BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMakerAlg.cxx
Go to the documentation of this file.
1#include "RecMakerAlg.h"
2
3#include "GaudiKernel/IDataProviderSvc.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/MsgStream.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "GaudiKernel/SmartDataPtr.h"
8
9#include "DstEvent/DstEmcShower.h"
10#include "DstEvent/DstMdcDedx.h"
11#include "DstEvent/DstMdcKalTrack.h"
12#include "DstEvent/DstMdcTrack.h"
13#include "DstEvent/DstMucTrack.h"
14#include "EmcRecEventModel/RecEmcShower.h"
15#include "EventModel/EventHeader.h"
16#include "EventModel/EventModel.h"
17#include "ExtEvent/ExtMucHit.h"
18#include "ExtEvent/RecExtTrack.h"
19#include "MdcRecEvent/RecMdcDedx.h"
20#include "MdcRecEvent/RecMdcDedxHit.h"
21#include "MdcRecEvent/RecMdcHit.h"
22#include "MdcRecEvent/RecMdcKalTrack.h"
23#include "MdcRecEvent/RecMdcTrack.h"
24#include "MucRecEvent/MucRecHit.h"
25#include "MucRecEvent/RecMucTrack.h"
26#include "TofRecEvent/RecTofTrack.h"
27
28/////////////////////////////////////////////////////////////////////////////
30RecMakerAlg::RecMakerAlg( const std::string& name, ISvcLocator* pSvcLocator )
31 : Algorithm( name, pSvcLocator ) {}
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
35
36 MsgStream log( msgSvc(), name() );
37 log << MSG::INFO << "in initialize()" << endmsg;
38
39 return StatusCode::SUCCESS;
40}
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
44
45 MsgStream log( msgSvc(), name() );
46 log << MSG::INFO << "in execute()" << endmsg;
47
48 // Get the event header, print out event and run number
49
50 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
51 if ( !eventHeader )
52 {
53 log << MSG::FATAL << "Could not find Event Header" << endmsg;
54 return ( StatusCode::FAILURE );
55 }
56
57 int eventId = eventHeader->eventNumber();
58 int runId = eventHeader->runNumber();
59 log << MSG::INFO << "event: " << eventId << " run: " << runId << endmsg;
60
61 StatusCode sc = StatusCode::SUCCESS;
62 int trackID;
63
64 // Retrieve Mdc Track
65 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol( eventSvc(), "/Event/Recon/RecMdcTrackCol" );
66 if ( !recMdcTrackCol )
67 {
68 log << MSG::INFO << "Could not find RecMdcTrackCol" << endmsg;
69 SmartDataPtr<DstMdcTrackCol> dstMdcTrackCol( eventSvc(), "/Event/Dst/DstMdcTrackCol" );
70 if ( !dstMdcTrackCol ) { log << MSG::INFO << "Could not find DstMdcTrackCol" << endmsg; }
71 else
72 {
73 RecMdcTrackCol* recMdcTrackCol = new RecMdcTrackCol();
74 DstMdcTrackCol::iterator iter_mdc = dstMdcTrackCol->begin();
75 trackID = 0;
76 for ( ; iter_mdc != dstMdcTrackCol->end(); iter_mdc++, trackID++ )
77 {
78 RecMdcTrack* recMdcTrack = new RecMdcTrack();
79 *recMdcTrack = **iter_mdc;
80 ( *recMdcTrackCol ).push_back( recMdcTrack );
81 log << MSG::INFO << " Mdc Track ID = " << trackID
82 << " Mdc Track Nster = " << ( *iter_mdc )->nster() << endmsg;
83 }
84 sc = eventSvc()->registerObject( EventModel::Recon::RecMdcTrackCol, recMdcTrackCol );
85 }
86 }
87
88 // Retrieve MdcKal track
89 SmartDataPtr<RecMdcKalTrackCol> recMdcKalTrackCol( eventSvc(),
90 "/Event/Recon/RecMdcKalTrackCol" );
91 if ( !recMdcKalTrackCol )
92 {
93 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endmsg;
94 SmartDataPtr<DstMdcKalTrackCol> dstMdcKalTrackCol( eventSvc(),
95 "/Event/Dst/DstMdcKalTrackCol" );
96 if ( !dstMdcKalTrackCol )
97 { log << MSG::INFO << "Could not find DstMdcKalTrackCol" << endmsg; }
98 else
99 {
100 RecMdcKalTrackCol* recMdcKalTrackCol = new RecMdcKalTrackCol();
101 DstMdcKalTrackCol::iterator iter_mdc = dstMdcKalTrackCol->begin();
102 trackID = 0;
103 for ( ; iter_mdc != dstMdcKalTrackCol->end(); iter_mdc++, trackID++ )
104 {
105 RecMdcKalTrack* recMdcKalTrack = new RecMdcKalTrack();
106 *recMdcKalTrack = **iter_mdc;
107 ( *recMdcKalTrackCol ).push_back( recMdcKalTrack );
108 log << MSG::INFO << " MdcKalTrack ID = " << trackID
109 << " MdcKalTrack Nster = " << ( *iter_mdc )->nster()
110 << " MdcKalTrack poca = " << ( *iter_mdc )->poca() << endmsg;
111 }
112 sc = eventSvc()->registerObject( EventModel::Recon::RecMdcKalTrackCol,
113 recMdcKalTrackCol );
114 }
115 }
116
117 // Retrieve MdcDedx
118 SmartDataPtr<RecMdcDedxCol> recMdcDedxCol( eventSvc(), "/Event/Recon/RecMdcDedxCol" );
119 if ( !recMdcDedxCol )
120 {
121 log << MSG::INFO << "Could not find RecMdcDedxCol" << endmsg;
122 SmartDataPtr<DstMdcDedxCol> dstMdcDedxCol( eventSvc(), "/Event/Dst/DstMdcDedxCol" );
123 if ( !dstMdcDedxCol ) { log << MSG::INFO << "Could not find DstMdcDedxCol" << endmsg; }
124 else
125 {
126 RecMdcDedxCol* recMdcDedxCol = new RecMdcDedxCol();
127 DstMdcDedxCol::iterator iter_mdc = dstMdcDedxCol->begin();
128 trackID = 0;
129 for ( ; iter_mdc != dstMdcDedxCol->end(); iter_mdc++, trackID++ )
130 {
131 RecMdcDedx* recMdcDedx = new RecMdcDedx();
132 *recMdcDedx = **iter_mdc;
133 ( *recMdcDedxCol ).push_back( recMdcDedx );
134 log << MSG::INFO << " MdcDedx ID = " << trackID << " MdcDedx " << endmsg;
135 }
136 sc = eventSvc()->registerObject( EventModel::Recon::RecMdcDedxCol, recMdcDedxCol );
137 }
138 }
139
140 // Retrieve Ext track
141 SmartDataPtr<RecExtTrackCol> recExtTrackCol( eventSvc(), "/Event/Recon/RecExtTrackCol" );
142 if ( !recExtTrackCol )
143 {
144 log << MSG::INFO << "Could not find RecExtTrackCol" << endmsg;
145 SmartDataPtr<DstExtTrackCol> dstExtTrackCol( eventSvc(), "/Event/Dst/DstExtTrackCol" );
146 if ( !dstExtTrackCol ) { log << MSG::INFO << "Could not find DstExtTrackCol" << endmsg; }
147 else
148 {
149 RecExtTrackCol* recExtTrackCol = new RecExtTrackCol();
150 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
151 trackID = 0;
152 for ( ; iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++ )
153 {
154 RecExtTrack* recExtTrack = new RecExtTrack();
155 *recExtTrack = **iter_ext;
156 ( *recExtTrackCol ).push_back( recExtTrack );
157 log << MSG::INFO << " ExtTrack ID = " << trackID << endmsg;
158 }
159 sc = eventSvc()->registerObject( EventModel::Recon::RecExtTrackCol, recExtTrackCol );
160 }
161 }
162
163 // Retrieve Tof Track
164 SmartDataPtr<RecTofTrackCol> tofTrackCol( eventSvc(), "/Event/Recon/RecTofTrackCol" );
165 if ( !tofTrackCol )
166 {
167 log << MSG::INFO << "Could not find TofTrackCol" << endmsg;
168 SmartDataPtr<DstTofTrackCol> dstTofTrackCol( eventSvc(), "/Event/Dst/DstTofTrackCol" );
169 if ( !dstTofTrackCol ) { log << MSG::INFO << "Could not find DstTofTrackCol" << endmsg; }
170 else
171 {
172 RecTofTrackCol* recTofTrackCol = new RecTofTrackCol();
173 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
174 for ( ; iter_tof != dstTofTrackCol->end(); iter_tof++ )
175 {
176 RecTofTrack* recTofTrack = new RecTofTrack();
177 *recTofTrack = **iter_tof;
178 ( *recTofTrackCol ).push_back( recTofTrack );
179 log << MSG::INFO << "Tof Track ID = " << ( *iter_tof )->tofTrackID()
180 << " Track ID = " << ( *iter_tof )->trackID()
181 << " Tof Counter ID = " << ( *iter_tof )->tofID()
182 << " Quality = " << ( *iter_tof )->quality() << endmsg;
183 }
184 sc = eventSvc()->registerObject( EventModel::Recon::RecTofTrackCol, recTofTrackCol );
185 }
186 }
187
188 // Retrieve Emc shower
189 SmartDataPtr<RecEmcShowerCol> recEmcShowerCol( eventSvc(), "/Event/Recon/RecEmcShowerCol" );
190 if ( !recEmcShowerCol )
191 {
192 log << MSG::INFO << "Could not find RecEmcShowerCol" << endmsg;
193 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol( eventSvc(), "/Event/Dst/DstEmcShowerCol" );
194 if ( !dstEmcShowerCol ) { log << MSG::INFO << "Could not find DstEmcShowerCol" << endmsg; }
195 else
196 {
197 RecEmcShowerCol* recEmcShowerCol = new RecEmcShowerCol();
198 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
199 trackID = 0;
200 for ( ; iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++ )
201 {
202 RecEmcShower* recEmcShower = new RecEmcShower();
203 *recEmcShower = **iter_emc;
204 ( *recEmcShowerCol ).push_back( recEmcShower );
205 log << MSG::INFO << " EmcShower ID = " << trackID
206 << " EmcShower energy = " << ( *iter_emc )->energy() << endmsg;
207 }
208 sc = eventSvc()->registerObject( EventModel::Recon::RecEmcShowerCol, recEmcShowerCol );
209 }
210 }
211
212 // Retrieve Muc Track
213 SmartDataPtr<RecMucTrackCol> recMucTrackCol( eventSvc(), "/Event/Recon/RecMucTrackCol" );
214 if ( !recMucTrackCol )
215 {
216 log << MSG::INFO << "Could not find RecMucTrackCol" << endmsg;
217 SmartDataPtr<DstMucTrackCol> dstMucTrackCol( eventSvc(), "/Event/Dst/DstMucTrackCol" );
218 if ( !dstMucTrackCol ) { log << MSG::INFO << "Could not find DstMucTrackCol" << endmsg; }
219 else
220 {
221 RecMucTrackCol* recMucTrackCol = new RecMucTrackCol();
222 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
223 trackID = 0;
224 for ( ; iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++ )
225 {
226 RecMucTrack* recMucTrack = new RecMucTrack();
227 *recMucTrack = **iter_muc;
228 ( *recMucTrackCol ).push_back( recMucTrack );
229 log << MSG::INFO << " MucTrack ID = " << trackID << endmsg;
230 }
231 sc = eventSvc()->registerObject( EventModel::Recon::RecMucTrackCol, recMucTrackCol );
232 }
233 }
234 return sc;
235}
236
237// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
239
240 MsgStream log( msgSvc(), name() );
241 log << MSG::INFO << "in finalize()" << endmsg;
242
243 return StatusCode::SUCCESS;
244}
DECLARE_COMPONENT(BesBdkRc)
ObjectVector< RecEmcShower > RecEmcShowerCol
ObjectVector< RecExtTrack > RecExtTrackCol
IMessageSvc * msgSvc()
StatusCode execute()
RecMakerAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize()
StatusCode finalize()