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

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
DaqBenchmark Class Reference

#include <DaqBenchmark.h>

Collaboration diagram for DaqBenchmark:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DaqBenchmark (const std::string &name, ISvcLocator *pSvcLocator)
 Create an instance of this class.
 ~DaqBenchmark ()
 Destroy this instance of the class.
virtual StatusCode initialize ()
 Initializes this module.
virtual StatusCode finalize ()
 Finalizes this module.
virtual StatusCode execute ()
 Called for each event.

Private Member Functions

 DaqBenchmark ()
 Suppress default.
 DaqBenchmark (DaqBenchmark &rhs)
 Suppress default.
DaqBenchmarkoperator= (DaqBenchmark &rhs)
 Suppress default.
TH1F ** getSlotLowGainHistograms (const unsigned int slot)
 Returns the High Range ADC histograms for the supplied slot.
TH1F * getLowGainHistogram (TH1F **slotLowGainHistograms, const unsigned int slot, const unsigned int channelNumber)
 Returns the selected histograms from the set supplied.
TH1F ** getSlotHighGainHistograms (const unsigned int slot)
 Returns the High Range ADC histograms for the supplied slot.
TH1F * getHighGainHistogram (TH1F **slotHighGainHistograms, const unsigned int slot, const unsigned int channelNumber)
 Returns the selected histograms from the set supplied.
TH1F ** getSlotTdcHistograms (const unsigned int slot)
 Returns the TDC histograms for the supplied slot.
TH1F * getTdcHistogram (TH1F **slotTdcHistograms, const unsigned int slot, const unsigned int channelNumber)
 Returns the selected histogram from the set supplied.
TH1F ** getSlotHistogram (TH1F ***histograms, const unsigned int slot)
 Returns the selected sub-set of histograms from the specified set.
TH1F ** getSlotFadcHistograms (const unsigned int slot)
 Returns the FADC histograms for the supplied slot.
TH1F * getFadcHistogram (TH1F **slotFadcHistograms, const unsigned int slot, const unsigned int channelNumber)
 Returns the selected histogram from the set supplied.
TH2F ** getSlotHistogram (TH2F ***histograms, const unsigned int slot)
 Returns the selected sub-set of histograms from the specified set.
StatusCode handleDaqFormat (const DayaBay::ReadoutHeader &readoutHeader)
 Handles the benchmark code using the DaqFormat project.
void handleEvent (const DybDaq::EventReadout &event)
 Handles the EventReadout once it has been extracted from the TES.
void handleFragment (const DybDaq::RomFragment &fragment)
 Handles a RomFragment.
void handleFee (const DybDaq::FeeReadout &readout, const unsigned int slot)
 Handled the readout of FEE board.
void handleFadc (const DybDaq::FadcReadout &readout, const unsigned int slot)
 Handle the readout of an FADC board.
StatusCode handleReadoutEvent (const DayaBay::ReadoutHeader &readoutHeader)
 Handles the benchmark code using the ReadoutEvent project.
void handleEvent (const DayaBay::ReadoutPmtCrate &create)
 Handles the ReadoutPmtCrate once it has been extracted from the TES.
void handleChannel (const DayaBay::ReadoutPmtChannel &channel)
 Handles a ReadoutPmtChannel.
StatusCode handleDaqEvent (const DayaBay::ReadoutHeader &readoutHeader)
 Handles the benchmark code using the DaqEvent project.
void handleEvent (const DayaBay::DaqPmtCrate &crate)
 Handles DaqPmtCrate.
void handleFrame (const DayaBay::DaqLtbFrame &frame)
 Handles a DaqLtbFrame.
void handleChannel (const DayaBay::DaqPmtChannel &channel)
 Handles a DaqPmtChannel.
void handleChannel (const DayaBay::DaqFadcChannel &channel)
 Handles a DaqFadcChannel.
void checkDeltaTime (const TimeStamp &time) const
 Checks that the delta between times in positive.

Private Attributes

IDaqDetailsSvcm_daqDetailsSvc
 The DAQ Details service used by this module.
IStatisticsSvc * m_statsSvc
 The Statistics service used by this module.
unsigned int m_lastRun
 The last run seen by this instance.
unsigned int m_lastFile
 The last file seen by this instance.
