| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DayaBay::DaqPmtCrate Class Reference

Class that wraps the DAQ data read from a Pmt crate. More...

#include <DaqPmtCrate.h>

Inheritance diagram for DayaBay::DaqPmtCrate:

[legend]
Collaboration diagram for DayaBay::DaqPmtCrate:
[legend]
List of all members.

Public Types

typedef std::vector< DayaBay::DaqPmtChannel * > PmtChannelPtrList
 A list containing pointers to the PMT channel readouts.
typedef std::vector< DayaBay::DaqFadcChannel * > FadcChannelPtrList
 A list containing pointers to the FADC channel readouts.

Public Member Functions

 DaqPmtCrate (const DybDaq::EventReadout *eventReadout)
 Constructor for read-only instance.
 DaqPmtCrate (const DayaBay::Detector &detector, const unsigned int run, const unsigned int event)
 Constructor for read-write instance.
 DaqPmtCrate (const DayaBay::DaqPmtCrate &crate)
 Copy constructor.
 DaqPmtCrate ()
 Default Constructor.
virtual ~DaqPmtCrate ()
 Destroys this instance of the class.
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the ASCII output stream.
const DayaBay::DaqLtblocalTriggerBoard () const
 Returns the LTB for this crate.
const PmtChannelPtrListchannelReadouts () const
 Returns the list of FEE channel readouts, alias for pmtChannelReadouts.
const PmtChannelPtrListpmtChannelReadouts () const
 Returns the list of FEE channel readouts.
bool hasChannel (const DayaBay::FeeChannelId &channelId) const
 Returns true if the DaqPmtChannel for the supplied FeeChannelId exists.
const DaqPmtChannelchannel (const DayaBay::FeeChannelId &channelId) const
 Returns the DaqPmtChannel for the supplied FeeChannelId.
DaqPmtChannelchannel (const DayaBay::FeeChannelId &channelId)
 Returns the DaqPmtChannel for the supplied FeeChannelId.
const FadcChannelPtrListfadcChannelReadouts () const
 Returns the list of FADC channel readouts.
bool hasChannel (const DayaBay::FadcChannelId &channelId) const
 Returns true if the DaqFadcChannel for the supplied FadcChannelId exists.
const DaqFadcChannelchannel (const DayaBay::FadcChannelId &channelId) const
 Returns the DaqFadcChannel for the supplied FadcChannelId.
DaqFadcChannelchannel (const DayaBay::FadcChannelId &channelId)
 Returns the DaqFadcChannel for the supplied FadcChannelId.
const DayaBay::DaqPmtCrateasPmtCrate () const
 Returns this object as a DaqPmtCrate.
const DayaBay::Detectordetector () const
 Returns the detector associated with this readout.
unsigned int eventNumber () const
 Returns the event number assigned to this readout.
const DybDaq::EventReadouteventReadout () const
 Returns the wrapped EventReadout instance.
unsigned int localTriggerNumber () const
 Returns the local trigger number of this readout.
unsigned int runNumber () const
 Returns the run number in which this readout was taken.
const TimeStamptriggerTime () const
 Returns the timestamp of the first trigger frame in this readout.
Trigger::TriggerType_t triggerType () const
 Returns the trigger type of this readout.
bool addLtb (const DaqLtb *ltb, const unsigned int slot)
 Adds a new LTB to this readout at the specified lot.

Static Public Member Functions

static void * operator new (size_t size)
 operator new
