CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingVertex.cc
Go to the documentation of this file.
4 
7 
8 // Constructors
9 
10 TrackingVertex::TrackingVertex() : position_(LorentzVector(0,0,0,0)), eId_(0)
11 {
12 // daughterTracks_.clear();
13 }
14 
15 TrackingVertex::TrackingVertex(const LorentzVector &p, const bool inVolume, const EncodedEventId eId) :
16  position_(p), inVolume_(inVolume), eId_(eId)
17 {
18 // daughterTracks_.clear();
19 }
20 
21 // Add a reference to vertex vectors
22 
24 {
25  g4Vertices_.push_back(v);
26 }
27 
29 {
31 }
32 
33 // Add a reference to track vectors
34 
36 {
38 }
39 
41 {
43 }
44 
46 {
48 }
49 
51 {
53 }
54 
55 
56 // Iterators over vertices and tracks
57 
59 {
60  return genVertices_.begin();
61 }
63 {
64  return genVertices_.end();
65 }
67 {
68  return g4Vertices_.begin();
69 }
71 {
72  return g4Vertices_.end();
73 }
74 
76 {
77  return daughterTracks_.begin();
78 }
80 {
81  return daughterTracks_.end();
82 }
84 {
85  return sourceTracks_.begin();
86 }
88 {
89  return sourceTracks_.end();
90 }
91 
92 // Accessors for whole vectors
93 
94 const std::vector<SimVertex>& TrackingVertex::g4Vertices() const
95 {
96  return g4Vertices_;
97 }
99 {
100  return genVertices_;
101 }
103 {
104  return sourceTracks_;
105 }
107 {
108  return daughterTracks_;
109 }
110 
111 std::ostream& operator<< (std::ostream& s, const TrackingVertex & v)
112 {
113 
114  using std::endl;
116  typedef std::vector<SimVertex>::const_iterator g4v_iterator;
118  typedef std::vector<SimTrack>::const_iterator g4t_iterator;
119 
120  s << "Vertex Position & Event #" << v.position() << " " << v.eventId().bunchCrossing() << "." << v.eventId().event() << endl;
121  s << " Associated with " << v.daughterTracks().size() << " tracks" << endl;
122  for (genv_iterator genV = v.genVertices_begin(); genV != v.genVertices_end(); ++genV)
123  {
124  s << " HepMC vertex position " << (*(*genV)).position().x() << ","<< (*(*genV)).position().y() << (*(*genV)).position().z() << endl;
125  }
126 
127  for (g4v_iterator g4V = v.g4Vertices_begin(); g4V != v.g4Vertices_end(); ++g4V)
128  {
129  s << " Geant vertex position " << (*g4V).position() << endl;
130  // Probably empty all the time, currently
131  }
132 
133  // Loop over daughter track(s)
134  for (tp_iterator iTP = v.daughterTracks_begin(); iTP != v.daughterTracks_end(); ++iTP)
135  {
136  s << " Daughter starts: " << (*(*iTP)).vertex();
137  for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T != (*(*iTP)).g4Track_end(); ++g4T)
138  {
139  s << " p " << g4T->momentum();
140  }
141  s << endl;
142  }
143 
144  // Loop over source track(s) (can be multiple since vertices are collapsed)
145  for (tp_iterator iTP = v.sourceTracks_begin(); iTP != v.sourceTracks_end(); ++iTP)
146  {
147  s << " Source starts: " << (*(*iTP)).vertex();
148  for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T != (*iTP)->g4Track_end(); ++g4T)
149  {
150  s << ", p " << g4T ->momentum();
151  }
152  s << endl;
153  }
154  return s;
155 }
156 
tp_iterator daughterTracks_begin() const
const TrackingParticleRefVector & sourceTracks() const
int event() const
get the contents of the subdetector field (should be protected?)
TrackingVertex::g4v_iterator g4v_iterator
std::vector< SimVertex >::const_iterator g4v_iterator
const std::vector< SimVertex > & g4Vertices() const
g4v_iterator g4Vertices_end() const
const GenVertexRefVector & genVertices() const
TrackingParticleRefVector::iterator tp_iterator
void addDaughterTrack(const TrackingParticleRef &)
void clearDaughterTracks()
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
void addParentTrack(const TrackingParticleRef &)
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
g4v_iterator g4Vertices_begin() const
void addG4Vertex(const SimVertex &)
math::XYZTLorentzVectorD LorentzVector
genv_iterator genVertices_end() const
TrackingParticleRefVector daughterTracks_
TrackingVertex::genv_iterator genv_iterator
edm::RefVector< edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector
GenVertexRefVector genVertices_
int bunchCrossing() const
get the detector field from this detid
tp_iterator daughterTracks_end() const
tp_iterator sourceTracks_begin() const
edm::Ref< edm::HepMCProduct, HepMC::GenVertex > GenVertexRef
void clear()
Clear the vector.
Definition: RefVector.h:133
tp_iterator sourceTracks_end() const
void clearParentTracks()
std::vector< SimVertex > g4Vertices_
void addGenVertex(const GenVertexRef &)
const EncodedEventId & eventId() const
const TrackingParticleRefVector & daughterTracks() const
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
TrackingParticleRefVector sourceTracks_
genv_iterator genVertices_begin() const
const LorentzVector & position() const
TrackingParticle::g4t_iterator g4t_iterator