/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 | Protected Member Functions | Protected Attributes | Private Attributes
SimReadoutBufferAlg Class Reference

#include <SimReadoutBufferAlg.h>

Inheritance diagram for SimReadoutBufferAlg:
Inheritance graph
[legend]
Collaboration diagram for SimReadoutBufferAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SimReadoutBufferAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~SimReadoutBufferAlg ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
 Most of this code was lifted from ROsSequencerAlg.
virtual StatusCode finalize ()
DayaBay::ReadoutHeaderGetCurrentHeaderObject () const
virtual StatusCode sysInitialize ()
virtual StatusCode sysExecute ()
virtual StatusCode preExecute ()
virtual StatusCode postExecute ()
virtual StatusCode sysFinalize ()
IDataProviderSvc * arcSvc () const
void putTES (DataObject *obj, std::string location) const
TYPE * getTES (std::string location) const
TYPE * getAES (std::string location, int index) const
std::vector< DataObject * > getAEScollection (std::string location) const
int getExecNum ()
std::string Location () const

Protected Member Functions

DayaBay::ReadoutHeaderMakeHeaderObject ()
void InitializeHeader (DayaBay::HeaderObject *header)
TYPE * MakeHeader ()
TYPE * MakeHeader (std::vector< const DayaBay::IHeader * > &inputHeaders)
TYPE * MakeHeader (const DayaBay::IHeader *referenceHeader)
void AppendInputHeader (const DayaBay::HeaderObject *header) const

Protected Attributes

DayaBay::HeaderObjectm_headerObject
bool m_pullMode
std::string m_location

Private Attributes

std::string m_simRoLocation
std::string m_bufferSvcName
IReadoutBufferSvcm_bufferSvc

Detailed Description

Definition at line 21 of file SimReadoutBufferAlg.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file SimReadoutBufferAlg.cc.

                 : DybAlgorithm<DayaBay::ReadoutHeader>(name,pSvcLocator),
                   m_bufferSvc(0)
{
 
    declareProperty("SimReadoutLocation",
                     m_simRoLocation=DayaBay::SimReadoutHeaderLocation::Default,
                    "Location in the TES where the input SimReadoutHeader is to be found.");
    declareProperty("BufferService",
                    m_bufferSvcName="ReadoutBufferSvc",
                    "Name of the ReadoutBufferSvc to use");
}
SimReadoutBufferAlg::~SimReadoutBufferAlg ( ) [virtual]

Definition at line 25 of file SimReadoutBufferAlg.cc.

{    
}

Member Function Documentation

StatusCode SimReadoutBufferAlg::initialize ( ) [virtual]

Definition at line 29 of file SimReadoutBufferAlg.cc.

{
    StatusCode sc = this->GaudiAlgorithm::initialize();
    if( sc.isFailure() ){
        error() << "could not initialize baseclass" << endreq;
        return sc;
    }
    
    m_bufferSvc = svc<IReadoutBufferSvc>(m_bufferSvcName,true);
    
    return sc;
}
StatusCode SimReadoutBufferAlg::execute ( ) [virtual]

Most of this code was lifted from ROsSequencerAlg.

Definition at line 44 of file SimReadoutBufferAlg.cc.

{
    // get or create readout header object
    info() << " execute()" << endreq;
    verbose() << " Entering execute() " << endreq;
    DayaBay::ReadoutHeader* roHeader = MakeHeaderObject();
    
    if( m_bufferSvc->isEmpty() )
    {
         debug() << "Filling Buffer Service" << endreq;

        if( exist<DayaBay::SimReadoutHeader>( evtSvc(), m_simRoLocation) )    
        {
            debug() << "retrieving a SimReadoutHeader From: "
                << m_simRoLocation << endreq;
            DayaBay::SimReadoutHeader* simReadoutHeader 
                = getTES<DayaBay::SimReadoutHeader>(m_simRoLocation);
            m_bufferSvc->setSimReadoutHeader(simReadoutHeader);
        }else
        {
            warning() << "Location is empty \"" 
                       << m_simRoLocation << "\"" << endreq;
        }
    }
    
    roHeader->setEarliest( m_bufferSvc->earliest() );
    roHeader->setLatest( m_bufferSvc->latest() );
    Context context = m_bufferSvc->context();
    
    if( m_bufferSvc->hasMoreReadouts() )
    {
        const DayaBay::SimReadout* simReadout = m_bufferSvc->nextReadout();
        debug() << "Got SimReadouts: " << simReadout <<  endreq;
        
        DayaBay::Detector det(simReadout->readout()->detector());
        context.SetSite(det.site());
        context.SetDetId(det.detectorId());
        
        bool isPmtBased = det.detectorId() == DetectorId::kAD1
                       || det.detectorId() == DetectorId::kAD2
                       || det.detectorId() == DetectorId::kAD3
                       || det.detectorId() == DetectorId::kAD4
                       || det.detectorId() == DetectorId::kIWS
                       || det.detectorId() == DetectorId::kOWS ;
        
        bool isRpcBased = det.detectorId() == DetectorId::kRPC;
        
    // check if its a pmt based detector and handle if it is

        if(isPmtBased)
        {
          const DayaBay::ReadoutPmtCrate* pmtReadout 
               = dynamic_cast<const DayaBay::ReadoutPmtCrate*>(simReadout->readout());
          if(!pmtReadout)
          {
                    error() << "Readout from detector " << det 
                                << " is not a PMT Crate readout." << endreq;
                    return StatusCode::FAILURE;
          }
        
          DayaBay::ReadoutPmtCrate* readout 
                    = new DayaBay::ReadoutPmtCrate(*pmtReadout);
          
          readout->setHeader(roHeader);
          roHeader->setReadout(readout);
          
   // check if its a RPC based detector and handle if it is
        }else if(isRpcBased)
        {
            const DayaBay::ReadoutRpcCrate* rpcReadout 
                 = dynamic_cast<const DayaBay::ReadoutRpcCrate*>(simReadout->readout());
            if(!rpcReadout){
                error() << "Readout from detector " << det 
                            << " is not an RPC Crate readout." << endreq;
                return StatusCode::FAILURE;
            }
        
            DayaBay::ReadoutRpcCrate* readout 
                    = new DayaBay::ReadoutRpcCrate(*rpcReadout);
            readout->setHeader(roHeader);
            roHeader->setReadout(readout);
        
    // if neither rpc or pmt there is a problem...    
        }else{
                error() << "Unknown detector " << det 
                            << " for readout " << simReadout << endreq;
                return StatusCode::FAILURE;
        }
    }else{
        info() << "No Readouts produced this cycle. Generate an empty readout in DayaBayAD1." << endreq;
          DayaBay::ReadoutPmtCrate* readout 
                    = new DayaBay::ReadoutPmtCrate();
        DayaBay::Detector det;
        det.set(Site::kDayaBay,DetectorId::kAD1);
        readout->setDetector(det);
        readout->setHeader(roHeader);
        roHeader->setReadout(readout);
        context.SetSite(Site::kDayaBay);
        context.SetDetId(DetectorId::kAD1);
    }
    
    roHeader->setContext(context);
    verbose() << " Leaving execute() " << endreq;
    return StatusCode::SUCCESS;   
}
StatusCode SimReadoutBufferAlg::finalize ( ) [virtual]

