RawRunCommentBlock Class Reference

#include <RawRunCommentBlock.h>

Inheritance diagram for RawRunCommentBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawRunCommentBlock ()
 RawRunCommentBlock (const Int_t *block)
 RawRunCommentBlock (const VldContext &vldc, Int_t run, Short_t subrun, Short_t runtype, const Char_t *comment)
 RawRunCommentBlock (const VldContext &vldc, const Char_t *comment)
virtual ~RawRunCommentBlock ()
VldTimeStamp GetTime () const
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
VldContext GetVldContext () const
const Char_t * GetRunComment () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawRunCommentBlock (const RawRunCommentBlock &rhs)
RawRunCommentBlockoperator= (const RawRunCommentBlock &rhs)

Static Public Member Functions

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

Protected Attributes

Char_t * fRunComment

Static Private Attributes

static UInt_t fgDebugFlags = 0
 not written out

Detailed Description

Definition at line 19 of file RawRunCommentBlock.h.


Constructor & Destructor Documentation

RawRunCommentBlock::RawRunCommentBlock (  ) 

Definition at line 45 of file RawRunCommentBlock.cxx.

00046    : RawDataBlock(), fRunComment(0)
00047 {
00048    // Default constructor
00049 }

RawRunCommentBlock::RawRunCommentBlock ( const Int_t *  block  ) 

Definition at line 52 of file RawRunCommentBlock.cxx.

00053    : RawDataBlock(block), fRunComment(0)
00054 {
00055    //  stored block format is:
00056    //---------------------
00057    //  0   # words in block
00058    //  1   checksum
00059    //  2   Block Id
00060    //-----
00061    //  3   run #
00062    //  4   {subrun#| run type}
00063    //  5   time (sec)
00064    //  6   time (nsec)
00065    //  7   comment string (padded to 4 char)
00066 
00067    // version < 2 had "comment" field starting at word 3
00068 }

RawRunCommentBlock::RawRunCommentBlock ( const VldContext vldc,
Int_t  run,
Short_t  subrun,
Short_t  runtype,
const Char_t *  comment 
)

Definition at line 71 of file RawRunCommentBlock.cxx.

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

00074    : RawDataBlock(), fRunComment(0)
00075 {
00076    // Component ctor (version 2)
00077 
00078    UInt_t nwdc  = nwords_in_string(comment);
00079    fSize = zzzz_last + nwdc;
00080    if (fRawBlock) delete [] fRawBlock;
00081    fRawBlock = new Int_t [fSize];  
00082 
00083    fRawBlock[0] = fSize;
00084 // fRawBlock[1] = checksum... see below
00085  
00086    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00087    RawBlockProxy*    rbp = rbr.LookUp("RawRunCommentBlock");
00088  
00089    Bool_t isDCS   = rbp->IsDCS();
00090    Int_t  majorId = rbp->GetMajorId();
00091    Int_t  minorId = 2;
00092    RawBlockId rbid(majorId,minorId,isDCS,
00093                    vldc.GetDetector(),vldc.GetSimFlag());
00094    fRawBlock[2] = rbid.GetEncoded();
00095  
00096    fRawBlock[indx_run]     = run;
00097    fRawBlock[indx_subrun]  = (subrun&0xffff)<<16 | (runtype&0xffff);
00098    fRawBlock[indx_startsec]     = vldc.GetTimeStamp().GetSec();
00099    fRawBlock[indx_startnsec]    = vldc.GetTimeStamp().GetNanoSec();
00100  
00101    fRawBlock[fSize-1] = 0; // ensure final '\0'
00102    pack_string_in_lel(fRawBlock+zzzz_last,comment);
00103 
00104    // fill checksum
00105    rdxsum_fill((int32_t*)fRawBlock,0);
00106 }

RawRunCommentBlock::RawRunCommentBlock ( const VldContext vldc,
const Char_t *  comment 
)

Definition at line 109 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, VldContext::GetDetector(), RawBlockProxy::GetMajorId(), VldContext::GetSimFlag(), RawBlockRegistry::Instance(), RawBlockProxy::IsDCS(), RawBlockRegistry::LookUp(), nwords_in_string(), pack_string_in_lel(), rdxsum_fill(), and zzzz_last_v1.

