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 "TofRawEvent/TofDigi.h"
12#include "EmcRawEvent/EmcDigi.h"
13#include "McTruth/McKine.h"
15#include "DstEvent/DstTofTrack.h"
16#include "DstEvent/DstMdcTrack.h"
17#include "DstEvent/DstEmcShower.h"
18#include "DstEvent/DstMucTrack.h"
19#include "DstEvent/DstMdcDedx.h"
20#include "DstEvent/DstExtTrack.h"
21#include "DstEvent/DstMdcKalTrack.h"
23#include "ReconEvent/ReconEvent.h"
25#include "CLHEP/Matrix/Vector.h"
26#include "CLHEP/Matrix/SymMatrix.h"
27#include "CLHEP/Vector/ThreeVector.h"
32#include "Identifier/Identifier.h"
45 Algorithm(name, pSvcLocator)
55 MsgStream log(
msgSvc(), name());
56 log << MSG::INFO <<
"in initialize()" << endreq;
69 return StatusCode::SUCCESS;
75 MsgStream log(
msgSvc(), name());
76 log << MSG::INFO <<
"in execute()" << endreq;
83 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
85 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
86 return( StatusCode::FAILURE);
88 log << MSG::INFO <<
"RootIoAlg: retrieved event: " << eventHeader->eventNumber() <<
" run: " << eventHeader->runNumber() << endreq;
94 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),
"/Event/Digi/MdcDigiCol");
96 log << MSG::INFO <<
"Could not find MDC digi" << endreq;
100 MdcDigiCol::iterator iter1 = mdcDigiCol->begin();
102 for (;iter1 != mdcDigiCol->end(); iter1++, digiId++) {
103 log << MSG::INFO <<
"MDC digit No: " << digiId << endreq;
106 <<
" time_channel = " << (*iter1)->getTimeChannel()
107 <<
" charge_channel = " << (*iter1)->getChargeChannel()
114 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),
"/Event/Digi/TofDigiCol");
116 log <<MSG::INFO <<
"Could not find TOF digi" << endreq;
120 TofDigiCol::iterator iter2 = tofDigiCol->begin();
122 for (;iter2 != tofDigiCol->end(); iter2++, digiId++) {
123 log << MSG::INFO <<
"TOF digit No: " << digiId << endreq;
125 <<
" time_channel = " << (*iter2)->getTimeChannel()
126 <<
" charge_channel = " << (*iter2)->getChargeChannel()
133 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),
"/Event/Digi/EmcDigiCol");
135 log <<MSG::INFO <<
"Could not find EMC digi" << endreq;
139 EmcDigiCol::iterator iter3 = emcDigiCol->begin();
141 for (;iter3 != emcDigiCol->end(); iter3++, digiId++) {
142 log << MSG::INFO <<
"Emc digit No: " << digiId << endreq;
145 <<
" time_channel = " << (*iter3)->getTimeChannel()
146 <<
" charge_channel = " << (*iter3)->getChargeChannel()
154 if (!dstTofTrackCol) {
155 log <<MSG::INFO <<
"Could not find Dst Tof Track" << endreq;
159 DstTofTrackCol::iterator iter4 = dstTofTrackCol->begin();
161 for (;iter4 != dstTofTrackCol->end(); iter4++, digiId++) {
162 log << MSG::INFO <<
"Dst Tof No: " << digiId << endreq;
165 <<
" TrackID = " << (*iter4)->trackID()
166 <<
" TofID = " <<(*iter4)->tofID()
167 <<
" TofTrackID = " <<(*iter4)->tofTrackID()
168 <<
" Beta = " << (*iter4)->beta()
175 if (!dstEmcShowerCol) {
176 log <<MSG::INFO <<
"Could not find Dst Emc Track" << endreq;
180 DstEmcShowerCol::iterator iter5 = dstEmcShowerCol->begin();
182 for (;iter5 != dstEmcShowerCol->end(); iter5++, digiId++) {
183 log << MSG::INFO <<
"Dst Emc No: " << digiId << endreq;
186 <<
" Track ID = " << (*iter5)->trackId()
187 <<
" Cell ID = " << (*iter5)->cellId()
188 <<
" Total energy observed in Emc = " << (*iter5)->energy()
195 if (!dstMdcTrackCol) {
196 log <<MSG::INFO <<
"Could not find Dst Mdc Track" << endreq;
200 DstMdcTrackCol::iterator iter6 = dstMdcTrackCol->begin();
202 for (;iter6 != dstMdcTrackCol->end(); iter6++, digiId++) {
203 log << MSG::INFO <<
"Dst Mdc No: " << digiId << endreq;
206 <<
" Track ID = " << (*iter6)->trackId()
207 <<
" number of total hits contained = " << (*iter6)->nster()
208 <<
"px = "<<(*iter6)->px()
209 <<
"p = "<<(*iter6)->p()
216 if (!dstMdcDedxCol) {
217 log << MSG::INFO <<
"Could not find Dst Mdc Dedx " << endreq;
221 DstMdcDedxCol::iterator iter7 = dstMdcDedxCol->begin();
223 for (;iter7 != dstMdcDedxCol->end(); iter7++, digiId++) {
224 log << MSG::INFO <<
"Dst Mdc Dedx No: " << digiId << endreq;
227 <<
" Track ID = " << (*iter7)->trackId()
228 <<
"Chi of E = " << (*iter7)->chi(0)
229 <<
"Chi of Mu = " << (*iter7)->chi(1)
230 <<
"Chi of Pi = " << (*iter7)->chi(2)
237 if (!dstMucTrackCol) {
238 log <<MSG::INFO <<
"Could not find Muc Track " << endreq;
242 DstMucTrackCol::iterator iter8 = dstMucTrackCol->begin();
244 for (;iter8 != dstMucTrackCol->end(); iter8++, digiId++) {
245 log << MSG::INFO <<
"Dst Muc Track No: " << digiId << endreq;
248 <<
" Track ID = " << (*iter8)->trackId()
249 <<
" Number of hits on track = " << (*iter8)->numHits()
250 <<
" maxHitsInLayer " << (*iter8)->maxHitsInLayer()
251 <<
" xPos = " << (*iter8)->xPos()
252 <<
" yPos = " << (*iter8)->yPos()
253 <<
" zPos = " << (*iter8)->zPos()
260 if (!dstExtTrackCol) {
261 log <<MSG::INFO <<
"Could not find DstExt Track " << endreq;
265 DstExtTrackCol::iterator iter9 = dstExtTrackCol->begin();
268 for (;iter9 != dstExtTrackCol->end(); iter9++, digiId++) {
269 log << MSG::INFO <<
"Dst Ext Track No: " << digiId << endreq;
271 <<
"volume name of Tof1= "<< (*iter9)->tof1VolumeName()
272 <<
"volume number of Tof1 = "<< (*iter9)->tof1VolumeNumber()
273 <<
"Tof1 = "<< (*iter9)->tof1()
276 <<
"volume name of Tof2= "<< (*iter9)->tof2VolumeName()
277 <<
"volume number of Tof2 = "<< (*iter9)->tof2VolumeNumber()
278 <<
"Tof2 = "<< (*iter9)->tof2()
281 <<
" Ext Tof1 Error Z = " << (*iter9)->tof1PosSigmaAlongZ()
282 <<
" Ext Tof2 Error Z = " << (*iter9)->tof2PosSigmaAlongZ()
283 <<
" Ext Emc Error theta = " << (*iter9)->emcPosSigmaAlongTheta()
284 <<
" Ext Muc Error Z = " << (*iter9)->mucPosSigmaAlongZ()
290 if (!dstMdcKalTrackCol) {
291 log <<MSG::INFO <<
"Could not find DstMdcKal Track " << endreq;
294 DstMdcKalTrackCol::iterator iter10 = dstMdcKalTrackCol->begin();
296 for (;iter10 != dstMdcKalTrackCol->end(); iter10++, digiId++) {
426 return StatusCode::SUCCESS;
432 MsgStream log(
msgSvc(), name());
433 log << MSG::INFO <<
"in finalize()" << endreq;
435 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 DstMucTrackCol