RawVtmTimeInfoBlock Class Reference

#include <RawVtmTimeInfoBlock.h>

Inheritance diagram for RawVtmTimeInfoBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawVtmTimeInfoBlock ()
 RawVtmTimeInfoBlock (const Int_t *block)
virtual ~RawVtmTimeInfoBlock ()
Int_t GetRun () const
Short_t GetSubRun () const
Short_t GetRunType () const
VldTimeStamp GetTimeStamp () const
VldContext GetVldContext () const
ElecType::Elec_t GetElecType () const
Bool_t GetPedMode () const
Bool_t GetSparsMode () const
Bool_t GetCommonMode () const
UShort_t GetCrate () const
Int_t GetCrateIdInfo () const
Int_t GetTimeFrameNum () const
Int_t GetLastRFClock () const
Int_t GetLastTimeStamp () const
Int_t GetSpillTimeRF () const
Int_t GetSpillTimeGPS () const
Int_t GetClockStatus () const
Bool_t VtmInError () const
Bool_t ModuleInError (UShort_t indx) const
std::vector< UShort_t > ErrorModules () const
Int_t GetLastRFClockFromPrevTF () const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawVtmTimeInfoBlock (const RawVtmTimeInfoBlock &rhs)
RawVtmTimeInfoBlockoperator= (const RawVtmTimeInfoBlock &rhs)

Static Public Member Functions

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

Protected Member Functions

virtual void FillCrateId () const

Protected Attributes

RawChannelId fCrateId

Static Private Attributes

static UInt_t fgDebugFlags = 0
 unpacked crateinfo

Detailed Description

Definition at line 24 of file RawVtmTimeInfoBlock.h.


Constructor & Destructor Documentation

RawVtmTimeInfoBlock::RawVtmTimeInfoBlock (  ) 

Definition at line 51 of file RawVtmTimeInfoBlock.cxx.

00052   : RawDataBlock(), fCrateId()
00053 {
00054    // Default constructor
00055 }

RawVtmTimeInfoBlock::RawVtmTimeInfoBlock ( const Int_t *  block  ) 

Definition at line 58 of file RawVtmTimeInfoBlock.cxx.

00059   : RawDataBlock(block), fCrateId()
00060 {
00061    //  stored block format is:
00062    //---------------------
00063    //  0   # words in block
00064    //  1   checksum
00065    //  2   Block Id
00066    //-----
00067    //  3   run #
00068    //  4   subRunAndType
00069    //  5   timestamp sec
00070    //  6   timestamp nsec
00071    //  7   crateIdentifier
00072    //  8   timeFrameNumber
00073    //  9   lastRFClock
00074    // 10   spillTimeRF
00075    // 11   spillTimeGPS
00076    // 12   clockStatus   (version 2 and above)
00077    // 13   endLastTF     (version 3 and above)
00078 
00079 }

RawVtmTimeInfoBlock::~RawVtmTimeInfoBlock (  )  [virtual]

Definition at line 82 of file RawVtmTimeInfoBlock.cxx.

00083 {
00084   // dtor
00085 }

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

Definition at line 67 of file RawVtmTimeInfoBlock.h.

00068      : RawDataBlock(rhs), fCrateId(rhs.fCrateId)
00069      { ; }


Member Function Documentation

std::vector< UShort_t > RawVtmTimeInfoBlock::ErrorModules (  )  const

Definition at line 206 of file RawVtmTimeInfoBlock.cxx.

References ModuleInError().

Referenced by FormatToOStream().

00207 {
00208   // return list of module that were in the error state
00209   std::vector<UShort_t> mdlsInError;
00210 
00211   for (unsigned short mdl = 0; mdl < 15; ++mdl) {
00212     if ( ModuleInError(mdl) ) mdlsInError.push_back(mdl);
00213   }
00214 
00215   return mdlsInError;
00216 }

void RawVtmTimeInfoBlock::FillCrateId (  )  const [protected, virtual]