TH1F *** m_feeLowGainHistograms
 The set of historgrams for the FEE high range ADCs.
TH1F *** m_feeHighGainHistograms
 The set of historgrams for the FEE low range ADCs.
TH1F *** m_feeTdcHistograms
 The set of historgrams for the FEE TDCs.
TH1F *** m_fadcHistograms
 The set of historgrams for the FADCs.
unsigned long m_eventCount
 The number of event seen so far by this module.
unsigned long m_payloadLength
 The number of bytes seen so far by this module.
time_t m_beginTime
 The time this module was initialized.
time_t m_firstEventTime
 The trigger time of the first event seen by this module.
time_t m_lastEventTime
 The trigger time of the last event seen by this module.
double m_specificTime
 The last trigger time seen, to an accuracy of nanoseconds.
bool m_useDaqFormat
 True if the DaqFormat products should be used in the benchmark.
bool m_useDaqEvent
 True if the DaqEvent products should be used in the benchmark.
bool m_useReadoutEvent
 True if the ReadoutEvent products should be used in the benchmark.

Detailed Description

Definition at line 42 of file DaqBenchmark.h.


Constructor & Destructor Documentation

DaqBenchmark::DaqBenchmark ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Create an instance of this class.

DaqBenchmark::~DaqBenchmark ( )

Destroy this instance of the class.

Definition at line 126 of file DaqBenchmark.cc.

                            {
    // Histograms are cleaned up by Stats service.
}
DaqBenchmark::DaqBenchmark ( ) [private]

Suppress default.

DaqBenchmark::DaqBenchmark ( DaqBenchmark rhs) [private]

Suppress default.


Member Function Documentation

StatusCode DaqBenchmark::initialize ( ) [virtual]

Initializes this module.

Definition at line 130 of file DaqBenchmark.cc.

{
    StatusCode sc = service("DetailsFromRecordSvc",
                            m_daqDetailsSvc,
                            true);
    if (sc.isFailure()) {
        error() << "Failed to get DaqDetailsSvc" << endreq;
        return sc;
    }
    sc = service("StatisticsSvc",
                 m_statsSvc,
                 true);
    if (sc.isFailure()) {
        error() << "Failed to get StatisticsSvc" << endreq;
        return sc;
    }
    m_beginTime = time(0);
    return sc;
}
StatusCode DaqBenchmark::finalize ( ) [virtual]

Finalizes this module.

Definition at line 150 of file DaqBenchmark.cc.

{
    if (m_lastEventTime != m_firstEventTime) {
        time_t now = time(0);
        const double moduleDelta = difftime(now,
                                            m_beginTime);
        const double eventDelta = difftime(m_lastEventTime,
                                           m_firstEventTime);
        info() << "Benchmark factor for this job was " << std::setprecision(2) << (moduleDelta/ eventDelta) << "." << endreq;
        info() << "Analysis byte rate was " << std::setprecision(2) << (m_payloadLength / (moduleDelta * 1024U * 1024U)) << " MB/s." << endreq;
        info() << "Data taking event rate was " << std::setprecision(4) << ((m_eventCount - 1) / eventDelta) << " Hz." << endreq;
        info() << "Analysis event rate was " << std::setprecision(4) << ((m_eventCount - 1) / moduleDelta) << " Hz." << endreq;
    }

    if( m_statsSvc ) {
        m_statsSvc->release();
    }
    if( m_daqDetailsSvc ) {
        m_daqDetailsSvc->release();
    }
    return StatusCode::SUCCESS;
}
StatusCode DaqBenchmark::execute ( ) [virtual]

Called for each event.

