BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TofEnergyRec Class Reference

#include <TofEnergyRec.h>

Inheritance diagram for TofEnergyRec:

Public Member Functions

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

Detailed Description

Definition at line 15 of file TofEnergyRec.h.

Constructor & Destructor Documentation

◆ TofEnergyRec()

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

Definition at line 42 of file TofEnergyRec.cxx.

43 : Algorithm( name, pSvcLocator ) {
44 declareProperty( "Output", m_output = false );
45 declareProperty( "EventNb", m_eventNb = 0 );
46 declareProperty( "CalibConst", m_calibConst = 0.0085 );
47 declareProperty( "IsData", m_isData = true );
48}

Referenced by TofEnergyRec().

Member Function Documentation

◆ execute()

StatusCode TofEnergyRec::execute ( )

Definition at line 95 of file TofEnergyRec.cxx.

95 {
96
97 MsgStream log( msgSvc(), name() );
98 log << MSG::INFO << "TofEnergyRec in execute()!!" << endmsg;
99
100 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
101 if ( !eventHeader )
102 {
103 log << MSG::FATAL << "TofEnergyRec could not find Event Header!" << endmsg;
104 return StatusCode::FAILURE;
105 }
106 int run = eventHeader->runNumber();
107 int event = eventHeader->eventNumber();
108 if ( m_eventNb != 0 && m_event % m_eventNb == 0 )
109 std::cout << "--------event: " << m_event << ", run= " << run << " event= " << event
110 << std::endl;
111 log << MSG::INFO << "run= " << run << " event= " << event << endmsg;
112 m_event++;
113
114 IRawDataProviderSvc* tofDigiSvc;
115 StatusCode sc = service( "RawDataProviderSvc", tofDigiSvc );
116 if ( sc != StatusCode::SUCCESS )
117 {
118 log << MSG::FATAL << "TofEnergyRec could not find RawDataProviderSvc!" << endmsg;
119 return StatusCode::SUCCESS;
120 }
121
122 // check whether the Recon has been already registered
123 DataObject* aReconEvent;
124 eventSvc()->findObject( "/Event/Recon", aReconEvent );
125 if ( aReconEvent == NULL )
126 {
127 log << MSG::INFO << "Register ReconEvent" << endmsg;
128 // then register Recon
129 aReconEvent = new ReconEvent();
130 sc = eventSvc()->registerObject( "/Event/Recon", aReconEvent );
131 if ( sc != StatusCode::SUCCESS )
132 {
133 log << MSG::FATAL << "Could not register ReconEvent" << endmsg;
134 return StatusCode::FAILURE;
135 }
136 }
137
138 // Register RecTofTrackCol
139 SmartDataPtr<RecTofTrackCol> tofTrackCol( eventSvc(), EventModel::Recon::RecTofTrackCol );
140 if ( !tofTrackCol )
141 {
142 log << MSG::INFO << "Register RecTofTrackCol!" << endmsg;
143 tofTrackCol = new RecTofTrackCol;
144 sc = eventSvc()->registerObject( EventModel::Recon::RecTofTrackCol, tofTrackCol );
145 if ( sc != StatusCode::SUCCESS )
146 { log << MSG::FATAL << "Could not register RecTofTrackCol!" << endmsg; }
147 }
148
149 // Retrieve RecEsTimeCol
150 SmartDataPtr<RecEsTimeCol> estimeCol( eventSvc(), "/Event/Recon/RecEsTimeCol" );
151 if ( !estimeCol || ( estimeCol->size() == 0 ) )
152 {
153 log << MSG::WARNING << "TofRec Could not find RecEsTimeCol! Run = " << run
154 << " Event = " << event << endmsg;
155 return StatusCode::SUCCESS;
156 }
157 RecEsTimeCol::iterator iter_ESTime = estimeCol->begin();
158
159 double t0 = 0;
160 t0 = ( *iter_ESTime )->getTest();
161 int t0Stat = ( *iter_ESTime )->getStat();
162
163 std::vector<TofData*> tofDataVec;
164 tofDataVec = tofDigiSvc->tofDataVectorTof();
165
166 m_tofShower->findShower( tofDataVec, tofTrackCol, t0 );
167
168 return StatusCode::SUCCESS;
169}
IMessageSvc * msgSvc()
IRawDataProviderSvc * tofDigiSvc
virtual TofDataVector & tofDataVectorTof(double estime=0)=0

◆ finalize()

StatusCode TofEnergyRec::finalize ( )

Definition at line 173 of file TofEnergyRec.cxx.

173 {
174 cout << "Total event:" << m_event << endl;
175 delete m_tofShower;
176 return StatusCode::SUCCESS;
177}

◆ initialize()

StatusCode TofEnergyRec::initialize ( )

Definition at line 52 of file TofEnergyRec.cxx.

52 {
53
54 MsgStream log( msgSvc(), name() );
55 log << MSG::INFO << "TofEnergyRec in initialize()" << endmsg;
56
57 m_event = 0;
58 m_tofShower = new TofShower;
59 m_tofShower->setCalibConst( m_calibConst );
60 m_tofShower->setIsData( m_isData );
61 // m_tofShower->readCalibPar();
62
63 if ( m_output )
64 {
65 cout << "--------Book Tof Energy Ntuple!" << endl;
66 NTuplePtr nt( ntupleSvc(), "FILE209/sci" );
67 NTuplePtr nt1( ntupleSvc(), "FILE209/shower" );
68 NTuplePtr nt2( ntupleSvc(), "FILE209/seed" );
69 if ( nt && nt1 && nt2 )
70 {
71 m_tuple = nt;
72 m_tuple1 = nt1;
73 m_tuple2 = nt2;
74 }
75 else
76 {
77 m_tuple = ntupleSvc()->book( "FILE209/sci", CLID_ColumnWiseTuple, "TofEnergyRec" );
78 m_tuple1 = ntupleSvc()->book( "FILE209/shower", CLID_ColumnWiseTuple, "TofEnergyRec" );
79 m_tuple2 = ntupleSvc()->book( "FILE209/seed", CLID_ColumnWiseTuple, "TofEnergyRec" );
80 if ( m_tuple && m_tuple1 && m_tuple2 )
81 { m_tofShower->BookNtuple( m_tuple, m_tuple1, m_tuple2 ); }
82 else
83 {
84 log << MSG::ERROR << " ----- TofShower cannot book N-tuple:" << long( m_tuple )
85 << endmsg;
86 }
87 }
88 }
89
90 return StatusCode::SUCCESS;
91}
INTupleSvc * ntupleSvc()

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