CMS 3D CMS Logo

SimCluster.cc
Go to the documentation of this file.
2 
4 
6 
7 #include <numeric>
8 
9 const unsigned int SimCluster::longLivedTag = 65536;
10 
12 {
13  // No operation
14 }
15 
17 {
18  addG4Track( simtrk );
19  event_ = simtrk.eventId();
20  particleId_ = simtrk.trackId();
21 
22  theMomentum_.SetPxPyPzE(simtrk.momentum().px(),
23  simtrk.momentum().py(),
24  simtrk.momentum().pz(),
25  simtrk.momentum().E());
26 }
27 
29 {
30  event_ = eventID;
32 }
33 
35 {
36 }
37 
38 std::ostream& operator<< (std::ostream& s, SimCluster const & tp)
39 {
40  s << "CP momentum, q, ID, & Event #: "
41  << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
42  << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
43 
44  for (SimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT)
45  {
46  s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
47  }
48 
49  for (SimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T)
50  {
51  s << " Geant Track Momentum " << g4T->momentum() << std::endl;
52  s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
53  if (g4T->type() != tp.pdgId())
54  {
55  s << " Mismatch b/t SimCluster and Geant types" << std::endl;
56  }
57  }
58  s << " # of cells = " << tp.hits_.size()
59  << ", effective cells = " << std::accumulate(tp.fractions_.begin(),tp.fractions_.end(),0.f) << std::endl;
60  return s;
61 }
EncodedEventId eventId() const
Definition: CoreSimTrack.h:31
int event() const
get the contents of the subdetector field (should be protected?)
void addG4Track(const SimTrack &t)
Definition: SimCluster.h:73
int pdgId() const
PDG ID.
Definition: SimCluster.h:54
friend std::ostream & operator<<(std::ostream &s, SimCluster const &tp)
Definition: SimCluster.cc:38
EncodedEventId event_
Definition: SimCluster.h:232
std::vector< SimTrack >::const_iterator g4t_iterator
Definition: SimCluster.h:40
EncodedEventId eventId() const
Signal source, crossing number.
Definition: SimCluster.h:63
genp_iterator genParticle_end() const
Definition: SimCluster.h:76
std::vector< uint32_t > hits_
Definition: SimCluster.h:236
Monte Carlo truth information used for tracking validation.
Definition: SimCluster.h:28
int bunchCrossing() const
get the detector field from this detid
std::vector< float > fractions_
Definition: SimCluster.h:237
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:86
unsigned int trackId() const
Definition: CoreSimTrack.h:34
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:22
uint32_t particleId_
Definition: SimCluster.h:234
g4t_iterator g4Track_begin() const
Definition: SimCluster.h:77
const math::XYZTLorentzVectorF & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:91
genp_iterator genParticle_begin() const
iterators
Definition: SimCluster.h:75
g4t_iterator g4Track_end() const
Definition: SimCluster.h:78
static const unsigned int longLivedTag
long lived flag
Definition: SimCluster.h:192
math::XYZTLorentzVectorF theMomentum_
Definition: SimCluster.h:239