Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RawDcsHeaderBlock.cxx

Go to the documentation of this file.
00001 
00002 // $Id: RawDcsHeaderBlock.cxx,v 1.3 2003/07/10 19:36:29 rhatcher Exp $
00003 // 
00004 // RawDcsHeaderBlock 
00005 // 
00006 // RawDcsHeaderBlock holds the basic Dcs Record Header info
00007 //
00008 // Author:  R. Hatcher 2002.07.13
00009 //
00011 
00012 #include "RawData/RawDcsHeaderBlock.h"
00013 
00014 UInt_t RawDcsHeaderBlock::fgDebugFlags = 0;
00015 
00016 #include "MessageService/MsgService.h"
00017 //CVSID("$Id: RawDcsHeaderBlock.cxx,v 1.3 2003/07/10 19:36:29 rhatcher Exp $");
00018 //#include "MessageService/MsgStream.h"
00019 
00020 #include "RawData/RawBlockRegistry.h"
00021 REGISTERRAWBLOCK(RawDcsHeaderBlock,kMdBlockDcsHeader,1);
00022 
00023 ClassImp(RawDcsHeaderBlock)
00024 
00025 enum EDcsHeaderBlkPos {
00026    indx_size      = 0,
00027    indx_checksum  = 1,
00028    indx_blockid   = 2,
00029    indx_sec       = 3,
00030    indx_nsec      = 4,
00031    zzzz_last      = 5
00032 };
00033 
00034 //_____________________________________________________________________________
00035 RawDcsHeaderBlock::RawDcsHeaderBlock() : RawDataBlock()
00036 {
00037    // Default constructor
00038 }
00039 
00040 //_____________________________________________________________________________
00041 RawDcsHeaderBlock::RawDcsHeaderBlock(const Int_t *block)
00042    : RawDataBlock(block)
00043 {
00044    //  stored block format is:
00045    //---------------------
00046    //  0   # words in block
00047    //  1   checksum
00048    //  2   Block Id
00049    //-----
00050    //  3   timestamp (sec)
00051    //  4   timestamp (nsec)
00052 }
00053 //_____________________________________________________________________________
00054 RawDcsHeaderBlock::RawDcsHeaderBlock(const VldContext& vldc)
00055    : RawDataBlock()
00056 {
00057    // Component ctor
00058 
00059    fSize = zzzz_last;
00060    if (fRawBlock) delete [] fRawBlock;
00061    fRawBlock = new Int_t [fSize];
00062 
00063    fRawBlock[0] = fSize;
00064 // fRawBlock[1] = checksum... see below
00065 
00066    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00067    RawBlockProxy*    rbp = rbr.LookUp("RawDcsHeaderBlock");
00068 
00069    Bool_t isDCS   = rbp->IsDCS();
00070    Int_t  majorId = rbp->GetMajorId();
00071    Int_t  minorId = 1;  // latest and greatest minor version #
00072    RawBlockId rbid(majorId,minorId,isDCS,
00073                    vldc.GetDetector(),vldc.GetSimFlag());
00074    fRawBlock[2] = rbid.GetEncoded();
00075 
00076    fRawBlock[indx_sec]     = vldc.GetTimeStamp().GetSec();
00077    fRawBlock[indx_nsec]    = vldc.GetTimeStamp().GetNanoSec();
00078 
00079    // fill checksum
00080    rdxsum_fill((long*)fRawBlock,0); 
00081 
00082 }
00083 
00084 //_____________________________________________________________________________
00085 RawDcsHeaderBlock::~RawDcsHeaderBlock()
00086 {
00087    // dtor
00088 }
00089 
00090 //_____________________________________________________________________________
00091 VldTimeStamp RawDcsHeaderBlock::GetTimeStamp() const
00092 {
00093    // get the timestamp
00094    if (fSize > indx_nsec) 
00095       return VldTimeStamp(fRawBlock[indx_sec],fRawBlock[indx_nsec]);
00096 
00097    return VldTimeStamp((time_t)0,(Int_t)0);
00098 }
00099 
00100 //_____________________________________________________________________________
00101 VldContext RawDcsHeaderBlock::GetVldContext() const
00102 {
00103    // build validity context
00104    RawBlockId rbid = GetBlockId();
00105    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp());
00106 }
00107 
00108 //_____________________________________________________________________________
00109 std::ostream& RawDcsHeaderBlock::FormatToOStream(ostream& os, 
00110                                                  Option_t *option) const
00111 {
00112    RawDataBlock::FormatToOStream(os,option);
00113    if (option[0] == 'X') return os;
00114 
00115    os << " TimeStamp " << GetTimeStamp().AsString("c") << endl;
00116 
00117    return os;
00118 }
00119 
00120 //_____________________________________________________________________________

Generated on Sat Nov 21 22:47:29 2009 for loon by  doxygen 1.3.9.1