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 
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
tp_iterator daughterTracks_begin() const
const TrackingParticleRefVector & sourceTracks() const
int event() const
get the contents of the subdetector field (should be protected?)
GenVertexRefVector::iterator genv_iterator
std::vector< SimVertex >::const_iterator g4v_iterator
LorentzVector position_
const std::vector< SimVertex > & g4Vertices() const
g4v_iterator g4Vertices_end() const
const GenVertexRefVector & genVertices() const
void addDaughterTrack(const TrackingParticleRef &)
EncodedEventId eId_
void clearDaughterTracks()
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
void addParentTrack(const TrackingParticleRef &)
const bool inVolume() const
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
g4v_iterator g4Vertices_begin() const
void addG4Vertex(const SimVertex &)
math::XYZTLorentzVectorD LorentzVector
genv_iterator genVertices_end() const
TrackingParticleRefVector daughterTracks_
friend std::ostream & operator<<(std::ostream &s, const TrackingVertex &tv)
GenVertexRefVector genVertices_
int bunchCrossing() const
get the detector field from this detid
tp_iterator daughterTracks_end() const
tp_iterator sourceTracks_begin() const
void clear()
Clear the vector.
Definition: RefVector.h:142
tp_iterator sourceTracks_end() const
void clearParentTracks()
std::vector< SimVertex > g4Vertices_
void addGenVertex(const GenVertexRef &)
edm::RefVector< edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector
const EncodedEventId & eventId() const
const TrackingParticleRefVector & daughterTracks() const
TrackingParticleRefVector::iterator tp_iterator
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
TrackingParticleRefVector sourceTracks_
genv_iterator genVertices_begin() const
const LorentzVector & position() const
TrackingParticle::g4t_iterator g4t_iterator