Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DQLightInjection.cxx

Go to the documentation of this file.
00001 #include "DQLightInjection.h"
00002 #include "RawChip.h"
00003 
00004 #include "RawData/RawDigit.h"
00005 #include "MessageService/MsgService.h"
00006  
00007 //
00008 // $Log $
00009 //
00010 
00011 ClassImp(DQLightInjection)
00012 
00013 CVSID("$Id: DQLightInjection.cxx,v 1.2 2006/11/15 11:02:02 blake Exp $");
00014 
00015 DQLightInjection::DQLightInjection() :
00016   fTime(-1),
00017   fCalibPoint(-1), 
00018   fCalibType(-1),
00019   fPulserBox(-1), 
00020   fPulserLed(-1),
00021   fPulseHeight(-1), 
00022   fPulseWidth(-1),
00023   fRawReadout(0), 
00024   fTpmtHitList(0)
00025 {
00026   fRawReadout = new RawReadout();
00027   
00028   fTpmtHitList = new TObjArray(); 
00029 }
00030  
00031 DQLightInjection::DQLightInjection(const DQLightInjection& rhs) :
00032   TObject(rhs),
00033   fTime(rhs.fTime),
00034   fCalibPoint(rhs.fCalibPoint), 
00035   fCalibType(rhs.fCalibType),
00036   fPulserBox(rhs.fPulserBox), 
00037   fPulserLed(rhs.fPulserLed),
00038   fPulseHeight(rhs.fPulseHeight), 
00039   fPulseWidth(rhs.fPulseWidth),
00040   fRawReadout(rhs.fRawReadout),
00041   fTpmtHitList(rhs.fTpmtHitList)
00042 {
00043   
00044 }
00045    
00046 DQLightInjection::~DQLightInjection()
00047 {
00048   delete fRawReadout;
00049 
00050   fTpmtHitList->Delete();
00051   delete fTpmtHitList;
00052 }
00053 
00054 void DQLightInjection::Process(RawLIAdcSummaryBlock* rdb)
00055 {
00056   MSG("DataQuality",Msg::kVerbose) << " DQLightInjection::Process(RawLIAdcSummaryBlock) " << endl;
00057 
00058   fTime=rdb->GetVldContext().GetTimeStamp().GetSec();
00059   fCalibPoint=rdb->GetCalibPoint();
00060   fCalibType=rdb->GetCalibType();
00061   fPulserBox=rdb->GetPulserBox();
00062   fPulserLed=rdb->GetLed();
00063   fPulseHeight=rdb->GetPulseHeight();
00064   fPulseWidth=rdb->GetPulseWidth();
00065 
00066   MSG("DataQuality",Msg::kVerbose) << "   Time=" << fTime << endl;
00067   MSG("DataQuality",Msg::kVerbose) << "   CalibPoint=" << fCalibPoint << endl;
00068   MSG("DataQuality",Msg::kVerbose) << "   CalibType=" << fCalibType << endl;
00069   MSG("DataQuality",Msg::kVerbose) << "   PulserBox=" << fPulserBox << endl;
00070   MSG("DataQuality",Msg::kVerbose) << "   PulserLed=" << fPulserLed << endl;
00071   MSG("DataQuality",Msg::kVerbose) << "   PulseHeight=" << fPulseHeight << endl;
00072   MSG("DataQuality",Msg::kVerbose) << "   PulseWidth=" << fPulseWidth << endl;
00073   
00074 }
00075 
00076 void DQLightInjection::Process(RawLiTpmtDigitsBlock* rdb)
00077 {
00078   MSG("DataQuality",Msg::kVerbose) << " DQLightInjection::Process(RawLiTpmtDigitsBlock) " << endl;
00079 
00080   Int_t n;
00081   Int_t time;
00082   Int_t adc;
00083   Int_t pulserbox;
00084   Int_t maxadc = -1;
00085   Int_t maxpulserbox = -1;
00086 
00087   VldContext vldc = (VldContext)(rdb->GetVldContext()); 
00088   time=vldc.GetTimeStamp().GetSec();
00089 
00090   if(time!=fTime){
00091     fTime=time;
00092     fCalibPoint=-1;
00093     fCalibType=-1;
00094     fPulserBox=-1;
00095     fPulserLed=-1;
00096     fPulseHeight=-1;
00097     fPulseWidth=-1;
00098   }
00099 
00100   // reset the list of TPMT hits
00101   fTpmtHitList->Delete();
00102   
00103   // iterate over raw TPMT hits
00104   // (pulser box is given by hit with largest adc)
00105   for(n=0;n<rdb->GetNumberOfDigits();n++){
00106     RawDigit* rd = (RawDigit*)(rdb->At(n));
00107     if( rd ){
00108       RawChannelId rawch = (RawChannelId)(rd->GetChannel());   
00109 
00110       if( vldc.GetDetector()==Detector::kNear
00111        && rawch.GetElecType()==ElecType::kQIE ){
00112         adc = rd->GetADC();
00113         pulserbox = fRawReadout->GetPulserBox(rawch);
00114         if( (maxpulserbox<0)
00115          || (pulserbox>=0 && adc>maxadc) ){
00116           maxadc=adc; maxpulserbox=pulserbox; }
00117         RawChip* tpmt = new RawChip(rawch,rd->GetADC(),rd->GetTDC(),RawReadout::kTpmt,RawChip::kGood,0);
00118         fTpmtHitList->Add(tpmt);
00119       }
00120 
00121       if( vldc.GetDetector()==Detector::kFar
00122        && rawch.GetElecType()==ElecType::kVA ){
00123         adc = rd->GetADC();
00124         pulserbox = fRawReadout->GetPulserBox(rawch);
00125         if( (maxpulserbox<0)
00126          || (pulserbox>=0 && adc>maxadc) ){
00127           maxadc=adc; maxpulserbox=pulserbox; }
00128         RawChip* tpmt = new RawChip(rawch,rd->GetADC(),rd->GetTDC(),RawReadout::kTpmt,RawChip::kGood,0);
00129         fTpmtHitList->Add(tpmt);
00130       }
00131 
00132     }
00133   }
00134 
00135   if(maxpulserbox>-1 && maxpulserbox!=fPulserBox){
00136     MSG("DataQuality",Msg::kVerbose) << " Pulser Box: " << maxpulserbox << " Adc: " << maxadc << endl;
00137     MSG("DataQuality",Msg::kVerbose) << " Overwritten Pulser Box: " << fPulserBox << " -> " << maxpulserbox << endl;
00138     fPulserBox=maxpulserbox;
00139   }
00140 
00141   MSG("DataQuality",Msg::kVerbose) << " Found " << 1+this->GetLast() << " Tpmt Hits" << endl;
00142 
00143 }
00144 
00145 Int_t DQLightInjection::GetLast() const
00146 {
00147   return fTpmtHitList->GetLast();
00148 }
00149   
00150 TObject* DQLightInjection::At(Int_t i) const
00151 {
00152   return (TObject*)(fTpmtHitList->At(i));
00153 }

Generated on Mon Feb 15 11:06:38 2010 for loon by  doxygen 1.3.9.1