RawSpillServerMonitorBlock Class Reference

#include <RawSpillServerMonitorBlock.h>

Inheritance diagram for RawSpillServerMonitorBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawSpillServerMonitorBlock ()
 RawSpillServerMonitorBlock (const Int_t *block)
 RawSpillServerMonitorBlock (const VldContext &vldc, Int_t run, Short_t subrun, Short_t runtype, Int_t timeframe)
virtual ~RawSpillServerMonitorBlock ()
VldTimeStamp GetTimeStamp () const
VldTimeStamp GetFrameStartTime () const
VldTimeStamp GetFrameEndTime () const
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
Int_t GetTimeFrameNum () const
Int_t GetResponse () const
VldContext GetVldContext () const
const mdSpillData_tGetSpillData () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawSpillServerMonitorBlock (const RawSpillServerMonitorBlock &rhs)

Static Public Member Functions

static const Char_t * ResponseAsString (Int_t spillServerQueryErrors)
static const Char_t * SpillTypeAsString (Int_t spillTypeEnum)
static void SetDebugFlags (const UInt_t dbgflgs)
static UInt_t GetDebugFlags ()

Static Private Attributes

static UInt_t fgDebugFlags = 0

Detailed Description

Definition at line 23 of file RawSpillServerMonitorBlock.h.


Constructor & Destructor Documentation

RawSpillServerMonitorBlock::RawSpillServerMonitorBlock (  ) 

Definition at line 56 of file RawSpillServerMonitorBlock.cxx.

00056                                                        : RawDataBlock()
00057 {
00058    // Default constructor
00059 }

RawSpillServerMonitorBlock::RawSpillServerMonitorBlock ( const Int_t *  block  ) 

Definition at line 62 of file RawSpillServerMonitorBlock.cxx.

00063    : RawDataBlock(block)
00064 {
00065    //  stored block format is:
00066    //---------------------
00067    //  0   # words in block
00068    //  1   checksum
00069    //  2   Block Id
00070    //-----
00071    //  3   run #
00072    //  4   {subrun #| run type}
00073    //  5   timeframe start timestamp (sec)
00074    //  6   timeframe start timestamp (nsec)
00075    //  7   timeframe #
00076    //  8   timeframe end timestamp (sec)
00077    //  9   timeframe end timestamp (nsec)
00078    // 10   query response time (usec if >=0; error code if <0)
00079    // 11   request sec
00080    // 12   isKnown
00081    // 13   spill type
00082    // 14   spill id (unique 'DAQ' id for spill)
00083    // 15   near spill timestamp (sec)
00084    // 16   near spill timestamp (nsec)
00085    // 17   far spill timestamp (sec)
00086    // 18   far spill timestamp (nsec)
00087    // 19   estimated worst case error (nsec)
00088    // 20   suggested window open time (nsec)
00089    // 21   suggested window close time (nsec)
00090 }

RawSpillServerMonitorBlock::RawSpillServerMonitorBlock ( const VldContext vldc,
Int_t  run,
Short_t  subrun,
Short_t  runtype,
Int_t  timeframe 
)

Definition at line 92 of file RawSpillServerMonitorBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, VldContext::GetDetector(), RawBlockProxy::GetMajorId(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), indx_close_ns, indx_end_nsec, indx_end_sec, indx_esterr_ns, indx_far_nsec, indx_far_sec, indx_isknown, indx_near_nsec, indx_near_sec, indx_open_ns, indx_request, indx_response, indx_run, indx_spillid, indx_spilltype, indx_start_nsec, indx_start_sec, indx_subrun, indx_tf, RawBlockRegistry::Instance(), RawBlockProxy::IsDCS(), RawBlockRegistry::LookUp(), rdxsum_fill(), and zzzz_last.