Definition at line 150 of file SimReadoutBufferAlg.cc.

{
  return this->GaudiAlgorithm::finalize();
}
DayaBay::ReadoutHeader * DybAlgorithm< DayaBay::ReadoutHeader >::GetCurrentHeaderObject ( ) const [inherited]
virtual StatusCode DybAlgorithm< DayaBay::ReadoutHeader >::sysInitialize ( ) [virtual, inherited]

Reimplemented from DybBaseAlg.

virtual StatusCode DybAlgorithm< DayaBay::ReadoutHeader >::sysExecute ( ) [virtual, inherited]

Reimplemented from DybBaseAlg.

virtual StatusCode DybAlgorithm< DayaBay::ReadoutHeader >::preExecute ( ) [virtual, inherited]

Reimplemented from DybBaseAlg.

virtual StatusCode DybAlgorithm< DayaBay::ReadoutHeader >::postExecute ( ) [virtual, inherited]

Reimplemented from DybBaseAlg.

virtual StatusCode DybAlgorithm< DayaBay::ReadoutHeader >::sysFinalize ( ) [virtual, inherited]

Reimplemented from DybBaseAlg.

IDataProviderSvc * DybAlgorithm< DayaBay::ReadoutHeader >::arcSvc ( ) const [inherited]

Reimplemented from DybBaseAlg.

void DybAlgorithm< DayaBay::ReadoutHeader >::putTES ( DataObject *  obj,
std::string  location 
) const [inherited]

Reimplemented from DybBaseAlg.

TYPE * DybAlgorithm< DayaBay::ReadoutHeader >::getTES ( std::string  location) const [inherited]

Reimplemented from DybBaseAlg.

TYPE * DybAlgorithm< DayaBay::ReadoutHeader >::getAES ( std::string  location,
int  index 
) const [inherited]

Reimplemented from DybBaseAlg.

std::vector< DataObject * > DybAlgorithm< DayaBay::ReadoutHeader >::getAEScollection ( std::string  location) const [inherited]

Reimplemented from DybBaseAlg.

int DybAlgorithm< DayaBay::ReadoutHeader >::getExecNum ( ) [inherited]

Reimplemented from DybBaseAlg.

std::string DybAlgorithm< DayaBay::ReadoutHeader >::Location ( ) const [inherited]

Reimplemented from DybBaseAlg.

DayaBay::ReadoutHeader * DybAlgorithm< DayaBay::ReadoutHeader >::MakeHeaderObject ( ) [protected, inherited]
void DybAlgorithm< DayaBay::ReadoutHeader >::InitializeHeader ( DayaBay::HeaderObject header) [protected, inherited]

Reimplemented from DybBaseAlg.

TYPE * DybAlgorithm< DayaBay::ReadoutHeader >::MakeHeader ( ) [protected, inherited]

Reimplemented from DybBaseAlg.

TYPE * DybAlgorithm< DayaBay::ReadoutHeader >::MakeHeader ( std::vector< const DayaBay::IHeader * > &  inputHeaders) [protected, inherited]

Reimplemented from DybBaseAlg.

TYPE * DybAlgorithm< DayaBay::ReadoutHeader >::MakeHeader ( const DayaBay::IHeader referenceHeader) [protected, inherited]

Reimplemented from DybBaseAlg.

void DybAlgorithm< DayaBay::ReadoutHeader >::AppendInputHeader ( const DayaBay::HeaderObject header) const [protected, inherited]

Reimplemented from DybBaseAlg.


Member Data Documentation

std::string SimReadoutBufferAlg::m_simRoLocation [private]

Definition at line 32 of file SimReadoutBufferAlg.h.

std::string SimReadoutBufferAlg::m_bufferSvcName [private]

Definition at line 33 of file SimReadoutBufferAlg.h.

Definition at line 34 of file SimReadoutBufferAlg.h.

Reimplemented from DybBaseAlg.

bool DybAlgorithm< DayaBay::ReadoutHeader >::m_pullMode [protected, inherited]

Reimplemented from DybBaseAlg.

std::string DybAlgorithm< DayaBay::ReadoutHeader >::m_location [protected, inherited]

Reimplemented from DybBaseAlg.


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:14:31 for SimSequencer by doxygen 1.7.4