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

Public Member Functions | |
| RawQieDataBlock () | |
| RawQieDataBlock (const Int_t *block) | |
| virtual | ~RawQieDataBlock () |
| Int_t | GetRun () const |
| Short_t | GetSubRun () const |
| Short_t | GetRunType () const |
| VldTimeStamp | GetTimeStamp () const |
| Detector::Detector_t | GetDetector () const |
| ElecType::Elec_t | GetElecType () const |
| Bool_t | GetPedMode () const |
| Bool_t | GetSparsMode () const |
| Bool_t | GetCommonMode () const |
| UShort_t | GetCrate () const |
| Int_t | GetCrateIdInfo () const |
| Int_t | GetTimeFrameNum () const |
| UInt_t | GetNumLocations () const |
| UInt_t | GetLocation (UInt_t indx) const |
| UInt_t | GetNumPoints (UInt_t loc) const |
| UInt_t | GetNumEntries (UInt_t loc, UInt_t ipt) const |
| Int_t | GetRange (UInt_t loc, UInt_t ipt) const |
| Double_t | GetMean (UInt_t loc, UInt_t ipt) const |
| Double_t | GetRms (UInt_t loc, UInt_t ipt) const |
| UInt_t | GetSum (UInt_t loc, UInt_t ipt) const |
| UInt_t | GetSumSqr (UInt_t loc, UInt_t ipt) const |
| Double_t | GetMean (UInt_t loc) const |
| Double_t | GetRms (UInt_t loc) const |
| Int_t | GetTimeFrameNo () const |
| virtual std::ostream & | FormatToOStream (std::ostream &os, Option_t *option="") const |
| RawQieDataBlock (const RawQieDataBlock &rhs) | |
| RawQieDataBlock & | operator= (const RawQieDataBlock &rhs) |
Static Public Member Functions | |
| void | SetDebugFlags (const UInt_t dbgflgs) |
| UInt_t | GetDebugFlags () |
Protected Member Functions | |
| void | FillCrateId () const |
| UInt_t | FillLocStart () const |
| const Int_t * | StartOfLocPoint (UInt_t loc, UInt_t ipt) const |
Protected Attributes | |
| std::vector< UInt_t > | fLocation |
| std::map< UInt_t, const Int_t * > | fLocStart |
| list of locations | |
| RawChannelId | fCrateId |
| where sub-block starts | |
Static Private Attributes | |
| UInt_t | fgDebugFlags = 0 |
| unpacked crateinfo | |
|
|
Definition at line 55 of file RawQieDataBlock.cxx. 00056 : RawDataBlock() 00057 { 00058 // Default constructor 00059 }
|
|
|
Definition at line 62 of file RawQieDataBlock.cxx. 00063 : RawDataBlock(block) 00064 { 00065 // stored block format is: 00066 //--------------------- 00067 // version 0 version 1 00068 // 0 # words in block # words in block 00069 // 1 checksum checksum 00070 // 2 Block Id Block Id 00071 //----- 00072 // 3 run # run # 00073 // 4 {subrun #| run type} {subrun #| run type} 00074 // 5 trigger time (sec) trigger time (sec) 00075 // 6 trigger time (nsec) trigger time (nsec) 00076 // 7 timeframe # crateid 00077 // 8 --n/a-- timeframe # 00078 // 9 --n/a-- nlocations 00079 /* 00080 * The data has the following reapeating structure until 00081 * all channels are completed: 00082 * long unsigned int location; -- bit packed 00083 * long nPoints; 00084 * nPoints * struct { long nEntries; 00085 * long range; 00086 * long unsigned int sum; 00087 * long unsigned int sum_sqr; 00088 * } 00089 */ 00090 00091 }
|
|
|
Definition at line 94 of file RawQieDataBlock.cxx. 00095 {
00096 // dtor
00097 }
|
|
|
Definition at line 71 of file RawQieDataBlock.h. References fCrateId, fLocation, and fLocStart. 00072 : RawDataBlock(rhs), fCrateId() { fLocation.clear(); fLocStart.clear(); }
|
|
|
Definition at line 334 of file RawQieDataBlock.cxx. References fCrateId, RawDataBlock::GetBlockId(), GetCrateIdInfo(), GetDetector(), RawDataBlock::GetMinorId(), RawChannelId::IsNull(), MSG, and RawChannelId::SetDetector(). Referenced by FormatToOStream(), GetCommonMode(), GetCrate(), GetDetector(), GetElecType(), GetPedMode(), and GetSparsMode(). 00335 {
00336 // unpack crate info
00337 if (!fCrateId.IsNull()) return;
00338 if (GetMinorId() <= 0) {
00339 fCrateId.SetDetector(GetBlockId().GetDetector());
00340 MSG("RawData",Msg::kWarning)
00341 << " No crate info for minor version " << GetMinorId() << endl;
00342 return;
00343 }
00344 fCrateId = RawChannelId(GetBlockId().GetDetector(),GetCrateIdInfo(),0x1fff);
00345 }
|
|
|
Definition at line 348 of file RawQieDataBlock.cxx. References fLocation, fLocStart, RawDataBlock::GetMinorId(), and MSG. Referenced by GetLocation(), GetNumLocations(), GetNumPoints(), and StartOfLocPoint(). 00349 {
00350 // calculate how many distinct locations are recorded
00351 // each might have a different number of points recorded
00352 // fill vector of pointers to start of each location's data
00353 // if already filled just return
00354
00355 if (!fLocStart.empty()) return fLocStart.size();
00356
00357 int zzzz_last_v = zzzz_last;
00358 if (GetMinorId() <= 0) zzzz_last_v = zzzz_last_v0;
00359 const Int_t *ptr = fRawBlock + zzzz_last_v; // start of packed data
00360 const Int_t *end = fRawBlock + fSize; // one beyond end
00361
00362 while ( ptr < end ) {
00363 Int_t loc = *ptr;
00364 Int_t npts = *(ptr+1);
00365 // bitch wildly if already an entry for this "location"
00366 if (fLocStart[loc])
00367 MSG("RawData",Msg::kError)
00368 << " Already have an sub-block unit for 'location' 0x"
00369 << hex << setfill('0') << setw(8) << loc
00370 << setfill(' ') << dec << endl
00371 << " at offset 0x"
00372 << hex << setfill('0') << setw(8) << (fLocStart[loc]-fRawBlock)
00373 << setfill(' ') << dec
00374 << " found again at 0x"
00375 << hex << setfill('0') << setw(8) << (ptr-fRawBlock)
00376 << setfill(' ') << dec
00377 << endl;
00378 fLocation.push_back(loc);
00379 fLocStart[loc] = ptr;
00380 // skip loc+npts + npts*(entries,range,s,s2)
00381 Int_t skip = 2 + npts*qieDataPointIntSize;
00382 ptr += skip;
00383 }
00384
00385 if ( ptr != end )
00386 MSG("RawData",Msg::kError) << endl
00387 << "FillLocStart() unpacking did not end evenly at block boundary"
00388 << endl;
00389
00390 return fLocStart.size();
00391 }
|
|
||||||||||||
|
Reimplemented from RawDataBlock. Definition at line 423 of file RawQieDataBlock.cxx. References RawChannelId::AsString(), VldTimeStamp::AsString(), fCrateId, FillCrateId(), RawDataBlock::FormatToOStream(), GetLocation(), GetMean(), RawDataBlock::GetMinorId(), GetNumEntries(), GetNumLocations(), GetNumPoints(), GetRange(), GetRms(), GetRun(), GetRunType(), GetSubRun(), GetSum(), GetSumSqr(), GetTimeFrameNum(), GetTimeStamp(), and option. 00425 {
00426
00427 RawDataBlock::FormatToOStream(os,option);
00428 if (option[0] == 'X') return os;
00429
00430 // additional block specific formatted output is done here
00431
00432 os << " Run " << GetRun() << " SubRun " << GetSubRun()
00433 << " RunType " << GetRunType() << " TimeFrame " << GetTimeFrameNum()
00434 << endl
00435 << " TimeStamp " << GetTimeStamp().AsString("c") << endl;
00436 if (GetMinorId()>0) {
00437 FillCrateId();
00438 os << " CrateId " << fCrateId.AsString("C") << ", ";
00439 }
00440 UInt_t nloc = GetNumLocations();
00441 os << " " << nloc << " 'locations' "<< endl;
00442
00443 // xx'location'
00444 // xxxx[123] range entries mean RMS
00445 // 0x12345678 has ?? points
00446 // [123] 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890
00447 os << " range entries mean RMS Sum SumSqr" << endl;
00448 for (UInt_t indx = 0; indx < nloc; ++indx) {
00449 UInt_t loc = GetLocation(indx);
00450 UInt_t npt = GetNumPoints(loc);
00451 os << " location 0x"
00452 << hex << setfill('0') << setw(8) << loc << setfill(' ') << dec
00453 << " ( index = " << setw(3) << indx << " )"
00454 << " has " << npt << " points" << endl;
00455 for (UInt_t ipt = 0; ipt < npt; ++ipt) {
00456 os << " [" << setw(3) << ipt << "] "
00457 << setw(8) << GetRange(loc,ipt) << " "
00458 << setw(8) << GetNumEntries(loc,ipt) << " "
00459 << setw(12) << GetMean(loc,ipt) << " "
00460 << setw(12) << GetRms(loc,ipt) << " "
00461 << setw(10) << GetSum(loc,ipt) << " "
00462 << setw(12) << GetSumSqr(loc,ipt)
00463 << endl;
00464 }
00465 }
00466 return os;
00467 }
|
|
|
Definition at line 114 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetCommonMode(). 00115 { FillCrateId(); return fCrateId.GetCommonMode(); }
|
|
|
Definition at line 117 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetCrate(). 00118 { FillCrateId(); return fCrateId.GetCrate(); }
|
|
|
Definition at line 148 of file RawQieDataBlock.cxx. References RawDataBlock::GetMinorId(). Referenced by FillCrateId(). 00149 {
00150 // get the crate id word
00151 if (GetMinorId() <= 0) return -1; // didn't exist in this version
00152 if (fSize > indx_crateid) return fRawBlock[indx_crateid];
00153 return -1;
00154 }
|
|
|
Definition at line 68 of file RawQieDataBlock.h. 00068 { return fgDebugFlags; }
|
|
|
Definition at line 102 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetDetector(). Referenced by FillCrateId(). 00103 { FillCrateId(); return fCrateId.GetDetector(); }
|
|
|
Definition at line 105 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetElecType(). 00106 { FillCrateId(); return fCrateId.GetElecType(); }
|
|
|
Definition at line 186 of file RawQieDataBlock.cxx. References FillLocStart(), fLocation, and MSG. Referenced by FormatToOStream(). 00187 {
00188 // report "location" associated with sub-block index by "indx"
00189
00190 UInt_t nloc = FillLocStart();
00191 if ( indx >= nloc) { // zero based indexing
00192 MSG("RawData",Msg::kError)
00193 << "indx " << indx << " out of range: there are only "
00194 << nloc << " entries" << endl;
00195 return illegalLocation;
00196 }
00197 return fLocation[indx];
00198 }
|
|
|
Definition at line 287 of file RawQieDataBlock.cxx. References GetNumPoints(), QieDataPoint::nEntries, StartOfLocPoint(), and QieDataPoint::sum. 00288 {
00289 // the "range" that the sub-sub-block corresponds to
00290 // "location", averaged over all points
00291
00292 // use 'long long' to accumulate multiple points
00293 // before conversion to double to avoid potential loss of precision
00294 unsigned long long sumofentries = 0;
00295 unsigned long long sumofsums = 0;
00296
00297 UInt_t npts = GetNumPoints(loc);
00298 for (UInt_t ipt = 0; ipt < npts; ++ipt) {
00299 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00300 sumofentries += ptr->nEntries;
00301 sumofsums += ptr->sum;
00302 }
00303 if (sumofentries) return 0; // don't divide by zero
00304 return (Double_t)sumofsums/(Double_t)sumofentries;
00305 }
|
|
||||||||||||
|
Definition at line 234 of file RawQieDataBlock.cxx. References QieDataPoint::nEntries, StartOfLocPoint(), and QieDataPoint::sum. Referenced by FormatToOStream(). 00235 {
00236 // the "range" that the sub-sub-block corresponds to
00237 // "location" and point # "ipt"
00238
00239 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00240 if (!ptr) return 0;
00241 if (!ptr->nEntries) return 0; // don't divide by zero
00242 return (Double_t)ptr->sum/(Double_t)ptr->nEntries;
00243 }
|
|
||||||||||||
|
Definition at line 212 of file RawQieDataBlock.cxx. References QieDataPoint::nEntries, and StartOfLocPoint(). Referenced by FormatToOStream(). 00213 {
00214 // the number of entries that went into the sub-sub-block
00215 // related to "location" and point # "ipt"
00216
00217 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00218 if (!ptr) return 0;
00219 return ptr->nEntries;
00220 }
|
|
|
Definition at line 167 of file RawQieDataBlock.cxx. References FillLocStart(), RawDataBlock::GetMinorId(), and MSG. Referenced by FormatToOStream(). 00168 {
00169 // calculate how many distinct locations are recorded
00170 // each might have a different number of points recorded
00171
00172 UInt_t minor = GetMinorId();
00173 UInt_t nloc_unpacked = FillLocStart();
00174 if (minor > 0) {
00175 UInt_t nloc_stored = fRawBlock[indx_nloc];
00176 if (nloc_stored != nloc_unpacked)
00177 MSG("RawData",Msg::kError)
00178 << " Unpacking found " << nloc_unpacked
00179 << " 'location', while data claims " << nloc_stored
00180 << " were stored" << endl;
00181 }
00182 return nloc_unpacked;
00183 }
|
|
|
Definition at line 201 of file RawQieDataBlock.cxx. References FillLocStart(), and fLocStart. Referenced by FormatToOStream(), GetMean(), and GetRms(). 00202 {
00203
00204 // treat each sub-block as indexed by "location"
00205
00206 FillLocStart();
00207 const Int_t* ptr = fLocStart[loc]; // this is "location"
00208 return *(ptr+1); // this is "nPoints"
00209 }
|
|
|
Definition at line 108 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetPedMode(). 00109 { FillCrateId(); return fCrateId.GetPedMode(); }
|
|
||||||||||||
|
Definition at line 223 of file RawQieDataBlock.cxx. References QieDataPoint::range, and StartOfLocPoint(). Referenced by FormatToOStream(). 00224 {
00225 // the "range" that the sub-sub-block corresponds to
00226 // "location" and point # "ipt"
00227
00228 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00229 if (!ptr) return 0;
00230 return ptr->range;
00231 }
|
|
|
Definition at line 308 of file RawQieDataBlock.cxx. References GetNumPoints(), QieDataPoint::nEntries, StartOfLocPoint(), QieDataPoint::sum, and QieDataPoint::sum_sqr. 00309 {
00310 // the RMS that the sub-sub-block corresponds to
00311 // "location", averaged over all points
00312
00313 // use 'long long' to accumulate multiple points
00314 // before conversion to double to avoid potential loss of precision
00315 unsigned long long sumofentries = 0;
00316 unsigned long long sumofsums = 0;
00317 unsigned long long sumofsumsqrs = 0;
00318
00319 UInt_t npts = GetNumPoints(loc);
00320 for (UInt_t ipt = 0; ipt < npts; ++ipt) {
00321 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00322 sumofentries += ptr->nEntries;
00323 sumofsums += ptr->sum;
00324 sumofsumsqrs += ptr->sum_sqr;
00325 }
00326 if (sumofentries) return 0; // don't divide by zero
00327 Double_t mean = (Double_t)sumofsums/(Double_t)sumofentries;
00328 Double_t sumx2byn = (Double_t)sumofsumsqrs/(Double_t)sumofentries;
00329 return TMath::Sqrt(sumx2byn - mean*mean);
00330
00331 }
|
|
||||||||||||
|
Definition at line 246 of file RawQieDataBlock.cxx. References QieDataPoint::nEntries, StartOfLocPoint(), QieDataPoint::sum, and QieDataPoint::sum_sqr. Referenced by FormatToOStream(). 00247 {
00248 // the RMS that the sub-sub-block corresponds to
00249 // "location" and point # "ipt"
00250
00251 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00252 if (!ptr) return 0;
00253 if (!ptr->nEntries) return 0; // don't divide by zero
00254 Double_t n = (Double_t)ptr->nEntries;
00255 Double_t sumx = (Double_t)ptr->sum;
00256 Double_t sumx2 = (Double_t)ptr->sum_sqr;
00257 Double_t mean = sumx/n;
00258 return TMath::Sqrt(sumx2/n - mean*mean);
00259
00260 }
|
|
|
Definition at line 114 of file RawQieDataBlock.cxx. Referenced by FormatToOStream(). 00115 {
00116 // get the run number
00117 if (fSize > indx_run) return fRawBlock[indx_run];
00118 return -1;
00119 }
|
|
|
Definition at line 130 of file RawQieDataBlock.cxx. Referenced by FormatToOStream(). 00131 {
00132 // get the run type
00133 if (fSize > indx_runtype) return fRawBlock[indx_runtype]&0xffff;
00134 return -1;
00135 }
|
|
|
Definition at line 111 of file RawQieDataBlock.h. References fCrateId, FillCrateId(), and RawChannelId::GetSparsMode(). 00112 { FillCrateId(); return fCrateId.GetSparsMode(); }
|
|
|
Definition at line 122 of file RawQieDataBlock.cxx. Referenced by FormatToOStream(). 00123 {
00124 // get the subrun number
00125 if (fSize > indx_subrun) return (fRawBlock[indx_subrun]>>16)&0xffff;
00126 return -1;
00127 }
|
|
||||||||||||
|
Definition at line 263 of file RawQieDataBlock.cxx. References StartOfLocPoint(), and QieDataPoint::sum. Referenced by FormatToOStream(). 00264 {
00265 // the sum that the sub-sub-block corresponds to
00266 // "location" and point # "ipt"
00267
00268 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00269 if (!ptr) return 0;
00270 return ptr->sum;
00271
00272 }
|
|
||||||||||||
|
Definition at line 275 of file RawQieDataBlock.cxx. References StartOfLocPoint(), and QieDataPoint::sum_sqr. Referenced by FormatToOStream(). 00276 {
00277 // the sum^2 that the sub-sub-block corresponds to
00278 // "location" and point # "ipt"
00279
00280 const QieDataPoint* ptr = (const QieDataPoint*)StartOfLocPoint(loc,ipt);
00281 if (!ptr) return 0;
00282 return ptr->sum_sqr;
00283
00284 }
|
|
|
Definition at line 62 of file RawQieDataBlock.h. References GetTimeFrameNum(). 00062 { return GetTimeFrameNum(); }
|
|
|
Definition at line 157 of file RawQieDataBlock.cxx. References RawDataBlock::GetMinorId(). Referenced by FormatToOStream(), and GetTimeFrameNo(). 00158 {
00159 // get the timeframe number
00160 int indx_tf_v = indx_tf;
00161 if (GetMinorId() <= 0) indx_tf_v = indx_tf_v0;
00162 if (fSize > indx_tf_v) return fRawBlock[indx_tf_v];
00163 return -1;
00164 }
|
|
|
Definition at line 138 of file RawQieDataBlock.cxx. References indx_nsec, and indx_sec. Referenced by FormatToOStream(). 00139 {
00140 // get the trigger time
00141 if (fSize > indx_nsec)
00142 return VldTimeStamp(fRawBlock[indx_sec],fRawBlock[indx_nsec]);
00143
00144 return VldTimeStamp((time_t)0,(Int_t)0);
00145 }
|
|
|
Definition at line 100 of file RawQieDataBlock.cxx. References fCrateId, fLocation, fLocStart, and RawDataBlock::operator=(). 00101 {
00102 // deep copy assignment
00103 if (this != &rhs) {
00104 RawDataBlock::operator=(rhs);
00105 fCrateId = rhs.fCrateId;
00106 // clear these to allow them to be re-filled
00107 fLocation.clear();
00108 fLocStart.clear();
00109 }
00110 return *this;
00111 }
|
|
|
Definition at line 67 of file RawQieDataBlock.h. References fgDebugFlags. 00067 {fgDebugFlags=dbgflgs;}
|
|
||||||||||||
|
Definition at line 394 of file RawQieDataBlock.cxx. References FillLocStart(), fLocStart, and MSG. Referenced by GetMean(), GetNumEntries(), GetRange(), GetRms(), GetSum(), and GetSumSqr(). 00395 {
00396
00397 // treat each sub-block as indexed by "location"
00398 // sub-sub-structures are indexed by "iptr" and offset by fixed amounts
00399
00400 FillLocStart(); // make sure we've scanned to find each sub-block
00401 const Int_t* ptr = fLocStart[loc];
00402 if (!ptr) {
00403 MSG("RawData",Msg::kError)
00404 << " No entry for 'location' 0x"
00405 << hex << setfill(' ') << setw(8) << loc
00406 << setfill(' ') << dec << endl;
00407 return 0;
00408 }
00409 UInt_t npts = *(ptr+1); // this is "nPoints";
00410 if ( ipt >= npts ) { // zero based indexing
00411 MSG("RawData",Msg::kError)
00412 << "ipt " << ipt << " for 'location' 0x"
00413 << hex << setfill(' ') << setw(8) << loc << setfill(' ') << dec
00414 << " that has only " << npts << " points" << endl;
00415 return 0;
00416 }
00417 // 2 skips loc+npoints, each struct is 4 long
00418 ptr += (2 + ipt*qieDataPointIntSize);
00419 return ptr;
00420 }
|
|
|
where sub-block starts
Definition at line 92 of file RawQieDataBlock.h. Referenced by FillCrateId(), FormatToOStream(), GetCommonMode(), GetCrate(), GetDetector(), GetElecType(), GetPedMode(), GetSparsMode(), operator=(), and RawQieDataBlock(). |
|
|
unpacked crateinfo
Definition at line 15 of file RawQieDataBlock.cxx. Referenced by SetDebugFlags(). |
|
|
Definition at line 89 of file RawQieDataBlock.h. Referenced by FillLocStart(), GetLocation(), operator=(), and RawQieDataBlock(). |
|
|
list of locations
Definition at line 90 of file RawQieDataBlock.h. Referenced by FillLocStart(), GetNumPoints(), operator=(), RawQieDataBlock(), and StartOfLocPoint(). |
1.3.9.1