BOSS 8.0.0
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 17 of file EmcTimeRec.cxx.

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

Referenced by EmcTimeRec().

Member Function Documentation

◆ execute()

StatusCode EmcTimeRec::execute ( )

Definition at line 58 of file EmcTimeRec.cxx.

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

◆ finalize()

StatusCode EmcTimeRec::finalize ( )

Definition at line 112 of file EmcTimeRec.cxx.

112 {
113
114 MsgStream log( msgSvc(), name() );
115 log << MSG::INFO << "in finalize()" << endmsg;
116
117 return StatusCode::SUCCESS;
118}

◆ 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()" << endmsg;
27
28 if ( m_output )
29 {
30 NTuplePtr nt( ntupleSvc(), "FILE303/n1" );
31 if ( nt ) m_tuple = nt;
32 else
33 {
34 m_tuple = ntupleSvc()->book( "FILE303/n1", CLID_ColumnWiseTuple, "EmcTimeRec" );
35 if ( m_tuple )
36 {
37 m_tuple->addItem( "emcTime", m_nt_emcTime );
38 m_tuple->addItem( "estTime", m_nt_estTime );
39 m_tuple->addItem( "corTime", m_nt_corTime );
40 m_tuple->addItem( "npart", m_nt_npart );
41 m_tuple->addItem( "ntheta", m_nt_ntheta );
42 m_tuple->addItem( "nphi", m_nt_nphi );
43 m_tuple->addItem( "e5x5", m_nt_e5x5 );
44 m_tuple->addItem( "status", m_nt_status );
45 }
46 else
47 { // did not manage to book the N tuple....
48 log << MSG::ERROR << "Cannot book N-tuple:" << long( m_tuple ) << endmsg;
49 return StatusCode::FAILURE;
50 }
51 }
52 }
53
54 return StatusCode::SUCCESS;
55}
INTupleSvc * ntupleSvc()

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