RawErrorStatsBlock Class Reference

#include <RawErrorStatsBlock.h>

Inheritance diagram for RawErrorStatsBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawErrorStatsBlock ()
 RawErrorStatsBlock (const Int_t *block)
 RawErrorStatsBlock (const VldContext &vldc_start, const VldTimeStamp &time_end, Int_t run, Short_t subrun, Short_t runtype, Int_t nsnarls, Int_t nsrcs, const Int_t *srcid, const Int_t *errorcnt)
virtual ~RawErrorStatsBlock ()
VldTimeStamp GetStartTime () const
VldTimeStamp GetEndTime () const
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
Int_t GetNumberOfErrors () const
Int_t GetNumberOfSources () const
Int_t GetSourceId (Int_t indx) const
Int_t GetErrorCount (Int_t indx) const
VldContext GetVldContext () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawErrorStatsBlock (const RawErrorStatsBlock &rhs)

Static Public Member Functions

static void SetDebugFlags (const UInt_t dbgflgs)
static UInt_t GetDebugFlags ()

Static Private Attributes

static UInt_t fgDebugFlags = 0

Detailed Description

Definition at line 19 of file RawErrorStatsBlock.h.


Constructor & Destructor Documentation

RawErrorStatsBlock::RawErrorStatsBlock (  ) 

Definition at line 44 of file RawErrorStatsBlock.cxx.

00044                                        : RawDataBlock()
00045 {
00046    // Default constructor
00047 }

RawErrorStatsBlock::RawErrorStatsBlock ( const Int_t *  block  ) 

Definition at line 50 of file RawErrorStatsBlock.cxx.

00051    : RawDataBlock(block)
00052 {
00053    //  stored block format is:
00054    //---------------------
00055    //  0   # words in block
00056    //  1   checksum
00057    //  2   Block Id
00058    //-----
00059    //  3   run #
00060    //  4   {subrun#| run type}
00061    //  5   start time (sec)
00062    //  6   start time (nsec)
00063    //  7   end time (sec)
00064    //  8   end time (nsec)
00065    //  9   total number of errors
00066    // 10   number error sources
00067    // 11   src id (index 1)
00068    // 12   # errors (index 1)
00069    // ..   {src id / # snarls}  pairs
00070 }

RawErrorStatsBlock::RawErrorStatsBlock ( const VldContext vldc_start,
const VldTimeStamp time_end,
Int_t  run,
Short_t  subrun,
Short_t  runtype,
Int_t  nsnarls,
Int_t  nsrcs,
const Int_t *  srcid,
const Int_t *  errorcnt 
)

Definition at line 73 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, VldContext::GetDetector(), RawBlockProxy::GetMajorId(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), indx_endnsec, indx_endsec, indx_nerrors, indx_nsrcs, indx_run, indx_startnsec, indx_startsec, indx_subrun, RawBlockRegistry::Instance(), RawBlockProxy::IsDCS(), RawBlockRegistry::LookUp(), rdxsum_fill(), and zzzz_last.

00078    : RawDataBlock()
00079 {
00080    // Component ctor
00081 
00082    fSize = zzzz_last + 2*nsrcs;
00083    if (fRawBlock) delete [] fRawBlock;
00084    fRawBlock = new Int_t [fSize];
00085 
00086    fRawBlock[0] = fSize;
00087 // fRawBlock[1] = checksum... see below
00088 
00089    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00090    RawBlockProxy*    rbp = rbr.LookUp("RawErrorStatsBlock");
00091 
00092    Bool_t isDCS   = rbp->IsDCS();
00093    Int_t  majorId = rbp->GetMajorId();
00094    Int_t  minorId = 0;
00095    RawBlockId rbid(majorId,minorId,isDCS,
00096                    vldc_start.GetDetector(),vldc_start.GetSimFlag());
00097    fRawBlock[2] = rbid.GetEncoded();
00098 
00099    fRawBlock[indx_run]        = run;
00100    fRawBlock[indx_subrun]     = (subrun&0xffff)<<16 | (runtype&0xffff);
00101    fRawBlock[indx_startsec]   = vldc_start.GetTimeStamp().GetSec();
00102    fRawBlock[indx_startnsec]  = vldc_start.GetTimeStamp().GetNanoSec();
00103    fRawBlock[indx_endsec]     = time_end.GetSec();
00104    fRawBlock[indx_endnsec]    = time_end.GetNanoSec();
00105    fRawBlock[indx_nerrors]    = nsnarls;
00106    fRawBlock[indx_nsrcs]      = nsrcs;
00107 
00108    for (Int_t i=0; i<nsrcs; i++) {
00109       Int_t ioff = zzzz_last + 2*i;
00110       fRawBlock[ioff+0] = srcid[i];
00111       fRawBlock[ioff+1] = errorcnt[i];
00112    }
00113 
00114    // fill checksum
00115    rdxsum_fill((int32_t*)fRawBlock,0); 
00116 }

RawErrorStatsBlock::~RawErrorStatsBlock (  )  [virtual]

Definition at line 119 of file RawErrorStatsBlock.cxx.

00120 {
00121    // dtor
00122 }

RawErrorStatsBlock::RawErrorStatsBlock ( const RawErrorStatsBlock rhs  )  [inline]

Definition at line 51 of file RawErrorStatsBlock.h.

00052      : RawDataBlock(rhs) { ; }


Member Function Documentation

std::ostream & RawErrorStatsBlock::FormatToOStream ( std::ostream &  os,
Option_t *  option = "" 
) const [virtual]

Reimplemented from RawDataBlock.

Definition at line 211 of file RawErrorStatsBlock.cxx.

