RawTriggerStatsBlock Class Reference

#include <RawTriggerStatsBlock.h>

Inheritance diagram for RawTriggerStatsBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawTriggerStatsBlock ()
 RawTriggerStatsBlock (const Int_t *block)
 RawTriggerStatsBlock (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 *snarlcnt)
virtual ~RawTriggerStatsBlock ()
VldTimeStamp GetStartTime () const
VldTimeStamp GetEndTime () const
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
Int_t GetNumberOfSnarls () const
Int_t GetNumberOfSources () const
Int_t GetSourceId (Int_t indx) const
Int_t GetSnarlCount (Int_t indx) const
VldContext GetVldContext () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawTriggerStatsBlock (const RawTriggerStatsBlock &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 RawTriggerStatsBlock.h.


Constructor & Destructor Documentation

RawTriggerStatsBlock::RawTriggerStatsBlock (  ) 

Definition at line 42 of file RawTriggerStatsBlock.cxx.

00042                                            : RawDataBlock()
00043 {
00044    // Default constructor
00045 }

RawTriggerStatsBlock::RawTriggerStatsBlock ( const Int_t *  block  ) 

Definition at line 48 of file RawTriggerStatsBlock.cxx.

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

RawTriggerStatsBlock::RawTriggerStatsBlock ( 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 *  snarlcnt 
)

Definition at line 71 of file RawTriggerStatsBlock.cxx.

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

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

RawTriggerStatsBlock::~RawTriggerStatsBlock (  )  [virtual]

Definition at line 117 of file RawTriggerStatsBlock.cxx.

00118 {
00119    // dtor
00120 }

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

Definition at line 51 of file RawTriggerStatsBlock.h.

00052      : RawDataBlock(rhs) { ; }


Member Function Documentation

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

Reimplemented from RawDataBlock.

Definition at line 209 of file RawTriggerStatsBlock.cxx.

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

00211 {
00212    RawDataBlock::FormatToOStream(os,option);
00213    if (option[0] == 'X') return os;
00214    
00215    // additional block specific formatted output is done here
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 << "   " << GetNumberOfSnarls() << " snarls from "
00223       << GetNumberOfSources() << " sources: " << endl;
00224    for (int i = 0; i<GetNumberOfSources(); i++) {
00225       os << "   src 0x" << hex << GetSourceId(i) << dec
00226          << " gave " << GetSnarlCount(i) << " snarls" << endl;
00227    }
00228 
00229    return os;
00230 }

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

Definition at line 48 of file RawTriggerStatsBlock.h.

References fgDebugFlags.

00048 { return fgDebugFlags; }

VldTimeStamp RawTriggerStatsBlock::GetEndTime (  )  const

Definition at line 133 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream(), and GetVldContext().

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

Int_t RawTriggerStatsBlock::GetNumberOfSnarls (  )  const

Definition at line 167 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Int_t RawTriggerStatsBlock::GetNumberOfSources (  )  const

Definition at line 175 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Int_t RawTriggerStatsBlock::GetRun ( void   )  const

Definition at line 143 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Short_t RawTriggerStatsBlock::GetRunType (  )  const

Definition at line 159 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Int_t RawTriggerStatsBlock::GetSnarlCount ( Int_t  indx  )  const

Definition at line 192 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Int_t RawTriggerStatsBlock::GetSourceId ( Int_t  indx  )  const

Definition at line 183 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

VldTimeStamp RawTriggerStatsBlock::GetStartTime (  )  const

Definition at line 123 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

Short_t RawTriggerStatsBlock::GetSubRun (  )  const

Definition at line 151 of file RawTriggerStatsBlock.cxx.

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

Referenced by FormatToOStream().

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

VldContext RawTriggerStatsBlock::GetVldContext (  )  const

Definition at line 201 of file RawTriggerStatsBlock.cxx.

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

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

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

Definition at line 47 of file RawTriggerStatsBlock.h.

References fgDebugFlags.

00047 {fgDebugFlags=dbgflgs;}


Member Data Documentation

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

Definition at line 59 of file RawTriggerStatsBlock.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