RawBlockId Class Reference

#include <RawBlockId.h>

List of all members.

Public Member Functions

 RawBlockId ()
 RawBlockId (Int_t major, Int_t minor, Bool_t isDCS, Detector::Detector_t detector, SimFlag::SimFlag_t simflag)
virtual ~RawBlockId ()
 RawBlockId (const Int_t encoded)
Int_t GetEncoded () const
const Char_t * AsString (Option_t *option="") const
Int_t GetMajor () const
const Char_t * GetMajorAsString () const
Int_t GetMinor () const
Bool_t IsDCS () const
Detector::Detector_t GetDetector () const
SimFlag::SimFlag_t GetSimFlag () const
void Print (Option_t *option="") const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const

Protected Attributes

Int_t fEncoded

Friends

Bool_t operator== (const RawBlockId &lhs, const RawBlockId &rhs)
Bool_t operator!= (const RawBlockId &lhs, const RawBlockId &rhs)

Detailed Description

Definition at line 24 of file RawBlockId.h.


Constructor & Destructor Documentation

RawBlockId::RawBlockId (  )  [inline]

Definition at line 107 of file RawBlockId.h.

00107 : fEncoded(defaultRawBlockId) { ; }

RawBlockId::RawBlockId ( Int_t  major,
Int_t  minor,
Bool_t  isDCS,
Detector::Detector_t  detector,
SimFlag::SimFlag_t  simflag 
)

Definition at line 35 of file RawBlockId.cxx.

References SimFlag::Compact(), fEncoded, maskRawBlkIdCSimFlag, maskRawBlkIdDetector, maskRawBlkIdIsDCS, maskRawBlkIdMajor, maskRawBlkIdMinor, shiftRawBlkIdCSimFlag, shiftRawBlkIdDetector, shiftRawBlkIdMajor, and shiftRawBlkIdMinor.

00038    : fEncoded(0)
00039 {
00040    // Normal ctor
00041 
00042    Int_t cmptSimFlag = SimFlag::Compact(simflag);
00043 
00044    fEncoded = 
00045       ((cmptSimFlag << shiftRawBlkIdCSimFlag) & maskRawBlkIdCSimFlag) |
00046       ((   detector << shiftRawBlkIdDetector) & maskRawBlkIdDetector) |
00047       ((isDCS) ? maskRawBlkIdIsDCS : 0)                               |
00048       ((         major << shiftRawBlkIdMajor) & maskRawBlkIdMajor)    |
00049       ((         minor << shiftRawBlkIdMinor) & maskRawBlkIdMinor);
00050 
00051 }

RawBlockId::~RawBlockId (  )  [inline, virtual]

Definition at line 108 of file RawBlockId.h.

00108 { ; }

RawBlockId::RawBlockId ( const Int_t  encoded  )  [inline]

Definition at line 110 of file RawBlockId.h.

00110 : fEncoded(encoded) { ; }


Member Function Documentation

const Char_t * RawBlockId::AsString ( Option_t *  option = ""  )  const

Definition at line 54 of file RawBlockId.cxx.

References SimFlag::AsString(), Detector::AsString(), GetDetector(), GetMajor(), GetMajorAsString(), GetMinor(), GetSimFlag(), and IsDCS().

Referenced by RotoObjectifier::BufferInflate(), RawLiTpmtDigitsBlock::FillRawDigits(), RawDigitDataBlock::FillRawDigits(), RawVaTimingMonitorBlock::FillRawDigits(), RawTOFBlock::FillRawTOFDigits(), RerootToRawDataModule::FinalizeWorkingArray(), FormatToOStream(), and RawDataBlock::FormatToOStream().