00112    : RawDataBlock(), fRunComment(0)
00113 {
00114    // Component ctor (version 1)
00115 
00116    UInt_t nwdc  = nwords_in_string(comment);
00117    fSize = zzzz_last_v1 + nwdc;
00118    if (fRawBlock) delete [] fRawBlock;
00119    fRawBlock = new Int_t [fSize];  
00120 
00121    fRawBlock[0] = fSize;
00122 // fRawBlock[1] = checksum... see below
00123  
00124    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00125    RawBlockProxy*    rbp = rbr.LookUp("RawRunCommentBlock");
00126  
00127    Bool_t isDCS   = rbp->IsDCS();
00128    Int_t  majorId = rbp->GetMajorId();
00129    Int_t  minorId = 1;
00130    RawBlockId rbid(majorId,minorId,isDCS,
00131                    vldc.GetDetector(),vldc.GetSimFlag());
00132    fRawBlock[2] = rbid.GetEncoded();
00133  
00134    fRawBlock[fSize-1] = 0; // ensure final '\0'
00135    pack_string_in_lel(fRawBlock+zzzz_last_v1,comment);
00136 
00137    // fill checksum
00138    rdxsum_fill((int32_t*)fRawBlock,0);
00139 }

RawRunCommentBlock::~RawRunCommentBlock (  )  [virtual]

Definition at line 142 of file RawRunCommentBlock.cxx.

References fRunComment.

00143 {
00144    // dtor
00145    if (fRunComment) {
00146       delete [] fRunComment;
00147       fRunComment = 0;
00148    }
00149 }

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

Definition at line 48 of file RawRunCommentBlock.h.

00049      : RawDataBlock(rhs), fRunComment(0) { ; }


Member Function Documentation

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

Reimplemented from RawDataBlock.

Definition at line 247 of file RawRunCommentBlock.cxx.

References VldTimeStamp::AsString(), fgDebugFlags, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), GetRun(), GetRunComment(), GetRunType(), GetSubRun(), GetTime(), and kdbg_ForceHexDump.

00249 {
00250    if (fgDebugFlags & kdbg_ForceHexDump) option = "x";
00251 
00252    RawDataBlock::FormatToOStream(os,option);
00253    if (option[0] == 'X') return os;
00254    
00255    // additional block specific formatted output is done here
00256 
00257    Int_t minor = GetBlockId().GetMinor();
00258    if (minor >= 2) {
00259       os << "Time " << GetTime().AsString("c") << endl;
00260       os << " Run " << GetRun()
00261          << " SubRun " << GetSubRun()
00262          << " RunType " << GetRunType() << endl;
00263    }
00264 //   os << "'" << GetRunComment() << "'" << endl;
00265    const Char_t* cmt = GetRunComment();
00266    const Char_t* linestart = " | ";
00267    os << linestart;
00268    while (*cmt != '\0') {
00269       os << *cmt;
00270       if (*cmt == '\n' && *(cmt+1) != '\0') os << linestart;
00271       ++cmt;
00272    }
00273    os << endl;
00274 
00275    return os;
00276 }

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

Definition at line 45 of file RawRunCommentBlock.h.

References fgDebugFlags.

00045 { return fgDebugFlags; }

Int_t RawRunCommentBlock::GetRun ( void   )  const

Definition at line 176 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), indx_run, and zzzz_last.

Referenced by RunSummary::Ana(), and FormatToOStream().

00177 {
00178    // get the run number
00179 
00180    Int_t minor = GetBlockId().GetMinor();
00181 
00182    if ( fSize >= zzzz_last && minor>=2 ) return fRawBlock[indx_run];
00183    return -1;
00184 }

const Char_t * RawRunCommentBlock::GetRunComment (  )  const

Definition at line 219 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, fRunComment, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), unpack_lel_to_string(), zzzz_last, and zzzz_last_v1.

Referenced by RunSummary::Ana(), FormatToOStream(), AutoPIDMaker::Get(), LISummaryModule::GetPulserBlocks(), DbuDaqMonitorModule::ProcessRawRecord(), OltTimeScan::Reco(), OltEnds::Reco(), and OltBlockScan::Reco().