Definition at line 173 of file DaqBenchmark.cc.

                                 {
    const ServiceMode serviceMode;

    if (m_daqDetailsSvc->hasRunDetails(serviceMode)) {
        const DaqRunDetails& runDetails = m_daqDetailsSvc->runDetails(serviceMode);
        const unsigned int run = runDetails.runNumber();
        if (m_lastRun != run) {
            info() << "Examining run " << run << endreq;
            m_lastRun = run;
            m_lastFile = 0;
        }
    }

    if (m_daqDetailsSvc->hasFileDetails(serviceMode)) {
        const DaqFileDetails& fileDetails = m_daqDetailsSvc->fileDetails(serviceMode);
        const unsigned int file = fileDetails.fileNumber();
        if (m_lastFile != file) {
            info() << "Examining file " << file << endreq;
            info() << "  This originated from the file \"" << fileDetails.fileName() << "\"" << endreq;
            m_lastFile = file;
            const int finished = m_daqDetailsSvc->calibDetailsCount(serviceMode);
            info() << "This file contains " << finished << " calibration settings" << endreq;
            for (int calib = 0;
                 finished != calib;
                 ++ calib) {
              const DaqCalibDetails& calibDetails = m_daqDetailsSvc->calibDetails(calib,
                                                                                  serviceMode);
              info() << "  For calibration record number " << calib << endreq;
              info() << "    The detector ID is " << DetectorId::AsString(calibDetails.detectorId());
              info() << ", and the AD Number is " << calibDetails.adNumber().asString() << endreq;
            }
        }
    }

    const ReadoutHeader* readoutHeader = get<ReadoutHeader>("/Event/Readout/ReadoutHeader");
    if (0 == readoutHeader) {
        error() << "Failed to get readout header." << endreq;
        return StatusCode::FAILURE;
    }

    if (m_useDaqFormat) {
        StatusCode sc = handleDaqFormat(*readoutHeader);
        if (sc.isFailure()) {
            return sc;
        }
    }
    if (m_useDaqEvent) {
        StatusCode sc = handleDaqEvent(*readoutHeader);
        if (sc.isFailure()) {
            return sc;
        }
    }
    if (m_useReadoutEvent) {
        StatusCode sc = handleReadoutEvent(*readoutHeader);
        if (sc.isFailure()) {
            return sc;
        }
    }
    ++m_eventCount;
    if (0 == (m_eventCount % 1000)) {
        info() << "Processed " << m_eventCount << " events" << endreq;
    }
    return StatusCode::SUCCESS;
}
DaqBenchmark& DaqBenchmark::operator= ( DaqBenchmark rhs) [private]

Suppress default.

TH1F ** DaqBenchmark::getSlotLowGainHistograms ( const unsigned int  slot) [private]

Returns the High Range ADC histograms for the supplied slot.

Definition at line 238 of file DaqBenchmark.cc.

TH1F * DaqBenchmark::getLowGainHistogram ( TH1F **  slotLowGainHistograms,
const unsigned int  slot,
const unsigned int  channelNumber 
) [private]

Returns the selected histograms from the set supplied.

Definition at line 310 of file DaqBenchmark.cc.

                                                                            {
    TH1F* result = slotLowGainHistograms[channelNumber];
    if (0 == result) {
        const string name = getName("Low Gain ADC",
                                    slot,
                                    channelNumber);
        result = new TH1F(name.c_str(),
                          "ADC, low gain",
                          4096,
                          0,
                          4096);
        slotLowGainHistograms[channelNumber] = result;
        m_statsSvc->put(getPath(slot,
                                channelNumber,
                                name.c_str()), 
                        result);
    }
    return result;
}
TH1F ** DaqBenchmark::getSlotHighGainHistograms ( const unsigned int  slot) [private]

Returns the High Range ADC histograms for the supplied slot.

Definition at line 243 of file DaqBenchmark.cc.

TH1F * DaqBenchmark::getHighGainHistogram ( TH1F **  slotHighGainHistograms,
const unsigned int  slot,
const unsigned int  channelNumber 
) [private]

Returns the selected histograms from the set supplied.

Definition at line 332 of file DaqBenchmark.cc.

                                                                           {
    TH1F* result = slotHighGainHistograms[channelNumber];
    if (0 == result) {
        const string name = getName("High Gain ADC",
                                    slot,
                                    channelNumber);
        result = new TH1F(name.c_str(),
                          "ADC, high gain",
                          4096,
                          0,
                          4096);
        slotHighGainHistograms[channelNumber] = result;
        m_statsSvc->put(getPath(slot,
                                channelNumber,
                                name.c_str()), 
                        result);
    }
    return result;
}
TH1F ** DaqBenchmark::getSlotTdcHistograms ( const unsigned int  slot) [private]

Returns the TDC histograms for the supplied slot.

Definition at line 248 of file DaqBenchmark.cc.