Definition at line 293 of file RawVtmTimeInfoBlock.cxx.

References fCrateId, RawDataBlock::GetBlockId(), GetCrateIdInfo(), DataUtil::GetDetector(), and RawChannelId::IsNull().

Referenced by GetCommonMode(), GetCrate(), GetElecType(), GetPedMode(), and GetSparsMode().

00294 {
00295    // unpack crate info
00296    if (!fCrateId.IsNull()) return;
00297    fCrateId = RawChannelId(GetBlockId().GetDetector(),GetCrateIdInfo(),0x1fff);
00298 }

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

Reimplemented from RawDataBlock.

Definition at line 235 of file RawVtmTimeInfoBlock.cxx.

References VldTimeStamp::AsString(), ErrorModules(), fgDebugFlags, GetClockStatus(), GetCrateIdInfo(), GetLastRFClockFromPrevTF(), GetLastTimeStamp(), RawDataBlock::GetMinorId(), GetRun(), GetRunType(), GetSpillTimeGPS(), GetSpillTimeRF(), GetSubRun(), GetTimeFrameNum(), GetTimeStamp(), kdbg_ForceHexDump, and VtmInError().

00237 {
00238    if (fgDebugFlags & kdbg_ForceHexDump) option = "x";
00239 
00240    RawDataBlock::FormatToOStream(os,option);
00241    if (option[0] == 'X') return os;
00242 
00243    // additional block specific formatted output is done here
00244 
00245    os << " TimeStamp " << GetTimeStamp().AsString("c")
00246       << " TimeFrame " << GetTimeFrameNum() << endl;
00247    os << " Run " << GetRun()
00248       << " SubRun " << GetSubRun()
00249       << " RunType " << GetRunType();
00250    int crateid = GetCrateIdInfo();
00251 
00252    os << " Crate " << (crateid&0x3f)
00253       << " (0x" << hex << crateid << dec << ") had: " << endl
00254       << " LastTimeStamp " << setw(8) << GetLastTimeStamp()
00255       << " SpillTimeRF "   << setw(8) << GetSpillTimeRF()
00256       << " SpillTimeGPS "  << setw(8) << GetSpillTimeGPS()
00257       << endl;
00258 
00259    int minor = GetMinorId();
00260 
00261    if (minor > 1) {
00262      os << " ClockStatus 0x" 
00263         << std::hex << std::setfill('0') 
00264         << setw(8) << GetClockStatus()
00265         << std::setfill(' ') << std::dec;
00266 
00267      if ( ! VtmInError() ) os << " Vtm Okay,";
00268      else                  os << " Vtm Error,";
00269 
00270      std::vector<UShort_t> mdlsInError = ErrorModules();
00271      unsigned int nerr = mdlsInError.size();
00272      if ( nerr == 0 ) os << " No Module Errors";
00273      else {
00274        if ( nerr == 1 ) os << " Error in Module " << mdlsInError[0];
00275        else {
00276          os << " Errors in Modules:";
00277          for (unsigned short i = 0; i < nerr; ++i)
00278            os << " " << mdlsInError[i];
00279        }
00280      }
00281      os << "." << endl;
00282    }
00283    if (minor > 2) {
00284      os << " LastRFClockFromPrevTF " 
00285         << setw(10) << GetLastRFClockFromPrevTF()
00286         << endl;
00287    }
00288 
00289    return os;
00290 }

Int_t RawVtmTimeInfoBlock::GetClockStatus (  )  const

Definition at line 173 of file RawVtmTimeInfoBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, RawDataBlock::GetMinorId(), indx_clockstatus, Msg::kWarning, and MSG.

Referenced by FormatToOStream(), ModuleInError(), and VtmInError().

00174 {
00175    // get the latched bits from each mtm and vtm
00176    const Int_t badValue = -1;
00177    if (GetMinorId() <= 1 || fSize <= indx_clockstatus) {
00178      MSG("RawData",Msg::kWarning)
00179        << "GetClockStatus() not available fSize " << fSize
00180        << " MinorId " << GetMinorId() << endl;
00181      return badValue;
00182    }
00183    return fRawBlock[indx_clockstatus];
00184 }

