test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HistoryBase.h
Go to the documentation of this file.
1 #ifndef HistoryBase_h
2 #define HistoryBase_h
3 
4 #include <set>
5 
10 
13 {
14 
15 public:
16 
18  typedef std::vector<const HepMC::GenParticle *> GenParticleTrail;
19 
21  typedef std::vector<const HepMC::GenVertex *> GenVertexTrail;
22 
24  typedef std::set<const HepMC::GenVertex *> GenVertexTrailHelper;
25 
27  typedef std::vector<TrackingParticleRef> SimParticleTrail;
28 
30  typedef std::vector<TrackingVertexRef> SimVertexTrail;
31 
32  // Default constructor
34  {
35  // Default depth
36  depth_ = -1;
37  }
38 
40  /* Set TrackHistory to given depth. Positive values
41  constrain the number of TrackingVertex visit in the history.
42  Negatives values set the limit of the iteration over generated
43  information i.e. (-1 -> status 1 or -2 -> status 2 particles).
44 
45  /param[in] depth the history
46  */
47  void depth(int d)
48  {
49  depth_ = d;
50  }
51 
54  {
55  return simVertexTrail_;
56  }
57 
60  {
61  return simParticleTrail_;
62  }
63 
66  {
67  return genVertexTrail_;
68  }
69 
72  {
73  return genParticleTrail_;
74  }
75 
78  {
79  return simParticleTrail_[0];
80  }
81 
83  const TrackingVertexRef & simVertex() const
84  {
85  return simVertexTrail_[0];
86  }
87 
90  {
91  if ( genParticleTrail_.empty() ) return 0;
92  return genParticleTrail_[genParticleTrail_.size()-1];
93  }
94 
95 protected:
96 
97  // History cointainers
102 
103  // Helper function to speedup search
105 
107  /* Return false when the history cannot be determined upto a given depth.
108  If not depth is pass to the function no restriction are apply to it.
109 
110  /param[in] TrackingParticleRef of a simulated track
111  /param[in] depth of the track history
112  /param[out] boolean that is true when history can be determined
113  */
115  {
116  resetTrails(tpr);
117  return traceSimHistory(tpr, depth_);
118  }
119 
121  /* Return false when the history cannot be determined upto a given depth.
122  If not depth is pass to the function no restriction are apply to it.
123 
124  /param[in] TrackingVertexRef of a simulated vertex
125  /param[in] depth of the track history
126  /param[out] boolean that is true when history can be determined
127  */
129  {
130  resetTrails();
131  return traceSimHistory(tvr, depth_);
132  }
133 
134 private:
135 
136  int depth_;
137 
139  bool traceSimHistory (TrackingParticleRef const &, int);
140 
142  bool traceSimHistory (TrackingVertexRef const &, int);
143 
145  void traceGenHistory (HepMC::GenParticle const *);
146 
148  void traceGenHistory (HepMC::GenVertex const *);
149 
151  void resetTrails()
152  {
153  simParticleTrail_.clear();
154  simVertexTrail_.clear();
155  genVertexTrail_.clear();
156  genParticleTrail_.clear();
157  genVertexTrailHelper_.clear();
158  }
159 
161  {
162  resetTrails();
163  simParticleTrail_.push_back(tpr);
164  }
165 };
166 
167 #endif
std::set< const HepMC::GenVertex * > GenVertexTrailHelper
GenVertex trail helper type.
Definition: HistoryBase.h:24
void resetTrails()
Reset trail functions.
Definition: HistoryBase.h:151
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
Definition: HistoryBase.h:53
const TrackingParticleRef & simParticle() const
Return the initial tracking particle from the history.
Definition: HistoryBase.h:77
SimVertexTrail simVertexTrail_
Definition: HistoryBase.h:100
std::vector< const HepMC::GenParticle * > GenParticleTrail
GenParticle trail type.
Definition: HistoryBase.h:18
GenVertexTrail genVertexTrail_
Definition: HistoryBase.h:98
void traceGenHistory(HepMC::GenParticle const *)
Trace all the simulated information for a given pointer to a GenParticle.
Definition: HistoryBase.cc:8
GenVertexTrailHelper genVertexTrailHelper_
Definition: HistoryBase.h:104
void resetTrails(TrackingParticleRef tpr)
Definition: HistoryBase.h:160
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
Definition: HistoryBase.h:21
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
Definition: HistoryBase.h:83
SimParticleTrail simParticleTrail_
Definition: HistoryBase.h:101
Base class to all the history types.
Definition: HistoryBase.h:12
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
Definition: HistoryBase.h:59
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:114
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:47
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:128
bool traceSimHistory(TrackingParticleRef const &, int)
Trace all the simulated information for a given reference to a TrackingParticle.
Definition: HistoryBase.cc:39
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
Definition: HistoryBase.h:65
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Definition: HistoryBase.h:30
GenParticleTrail genParticleTrail_
Definition: HistoryBase.h:99
GenParticleTrail const & genParticleTrail() const
Return all generated particle in the history.
Definition: HistoryBase.h:71
const HepMC::GenParticle * genParticle() const
Returns a pointer to most primitive status 1 or 2 particle.
Definition: HistoryBase.h:89
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.
Definition: HistoryBase.h:27