RawTOFBlock Class Reference

#include <RawTOFBlock.h>

Inheritance diagram for RawTOFBlock:
RawDataBlock

List of all members.

Public Member Functions

 RawTOFBlock ()
 RawTOFBlock (const Int_t *block)
virtual ~RawTOFBlock ()
Int_t GetNumberOfDigits () const
const RawTOFDigitAt (Int_t idx) const
virtual TIter GetDatumIter (Bool_t dir=kIterForward) const
Int_t IndexOf (RawTOFDigit *rawdigit) const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
 RawTOFBlock (const RawTOFBlock &rhs)
RawTOFBlockoperator= (const RawTOFBlock &rhs)

Static Public Member Functions

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

Protected Member Functions

virtual void FillRawTOFDigits () const

Protected Attributes

TObjArray * fRawCrateStatuses
TObjArray * fRawTOFDigits
 not written out

Static Private Attributes

static UInt_t fgDebugFlags = 0
 not written out

Detailed Description

Definition at line 23 of file RawTOFBlock.h.


Constructor & Destructor Documentation

RawTOFBlock::RawTOFBlock (  ) 

Definition at line 36 of file RawTOFBlock.cxx.

00036                          :
00037    fRawCrateStatuses(0), fRawTOFDigits(0)
00038 {
00039    // Default constructor
00040 }

RawTOFBlock::RawTOFBlock ( const Int_t *  block  ) 

Definition at line 43 of file RawTOFBlock.cxx.

00044    : RawDataBlock(block), 
00045      fRawCrateStatuses(0), fRawTOFDigits(0)
00046 {
00047    //  stored block format is:
00048    //---------------------
00049    //  0   # words in block
00050    //  1   checksum
00051    //  2   Block Id
00052    //-----
00053    //  3   Crate # i (+extra)
00054    //  4   # of crate entries (N_i)
00055    //  5   Crate T0_i sec
00056    //  6   Crate T0_i nsec
00057    //-----
00058    //  7   readout 1_i word 1
00059    //  8   readout 1_i word 2
00060    //      < truth PlexStripEndId if Reroot data>
00061    //      tdc header (inc count)
00062    //      tdc data word 0
00063    //      ...
00064    //      tdc trailer
00065    //      readout 2_i word 1
00066    //      readout 2_i word 2
00067    //      ...
00068 
00069 }

RawTOFBlock::~RawTOFBlock (  )  [virtual]

Definition at line 72 of file RawTOFBlock.cxx.

References fRawCrateStatuses, and fRawTOFDigits.

00073 {
00074    if (fRawTOFDigits) {
00075       fRawTOFDigits->Delete();
00076       delete fRawTOFDigits;
00077       fRawTOFDigits = 0;
00078    }
00079    if (fRawCrateStatuses) {
00080       fRawCrateStatuses->Delete();
00081       delete fRawCrateStatuses;
00082       fRawCrateStatuses = 0;
00083    }
00084    return;
00085 }

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

Definition at line 43 of file RawTOFBlock.h.

00044      : RawDataBlock(rhs), fRawCrateStatuses(0), fRawTOFDigits(0) { ; }


Member Function Documentation

const RawTOFDigit * RawTOFBlock::At ( Int_t  idx  )  const

Definition at line 118 of file RawTOFBlock.cxx.

References FillRawTOFDigits(), and fRawTOFDigits.

Referenced by AlgCalDetSI::RunAlg().

00119 {
00120    // create/fill the TObjArray of RawTOFDigit (if it doesn't exist)
00121    // return pointer to the i-th element
00122    
00123    if ( ! fRawTOFDigits ) FillRawTOFDigits();
00124    return (RawTOFDigit*) fRawTOFDigits->At(idx);
00125 }

void RawTOFBlock::FillRawTOFDigits (  )  const [protected, virtual]

Definition at line 148 of file RawTOFBlock.cxx.

