StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StG2TrackVertexMap.h
1 #ifndef __StG2TrackVertexMap_h__
2 #define __StG2TrackVertexMap_h__
3 #include <map>
4 #include "Rtypes.h"
5 #include "tables/St_g2t_track_Table.h"
6 #include "tables/St_g2t_vertex_Table.h"
8  public:
9  static StG2TrackVertexMap* instance(St_g2t_track *track=0, St_g2t_vertex *vertex = 0);
10  void Reset(St_g2t_track *track, St_g2t_vertex *vertex);
11  virtual ~StG2TrackVertexMap() {fgInstance = 0;}
12  Int_t IdVertex(Int_t IdTrack) {return fTrack2Vertex.empty() ? -1 : fTrack2Vertex.find(IdTrack)->second;}
13  Int_t IdParentTrack(Int_t IdVertex) {return fVertex2ParentTrack.empty() ? -1 : fVertex2ParentTrack.find(IdVertex)->second;}
14  private:
15  StG2TrackVertexMap(St_g2t_track *track=0, St_g2t_vertex *vertex = 0) : fTrack(track), fVertex(vertex) {Reset(track,vertex);}
16  St_g2t_track *fTrack;
17  St_g2t_vertex *fVertex;
18  std::map<Int_t,Int_t> fTrack2Vertex;
19  std::map<Int_t,Int_t> fVertex2ParentTrack;
20  static StG2TrackVertexMap* fgInstance;
21 };
22 #endif