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.
3 
6 
7 // Constructors
8 
9 TrackingVertex::TrackingVertex() : position_(LorentzVector(0,0,0,0)), eId_(0)
10 {
11 // daughterTracks_.clear();
12 }
13 
14 TrackingVertex::TrackingVertex(const LorentzVector &p, const bool inVolume, const EncodedEventId eId) :
15  position_(p), inVolume_(inVolume), eId_(eId)
16 {
17 // daughterTracks_.clear();
18 }
19 
20 // Add a reference to vertex vectors
21 
23 {
24  g4Vertices_.push_back(v);
25 }
26 
28 {
30 }
31 
32 // Add a reference to track vectors
33 
35 {
37 }
38 
40 {
42 }
43 
45 {
47 }
48 
50 {
52 }
53 
54 
55 // Iterators over vertices and tracks
56 
58 {
59  return genVertices_.begin();
60 }
62 {
63  return genVertices_.end();
64 }
66 {
67  return g4Vertices_.begin();
68 }
70 {
71  return g4Vertices_.end();
72 }
73 
75 {
76  return daughterTracks_.begin();
77 }
79 {
80  return daughterTracks_.end();
81 }
83 {
84  return sourceTracks_.begin();
85 }
87 {
88  return sourceTracks_.end();
89 }
90 
91 // Accessors for whole vectors
92 
93 const std::vector<SimVertex>& TrackingVertex::g4Vertices() const
94 {
95  return g4Vertices_;
96 }
98 {
99  return genVertices_;
100 }
102 {
103  return sourceTracks_;
104 }
106 {
107  return daughterTracks_;
108 }
109 
110 std::ostream& operator<< (std::ostream& s, const TrackingVertex & v)
111 {
112 
113  using std::endl;
115  typedef std::vector<SimVertex>::const_iterator g4v_iterator;
117  typedef std::vector<SimTrack>::const_iterator g4t_iterator;
118 
119  s << "Vertex Position & Event #" << v.position() << " " << v.eventId().bunchCrossing() << "." << v.eventId().event() << endl;
120  s << " Associated with " << v.daughterTracks().size() << " tracks" << endl;
121  for (genv_iterator genV = v.genVertices_begin(); genV != v.genVertices_end(); ++genV)
122  {
123  s << " HepMC vertex position " << (*(*genV)).position().x() << ","<< (*(*genV)).position().y() << (*(*genV)).position().z() << endl;
124  }
125 
126  for (g4v_iterator g4V = v.g4Vertices_begin(); g4V != v.g4Vertices_end(); ++g4V)
127  {
128  s << " Geant vertex position " << (*g4V).position() << endl;
129  // Probably empty all the time, currently
130  }
131 
132  // Loop over daughter track(s)
133  for (tp_iterator iTP = v.daughterTracks_begin(); iTP != v.daughterTracks_end(); ++iTP)
134  {
135  s << " Daughter starts: " << (*(*iTP)).vertex();
136  for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T != (*(*iTP)).g4Track_end(); ++g4T)
137  {
138  s << " p " << g4T->momentum();
139  }
140  s << endl;
141  }
142 
143  // Loop over source track(s) (can be multiple since vertices are collapsed)
144  for (tp_iterator iTP = v.sourceTracks_begin(); iTP != v.sourceTracks_end(); ++iTP)
145  {
146  s << " Source starts: " << (*(*iTP)).vertex();
147  for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T != (*iTP)->g4Track_end(); ++g4T)
148  {
149  s << ", p " << g4T ->momentum();
150  }
151  s << endl;
152  }
153  return s;
154 }
155 
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
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:242
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:237
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:129
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:61
size_type size() const
Size of the RefVector.
Definition: RefVector.h:85
string s
Definition: asciidump.py:422
TrackingParticleRefVector::iterator tp_iterator
TrackingParticleRefVector sourceTracks_
genv_iterator genVertices_begin() const
mathSSE::Vec4< T > v
const LorentzVector & position() const
TrackingParticle::g4t_iterator g4t_iterator