DQRawDigits Class Reference

#include <DQRawDigits.h>

List of all members.

Public Member Functions

 DQRawDigits ()
 DQRawDigits (const DQRawDigits &rhs)
 ~DQRawDigits ()
void Process (RawDaqHeader *hdr)
void Process (RawDaqSnarlHeader *hdr)
void Process (RawDaqHeaderBlock *rdb)
void Process (RawSnarlHeaderBlock *rdb)
void Process (RawDigitDataBlock *rdb)
Int_t GetTime () const
Int_t GetTriggerTime () const
Int_t GetSnarl () const
Int_t GetPreTriggerDigits () const
Int_t GetPostTriggerDigits () const
Int_t GetSnarlMultiplicity () const
Int_t GetSnarlPassFail () const
Int_t GetLast () const
TObject * At (Int_t i) const

Private Member Functions

 ClassDef (DQRawDigits, 1)

Private Attributes

Int_t fTime
Int_t fBaseTime
Int_t fTriggerTime
Int_t fTriggerBaseTime
Int_t fSnarl
Int_t fPreTriggerDigits
Int_t fPostTriggerDigits
Int_t fSnarlMultiplicity
Int_t fSnarlPassFail
RawReadoutfRawReadout
TObjArray * fRawDigitsList
TObjArray * fReadoutErrorList
TObjArray * fReadoutBusyList

Detailed Description

Definition at line 20 of file DQRawDigits.h.


Constructor & Destructor Documentation

DQRawDigits::DQRawDigits (  ) 

Definition at line 15 of file DQRawDigits.cxx.

00015                          :
00016   fTime(-1), 
00017   fBaseTime(0),
00018   fTriggerTime(-99999),
00019   fTriggerBaseTime(0),
00020   fSnarl(-1),
00021   fPreTriggerDigits(0),
00022   fPostTriggerDigits(0), 
00023   fSnarlMultiplicity(0),
00024   fSnarlPassFail(0),
00025   fRawReadout(0), 
00026   fRawDigitsList(0),
00027   fReadoutErrorList(0),
00028   fReadoutBusyList(0)
00029 {
00030   fRawReadout = new RawReadout();
00031 
00032   fRawDigitsList = new TObjArray();
00033   fReadoutErrorList = new TObjArray();
00034   fReadoutBusyList = new TObjArray();
00035 }
 

DQRawDigits::DQRawDigits ( const DQRawDigits rhs  ) 

Definition at line 37 of file DQRawDigits.cxx.

00037                                                :
00038   TObject(rhs),
00039   fTime(rhs.fTime), 
00040   fBaseTime(rhs.fBaseTime),
00041   fTriggerTime(rhs.fTriggerTime), 
00042   fTriggerBaseTime(rhs.fTriggerBaseTime), 
00043   fSnarl(rhs.fSnarl),
00044   fPreTriggerDigits(rhs.fPreTriggerDigits),
00045   fPostTriggerDigits(rhs.fPostTriggerDigits),
00046   fSnarlMultiplicity(rhs.fSnarlMultiplicity),
00047   fSnarlPassFail(rhs.fSnarlPassFail),
00048   fRawReadout(rhs.fRawReadout),
00049   fRawDigitsList(rhs.fRawDigitsList),
00050   fReadoutErrorList(rhs.fReadoutErrorList),
00051   fReadoutBusyList(rhs.fReadoutBusyList)
00052 {
00053  
00054 }
   

DQRawDigits::~DQRawDigits (  ) 

Definition at line 56 of file DQRawDigits.cxx.

References fRawDigitsList, fRawReadout, fReadoutBusyList, and fReadoutErrorList.

00057 {
00058   delete fRawReadout;
00059 
00060   fReadoutErrorList->Delete();
00061   delete fReadoutErrorList;
00062 
00063   fReadoutBusyList->Delete();
00064   delete fReadoutBusyList;
00065 
00066   fRawDigitsList->Clear();
00067   delete fRawDigitsList;
00068 }


Member Function Documentation

