1#include "RootIO/RootIoAlg.h"
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/AlgFactory.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/SmartDataPtr.h"
6#include "GaudiKernel/IDataProviderSvc.h"
7#include "GaudiKernel/PropertyMgr.h"
8#include "EventModel/Event.h"
9#include "EventModel/EventHeader.h"
10#include "MdcRawEvent/MdcDigi.h"
11#include "CgemRawEvent/CgemDigi.h"
12#include "TofRawEvent/TofDigi.h"
13#include "EmcRawEvent/EmcDigi.h"
14#include "McTruth/McKine.h"
16#include "DstEvent/DstTofTrack.h"
17#include "DstEvent/DstMdcTrack.h"
18#include "DstEvent/DstCgemTrack.h"
19#include "DstEvent/DstEmcShower.h"
20#include "DstEvent/DstMucTrack.h"
21#include "DstEvent/DstMdcDedx.h"
22#include "DstEvent/DstExtTrack.h"
23#include "DstEvent/DstMdcKalTrack.h"
24#include "DstEvent/DstCgemKalTrack.h"
26#include "ReconEvent/ReconEvent.h"
28#include "CLHEP/Matrix/Vector.h"
29#include "CLHEP/Matrix/SymMatrix.h"
30#include "CLHEP/Vector/ThreeVector.h"
35#include "Identifier/Identifier.h"
48 Algorithm(name, pSvcLocator)
58 MsgStream log(
msgSvc(), name());
59 log << MSG::INFO <<
"in initialize()" << endreq;
72 return StatusCode::SUCCESS;
78 MsgStream log(
msgSvc(), name());
79 log << MSG::INFO <<
"in execute()" << endreq;
86 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
88 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
89 return( StatusCode::FAILURE);
91 log << MSG::INFO <<
"RootIoAlg: retrieved event: " << eventHeader->eventNumber() <<
" run: " << eventHeader->runNumber() << endreq;
97 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),
"/Event/Digi/MdcDigiCol");
99 log << MSG::INFO <<
"Could not find MDC digi" << endreq;
103 MdcDigiCol::iterator iter1 = mdcDigiCol->begin();
105 for (;iter1 != mdcDigiCol->end(); iter1++, digiId++) {
106 log << MSG::INFO <<
"MDC digit No: " << digiId << endreq;
109 <<
" time_channel = " << (*iter1)->getTimeChannel()
110 <<
" charge_channel = " << (*iter1)->getChargeChannel()
117 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),
"/Event/Digi/TofDigiCol");
119 log <<MSG::INFO <<
"Could not find TOF digi" << endreq;
123 TofDigiCol::iterator iter2 = tofDigiCol->begin();
125 for (;iter2 != tofDigiCol->end(); iter2++, digiId++) {
126 log << MSG::INFO <<
"TOF digit No: " << digiId << endreq;
128 <<
" time_channel = " << (*iter2)->getTimeChannel()
129 <<
" charge_channel = " << (*iter2)->getChargeChannel()
136 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),
"/Event/Digi/EmcDigiCol");
138 log <<MSG::INFO <<
"Could not find EMC digi" << endreq;
142 EmcDigiCol::iterator iter3 = emcDigiCol->begin();
144 for (;iter3 != emcDigiCol->end(); iter3++, digiId++) {
145 log << MSG::INFO <<
"Emc digit No: " << digiId << endreq;
148 <<
" time_channel = " << (*iter3)->getTimeChannel()
149 <<
" charge_channel = " << (*iter3)->getChargeChannel()
157 if (!dstTofTrackCol) {
158 log <<MSG::INFO <<
"Could not find Dst Tof Track" << endreq;
162 DstTofTrackCol::iterator iter4 = dstTofTrackCol->begin();
164 for (;iter4 != dstTofTrackCol->end(); iter4++, digiId++) {
165 log << MSG::INFO <<
"Dst Tof No: " << digiId << endreq;
168 <<
" TrackID = " << (*iter4)->trackID()
169 <<
" TofID = " <<(*iter4)->tofID()
170 <<
" TofTrackID = " <<(*iter4)->tofTrackID()
171 <<
" Beta = " << (*iter4)->beta()
178 if (!dstEmcShowerCol) {
179 log <<MSG::INFO <<
"Could not find Dst Emc Track" << endreq;
183 DstEmcShowerCol::iterator iter5 = dstEmcShowerCol->begin();
185 for (;iter5 != dstEmcShowerCol->end(); iter5++, digiId++) {
186 log << MSG::INFO <<
"Dst Emc No: " << digiId << endreq;
189 <<
" Track ID = " << (*iter5)->trackId()
190 <<
" Cell ID = " << (*iter5)->cellId()
191 <<
" Total energy observed in Emc = " << (*iter5)->energy()
198 if (!dstMdcTrackCol) {
199 log <<MSG::INFO <<
"Could not find Dst Mdc Track" << endreq;
203 DstMdcTrackCol::iterator iter6 = dstMdcTrackCol->begin();
205 for (;iter6 != dstMdcTrackCol->end(); iter6++, digiId++) {
206 log << MSG::INFO <<
"Dst Mdc No: " << digiId << endreq;
209 <<
" Track ID = " << (*iter6)->trackId()
210 <<
" number of total hits contained = " << (*iter6)->nster()
211 <<
"px = "<<(*iter6)->px()
212 <<
"p = "<<(*iter6)->p()
219 if (!dstMdcDedxCol) {
220 log << MSG::INFO <<
"Could not find Dst Mdc Dedx " << endreq;
224 DstMdcDedxCol::iterator iter7 = dstMdcDedxCol->begin();
226 for (;iter7 != dstMdcDedxCol->end(); iter7++, digiId++) {
227 log << MSG::INFO <<
"Dst Mdc Dedx No: " << digiId << endreq;
230 <<
" Track ID = " << (*iter7)->trackId()
231 <<
"Chi of E = " << (*iter7)->chi(0)
232 <<
"Chi of Mu = " << (*iter7)->chi(1)
233 <<
"Chi of Pi = " << (*iter7)->chi(2)
240 if (!dstMucTrackCol) {
241 log <<MSG::INFO <<
"Could not find Muc Track " << endreq;
245 DstMucTrackCol::iterator iter8 = dstMucTrackCol->begin();
247 for (;iter8 != dstMucTrackCol->end(); iter8++, digiId++) {
248 log << MSG::INFO <<
"Dst Muc Track No: " << digiId << endreq;
251 <<
" Track ID = " << (*iter8)->trackId()
252 <<
" Number of hits on track = " << (*iter8)->numHits()
253 <<
" maxHitsInLayer " << (*iter8)->maxHitsInLayer()
254 <<
" xPos = " << (*iter8)->xPos()
255 <<
" yPos = " << (*iter8)->yPos()
256 <<
" zPos = " << (*iter8)->zPos()
263 if (!dstExtTrackCol) {
264 log <<MSG::INFO <<
"Could not find DstExt Track " << endreq;
268 DstExtTrackCol::iterator iter9 = dstExtTrackCol->begin();
271 for (;iter9 != dstExtTrackCol->end(); iter9++, digiId++) {
272 log << MSG::INFO <<
"Dst Ext Track No: " << digiId << endreq;
274 <<
"volume name of Tof1= "<< (*iter9)->tof1VolumeName()
275 <<
"volume number of Tof1 = "<< (*iter9)->tof1VolumeNumber()
276 <<
"Tof1 = "<< (*iter9)->tof1()
279 <<
"volume name of Tof2= "<< (*iter9)->tof2VolumeName()
280 <<
"volume number of Tof2 = "<< (*iter9)->tof2VolumeNumber()
281 <<
"Tof2 = "<< (*iter9)->tof2()
284 <<
" Ext Tof1 Error Z = " << (*iter9)->tof1PosSigmaAlongZ()
285 <<
" Ext Tof2 Error Z = " << (*iter9)->tof2PosSigmaAlongZ()
286 <<
" Ext Emc Error theta = " << (*iter9)->emcPosSigmaAlongTheta()
287 <<
" Ext Muc Error Z = " << (*iter9)->mucPosSigmaAlongZ()
293 if (!dstMdcKalTrackCol) {
294 log <<MSG::INFO <<
"Could not find DstMdcKal Track " << endreq;
297 DstMdcKalTrackCol::iterator iter10 = dstMdcKalTrackCol->begin();
299 for (;iter10 != dstMdcKalTrackCol->end(); iter10++, digiId++) {
310 SmartDataPtr<CgemDigiCol> cgemDigiCol(eventSvc(),
"/Event/Digi/CgemDigiCol");
312 log << MSG::INFO <<
"Could not find CGEM digi" << endreq;
316 CgemDigiCol::iterator iter11 = cgemDigiCol->begin();
318 for (;iter11 != cgemDigiCol->end(); iter11++, digiId++) {
319 log << MSG::INFO <<
"CGEM digit No: " << digiId << endreq;
322 <<
" time_channel = " << (*iter11)->getTimeChannel()
323 <<
" charge_channel = " << (*iter11)->getChargeChannel()
331 if (!dstCgemTrackCol) {
332 log <<MSG::INFO <<
"Could not find Dst Cgem Track" << endreq;
336 DstCgemTrackCol::iterator iter12 = dstCgemTrackCol->begin();
338 for (;iter12 != dstCgemTrackCol->end(); iter12++, digiId++) {
339 log << MSG::INFO <<
"Dst Cgem No: " << digiId << endreq;
342 <<
" Track ID = " << (*iter12)->trackId()
343 <<
"px = "<<(*iter12)->px()
344 <<
"p = "<<(*iter12)->p()
351 if (!dstCgemKalTrackCol) {
352 log <<MSG::INFO <<
"Could not find DstCgemKal Track " << endreq;
355 DstCgemKalTrackCol::iterator iter13 = dstCgemKalTrackCol->begin();
357 for (;iter13 != dstCgemKalTrackCol->end(); iter13++, digiId++) {
487 return StatusCode::SUCCESS;
493 MsgStream log(
msgSvc(), name());
494 log << MSG::INFO <<
"in finalize()" << endreq;
496 return StatusCode::SUCCESS;
RootIoAlg(const std::string &name, ISvcLocator *pSvcLocator)
_EXTERN_ std::string DstEmcShowerCol
_EXTERN_ std::string DstMdcKalTrackCol
_EXTERN_ std::string DstExtTrackCol
_EXTERN_ std::string DstMdcDedxCol
_EXTERN_ std::string DstTofTrackCol
_EXTERN_ std::string DstMdcTrackCol
_EXTERN_ std::string DstCgemTrackCol
_EXTERN_ std::string DstMucTrackCol
_EXTERN_ std::string DstCgemKalTrackCol