/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 | Private Member Functions | Private Attributes
DayaBay::DaqRtm Class Reference

Class that wraps the DAQ data read from a RTM readout. More...

#include <DaqRtm.h>

Collaboration diagram for DayaBay::DaqRtm:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector
< DayaBay::DaqRtmData * > 
RtmDataPtrList
 A list containing pointers to the RtmData.

Public Member Functions

 DaqRtm (const DybDaq::RtmReadout &rtmReadout, const DayaBay::Detector &detector)
 Constructor for read-only instance.
 DaqRtm (const DayaBay::Detector &detector)
 Constructor for read-write instance.
 DaqRtm ()
 Default Constructor.
virtual ~DaqRtm ()
 Destroys this instance of the class.
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the ASCII output stream.
bool hasTriggers () const
 Returns true when this readout contains triggers.
const TimeStampearliestTriggerTime () const
 Returns the earliest trigger time in this crate.
const TimeStamplatestTriggerTime () const
 Returns the latest trigger time in this crate.
const RtmDataPtrListrtmDataList () const
 Returns the list of RtmData.
Trigger::TriggerType_t triggerType () const
 Returns the composite trigger type of this crate.
int getEvtType () const
 The trigger type of current readout, see the description of m_evtType.
const DybDaq::RtmReadoutrtmReadout () const
 Returns the rtmReadout being wrapped by this class.
bool addRtmData (DaqRtmData *rtmData)
 Adds a new DaqRtmData to this object.
void fixTriggerTime (const TimeStamp &time)
 fix the trigger time of this readout.
void setTriggerType (const DayaBay::Trigger::TriggerType_t &value)
 Update The composite trigger type of this crate.
void setEvtType (int value)
 Update Rpc Trigger type, 1:only array, 2:only first telescope, 4:one second telescope.

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

Private Member Functions

void fillTimes () const
 Fills in the earliest and latest times if not already filled.

Private Attributes

DybDaq::RtmReadoutm_rtmReadout
 The wrapped RtmReadout instance.
const DayaBay::Detectorm_detector
 The detector with which this readout is associated.
RtmDataPtrListm_rtmDataPtrs
 The list containing pointers to the RtmData in this readout.
DayaBay::Trigger::TriggerType_t m_triggerType
 The composite trigger type of this crate.
TimeStampm_earliestTriggerTime
 The earliest trigger time in this crate.
TimeStampm_latestTriggerTime
 The latest trigger time in this crate.
int m_evtType
 Rpc Trigger type, 1:only array, 2:only first telescope, 4:one second telescope. or the mix of them.

Detailed Description

Class that wraps the DAQ data read from a RTM readout.

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

Definition at line 43 of file DaqRtm.h.


Member Typedef Documentation

A list containing pointers to the RtmData.

Definition at line 48 of file DaqRtm.h.


Constructor & Destructor Documentation

DaqRtm::DaqRtm ( const DybDaq::RtmReadout rtmReadout,
const DayaBay::Detector detector 
)

Constructor for read-only instance.

Definition at line 24 of file DaqRtm.cc.

                                         :
    m_rtmReadout(const_cast<RtmReadout*>(&rtmReadout)),
    m_detector(&detector),
    m_rtmDataPtrs(0),
    m_triggerType(DayaBay::Trigger::kNone),
    m_earliestTriggerTime(0),
    m_latestTriggerTime(0),
    m_evtType(0) {
}
DaqRtm::DaqRtm ( const DayaBay::Detector detector)

Constructor for read-write instance.

Definition at line 35 of file DaqRtm.cc.

DayaBay::DaqRtm::DaqRtm ( ) [inline]

Default Constructor.

Definition at line 58 of file DaqRtm.h.

DaqRtm::~DaqRtm ( ) [virtual]

Destroys this instance of the class.

Definition at line 45 of file DaqRtm.cc.

                {
   if ( m_rtmDataPtrs != 0 ) {
       RtmDataPtrList::iterator block = m_rtmDataPtrs->begin();
       RtmDataPtrList::iterator finished = m_rtmDataPtrs->end();
       while ( block != finished ) {
           delete *block;
           ++block;
       }
       delete m_rtmDataPtrs;
   }
   if (0 != m_earliestTriggerTime) {
     if (m_earliestTriggerTime == m_latestTriggerTime) {
         delete m_earliestTriggerTime;
     } else {
         delete m_earliestTriggerTime;
         delete m_latestTriggerTime;
     }
   }
}