TObject * DQRawDigits::At ( Int_t  i  )  const

Definition at line 370 of file DQRawDigits.cxx.

References fRawDigitsList.

Referenced by AlgDataQuality::RunAlg().

00371 {
00372   return (TObject*)(fRawDigitsList->At(i));
00373 }

DQRawDigits::ClassDef ( DQRawDigits  ,
 
) [private]
Int_t DQRawDigits::GetLast (  )  const

Definition at line 365 of file DQRawDigits.cxx.

References fRawDigitsList.

Referenced by Process(), and AlgDataQuality::RunAlg().

00366 {
00367   return fRawDigitsList->GetLast();
00368 }

Int_t DQRawDigits::GetPostTriggerDigits (  )  const [inline]

Definition at line 38 of file DQRawDigits.h.

References fPostTriggerDigits.

Referenced by AlgDataQuality::RunAlg().

00038 { return fPostTriggerDigits; }

Int_t DQRawDigits::GetPreTriggerDigits (  )  const [inline]

Definition at line 37 of file DQRawDigits.h.

References fPreTriggerDigits.

Referenced by AlgDataQuality::RunAlg().

00037 { return fPreTriggerDigits; }

Int_t DQRawDigits::GetSnarl (  )  const [inline]

Definition at line 36 of file DQRawDigits.h.

References fSnarl.

00036 { return fSnarl; }

Int_t DQRawDigits::GetSnarlMultiplicity (  )  const [inline]

Definition at line 39 of file DQRawDigits.h.

References fSnarlMultiplicity.

Referenced by AlgDataQuality::RunAlg().

00039 { return fSnarlMultiplicity; }

Int_t DQRawDigits::GetSnarlPassFail (  )  const [inline]

Definition at line 40 of file DQRawDigits.h.

References fSnarlPassFail.

Referenced by AlgDataQuality::RunAlg().

00040 { return fSnarlPassFail; }

Int_t DQRawDigits::GetTime (  )  const [inline]

Definition at line 34 of file DQRawDigits.h.

References fTime.

Referenced by AlgDataQuality::RunAlg().

00034 { return fTime; }

Int_t DQRawDigits::GetTriggerTime (  )  const [inline]

Definition at line 35 of file DQRawDigits.h.

References fTriggerTime.

00035 { return fTriggerTime; }

void DQRawDigits::Process ( RawDigitDataBlock rdb  ) 

Definition at line 115 of file DQRawDigits.cxx.

References RawChip::AddChannel(), fBaseTime, fPostTriggerDigits, fPreTriggerDigits, fRawDigitsList, fRawReadout, fReadoutBusyList, fReadoutErrorList, fSnarl, fSnarlMultiplicity, fSnarlPassFail, fTime, fTriggerBaseTime, fTriggerTime, RawDigitDataBlock::GetDatumIter(), VldContext::GetDetector(), RawChannelId::GetElecType(), GetLast(), RawChip::GetNanosec(), RawDigitDataBlock::GetNumberOfDigits(), RawChip::GetReadoutType(), RawReadout::GetReadoutType(), RawChip::GetTdc(), RawChip::GetVaPriority(), RawDigitDataBlock::GetVldContext(), RawChip::IsSameVaChip(), RawChip::IsSameVmm(), RawChip::kBusy, RawReadout::kDetector, RawChip::kError, Detector::kFar, Detector::kNear, ElecType::kQIE, ElecType::kVA, Msg::kVerbose, Msg::kWarning, MSG, and n.

