#include <RawLiTpmtDigitsBlock.h>
Inheritance diagram for RawLiTpmtDigitsBlock:

Public Member Functions | |
| RawLiTpmtDigitsBlock () | |
| RawLiTpmtDigitsBlock (const Int_t *block) | |
| virtual | ~RawLiTpmtDigitsBlock () |
| Int_t | GetRun () const |
| Short_t | GetSubRun () const |
| Short_t | GetRunType () const |
| VldTimeStamp | GetTimeStamp () const |
| VldContext | GetVldContext () const |
| Int_t | GetTimeFrameNum () const |
| const RawDigitCrateStatus * | GetCrateStatus () const |
| ElecType::Elec_t | GetElecType () const |
| Int_t | GetNumberOfDigits () const |
| const RawDigit * | At (Int_t idx) const |
| virtual TIter | GetDatumIter (Bool_t dir=kIterForward) const |
| Int_t | IndexOf (RawDigit *rawdigit) const |
| virtual std::ostream & | FormatToOStream (std::ostream &os, Option_t *option="") const |
| RawLiTpmtDigitsBlock (const RawLiTpmtDigitsBlock &rhs) | |
| RawLiTpmtDigitsBlock & | operator= (const RawLiTpmtDigitsBlock &rhs) |
Static Public Member Functions | |
| static void | SetDebugFlags (const UInt_t dbgflgs) |
| static UInt_t | GetDebugFlags () |
Protected Member Functions | |
| virtual void | FillRawDigits () const |
Protected Attributes | |
| RawDigitCrateStatus * | fRawCrateStatus |
| TObjArray * | fRawDigits |
| not written out | |
Static Private Attributes | |
| static UInt_t | fgDebugFlags = 0 |
| not written out | |
Definition at line 24 of file RawLiTpmtDigitsBlock.h.
| RawLiTpmtDigitsBlock::RawLiTpmtDigitsBlock | ( | ) |
Definition at line 54 of file RawLiTpmtDigitsBlock.cxx.
00055 : fRawCrateStatus(0), fRawDigits(0) 00056 { 00057 // Default constructor 00058 }
| RawLiTpmtDigitsBlock::RawLiTpmtDigitsBlock | ( | const Int_t * | block | ) |
Definition at line 61 of file RawLiTpmtDigitsBlock.cxx.
00062 : RawDataBlock(block), fRawCrateStatus(0), fRawDigits(0) 00063 { 00064 // stored block format is: 00065 //--------------------- 00066 // 0 # words in block 00067 // 1 checksum 00068 // 2 Block Id 00069 //----- 00070 // 3 Run Number 00071 // 4 SubRun | RunType 00072 // 5 Time (sec) 00073 // 6 Time (ns) 00074 // 7 CrateId (+ special bits) TimeFrame # (v1) 00075 // 8 TimeFrame # CrateId (v1) 00076 // 8 # of digits to follow 00077 // ... packed two 32-bit words per digit 00078 00079 }
| RawLiTpmtDigitsBlock::~RawLiTpmtDigitsBlock | ( | ) | [virtual] |
Definition at line 82 of file RawLiTpmtDigitsBlock.cxx.
References fRawCrateStatus, and fRawDigits.
00083 { 00084 // dtor 00085 if ( fRawDigits ) { 00086 fRawDigits->Delete(); 00087 delete fRawDigits; 00088 fRawDigits = 0; 00089 } 00090 if ( fRawCrateStatus ) { 00091 delete fRawCrateStatus; 00092 fRawCrateStatus = 0; 00093 } 00094 00095 }
| RawLiTpmtDigitsBlock::RawLiTpmtDigitsBlock | ( | const RawLiTpmtDigitsBlock & | rhs | ) | [inline] |
Definition at line 58 of file RawLiTpmtDigitsBlock.h.
00059 : RawDataBlock(rhs), fRawCrateStatus(0), fRawDigits(0) { ; }
| const RawDigit * RawLiTpmtDigitsBlock::At | ( | Int_t | idx | ) | const |
Definition at line 215 of file RawLiTpmtDigitsBlock.cxx.
References FillRawDigits(), and fRawDigits.
Referenced by FarDetTpSinglesDump::Ana(), FarDetRawRateDump::Ana(), FarDetRawDigitDump::Ana(), DQLightInjection::Process(), and FarDetDataQualityModule::ProcessBlock().
00216 { 00217 // create/fill the TObjArray of RawDigits (if it doesn't exist) 00218 // return pointer to the i-th element 00219 00220 if ( ! fRawDigits ) FillRawDigits(); 00221 return (RawDigit*) fRawDigits->At(idx); 00222 }
| void RawLiTpmtDigitsBlock::FillRawDigits | ( | ) | const [protected, virtual] |
Definition at line 245 of file RawLiTpmtDigitsBlock.cxx.
References Detector::AsString(), ElecType::AsString(), SimFlag::AsString(), RawBlockId::AsString(), dbg_DumpCrateOnUnpack, dbg_DumpDigitOnUnpack, dbg_DumpHeaderOnUnpack, fgDebugFlags, RawDataBlock::fRawBlock, fRawCrateStatus, fRawDigits, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), RawCrateStatus::GetElecType(), RawCrateStatus::GetEntries(), RawDataBlock::GetMinorId(), RawBlockId::GetSimFlag(), GetTimeStamp(), indx_crateid, indx_crateid_v1, SimFlag::kDaqFakeData, SimFlag::kData, Msg::kError, Msg::kInfo, SimFlag::kMC, Detector::kNear, ElecType::kQIE, ElecType::kReroot, SimFlag::kReroot, SimFlag::kUnknown, ElecType::kVA, Msg::kWarning, MSG, RawDigit::Print(), and RawCrateStatus::Print().
Referenced by At(), GetCrateStatus(), GetDatumIter(), GetNumberOfDigits(), and IndexOf().
00246 { 00247 // create the TObjArray of RawDigit (if it doesn't exist) 00248 00249 if ( fRawDigits ) return; // already filled 00250 if ( fSize <= 0 || fRawBlock == 0) { 00251 MSG("RawData",Msg::kWarning) 00252 << "RawLiTpmtDigitsBlock::FillRawDigits empty block? " 00253 << fSize << " " << fRawBlock << endl; 00254 return; 00255 } 00256 00257 fRawDigits = new TObjArray(); 00258 RawDigit *rawdigit = 0; 00259 const Int_t *p = fRawBlock; 00260 const Int_t *end = fRawBlock + fSize; // 1 beyond end 00261 00262 int minorId = GetMinorId(); 00263 RawBlockId rbid = GetBlockId(); 00264 // skip #words, blockid and checksum, etc 00265 p += ( (minorId<=1) ? indx_crateid_v1 : indx_crateid ); 00266 00267 if (fgDebugFlags&dbg_DumpHeaderOnUnpack) { 00268 MSG("RawData",Msg::kInfo) 00269 << "RawLiTpmtDigitsBlock::FillRawDigits " 00270 << " fSize " << fSize 00271 << " id " << rbid.AsString() 00272 << endl; 00273 } 00274 00275 // unpack crate info 00276 // version >1 has TF word between crateId and # of entries 00277 Bool_t skipTFword = ( minorId > 1 ); 00278 fRawCrateStatus = 00279 new RawDigitCrateStatus(rbid,p,GetTimeStamp(),skipTFword); 00280 Int_t npairs = fRawCrateStatus->GetEntries(); 00281 if (fgDebugFlags&dbg_DumpCrateOnUnpack) fRawCrateStatus->Print(); 00282 00283 while (p<end) { 00284 00285 for (Int_t ipair = 0; ipair < npairs; ipair++) { 00286 // assume that the readout type is consistent for whole crate 00287 // and that the status block knows what it is 00288 ElecType::Elec_t etype = fRawCrateStatus->GetElecType(); 00289 00290 // pointer is advanced by RawDigit ctor 00291 // knowing how many words it needed to eat 00292 switch (rbid.GetSimFlag()) { 00293 case SimFlag::kData: 00294 case SimFlag::kDaqFakeData: 00295 switch (etype) { 00296 case ElecType::kVA: 00297 rawdigit = new RawVaDigit(p,fRawCrateStatus); 00298 break; 00299 case ElecType::kQIE: 00300 rawdigit = new RawQieDigit(p,fRawCrateStatus); 00301 break; 00302 default: 00303 rawdigit = new RawDigit(p,fRawCrateStatus); 00304 break; 00305 } 00306 break; 00307 case SimFlag::kMC: 00308 case SimFlag::kReroot: 00309 switch (etype) { 00310 case ElecType::kVA: 00311 rawdigit = new RawVaMCDigit(p,fRawCrateStatus); 00312 break; 00313 case ElecType::kQIE: 00314 rawdigit = new RawQieMCDigit(p,fRawCrateStatus); 00315 break; 00316 case ElecType::kReroot: 00317 { 00318 if (rbid.GetDetector() == Detector::kNear) { 00319 static int nmsg = 10; 00320 if (nmsg) { 00321 MSG("RawData",Msg::kWarning) 00322 << "RawLiTpmtDigitsBlock::FillRawDigits SimFlag " 00323 << SimFlag::AsString(rbid.GetSimFlag()) 00324 << " ElecType " << ElecType::AsString(etype) 00325 << " in Detector " 00326 << Detector::AsString(rbid.GetDetector()) 00327 << endl 00328 << " treat as kQIE for RawQieMCDigit creation" 00329 << endl; 00330 if (nmsg) { 00331 if (--nmsg == 0) 00332 MSG("RawData",Msg::kWarning) 00333 << " ... last warning of this type" << endl; 00334 } 00335 } 00336 rawdigit = new RawQieMCDigit(p,fRawCrateStatus); 00337 break; 00338 } 00339 else 00340 MSG("RawData",Msg::kError) 00341 << "RawLiTpmtDigitsBlock::FillRawDigits SimFlag " 00342 << SimFlag::AsString(rbid.GetSimFlag()) 00343 << " ElecType " << ElecType::AsString(etype) 00344 << endl << " attempt to move past problem " << endl; 00345 p += 3; 00346 break; 00347 } 00348 default: 00349 MSG("RawData",Msg::kError) 00350 << "RawLiTpmtDigitsBlock::FillRawDigits SimFlag " 00351 << SimFlag::AsString(rbid.GetSimFlag()) 00352 << " ElecType " << ElecType::AsString(etype) 00353 << endl << " attempt to move past problem " << endl; 00354 p += 3; 00355 break; 00356 } 00357 break; 00358 case SimFlag::kUnknown: 00359 MSG("RawData",Msg::kError) 00360 << "RawLiTpmtDigitsBlock::FillRawDigits SimFlag " 00361 << SimFlag::AsString(rbid.GetSimFlag()) 00362 << endl << " attempt to move past problem " << endl; 00363 p += 2; 00364 break; 00365 } 00366 00367 fRawDigits->Add(rawdigit); 00368 00369 if (fgDebugFlags&dbg_DumpDigitOnUnpack) { 00370 rawdigit->Print(); cout << endl; 00371 } 00372 if (p>end) { 00373 MSG("RawData",Msg::kWarning) 00374 << "RawLiTpmtDigitsBlock::FillRawDigits crate info seems trashed" 00375 << endl << " SimFlag " << SimFlag::AsString(rbid.GetSimFlag()) 00376 << " ElecType " << ElecType::AsString(etype) 00377 << endl; 00378 break; 00379 } 00380 } 00381 } 00382 00383 }
| std::ostream & RawLiTpmtDigitsBlock::FormatToOStream | ( | std::ostream & | os, | |
| Option_t * | option = "" | |||
| ) | const [virtual] |
Reimplemented from RawDataBlock.
Definition at line 114 of file RawLiTpmtDigitsBlock.cxx.
References VldTimeStamp::AsString(), RawDataBlock::FormatToOStream(), GetCrateStatus(), GetDatumIter(), GetNumberOfDigits(), GetRun(), GetRunType(), GetSubRun(), GetTimeFrameNum(), and GetTimeStamp().
00116 { 00117 RawDataBlock::FormatToOStream(os,option); 00118 if (option[0] == 'X') return os; 00119 00120 // additional block specific formatted output is done here 00121 00122 os << " TimeStamp " << GetTimeStamp().AsString("c") << endl; 00123 os << " Run " << GetRun() 00124 << " SubRun " << GetSubRun() 00125 << " RunType " << GetRunType() 00126 << " TimeFrame " << GetTimeFrameNum() 00127 << " with " << GetNumberOfDigits() << " digits " 00128 << endl; 00129 os << " " << *GetCrateStatus() << endl; 00130 00131 if (strchr(option,'q') != 0) return os; 00132 00133 TIter iter = GetDatumIter(); 00134 TObject *tobj; 00135 RawDigit *udigit; 00136 while ( ( tobj = iter.Next() ) ) { 00137 udigit = dynamic_cast<RawDigit *>(tobj); 00138 if (udigit) os << " " << (*udigit) << endl; 00139 } 00140 os << endl; 00141 return os; 00142 }
| const RawDigitCrateStatus * RawLiTpmtDigitsBlock::GetCrateStatus | ( | ) | const |
Definition at line 198 of file RawLiTpmtDigitsBlock.cxx.
References FillRawDigits(), fRawCrateStatus, and fRawDigits.
Referenced by FormatToOStream(), and GetElecType().
00199 { 00200 // get the crate id --> status 00201 if ( ! fRawDigits ) FillRawDigits(); 00202 return fRawCrateStatus; 00203 00204 }
| TIter RawLiTpmtDigitsBlock::GetDatumIter | ( | Bool_t | dir = kIterForward |
) | const [virtual] |
Definition at line 225 of file RawLiTpmtDigitsBlock.cxx.
References FillRawDigits(), and fRawDigits.
Referenced by FormatToOStream().
00226 { 00227 // create/fill the TObjArray of RawDigits (if it doesn't exist) 00228 // return an iterator to look over them 00229 00230 if ( ! fRawDigits ) FillRawDigits(); 00231 return TIter(fRawDigits,dir); 00232 }
| static UInt_t RawLiTpmtDigitsBlock::GetDebugFlags | ( | ) | [inline, static] |
Definition at line 55 of file RawLiTpmtDigitsBlock.h.
References fgDebugFlags.
00055 { return fgDebugFlags; }
| ElecType::Elec_t RawLiTpmtDigitsBlock::GetElecType | ( | ) | const [inline] |
Definition at line 40 of file RawLiTpmtDigitsBlock.h.
References GetCrateStatus(), and RawCrateStatus::GetElecType().
00041 { return GetCrateStatus()->GetElecType(); }
| Int_t RawLiTpmtDigitsBlock::GetNumberOfDigits | ( | ) | const |
Definition at line 207 of file RawLiTpmtDigitsBlock.cxx.
References FillRawDigits(), and fRawDigits.
Referenced by FarDetTpSinglesDump::Ana(), FarDetRawRateDump::Ana(), FarDetRawDigitDump::Ana(), FormatToOStream(), DQLightInjection::Process(), and FarDetDataQualityModule::ProcessBlock().
00208 { 00209 // get the number of digits 00210 if ( ! fRawDigits ) FillRawDigits(); 00211 return fRawDigits->GetEntriesFast(); // known not to have gaps 00212 }
| Int_t RawLiTpmtDigitsBlock::GetRun | ( | ) | const |
Definition at line 145 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_run.
Referenced by FormatToOStream().
00146 { 00147 // get the run number 00148 if (fSize > indx_run) return fRawBlock[indx_run]; 00149 return -1; 00150 }
| Short_t RawLiTpmtDigitsBlock::GetRunType | ( | ) | const |
Definition at line 161 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_runtype.
Referenced by FormatToOStream().
00162 { 00163 // get the run type 00164 if (fSize > indx_runtype) return fRawBlock[indx_runtype]&0xffff; 00165 return -1; 00166 }
| Short_t RawLiTpmtDigitsBlock::GetSubRun | ( | ) | const |
Definition at line 153 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_subrun.
Referenced by FormatToOStream().
00154 { 00155 // get the subrun number 00156 if (fSize > indx_subrun) return (fRawBlock[indx_subrun]>>16)&0xffff; 00157 return -1; 00158 }
| Int_t RawLiTpmtDigitsBlock::GetTimeFrameNum | ( | ) | const |
Definition at line 188 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetMinorId(), indx_tf, and indx_tf_v1.
Referenced by FormatToOStream().
00189 { 00190 // get the time frame # 00191 int indx_tf_v = indx_tf; 00192 if (GetMinorId() <= 1) indx_tf_v = indx_tf_v1; 00193 if (fSize >= indx_tf_v) return fRawBlock[indx_tf_v]; 00194 return -1; 00195 }
| VldTimeStamp RawLiTpmtDigitsBlock::GetTimeStamp | ( | ) | const |
Definition at line 169 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_loadnsec, indx_loadsec, and zzzz_last.
Referenced by FillRawDigits(), FormatToOStream(), and GetVldContext().
00170 { 00171 // get the start time 00172 if (fSize >= zzzz_last) 00173 return VldTimeStamp(fRawBlock[indx_loadsec],fRawBlock[indx_loadnsec]); 00174 00175 return VldTimeStamp((time_t)0,(Int_t)0); 00176 }
| VldContext RawLiTpmtDigitsBlock::GetVldContext | ( | ) | const |
Definition at line 179 of file RawLiTpmtDigitsBlock.cxx.
References RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), RawBlockId::GetSimFlag(), and GetTimeStamp().
Referenced by DQLightInjection::Process().
00180 { 00181 // get a VldContext 00182 00183 RawBlockId rbid = GetBlockId(); 00184 return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp()); 00185 }
| Int_t RawLiTpmtDigitsBlock::IndexOf | ( | RawDigit * | rawdigit | ) | const |
Definition at line 235 of file RawLiTpmtDigitsBlock.cxx.
References FillRawDigits(), and fRawDigits.
00236 { 00237 // create/fill the TObjArray of RawDigits (if it doesn't exist) 00238 // return the index for this object (if contained in the list) 00239 00240 if ( ! fRawDigits ) FillRawDigits(); 00241 return fRawDigits->IndexOf(rawdigit); 00242 }
| RawLiTpmtDigitsBlock & RawLiTpmtDigitsBlock::operator= | ( | const RawLiTpmtDigitsBlock & | rhs | ) |
Definition at line 98 of file RawLiTpmtDigitsBlock.cxx.
References fRawCrateStatus, fRawDigits, and RawDataBlock::operator=().
00099 { 00100 // deep copy assignment 00101 if (this != &rhs) { 00102 RawDataBlock::operator=(rhs); 00103 if (fRawCrateStatus) { delete fRawCrateStatus; fRawCrateStatus = 0; } 00104 if (fRawDigits) { 00105 fRawDigits->Delete(); 00106 delete fRawDigits; 00107 fRawDigits = 0; 00108 } 00109 } 00110 return *this; 00111 }
| static void RawLiTpmtDigitsBlock::SetDebugFlags | ( | const UInt_t | dbgflgs | ) | [inline, static] |
Definition at line 54 of file RawLiTpmtDigitsBlock.h.
References fgDebugFlags.
00054 {fgDebugFlags=dbgflgs;}
UInt_t RawLiTpmtDigitsBlock::fgDebugFlags = 0 [static, private] |
not written out
Definition at line 75 of file RawLiTpmtDigitsBlock.h.
Referenced by FillRawDigits(), GetDebugFlags(), and SetDebugFlags().
RawDigitCrateStatus* RawLiTpmtDigitsBlock::fRawCrateStatus [mutable, protected] |
Definition at line 69 of file RawLiTpmtDigitsBlock.h.
Referenced by FillRawDigits(), GetCrateStatus(), operator=(), and ~RawLiTpmtDigitsBlock().
TObjArray* RawLiTpmtDigitsBlock::fRawDigits [mutable, protected] |
not written out
Definition at line 70 of file RawLiTpmtDigitsBlock.h.
Referenced by At(), FillRawDigits(), GetCrateStatus(), GetDatumIter(), GetNumberOfDigits(), IndexOf(), operator=(), and ~RawLiTpmtDigitsBlock().
1.4.7