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

In This Package:

Classes | Public Member Functions | Static Public Member Functions | Private Attributes
ROBufferSvc Class Reference

Dealing with Readouts from all detectors, outputting the earliest one in one "execute()" of the MainAlgorithm. More...

#include <ROBufferSvc.h>

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

List of all members.

Classes

class  Configure

Public Member Functions

 ROBufferSvc (const string &name, ISvcLocator *pSvcLocator)
virtual ~ROBufferSvc ()
virtual StatusCode initialize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppint)
virtual StatusCode setROHeaders (SimReadoutHeader *sroh)
virtual ReadoutHeadergetROHeader ()
virtual deque< MixHeader >
::size_type 
getMBufferSize ()

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Attributes

MsgStream m_log
deque< MixHeaderm_mhBuffer
list __all__ = ['ROBufferSvcConf', 'Configure']

Detailed Description

Dealing with Readouts from all detectors, outputting the earliest one in one "execute()" of the MainAlgorithm.

Zhang YiChun Dec 12 2010 yczhang@ihep.ac.cn

Definition at line 29 of file ROBufferSvc.h.


Constructor & Destructor Documentation

ROBufferSvc::ROBufferSvc ( const string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 10 of file ROBufferSvc.cc.

            :Service(name, pSvcLocator), m_log(msgSvc(), "ROBufferSvc")
{
  m_log<< MSG::INFO<< "Construct:ROBufferSvc()!"<< endreq;
}
ROBufferSvc::~ROBufferSvc ( ) [virtual]

Definition at line 169 of file ROBufferSvc.cc.

{
  m_log<< MSG::INFO<< "MixHeader buffer size: "<< m_mhBuffer.size()<< endreq;
  m_log<< MSG::INFO<< "Destruct:~ROBufferSvc()!"<< endreq;
}

Member Function Documentation

StatusCode ROBufferSvc::initialize ( ) [virtual]

Definition at line 16 of file ROBufferSvc.cc.

{
  StatusCode sc= this->Service::initialize();
  if(sc.isFailure()) 
  { 
    m_log<< MSG::ERROR<< "Error when initializing Service."<< endreq;
    return sc;
  }
   
  m_log<< MSG::INFO<< "ROBufferSvc ininalize()"<< endreq; 

  return StatusCode::SUCCESS;
}
StatusCode ROBufferSvc::queryInterface ( const InterfaceID &  riid,
void **  ppint 
) [virtual]

Definition at line 30 of file ROBufferSvc.cc.

{
  if(IID_IROBufferSvc.versionMatch(riid)) 
  {
    m_log<< MSG::DEBUG<< "queryInterface("<< riid
         << ")-->(IROBufferSvc*)"<< (void*)this<< endreq;
    *ppint = (IROBufferSvc*)this;
  }
  else 
  {
    return Service::queryInterface(riid, ppint);
  }
  addRef();
  return StatusCode::SUCCESS;
}
StatusCode ROBufferSvc::setROHeaders ( SimReadoutHeader sroh) [virtual]

Implements IROBufferSvc.

Definition at line 46 of file ROBufferSvc.cc.

{
  m_log<< MSG::INFO<< "Set ReadoutHeaders from SimReadoutHeader!"<< endreq;
  m_log<< MSG::INFO<< "The deque<MixHeader> m_mhBuffer size: "<< m_mhBuffer.size()<< endreq;

  //Deal with the SimReadoutHeader
  vector<SimReadout*> sros = sroh->readouts();
  m_log<< MSG::INFO<< "Size of vector<SimReadout*>: "<< sros.size()<< endreq;

  vector<SimReadout*>::iterator simit;
  for(simit = sros.begin(); simit != sros.end(); simit++)
  {
    SimReadout* sro = (*simit);
    const Readout* ro = sro->readout();

    Context context = sroh->context();

    Detector det(sro->readout()->detector());
    context.SetSite(det.site());
    context.SetDetId(det.detectorId());

    if(det.detectorId() == DetectorId::kAD1
       || det.detectorId() == DetectorId::kAD2
       || det.detectorId() == DetectorId::kAD3
       || det.detectorId() == DetectorId::kAD4
       || det.detectorId() == DetectorId::kIWS
       || det.detectorId() == DetectorId::kOWS)
    {
      const ReadoutPmtCrate* ropmtc = 0;
      ropmtc = dynamic_cast<const ReadoutPmtCrate*>(ro);
      if(!ropmtc)
      {
        m_log<< MSG::ERROR<< "Failed to get ReadoutPmtCrate!"<< endreq;
        return StatusCode::FAILURE;
      }
      ReadoutPmtCrate* ropc = new ReadoutPmtCrate(*ropmtc);
    
      //Prepare a new ReadoutHeader
      ReadoutHeader* roh = new ReadoutHeader();
      ropc->setHeader(roh);
      roh->setReadout(dynamic_cast<Readout*>(ropc));

      roh->setContext(context);
      roh->setEarliest(sroh->earliest());
      roh->setLatest(sroh->latest());
    
      //Prepare the MBuffer
      MixHeader mh;
      mh.roh = roh;
      m_mhBuffer.push_back(mh);
    }
    else if(det.detectorId() == DetectorId::kRPC)
    {
      const ReadoutRpcCrate *rorpcc = 0;
      rorpcc = dynamic_cast<const ReadoutRpcCrate*>(ro);
      if(!rorpcc)
      {
        m_log<< MSG::ERROR<< "Failed to get ReadoutRpcCrate!"<< endreq;
        return StatusCode::FAILURE;
      }
      ReadoutRpcCrate* rorc = new ReadoutRpcCrate(*rorpcc);

      //Prepare a new ReadoutHeader
      ReadoutHeader* roh = new ReadoutHeader();
      rorc->setHeader(roh);
      roh->setReadout(dynamic_cast<Readout*>(rorc));

      roh->setContext(context);
      roh->setEarliest(sroh->earliest());
      roh->setLatest(sroh->latest());

      //Prepare the MBuffer
      MixHeader mh;
      mh.roh = roh;
      m_mhBuffer.push_back(mh);
    }
    else if(det.detectorId() == DetectorId::kUnknown)
    {
      Readout* nro = new Readout(*ro);

      //Prepare a new ReadoutHeader
      ReadoutHeader* roh = new ReadoutHeader();
      nro->setHeader(roh);
      roh->setReadout(nro);

      roh->setContext(context);
      roh->setEarliest(sroh->earliest());
      roh->setLatest(sroh->latest());
    
      //Prepare the MBuffer
      MixHeader mh;
      mh.roh = roh;
      m_mhBuffer.push_back(mh);
    }
  }

  //Sort the MBuffer
  sort(m_mhBuffer.begin(), m_mhBuffer.end());

  m_log<< MSG::INFO<< "ROBufferSvc MixHeader buffer filled!" << endreq;

  delete sroh;
  return StatusCode::SUCCESS;  
}
ReadoutHeader * ROBufferSvc::getROHeader ( ) [virtual]

Implements IROBufferSvc.

Definition at line 151 of file ROBufferSvc.cc.

{
  m_log<< MSG::INFO<< "get one Readout from MixHeader buffer...."<< endreq;

  ReadoutHeader* roh = m_mhBuffer[0].roh;
  m_mhBuffer.pop_front();

  return roh;
}
deque< MixHeader >::size_type ROBufferSvc::getMBufferSize ( ) [virtual]

Implements IROBufferSvc.

Definition at line 161 of file ROBufferSvc.cc.

{
  m_log<< MSG::INFO<< "The deque<MixHeader> m_mhBuffer size is "
       << m_mhBuffer.size()<< endreq;

  return m_mhBuffer.size();
}
static const InterfaceID& IROBufferSvc::interfaceID ( ) [inline, static, inherited]

Definition at line 36 of file IROBufferSvc.h.

                             { return  IID_IROBufferSvc; }

Member Data Documentation

MsgStream ROBufferSvc::m_log [mutable, private]

Definition at line 45 of file ROBufferSvc.h.

Definition at line 46 of file ROBufferSvc.h.

list ROBufferSvc::__all__ = ['ROBufferSvcConf', 'Configure'] [private]

Definition at line 3 of file __init__.py.


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:11 for ROBufferSvc by doxygen 1.7.4