/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 Attributes
ADLEDTag Class Reference

#include <ADLEDTag.h>

Collaboration diagram for ADLEDTag:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ADLEDTag (const std::string &name, ISvcLocator *svcloc)
 Constructor has to be in this form.
virtual ~ADLEDTag ()
StatusCode initialize ()
 Three mandatory member functions of any algorithm.
StatusCode execute ()
StatusCode finalize ()

Private Attributes

IJobInfoSvcm_jobInfoSvc
std::string m_readoutHeaderLocation
std::string m_calibStatsLocation
std::string m_ADLEDLocation
int m_tagged

Detailed Description

Definition at line 22 of file ADLEDTag.h.


Constructor & Destructor Documentation

ADLEDTag::ADLEDTag ( const std::string &  name,
ISvcLocator *  svcloc 
)

Constructor has to be in this form.

Definition at line 12 of file ADLEDTag.cc.

: GaudiAlgorithm(name, svcloc)
{
  declareProperty("ReadoutHeaderLocation", m_readoutHeaderLocation="/Event/Readout/ReadoutHeader",
                  "Location of the ReadoutHeader");
  declareProperty("CalibStatsLocation", m_calibStatsLocation="/Event/Data/CalibStats",
                  "Location of the CalibStats User data");
  declareProperty("ADLEDLocation", m_ADLEDLocation="/Event/Tag/Calib/ADLED",
                  "Location of the ADLED Tag");
}
ADLEDTag::~ADLEDTag ( ) [virtual]

Definition at line 23 of file ADLEDTag.cc.

{
}

Member Function Documentation

StatusCode ADLEDTag::initialize ( )

Three mandatory member functions of any algorithm.

Definition at line 27 of file ADLEDTag.cc.

{
  debug() << "initialize()" << endreq;

  m_jobInfoSvc = svc<IJobInfoSvc>("JobInfoSvc",true);
  if(!m_jobInfoSvc) {
    error() << "Failed to initialize JobInfoSvc" << endreq;
    return StatusCode::FAILURE;
  }
  m_tagged = 0;

  return StatusCode::SUCCESS;
}
StatusCode ADLEDTag::execute ( )

Definition at line 41 of file ADLEDTag.cc.

{
  debug() << "execute() ______________________________ start" << endreq;

  const DayaBay::ReadoutHeader *readoutHdr = 0;  // DayaBay::CLID_CalibReadoutHeader
  DayaBay::UserDataHeader *calibStatsHdr = 0;  //
  
  //Get Raw Readout Header
  if ( !exist<DayaBay::ReadoutHeader>(evtSvc(), m_readoutHeaderLocation)) {
    warning() << "Cannot find header at " << m_readoutHeaderLocation << endreq;
    return StatusCode::FAILURE;
  } else {
    readoutHdr = get<DayaBay::ReadoutHeader>(m_readoutHeaderLocation);
  } 
       
  //Get CalibStats Header
  if (!exist<DayaBay::UserDataHeader>(evtSvc(), m_calibStatsLocation)) {
    warning() << "Cannot find header at " << m_calibStatsLocation << endreq;
    return StatusCode::FAILURE;
  } else {
    calibStatsHdr = get<DayaBay::UserDataHeader>(m_calibStatsLocation);
  }

  DetectorId::DetectorId_t detectorId = readoutHdr->context().GetDetId(); 
  //ingore RPC readouts
  if(detectorId == DetectorId::kRPC) return StatusCode::SUCCESS;
  //info() << "detectorId = " << detectorId << endreq;

  //const DayaBay::Readout * readout = readoutHeader->readout();
  const DayaBay::DaqPmtCrate * readout = readoutHdr->daqCrate()->asPmtCrate();
//readoutHdr.daqCrate().asPmtCrate()
  if(readout == 0){
    warning() << "Cannot find readout from readout header" << endreq;
    return StatusCode::FAILURE;
  }

  DayaBay::Trigger::TriggerType_t triggerType = readout->triggerType();
  //info() << "triggerType = " << std::hex << "0x" << triggerType << endreq;
  
  // Only consider AD triggers
  if (detectorId == DetectorId::kAD1 || detectorId == DetectorId::kAD2
   || detectorId == DetectorId::kAD3 || detectorId == DetectorId::kAD4) {
      // Skip if not cross-in (aka calib) trigger
      if ((triggerType & DayaBay::Trigger::kCalib) == DayaBay::Trigger::kNone){
          return StatusCode::SUCCESS;
      }
  }

  // Tag as ADLED event
  DayaBay::HeaderObject *header = new DayaBay::HeaderObject();
  std::vector<const DayaBay::IHeader*> inputHeaders;
  inputHeaders.push_back(readoutHdr);
  inputHeaders.push_back(calibStatsHdr);
  header->setInputHeaders(inputHeaders);
  header->setExecNumber(readoutHdr->execNumber());
  header->setContext(readoutHdr->context());
  header->setEarliest(readoutHdr->earliest());
  header->setLatest(readoutHdr->latest());
  m_tagged++;

  const DayaBay::JobId &m_currentJobId = m_jobInfoSvc->currentJobInfo()->jobId();
  header->setJobId(m_currentJobId);

  put(header, m_ADLEDLocation);

  debug() << "execute() ______________________________ end" << endreq;
  return StatusCode::SUCCESS;
}
StatusCode ADLEDTag::finalize ( )

Definition at line 110 of file ADLEDTag.cc.

{
  debug() << "finalize()" << endreq;
  switch(m_tagged){
    case 0: info () << "No trigger was tagged as ADLED event." << endreq; break;
    case 1: info () << "Only one trigger was tagged as ADLED event." << endreq; break;
    default: info () << m_tagged << " triggers were tagged as ADLED events." << endreq;
  }
  return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 35 of file ADLEDTag.h.

std::string ADLEDTag::m_readoutHeaderLocation [private]

Definition at line 36 of file ADLEDTag.h.

std::string ADLEDTag::m_calibStatsLocation [private]

Definition at line 37 of file ADLEDTag.h.

std::string ADLEDTag::m_ADLEDLocation [private]

Definition at line 38 of file ADLEDTag.h.

int ADLEDTag::m_tagged [private]

Definition at line 39 of file ADLEDTag.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:10:08 for CalibrationTagging by doxygen 1.7.4