Member Function Documentation

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

Fill the ASCII output stream.

Definition at line 170 of file DaqRtm.h.

{
  s << "{ " << "rtmReadout :    " << m_rtmReadout << std::endl
            << "detector :      " << m_detector << std::endl
            << "rtmDataPtrs :   " << m_rtmDataPtrs << std::endl
            << "triggerType :   " << m_triggerType << std::endl
            << "earliestTriggerTime :   " << m_earliestTriggerTime << std::endl
            << "latestTriggerTime :     " << m_latestTriggerTime << std::endl
            << "evtType :       " << m_evtType << std::endl << " }";
  return s;
}
bool DaqRtm::hasTriggers ( ) const

Returns true when this readout contains triggers.

Definition at line 65 of file DaqRtm.cc.

                               {
  const RtmReadout::RtmDataPtrList& rtmDataList = m_rtmReadout->rtmDataList();
  return !rtmDataList.empty();
}
const TimeStamp & DaqRtm::earliestTriggerTime ( ) const

Returns the earliest trigger time in this crate.

Definition at line 70 of file DaqRtm.cc.

const TimeStamp & DaqRtm::latestTriggerTime ( ) const

Returns the latest trigger time in this crate.

Definition at line 75 of file DaqRtm.cc.

                                                 {
    fillTimes();
    return *m_latestTriggerTime;
}
const DaqRtm::RtmDataPtrList & DaqRtm::rtmDataList ( ) const

Returns the list of RtmData.

Definition at line 80 of file DaqRtm.cc.

{
    using DayaBay::Trigger::TriggerType_t;
    if ( m_rtmDataPtrs == 0 ) {
        TriggerType_t* trigType = const_cast<TriggerType_t*>(&m_triggerType);
        int* evtType = const_cast<int*>(&m_evtType);
        RtmDataPtrList** dataPtrs = const_cast<RtmDataPtrList**>(&m_rtmDataPtrs);
        (*dataPtrs) = new RtmDataPtrList();
        const RtmReadout::RtmDataPtrList& blocks = m_rtmReadout->rtmDataList();
        RtmReadout::RtmDataPtrList::const_iterator block = blocks.begin();
        while ( block != blocks.end() ) {
            DaqRtmData* daqRtm = new DaqRtmData(**block, *m_detector);
            (*dataPtrs)->push_back(daqRtm);
            (*trigType) = TriggerType_t(m_triggerType | daqRtm->triggerType());
            (*evtType) |= daqRtm->location();
            ++block;
        }
    }
    return *m_rtmDataPtrs;
}
DayaBay::Trigger::TriggerType_t DaqRtm::triggerType ( ) const

Returns the composite trigger type of this crate.

Definition at line 101 of file DaqRtm.cc.

                                                      {
    rtmDataList();
    return m_triggerType;
}
int DaqRtm::getEvtType ( ) const

The trigger type of current readout, see the description of m_evtType.

Definition at line 106 of file DaqRtm.cc.

                             {
    rtmDataList();
    return m_evtType;
}
const RtmReadout * DaqRtm::rtmReadout ( ) const

Returns the rtmReadout being wrapped by this class.

Definition at line 151 of file DaqRtm.cc.

                                           {
    return m_rtmReadout;
}
bool DaqRtm::addRtmData ( DaqRtmData rtmData)

Adds a new DaqRtmData to this object.

Definition at line 155 of file DaqRtm.cc.

{
    if ( m_rtmDataPtrs == 0 ) {
        m_rtmDataPtrs = new RtmDataPtrList();
    }
    m_rtmDataPtrs->push_back(rtmData);
    m_rtmReadout->add(rtmData->rtmData());
    return true;
}
void DaqRtm::fixTriggerTime ( const TimeStamp time)

fix the trigger time of this readout.

Definition at line 165 of file DaqRtm.cc.

