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

Public Member Functions | |
| RawVarcErrorInTfBlock () | |
| RawVarcErrorInTfBlock (const Int_t *block) | |
| virtual | ~RawVarcErrorInTfBlock () |
| Int_t | GetRun () const |
| Short_t | GetSubRun () const |
| Short_t | GetRunType () const |
| VldTimeStamp | GetTimeStamp () const |
| Int_t | GetCrateId () const |
| Int_t | GetTimeFrame () const |
| Int_t | GetNumberOfSparsErrors () const |
| Int_t | GetNumberOfEtcErrors () const |
| const Int_t * | GetErrorValues () const |
| Bool_t | UnpackSparsError (UInt_t indx, UShort_t &timeBlock, UShort_t &varcId, UShort_t &errCode) const |
| Bool_t | UnpackEtcError (UInt_t indx, UShort_t &timeBlock, UShort_t &varcId, UShort_t &etcNum, UShort_t &errRegister) const |
| virtual std::ostream & | FormatToOStream (std::ostream &os, Option_t *option="") const |
| RawVarcErrorInTfBlock (const RawVarcErrorInTfBlock &rhs) | |
| RawVarcErrorInTfBlock & | operator= (const RawVarcErrorInTfBlock &rhs) |
Static Public Member Functions | |
| static void | SetDebugFlags (const UInt_t dbgflgs) |
| static UInt_t | GetDebugFlags () |
Protected Member Functions | |
| void | BuildIndxToOffset () const |
Protected Attributes | |
| Bool_t | fIndxToOffsetBuilt |
| std::vector< Int_t > | fIndxToOffsetSpars |
| not written out | |
| std::vector< Int_t > | fIndxToOffsetEtc |
| not written out | |
Static Private Attributes | |
| static UInt_t | fgDebugFlags = 0 |
| not written out | |
Definition at line 21 of file RawVarcErrorInTfBlock.h.
| RawVarcErrorInTfBlock::RawVarcErrorInTfBlock | ( | ) |
Definition at line 60 of file RawVarcErrorInTfBlock.cxx.
00061 : fIndxToOffsetBuilt(false) 00062 { 00063 // Default constructor 00064 }
| RawVarcErrorInTfBlock::RawVarcErrorInTfBlock | ( | const Int_t * | block | ) |
Definition at line 67 of file RawVarcErrorInTfBlock.cxx.
00068 : RawDataBlock(block), fIndxToOffsetBuilt(false) 00069 { 00070 // stored block format is: 00071 //--------------------- 00072 // 0 # words in block 00073 // 1 checksum 00074 // 2 Block Id 00075 //----- 00076 // 3 run # 00077 // 4 {subrun#| run type} 00078 // 5 time (sec) 00079 // 6 time (nsec) 00080 // 7 time frame # 00081 // 8 # of sparse errors 00082 // 9 # of etc errors 00083 // * Followed by (for 2nd version of block): 00084 // * numSparsErrorValues + numEtcErrorValues longs packed as follows 00085 // * NOTE: these are interspersed!!! 00086 // * 00087 // * [0:15] ETC_ERR : error code from ETC/sparsifier error register, 16 bits 00088 // * [16:18] ETC_NUM : ETC number, 3 bits (0 for sparsifier errors) 00089 // * [19:20] VARC_ID : VARC ID, 2 bits 00090 // * [21:22] : unused, 2 bits 00091 // * [23:23] : error source 0=ETC 1=sparsifier 00092 // * [24:31] TB_ID : time block ID, 16 bits 00093 }
| RawVarcErrorInTfBlock::~RawVarcErrorInTfBlock | ( | ) | [virtual] |
| RawVarcErrorInTfBlock::RawVarcErrorInTfBlock | ( | const RawVarcErrorInTfBlock & | rhs | ) | [inline] |
Definition at line 56 of file RawVarcErrorInTfBlock.h.
References fIndxToOffsetEtc, and fIndxToOffsetSpars.
00057 : RawDataBlock(rhs), fIndxToOffsetBuilt(false) 00058 { fIndxToOffsetSpars.clear(); fIndxToOffsetEtc.clear(); }
| void RawVarcErrorInTfBlock::BuildIndxToOffset | ( | ) | const [protected] |
Definition at line 324 of file RawVarcErrorInTfBlock.cxx.
References errSrcMask, errSrcShift, errSrcWasEtc, errSrcWasSpars, fIndxToOffsetBuilt, fIndxToOffsetEtc, fIndxToOffsetSpars, RawDataBlock::fRawBlock, RawDataBlock::fSize, GetNumberOfEtcErrors(), GetNumberOfSparsErrors(), Msg::kError, MSG, and zzzz_last.
Referenced by FormatToOStream(), UnpackEtcError(), and UnpackSparsError().
00325 { 00326 // build lookup so we can map "indx" to "offset" in error value 00327 // region for Spars and Etc errors 00328 if (fIndxToOffsetBuilt) return; // already done 00329 00330 fIndxToOffsetBuilt = true; 00331 00332 UInt_t nspars = GetNumberOfSparsErrors(); 00333 UInt_t netc = GetNumberOfEtcErrors(); 00334 00335 UInt_t n = nspars + netc; 00336 for (UInt_t i=0; i<n; i++) { 00337 Int_t offset = zzzz_last + i; 00338 if (offset >= fSize) { 00339 // this shouldn't happen 00340 MSG("RawData",Msg::kError) 00341 << "BuildIndxToOffset i " << i << " offset " << offset 00342 << " fSize " << fSize << endl; 00343 } 00344 Int_t value = fRawBlock[offset]; 00345 Int_t errSrc = (value>>errSrcShift)&errSrcMask; 00346 if (errSrc == errSrcWasSpars) 00347 fIndxToOffsetSpars.push_back(offset); 00348 else if (errSrc == errSrcWasEtc) 00349 fIndxToOffsetEtc.push_back(offset); 00350 else 00351 MSG("RawData",Msg::kError) 00352 << "BuildIndxToOffset entry " << i 00353 << " was neither Spars nor Etc" << endl; 00354 } 00355 00356 if (fIndxToOffsetSpars.size() != nspars || 00357 fIndxToOffsetEtc.size() != netc ) 00358 MSG("RawData",Msg::kError) 00359 << endl 00360 << "BuildIndxToOffset size mismatch (unpacked,expected)" 00361 << " Spars (" << fIndxToOffsetSpars.size() << "," << nspars << ")" 00362 << " Etc (" << fIndxToOffsetEtc.size() << "," << netc << ")" 00363 << endl; 00364 00365 return; 00366 }
| std::ostream & RawVarcErrorInTfBlock::FormatToOStream | ( | std::ostream & | os, | |
| Option_t * | option = "" | |||
| ) | const [virtual] |
Reimplemented from RawDataBlock.
Definition at line 254 of file RawVarcErrorInTfBlock.cxx.
References VldTimeStamp::AsString(), BuildIndxToOffset(), fgDebugFlags, fIndxToOffsetBuilt, fIndxToOffsetEtc, fIndxToOffsetSpars, RawDataBlock::FormatToOStream(), GetCrateId(), GetNumberOfEtcErrors(), GetNumberOfSparsErrors(), GetRun(), GetRunType(), GetSubRun(), GetTimeFrame(), GetTimeStamp(), kdbg_ForceHexDump, UnpackEtcError(), and UnpackSparsError().
00256 { 00257 00258 if (fgDebugFlags & kdbg_ForceHexDump) option = "x"; 00259 00260 RawDataBlock::FormatToOStream(os,option); 00261 if (option[0] == 'X') return os; 00262 00263 // additional block specific formatted output is done here 00264 00265 os << " TimeStamp " << GetTimeStamp().AsString("c") 00266 << " TimeFrame " << GetTimeFrame() << endl; 00267 os << " Run " << GetRun() 00268 << " SubRun " << GetSubRun() 00269 << " RunType " << GetRunType(); 00270 int crateid = GetCrateId(); 00271 00272 // force everything unpacked in case of sizing errors 00273 if (!fIndxToOffsetBuilt) BuildIndxToOffset(); 00274 00275 int nerrSpars = TMath::Max(GetNumberOfSparsErrors(), 00276 (Int_t)fIndxToOffsetSpars.size());; 00277 int nerrEtc = TMath::Max(GetNumberOfEtcErrors(), 00278 (Int_t)fIndxToOffsetEtc.size()); 00279 os << " Crate " << (crateid&0x3f) 00280 << " (0x" << hex << crateid << dec << ") had: " 00281 << endl; 00282 00283 00284 if (nerrSpars) { 00285 os << " SparsErrors: " << endl; 00286 for (int indxs = 0; indxs < nerrSpars; indxs++) { 00287 UShort_t timeBlock, varcId, errCode; 00288 Bool_t unpk_ok = 00289 UnpackSparsError(indxs,timeBlock,varcId,errCode); 00290 os << " [" << setw(3) << indxs << "] " 00291 << ((unpk_ok) ? " " : "?") 00292 << " TB " << setw(5) << timeBlock 00293 << " VarcId " << varcId 00294 << " ErrorCode " << setw(5) << errCode 00295 << " ( 0x" << hex << setw(4) << errCode << " )" << dec << endl; 00296 } 00297 } 00298 else { 00299 os << " No Spars Errors" << endl; 00300 } 00301 00302 if (nerrEtc) { 00303 os << " EtcErrors: " << endl; 00304 for (int indxe = 0; indxe < nerrEtc; indxe++) { 00305 UShort_t timeBlock, varcId, etcNum, errCode; 00306 Bool_t unpk_ok = 00307 UnpackEtcError(indxe,timeBlock,varcId,etcNum,errCode); 00308 os << " [" << setw(3) << indxe << "] " 00309 << ((unpk_ok) ? " " : "?") 00310 << " TB " << setw(5) << timeBlock 00311 << " VarcId " << varcId << " etcNum " << etcNum 00312 << " ErrorCode " << setw(5) << errCode 00313 << " ( 0x" << hex << setw(4) << errCode << " )" << dec << endl; 00314 } 00315 } 00316 else { 00317 os << " No Etc Errors" << endl; 00318 } 00319 00320 return os; 00321 }
| Int_t RawVarcErrorInTfBlock::GetCrateId | ( | ) | const |
Definition at line 150 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_crateid.
Referenced by FarDetVarcErrorsDump::Ana(), FormatToOStream(), and FarDetDataQualityModule::ProcessBlock().
00151 { 00152 // get the crate id 00153 if (fSize > indx_crateid) return fRawBlock[indx_crateid]; 00154 return -1; 00155 }
| static UInt_t RawVarcErrorInTfBlock::GetDebugFlags | ( | ) | [inline, static] |
Definition at line 53 of file RawVarcErrorInTfBlock.h.
References fgDebugFlags.
00053 { return fgDebugFlags; }
| const Int_t * RawVarcErrorInTfBlock::GetErrorValues | ( | ) | const |
Definition at line 182 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and zzzz_last.
00183 { 00184 // get ptr to the raw list of error values 00185 // since Spars and Etc errors are intermingled this is all we 00186 // can do at this level 00187 if (fSize >= zzzz_last) return fRawBlock + zzzz_last; 00188 return 0; 00189 }
| Int_t RawVarcErrorInTfBlock::GetNumberOfEtcErrors | ( | ) | const |
Definition at line 174 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_netcerr.
Referenced by FarDetVarcErrorsDump::Ana(), BuildIndxToOffset(), FormatToOStream(), and FarDetDataQualityModule::ProcessBlock().
00175 { 00176 // get the # of Etc errors 00177 if (fSize > indx_netcerr) return fRawBlock[indx_netcerr]; 00178 return -1; 00179 }
| Int_t RawVarcErrorInTfBlock::GetNumberOfSparsErrors | ( | ) | const |
Definition at line 166 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_nsparserr.
Referenced by FarDetVarcErrorsDump::Ana(), BuildIndxToOffset(), AlgCalDetSI::FillVarcErrs(), FormatToOStream(), and FarDetDataQualityModule::ProcessBlock().
00167 { 00168 // get the # of Sparsification errors 00169 if (fSize > indx_nsparserr) return fRawBlock[indx_nsparserr]; 00170 return -1; 00171 }
| Int_t RawVarcErrorInTfBlock::GetRun | ( | ) | const |
Definition at line 126 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_run.
Referenced by FormatToOStream().
00127 { 00128 // get the run number 00129 if (fSize > indx_run) return fRawBlock[indx_run]; 00130 return -1; 00131 }
| Short_t RawVarcErrorInTfBlock::GetRunType | ( | ) | const |
Definition at line 142 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_runtype.
Referenced by FormatToOStream().
00143 { 00144 // get the run type 00145 if (fSize > indx_runtype) return fRawBlock[indx_runtype]&0xffff; 00146 return -1; 00147 }
| Short_t RawVarcErrorInTfBlock::GetSubRun | ( | ) | const |
Definition at line 134 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_subrun.
Referenced by FormatToOStream().
00135 { 00136 // get the subrun number 00137 if (fSize > indx_subrun) return (fRawBlock[indx_subrun]>>16)&0xffff; 00138 return -1; 00139 }
| Int_t RawVarcErrorInTfBlock::GetTimeFrame | ( | ) | const |
Definition at line 158 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, and indx_tf.
Referenced by AlgCalDetSI::FillVarcErrs(), and FormatToOStream().
00159 { 00160 // get the time frame 00161 if (fSize > indx_tf) return fRawBlock[indx_tf]; 00162 return -1; 00163 }
| VldTimeStamp RawVarcErrorInTfBlock::GetTimeStamp | ( | ) | const |
Definition at line 116 of file RawVarcErrorInTfBlock.cxx.
References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_nsec, and indx_sec.
Referenced by FormatToOStream().
00117 { 00118 // get the timestamp 00119 if (fSize > indx_nsec) 00120 return VldTimeStamp(fRawBlock[indx_sec],fRawBlock[indx_nsec]); 00121 00122 return VldTimeStamp((time_t)0,(Int_t)0); 00123 }
| RawVarcErrorInTfBlock & RawVarcErrorInTfBlock::operator= | ( | const RawVarcErrorInTfBlock & | rhs | ) |
Definition at line 102 of file RawVarcErrorInTfBlock.cxx.
References fIndxToOffsetBuilt, fIndxToOffsetEtc, fIndxToOffsetSpars, and RawDataBlock::operator=().
00103 { 00104 // deep copy assignment 00105 if (this != &rhs) { 00106 RawDataBlock::operator=(rhs); 00107 // clear the unpacked info to allow it to be re-filled 00108 fIndxToOffsetBuilt = false; 00109 fIndxToOffsetSpars.clear(); 00110 fIndxToOffsetEtc.clear(); 00111 } 00112 return *this; 00113 }
| static void RawVarcErrorInTfBlock::SetDebugFlags | ( | const UInt_t | dbgflgs | ) | [inline, static] |
Definition at line 52 of file RawVarcErrorInTfBlock.h.
References fgDebugFlags.
00052 {fgDebugFlags=dbgflgs;}
| Bool_t RawVarcErrorInTfBlock::UnpackEtcError | ( | UInt_t | indx, | |
| UShort_t & | timeBlock, | |||
| UShort_t & | varcId, | |||
| UShort_t & | etcNum, | |||
| UShort_t & | errRegister | |||
| ) | const |
Definition at line 221 of file RawVarcErrorInTfBlock.cxx.
References BuildIndxToOffset(), errCodeMask, errSrcMask, errSrcShift, errSrcWasEtc, etcNumMask, etcNumShift, fIndxToOffsetBuilt, fIndxToOffsetEtc, RawDataBlock::fRawBlock, RawDataBlock::fSize, tbIdMask, tbIdShift, varcIdMask, and varcIdShift.
Referenced by FarDetVarcErrorsDump::Ana(), FormatToOStream(), and FarDetDataQualityModule::ProcessBlock().
00224 { 00225 // unpack the spars error at index "indx" 00226 // return "false" if there was a problem 00227 // (indx out-of-range or source tagging wasn't as expected) 00228 00229 if (!fIndxToOffsetBuilt) BuildIndxToOffset(); 00230 Int_t offset = fSize+1; // in case of bad indx 00231 if (indx < fIndxToOffsetEtc.size()) 00232 offset = fIndxToOffsetEtc[indx]; 00233 00234 if (fSize >= offset) { 00235 Int_t value = fRawBlock[offset]; 00236 timeBlock = ( value >> tbIdShift ) & tbIdMask; 00237 varcId = ( value >> varcIdShift ) & varcIdMask; 00238 etcNum = ( value >> etcNumShift ) & etcNumMask; 00239 errCode = value & errCodeMask; 00240 00241 return ( ((value>>errSrcShift)&errSrcMask) == errSrcWasEtc ); 00242 } 00243 else { 00244 timeBlock = (UShort_t) -1; 00245 varcId = (UShort_t) -1; 00246 etcNum = (UShort_t) -1; 00247 errCode = (UShort_t) -1; 00248 return false; 00249 } 00250 00251 }
| Bool_t RawVarcErrorInTfBlock::UnpackSparsError | ( | UInt_t | indx, | |
| UShort_t & | timeBlock, | |||
| UShort_t & | varcId, | |||
| UShort_t & | errCode | |||
| ) | const |
Definition at line 192 of file RawVarcErrorInTfBlock.cxx.
References BuildIndxToOffset(), errCodeMask, errSrcMask, errSrcShift, errSrcWasSpars, fIndxToOffsetBuilt, fIndxToOffsetSpars, RawDataBlock::fRawBlock, RawDataBlock::fSize, tbIdMask, tbIdShift, varcIdMask, and varcIdShift.
Referenced by FarDetVarcErrorsDump::Ana(), FormatToOStream(), and FarDetDataQualityModule::ProcessBlock().
00194 { 00195 // unpack the spars error at index "indx" 00196 // return "false" if there was a problem 00197 // (indx out-of-range or source tagging wasn't as expected) 00198 00199 if (!fIndxToOffsetBuilt) BuildIndxToOffset(); 00200 Int_t offset = fSize+1; // in case of bad indx 00201 if (indx < fIndxToOffsetSpars.size()) 00202 offset = fIndxToOffsetSpars[indx]; 00203 00204 if (fSize >= offset) { 00205 Int_t value = fRawBlock[offset]; 00206 timeBlock = ( value >> tbIdShift ) & tbIdMask; 00207 varcId = ( value >> varcIdShift ) & varcIdMask; 00208 errCode = value & errCodeMask; 00209 00210 return ( ((value>>errSrcShift)&errSrcMask) == errSrcWasSpars ); 00211 } 00212 else { 00213 timeBlock = (UShort_t) -1; 00214 varcId = (UShort_t) -1; 00215 errCode = (UShort_t) -1; 00216 return false; 00217 } 00218 }
UInt_t RawVarcErrorInTfBlock::fgDebugFlags = 0 [static, private] |
not written out
Definition at line 73 of file RawVarcErrorInTfBlock.h.
Referenced by FormatToOStream(), GetDebugFlags(), and SetDebugFlags().
Bool_t RawVarcErrorInTfBlock::fIndxToOffsetBuilt [mutable, protected] |
Definition at line 66 of file RawVarcErrorInTfBlock.h.
Referenced by BuildIndxToOffset(), FormatToOStream(), operator=(), UnpackEtcError(), and UnpackSparsError().
std::vector<Int_t> RawVarcErrorInTfBlock::fIndxToOffsetEtc [mutable, protected] |
not written out
Definition at line 68 of file RawVarcErrorInTfBlock.h.
Referenced by BuildIndxToOffset(), FormatToOStream(), operator=(), RawVarcErrorInTfBlock(), and UnpackEtcError().
std::vector<Int_t> RawVarcErrorInTfBlock::fIndxToOffsetSpars [mutable, protected] |
not written out
Definition at line 67 of file RawVarcErrorInTfBlock.h.
Referenced by BuildIndxToOffset(), FormatToOStream(), operator=(), RawVarcErrorInTfBlock(), and UnpackSparsError().
1.4.7