TH1F * DaqBenchmark::getTdcHistogram ( TH1F **  slotTdcHistograms,
const unsigned int  slot,
const unsigned int  channelNumber 
) [private]

Returns the selected histogram from the set supplied.

Definition at line 354 of file DaqBenchmark.cc.

                                                                      {
    TH1F* result = slotTdcHistograms[channelNumber];
    if (0 == result) {
        const string name = getName("TDC",
                                    slot,
                                    channelNumber);
        result = new TH1F(name.c_str(),
                          "TDC",
                          1000,
                          300,
                          1300);
        slotTdcHistograms[channelNumber] = result;
        m_statsSvc->put(getPath(slot,
                                channelNumber,
                                name.c_str()), 
                        result);
    }
    return result;
}
TH1F ** DaqBenchmark::getSlotHistogram ( TH1F ***  histograms,
const unsigned int  slot 
) [private]

Returns the selected sub-set of histograms from the specified set.

Definition at line 253 of file DaqBenchmark.cc.

                                                               {
    TH1F** result = histograms[slot];
    if (0 == result) {
        result = new TH1F*[kMaxFeeChannelCount];
        histograms[slot] = result;
        for (unsigned int channel = 0;
             channel != kMaxFeeChannelCount;
             ++channel) {
            result[channel] = 0;
        }
    }
    return result;
}
TH1F ** DaqBenchmark::getSlotFadcHistograms ( const unsigned int  slot) [private]

Returns the FADC histograms for the supplied slot.

Definition at line 268 of file DaqBenchmark.cc.

                                                                  {
    return getSlotHistogram(m_fadcHistograms,
                            slot);
}
TH1F * DaqBenchmark::getFadcHistogram ( TH1F **  slotFadcHistograms,
const unsigned int  slot,
const unsigned int  channelNumber 
) [private]

Returns the selected histogram from the set supplied.

Definition at line 376 of file DaqBenchmark.cc.

                                                                       {
    TH1F* result = slotFadcHistograms[channelNumber];
    if (0 == result) {
        const string name = getName("FADC",
                                    slot,
                                    channelNumber);
        result = new TH1F(name.c_str(),
                          "FADC",
                          128,
                          0,
                          128);
        slotFadcHistograms[channelNumber] = result;
        m_statsSvc->put(getPath(slot,
                                channelNumber,
                                name.c_str()), 
                        result);
    }
    return result;
}
TH2F ** DaqBenchmark::getSlotHistogram ( TH2F ***  histograms,
const unsigned int  slot 
) [private]

Returns the selected sub-set of histograms from the specified set.

Definition at line 273 of file DaqBenchmark.cc.

                                                               {
    TH2F** result = histograms[slot];
    if (0 == result) {
        result = new TH2F*[kMaxFeeChannelCount];
        histograms[slot] = result;
        for (unsigned int channel = 0;
             channel != kMaxFeeChannelCount;
             ++channel) {
            result[channel] = 0;
        }
    }
    return result;
}
StatusCode DaqBenchmark::handleDaqFormat ( const DayaBay::ReadoutHeader readoutHeader) [private]

Handles the benchmark code using the DaqFormat project.

Definition at line 416 of file DaqBenchmark.cc.

                                                                           {
    const EventReadout* event = 0;
    const DaqCrate* daqCrate = readoutHeader.daqCrate();
    if (0 == daqCrate) {
        const Readout* readout = readoutHeader.readout();
        if (0 == readout) {
            error() << "Failed to get DAQ readout or readout from header" << endreq;
            return StatusCode::FAILURE;
        }
        event = readout->eventReadout();
        if (0 == event) {
            error() << "Failed to get event readout from readout" << endreq;
            return StatusCode::FAILURE;
        }
    } else {
        event = &(daqCrate->eventReadout());
    }

    
    m_lastEventTime = getEventTime(*event);
    if (0 == m_firstEventTime) {
        m_firstEventTime = m_lastEventTime;
    } else {
      //checkDeltaTime(*event);
    }
    handleEvent(*event);
    m_payloadLength += event->header().totalSize() * kBytesInInt;
    return StatusCode::SUCCESS;
 }
void DaqBenchmark::handleEvent ( const DybDaq::EventReadout event) [private]