00116 {
00117   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits::Process(RawDigitDataBlock) " << endl;
00118 
00119   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits [" << fSnarl << "] [" << fTime << "|" << fTriggerTime << "] [" << fBaseTime << "|" << fTriggerBaseTime << "]" << endl;
00120   MSG("DataQuality",Msg::kVerbose) << " Subtracted time (+" << fTime-fBaseTime << ",+" << fTriggerTime-fTriggerBaseTime << ")" << endl;
00121   MSG("DataQuality",Msg::kVerbose) << " Number of Raw Digits [" << rdb->GetNumberOfDigits() << "]" << endl;
00122 
00123   Int_t i,j,k;
00124   Int_t chid;
00125   
00126   VldContext vldc = (VldContext)(rdb->GetVldContext());
00127   
00128   fPreTriggerDigits = 0;
00129   fPostTriggerDigits = 0;
00130   fSnarlMultiplicity = 0;
00131   fSnarlPassFail = 0;
00132 
00133   // Reset the lists of busy/error chips
00134   fReadoutErrorList->Delete();
00135   fReadoutBusyList->Delete();
00136   fRawDigitsList->Clear();
00137 
00138   // Bail out of snarl if number of digits is too high
00139   if( vldc.GetDetector()==Detector::kFar
00140    && rdb->GetNumberOfDigits()>10000 ){
00141     fPreTriggerDigits = 0;
00142     fPostTriggerDigits = rdb->GetNumberOfDigits();
00143     fSnarlMultiplicity = rdb->GetNumberOfDigits();
00144     fSnarlPassFail = 0;
00145     MSG("DataQuality",Msg::kWarning) << " RAW DIGITS > 10,000, BAILING OUT !!! " << endl;
00146     return;
00147   }
00148 
00149   // Iterate over raw digits and record any pre-trigger 
00150   // hits along with any hits containing readout errors
00151   // ==================================================
00152   TIter digitr = rdb->GetDatumIter();
00153   while(RawDigit *rd = (RawDigit*)(digitr())){
00154     if(rd){
00155       RawChannelId rawch = (RawChannelId)(rd->GetChannel());
00156       
00157       Int_t adc = (Int_t)(rd->GetADC());
00158       Int_t tdc = (Int_t)(rd->GetTDC());
00159       Int_t errorcode = (Int_t)(rd->GetErrorCode());
00160       RawReadout::ReadoutType_t readout = fRawReadout->GetReadoutType(rawch);
00161 
00162       // Near Detector, QIE Electronics
00163       // ==============================
00164       if( vldc.GetDetector()==Detector::kNear
00165        && rawch.GetElecType()==ElecType::kQIE ){
00166 
00167         // Readout Errors
00168         if( errorcode>0 ){
00169           // (don't check for duplicates in ND)
00170           // chid=-1;
00171           // for(i=0;chid<0&&i<1+fReadoutErrorList->GetLast();i++){
00172           //   RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00173           //   if( chip->IsSameMenu(rawch) && chip->GetTdc()==tdc ) chid=i;
00174           // }
00175           RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kError,errorcode);
00176           fReadoutErrorList->Add(chip);
00177         }
00178 
00179         // Overflowing TDC values (TDC>TF+1ms)
00180         if( tdc>53100000+53100 ){
00181           // (don't check for duplicates in ND)
00182           // chid=-1;
00183           // for(i=0;chid<0&&i<1+fReadoutErrorList->GetLast();i++){
00184           //   RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00185           //   if( chip->IsSameMenu(rawch) && chip->GetTdc()==tdc ) chid=i;
00186           // }
00187           RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kError,errorcode);
00188           fReadoutErrorList->Add(chip);
00189         }
00190 
00191         // Pre-Trigger Hits
00192         if( fTime==fBaseTime
00193          && (Double_t)((1000.0/53.1)*(tdc+1.0))-(Double_t)(fTriggerTime-fTriggerBaseTime)<0.0 ){
00194           // (don't check for duplicates in ND)
00195           // chid=-1;
00196           // for(i=0;chid<0&&i<1+fReadoutBusyList->GetLast();i++){
00197           //   RawChip* chip = (RawChip*)(fReadoutBusyList->At(i));
00198           //   if( chip->IsSameMenu(rawch) && chip->GetTdc()==tdc ) chid=i;
00199           // }
00200           RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kBusy,0);
00201           fReadoutBusyList->Add(chip);
00202           fPreTriggerDigits++;
00203         }
00204         else{
00205           fPostTriggerDigits++;
00206           if( readout==RawReadout::kDetector ){
00207             fSnarlMultiplicity++;
00208           }
00209         }
00210       }
00211 
00212       // Far Detector, VA Electronics
00213       // ============================
00214       if( vldc.GetDetector()==Detector::kFar
00215        && rawch.GetElecType()==ElecType::kVA ){
00216 
00217         // Readout Errors
00218         if( errorcode>0 ){
00219           chid=-1;
00220           for(i=0;chid<0&&i<1+fReadoutErrorList->GetLast();i++){
00221             RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00222             if( chip->IsSameVaChip(rawch) && chip->GetTdc()==tdc ) chid=i;
00223           }
00224           if( chid<0 ){
00225             RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kError,errorcode);
00226             fReadoutErrorList->Add(chip);
00227           }
00228           else{
00229             RawChip* chip = (RawChip*)(fReadoutErrorList->At(chid));
00230             chip->AddChannel(rawch,adc,tdc,errorcode);
00231           }
00232         }
00233 
00234         // Overflowing TDC values (TDC>TF+1ms)
00235         if( tdc>640000000+640000 ){
00236           chid=-1;
00237           for(i=0;chid<0&&i<1+fReadoutErrorList->GetLast();i++){
00238             RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00239             if( chip->IsSameVaChip(rawch) && chip->GetTdc()==tdc ) chid=i;
00240           }
00241           if( chid<0 ){
00242             RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kError,errorcode);
00243             fReadoutErrorList->Add(chip);
00244           }
00245           else{
00246             RawChip* chip = (RawChip*)(fReadoutErrorList->At(chid));
00247             chip->AddChannel(rawch,adc,tdc,errorcode);
00248           }
00249         }
00250 
00251         // Pre-Trigger Hits
00252         if( fTime==fBaseTime
00253          && (Double_t)((1000.0/640.0)*(tdc+1.0))-(Double_t)(fTriggerTime-fTriggerBaseTime)<0.0 ){
00254           chid=-1;
00255           for(i=0;chid<0&&i<1+fReadoutBusyList->GetLast();i++){
00256             RawChip* chip = (RawChip*)(fReadoutBusyList->At(i));
00257             if( chip->IsSameVaChip(rawch) && chip->GetTdc()==tdc ) chid=i;
00258           }
00259           if( chid<0 ){
00260             RawChip* chip = new RawChip(rawch,adc,tdc,readout,RawChip::kBusy,0);
00261             fReadoutBusyList->Add(chip);
00262           }
00263           else{
00264             RawChip* chip = (RawChip*)(fReadoutBusyList->At(chid));
00265             chip->AddChannel(rawch,adc,tdc,errorcode);
00266           }
00267           fPreTriggerDigits++;
00268         }
00269         else{
00270           fPostTriggerDigits++;
00271           if( readout==RawReadout::kDetector ){
00272             fSnarlMultiplicity++;
00273           }
00274         }
00275       }
00276 
00277     }
00278   }
00279 
00280   // Now sort throught the list of pre-trigger hits 
00281   // to determine which chips were actually busy.
00282 
00283   // Far Detector, VA Electronics
00284   if( vldc.GetDetector()==Detector::kFar ){
00285 
00286     // Busy VA Electronics:
00287     // This assumes 2/36 VARC trigger in detector but not in shield.
00288     // The VARC-triggered hits are read out in the following order:
00289     //   (vaadc,vachip)=(0,0)->(0,1)->(0,2)->(1,0)->(1,1)->(1,2)
00290     // It's assumed that no triggered hits get sparsified away.
00291     // The parameters used are:
00292     //   VaTriggerTime = VA Trigger Window 
00293     //                  (1ns in shield, 400ns in detector)
00294     //   VaReadoutTime = VA Readout Time
00295     //                  (5000ns)
00296 
00297     Int_t n,ntmp;
00298     Int_t prehits[6];
00299     Int_t VaTriggerTime=400;
00300     Int_t VaReadoutTime=5000;
00301     
00302     for(i=0;i<1+fReadoutBusyList->GetLast();i++){
00303       RawChip* chip = (RawChip*)(fReadoutBusyList->At(i));
00304       
00305       n=0; 
00306       for(k=0;k<6;k++){ prehits[k]=0; }
00307       if( chip->GetReadoutType()==RawReadout::kDetector ) VaTriggerTime=400; 
00308       else VaTriggerTime=1;
00309       
00310       for(j=0;j<1+fReadoutBusyList->GetLast();j++){
00311         RawChip* prechip = (RawChip*)(fReadoutBusyList->At(j));
00312         if(chip->IsSameVmm(prechip)){
00313           if( prechip->GetNanosec()-chip->GetNanosec()<+VaTriggerTime
00314            && prechip->GetNanosec()-chip->GetNanosec()>=-VaTriggerTime
00315            && prechip->GetVaPriority()<=chip->GetVaPriority() ) n++;
00316           for(k=0;k<6;k++){
00317             if( prechip->GetNanosec()-chip->GetNanosec()<-VaTriggerTime
00318              && prechip->GetNanosec()-chip->GetNanosec()<-k*VaReadoutTime
00319              && prechip->GetNanosec()-chip->GetNanosec()>=-(k+1)*VaReadoutTime ) prehits[k]++;
00320           }
00321         }
00322       }
00323 
00324       for(j=0;j<6;j++){
00325         ntmp=0;
00326         for(k=0;k<j+1;k++){
00327           ntmp+=prehits[k];
00328         }
00329         if(ntmp>j) n+=ntmp;
00330       }
00331 
00332       if( chip->GetNanosec()-fTriggerTime>-n*VaReadoutTime ){
00333         fRawDigitsList->Add(chip);
00334       }
00335     }
00336 
00337     // VA Readout Errors
00338     for(i=0;i<1+fReadoutErrorList->GetLast();i++){
00339       RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00340       fRawDigitsList->Add(chip);
00341     }
00342 
00343   }
00344 
00345   // Near Detector, QIE Electronics
00346   if( vldc.GetDetector()==Detector::kNear ){
00347 
00348     // Busy QIE Electronics:
00349     // assume it's deadtime-less for now
00350 
00351     // QIE Readout Errors
00352     for(i=0;i<1+fReadoutErrorList->GetLast();i++){
00353       RawChip* chip = (RawChip*)(fReadoutErrorList->At(i));
00354       fRawDigitsList->Add(chip);
00355     }
00356   }
00357 
00358   // Reached the end of the snarl okay
00359   fSnarlPassFail=1;
00360 
00361   MSG("DataQuality",Msg::kVerbose) << " Found " << 1+this->GetLast() << " bad chips " << endl;
00362 
00363 }

