CMS 3D CMS Logo

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  // daughterTracks_.clear();
12 }
13 
14 TrackingVertex::TrackingVertex(const LorentzVector& p, const bool inVolume, const EncodedEventId eId)
15  : position_(p), inVolume_(inVolume), eId_(eId) {
16  // daughterTracks_.clear();
17 }
18 
19 // Add a reference to vertex vectors
20 
21 void TrackingVertex::addG4Vertex(const SimVertex& v) { g4Vertices_.push_back(v); }
22 
24 
25 // Add a reference to track vectors
26 
28 
30 
32 
34 
35 // Iterators over vertices and tracks
36 
41 
46 
47 // Accessors for whole vectors
48 
49 const std::vector<SimVertex>& TrackingVertex::g4Vertices() const { return g4Vertices_; }
53 
54 std::ostream& operator<<(std::ostream& s, const TrackingVertex& v) {
55  using std::endl;
57  typedef std::vector<SimVertex>::const_iterator g4v_iterator;
59  typedef std::vector<SimTrack>::const_iterator g4t_iterator;
60 
61  s << "Vertex Position & Event #" << v.position() << " " << v.eventId().bunchCrossing() << "." << v.eventId().event()
62  << endl;
63  s << " Associated with " << v.daughterTracks().size() << " tracks" << endl;
64  for (genv_iterator genV = v.genVertices_begin(); genV != v.genVertices_end(); ++genV) {
65  s << " HepMC vertex position " << (*(*genV)).position().x() << "," << (*(*genV)).position().y()
66  << (*(*genV)).position().z() << endl;
67  }
68 
69  for (g4v_iterator g4V = v.g4Vertices_begin(); g4V != v.g4Vertices_end(); ++g4V) {
70  s << " Geant vertex position " << (*g4V).position() << endl;
71  // Probably empty all the time, currently
72  }
73 
74  // Loop over daughter track(s)
75  for (tp_iterator iTP = v.daughterTracks_begin(); iTP != v.daughterTracks_end(); ++iTP) {
76  s << " Daughter starts: " << (*(*iTP)).vertex();
77  for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T != (*(*iTP)).g4Track_end(); ++g4T) {
78  s << " p " << g4T->momentum();
79  }
80  s << endl;
81  }
82 
83  // Loop over source track(s) (can be multiple since vertices are collapsed)
84  for (tp_iterator iTP = v.sourceTracks_begin(); iTP != v.sourceTracks_end(); ++iTP) {
85  s << " Source starts: " << (*(*iTP)).vertex();
86  for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T != (*iTP)->g4Track_end(); ++g4T) {
87  s << ", p " << g4T->momentum();
88  }
89  s << endl;
90  }
91  return s;
92 }
edm::Ref< edm::HepMCProduct, HepMC::GenVertex > GenVertexRef
TrackingVertex::g4v_iterator g4v_iterator
std::vector< SimVertex >::const_iterator g4v_iterator
tp_iterator sourceTracks_end() const
void addDaughterTrack(const TrackingParticleRef &)
void clearDaughterTracks()
tp_iterator daughterTracks_begin() const
void addParentTrack(const TrackingParticleRef &)
void addG4Vertex(const SimVertex &)
math::XYZTLorentzVectorD LorentzVector
TrackingParticleRefVector daughterTracks_
std::ostream & operator<<(std::ostream &s, const TrackingVertex &v)
TrackingVertex::genv_iterator genv_iterator
GenVertexRefVector genVertices_
genv_iterator genVertices_end() const
const TrackingParticleRefVector & sourceTracks() const
void clear()
Clear the vector.
Definition: RefVector.h:142
void clearParentTracks()
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
std::vector< SimVertex > g4Vertices_
const TrackingParticleRefVector & daughterTracks() const
tp_iterator sourceTracks_begin() const
void addGenVertex(const GenVertexRef &)
edm::RefVector< edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector
tp_iterator daughterTracks_end() const
const std::vector< SimVertex > & g4Vertices() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
TrackingParticleRefVector::iterator tp_iterator
g4v_iterator g4Vertices_end() const
TrackingParticleRefVector sourceTracks_
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
genv_iterator genVertices_begin() const
g4v_iterator g4Vertices_begin() const
const GenVertexRefVector & genVertices() const
TrackingParticle::g4t_iterator g4t_iterator