Handles the EventReadout once it has been extracted from the TES.

Definition at line 446 of file DaqBenchmark.cc.

                                                              {
    const EventReadout::RomFragmentPtrList& fragments = event.romFragments();
    for (EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
         fragment != fragments.end();
         ++fragment) {
        handleFragment(*(*fragment));
    }
}
void DaqBenchmark::handleFragment ( const DybDaq::RomFragment fragment) [private]

Handles a RomFragment.

Definition at line 455 of file DaqBenchmark.cc.

                                                             {
    const RomHeader& header = fragment.header();
    const unsigned int slot = header.slot();
    const unsigned int kFeeModuleType = header.eventTraits().moduleType(EventTraits::kFeeModule);
    const unsigned int kFadcModuleType = header.eventTraits().moduleType(EventTraits::kFadcModule);
    if (kFeeModuleType == header.moduleType()) {
        handleFee(dynamic_cast<const FeeReadout&>(fragment.unwrappedData()),
                  slot);
    } else if (kFadcModuleType == header.moduleType()) {
        handleFadc(dynamic_cast<const FadcReadout&>(fragment.unwrappedData()),
                   slot);
    }
}
void DaqBenchmark::handleFee ( const DybDaq::FeeReadout readout,
const unsigned int  slot 
) [private]

Handled the readout of FEE board.

Definition at line 469 of file DaqBenchmark.cc.

                                                      {
    TH1F** slotLowGainHistograms = getSlotLowGainHistograms(slot);
    TH1F** slotHighGainHistograms = getSlotHighGainHistograms(slot);
    TH1F** slotTdcHistograms = getSlotTdcHistograms(slot);

    const FeeReadout::FeeHitPtrList& hits = readout.feeHits();
    for (FeeReadout::FeeHitPtrList::const_iterator hitPtr = hits.begin();
         hitPtr != hits.end();
         ++hitPtr) {
        const FeeHit& hit = *(*hitPtr);
        const unsigned int channelNumber = hit.channelId() + 1;
        TH1F* rangeHistogram = 0;
        if (hit.isHighRangeAdc()) {
            rangeHistogram = getLowGainHistogram(slotLowGainHistograms,
                                                   slot,
                                                   channelNumber);
        } else {
            rangeHistogram = getHighGainHistogram(slotHighGainHistograms,
                                                  slot,
                                                  channelNumber);
        }
        rangeHistogram->Fill(hit.adc());
        TH1F* tdcHistogram = getTdcHistogram(slotTdcHistograms,
                                             slot,
                                             channelNumber);
        tdcHistogram->Fill(hit.tdc());
    }
}
void DaqBenchmark::handleFadc ( const DybDaq::FadcReadout readout,
const unsigned int  slot 
) [private]

Handle the readout of an FADC board.

Definition at line 499 of file DaqBenchmark.cc.

                                                       {
    TH1F** slotFadcHistograms = getSlotFadcHistograms(slot);
    const DaqTraits& traits = readout.daqTraits();
    bool byteData = (2 > traits.majorVersion() && 6 > traits.minorVersion());
    const FadcReadout::FadcDataPtrList& dataList = readout.fadcData();
    unsigned int bin = 0;
    unsigned int lastChannel = 0;
    TH1F* fadcHistogram = 0;
    for (FadcReadout::FadcDataPtrList::const_iterator dataPtr = dataList.begin();
         dataPtr != dataList.end();
         ++dataPtr) {
        const FadcData& data = *(*dataPtr);
        if (byteData) {
            const unsigned int channelNumber = data.channelId();
            if (lastChannel != channelNumber) {
                bin = 0;
                lastChannel = channelNumber;
            }
            fadcHistogram = getFadcHistogram(slotFadcHistograms,
                                             slot,
                                             channelNumber);
            fadcHistogram->Fill(bin,
                                data.highDataByte());
            fadcHistogram->Fill(++bin,
                                data.middleDataByte());
            fadcHistogram->Fill(++bin,
                                data.lowDataByte());
            ++bin;
        } else {
            if ((*dataPtr)->isChannelHead()) {
                const unsigned int channelNumber = (*dataPtr)->channelId();
                fadcHistogram = getFadcHistogram(slotFadcHistograms,
                                                 slot,
                                                 channelNumber);
                bin = 0;
            } else if ((*dataPtr)->isChannelFoot()) {
                // Simple sanity check.
                if (0 != bin && 120 != bin) {
                    info() << "bin is " << bin << endreq;
                }
                const unsigned int channelNumber = (*dataPtr)->channelId();
                TH1F* histogram = getFadcHistogram(slotFadcHistograms,
                                                   slot,
                                                   channelNumber);
                if ( histogram != fadcHistogram) {
                    error() << "mismatch in FADC channel number" << endreq; 
                    return;
                }
            } else {
                fadcHistogram->Fill(bin,
                                    data.sample1());
                fadcHistogram->Fill(++bin,
                                    data.sample2());
                fadcHistogram->Fill(++bin,
                                    data.sample3());
                fadcHistogram->Fill(++bin,
                                    data.sample4());
                ++bin;
            }
        }
    }
}
StatusCode DaqBenchmark::handleReadoutEvent ( const DayaBay::ReadoutHeader readoutHeader) [private]

