1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "EventModel/EventHeader.h"
7#include "EmcRecEventModel/RecEmcEventModel.h"
8#include "EvTimeEvent/RecEsTime.h"
9#include "EmcTimeRec/EmcTimeRec.h"
17 Algorithm(name, pSvcLocator)
19 declareProperty(
"Output",m_output=
false);
25 MsgStream log(
msgSvc(), name());
26 log << MSG::INFO <<
"in initialize()" << endreq;
30 if ( nt ) m_tuple = nt;
32 m_tuple=
ntupleSvc()->book(
"FILE303/n1",CLID_ColumnWiseTuple,
"EmcTimeRec");
34 m_tuple->addItem (
"emcTime", m_nt_emcTime);
35 m_tuple->addItem (
"estTime", m_nt_estTime);
36 m_tuple->addItem (
"corTime", m_nt_corTime);
37 m_tuple->addItem (
"npart", m_nt_npart);
38 m_tuple->addItem (
"ntheta", m_nt_ntheta);
39 m_tuple->addItem (
"nphi", m_nt_nphi);
40 m_tuple->addItem (
"e5x5", m_nt_e5x5);
41 m_tuple->addItem (
"status", m_nt_status);
44 log << MSG::ERROR <<
"Cannot book N-tuple:" << long(m_tuple) << endmsg;
45 return StatusCode::FAILURE;
50 return StatusCode::SUCCESS;
56 MsgStream log(
msgSvc(), name());
57 log << MSG::DEBUG <<
"in execute()" << endreq;
59 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
61 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
62 log << MSG::WARNING <<
"Could not find RecEsTimeCol!" << endreq;
63 return StatusCode::SUCCESS;
66 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
67 double t0 = (*iter_ESTime)->getTest();
70 if(!emcRecShowerCol) {
71 log << MSG::WARNING <<
"Could not find RecEmcShowerCol!" << endreq;
72 return StatusCode::SUCCESS;
75 RecEmcShowerCol::iterator iShowerCol;
76 for(iShowerCol=emcRecShowerCol->begin();
77 iShowerCol!=emcRecShowerCol->end();
80 if((*iShowerCol)->status()>=100)
continue;
82 double tEmc = (*iShowerCol)->time();
83 (*iShowerCol)->setTime(tEmc-(
int)(t0/50));
84 (*iShowerCol)->setStatus((*iShowerCol)->status()%100+100);
88 m_nt_estTime = (double)(
int)(t0/50);
89 m_nt_corTime = (*iShowerCol)->time();
90 RecEmcID id((*iShowerCol)->getShowerId());
94 m_nt_e5x5 = (*iShowerCol)->e5x5();
95 m_nt_status = (*iShowerCol)->status();
100 return StatusCode::SUCCESS;
106 MsgStream log(
msgSvc(), name());
107 log << MSG::INFO <<
"in finalize()" << endreq;
109 return StatusCode::SUCCESS;
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
EmcTimeRec(const std::string &name, ISvcLocator *pSvcLocator)
_EXTERN_ std::string RecEmcShowerCol