1#include "DstMakerAlg/DstEventMaker.h"
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"
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"
20#include "MdcRecEvent/RecMdcKalTrack.h"
22#include "EventModel/EventModel.h"
23#include "EventModel/Event.h"
24#include "EventModel/EventHeader.h"
26#include "DstEvent/DstEvent.h"
27#include "DstEvent/DstTofTrack.h"
28#include "DstEvent/DstEmcShower.h"
29#include "DstEvent/DstMdcTrack.h"
30#include "DstEvent/DstMucTrack.h"
31#include "DstEvent/DstMdcDedx.h"
32#include "DstEvent/DstExtTrack.h"
33#include "DstEvent/DstMdcKalTrack.h"
35#include "CLHEP/Matrix/Vector.h"
36#include "CLHEP/Matrix/SymMatrix.h"
37#include "CLHEP/Vector/ThreeVector.h"
48using CLHEP::Hep3Vector;
49using CLHEP::HepSymMatrix;
56 Algorithm(name, pSvcLocator)
66 MsgStream log(
msgSvc(), name());
67 log << MSG::INFO <<
"in initialize()" << endreq;
69 return StatusCode::SUCCESS;
75 MsgStream log(
msgSvc(), name());
76 log << MSG::INFO <<
"in execute()" << endreq;
80 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
82 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
83 return( StatusCode::FAILURE);
87 int eventId = eventHeader->eventNumber() ;
88 int runId = eventHeader->runNumber();
89 log << MSG::INFO <<
"DstEventMaker: retrieved event: " <<
" Event Number "<< eventId <<
" run: " <<runId << endreq;
91 StatusCode sc = StatusCode::SUCCESS ;
102 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
103 if (!recMdcTrackCol) {
104 log << MSG::INFO <<
"Could not find RecMdcTrackCol" << endreq;
107 RecMdcTrackCol::iterator iter_mdc = recMdcTrackCol->begin();
109 for (;iter_mdc != recMdcTrackCol->end(); iter_mdc++, trackID++) {
111 *dstMdcTrack = **iter_mdc;
112 (*dstMdcTrackCol).push_back(dstMdcTrack);
115 <<
" Mdc Track ID = " << trackID
116 <<
" Mdc Track Nster = " << (*iter_mdc)->
nster()
123 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),
"/Event/Recon/RecTofTrackCol");
124 if ( !tofTrackCol ) {
125 log << MSG::INFO <<
"Could not find TofTrackCol" << endreq;
129 RecTofTrackCol::iterator iter_tof = tofTrackCol->begin();
130 for( ; iter_tof != tofTrackCol->end(); iter_tof++ ) {
132 *dstTofTrack = **iter_tof;
133 (*dstTofTrackCol).push_back(dstTofTrack);
136 <<
"Tof Track ID = " << (*iter_tof)->
tofTrackID()
137 <<
" Track ID = " << (*iter_tof)->trackID()
138 <<
" Tof Counter ID = "<<(*iter_tof)->tofID()
139 <<
" Quality = "<< (*iter_tof)->quality()
147 SmartDataPtr<RecMucTrackCol> mucTrackCol(eventSvc(),
"/Event/Recon/RecMucTrackCol");
149 log <<MSG::INFO <<
"Could not find RecMucTrackCol" << endreq;
152 RecMucTrackCol::iterator iter_muc = mucTrackCol->begin();
154 for (;iter_muc != mucTrackCol->end(); iter_muc++, trackID++) {
156 *dstMucTrack = **iter_muc;
157 (*dstMucTrackCol).push_back(dstMucTrack);
159 <<
"Muc Track ID = " << trackID
160 <<
" Muc NumHits = " << (*iter_muc)->GetTotalHits()
161 <<
" Muc Pos x = " << (*iter_muc)->getMucPos().x()
162 <<
" Muc Pos y = " << (*iter_muc)->getMucPos().y()
163 <<
" Muc Pos z = " << (*iter_muc)->getMucPos().z()
172 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(eventSvc(),
"/Event/Recon/RecMdcDedxCol");
174 log <<MSG::INFO <<
"Could not find RecMdcDedxCol" << endreq;
178 RecMdcDedxCol::iterator iter_dedx = mdcDedxCol->begin();
179 for (;iter_dedx != mdcDedxCol->end(); iter_dedx++, trackID++) {
181 *dstMdcDedx = **iter_dedx;
182 (*dstMdcDedxCol).push_back(dstMdcDedx);
184 <<
" Dedx TrackID = "<< trackID
196 SmartDataPtr<RecEmcShowerCol> emcRecShowerCol(eventSvc(),
"/Event/Recon/RecEmcShowerCol");
197 if (!emcRecShowerCol) {
198 log <<MSG::INFO <<
"Could not find RecEmcShowerCol" << endreq;
204 RecEmcShowerCol::iterator iter_emc = emcRecShowerCol->begin();
205 for (;iter_emc != emcRecShowerCol->end(); iter_emc++, trackID++) {
207 (*dstEmcTrackCol).push_back(dstEmcTrack);
209 <<
" Emc Track Id = " << trackID
218 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),
"/Event/Recon/RecExtTrackCol");
220 log <<MSG::INFO <<
"Could not find RecExtTrackCol" << endreq;
226 RecExtTrackCol::iterator iter_ext = extTrackCol->begin();
227 for (;iter_ext != extTrackCol->end(); iter_ext++, trackID++) {
229 *dstExtTrack = **iter_ext;
230 (*dstExtTrackCol).push_back(dstExtTrack);
232 <<
" Ext Track Id = " << trackID
234 <<
" Ext Tof1 Error Z = " << (*iter_ext)->tof1PosSigmaAlongZ()
235 <<
" Ext Tof2 Error Z = " << (*iter_ext)->tof2PosSigmaAlongZ()
236 <<
" Ext Emc Error theta = " << (*iter_ext)->emcPosSigmaAlongTheta()
237 <<
" Ext Muc Error Z = " << (*iter_ext)->mucPosSigmaAlongZ()
245 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
246 if (!mdcKalTrackCol) {
247 log << MSG::INFO<<
"Could not find MdcKalTrackCol" << endreq;
261 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
262 for (;iter_kal != mdcKalTrackCol->end(); iter_kal++, trackID++) {
264 *dstMdcKalTrack = **iter_kal;
294 (*dstMdcKalTrackCol).push_back(dstMdcKalTrack);
296 log<<MSG::INFO<<
" * * * * * * * * * * * * * * * * * * * * * * * * * * *"<<endreq;
297 for(
int i =0 ; i < 5; i++){
298 log << MSG::INFO<<
"dstMdcKalTrack ZHelix["<<i<<
"] = " <<dstMdcKalTrack->
getZHelix(i) <<endreq;
299 log << MSG::INFO <<
"number of total hits contained ["<<i<<
"]"<<nhits[i]<<endreq;
300 log << MSG::INFO<<
"status flag ["<<i<<
"]"<<stat[i]<<endreq;
301 log << MSG::INFO<<
"dstMdcKalTrack ZError ["<<i<<
"]"<<dstMdcKalTrack->
getZError(i)<<endreq;
302 log << MSG::INFO<<
"dstMdcKalTrack Poca ["<<i<<
"]"<<dstMdcKalTrack->
getPoca(i)<<endreq;
314 MsgStream log(
msgSvc(), name());
315 log << MSG::INFO <<
"in finalize()" << endreq;
317 return StatusCode::SUCCESS;
ObjectVector< DstEmcShower > DstEmcShowerCol
ObjectVector< DstExtTrack > DstExtTrackCol
ObjectVector< DstMdcDedx > DstMdcDedxCol
ObjectVector< DstMdcKalTrack > DstMdcKalTrackCol
ObjectVector< DstMdcTrack > DstMdcTrackCol
ObjectVector< DstMucTrack > DstMucTrackCol
ObjectVector< DstTofTrack > DstTofTrackCol
DstEventMaker(const std::string &name, ISvcLocator *pSvcLocator)
const string tof1VolumeName() const
const HepVector & getZHelix(const int pid) const
const HepSymMatrix & getZError(const int pid) const
const HepPoint3D & getPoca(const int pid) const
_EXTERN_ std::string Event
_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