Handles the benchmark code using the ReadoutEvent project.

Definition at line 577 of file DaqBenchmark.cc.

                                                                              {
    const Readout* readout = readoutHeader.readout();
    if (0 == readout) {
        error() << "Failed to get readout from header" << endreq;
        return StatusCode::FAILURE;
    }

    m_lastEventTime = getEventTime(readout->triggerTime());
    if (0 == m_firstEventTime) {
        m_firstEventTime = m_lastEventTime;
        m_specificTime = readout->triggerTime().GetSeconds();
    } else {
        checkDeltaTime(readout->triggerTime());
    }
    const ReadoutPmtCrate* pmtReadout = dynamic_cast<const ReadoutPmtCrate*>(readout);
    if (0 != pmtReadout) {
        handleEvent(*pmtReadout);
    }
    return StatusCode::SUCCESS;
 }
void DaqBenchmark::handleEvent ( const DayaBay::ReadoutPmtCrate create) [private]

Handles the ReadoutPmtCrate once it has been extracted from the TES.

Definition at line 598 of file DaqBenchmark.cc.

                                                                  {
    const std::vector<DayaBay::FeeChannelId> channels = const_cast<ReadoutPmtCrate&>(crate).channels();
    std::vector<DayaBay::FeeChannelId>::const_iterator finished = channels.end();
    for (std::vector<DayaBay::FeeChannelId>::const_iterator channel = channels.begin();
         channel != finished;
         ++channel) {
        handleChannel(const_cast<ReadoutPmtCrate&>(crate).channel(*channel));
    }
}
void DaqBenchmark::handleChannel ( const DayaBay::ReadoutPmtChannel channel) [private]

Handles a ReadoutPmtChannel.

Definition at line 608 of file DaqBenchmark.cc.

                                                                 {
    const FeeChannelId& feeChannelId = channel.channelId();
    const unsigned int slot = feeChannelId.board();
    TH1F** slotLowGainHistograms = getSlotLowGainHistograms(slot);
    TH1F** slotHighGainHistograms = getSlotHighGainHistograms(slot);
    TH1F** slotTdcHistograms = getSlotTdcHistograms(slot);
  
    const unsigned int channelNumber = feeChannelId.connector();
    TH1F* lowGainHistogram = getLowGainHistogram(slotLowGainHistograms,
                                                 slot,
                                                 channelNumber);
    TH1F* highGainHistogram = getHighGainHistogram(slotHighGainHistograms,
                                                   slot,
                                                   channelNumber);
    unsigned int hit = 0;
    const std::vector<int>& charges = channel.adc();
    const std::vector<int>::const_iterator finishedCharges = charges.end();
    for(std::vector<int>::const_iterator charge = charges.begin();
        finishedCharges != charge;
        ++charge) {
        if (channel.adcRange(hit) == DayaBay::FeeGain::kHigh) {
            highGainHistogram->Fill(*charge);
        } else {
            lowGainHistogram->Fill(*charge);
        }
        ++hit;
    }

    TH1F* tdcHistogram = getTdcHistogram(slotTdcHistograms,
                                         slot,
                                         channelNumber);
    const std::vector<int>& times = channel.tdc();
    const std::vector<int>::const_iterator finishedTimes = times.end();
    for(std::vector<int>::const_iterator time = times.begin();
        finishedTimes != time;
        ++time) {
        tdcHistogram->Fill(*time);
    }
}
StatusCode DaqBenchmark::handleDaqEvent ( const DayaBay::ReadoutHeader readoutHeader) [private]