References ElecType::AsString(), bfld::AsString(), RawBlockId::AsString(), dbg_DumpCrateOnUnpack, dbg_DumpDigitOnUnpack, dbg_DumpHeaderOnUnpack, fgDebugFlags, RawDataBlock::fRawBlock, fRawCrateStatuses, fRawTOFDigits, RawDataBlock::fSize, RawDataBlock::GetBlockId(), RawCrateStatus::GetElecType(), RawCrateStatus::GetEntries(), RawBlockId::GetSimFlag(), SimFlag::kDaqFakeData, SimFlag::kData, Msg::kInfo, SimFlag::kMC, SimFlag::kReroot, Msg::kWarning, MSG, RawCrateStatus::Print(), and RawTOFDigit::Print().

Referenced by At(), GetDatumIter(), GetNumberOfDigits(), and IndexOf().

00149 {
00150    // create the TObjArray of RawTOFDigit (if it doesn't exist)
00151    
00152    if ( fRawTOFDigits ) return;   // already filled
00153    if ( fSize <= 0 || fRawBlock == 0) {
00154       MSG("RawData",Msg::kWarning)
00155          << "RawTOFBlock::FillRawTOFDigits empty block? "
00156          << fSize << " " << fRawBlock << endl;
00157       return;
00158    }
00159 
00160    fRawCrateStatuses = new TObjArray();
00161    fRawTOFDigits     = new TObjArray();
00162    RawDigitCrateStatus *cratestatus = 0;
00163    RawTOFDigit         *rawdigit    = 0;
00164    const Int_t    *p   = fRawBlock;
00165    const Int_t    *end = fRawBlock + fSize; // 1 beyond end
00166 
00167    RawBlockId rbid = GetBlockId();
00168    p += 3; // skip #words, blockid and checksum
00169 
00170    if (fgDebugFlags&dbg_DumpHeaderOnUnpack) {
00171       MSG("RawData",Msg::kInfo) 
00172          << "RawTOFBlock::FillRawTOFDigits "
00173          << " fSize " << fSize 
00174          << " id " << rbid.AsString()
00175          << endl;
00176    }
00177 
00178    while (p<end) {
00179       // start a new crate (pointer advanced by RawCrateStatus ctor
00180       cratestatus = new RawDigitCrateStatus(rbid,p);
00181       fRawCrateStatuses->Add(cratestatus);
00182       Int_t npairs = cratestatus->GetEntries(); 
00183 
00184       if (fgDebugFlags&dbg_DumpCrateOnUnpack) cratestatus->Print();
00185 
00186       for (Int_t ipair = 0; ipair < npairs; ipair++) {
00187          // assume that the readout type is consistent for whole crate
00188          // and that the status block knows what it is
00189          ElecType::Elec_t etype = cratestatus->GetElecType();
00190 
00191          // pointer is advanced by RawTOFDigit ctor
00192          // knowing how many words it needed to eat
00193          switch (rbid.GetSimFlag()) {
00194          case SimFlag::kData:
00195          case SimFlag::kDaqFakeData:
00196             rawdigit = new RawTOFDigit(p,cratestatus);
00197             break;
00198          case SimFlag::kMC:
00199          case SimFlag::kReroot:
00200             rawdigit = new RawTOFDigit(p,cratestatus);
00201             break;
00202          default:
00203             MSG("RawData",Msg::kWarning)
00204                << "RawTOFBlock::FillRawTOFDigits simflag was: \""
00205                << SimFlag::AsString(rbid.GetSimFlag()) << "\" ("
00206                << (int)rbid.GetSimFlag() << ")" << endl;
00207             break;
00208          }
00209 
00210          fRawTOFDigits->Add(rawdigit);
00211 
00212          if (fgDebugFlags&dbg_DumpDigitOnUnpack) rawdigit->Print();
00213          if (p>end) {
00214             MSG("RawData",Msg::kWarning)
00215                << "RawTOFBlock::FillRawTOFDigits crate info seems trashed"
00216                << endl << " SimFlag " << SimFlag::AsString(rbid.GetSimFlag())
00217                << " ElecType " << ElecType::AsString(etype)
00218                << endl;
00219             break;
00220          }
00221       }
00222    }
00223 
00224 }

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

Reimplemented from RawDataBlock.

Definition at line 227 of file RawTOFBlock.cxx.

References RawDigit::GetCrateStatus(), and GetDatumIter().

Referenced by RawTofConverter::Dump().