Bool_t RawVtmTimeInfoBlock::GetCommonMode (  )  const [inline]

Definition at line 98 of file RawVtmTimeInfoBlock.h.

References fCrateId, FillCrateId(), and RawChannelId::GetCommonMode().

00099 { FillCrateId(); return fCrateId.GetCommonMode(); }

UShort_t RawVtmTimeInfoBlock::GetCrate (  )  const [inline]

Definition at line 101 of file RawVtmTimeInfoBlock.h.

References fCrateId, FillCrateId(), and RawChannelId::GetCrate().

Referenced by FiltSGateModule::ProcessVtmTimeInfoBlks().

00102 { FillCrateId(); return fCrateId.GetCrate(); }

Int_t RawVtmTimeInfoBlock::GetCrateIdInfo (  )  const

Definition at line 133 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by FillCrateId(), and FormatToOStream().

00134 {
00135    // get the crate id info (packed)
00136    if (fSize > indx_crateid) return fRawBlock[indx_crateid];
00137    return -1;
00138 }

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

Definition at line 64 of file RawVtmTimeInfoBlock.h.

References fgDebugFlags.

00064 { return fgDebugFlags; }

ElecType::Elec_t RawVtmTimeInfoBlock::GetElecType (  )  const [inline]

Definition at line 89 of file RawVtmTimeInfoBlock.h.

References fCrateId, FillCrateId(), and RawChannelId::GetElecType().

00090 { FillCrateId(); return fCrateId.GetElecType(); }

Int_t RawVtmTimeInfoBlock::GetLastRFClock (  )  const

Definition at line 149 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by NtpSRModule::FillNtpTimeStatus(), and GetLastTimeStamp().

00150 {
00151    // get the RF clock counter at end of time frame
00152    if (fSize > indx_lastrfclock) return fRawBlock[indx_lastrfclock];
00153    return -1;
00154 }

Int_t RawVtmTimeInfoBlock::GetLastRFClockFromPrevTF (  )  const

Definition at line 219 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by NtpSRModule::FillNtpTimeStatus(), and FormatToOStream().

00220 {
00221    // get the RF clock at the counter reset on the previous time frame
00222    if (fSize > indx_endlasttf) return fRawBlock[indx_endlasttf];
00223    return -1;
00224 }

Int_t RawVtmTimeInfoBlock::GetLastTimeStamp (  )  const [inline]

Definition at line 104 of file RawVtmTimeInfoBlock.h.

References GetLastRFClock().

Referenced by FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00105 { return GetLastRFClock(); }

Bool_t RawVtmTimeInfoBlock::GetPedMode (  )  const [inline]

Definition at line 92 of file RawVtmTimeInfoBlock.h.

References fCrateId, FillCrateId(), and RawChannelId::GetPedMode().

00093 { FillCrateId(); return fCrateId.GetPedMode(); }

Int_t RawVtmTimeInfoBlock::GetRun ( void   )  const

Definition at line 109 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00110 {
00111    // get the run number
00112    if (fSize > indx_run) return fRawBlock[indx_run];
00113    return -1;
00114 }

Short_t RawVtmTimeInfoBlock::GetRunType (  )  const

Definition at line 125 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by FormatToOStream().

00126 {
00127    // get the run type
00128    if (fSize > indx_runtype) return fRawBlock[indx_runtype]&0xffff;
00129    return -1;
00130 }

Bool_t RawVtmTimeInfoBlock::GetSparsMode (  )  const [inline]

Definition at line 95 of file RawVtmTimeInfoBlock.h.

References fCrateId, FillCrateId(), and RawChannelId::GetSparsMode().

00096 { FillCrateId(); return fCrateId.GetSparsMode(); }

Int_t RawVtmTimeInfoBlock::GetSpillTimeGPS (  )  const