void DQRawDigits::Process ( RawSnarlHeaderBlock rdb  ) 

Definition at line 103 of file DQRawDigits.cxx.

References fBaseTime, fSnarl, fSnarlPassFail, fTime, fTriggerBaseTime, fTriggerTime, VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), RawSnarlHeaderBlock::GetSnarl(), RawSnarlHeaderBlock::GetTriggerTime(), Msg::kVerbose, and MSG.

00104 {
00105   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits::Process(RawSnarlHeaderBlock) " << endl;
00106 
00107   fTime = rdb->GetTriggerTime().GetSec();
00108   fTriggerTime = rdb->GetTriggerTime().GetNanoSec();
00109   fSnarl = rdb->GetSnarl();
00110   fSnarlPassFail = 0;
00111   
00112   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits [" << fSnarl << "] [" << fTime << "|" << fTriggerTime << "] [" << fBaseTime << "|" << fTriggerBaseTime << "]" << endl;
00113 }

void DQRawDigits::Process ( RawDaqHeaderBlock rdb  ) 

Definition at line 88 of file DQRawDigits.cxx.

References fBaseTime, fSnarl, fSnarlPassFail, fTime, fTriggerBaseTime, fTriggerTime, VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), VldContext::GetTimeStamp(), RawDaqHeaderBlock::GetVldContext(), Msg::kVerbose, and MSG.

