/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DayaBay::DaqPmtCrate Class Reference

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

#include <DaqPmtCrate.h>

Inheritance diagram for DayaBay::DaqPmtCrate:
Inheritance graph
[legend]
Collaboration diagram for DayaBay::DaqPmtCrate:
Collaboration graph
[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.
virtual bool hasTriggers () const
 Returns true when this readout contains triggers.
virtual const TimeStamptriggerTime () const
 Returns the timestamp of the first trigger frame in this readout.
virtual double triggerSpan () const
 Returns the span, in seconds, of trigger times in this readout.
virtual Trigger::TriggerType_t triggerType () const
 Returns the trigger type of this readout.
virtual unsigned int localTriggerNumber () const
 Returns the local trigger number of this readout.
virtual bool addLtb (const DaqLtb *ltb, const unsigned int slot)
 Adds a new LTB to this readout at the specified lot.
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.
virtual void fixTriggerTime (const TimeStamp &time)
 fix the trigger time of this readout.
const DayaBay::DaqPmtCrateasPmtCrate () const
 Returns this object as a DaqPmtCrate.
const DayaBay::DaqRpcCrateasRpcCrate () const
 Returns this object as a DaqRpcCrate.
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 runNumber () const
 Returns the run number in which this readout was taken.

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.
void assignment (const DayaBay::DaqCrate &rhs)
 Assignement operator.

Private Member Functions

const DayaBay::DaqLtbltb () const
 Returns the LTB for this readout.
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 fillFadcSamplesPreV2 (const DybDaq::FadcReadout::FadcDataPtrList &hits, const unsigned int, const Site::Site_t &site, const DetectorId::DetectorId_t &det) const
 Fills in the sampled for pre FADC v2 data.
void fillFadcSamples (const DybDaq::FadcReadout::FadcDataPtrList &hits, const unsigned int, const Site::Site_t &site, const DetectorId::DetectorId_t &det) const
 Fills in the sampled for pre FADC v2 data.
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.
const DayaBay::DaqLtbm_localTriggerBoard
 The local trigger board in this readout.

Detailed Description

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

Author:
sjpatton@lbl.gov created Thu Dec 5 17:51:47 2013

Definition at line 44 of file DaqPmtCrate.h.


Member Typedef Documentation

A list containing pointers to the PMT channel readouts.

Definition at line 49 of file DaqPmtCrate.h.

A list containing pointers to the FADC channel readouts.

Definition at line 51 of file DaqPmtCrate.h.


Constructor & Destructor Documentation

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

Constructor for read-only instance.

Definition at line 82 of file DaqPmtCrate.cc.

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

Constructor for read-write instance.

Definition at line 61 of file DaqPmtCrate.cc.

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

Copy constructor.

Definition at line 93 of file DaqPmtCrate.cc.

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

Default Constructor.

Definition at line 65 of file DaqPmtCrate.h.

DaqPmtCrate::~DaqPmtCrate ( ) [virtual]

Destroys this instance of the class.

Definition at line 104 of file DaqPmtCrate.cc.

                          {
    flushCache();
}

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 224 of file DaqPmtCrate.h.

{
  DaqCrate::fillStream(s);
  s << "{ " << "pmtChannelPtrs :        " << m_pmtChannelPtrs << std::endl
            << "pmtIndices :    " << m_pmtIndices << std::endl
            << "feeReadouts :   " << m_feeReadouts << std::endl
            << "fadcChannelPtrs :       " << m_fadcChannelPtrs << std::endl
            << "fadcIndices :   " << m_fadcIndices << std::endl
            << "fadcReadouts :  " << m_fadcReadouts << std::endl
            << "localTriggerBoard :     " << m_localTriggerBoard << std::endl << " }";
  return s;
}
bool DaqPmtCrate::hasTriggers ( ) const [virtual]

Returns true when this readout contains triggers.

Implements DayaBay::DaqCrate.

Definition at line 123 of file DaqPmtCrate.cc.

                                    {
  return localTriggerBoard().hasTriggers();
}
const TimeStamp & DaqPmtCrate::triggerTime ( ) const [virtual]

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

Implements DayaBay::DaqCrate.

Definition at line 127 of file DaqPmtCrate.cc.

                                                {
    const DaqLtb& crateLtb = localTriggerBoard();
    return crateLtb.earliestTriggerTime();
}
double DaqPmtCrate::triggerSpan ( ) const [virtual]

Returns the span, in seconds, of trigger times in this readout.

Implements DayaBay::DaqCrate.

Definition at line 132 of file DaqPmtCrate.cc.

                                      {
    const DaqLtb& crateLtb = localTriggerBoard();
    TimeStamp result = crateLtb.latestTriggerTime();
    result.Subtract(crateLtb.earliestTriggerTime());
    return (double)result;
}
DayaBay::Trigger::TriggerType_t DaqPmtCrate::triggerType ( ) const [virtual]

Returns the trigger type of this readout.

Implements DayaBay::DaqCrate.

Definition at line 139 of file DaqPmtCrate.cc.

                                                           {
    const DaqLtb& crateLtb = localTriggerBoard();
    return crateLtb.triggerType();
}
unsigned int DaqPmtCrate::localTriggerNumber ( ) const [virtual]

Returns the local trigger number of this readout.

Implements DayaBay::DaqCrate.

Definition at line 144 of file DaqPmtCrate.cc.

                                                   {
    const DaqLtb& ltb = localTriggerBoard();
    return ltb.localTriggerNumber();
}
bool DaqPmtCrate::addLtb ( const DaqLtb ltb,
const unsigned int  slot 
) [virtual]

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

Definition at line 560 of file DaqPmtCrate.cc.

                                                  {
    if (0 != m_localTriggerBoard) {
        return false;
    }
    m_localTriggerBoard = ltb;
    eventReadout().addReadout(ltb->ltbReadout(),
                              slot);
    return true;
}
const DaqLtb & DaqPmtCrate::localTriggerBoard ( ) const

Returns the LTB for this crate.

Definition at line 242 of file DaqPmtCrate.cc.

                                                   {
    if ( 0 == m_localTriggerBoard) {
        const EventReadout& readout = eventReadout();
        if (0 == &readout) {
            return *((DaqLtb*)0);
        }
        const EventReadout::RomFragmentPtrList& fragments = readout.romFragments();
        EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
        unsigned int ltbModuleType = readout.header().eventTraits().moduleType(EventTraits::kLtbModule);
        while((ltbModuleType != ((*fragment)->header().moduleType()))
              && fragment != fragments.end()) {
            ++fragment;
        }
        if (fragment == fragments.end()) {
            return *((DaqLtb*)0);
        }
        const RomData& romData = (*fragment)->unwrappedData();
        const DaqLtb** ltb = const_cast<const DaqLtb**>(&m_localTriggerBoard);
        *(ltb) = new DaqLtb(dynamic_cast<const LtbReadout&>(romData),
                            detector());
    }
    return *m_localTriggerBoard;
}
const DaqPmtCrate::PmtChannelPtrList & DaqPmtCrate::channelReadouts ( ) const

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

Definition at line 266 of file DaqPmtCrate.cc.

                                                                       {
    return pmtChannelReadouts();
}
const DaqPmtCrate::PmtChannelPtrList & DaqPmtCrate::pmtChannelReadouts ( ) const

Returns the list of FEE channel readouts.

Definition at line 270 of file DaqPmtCrate.cc.

                                                                          {
    const EventReadout& daqReadout = eventReadout();
    if (0 == &daqReadout) {
        return *((PmtChannelPtrList*)0);
    }

    if (freshPmtAttributes()) {
        const Detector zzub = detector();
        const EventHeader& eventHeader = daqReadout.header();
        const EventTraits& traits = eventHeader.eventTraits();
        const unsigned int kFeeModuleType = traits.moduleType(EventTraits::kFeeModule);
        const EventReadout::RomFragmentPtrList& fragments = daqReadout.romFragments();
        for (EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
             fragment != fragments.end();
             ++fragment) {
            const RomHeader& header = (*fragment)->header();
            if (kFeeModuleType == header.moduleType()) {
                const FeeReadout& readout = dynamic_cast<const FeeReadout&>((*fragment)->unwrappedData());
                const FeeReadout::FeeHitPtrList& hits = readout.feeHits();
                const unsigned int slot = header.slot();
    for (FeeReadout::FeeHitPtrList::const_iterator hitPtr = hits.begin();
         hitPtr != hits.end();
         ++hitPtr) {
        const unsigned int channelNumber = (*hitPtr)->channelId();
        PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(slot);
        const unsigned int index = indices[channelNumber];
        if (kUninitializedChannel == index) {
            indices[channelNumber] = m_pmtChannelPtrs->size();
            m_pmtChannelPtrs->push_back(new DaqPmtChannel(*(*hitPtr),
                                                          FeeChannelId(slot,
                                                                       channelNumber + kFeeConnectorOffset,
                                                                                      zzub.site(),
                                                                                      zzub.detectorId())));
        } else {
            (m_pmtChannelPtrs->at(index))->addHit(*(*hitPtr));
        }
    }
            }
        }
    }
    return *m_pmtChannelPtrs;
}
bool DaqPmtCrate::hasChannel ( const DayaBay::FeeChannelId channelId) const

Returns true if the DaqPmtChannel for the supplied FeeChannelId exists.

Definition at line 313 of file DaqPmtCrate.cc.

                                                                {
    pmtChannelReadouts();
    PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(channelId.board());
    const unsigned int index = indices[channelId.connector() - kFeeConnectorOffset];
    return kUninitializedChannel != index;
}
const DaqPmtChannel & DaqPmtCrate::channel ( const DayaBay::FeeChannelId channelId) const

Returns the DaqPmtChannel for the supplied FeeChannelId.

Definition at line 320 of file DaqPmtCrate.cc.

                                                                             {
    pmtChannelReadouts();
    PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(channelId.board());
    const unsigned int channelNumber = channelId.connector() - kFeeConnectorOffset;
    if (kMaxChannelCount <= channelNumber) {
        return *((DaqPmtChannel*)0);
    }
    const unsigned int index = indices[channelNumber];
    if (kUninitializedChannel == index) {
        return *((DaqPmtChannel*)0);
    }
    return *(m_pmtChannelPtrs->at(index));    
}
DaqPmtChannel & DaqPmtCrate::channel ( const DayaBay::FeeChannelId channelId)

Returns the DaqPmtChannel for the supplied FeeChannelId.

Definition at line 334 of file DaqPmtCrate.cc.

                                                                 {
    const unsigned int slot = channelId.board();
    FeeReadout* readout = m_feeReadouts[slot];
    if (0 == readout) {
        readout = new FeeReadout(localTriggerNumber(),
                                 triggerType(),
                                 false,
                                 false,
                                 FeeTraits::defaultTraits());
        m_feeReadouts[slot] = readout;
        eventReadout().addReadout(readout,
                                  slot);
    }

    PmtChannelPtrList::size_type* indices = pmtIndicesForSlot(slot);
    const unsigned int channelNumber = channelId.connector() - kFeeConnectorOffset;
    if (kMaxChannelCount <= channelNumber) {
        return *((DaqPmtChannel*)0);
    }
    const unsigned int index = indices[channelNumber];
    if (kUninitializedChannel == index) {
        indices[channelNumber] = m_pmtChannelPtrs->size();
        DaqPmtChannel* channel = new DaqPmtChannel(channelId,
                                                   *readout);
        m_pmtChannelPtrs->push_back(channel);
        return *channel;
    }
    return *(m_pmtChannelPtrs->at(index));
}
const DaqPmtCrate::FadcChannelPtrList & DaqPmtCrate::fadcChannelReadouts ( ) const

Returns the list of FADC channel readouts.

Definition at line 390 of file DaqPmtCrate.cc.

                                                                            {
    const EventReadout& daqReadout = eventReadout();
    if (0 == &daqReadout) {
        return *((FadcChannelPtrList*)0);
    }

    if (freshFadcAttributes()) {
        const Detector zzub = detector();
        const EventHeader& eventHeader = daqReadout.header();
        const EventTraits& traits = eventHeader.eventTraits();
        const unsigned int kFadcModuleType = traits.moduleType(EventTraits::kFadcModule);
        const EventReadout::RomFragmentPtrList& fragments = daqReadout.romFragments();
        for (EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
             fragment != fragments.end();
             ++fragment) {
            const RomHeader& header = (*fragment)->header();
            if (kFadcModuleType == header.moduleType()) {
                const FadcReadout& readout = dynamic_cast<const FadcReadout&>((*fragment)->unwrappedData());
                const FadcReadout::FadcDataPtrList& data = readout.fadcData();
                const unsigned int slot = header.slot();
                const DaqTraits& traits = readout.daqTraits();
                if (2 > traits.majorVersion() && 6 > traits.minorVersion()) {
                    fillFadcSamplesPreV2(data,
                                         slot,
                                         zzub.site(),
                                         zzub.detectorId());
                } else {
                  fillFadcSamples(data, 
                                  slot, 
                                  zzub.site(), 
                                  zzub.detectorId()); 
                }
            }
        }
    }
    return *m_fadcChannelPtrs;
}
bool DaqPmtCrate::hasChannel ( const DayaBay::FadcChannelId channelId) const

Returns true if the DaqFadcChannel for the supplied FadcChannelId exists.

Definition at line 485 of file DaqPmtCrate.cc.

                                                                 {
    FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(channelId.board());
    const unsigned int index = indices[channelId.connector() - kFadcConnectorOffset];
    return kUninitializedChannel != index;
}
const DaqFadcChannel & DaqPmtCrate::channel ( const DayaBay::FadcChannelId channelId) const

Returns the DaqFadcChannel for the supplied FadcChannelId.

Definition at line 491 of file DaqPmtCrate.cc.

                                                                               {
    FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(channelId.board());
    const unsigned int channelNumber = channelId.connector() - kFadcConnectorOffset;
    if (kMaxChannelCount <= channelNumber) {
        return *((DaqFadcChannel*)0);
    }
    const unsigned int index = indices[channelNumber];
    if (kUninitializedChannel == index) {
        return *((DaqFadcChannel*)0);
    }
    return *(m_fadcChannelPtrs->at(index));    
}
DaqFadcChannel & DaqPmtCrate::channel ( const DayaBay::FadcChannelId channelId)

Returns the DaqFadcChannel for the supplied FadcChannelId.

Definition at line 504 of file DaqPmtCrate.cc.

                                                                   {
    const unsigned int slot = channelId.board();
    FadcReadout* readout = m_fadcReadouts[slot];
    if (0 == readout) {
        readout = new FadcReadout(localTriggerNumber(),
                                  triggerType(),
                                  false,
                                  FadcTraits::defaultTraits());
        m_fadcReadouts[slot] = readout;
        eventReadout().addReadout(readout,
                                  slot);
    }

    FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
    unsigned int channelNumber = 0;
    if (kFadcConnectorOffset > (unsigned int)channelId.connector()) {
        channelNumber = channelId.connector();
    } else {
        channelNumber = channelId.connector() - kFadcConnectorOffset;
    }
    if (kMaxChannelCount <= channelNumber) {
        return *((DaqFadcChannel*)0);
    }
    if (kMaxChannelCount <= channelNumber) {
        return *((DaqFadcChannel*)0);
    }
    const unsigned int index = indices[channelNumber];
    if (kUninitializedChannel == index) {
        indices[channelNumber] = m_fadcChannelPtrs->size();
        DaqFadcChannel* channel = new DaqFadcChannel(channelId,
                                                   *readout);
        m_fadcChannelPtrs->push_back(channel);
        return *channel;
    }
    return *(m_fadcChannelPtrs->at(index));
}
void DaqPmtCrate::fixTriggerTime ( const TimeStamp time) [virtual]

fix the trigger time of this readout.

Implements DayaBay::DaqCrate.

Definition at line 364 of file DaqPmtCrate.cc.

{
    localTriggerBoard();
    (const_cast<DaqLtb*>(m_localTriggerBoard))->fixTriggerTime(time);
}
static void* DayaBay::DaqPmtCrate::operator new ( size_t  size) [inline, static]

operator new

Reimplemented from DayaBay::DaqCrate.

Definition at line 134 of file DaqPmtCrate.h.

    {
      return ( sizeof(DaqPmtCrate) == size ? 
               boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::malloc() :
               ::operator new(size) );
    }
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 144 of file DaqPmtCrate.h.

    {
      return ::operator new (size,pObj);
    }
static void DayaBay::DaqPmtCrate::operator delete ( void *  p) [inline, static]

operator delete

Reimplemented from DayaBay::DaqCrate.

Definition at line 150 of file DaqPmtCrate.h.

    {
      boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::is_from(p) ?
      boost::singleton_pool<DaqPmtCrate, sizeof(DaqPmtCrate)>::free(p) :
      ::operator delete(p);
    }
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 159 of file DaqPmtCrate.h.

    {
      ::operator delete (p, pObj);
    }
DaqPmtCrate & DaqPmtCrate::operator= ( const DayaBay::DaqPmtCrate rhs) [protected]

Assignement operator.

Definition at line 108 of file DaqPmtCrate.cc.

                                                           {
  if (this != &rhs) {
      flushCache();
      assignment(rhs);
      m_pmtChannelPtrs = 0;
      m_pmtIndices = 0;
      m_feeReadouts = 0;
      m_fadcChannelPtrs = 0;
      m_fadcIndices = 0;
      m_fadcReadouts = 0;
      m_localTriggerBoard = 0;
  }
  return *this;
}
const DayaBay::DaqLtb& DayaBay::DaqPmtCrate::ltb ( ) const [private]

Returns the LTB for this readout.

bool DaqPmtCrate::freshPmtAttributes ( ) const [private]

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

Definition at line 204 of file DaqPmtCrate.cc.

                                           {
    if (0 != m_pmtChannelPtrs) {
        return false;
    }

    PmtChannelPtrList** pmtChannelPtrs = const_cast<PmtChannelPtrList**>(&m_pmtChannelPtrs);
    *(pmtChannelPtrs) = new PmtChannelPtrList();

    PmtChannelPtrList::size_type*** pmtIndicesInSlot = const_cast<PmtChannelPtrList::size_type***>(&m_pmtIndices);
    *(pmtIndicesInSlot) = new PmtChannelPtrList::size_type*[kMaxSlotCount];
    for (unsigned int slot = 0;
         slot != kMaxSlotCount;
         ++slot) {
        (*(pmtIndicesInSlot))[slot] = 0;
    }

    return true;
}
bool DaqPmtCrate::freshFadcAttributes ( ) const [private]

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

Definition at line 223 of file DaqPmtCrate.cc.

                                            {
    if (0 != m_fadcChannelPtrs) {
        return false;
    }

    FadcChannelPtrList** fadcChannelPtrs = const_cast<FadcChannelPtrList**>(&m_fadcChannelPtrs);
    *(fadcChannelPtrs) = new FadcChannelPtrList();

    FadcChannelPtrList::size_type*** fadcIndicesInSlot = const_cast<FadcChannelPtrList::size_type***>(&m_fadcIndices);
    *(fadcIndicesInSlot) = new FadcChannelPtrList::size_type*[kMaxSlotCount];
    for (unsigned int slot = 0;
         slot != kMaxSlotCount;
         ++slot) {
        (*(fadcIndicesInSlot))[slot] = 0;
    }

    return true;
}
DaqPmtCrate::PmtChannelPtrList::size_type * DaqPmtCrate::pmtIndicesForSlot ( const unsigned int  slot) const [private]

Returns the channel indices for the specified slot.

Definition at line 371 of file DaqPmtCrate.cc.

                                                                                                   {
    if (kMaxSlotCount <= slot) {
        return 0;
    }

    freshPmtAttributes();
    PmtChannelPtrList::size_type* result = m_pmtIndices[slot];
    if (0 == result) {
        result = new PmtChannelPtrList::size_type[kMaxChannelCount];
        m_pmtIndices[slot] = result;
        for (unsigned int channel = 0;
             channel != kMaxChannelCount;
             ++channel) {
            result[channel] = kUninitializedChannel;
        }
    }
    return result;
}
DaqPmtCrate::FadcChannelPtrList::size_type * DaqPmtCrate::fadcIndicesForSlot ( const unsigned int  slot) const [private]

Returns the channel indices for the specified slot.

Definition at line 541 of file DaqPmtCrate.cc.

                                                                                                     {
    if (kMaxSlotCount <= slot) {
        return 0;
    }

    freshFadcAttributes();
    FadcChannelPtrList::size_type* result = m_fadcIndices[slot];
    if (0 == result) {
        result = new FadcChannelPtrList::size_type[kMaxChannelCount];
        m_fadcIndices[slot] = result;
        for (unsigned int channel = 0;
             channel != kMaxChannelCount;
             ++channel) {
            result[channel] = kUninitializedChannel;
        }
    }
    return result;
}
void DaqPmtCrate::fillFadcSamplesPreV2 ( const DybDaq::FadcReadout::FadcDataPtrList hits,
const unsigned  int,
const Site::Site_t site,
const DetectorId::DetectorId_t det 
) const [private]

Fills in the sampled for pre FADC v2 data.

Definition at line 428 of file DaqPmtCrate.cc.

                                                                                {
    for (FadcReadout::FadcDataPtrList::const_iterator dataPtr = data.begin();
         dataPtr != data.end();
         ++dataPtr) {
        const unsigned int channelNumber = (*dataPtr)->channelId();
        FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
        const unsigned int index = indices[channelNumber];
        if (kUninitializedChannel == index) {
            indices[channelNumber] = m_fadcChannelPtrs->size();
            m_fadcChannelPtrs->push_back(new DaqFadcChannel(*(*dataPtr),
                                                            FadcChannelId(slot,
                                                                          channelNumber + kFadcConnectorOffset,
                                                                          site,
                                                                          det)));
        } else {
            (m_fadcChannelPtrs->at(index))->addData(*(*dataPtr));
        }
    }
}
void DaqPmtCrate::fillFadcSamples ( const DybDaq::FadcReadout::FadcDataPtrList hits,
const unsigned  int,
const Site::Site_t site,
const DetectorId::DetectorId_t det 
) const [private]

Fills in the sampled for pre FADC v2 data.

Definition at line 451 of file DaqPmtCrate.cc.

                                                                           {
    unsigned int index = kUninitializedChannel;
    for (FadcReadout::FadcDataPtrList::const_iterator dataPtr = data.begin();
         dataPtr != data.end();
         ++dataPtr) {
        if ((*dataPtr)->isChannelHead()) {
            const unsigned int channelNumber = (*dataPtr)->channelId();
            FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
            index = indices[channelNumber];
            if (kUninitializedChannel == index) {
                indices[channelNumber] = m_fadcChannelPtrs->size();
                index = indices[channelNumber];
                m_fadcChannelPtrs->push_back(new DaqFadcChannel(*(*dataPtr),
                                                                FadcChannelId(slot,
                                                                              channelNumber + kFadcConnectorOffset,
                                                                              site,
                                                                              det)));
            }
        } else if ((*dataPtr)->isChannelFoot()) {
            // Simple sanity check.
            const unsigned int channelNumber = (*dataPtr)->channelId();
            FadcChannelPtrList::size_type* indices = fadcIndicesForSlot(slot);
            if (index != indices[channelNumber]) {
              return;
            }
        } else {
            (m_fadcChannelPtrs->at(index))->addSamples(*(*dataPtr));
        }
    }
}
void DaqPmtCrate::flushCache ( ) [private]

Deletes any objects cached by this instance.

Reimplemented from DayaBay::DaqCrate.

Definition at line 149 of file DaqPmtCrate.cc.

                             {
    if (0 != m_localTriggerBoard) {
        delete m_localTriggerBoard;
    }
    if (0 != m_fadcReadouts) {
        // Fadceadouts are own by the EventReadout.
        delete[] m_fadcReadouts;
    }
    if (0 != m_fadcIndices) {
        for (unsigned int slot = 0;
             slot != kMaxSlotCount;
             ++slot) {
            FadcChannelPtrList::size_type* indicesInSlot = m_fadcIndices[slot];
            if (0 != indicesInSlot) {
                delete[] indicesInSlot;
            }
        }
        delete[] m_fadcIndices;
    }
    if (0 != m_fadcChannelPtrs) {
        FadcChannelPtrList::iterator finished = m_fadcChannelPtrs->end();
        for(FadcChannelPtrList::iterator readout = m_fadcChannelPtrs->begin();
            readout != finished;
            ++readout) {
            delete (*readout);
        }
        delete m_fadcChannelPtrs;
    }

    if (0 != m_feeReadouts) {
        // FeeReadouts are own by the EventReadout.
        delete[] m_feeReadouts;
    }
    if (0 != m_pmtIndices) {
        for (unsigned int slot = 0;
             slot != kMaxSlotCount;
             ++slot) {
            PmtChannelPtrList::size_type* indicesInSlot = m_pmtIndices[slot];
            if (0 != indicesInSlot) {
                delete[] indicesInSlot;
            }
        }
        delete[] m_pmtIndices;
    }
    if (0 != m_pmtChannelPtrs) {
        PmtChannelPtrList::iterator finished = m_pmtChannelPtrs->end();
        for(PmtChannelPtrList::iterator readout = m_pmtChannelPtrs->begin();
            readout != finished;
            ++readout) {
            delete (*readout);
        }
        delete m_pmtChannelPtrs;
    }
}
const DaqPmtCrate * DaqCrate::asPmtCrate ( ) const [inherited]

Returns this object as a DaqPmtCrate.

Definition at line 175 of file DaqCrate.cc.

                                              {
    return dynamic_cast<const DaqPmtCrate*>(this);
}
const DaqRpcCrate * DaqCrate::asRpcCrate ( ) const [inherited]

Returns this object as a DaqRpcCrate.

Definition at line 179 of file DaqCrate.cc.

                                              {
    return dynamic_cast<const DaqRpcCrate*>(this);
}
const Detector & DaqCrate::detector ( ) const [inherited]

Returns the detector associated with this readout.

Definition at line 195 of file DaqCrate.cc.

                                         {
    if (0 == m_detector) {
        const EventHeader& header = m_eventReadout->header();
        Detector** detector = const_cast<Detector**>(&m_detector);
        *(detector) = new Detector(convertSite(header.site()),
                                   convertDetector(header.detector()));

    }
    return *m_detector;
}
unsigned int DaqCrate::eventNumber ( ) const [inherited]

Returns the event number assigned to this readout.

Definition at line 183 of file DaqCrate.cc.

                                         {
    return m_eventReadout->header().event();
}
const DybDaq::EventReadout & DaqCrate::eventReadout ( ) const [inherited]

Returns the wrapped EventReadout instance.

Definition at line 187 of file DaqCrate.cc.

                                                       {
    return *m_eventReadout;
}
DybDaq::EventReadout & DaqCrate::eventReadout ( ) [protected, inherited]

Returns the wrapped EventReadout instance.

Definition at line 206 of file DaqCrate.cc.

                                           {
    return *m_eventReadout;
}
unsigned int DaqCrate::runNumber ( ) const [inherited]

Returns the run number in which this readout was taken.

Definition at line 191 of file DaqCrate.cc.

                                       {
    return m_eventReadout->header().run();
}
void DaqCrate::assignment ( const DayaBay::DaqCrate rhs) [protected, inherited]

Assignement operator.

Definition at line 158 of file DaqCrate.cc.

                                             {
  if (this != &rhs) {
      flushCache();
      m_detector = 0;
      m_eventReadout = new EventReadout(rhs.eventReadout());
  }
}

Member Data Documentation

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

Definition at line 201 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 202 of file DaqPmtCrate.h.

The cache of FeeReadouts used help load this crate.

Definition at line 203 of file DaqPmtCrate.h.

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

Definition at line 204 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 205 of file DaqPmtCrate.h.

The cache of FadcReadouts used help load this crate.

Definition at line 206 of file DaqPmtCrate.h.

The local trigger board in this readout.

Definition at line 207 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 Fri May 16 2014 10:01:06 for DaqEvent by doxygen 1.7.4