Definition at line 165 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by NtpSRModule::FillNtpTimeStatus(), FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00166 {
00167    // get the latched GPS 10Mhz dounter at spill gate
00168    if (fSize > indx_spilltimegps) return fRawBlock[indx_spilltimegps];
00169    return -1;
00170 }

Int_t RawVtmTimeInfoBlock::GetSpillTimeRF (  )  const

Definition at line 157 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by NtpSRModule::FillNtpTimeStatus(), FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00158 {
00159    // get the latched timestamp counter at spill gate
00160    if (fSize > indx_spilltimerf) return fRawBlock[indx_spilltimerf];
00161    return -1;
00162 }

Short_t RawVtmTimeInfoBlock::GetSubRun (  )  const

Definition at line 117 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00118 {
00119    // get the subrun number
00120    if (fSize > indx_subrun) return (fRawBlock[indx_subrun]>>16)&0xffff;
00121    return -1;
00122 }

Int_t RawVtmTimeInfoBlock::GetTimeFrameNum (  )  const

Definition at line 141 of file RawVtmTimeInfoBlock.cxx.

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

Referenced by NtpSRModule::FillNtpTimeStatus(), FormatToOStream(), and FiltSGateModule::ProcessVtmTimeInfoBlks().

00142 {
00143    // get the time frame
00144    if (fSize > indx_tf) return fRawBlock[indx_tf];
00145    return -1;
00146 }

VldTimeStamp RawVtmTimeInfoBlock::GetTimeStamp (  )  const

Definition at line 99 of file RawVtmTimeInfoBlock.cxx.

References RawDataBlock::fRawBlock, RawDataBlock::fSize, indx_nsec, and indx_sec.

Referenced by FormatToOStream(), and GetVldContext().

00100 {
00101    // get the timestamp
00102    if (fSize > indx_nsec) 
00103       return VldTimeStamp(fRawBlock[indx_sec],fRawBlock[indx_nsec]);
00104 
00105    return VldTimeStamp((time_t)0,(Int_t)0);
00106 }

VldContext RawVtmTimeInfoBlock::GetVldContext (  )  const

Definition at line 227 of file RawVtmTimeInfoBlock.cxx.

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

00228 {
00229    // build validity context
00230   RawBlockId rbid = GetBlockId();
00231   return VldContext(rbid.GetDetector(),rbid.GetSimFlag(),GetTimeStamp());
00232 }

Bool_t RawVtmTimeInfoBlock::ModuleInError ( UShort_t  indx  )  const

Definition at line 196 of file RawVtmTimeInfoBlock.cxx.

References GetClockStatus().

Referenced by ErrorModules().

00197 {
00198   // return whether a module was in an error state
00199   Int_t status = GetClockStatus();
00200   // the modules are only bit 0-14
00201   if (indx > 14) return true;
00202   return ((1<<indx) & status);
00203 }

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

Reimplemented from RawDataBlock.

Definition at line 88 of file RawVtmTimeInfoBlock.cxx.

References fCrateId.

00089 {
00090    // deep copy assignment 
00091    if (this != &rhs) {
00092      RawDataBlock::operator=(rhs);
00093      fCrateId = rhs.fCrateId;
00094    }
00095    return *this;
00096 }

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

Definition at line 63 of file RawVtmTimeInfoBlock.h.

References fgDebugFlags.

00063 {fgDebugFlags=dbgflgs;}

Bool_t RawVtmTimeInfoBlock::VtmInError (  )  const

Definition at line 187 of file RawVtmTimeInfoBlock.cxx.

References GetClockStatus().

Referenced by FormatToOStream().

00188 {
00189   // return whether the was in an error state
00190   Int_t status = GetClockStatus();
00191   // the modules are bits 0-14, vtm is bit 15
00192   return ((1<<15) & status);
00193 }


Member Data Documentation

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

unpacked crateinfo

Definition at line 84 of file RawVtmTimeInfoBlock.h.

Referenced by FormatToOStream(), 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