00229 {
00230    RawDataBlock::FormatToOStream(os,option);
00231    if (option[0] == 'X') return os;
00232    
00233    // additional block specific formatted output is done here
00234 
00235    const RawDigitCrateStatus *lastcrate = 0;
00236 
00237    TIter iter = GetDatumIter();
00238    TObject *tobj;
00239    RawTOFDigit *udigit;
00240    while ( ( tobj = iter.Next() ) ) {
00241       udigit = dynamic_cast<RawTOFDigit *>(tobj);
00242       if (udigit->GetCrateStatus() != lastcrate) {
00243          lastcrate = udigit->GetCrateStatus();
00244          os << " " << *lastcrate << endl;
00245       }
00246       if (udigit)  os << (*udigit);
00247    }
00248    os << endl;
00249    return os;
00250 }

TIter RawTOFBlock::GetDatumIter ( Bool_t  dir = kIterForward  )  const [virtual]

Definition at line 128 of file RawTOFBlock.cxx.

References FillRawTOFDigits(), and fRawTOFDigits.

Referenced by FormatToOStream().

00129 {
00130    // create/fill the TObjArray of RawTOFDigit (if it doesn't exist)
00131    // return an iterator to look over them
00132    
00133    if ( ! fRawTOFDigits ) FillRawTOFDigits();
00134    return TIter(fRawTOFDigits,dir);
00135 }

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

Definition at line 40 of file RawTOFBlock.h.

References fgDebugFlags.

00040 { return fgDebugFlags; }

Int_t RawTOFBlock::GetNumberOfDigits ( void   )  const

Definition at line 108 of file RawTOFBlock.cxx.

References FillRawTOFDigits(), and fRawTOFDigits.

Referenced by CDPreFilterModule::Ana().

00109 {
00110    // create/fill the TObjArray of RawTOFDigit (if it doesn't exist)
00111    // return number of entries
00112    
00113    if ( ! fRawTOFDigits ) FillRawTOFDigits();
00114    return fRawTOFDigits->GetEntriesFast(); // known not to have gaps
00115 }

Int_t RawTOFBlock::IndexOf ( RawTOFDigit rawdigit  )  const

Definition at line 138 of file RawTOFBlock.cxx.

References FillRawTOFDigits(), and fRawTOFDigits.

00139 {
00140    // create/fill the TObjArray of RawTOFDigit (if it doesn't exist)
00141    // return the index for this object (if contained in the list)
00142 
00143    if ( ! fRawTOFDigits ) FillRawTOFDigits();
00144    return fRawTOFDigits->IndexOf(rawdigit);
00145 }

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

Reimplemented from RawDataBlock.

Definition at line 88 of file RawTOFBlock.cxx.

References fRawCrateStatuses, and fRawTOFDigits.

00089 {
00090    // deep copy assignment
00091    if (this != &rhs) {
00092      RawDataBlock::operator=(rhs);
00093      if (fRawTOFDigits) {
00094        fRawTOFDigits->Delete();
00095        delete fRawTOFDigits;
00096        fRawTOFDigits = 0;
00097      }
00098      if (fRawCrateStatuses) {
00099        fRawCrateStatuses->Delete();
00100        delete fRawCrateStatuses;
00101        fRawCrateStatuses = 0;
00102      }
00103    }
00104    return *this;
00105 }

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

Definition at line 39 of file RawTOFBlock.h.

References fgDebugFlags.

00039 {fgDebugFlags=dbgflgs;}


Member Data Documentation

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

not written out

Definition at line 60 of file RawTOFBlock.h.

Referenced by FillRawTOFDigits(), GetDebugFlags(), and SetDebugFlags().

TObjArray* RawTOFBlock::fRawCrateStatuses [mutable, protected]

Definition at line 54 of file RawTOFBlock.h.

Referenced by FillRawTOFDigits(), operator=(), and ~RawTOFBlock().

TObjArray* RawTOFBlock::fRawTOFDigits [mutable, protected]

not written out

Definition at line 55 of file RawTOFBlock.h.

Referenced by At(), FillRawTOFDigits(), GetDatumIter(), GetNumberOfDigits(), IndexOf(), operator=(), and ~RawTOFBlock().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1