BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcTimeRec Class Reference

#include <EmcTimeRec.h>

+ Inheritance diagram for EmcTimeRec:

Public Member Functions

 EmcTimeRec (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 12 of file EmcTimeRec.h.

Constructor & Destructor Documentation

◆ EmcTimeRec()

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

Definition at line 16 of file EmcTimeRec.cxx.

16 :
17 Algorithm(name, pSvcLocator)
18{
19 declareProperty("Output",m_output=false);
20}

Member Function Documentation

◆ execute()

StatusCode EmcTimeRec::execute ( )

Definition at line 54 of file EmcTimeRec.cxx.

54 {
55
56 MsgStream log(msgSvc(), name());
57 log << MSG::DEBUG << "in execute()" << endreq;
58
59 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
60
61 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
62 log << MSG::WARNING << "Could not find RecEsTimeCol!" << endreq;
63 return StatusCode::SUCCESS;
64 }
65
66 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
67 double t0 = (*iter_ESTime)->getTest(); //get t0
68
69 SmartDataPtr<RecEmcShowerCol> emcRecShowerCol(eventSvc(), EventModel::Recon::RecEmcShowerCol);
70 if(!emcRecShowerCol) {
71 log << MSG::WARNING << "Could not find RecEmcShowerCol!" << endreq;
72 return StatusCode::SUCCESS;
73 }
74
75 RecEmcShowerCol::iterator iShowerCol;
76 for(iShowerCol=emcRecShowerCol->begin();
77 iShowerCol!=emcRecShowerCol->end();
78 iShowerCol++) {
79
80 if((*iShowerCol)->status()>=100) continue; //estTime has been subtracted
81
82 double tEmc = (*iShowerCol)->time();
83 (*iShowerCol)->setTime(tEmc-(int)(t0/50));
84 (*iShowerCol)->setStatus((*iShowerCol)->status()%100+100);
85
86 if(m_output) {
87 m_nt_emcTime = tEmc;
88 m_nt_estTime = (double)(int)(t0/50);
89 m_nt_corTime = (*iShowerCol)->time();
90 RecEmcID id((*iShowerCol)->getShowerId());
91 m_nt_npart = EmcID::barrel_ec(id);
92 m_nt_ntheta = EmcID::theta_module(id);
93 m_nt_nphi = EmcID::phi_module(id);
94 m_nt_e5x5 = (*iShowerCol)->e5x5();
95 m_nt_status = (*iShowerCol)->status();
96 m_tuple->write();
97 }
98 }
99
100 return StatusCode::SUCCESS;
101}
IMessageSvc * msgSvc()
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
_EXTERN_ std::string RecEmcShowerCol
Definition: EventModel.h:99

◆ finalize()

StatusCode EmcTimeRec::finalize ( )

Definition at line 104 of file EmcTimeRec.cxx.

104 {
105
106 MsgStream log(msgSvc(), name());
107 log << MSG::INFO << "in finalize()" << endreq;
108
109 return StatusCode::SUCCESS;
110}

◆ initialize()

StatusCode EmcTimeRec::initialize ( )

Definition at line 23 of file EmcTimeRec.cxx.

23 {
24
25 MsgStream log(msgSvc(), name());
26 log << MSG::INFO << "in initialize()" << endreq;
27
28 if(m_output) {
29 NTuplePtr nt(ntupleSvc(),"FILE303/n1");
30 if ( nt ) m_tuple = nt;
31 else {
32 m_tuple=ntupleSvc()->book("FILE303/n1",CLID_ColumnWiseTuple,"EmcTimeRec");
33 if( m_tuple ) {
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);
42 }
43 else { // did not manage to book the N tuple....
44 log << MSG::ERROR << "Cannot book N-tuple:" << long(m_tuple) << endmsg;
45 return StatusCode::FAILURE;
46 }
47 }
48 }
49
50 return StatusCode::SUCCESS;
51}
INTupleSvc * ntupleSvc()

The documentation for this class was generated from the following files: