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

In This Package:

DayaBay::DaqCrate Class Reference

Class that wraps a DybDaq::EventReadout instance. More...

#include <DaqCrate.h>

Inheritance diagram for DayaBay::DaqCrate:

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

Public Member Functions

 DaqCrate (const DybDaq::EventReadout *eventReadout)
 Standard constructor.
 DaqCrate (const DayaBay::Detector &detector, const unsigned int run, const unsigned int event)
 Monte Carlo constructor.
 DaqCrate (const DayaBay::DaqCrate &crate)
 Copy constructor.
 DaqCrate ()
 Default Constructor.
virtual ~DaqCrate ()
 Destroys this instance of the class.
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the ASCII output stream.
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

DaqCrateoperator= (const DayaBay::DaqCrate &rhs)
 Assignement operator.
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.
DybDaq::EventReadouteventReadout ()
 Returns the wrapped EventReadout instance.

Private Member Functions

void flushCache ()
 Deletes any objects cached by this instance.

Private Attributes

DayaBay::Detectorm_detector
 The detector associated with this readout.
DybDaq::EventReadoutm_eventReadout
 The wrapped EventReadout instance.
const DayaBay::DaqLtbm_ltb
 The local trigger board in this readout.

Detailed Description

Class that wraps a DybDaq::EventReadout instance.

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

Definition at line 45 of file DaqCrate.h.


Constructor & Destructor Documentation

DaqCrate::DaqCrate ( const DybDaq::EventReadout eventReadout  ) 

Standard constructor.

Definition at line 122 of file DaqCrate.cc.

00122                                                    :
00123     m_detector(0),
00124     m_eventReadout(const_cast<EventReadout*>(eventReadout)),
00125     m_ltb(0) {
00126 }

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

Monte Carlo constructor.

Definition at line 105 of file DaqCrate.cc.

00107                                              :
00108     m_detector(0),
00109     m_eventReadout(new EventReadout(convertSite(detector.site()),
00110                                     convertDetectorId(detector.detectorId()),
00111                                     run,
00112                                     event,
00113                                     0, // Normal data type
00114                                     false,
00115                                     false,
00116                                     false,
00117                                     CbltTraits::defaultTraits(),
00118                                     EventTraits::defaultTraits())),
00119     m_ltb(0) {
00120 }

DaqCrate::DaqCrate ( const DayaBay::DaqCrate crate  ) 

Copy constructor.

Definition at line 128 of file DaqCrate.cc.

00128                                        :
00129     m_detector(0),
00130     m_eventReadout(0),
00131     m_ltb(0) {
00132     const EventReadout& readout = crate.eventReadout();
00133     // WARNING: NExt line will fail to work if EventReadout is not ByteBuffer based.
00134     m_eventReadout = new EventReadout(readout);
00135 }

DayaBay::DaqCrate::DaqCrate (  )  [inline]

Default Constructor.

Definition at line 61 of file DaqCrate.h.

00061                : m_detector(0),
00062                  m_eventReadout(0),
00063                  m_ltb(0) {}

DaqCrate::~DaqCrate (  )  [virtual]

Destroys this instance of the class.

Definition at line 137 of file DaqCrate.cc.

00137                     {
00138     flushCache();
00139 }


Member Function Documentation

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

Fill the ASCII output stream.

Reimplemented in DayaBay::DaqPmtCrate.

Definition at line 172 of file DaqCrate.h.

00173 {
00174   s << "{ " << "detector :      " << m_detector << std::endl
00175             << "eventReadout :  " << m_eventReadout << std::endl
00176             << "ltb :   " << m_ltb << std::endl << " }";
00177   return s;
00178 }

const DaqPmtCrate * DaqCrate::asPmtCrate (  )  const

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

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

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

Returns the wrapped EventReadout instance.

Definition at line 171 of file DaqCrate.cc.

00171                                                        {
00172     return *m_eventReadout;
00173 }

unsigned int DaqCrate::localTriggerNumber (  )  const

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

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

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

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 
)

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 }

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

operator new

Reimplemented in DayaBay::DaqPmtCrate.

Definition at line 102 of file DaqCrate.h.

00103     {
00104       return ( sizeof(DaqCrate) == size ? 
00105                boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::malloc() :
00106                ::operator new(size) );
00107     }

static void* DayaBay::DaqCrate::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 in DayaBay::DaqPmtCrate.

Definition at line 112 of file DaqCrate.h.

00113     {
00114       return ::operator new (size,pObj);
00115     }

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

operator delete

Reimplemented in DayaBay::DaqPmtCrate.

Definition at line 118 of file DaqCrate.h.

00119     {
00120       boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::is_from(p) ?
00121       boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::free(p) :
00122       ::operator delete(p);
00123     }

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

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

Reimplemented in DayaBay::DaqPmtCrate.

Definition at line 127 of file DaqCrate.h.

00128     {
00129       ::operator delete (p, pObj);
00130     }

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

Assignement operator.

Definition at line 141 of file DaqCrate.cc.

00141                                                  {
00142   if (this != &rhs) {
00143       flushCache();
00144       m_detector = 0;
00145       m_eventReadout = new EventReadout(rhs.eventReadout());
00146       m_ltb = 0;
00147   }
00148   return *this;
00149 }

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

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]

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 }

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

Returns the wrapped EventReadout instance.

Definition at line 245 of file DaqCrate.cc.

00245                                            {
00246     return *m_eventReadout;
00247 }

void DaqCrate::flushCache (  )  [private]

Deletes any objects cached by this instance.

Reimplemented in DayaBay::DaqPmtCrate.

Definition at line 151 of file DaqCrate.cc.

00151                           {
00152     if (0 != m_ltb) {
00153         delete m_ltb;
00154     }
00155     if (0 != m_eventReadout) {
00156         delete m_eventReadout;
00157     }
00158     if (0 != m_detector) {
00159         delete m_detector;
00160     }
00161 }


Member Data Documentation

DayaBay::Detector* DayaBay::DaqCrate::m_detector [private]

The detector associated with this readout.

Definition at line 151 of file DaqCrate.h.

DybDaq::EventReadout* DayaBay::DaqCrate::m_eventReadout [private]

The wrapped EventReadout instance.

Definition at line 152 of file DaqCrate.h.

const DayaBay::DaqLtb* DayaBay::DaqCrate::m_ltb [private]

The local trigger board in this readout.

Definition at line 153 of file DaqCrate.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