CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  // No operation
13 }
14 
16  addG4Track(simtrk);
17  event_ = simtrk.eventId();
18  particleId_ = simtrk.trackId();
19 
20  theMomentum_.SetPxPyPzE(
21  simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E());
22 }
23 
24 SimCluster::SimCluster(EncodedEventId eventID, uint32_t particleID) {
25  event_ = eventID;
26  particleId_ = particleID;
27 }
28 
30 
31 std::ostream &operator<<(std::ostream &s, SimCluster const &tp) {
32  s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
33  << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
34 
35  for (SimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) {
36  s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
37  }
38 
39  for (SimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) {
40  s << " Geant Track Momentum " << g4T->momentum() << std::endl;
41  s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
42  if (g4T->type() != tp.pdgId()) {
43  s << " Mismatch b/t SimCluster and Geant types" << std::endl;
44  }
45  }
46  s << " # of cells = " << tp.hits_.size()
47  << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl;
48  return s;
49 }
EncodedEventId eventId() const
Definition: CoreSimTrack.h:28
int event() const
get the contents of the subdetector field (should be protected?)
void addG4Track(const SimTrack &t)
Definition: SimCluster.h:72
int pdgId() const
PDG ID.
Definition: SimCluster.h:55
EncodedEventId event_
Definition: SimCluster.h:223
std::vector< SimTrack >::const_iterator g4t_iterator
Definition: SimCluster.h:41
EncodedEventId eventId() const
Signal source, crossing number.
Definition: SimCluster.h:66
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
genp_iterator genParticle_end() const
Definition: SimCluster.h:75
std::vector< uint32_t > hits_
Definition: SimCluster.h:227
Monte Carlo truth information used for tracking validation.
Definition: SimCluster.h:29
int bunchCrossing() const
get the detector field from this detid
std::vector< float > fractions_
Definition: SimCluster.h:228
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:85
unsigned int trackId() const
Definition: CoreSimTrack.h:31
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
uint32_t particleId_
Definition: SimCluster.h:225
g4t_iterator g4Track_begin() const
Definition: SimCluster.h:76
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:74
g4t_iterator g4Track_end() const
Definition: SimCluster.h:77
static const unsigned int longLivedTag
long lived flag
Definition: SimCluster.h:163
math::XYZTLorentzVectorF theMomentum_
Definition: SimCluster.h:231