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