00095    : RawDataBlock()
00096 {
00097    // Component ctor
00098 
00099    fSize = zzzz_last;
00100    if (fRawBlock) delete [] fRawBlock;
00101    fRawBlock = new Int_t [fSize];
00102 
00103    fRawBlock[0] = fSize;
00104 // fRawBlock[1] = checksum... see below
00105 
00106    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00107    RawBlockProxy*    rbp = rbr.LookUp("RawSpillServerMonitorBlock");
00108 
00109    Bool_t isDCS   = rbp->IsDCS();
00110    Int_t  majorId = rbp->GetMajorId();
00111    Int_t  minorId = 1;  // latest and greatest minor version #
00112    RawBlockId rbid(majorId,minorId,isDCS,
00113                    vldc.GetDetector(),vldc.GetSimFlag());
00114    fRawBlock[2] = rbid.GetEncoded();
00115 
00116    fRawBlock[indx_run]         = run;
00117    fRawBlock[indx_subrun]      = (subrun&0xffff)<<16 | (runtype&0xffff);
00118    fRawBlock[indx_start_sec]   = vldc.GetTimeStamp().GetSec();
00119    fRawBlock[indx_start_nsec]  = vldc.GetTimeStamp().GetNanoSec();
00120    fRawBlock[indx_tf]          = timeframe;
00121    fRawBlock[indx_end_sec]     = fRawBlock[indx_start_sec] + 1;
00122    fRawBlock[indx_end_nsec]    = fRawBlock[indx_start_nsec];
00123    fRawBlock[indx_response]    = -1;
00124    fRawBlock[indx_request]     = 0;
00125    fRawBlock[indx_isknown]     = 0;
00126    fRawBlock[indx_spilltype]   = -1;
00127    fRawBlock[indx_spillid]     = 0;
00128    fRawBlock[indx_near_sec]    = 0;
00129    fRawBlock[indx_near_sec]    = 0;
00130    fRawBlock[indx_near_nsec]   = 0;
00131    fRawBlock[indx_far_sec]     = 0;
00132    fRawBlock[indx_far_nsec]    = 0;
00133    fRawBlock[indx_esterr_ns]   = 0;
00134    fRawBlock[indx_open_ns]     = 0;
00135    fRawBlock[indx_close_ns]    = 0;
00136 
00137    // fill checksum
00138    rdxsum_fill((int32_t*)fRawBlock,0); 
00139 
00140 }

RawSpillServerMonitorBlock::~RawSpillServerMonitorBlock (  )  [virtual]

Definition at line 143 of file RawSpillServerMonitorBlock.cxx.

00144 {
00145    // dtor
00146 }

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

Definition at line 60 of file RawSpillServerMonitorBlock.h.

00061      : RawDataBlock(rhs) { ; }


Member Function Documentation

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

Reimplemented from RawDataBlock.

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

Definition at line 57 of file RawSpillServerMonitorBlock.h.

References fgDebugFlags.

00057 { return fgDebugFlags; }

VldTimeStamp RawSpillServerMonitorBlock::GetFrameEndTime (  )  const

Definition at line 160 of file RawSpillServerMonitorBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_end_nsec, and indx_end_sec.

00161 {
00162    // get the timestamp for the end of the timeframe
00163 
00164    if (fSize > indx_end_nsec) 
00165       return VldTimeStamp(fRawBlock[indx_end_sec],
00166                           fRawBlock[indx_end_nsec]);
00167 
00168    return VldTimeStamp((time_t)0,(Int_t)0);
00169 }

VldTimeStamp RawSpillServerMonitorBlock::GetFrameStartTime (  )  const

Definition at line 149 of file RawSpillServerMonitorBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_start_nsec, and indx_start_sec.

Referenced by GetTimeStamp().

00150 {
00151    // get the timestamp for the start of the timeframe
00152    if (fSize > indx_start_nsec) 
00153       return VldTimeStamp(fRawBlock[indx_start_sec],
00154                           fRawBlock[indx_start_nsec]);
00155 
00156    return VldTimeStamp((time_t)0,(Int_t)0);
00157 }

Int_t RawSpillServerMonitorBlock::GetResponse (  )  const

Definition at line 204 of file RawSpillServerMonitorBlock.cxx.

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

00205 {
00206    // get the time taken to obtain data from server (in usec)
00207    if (fSize > indx_response) return fRawBlock[indx_response];
00208    return -1;
00209 }

Int_t RawSpillServerMonitorBlock::GetRun ( void   )  const

Definition at line 172 of file RawSpillServerMonitorBlock.cxx.

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

00173 {
00174    // get the run number
00175    if (fSize > indx_run) return fRawBlock[indx_run];
00176    return -1;
00177 }

Short_t RawSpillServerMonitorBlock::GetRunType (  )  const

Definition at line 188 of file RawSpillServerMonitorBlock.cxx.

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