00089 {
00090   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits::Process(RawDaqHeaderBlock) " << endl;  
00091 
00092   fTime = -1;
00093   fTriggerTime = -99999;
00094   fSnarl = -1;
00095   fSnarlPassFail = 0;
00096 
00097   fBaseTime = hdr->GetVldContext().GetTimeStamp().GetSec();
00098   fTriggerBaseTime = hdr->GetVldContext().GetTimeStamp().GetNanoSec();
00099 
00100   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits [" << fSnarl << "] [" << fTime << "|" << fTriggerTime << "] [" << fBaseTime << "|" << fTriggerBaseTime << "]" << endl;
00101 }

void DQRawDigits::Process ( RawDaqSnarlHeader hdr  ) 

Definition at line 76 of file DQRawDigits.cxx.

References fBaseTime, fSnarl, fSnarlPassFail, fTime, fTriggerBaseTime, fTriggerTime, VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), RawDaqSnarlHeader::GetSnarl(), VldContext::GetTimeStamp(), RecMinosHdr::GetVldContext(), Msg::kVerbose, and MSG.

00077 {
00078   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits::Process(RawDaqSnarlHeader) " << endl;
00079 
00080   fTime = hdr->GetVldContext().GetTimeStamp().GetSec();
00081   fTriggerTime = hdr->GetVldContext().GetTimeStamp().GetNanoSec();
00082   fSnarl = hdr->GetSnarl();
00083   fSnarlPassFail = 0;
00084 
00085   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits [" << fSnarl << "] [" << fTime << "|" << fTriggerTime << "] [" << fBaseTime << "|" << fTriggerBaseTime << "]" << endl;
00086 }