{
    if ( m_earliestTriggerTime != 0 ) {
        if ( m_earliestTriggerTime != m_latestTriggerTime ) {
            delete m_latestTriggerTime;
        }
        delete m_earliestTriggerTime;
        m_earliestTriggerTime = 0;
        m_latestTriggerTime = 0;
    }

    rtmDataList();
    RtmDataPtrList::iterator end = m_rtmDataPtrs->end();
    for ( RtmDataPtrList::iterator it = m_rtmDataPtrs->begin();
            it != end;
            ++it )
    {
        (*it)->fixTriggerTime(time);
    }
}
void DayaBay::DaqRtm::setTriggerType ( const DayaBay::Trigger::TriggerType_t value) [inline]

Update The composite trigger type of this crate.

Definition at line 183 of file DaqRtm.h.

{
  m_triggerType = value;
}
void DayaBay::DaqRtm::setEvtType ( int  value) [inline]

Update Rpc Trigger type, 1:only array, 2:only first telescope, 4:one second telescope.

or the mix of them

Definition at line 188 of file DaqRtm.h.

{
  m_evtType = value;
}
static void* DayaBay::DaqRtm::operator new ( size_t  size) [inline, static]

operator new

Definition at line 110 of file DaqRtm.h.

    {
      return ( sizeof(DaqRtm) == size ? 
               boost::singleton_pool<DaqRtm, sizeof(DaqRtm)>::malloc() :
               ::operator new(size) );
    }
static void* DayaBay::DaqRtm::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

Definition at line 120 of file DaqRtm.h.

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

operator delete

Definition at line 126 of file DaqRtm.h.

    {
      boost::singleton_pool<DaqRtm, sizeof(DaqRtm)>::is_from(p) ?
      boost::singleton_pool<DaqRtm, sizeof(DaqRtm)>::free(p) :
      ::operator delete(p);
    }
static void DayaBay::DaqRtm::operator delete ( void *  p,
void *  pObj 
) [inline, static]

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

Definition at line 135 of file DaqRtm.h.

    {
      ::operator delete (p, pObj);
    }
void DaqRtm::fillTimes ( ) const [private]

Fills in the earliest and latest times if not already filled.

Definition at line 111 of file DaqRtm.cc.

                             {
    if (0 == m_earliestTriggerTime) {
        const RtmReadout::RtmDataPtrList& rtmDataList = m_rtmReadout->rtmDataList();
        const RtmReadout::RtmDataPtrList::const_iterator finished = rtmDataList.end();
        for (RtmReadout::RtmDataPtrList::const_iterator rtmDataItr= rtmDataList.begin();
             finished != rtmDataItr;
             ++rtmDataItr) {
            const RtmData* rtmData = *rtmDataItr;
            TimeStamp* dataTime;
            if(rtmData->usingUTC()){
                // TODO: Write this
                dataTime = new TimeStamp(0,
                                         0);
            } else {
                int nanoSec = rtmData->nanoSecond() + rtmData->accumulation();
                nanoSec /= 2;
                dataTime = new TimeStamp((TIME_T_BUILTIN_TYPE)rtmData->second(), nanoSec);
            }
            TimeStamp** earliestTime = const_cast<TimeStamp**>(&m_earliestTriggerTime);
            TimeStamp** latestTime = const_cast<TimeStamp**>(&m_latestTriggerTime);
            if (0 == m_earliestTriggerTime) {
                *(earliestTime) = dataTime;
                *(latestTime) = dataTime;
            } else if (*(m_earliestTriggerTime) > *(dataTime)) {
                if (m_earliestTriggerTime != m_latestTriggerTime) {
                    delete *(earliestTime);
                }
                *(earliestTime) = dataTime;
            } else if (*(m_earliestTriggerTime) < *(dataTime)) {
                if (m_earliestTriggerTime != m_latestTriggerTime) {
                    delete *(latestTime);
                }
                *(latestTime) = dataTime;
            } else {
                delete dataTime;
            }
        }
    }
}

Member Data Documentation

The wrapped RtmReadout instance.

Definition at line 147 of file DaqRtm.h.

The detector with which this readout is associated.

Definition at line 148 of file DaqRtm.h.

The list containing pointers to the RtmData in this readout.

Definition at line 149 of file DaqRtm.h.

The composite trigger type of this crate.

Definition at line 150 of file DaqRtm.h.

The earliest trigger time in this crate.

Definition at line 151 of file DaqRtm.h.

The latest trigger time in this crate.

Definition at line 152 of file DaqRtm.h.

Rpc Trigger type, 1:only array, 2:only first telescope, 4:one second telescope. or the mix of them.

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