00189 {
00190    // get the run type
00191    if (fSize > indx_runtype) return fRawBlock[indx_runtype]&0xffff;
00192    return -1;
00193 }

const mdSpillData_t & RawSpillServerMonitorBlock::GetSpillData (  )  const

Definition at line 212 of file RawSpillServerMonitorBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_response, and indx_spilldata.

Referenced by DQSpillServer::Process(), FarDetDataQualityModule::ProcessBlock(), and FillSpillServerMon::ProcessBlock().

00213 {
00214    // get the mdSpillData_t structure
00215   static mdSpillData_t dummySpillData; // = {0,0,0,0,0,0,0,0,0,0,0};
00216 
00217   if ((unsigned int)fSize > indx_response+sizeof(mdSpillRequest_t)) {
00218     return *(mdSpillData_t*)(fRawBlock+indx_spilldata);
00219   }
00220   else return dummySpillData;
00221 }

Short_t RawSpillServerMonitorBlock::GetSubRun (  )  const

Definition at line 180 of file RawSpillServerMonitorBlock.cxx.

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

00181 {
00182    // get the subrun number
00183    if (fSize > indx_subrun) return (fRawBlock[indx_subrun]>>16)&0xffff;
00184    return -1;
00185 }

Int_t RawSpillServerMonitorBlock::GetTimeFrameNum (  )  const

Definition at line 196 of file RawSpillServerMonitorBlock.cxx.

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

00197 {
00198    // get the timeframe number
00199    if (fSize > indx_tf) return fRawBlock[indx_tf];
00200    return -1;
00201 }

VldTimeStamp RawSpillServerMonitorBlock::GetTimeStamp (  )  const [inline]
VldContext RawSpillServerMonitorBlock::GetVldContext (  )  const

Definition at line 224 of file RawSpillServerMonitorBlock.cxx.

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

00225 {
00226    // build validity context
00227    RawBlockId rbid = GetBlockId();
00228    return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp());
00229 }

const Char_t * RawSpillServerMonitorBlock::ResponseAsString ( Int_t  spillServerQueryErrors  )  [static]

Definition at line 286 of file RawSpillServerMonitorBlock.cxx.

References Form(), kSpillServerCommsFailure, kSpillServerHangUp, kSpillServerIncompleteData, kSpillServerNoConnect, kSpillServerNotAsked, and kSpillServerTimeout.

00287 {
00288   // interpret response error codes -- tpSpillServerQueryErrors
00289  
00290   if (response>=0) return Form("in %d usec",response);
00291 
00292   switch (response) {
00293   case kSpillServerNotAsked:       return "No query to Spill Server ";                  break;
00294   case kSpillServerNoConnect:      return "Connection to Spill Server failed";          break;
00295   case kSpillServerCommsFailure:   return "Spill Server socket communications failure"; break;
00296   case kSpillServerHangUp:         return "Spill Server hung up before response";       break;
00297   case kSpillServerTimeout:        return "Timeout before Spill Server responded";      break;
00298   case kSpillServerIncompleteData: return "Incomplete Data received from Spill Server"; break;
00299   default: return "unknown tpSpillServerQueryError"; break;
00300   }
00301 }

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

Definition at line 56 of file RawSpillServerMonitorBlock.h.

References fgDebugFlags.

00056 {fgDebugFlags=dbgflgs;}

const Char_t * RawSpillServerMonitorBlock::SpillTypeAsString ( Int_t  spillTypeEnum  )  [static]

Definition at line 304 of file RawSpillServerMonitorBlock.cxx.

References kSpillType_Fake, kSpillType_Local, kSpillType_None, kSpillType_Predicted, and kSpillType_Reported.

00305 {
00306   // interpret spill types -- mdSpillTypeEnum
00307 
00308   switch (spillType) {
00309   case kSpillType_None:      return "None";              break;
00310   case kSpillType_Reported:  return "Reported";          break;
00311   case kSpillType_Predicted: return "Predicted";         break;
00312   case kSpillType_Fake:      return "Fake";              break;
00313   case kSpillType_Local:     return "Local";             break;
00314   default:                   return "Unknown mdSpillTypeEnum"; break;
00315   }
00316 }


Member Data Documentation

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

Definition at line 68 of file RawSpillServerMonitorBlock.h.

Referenced by GetDebugFlags(), and SetDebugFlags().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1