00220 {
00221    // return the run comment
00222 
00223    if (!fRunComment) {
00224 
00225       Int_t minor = GetBlockId().GetMinor();
00226 
00227       Int_t*       insitu = fRawBlock+zzzz_last;
00228       if (minor<2) insitu = fRawBlock+zzzz_last_v1;
00229 
00230       UInt_t nwd = (fRawBlock+fSize) - insitu;
00231       fRunComment = unpack_lel_to_string(insitu,nwd);
00232 
00233       // replace non-printable, non-newline characters with blanks
00234       // leave final null (which should be there ... but make sure it is).
00235       int nchar = nwd*sizeof(Int_t)/sizeof(Char_t) - 1;
00236       fRunComment[nchar] = '\0';
00237       for (int i=0; i<nchar; ++i) {
00238         Char_t c = fRunComment[i];
00239         if ( !isprint(c) && '\n'!=c ) fRunComment[i] = ' ';
00240       }
00241 
00242    }
00243    return fRunComment;
00244 }

Short_t RawRunCommentBlock::GetRunType (  )  const

Definition at line 199 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), indx_runtype, and zzzz_last.

Referenced by FormatToOStream().

00200 {
00201    // get the run type
00202 
00203    Int_t minor = GetBlockId().GetMinor();
00204 
00205    if ( fSize >= zzzz_last && minor>= 2 ) 
00206       return fRawBlock[indx_runtype]&0xffff;
00207    return -1;
00208 }

Short_t RawRunCommentBlock::GetSubRun (  )  const

Definition at line 187 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), indx_subrun, and zzzz_last.

Referenced by RunSummary::Ana(), and FormatToOStream().

00188 {
00189    // get the subrun number
00190 
00191    Int_t minor = GetBlockId().GetMinor();
00192 
00193    if ( fSize >= zzzz_last && minor>=2 ) 
00194       return (fRawBlock[indx_subrun]>>16)&0xffff;
00195    return -1;
00196 }

VldTimeStamp RawRunCommentBlock::GetTime ( void   )  const

Definition at line 163 of file RawRunCommentBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawBlockId::GetMinor(), indx_startnsec, indx_startsec, and zzzz_last.

Referenced by FormatToOStream(), GetVldContext(), and DbuDaqMonitorModule::ProcessRawRecord().

00164 {
00165    // get the trigger time
00166 
00167    Int_t minor = GetBlockId().GetMinor();
00168 
00169    if ( fSize >= zzzz_last && minor>=2 )
00170       return VldTimeStamp(fRawBlock[indx_startsec],fRawBlock[indx_startnsec]);
00171  
00172    return VldTimeStamp((time_t)0,(Int_t)0);
00173 }

VldContext RawRunCommentBlock::GetVldContext (  )  const

Definition at line 211 of file RawRunCommentBlock.cxx.

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

00212 {
00213    // build validity context
00214    RawBlockId rbid = GetBlockId();
00215    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTime());
00216 }

RawRunCommentBlock & RawRunCommentBlock::operator= ( const RawRunCommentBlock rhs  ) 

Reimplemented from RawDataBlock.

Definition at line 152 of file RawRunCommentBlock.cxx.

References fRunComment.

00153 {
00154    // deep copy assignment 
00155   if (this != &rhs) {
00156     RawDataBlock::operator=(rhs);
00157     if (fRunComment) { delete [] fRunComment; fRunComment = 0; }
00158   }
00159   return *this;
00160 }

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

Definition at line 44 of file RawRunCommentBlock.h.

References fgDebugFlags.

00044 {fgDebugFlags=dbgflgs;}


Member Data Documentation

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

not written out

Definition at line 60 of file RawRunCommentBlock.h.

Referenced by FormatToOStream(), GetDebugFlags(), and SetDebugFlags().

Char_t* RawRunCommentBlock::fRunComment [mutable, protected]

Definition at line 55 of file RawRunCommentBlock.h.

Referenced by GetRunComment(), operator=(), and ~RawRunCommentBlock().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1