test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingParticle.cc
Go to the documentation of this file.
3 
5 
7 
8 const unsigned int TrackingParticle::longLivedTag = 65536;
9 
11 {
12  // No operation
13 }
14 
15 TrackingParticle::TrackingParticle( const SimTrack& simtrk, const TrackingVertexRef& parentVertex )
16 {
17  addG4Track( simtrk );
18  setParentVertex( parentVertex );
19 }
20 
22 {
23 }
24 
26 {
27  genParticles_.push_back( ref );
28 }
29 
31 {
32  g4Tracks_.push_back( t );
33 }
34 
36 {
37  return genParticles_.begin();
38 }
39 
41 {
42  return genParticles_.end();
43 }
44 
46 {
47  return g4Tracks_.begin();
48 }
49 
51 {
52  return g4Tracks_.end();
53 }
54 
56 {
57  parentVertex_=ref;
58 }
59 
61 {
63 }
64 
66 {
68 }
69 
71 {
73 }
74 
76 {
77  edm::LogWarning("TrackingParticle") << "The method matchedHit() has been deprecated. Use numberOfTrackerLayers() instead.";
79 }
80 
81 
82 void TrackingParticle::setNumberOfHits( int numberOfHits )
83 {
85 }
86 
87 void TrackingParticle::setNumberOfTrackerHits( int numberOfTrackerHits )
88 {
90 }
91 
92 void TrackingParticle::setNumberOfTrackerLayers( const int numberOfTrackerLayers )
93 {
95 }
96 
97 std::ostream& operator<< (std::ostream& s, TrackingParticle const & tp)
98 {
99  s << "TP momentum, q, ID, & Event #: "
100  << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
101  << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
102 
103  for (TrackingParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT)
104  {
105  s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
106  }
107 
108  for (TrackingParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T)
109  {
110  s << " Geant Track Momentum " << g4T->momentum() << std::endl;
111  s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
112  if (g4T->type() != tp.pdgId())
113  {
114  s << " Mismatch b/t TrackingParticle and Geant types" << std::endl;
115  }
116  }
117  // Loop over decay vertices
118  s << " TP Vertex " << tp.vertex() << std::endl;
119  s << " Source vertex: " << tp.parentVertex()->position() << std::endl;
120  s << " " << tp.decayVertices().size() << " Decay vertices" << std::endl;
121  for (tv_iterator iTV = tp.decayVertices_begin(); iTV != tp.decayVertices_end(); ++iTV)
122  {
123  s << " Decay vertices: " << (**iTV).position() << std::endl;
124  }
125 
126  return s;
127 }
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
genp_iterator genParticle_begin() const
iterators
tv_iterator decayVertices_end() const
int event() const
get the contents of the subdetector field (should be protected?)
tv_iterator decayVertices_begin() const
TrackingVertexRefVector decayVertices_
g4t_iterator g4Track_begin() const
int pdgId() const
PDG ID.
TrackingParticle()
Default constructor. Note that the object will be useless until it is provided with a SimTrack and pa...
int matchedHit() const
int numberOfTrackerHits_
The number of tracker only hits.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
void setParentVertex(const TrackingVertexRef &ref)
void addGenParticle(const reco::GenParticleRef &ref)
reco::GenParticleRefVector genParticles_
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
int bunchCrossing() const
get the detector field from this detid
void addG4Track(const SimTrack &t)
int numberOfTrackerLayers() const
The number of tracker layers with a hit.
int numberOfHits_
The total number of hits.
std::vector< SimTrack > g4Tracks_
references to G4 and reco::GenParticle tracks
const TrackingVertexRef & parentVertex() const
std::vector< SimTrack >::const_iterator g4t_iterator
edm::Ref< TrackingVertexCollection > TrackingVertexRef
genp_iterator genParticle_end() const
void clear()
Clear the vector.
Definition: RefVector.h:139
void addDecayVertex(const TrackingVertexRef &ref)
int numberOfHits() const
Gives the total number of hits, including muon hits. Hits on overlaps in the same layer count separat...
Point vertex() const
Parent vertex position.
EncodedEventId eventId() const
Signal source, crossing number.
void setNumberOfTrackerHits(int numberOfTrackerHits)
int numberOfTrackerLayers_
The number of tracker layers with hits. Equivalent to the old matchedHit.
static const unsigned int longLivedTag
long lived flag
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:62
size_type size() const
Size of the RefVector.
Definition: RefVector.h:99
Monte Carlo truth information used for tracking validation.
int numberOfTrackerHits() const
The number of hits in the tracker. Hits on overlaps in the same layer count separately.
void setNumberOfTrackerLayers(const int numberOfTrackerLayers)
g4t_iterator g4Track_end() const
const TrackingVertexRefVector & decayVertices() const
TrackingVertexRef parentVertex_
void setNumberOfHits(int numberOfHits)