RawRunConfigBlock Class Reference

#include <RawRunConfigBlock.h>

Inheritance diagram for RawRunConfigBlock:
RawDataBlock

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

Char_t * fRunConfig

Static Private Attributes

static UInt_t fgDebugFlags = 0
 not written out

Detailed Description

Definition at line 19 of file RawRunConfigBlock.h.


Constructor & Destructor Documentation

RawRunConfigBlock::RawRunConfigBlock (  ) 

Definition at line 41 of file RawRunConfigBlock.cxx.

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

RawRunConfigBlock::RawRunConfigBlock ( const Int_t *  block  ) 

Definition at line 48 of file RawRunConfigBlock.cxx.

00049    : RawDataBlock(block), fRunConfig(0)
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   time (sec)
00060    //  6   time (nsec)
00061    //  7   comment string (padded to 4 char)
00062 
00063 }

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

Definition at line 66 of file RawRunConfigBlock.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.

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

RawRunConfigBlock::~RawRunConfigBlock (  )  [virtual]

Definition at line 104 of file RawRunConfigBlock.cxx.

References fRunConfig.

00105 {
00106    // dtor
00107    if (fRunConfig) {
00108       delete [] fRunConfig;
00109       fRunConfig = 0;
00110    }
00111 }

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

Definition at line 46 of file RawRunConfigBlock.h.

00047      : RawDataBlock(rhs), fRunConfig(0) { ; }


Member Function Documentation

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

Reimplemented from RawDataBlock.

Definition at line 198 of file RawRunConfigBlock.cxx.

References VldTimeStamp::AsString(), GetRun(), GetRunConfig(), GetRunType(), GetSubRun(), and GetTime().

00200 {
00201    RawDataBlock::FormatToOStream(os,option);
00202    if (option[0] == 'X') return os;
00203    
00204    // additional block specific formatted output is done here
00205 
00206    os << "Time " << GetTime().AsString("c") << endl;
00207    os << " Run " << GetRun()
00208       << " SubRun " << GetSubRun()
00209       << " RunType " << GetRunType() << endl;
00210 //   os << "'" << GetRunConfig() << "'" << endl;
00211    const Char_t* cfg = GetRunConfig();
00212    const Char_t* linestart = " | ";
00213    os << linestart;
00214    while (*cfg != '\0') {
00215       os << *cfg;
00216       if (*cfg == '\n' && *(cfg+1) != '\0') os << linestart;
00217       ++cfg;
00218    }
00219    os << endl;
00220 
00221    return os;
00222 }

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

Definition at line 43 of file RawRunConfigBlock.h.

References fgDebugFlags.

00043 { return fgDebugFlags; }

Int_t RawRunConfigBlock::GetRun ( void   )  const

Definition at line 136 of file RawRunConfigBlock.cxx.

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

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

00137 {
00138    // get the run number
00139 
00140    if ( fSize >= zzzz_last ) return fRawBlock[indx_run];
00141    return -1;
00142 }

const Char_t * RawRunConfigBlock::GetRunConfig (  )  const

Definition at line 173 of file RawRunConfigBlock.cxx.

References RawDataBlock::fRawBlock, fRunConfig, RawDataBlock::fSize, unpack_lel_to_string(), and zzzz_last.

Referenced by FilterRunType::Ana(), RunSummary::Ana(), cfgtest(), FormatToOStream(), FillFarRunQuality::ProcessBlock(), FillNearRunQuality::ProcessBlock(), and OltBlockScan::Reco().

00174 {
00175    // return the run config string
00176 
00177    if (!fRunConfig) {
00178 
00179       Int_t*       insitu = fRawBlock+zzzz_last;
00180 
00181       UInt_t nwd = (fRawBlock+fSize) - insitu;
00182       fRunConfig = unpack_lel_to_string(insitu,nwd);
00183 
00184       // replace non-printable, non-newline characters with blanks
00185       // leave final null (which should be there ... but make sure it is).
00186       int nchar = nwd*sizeof(Int_t)/sizeof(Char_t) - 1;
00187       fRunConfig[nchar] = '\0';
00188       for (int i=0; i<nchar; ++i) {
00189         Char_t c = fRunConfig[i];
00190         if ( !isprint(c) && '\n'!=c ) fRunConfig[i] = ' ';
00191       }
00192 
00193    }
00194    return fRunConfig;
00195 }

Short_t RawRunConfigBlock::GetRunType (  )  const

Definition at line 155 of file RawRunConfigBlock.cxx.

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

Referenced by FormatToOStream().

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

Short_t RawRunConfigBlock::GetSubRun (  )  const

Definition at line 145 of file RawRunConfigBlock.cxx.

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

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

00146 {
00147    // get the subrun number
00148 
00149    if ( fSize >= zzzz_last ) 
00150       return (fRawBlock[indx_subrun]>>16)&0xffff;
00151    return -1;
00152 }

VldTimeStamp RawRunConfigBlock::GetTime ( void   )  const

Definition at line 125 of file RawRunConfigBlock.cxx.

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

Referenced by FormatToOStream(), and GetVldContext().

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

VldContext RawRunConfigBlock::GetVldContext (  )  const

Definition at line 165 of file RawRunConfigBlock.cxx.

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

00166 {
00167    // build validity context
00168    RawBlockId rbid = GetBlockId();
00169    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTime());
00170 }

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

Reimplemented from RawDataBlock.

Definition at line 114 of file RawRunConfigBlock.cxx.

References fRunConfig.

00115 {
00116    // deep copy assignment 
00117   if (this != &rhs) {
00118     RawDataBlock::operator=(rhs);
00119     if (fRunConfig) { delete [] fRunConfig; fRunConfig = 0; }
00120   }
00121   return *this;
00122 }

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

Definition at line 42 of file RawRunConfigBlock.h.

References fgDebugFlags.

00042 {fgDebugFlags=dbgflgs;}


Member Data Documentation

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

not written out

Definition at line 58 of file RawRunConfigBlock.h.

Referenced by GetDebugFlags(), and SetDebugFlags().

Char_t* RawRunConfigBlock::fRunConfig [mutable, protected]

Definition at line 53 of file RawRunConfigBlock.h.

Referenced by GetRunConfig(), operator=(), and ~RawRunConfigBlock().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1