void DQRawDigits::Process ( RawDaqHeader hdr  ) 

Definition at line 70 of file DQRawDigits.cxx.

References Msg::kVerbose, and MSG.

Referenced by DataQualityReader::ProcessBlock(), and DataQualityReader::ProcessHeader().

00071 {
00072   MSG("DataQuality",Msg::kVerbose) << " DQRawDigits::Process(RawDaqHeader) " << endl;  
00073 
00074 }


Member Data Documentation

Int_t DQRawDigits::fBaseTime [private]

Definition at line 48 of file DQRawDigits.h.

Referenced by Process().

Definition at line 54 of file DQRawDigits.h.

Referenced by GetPostTriggerDigits(), and Process().

Definition at line 53 of file DQRawDigits.h.

Referenced by GetPreTriggerDigits(), and Process().

TObjArray* DQRawDigits::fRawDigitsList [private]

Definition at line 60 of file DQRawDigits.h.

Referenced by At(), GetLast(), Process(), and ~DQRawDigits().

Definition at line 58 of file DQRawDigits.h.

Referenced by Process(), and ~DQRawDigits().

TObjArray* DQRawDigits::fReadoutBusyList [private]

Definition at line 63 of file DQRawDigits.h.

Referenced by Process(), and ~DQRawDigits().

TObjArray* DQRawDigits::fReadoutErrorList [private]

Definition at line 62 of file DQRawDigits.h.

Referenced by Process(), and ~DQRawDigits().

Int_t DQRawDigits::fSnarl [private]

Definition at line 52 of file DQRawDigits.h.

Referenced by GetSnarl(), and Process().

Definition at line 55 of file DQRawDigits.h.

Referenced by GetSnarlMultiplicity(), and Process().

Int_t DQRawDigits::fSnarlPassFail [private]

Definition at line 56 of file DQRawDigits.h.

Referenced by GetSnarlPassFail(), and Process().

Int_t DQRawDigits::fTime [private]

Definition at line 47 of file DQRawDigits.h.

Referenced by GetTime(), and Process().

Definition at line 50 of file DQRawDigits.h.

Referenced by Process().

Int_t DQRawDigits::fTriggerTime [private]

Definition at line 49 of file DQRawDigits.h.

Referenced by GetTriggerTime(), and Process().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1