static void * operator new (size_t size, void *pObj)
 placement operator new it is needed by libstdc++ 3.2.3 (e.g.
static void operator delete (void *p)
 operator delete
static void operator delete (void *p, void *pObj)
 placement operator delete not sure if really needed, but it does not harm

Protected Member Functions

DaqPmtCrateoperator= (const DayaBay::DaqPmtCrate &rhs)
 Assignement operator.
DybDaq::EventReadouteventReadout ()
 Returns the wrapped EventReadout instance.
const DayaBay::DaqLtbFramefirstLtbFrame () const
 Returns the first LTB frame in the LTB readout for this readout.
const DayaBay::DaqLtbltb () const
 Returns the LTB for this readout.

Private Member Functions

bool freshPmtAttributes () const
 Prepares the PMT attributes if they have not already been prepared.
bool freshFadcAttributes () const
 Prepares the FADC attributes if they have not already been prepared.
DaqPmtCrate::PmtChannelPtrList::size_type * pmtIndicesForSlot (const unsigned int) const
 Returns the channel indices for the specified slot.
DaqPmtCrate::FadcChannelPtrList::size_type * fadcIndicesForSlot (const unsigned int) const
 Returns the channel indices for the specified slot.
void flushCache ()
 Deletes any objects cached by this instance.

Private Attributes

PmtChannelPtrListm_pmtChannelPtrs
 The list containing pointers to the PMT channel readouts in this crate.
PmtChannelPtrList::size_type ** m_pmtIndices
 The indices of channels in 'pmtChannelPtrs', organized by slot and channel.
DybDaq::FeeReadout ** m_feeReadouts
 The cache of FeeReadouts used help load this crate.
FadcChannelPtrListm_fadcChannelPtrs
 The list containing pointers to the FADC channel readouts in this crate.
FadcChannelPtrList::size_type ** m_fadcIndices
 The indices of channels in 'channelPtrs', organized by slot and channel.
DybDaq::FadcReadout ** m_fadcReadouts
 The cache of FadcReadouts used help load this crate.

Detailed Description

Class that wraps the DAQ data read from a Pmt crate.

Author:
sjpatton@lbl.gov created Mon Apr 11 03:44:54 2011

Definition at line 42 of file DaqPmtCrate.h.


Member Typedef Documentation

typedef std::vector<DayaBay::DaqPmtChannel*> DayaBay::DaqPmtCrate::PmtChannelPtrList

A list containing pointers to the PMT channel readouts.

Definition at line 47 of file DaqPmtCrate.h.

typedef std::vector<DayaBay::DaqFadcChannel*> DayaBay::DaqPmtCrate::FadcChannelPtrList

A list containing pointers to the FADC channel readouts.

Definition at line 49 of file DaqPmtCrate.h.


Constructor & Destructor Documentation

DaqPmtCrate::DaqPmtCrate ( const DybDaq::EventReadout eventReadout  ) 

Constructor for read-only instance.

Definition at line 70 of file DaqPmtCrate.cc.

00070                                                          :
00071     DaqCrate(eventReadout),
00072     m_pmtChannelPtrs(0),
00073     m_pmtIndices(0),
00074     m_feeReadouts(0),
00075     m_fadcChannelPtrs(0),
00076     m_fadcIndices(0),
00077     m_fadcReadouts(0) {
00078 }

DaqPmtCrate::DaqPmtCrate ( const DayaBay::Detector detector,
const unsigned int  run,
const unsigned int  event 
)

Constructor for read-write instance.

Definition at line 51 of file DaqPmtCrate.cc.

00053                                                    :
00054     DaqCrate(detector,
00055              run,
00056              event),
00057     m_pmtChannelPtrs(0),
00058     m_pmtIndices(0),
00059     m_feeReadouts(new FeeReadout*[kMaxSlotCount]),
00060     m_fadcChannelPtrs(0),
00061     m_fadcIndices(0),
00062     m_fadcReadouts(new FadcReadout*[kMaxSlotCount]) {
00063     for (unsigned int channel = 0;
00064          kMaxSlotCount != channel;
00065          ++channel) {
00066         m_feeReadouts[channel] = 0;
00067     }
00068 }

DaqPmtCrate::DaqPmtCrate ( const DayaBay::DaqPmtCrate crate  ) 

Copy constructor.

Definition at line 80 of file DaqPmtCrate.cc.

00080                                                  :
00081     DaqCrate(crate),
00082     m_pmtChannelPtrs(0),
00083     m_pmtIndices(0),
00084     m_feeReadouts(0),
00085     m_fadcChannelPtrs(0),
00086     m_fadcIndices(0),
00087     m_fadcReadouts(0) {
00088 }

DayaBay::DaqPmtCrate::DaqPmtCrate (  )  [inline]

Default Constructor.

Definition at line 63 of file DaqPmtCrate.h.

00063                   : m_pmtChannelPtrs(0),
00064                     m_pmtIndices(0),
00065                     m_feeReadouts(0),
00066                     m_fadcChannelPtrs(0),
00067                     m_fadcIndices(0),
00068                     m_fadcReadouts(0) {}

DaqPmtCrate::~DaqPmtCrate (  )  [virtual]

Destroys this instance of the class.

Definition at line 90 of file DaqPmtCrate.cc.

00090                           {
00091     flushCache();
00092 }


Member Function Documentation

std::ostream & DayaBay::DaqPmtCrate::fillStream ( std::ostream &  s  )  const [inline, virtual]

Fill the ASCII output stream.

Reimplemented from DayaBay::DaqCrate.

Definition at line 183 of file DaqPmtCrate.h.

00184 {
00185   DaqCrate::fillStream(s);
00186   s << "{ " << "pmtChannelPtrs :        " << m_pmtChannelPtrs << std::endl
00187             << "pmtIndices :    " << m_pmtIndices << std::endl
00188             << "feeReadouts :   " << m_feeReadouts << std::endl
00189             << "fadcChannelPtrs :       " << m_fadcChannelPtrs << std::endl
00190             << "fadcIndices :   " << m_fadcIndices << std::endl
00191             << "fadcReadouts :  " << m_fadcReadouts << std::endl << " }";
00192   return s;
00193 }

const DaqLtb & DaqPmtCrate::localTriggerBoard (  )  const

Returns the LTB for this crate.

Definition at line 198 of file DaqPmtCrate.cc.

00198                                                    {
00199     return ltb();
00200 }

const DaqPmtCrate::PmtChannelPtrList & DaqPmtCrate::channelReadouts (  )  const

Returns the list of FEE channel readouts, alias for pmtChannelReadouts.

Definition at line 202 of file DaqPmtCrate.cc.

00202                                                                        {
00203     return pmtChannelReadouts();
00204 }

const DaqPmtCrate::PmtChannelPtrList & DaqPmtCrate::pmtChannelReadouts (  )  const

Returns the list of FEE channel readouts.

Definition at line 206 of file DaqPmtCrate.cc.

00206                                                                           {
00207     const EventReadout& daqReadout = eventReadout();
00208     if (0 == &daqReadout) {
00209         return *((PmtChannelPtrList*)0);
00210     }
00211 
00212     if (freshPmtAttributes()) {
00213         const Detector zzub = detector();
00214         const EventHeader& eventHeader = daqReadout.header();
00215         const EventTraits& traits = eventHeader.eventTraits();
00216         const unsigned int kFeeModuleType = traits.moduleType(EventTraits::kFeeModule);
00217         const EventReadout::RomFragmentPtrList& fragments = daqReadout.romFragments();
00218         for (EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
00219              fragment != fragments.end();
00220              ++fragment) {
00221             const RomHeader& header = (*fragment)->header();
00222             if (kFeeModuleType == header.moduleType()) {
00223                 const FeeReadout& readout = dynamic_cast<const FeeReadout&>((*fragment)->unwrappedData());
00224                 const FeeReadout::FeeHitPtrList& hits = readout.feeHits();
00225                 const unsigned int slot = header.slot();
00226                 for (FeeReadout::FeeHitPtrList::const_iterator hitPtr = hits.begin();
00227                      hitPtr != hits.end();
00228                      ++hitPtr) {
00229                     const unsigned int channelNumber = (*hitPtr)->channelId();
00230                     PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(slot);
00231                     const unsigned int index = indices[channelNumber];
00232                     if (kUninitializedChannel == index) {
00233                         indices[channelNumber] = m_pmtChannelPtrs->size();
00234                         m_pmtChannelPtrs->push_back(new DaqPmtChannel(*(*hitPtr),
00235                                                                    FeeChannelId(slot,
00236                                                                                 channelNumber + kFeeConnectorOffset,
00237                                                                                 zzub.site(),
00238                                                                                 zzub.detectorId())));
00239                     } else {
00240                         (m_pmtChannelPtrs->at(index))->addHit(*(*hitPtr));
00241                     }
00242                 }
00243             }
00244         }
00245     }
00246     return *m_pmtChannelPtrs;
00247 }

bool DaqPmtCrate::hasChannel ( const DayaBay::FeeChannelId channelId  )  const

Returns true if the DaqPmtChannel for the supplied FeeChannelId exists.

Definition at line 249 of file DaqPmtCrate.cc.

00249                                                                 {
00250     pmtChannelReadouts();
00251     PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(channelId.board());
00252     const unsigned int index = indices[channelId.connector() - kFeeConnectorOffset];
00253     return kUninitializedChannel != index;
00254 }

const DaqPmtChannel & DaqPmtCrate::channel ( const DayaBay::FeeChannelId channelId  )  const

Returns the DaqPmtChannel for the supplied FeeChannelId.

Definition at line 256 of file DaqPmtCrate.cc.

00256                                                                              {
00257     pmtChannelReadouts();
00258     PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(channelId.board());
00259     const unsigned int channelNumber = channelId.connector() - kFeeConnectorOffset;
00260     if (kMaxChannelCount <= channelNumber) {
00261         return *((DaqPmtChannel*)0);
00262     }
00263     const unsigned int index = indices[channelNumber];
00264     if (kUninitializedChannel == index) {
00265         return *((DaqPmtChannel*)0);
00266     }
00267     return *(m_pmtChannelPtrs->at(index));    
00268 }

DaqPmtChannel & DaqPmtCrate::channel ( const DayaBay::FeeChannelId channelId  ) 

Returns the DaqPmtChannel for the supplied FeeChannelId.

Definition at line 270 of file DaqPmtCrate.cc.

00270                                                                  {
00271     const unsigned int slot = channelId.board();
00272     FeeReadout* readout = m_feeReadouts[slot];
00273     if (0 == readout) {
00274         readout = new FeeReadout(localTriggerNumber(),
00275                                  triggerType(),
00276                                  false,
00277                                  false,
00278                                  FeeTraits::defaultTraits());
00279         m_feeReadouts[slot] = readout;
00280         eventReadout().addReadout(readout,
00281                                   slot);
00282     }
00283 
00284     PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(slot);
00285     const unsigned int channelNumber = channelId.connector() - kFeeConnectorOffset;
00286     if (kMaxChannelCount <= channelNumber) {
00287         return *((DaqPmtChannel*)0);
00288     }
00289     const unsigned int index = indices[channelNumber];
00290     if (kUninitializedChannel == index) {
00291         indices[channelNumber] = m_pmtChannelPtrs->size();
00292         DaqPmtChannel* channel = new DaqPmtChannel(channelId,
00293                                                    *readout);
00294         m_pmtChannelPtrs->push_back(channel);
00295         return *channel;
00296     }
00297     return *(m_pmtChannelPtrs->at(index));
00298 }

const DaqPmtCrate::FadcChannelPtrList & DaqPmtCrate::fadcChannelReadouts (  )  const

Returns the list of FADC channel readouts.

Definition at line 320 of file DaqPmtCrate.cc.

00320                                                                             {
00321     const EventReadout& daqReadout = eventReadout();
00322     if (0 == &daqReadout) {
00323         return *((FadcChannelPtrList*)0);
00324     }
00325 
00326     if (freshFadcAttributes()) {
00327         const Detector zzub = detector();
00328         const EventHeader& eventHeader = daqReadout.header();
00329         const EventTraits& traits = eventHeader.eventTraits();
00330         const unsigned int kFadcModuleType = traits.moduleType(EventTraits::kFadcModule);
00331         const EventReadout::RomFragmentPtrList& fragments = daqReadout.romFragments();
00332         for (EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
00333              fragment != fragments.end();
00334              ++fragment) {
00335             const RomHeader& header = (*fragment)->header();
00336             if (kFadcModuleType == header.moduleType()) {
00337                 const FadcReadout& readout = dynamic_cast<const FadcReadout&>((*fragment)->unwrappedData());
00338                 const FadcReadout::FadcDataPtrList& data = readout.fadcData();
00339                 const unsigned int slot = header.slot();
00340                 for (FadcReadout::FadcDataPtrList::const_iterator dataPtr = data.begin();
00341                      dataPtr != data.end();
00342                      ++dataPtr) {
00343                     const unsigned int channelNumber = (*dataPtr)->channelId();
00344                     FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
00345                     const unsigned int index = indices[channelNumber];
00346                     if (kUninitializedChannel == index) {
00347                         indices[channelNumber] = m_fadcChannelPtrs->size();
00348                         m_fadcChannelPtrs->push_back(new DaqFadcChannel(*(*dataPtr),
00349                                                                         FadcChannelId(slot,
00350                                                                                       channelNumber + kFadcConnectorOffset,
00351                                                                                       zzub.site(),
00352                                                                                       zzub.detectorId())));
00353                     } else {
00354                         (m_fadcChannelPtrs->at(index))->addData(*(*dataPtr));
00355                     }
00356                 }
00357             }
00358         }
00359     }
00360     return *m_fadcChannelPtrs;
00361 }

bool DaqPmtCrate::hasChannel ( const DayaBay::FadcChannelId channelId  )  const

Returns true if the DaqFadcChannel for the supplied FadcChannelId exists.

Definition at line 363 of file DaqPmtCrate.cc.

00363                                                                  {
00364     FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(channelId.board());
00365     const unsigned int index = indices[channelId.connector() - kFadcConnectorOffset];
00366     return kUninitializedChannel != index;
00367 }

const DaqFadcChannel & DaqPmtCrate::channel ( const DayaBay::FadcChannelId channelId  )  const

Returns the DaqFadcChannel for the supplied FadcChannelId.

Definition at line 369 of file DaqPmtCrate.cc.

00369                                                                                {
00370     FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(channelId.board());
00371     const unsigned int channelNumber = channelId.connector() - kFadcConnectorOffset;
00372     if (kMaxChannelCount <= channelNumber) {
00373         return *((DaqFadcChannel*)0);
00374     }
00375     const unsigned int index = indices[channelNumber];
00376     if (kUninitializedChannel == index) {
00377         return *((DaqFadcChannel*)0);
00378     }
00379     return *(m_fadcChannelPtrs->at(index));    
00380 }

DaqFadcChannel & DaqPmtCrate::channel ( const DayaBay::FadcChannelId channelId  ) 

Returns the DaqFadcChannel for the supplied FadcChannelId.

Definition at line 382 of file DaqPmtCrate.cc.

00382                                                                    {
00383     const unsigned int slot = channelId.board();
00384     FadcReadout* readout = m_fadcReadouts[slot];
00385     if (0 == readout) {
00386         readout = new FadcReadout(localTriggerNumber(),
00387                                   triggerType(),
00388                                   false,
00389                                   FadcTraits::defaultTraits());
00390         m_fadcReadouts[slot] = readout;
00391         eventReadout().addReadout(readout,
00392                                   slot);
00393     }
00394 
00395     FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
00396     const unsigned int channelNumber = channelId.connector() - kFadcConnectorOffset;
00397     if (kMaxChannelCount <= channelNumber) {
00398         return *((DaqFadcChannel*)0);
00399     }
00400     const unsigned int index = indices[channelNumber];
00401     if (kUninitializedChannel == index) {
00402         indices[channelNumber] = m_fadcChannelPtrs->size();
00403         DaqFadcChannel* channel = new DaqFadcChannel(channelId,
00404                                                    *readout);
00405         m_fadcChannelPtrs->push_back(channel);
00406         return *channel;
00407     }
00408     return *(m_fadcChannelPtrs->at(index));
00409 }

static void* DayaBay::DaqPmtCrate::operator new ( size_t  size  )  [inline, static]

operator new

Reimplemented from DayaBay::DaqCrate.

Definition at line 109 of file DaqPmtCrate.h.

00110     {
00111       return ( sizeof(DaqPmtCrate) == size ? 
00112                boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::malloc() :
00113                ::operator new(size) );
00114     }

static void* DayaBay::DaqPmtCrate::operator new ( size_t  size,
void *  pObj 
) [inline, static]

placement operator new it is needed by libstdc++ 3.2.3 (e.g.

in std::vector) it is not needed in libstdc++ >= 3.4

Reimplemented from DayaBay::DaqCrate.

Definition at line 119 of file DaqPmtCrate.h.

00120     {
00121       return ::operator new (size,pObj);
00122     }

static void DayaBay::DaqPmtCrate::operator delete ( void *  p  )  [inline, static]

operator delete

Reimplemented from DayaBay::DaqCrate.

Definition at line 125 of file DaqPmtCrate.h.

00126     {
00127       boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::is_from(p) ?
00128       boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::free(p) :
00129       ::operator delete(p);
00130     }

static void DayaBay::DaqPmtCrate::operator delete ( void *  p,
void *  pObj 
) [inline, static]

placement operator delete not sure if really needed, but it does not harm

Reimplemented from DayaBay::DaqCrate.

Definition at line 134 of file DaqPmtCrate.h.

00135     {
00136       ::operator delete (p, pObj);
00137     }

DaqPmtCrate & DaqPmtCrate::operator= ( const DayaBay::DaqPmtCrate rhs  )  [protected]

Assignement operator.

Definition at line 94 of file DaqPmtCrate.cc.

00094                                                            {
00095   if (this != &rhs) {
00096       flushCache();
00097       DaqCrate::operator=(rhs);
00098       m_pmtChannelPtrs = 0;
00099       m_pmtIndices = 0;
00100       m_feeReadouts = 0;
00101       m_fadcChannelPtrs = 0;
00102       m_fadcIndices = 0;
00103       m_fadcReadouts = 0;
00104   }
00105   return *this;
00106 }

bool DaqPmtCrate::freshPmtAttributes (  )  const [private]

Prepares the PMT attributes if they have not already been prepared.

Definition at line 160 of file DaqPmtCrate.cc.

00160                                            {
00161     if (0 != m_pmtChannelPtrs) {
00162         return false;
00163     }
00164 
00165     PmtChannelPtrList** pmtChannelPtrs = const_cast<PmtChannelPtrList**>(&m_pmtChannelPtrs);
00166     *(pmtChannelPtrs) = new PmtChannelPtrList();
00167 
00168     PmtChannelPtrList::size_type*** pmtIndicesInSlot = const_cast<PmtChannelPtrList::size_type***>(&m_pmtIndices);
00169     *(pmtIndicesInSlot) = new PmtChannelPtrList::size_type*[kMaxSlotCount];
00170     for (unsigned int slot = 0;
00171          slot != kMaxSlotCount;
00172          ++slot) {
00173         (*(pmtIndicesInSlot))[slot] = 0;
00174     }
00175 
00176     return true;
00177 }

bool DaqPmtCrate::freshFadcAttributes (  )  const [private]

Prepares the FADC attributes if they have not already been prepared.

Definition at line 179 of file DaqPmtCrate.cc.

00179                                             {
00180     if (0 != m_fadcChannelPtrs) {
00181         return false;
00182     }
00183 
00184     FadcChannelPtrList** fadcChannelPtrs = const_cast<FadcChannelPtrList**>(&m_fadcChannelPtrs);
00185     *(fadcChannelPtrs) = new FadcChannelPtrList();
00186 
00187     FadcChannelPtrList::size_type*** fadcIndicesInSlot = const_cast<FadcChannelPtrList::size_type***>(&m_fadcIndices);
00188     *(fadcIndicesInSlot) = new FadcChannelPtrList::size_type*[kMaxSlotCount];
00189     for (unsigned int slot = 0;
00190          slot != kMaxSlotCount;
00191          ++slot) {
00192         (*(fadcIndicesInSlot))[slot] = 0;
00193     }
00194 
00195     return true;
00196 }

DaqPmtCrate::PmtChannelPtrList::size_type * DaqPmtCrate::pmtIndicesForSlot ( const unsigned  int  )  const [private]

Returns the channel indices for the specified slot.

Definition at line 301 of file DaqPmtCrate.cc.

00301                                                                                                    {
00302     if (kMaxSlotCount <= slot) {
00303         return 0;
00304     }
00305 
00306     freshPmtAttributes();
00307     PmtChannelPtrList::size_type* result = m_pmtIndices[slot];
00308     if (0 == result) {
00309         result = new PmtChannelPtrList::size_type[kMaxChannelCount];
00310         m_pmtIndices[slot] = result;
00311         for (unsigned int channel = 0;
00312              channel != kMaxChannelCount;
00313              ++channel) {
00314             result[channel] = kUninitializedChannel;
00315         }
00316     }
00317     return result;
00318 }

DaqPmtCrate::FadcChannelPtrList::size_type * DaqPmtCrate::fadcIndicesForSlot ( const unsigned  int  )  const [private]

Returns the channel indices for the specified slot.

Definition at line 411 of file DaqPmtCrate.cc.

00411                                                                                                      {
00412     if (kMaxSlotCount <= slot) {
00413         return 0;
00414     }
00415 
00416     freshFadcAttributes();
00417     FadcChannelPtrList::size_type* result = m_fadcIndices[slot];
00418     if (0 == result) {
00419         result = new FadcChannelPtrList::size_type[kMaxChannelCount];
00420         m_fadcIndices[slot] = result;
00421         for (unsigned int channel = 0;
00422              channel != kMaxChannelCount;
00423              ++channel) {
00424             result[channel] = kUninitializedChannel;
00425         }
00426     }
00427     return result;
00428 }

void DaqPmtCrate::flushCache (  )  [private]

Deletes any objects cached by this instance.

Reimplemented from DayaBay::DaqCrate.

Definition at line 108 of file DaqPmtCrate.cc.

00108                              {
00109     if (0 != m_fadcReadouts) {
00110         // Fadceadouts are own by the EventReadout.
00111         delete[] m_fadcReadouts;
00112     }
00113     if (0 != m_fadcIndices) {
00114         for (unsigned int slot = 0;
00115              slot != kMaxSlotCount;
00116              ++slot) {
00117             FadcChannelPtrList::size_type* indicesInSlot = m_fadcIndices[slot];
00118             if (0 != indicesInSlot) {
00119                 delete[] indicesInSlot;
00120             }
00121         }
00122         delete[] m_fadcIndices;
00123     }
00124     if (0 != m_fadcChannelPtrs) {
00125         FadcChannelPtrList::iterator finished = m_fadcChannelPtrs->end();
00126         for(FadcChannelPtrList::iterator readout = m_fadcChannelPtrs->begin();
00127             readout != finished;
00128             ++readout) {
00129             delete (*readout);
00130         }
00131         delete m_fadcChannelPtrs;
00132     }
00133 
00134     if (0 != m_feeReadouts) {
00135         // FeeReadouts are own by the EventReadout.
00136         delete[] m_feeReadouts;
00137     }
00138     if (0 != m_pmtIndices) {
00139         for (unsigned int slot = 0;
00140              slot != kMaxSlotCount;
00141              ++slot) {
00142             PmtChannelPtrList::size_type* indicesInSlot = m_pmtIndices[slot];
00143             if (0 != indicesInSlot) {
00144                 delete[] indicesInSlot;
00145             }
00146         }
00147         delete[] m_pmtIndices;
00148     }
00149     if (0 != m_pmtChannelPtrs) {
00150         PmtChannelPtrList::iterator finished = m_pmtChannelPtrs->end();
00151         for(PmtChannelPtrList::iterator readout = m_pmtChannelPtrs->begin();
00152             readout != finished;
00153             ++readout) {
00154             delete (*readout);
00155         }
00156         delete m_pmtChannelPtrs;
00157     }
00158 }

const DaqPmtCrate * DaqCrate::asPmtCrate (  )  const [inherited]

Returns this object as a DaqPmtCrate.

Definition at line 163 of file DaqCrate.cc.

00163                                               {
00164     return dynamic_cast<const DaqPmtCrate*>(this);
00165 }

const Detector & DaqCrate::detector (  )  const [inherited]

Returns the detector associated with this readout.

Definition at line 195 of file DaqCrate.cc.

00195                                          {
00196     if (0 == m_detector) {
00197         const EventHeader& header = m_eventReadout->header();
00198         Detector** detector = const_cast<Detector**>(&m_detector);
00199         *(detector) = new Detector(convertSite(header.site()),
00200                                    convertDetector(header.detector()));
00201 
00202     }
00203     return *m_detector;
00204 }

unsigned int DaqCrate::eventNumber (  )  const [inherited]

Returns the event number assigned to this readout.

Definition at line 167 of file DaqCrate.cc.

00167                                          {
00168     return m_eventReadout->header().event();
00169 }

const DybDaq::EventReadout & DaqCrate::eventReadout (  )  const [inherited]

Returns the wrapped EventReadout instance.

Definition at line 171 of file DaqCrate.cc.

00171                                                        {
00172     return *m_eventReadout;
00173 }

DybDaq::EventReadout & DaqCrate::eventReadout (  )  [protected, inherited]

Returns the wrapped EventReadout instance.

Definition at line 245 of file DaqCrate.cc.

00245                                            {
00246     return *m_eventReadout;
00247 }

unsigned int DaqCrate::localTriggerNumber (  )  const [inherited]

Returns the local trigger number of this readout.

Definition at line 175 of file DaqCrate.cc.

00175                                                 {
00176     const DaqLtb& localTriggerBoard = ltb();
00177     return localTriggerBoard.localTriggerNumber();
00178 }

unsigned int DaqCrate::runNumber (  )  const [inherited]

Returns the run number in which this readout was taken.

Definition at line 180 of file DaqCrate.cc.

00180                                        {
00181     return m_eventReadout->header().run();
00182 }

const TimeStamp & DaqCrate::triggerTime (  )  const [inherited]

Returns the timestamp of the first trigger frame in this readout.

Definition at line 184 of file DaqCrate.cc.

00184                                              {
00185     const DaqLtbFrame& frame = firstLtbFrame();
00186     return frame.triggerTime();
00187 }

DayaBay::Trigger::TriggerType_t DaqCrate::triggerType (  )  const [inherited]

Returns the trigger type of this readout.

Definition at line 189 of file DaqCrate.cc.

00189                                                         {
00190     const DaqLtbFrame& frame = firstLtbFrame();
00191     // TODO: Chek whether this should be the sum of all frames?
00192     return frame.triggerType();
00193 }

bool DaqCrate::addLtb ( const DaqLtb ltb,
const unsigned int  slot 
) [inherited]

Adds a new LTB to this readout at the specified lot.

Definition at line 234 of file DaqCrate.cc.

00235                                                {
00236     if (0 != m_ltb) {
00237         return false;
00238     }
00239     m_ltb = ltb;
00240     eventReadout().addReadout(ltb->ltbReadout(),
00241                               slot);
00242     return true;
00243 }

const DaqLtbFrame & DaqCrate::firstLtbFrame (  )  const [protected, inherited]

Returns the first LTB frame in the LTB readout for this readout.

Definition at line 206 of file DaqCrate.cc.

00206                                                  {
00207     const DaqLtb& crateLtb = ltb();
00208     return crateLtb.firstFrame();
00209 }

const DaqLtb & DaqCrate::ltb (  )  const [protected, inherited]

Returns the LTB for this readout.

Definition at line 211 of file DaqCrate.cc.

00211                                   {
00212     if ( 0 == m_ltb) {
00213         if (0 == m_eventReadout) {
00214             return *((DaqLtb*)0);
00215         }
00216         const EventReadout::RomFragmentPtrList& fragments = m_eventReadout->romFragments();
00217         EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
00218         unsigned int ltbModuleType = m_eventReadout->header().eventTraits().moduleType(EventTraits::kLtbModule);
00219         while((ltbModuleType != ((*fragment)->header().moduleType()))
00220               && fragment != fragments.end()) {
00221             ++fragment;
00222         }
00223         if (fragment == fragments.end()) {
00224             return *((DaqLtb*)0);
00225         }
00226         const RomData& romData = (*fragment)->unwrappedData();
00227         const DaqLtb** ltb = const_cast<const DaqLtb**>(&m_ltb);
00228         *(ltb) = new DaqLtb(dynamic_cast<const LtbReadout&>(romData),
00229                             detector());
00230     }
00231     return *m_ltb;
00232 }


Member Data Documentation

PmtChannelPtrList* DayaBay::DaqPmtCrate::m_pmtChannelPtrs [private]

The list containing pointers to the PMT channel readouts in this crate.

Definition at line 161 of file DaqPmtCrate.h.

PmtChannelPtrList::size_type** DayaBay::DaqPmtCrate::m_pmtIndices [private]

The indices of channels in 'pmtChannelPtrs', organized by slot and channel.

Definition at line 162 of file DaqPmtCrate.h.

DybDaq::FeeReadout** DayaBay::DaqPmtCrate::m_feeReadouts [private]

The cache of FeeReadouts used help load this crate.

Definition at line 163 of file DaqPmtCrate.h.

FadcChannelPtrList* DayaBay::DaqPmtCrate::m_fadcChannelPtrs [private]

The list containing pointers to the FADC channel readouts in this crate.

Definition at line 164 of file DaqPmtCrate.h.

FadcChannelPtrList::size_type** DayaBay::DaqPmtCrate::m_fadcIndices [private]

The indices of channels in 'channelPtrs', organized by slot and channel.

Definition at line 165 of file DaqPmtCrate.h.

DybDaq::FadcReadout** DayaBay::DaqPmtCrate::m_fadcReadouts [private]

The cache of FadcReadouts used help load this crate.

Definition at line 166 of file DaqPmtCrate.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:24:29 2011 for DaqEvent by doxygen 1.4.7