Handles the benchmark code using the DaqEvent project.

Definition at line 648 of file DaqBenchmark.cc.

                                                                          {
    const DaqCrate* daqCrate = readoutHeader.daqCrate();
    if (0 == daqCrate) {
        error() << "Failed to get readout from header" << endreq;
        return StatusCode::FAILURE;
    }

    // RPC crate can have zero RTM readouts.
    if (!daqCrate->hasTriggers()) {
      return StatusCode::SUCCESS;
    }

    m_lastEventTime = getEventTime(daqCrate->triggerTime());
    if (0 == m_firstEventTime) {
        m_firstEventTime = m_lastEventTime;
        m_specificTime = daqCrate->triggerTime().GetSeconds();
    } else {
        checkDeltaTime(daqCrate->triggerTime());
    }

    DayaBay::Trigger::TriggerType_t triggerType = daqCrate->triggerType();

    const DaqPmtCrate* pmtCrate = daqCrate->asPmtCrate();
    if (0 != pmtCrate) {
        handleEvent(*pmtCrate);
        // TODO can this simple exercising of trigger type into histogramming.
        if (DayaBay::Trigger::kUnknown == (triggerType | DayaBay::Trigger::kUnknown)) {
          error() << "Unknown trigger detected in PMT crate!" << endreq;
        }
    }
    return StatusCode::SUCCESS;
 }
void DaqBenchmark::handleEvent ( const DayaBay::DaqPmtCrate crate) [private]

Handles DaqPmtCrate.

Definition at line 681 of file DaqBenchmark.cc.

                                                              {
    {
        const DaqLtb& triggerBoard = crate.localTriggerBoard();
        const DaqLtb::LtbFramePtrList& frames = triggerBoard.frames();
        const DaqLtb::LtbFramePtrList::const_iterator finished = frames.end();
        for(DaqLtb::LtbFramePtrList::const_iterator frame = frames.begin();
            finished != frame;
            ++frame) {
            handleFrame(*(*frame));
        }
    }

    {
        const DaqPmtCrate::PmtChannelPtrList& channels = crate.pmtChannelReadouts();
        const DaqPmtCrate::PmtChannelPtrList::const_iterator finished = channels.end();
        for (DaqPmtCrate::PmtChannelPtrList::const_iterator channel = channels.begin();
             channel != finished;
             ++channel) {
            handleChannel(*(*channel));
        }
    }

    {
        const DaqPmtCrate::FadcChannelPtrList& channels = crate.fadcChannelReadouts();
        const DaqPmtCrate::FadcChannelPtrList::const_iterator finished = channels.end();
        for (DaqPmtCrate::FadcChannelPtrList::const_iterator channel = channels.begin();
             channel != finished;
             ++channel) {
            handleChannel(*(*channel));
        }
    }
}
void DaqBenchmark::handleFrame ( const DayaBay::DaqLtbFrame frame) [private]

Handles a DaqLtbFrame.

Definition at line 714 of file DaqBenchmark.cc.

                                                   {
}
void DaqBenchmark::handleChannel ( const DayaBay::DaqPmtChannel channel) [private]

Handles a DaqPmtChannel.

Definition at line 717 of file DaqBenchmark.cc.

                                                             {
    const FeeChannelId& feeChannelId = channel.channelId();
    const unsigned int slot = feeChannelId.board();
    TH1F** slotLowGainHistograms = getSlotLowGainHistograms(slot);
    TH1F** slotHighGainHistograms = getSlotHighGainHistograms(slot);
    TH1F** slotTdcHistograms = getSlotTdcHistograms(slot);
    
    const unsigned int channelNumber = feeChannelId.connector();
    TH1F* lowGainHistogram = getLowGainHistogram(slotLowGainHistograms,
                                           slot,
                                           channelNumber);
    TH1F* highGainHistogram = getHighGainHistogram(slotHighGainHistograms,
                                                   slot,
                                                   channelNumber);
    TH1F* tdcHistogram = getTdcHistogram(slotTdcHistograms,
                                         slot,
                                         channelNumber);

    const unsigned int finished = channel.hitCount();
    for(unsigned int hit = 0;
        hit != finished;
        ++hit) {
        if (channel.isHighGainAdc(hit)) {
            highGainHistogram->Fill(channel.adc(hit));
        } else {
            lowGainHistogram->Fill(channel.adc(hit));
        }
        tdcHistogram->Fill(channel.tdc(hit));
    }
}
void DaqBenchmark::handleChannel ( const DayaBay::DaqFadcChannel channel) [private]

