CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EventNavigator.h
Go to the documentation of this file.
1#ifndef EventNavigator_H
2#define EventNavigator_H
3
4#include <map>
5
6#include "GaudiKernel/Kernel.h"
7#include "GaudiKernel/StreamBuffer.h"
8#include "GaudiKernel/DataObject.h"
9
11
12// Monte-Carlo data
13#include "McTruth/McParticle.h"
14#include "McTruth/MdcMcHit.h"
15#include "McTruth/EmcMcHit.h"
16#include "McTruth/TofMcHit.h"
17#include "McTruth/MucMcHit.h"
18
19// MDC reconstructed data
23
24// EMC reconstructed data
26
27// TOF reconstructed data
28class RecBTofTrack;
29class RecBTofHit;
30class RecETofTrack;
31class RecETofHit;
32
33// MUC reconstructed data
34class RecMucTrack;
35class RecMucHit;
36
37// Digi information
38class MdcDigi;
39
41
42//using namespace Event;
43
44typedef std::multimap <int, int> IndexMap;
45typedef std::vector < pair<const Event::McParticle*,int> > McParticleVectorP;
46typedef std::vector < pair<const RecMdcTrack*,int> > RecMdcTrackVectorP;
47typedef std::vector < pair<const RecMdcKalTrack*,int> > RecMdcKalTrackVectorP;
48typedef std::vector < pair<const RecEmcShower*,int> > RecEmcShowerVectorP;
49typedef std::vector <const Event::McParticle*> McParticleVector;
50typedef std::vector <const RecMdcTrack*> RecMdcTrackVector;
51typedef std::vector <const RecMdcKalTrack*> RecMdcKalTrackVector;
52typedef std::vector <const Event::MdcMcHit*> MdcMcHitVector;
53typedef std::vector <const RecMdcHit*> RecMdcHitVector;
54typedef std::vector <const MdcDigi*> MdcDigiVector;
55typedef std::vector <const Event::EmcMcHit*> EmcMcHitVector;
56typedef std::vector <const RecEmcShower*> RecEmcShowerVector;
57
58static const CLID CLID_EventNavigator = 5101;
59
60// Class EventNavigator
61
62// Provides relation tables to make correspondence between BES3
63// reconstructed data and Monte-Carlo truth
64
65// History: A.Zhemchugov. Created with MDC navigation, 20 Jan 2006
66// A.Zhemchugov. EMC navigation added, 23 Nov 2006
67// A.Zhemchugov. Migrated to new EventModel, 03 Apr 2008
68// A.Zhemchugov. Cut on number of common hits in MDC introduced, 13 Jun 2009
69// A.Zhemchugov. Store Event Navigator to DST, 17 Aug 2011
70// A.Zhemchugov. Add methods to access McParticle relevance, 07 Aug 2012
71
72class EventNavigator : public DataObject {
73
74 public:
75
76 EventNavigator() : DataObject()
77 {
78 m_mdcCut = 7;
79 }
80
81 virtual ~EventNavigator() {}
82
83 /// Retrieve reference to class definition structure
84 virtual const CLID& clID() const { return EventNavigator::classID(); }
85 static const CLID& classID() { return CLID_EventNavigator; }
86
87 void Print();
88
89 // Set cut on the minimum number of common hits of
90 // the MDC tracks and McParticles to make correspondence (default is 2)
91 void setMdcCut( int cut ) { m_mdcCut = cut; };
92
93 //******** Methods to retrieve objPtr via id *******
94 const Event::McParticle* getMcParticle ( int id ) { return m_mcParticleId[id]; };
95 // MDC
96 const RecMdcTrack* getMdcTrack ( int id ) { return m_mdcTrackId[id]; };
97 const RecMdcKalTrack* getMdcKalTrack ( int id ) { return m_mdcKalTrackId[id]; };
98
99 // return MdcMcHits corresponding given detector Id
101
102 const RecMdcHit* getMdcRecHit ( int id ) { return m_mdcRecHitId[id]; };
103 const MdcDigi* getMdcDigi ( int id ) { return m_mdcDigiId[id]; };
104 // EMC
107
108 //******** Methods to handle persistency ************
109 IndexMap& getMcMdcMcHitsIdx(){return m_mcMdcMcHitsIdx;}
110 IndexMap& getMcMdcTracksIdx(){return m_mcMdcTracksIdx;}
111 IndexMap& getMcEmcMcHitsIdx(){return m_mcEmcMcHitsIdx;}
112 IndexMap& getMcEmcRecShowersIdx(){return m_mcEmcRecShowersIdx;}
113 void setMcMdcMcHitsIdx(IndexMap& map){m_mcMdcMcHitsIdx=map;}
114 void setMcMdcTracksIdx(IndexMap& map){m_mcMdcTracksIdx=map;}
115 void setMcEmcMcHitsIdx(IndexMap& map){m_mcEmcMcHitsIdx=map;}
116 void setMcEmcRecShowersIdx(IndexMap& map){m_mcEmcRecShowersIdx=map;}
117
118 //******** Main methods to retrieve relations *******
119 // MC particle
123
124 int getMcParticleRelevance( const RecMdcTrack* key, const Event::McParticle* value );
126 int getMcParticleRelevance( const RecEmcShower* key, const Event::McParticle* value );
127
128 // MDC Tracks
131
132 // Reconstructed EMC showers
134
135 //******** Auxillary methods to retrieve relations **
136 /*
137 RecMdcHitVector& getMdcRecHits ( const McParticle* key );
138 MdcMcHitVector& getMdcMcHits ( const RecMdcTrack* key );
139 RecMdcHitVector& getMdcRecHits ( const MdcMcHit* key );
140 MdcMcHitVector& getMdcMcHits ( const RecMdcHit* key );
141
142 EmcMcHitVector& getEmcMcHits ( const RecEmcShower* key );
143 */
144
145
146 friend class BesNavigatorInit;
147
148 protected:
149
150 // ==== Methods to store id->objPtr lookup maps ====
151 void addIdLink ( int id, Event::McParticle* ptr ) { m_mcParticleId[id] = ptr; };
152
153 // MDC info
154 void addIdLink ( int id, RecMdcTrack* ptr ) {
155 m_mdcTrackId[id] = ptr;
156 };
157
158 void addIdLink ( int id, RecMdcKalTrack* ptr ) {
159 m_mdcKalTrackId[id] = ptr;
160 };
161
162 void addIdLink ( unsigned int id, RecEmcShower* ptr ) {
163 m_emcRecShowerId.insert(pair<int, RecEmcShower*>(id,ptr));
164 };
165
166 // ==== Methods to store relations ====
167 // store list of MdcTracks corresponding given McParticle
168 void addLink( const Event::McParticle* key, const RecMdcTrack* value );
169
170 // store list of McParticles corresponding given MdcTrack
171 void addLink( const RecMdcTrack* key, const Event::McParticle* value );
172
173 // store list of MdcKalTracks corresponding given McParticle
174 void addLink( const Event::McParticle* key, const RecMdcKalTrack* value );
175
176 // store list of McParticles corresponding given MdcKalTrack
177 void addLink( const RecMdcKalTrack* key, const Event::McParticle* value );
178
179 // store list of McParticles corresponding given EmcRecShower
180 void addLink( const RecEmcShower* key, const Event::McParticle* value );
181
182 // store list of EmcShowers corresponding given McParticle
183 void addLink( const Event::McParticle* key, const RecEmcShower* value );
184
185 private:
186 // === lookup maps of id->objPtr relations ===
187 std::map <int, const Event::McParticle*> m_mcParticleId;
188
189 // MDC info
190 std::map <int, const RecMdcTrack*> m_mdcTrackId;
191 std::map <int, const RecMdcKalTrack*> m_mdcKalTrackId;
192 std::map <int, const MdcDigi*> m_mdcDigiId;
193 std::multimap <unsigned int, const Event::MdcMcHit*> m_mdcMcHitId;
194 std::map <unsigned int, const RecMdcHit*> m_mdcRecHitId;
195
196 // ===== relations =====
197 // relation tables to be returned by query
198 std::map <int, RecMdcTrackVector> m_mdcTracksWrtMcParticle;
199 std::map <int, McParticleVector> m_mcParticlesWrtMdcTrack;
200 std::map <int, RecMdcKalTrackVector> m_mdcKalTracksWrtMcParticle;
201 std::map <int, McParticleVector> m_mcParticlesWrtMdcKalTrack;
202
203 // internal version of relation tables to keep number of the same hits for each pair McParticle-MdcTrack
204 std::map <int, RecMdcTrackVectorP> m_mdcTracksWrtMcParticleP;
205 std::map <int, McParticleVectorP> m_mcParticlesWrtMdcTrackP;
206 std::map <int, RecMdcKalTrackVectorP> m_mdcKalTracksWrtMcParticleP;
207 std::map <int, McParticleVectorP> m_mcParticlesWrtMdcKalTrackP;
208
209 // EMC info
210 std::multimap <unsigned int, const RecEmcShower*> m_emcRecShowerId;
211 std::multimap <unsigned int, const Event::EmcMcHit*> m_emcMcHitId;
212
213 // ===== relations =====
214 std::map <int, McParticleVector> m_mcParticlesWrtRecShower;
215 std::map <int, RecEmcShowerVector> m_emcRecShowersWrtMcHit;
216 std::map <int, RecEmcShowerVector> m_emcRecShowersWrtMcParticle;
217 std::map <int, EmcMcHitVector> m_emcMcHitsWrtRecShower;
218 // internal version of relation tables to keep number of the same hits for each pair McParticle-EmcRecShower
219 std::map <int, RecEmcShowerVectorP> m_emcRecShowersWrtMcParticleP;
220 std::map <int, McParticleVectorP> m_mcParticlesWrtRecEmcShowerP;
221
222 // persistency
223 IndexMap m_mcMdcTracksIdx; // id is the same for RecMdcTrack and RecMdcKalTrack
224 IndexMap m_mcMdcMcHitsIdx;
225 IndexMap m_mcEmcRecShowersIdx;
226 IndexMap m_mcEmcMcHitsIdx;
227
228 int m_mdcCut;
229};
230
231#endif // EventNavigator_H
232
std::vector< const RecMdcTrack * > RecMdcTrackVector
std::vector< const Event::McParticle * > McParticleVector
std::vector< const MdcDigi * > MdcDigiVector
std::vector< pair< const Event::McParticle *, int > > McParticleVectorP
std::vector< const RecMdcHit * > RecMdcHitVector
std::vector< pair< const RecMdcKalTrack *, int > > RecMdcKalTrackVectorP
std::vector< const Event::EmcMcHit * > EmcMcHitVector
std::vector< const RecMdcKalTrack * > RecMdcKalTrackVector
std::multimap< int, int > IndexMap
std::vector< const RecEmcShower * > RecEmcShowerVector
std::vector< pair< const RecMdcTrack *, int > > RecMdcTrackVectorP
std::vector< pair< const RecEmcShower *, int > > RecEmcShowerVectorP
std::vector< const Event::MdcMcHit * > MdcMcHitVector
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
Definition KarFin.h:27
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition Taupair.h:42
void addIdLink(unsigned int id, RecEmcShower *ptr)
IndexMap & getMcMdcMcHitsIdx()
EmcMcHitVector getEmcMcHits(int id)
void setMcEmcRecShowersIdx(IndexMap &map)
virtual const CLID & clID() const
Retrieve reference to class definition structure.
static const CLID & classID()
void setMcMdcMcHitsIdx(IndexMap &map)
void setMdcCut(int cut)
RecMdcKalTrackVector & getMdcKalTracks(const Event::McParticle *key)
IndexMap & getMcEmcMcHitsIdx()
virtual ~EventNavigator()
const RecMdcHit * getMdcRecHit(int id)
const RecMdcKalTrack * getMdcKalTrack(int id)
void addLink(const Event::McParticle *key, const RecMdcTrack *value)
const MdcDigi * getMdcDigi(int id)
void addIdLink(int id, RecMdcKalTrack *ptr)
void setMcEmcMcHitsIdx(IndexMap &map)
MdcMcHitVector getMdcMcHits(int id)
const Event::McParticle * getMcParticle(int id)
int getMcParticleRelevance(const RecMdcTrack *key, const Event::McParticle *value)
IndexMap & getMcEmcRecShowersIdx()
McParticleVector & getMcParticles(const RecMdcTrack *key)
RecMdcTrackVector & getMdcTracks(const Event::McParticle *key)
IndexMap & getMcMdcTracksIdx()
void setMcMdcTracksIdx(IndexMap &map)
const RecMdcTrack * getMdcTrack(int id)
void addIdLink(int id, RecMdcTrack *ptr)
RecEmcShowerVector getEmcRecShowers(int id)
void addIdLink(int id, Event::McParticle *ptr)