00055 {
00056    // Return unpacked RawBlockId as a string
00057    // User should copy result because it points to a 
00058    // statically allocated string.
00059    // Internally uses a circular list of buffers to avoid problems
00060    // using AsString multiple times in a cout-like situation.
00061 
00062    const int nbuffers = 8;  // use a circular list of strings
00063    static char newstring[nbuffers][128];
00064    static int ibuffer = nbuffers;
00065    ibuffer = (ibuffer+1)%nbuffers;  // each time move to next buffer
00066 
00067    switch (option[0]) {
00068    case 'c':
00069       // compact rendering "DCS:225;225(F+D)"
00070       sprintf(newstring[ibuffer],"%3s:%3.3d;%3.3d(%1.1s+%1.1s)"
00071               ,(IsDCS() ? "DCS" : "DAQ")
00072               ,GetMajor(),GetMinor()
00073               ,Detector::AsString(GetDetector())
00074               ,SimFlag::AsString(GetSimFlag())
00075               );
00076       break;
00077    default:
00078       // expanded rendering "DCS:RawDigitDataBlock;225(Far+Data)"
00079       sprintf(newstring[ibuffer],"%3s:%s;%3.3d(%s+%s)"
00080               ,(IsDCS() ? "DCS" : "DAQ")
00081               ,GetMajorAsString(),GetMinor()
00082               ,Detector::AsString(GetDetector())
00083               ,SimFlag::AsString(GetSimFlag())
00084               );
00085       break;
00086    }
00087    
00088    return newstring[ibuffer];
00089 }

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

Definition at line 120 of file RawBlockId.cxx.

References AsString().

Referenced by Print().

00122 {
00123    if (os.good()) {
00124       if (os.tie()) os.tie()->flush(); // instead of opfx
00125       os << AsString(option);
00126    }
00127    // instead of os.osfx()
00128    if (os.flags() & std::ios::unitbuf) os.flush();
00129    return os;
00130 }

Detector::Detector_t RawBlockId::GetDetector (  )  const [inline]

Definition at line 125 of file RawBlockId.h.

References fEncoded, maskRawBlkIdDetector, and shiftRawBlkIdDetector.

Referenced by AsString(), RawLIAdcSummary::BuildRawChannelId(), RawLITimingSummary::BuildRawChannelId(), RawDigit::BuildRawChannelId(), RotoObjectifier::BuildRecord(), RawQieErrorStatsBlock::FillAllMaps(), RawDeadChipBlock::FillDeadChannels(), RawOvershootBlock::FillOvershootChannels(), RawLiTpmtDigitsBlock::FillRawDigits(), RawDigitDataBlock::FillRawDigits(), RawVaTimingMonitorBlock::FillRawDigits(), RawDcsEnvMonitorBlock::GetEnvDetector(), RawDcsHvMonitorBlock::GetHvDetector(), RawDcsMagnetMonitorBlock::GetMagDetector(), RawCrateMonitorBlock::GetMasterMonitor(), RawPedestalTableBlock::GetPedValue(), RawSparsifierTableBlock::GetThresholdValue(), RawDcsCanMonitorBlock::GetVldContext(), RawRunCommentBlock::GetVldContext(), RawVaTimingMonitorBlock::GetVldContext(), RawRunConfigBlock::GetVldContext(), RawSubRunEndBlock::GetVldContext(), RawRunEndBlock::GetVldContext(), RawDcsEnvMonitorBlock::GetVldContext(), RawDigitDataBlock::GetVldContext(), RawSpillServerMonitorBlock::GetVldContext(), RawDcsMagnetMonitorBlock::GetVldContext(), RawConfigFilesBlock::GetVldContext(), RawDcsHvMonitorBlock::GetVldContext(), RawTriggerStatsBlock::GetVldContext(), RawVtmTimeInfoBlock::GetVldContext(), RawBeamMonHeaderBlock::GetVldContext(), RawErrorStatsBlock::GetVldContext(), RawQieErrorStatsBlock::GetVldContext(), RawRunStartBlock::GetVldContext(), RawDcsRpsMonitorBlock::GetVldContext(), RawLiTpmtDigitsBlock::GetVldContext(), RawSnarlHeaderBlock::GetVldContext(), RawDcsChillerMonitorBlock::GetVldContext(), RawCrateMonitorBlock::GetVldContext(), RawDaqHeaderBlock::GetVldContext(), RawDcsHeaderBlock::GetVldContext(), RawDaqDeadTimeBlock::GetVldContext(), RawLIHeader::RawLIHeader(), AlgCalDetSI::RunAlg(), RawTpSinglesSummaryBlock::UnpackQieRates(), RawTpSinglesSummaryBlock::UnpackVaRates(), RawCrateMonitorBlock::UnpackVfbMonitors(), DbuDaqMonitorModule::WriteVaChipPedsEntry(), and DbuDaqMonitorModule::WriteVaChipSparsEntry().

00126 { 
00127    Int_t bitField = (fEncoded & maskRawBlkIdDetector) >> shiftRawBlkIdDetector;
00128    return (Detector::Detector_t) bitField;   
00129 }