Handles a DaqFadcChannel.

Definition at line 748 of file DaqBenchmark.cc.

                                                              {
    const FadcChannelId& fadcChannelId = channel.channelId();
    const unsigned int slot = fadcChannelId.board();
    TH1F** slotFadcHistograms = getSlotFadcHistograms(slot);
    
    const unsigned int channelNumber = fadcChannelId.connector();
    TH1F* fadcHistogram = getFadcHistogram(slotFadcHistograms,
                                           slot,
                                           channelNumber);

    const DaqFadcChannel::FadcSamples& samples = channel.samples();
    unsigned int bin = 0;
    const DaqFadcChannel::FadcSamples::const_iterator finished = samples.end();
    for (DaqFadcChannel::FadcSamples::const_iterator sample = samples.begin();
         finished != sample;
         ++sample) {
        fadcHistogram->Fill(bin,
                            *sample);
        ++bin;
    }
}
void DaqBenchmark::checkDeltaTime ( const TimeStamp time) const [private]

Checks that the delta between times in positive.

Definition at line 568 of file DaqBenchmark.cc.

                                                             {
    const double previousSpecificTime = m_specificTime;
    m_specificTime = time.GetSeconds();
    const double delta = m_specificTime - previousSpecificTime;
    if (0.0 > delta) {
      warning() << "At event " << m_eventCount + 1 << ", there is a time difference of " << delta << " second between events." << endreq;
    }
}

Member Data Documentation

The DAQ Details service used by this module.

Definition at line 225 of file DaqBenchmark.h.

IStatisticsSvc* DaqBenchmark::m_statsSvc [private]

The Statistics service used by this module.

Definition at line 230 of file DaqBenchmark.h.

unsigned int DaqBenchmark::m_lastRun [private]

The last run seen by this instance.

Definition at line 235 of file DaqBenchmark.h.

unsigned int DaqBenchmark::m_lastFile [private]

The last file seen by this instance.

Definition at line 240 of file DaqBenchmark.h.

The set of historgrams for the FEE high range ADCs.

Definition at line 245 of file DaqBenchmark.h.

The set of historgrams for the FEE low range ADCs.

Definition at line 250 of file DaqBenchmark.h.

The set of historgrams for the FEE TDCs.

Definition at line 255 of file DaqBenchmark.h.

TH1F*** DaqBenchmark::m_fadcHistograms [private]

The set of historgrams for the FADCs.

Definition at line 260 of file DaqBenchmark.h.

unsigned long DaqBenchmark::m_eventCount [private]

The number of event seen so far by this module.

Definition at line 265 of file DaqBenchmark.h.

unsigned long DaqBenchmark::m_payloadLength [private]

The number of bytes seen so far by this module.

Definition at line 270 of file DaqBenchmark.h.

time_t DaqBenchmark::m_beginTime [private]

The time this module was initialized.

Definition at line 275 of file DaqBenchmark.h.

The trigger time of the first event seen by this module.

Definition at line 280 of file DaqBenchmark.h.

The trigger time of the last event seen by this module.

Definition at line 285 of file DaqBenchmark.h.

double DaqBenchmark::m_specificTime [mutable, private]

The last trigger time seen, to an accuracy of nanoseconds.

Definition at line 290 of file DaqBenchmark.h.

True if the DaqFormat products should be used in the benchmark.

Definition at line 295 of file DaqBenchmark.h.

True if the DaqEvent products should be used in the benchmark.

Definition at line 300 of file DaqBenchmark.h.

True if the ReadoutEvent products should be used in the benchmark.

Definition at line 305 of file DaqBenchmark.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:15:32 for DaqFormatModules by doxygen 1.7.4