References VldTimeStamp::AsString(), GetEndTime(), GetErrorCount(), GetNumberOfErrors(), GetNumberOfSources(), GetRun(), GetRunType(), GetSourceId(), GetStartTime(), and GetSubRun().

00213 {
00214    RawDataBlock::FormatToOStream(os,option);
00215    if (option[0] == 'X') return os;
00216 
00217    os << " Start " << GetStartTime().AsString("c") << endl;
00218    os << " End   " << GetEndTime().AsString("c") << endl;
00219    os << " Run " << GetRun() 
00220       << " SubRun " << GetSubRun() 
00221       << " RunType " << GetRunType() << endl; 
00222    os << "   " << GetNumberOfErrors() << " errors from "
00223       << GetNumberOfSources() << " sources: " << endl;
00224    for (int i = 0; i<GetNumberOfSources(); i++) {
00225       os << "   src 0x" << hex << GetSourceId(i) << dec
00226          << " gave " << GetErrorCount(i) << " errors" << endl;
00227    }
00228    return os;
00229 }

static UInt_t RawErrorStatsBlock::GetDebugFlags (  )  [inline, static]

Definition at line 48 of file RawErrorStatsBlock.h.

References fgDebugFlags.

00048 { return fgDebugFlags; }

VldTimeStamp RawErrorStatsBlock::GetEndTime (  )  const

Definition at line 135 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_endnsec, indx_endsec, and zzzz_last.

Referenced by FormatToOStream(), and GetVldContext().

00136 {
00137    // get the end time
00138    if (fSize >= zzzz_last) 
00139       return VldTimeStamp(fRawBlock[indx_endsec],fRawBlock[indx_endnsec]);
00140 
00141    return VldTimeStamp((time_t)0,(Int_t)0);
00142 }

Int_t RawErrorStatsBlock::GetErrorCount ( Int_t  indx  )  const

Definition at line 194 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, and zzzz_last.

Referenced by FormatToOStream().

00195 {
00196    // get the "indx"-th snarl count from the list
00197    Int_t ioff = zzzz_last + 2*indx + 1;
00198    if (fSize >= ioff) return fRawBlock[ioff];
00199    return -1;
00200 }

Int_t RawErrorStatsBlock::GetNumberOfErrors (  )  const

Definition at line 169 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_nerrors, and zzzz_last.

Referenced by FormatToOStream().

00170 {
00171    // get the total number of snarls
00172    if (fSize >= zzzz_last) return fRawBlock[indx_nerrors];
00173    return -1;
00174 }

Int_t RawErrorStatsBlock::GetNumberOfSources (  )  const

Definition at line 177 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_nsrcs, and zzzz_last.

Referenced by FormatToOStream().

00178 {
00179    // get the number of sources in the list
00180    if (fSize >= zzzz_last) return fRawBlock[indx_nsrcs];
00181    return -1;
00182 }

Int_t RawErrorStatsBlock::GetRun ( void   )  const

Definition at line 145 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_run, and zzzz_last.

Referenced by FormatToOStream().

00146 {
00147    // get the run number
00148    if (fSize >= zzzz_last) return fRawBlock[indx_run];
00149    return -1;
00150 }

Short_t RawErrorStatsBlock::GetRunType (  )  const

Definition at line 161 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_runtype, and zzzz_last.

Referenced by FormatToOStream().

00162 {
00163    // get the run type
00164    if (fSize >= zzzz_last) return fRawBlock[indx_runtype]&0xffff;
00165    return -1;
00166 }

Int_t RawErrorStatsBlock::GetSourceId ( Int_t  indx  )  const

Definition at line 185 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, and zzzz_last.

Referenced by FormatToOStream().

00186 {
00187    // get the "indx"-th source from the list
00188    Int_t ioff = zzzz_last + 2*indx + 0;
00189    if (fSize >= ioff) return fRawBlock[ioff];
00190    return -1;
00191 }

VldTimeStamp RawErrorStatsBlock::GetStartTime (  )  const

Definition at line 125 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_startnsec, indx_startsec, and zzzz_last.

Referenced by FormatToOStream().

00126 {
00127    // get the start time
00128    if (fSize >= zzzz_last) 
00129       return VldTimeStamp(fRawBlock[indx_startsec],fRawBlock[indx_startnsec]);
00130 
00131    return VldTimeStamp((time_t)0,(Int_t)0);
00132 }

Short_t RawErrorStatsBlock::GetSubRun (  )  const

Definition at line 153 of file RawErrorStatsBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_subrun, and zzzz_last.

Referenced by FormatToOStream().

00154 {
00155    // get the subrun number
00156    if (fSize >= zzzz_last) return (fRawBlock[indx_subrun]>>16)&0xffff;
00157    return -1;
00158 }

VldContext RawErrorStatsBlock::GetVldContext (  )  const

Definition at line 203 of file RawErrorStatsBlock.cxx.

References RawDataBlock::GetBlockId(), RawBlockId::GetDetector(), GetEndTime(), and RawBlockId::GetSimFlag().

00204 {
00205    // build validity context
00206    RawBlockId rbid = GetBlockId();
00207    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetEndTime());
00208 }

static void RawErrorStatsBlock::SetDebugFlags ( const UInt_t  dbgflgs  )  [inline, static]

Definition at line 47 of file RawErrorStatsBlock.h.

References fgDebugFlags.

00047 {fgDebugFlags=dbgflgs;}


Member Data Documentation

UInt_t RawErrorStatsBlock::fgDebugFlags = 0 [static, private]

Definition at line 59 of file RawErrorStatsBlock.h.

Referenced by GetDebugFlags(), and SetDebugFlags().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1