Int_t RawBlockId::GetEncoded (  )  const [inline]
Int_t RawBlockId::GetMajor (  )  const [inline]
const Char_t * RawBlockId::GetMajorAsString (  )  const

Definition at line 92 of file RawBlockId.cxx.

References GetMajor(), RawBlockProxy::GetName(), RawBlockRegistry::Instance(), IsDCS(), and RawBlockRegistry::LookUp().

Referenced by AsString().

00093 {
00094    // Return major id # expanded as a string
00095 
00096    RawBlockRegistry& rbr = RawBlockRegistry::Instance();
00097    RawBlockProxy*    rbp = rbr.LookUp(IsDCS(),GetMajor());
00098 
00099    static char unknownstring[128];
00100 
00101    if (rbp) {
00102       return rbp->GetName();
00103    } 
00104    else {
00105       sprintf(unknownstring,"Unknown%3sBlock0x%2.2x",
00106               (IsDCS() ? "DCS" : "DAQ"),GetMajor());
00107       return unknownstring;
00108    }
00109 
00110 }

Int_t RawBlockId::GetMinor (  )  const [inline]
SimFlag::SimFlag_t RawBlockId::GetSimFlag (  )  const [inline]

Definition at line 131 of file RawBlockId.h.

References SimFlag::Expand(), fEncoded, maskRawBlkIdCSimFlag, and shiftRawBlkIdCSimFlag.

Referenced by AsString(), RotoObjectifier::BuildRecord(), RawLIAdcSummaryBlock::FillRawAdcSums(), RawLiTpmtDigitsBlock::FillRawDigits(), RawDigitDataBlock::FillRawDigits(), RawVaTimingMonitorBlock::FillRawDigits(), RawLITimingSummaryBlock::FillRawTimingSums(), RawTOFBlock::FillRawTOFDigits(), RawDcsCanMonitorBlock::GetVldContext(), RawRunCommentBlock::GetVldContext(), RawVaTimingMonitorBlock::GetVldContext(), RawRunConfigBlock::GetVldContext(), RawSubRunEndBlock::GetVldContext(), RawRunEndBlock::GetVldContext(), RawDcsEnvMonitorBlock::GetVldContext(), RawDigitDataBlock::GetVldContext(), RawSpillServerMonitorBlock::GetVldContext(), RawDcsMagnetMonitorBlock::GetVldContext(), RawConfigFilesBlock::GetVldContext(), RawDcsHvMonitorBlock::GetVldContext(), RawTriggerStatsBlock::GetVldContext(), RawVtmTimeInfoBlock::GetVldContext(), RawBeamMonHeaderBlock::GetVldContext(), RawErrorStatsBlock::GetVldContext(), RawQieErrorStatsBlock::GetVldContext(), RawRunStartBlock::GetVldContext(), RawDcsRpsMonitorBlock::GetVldContext(), RawLiTpmtDigitsBlock::GetVldContext(), RawSnarlHeaderBlock::GetVldContext(), RawDcsChillerMonitorBlock::GetVldContext(), RawCrateMonitorBlock::GetVldContext(), RawDaqHeaderBlock::GetVldContext(), RawDcsHeaderBlock::GetVldContext(), RawDaqDeadTimeBlock::GetVldContext(), RawLIHeader::RawLIHeader(), DbuDaqMonitorModule::WriteVaChipPedsEntry(), DbuDaqMonitorModule::WriteVaChipSparsEntry(), and MnvRawDigitSuppression::ZeroDataBasedOnTDC().

00132 {
00133    Int_t bitField = (fEncoded & maskRawBlkIdCSimFlag) >> shiftRawBlkIdCSimFlag;
00134    return SimFlag::Expand(bitField);
00135 }

Bool_t RawBlockId::IsDCS (  )  const [inline]
void RawBlockId::Print ( Option_t *  option = ""  )  const

Definition at line 113 of file RawBlockId.cxx.

References FormatToOStream().

00114 {
00115    // Print the (decoded) value
00116    FormatToOStream(cout,option);
00117 }


Friends And Related Function Documentation

Bool_t operator!= ( const RawBlockId lhs,
const RawBlockId rhs 
) [friend]
Bool_t operator== ( const RawBlockId lhs,
const RawBlockId rhs 
) [friend]

Member Data Documentation

Int_t RawBlockId::fEncoded [protected]

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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1