CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Friends
MtdSimCluster Class Reference

#include <MtdSimCluster.h>

Inheritance diagram for MtdSimCluster:
SimCluster MtdSimLayerCluster MtdSimTrackster

Public Member Functions

void addHitAndFraction (uint64_t hit, float fraction)
 add hit with fraction More...
 
void addHitPosition (LocalPoint pos)
 add hit position More...
 
void addHitTime (float time)
 add hit time More...
 
void addSimHit (const PSimHit &hit)
 add simhit's energy to cluster More...
 
void clear ()
 
void clearHitsAndFractions ()
 clear the hits and fractions list More...
 
void clearHitsPosition ()
 clear the positions list More...
 
void clearHitsTime ()
 clear the times list More...
 
std::vector< std::pair< uint32_t, std::pair< uint8_t, uint8_t > > > detIds_and_rows () const
 Returns list of detIds, rows and columns for this SimCluster. More...
 
std::vector< std::pair< uint64_t, float > > hits_and_energies () const
 Returns list of hit IDs and energies for this SimCluster. More...
 
std::vector< std::pair< uint64_t, float > > hits_and_fractions () const
 Returns list of hit IDs and fractions for this SimCluster. More...
 
std::vector< std::pair< uint64_t, LocalPoint > > hits_and_positions () const
 Returns list of hit IDs and times for this SimCluster. More...
 
std::vector< std::pair< uint64_t, float > > hits_and_times () const
 Returns list of hit IDs and times for this SimCluster. More...
 
 MtdSimCluster ()
 
 MtdSimCluster (const SimTrack &simtrk)
 
 MtdSimCluster (EncodedEventId eventID, uint32_t particleID)
 
void setTrackIdOffset (unsigned int offset)
 
unsigned int trackIdOffset () const
 
 ~MtdSimCluster ()
 
- Public Member Functions inherited from SimCluster
void addG4Track (const SimTrack &t)
 
void addGenParticle (const reco::GenParticleRef &ref)
 
void addHitEnergy (float energy)
 add rechit energy More...
 
void addRecHitAndFraction (uint32_t hit, float fraction)
 add rechit with fraction More...
 
void addSimHit (const PCaloHit &hit)
 add simhit's energy to cluster More...
 
std::vector< std::pair< uint32_t, float > > barrel_hits_and_fractions () const
 Returns list of rechit IDs and fractions in the barrel for this SimCluster. More...
 
math::XYZVectorF boostToCM () const
 Vector to boost to the particle centre of mass frame. More...
 
float charge () const
 Electric charge. Note this is taken from the first SimTrack only. More...
 
void clearHitsAndFractions ()
 clear the hits and fractions list More...
 
void clearHitsEnergy ()
 clear the energies list More...
 
std::vector< std::pair< uint32_t, float > > endcap_hits_and_fractions () const
 Returns list of rechit IDs and fractions in the endcap for this SimCluster. More...
 
float energy () const
 Energy. Note this is taken from the first SimTrack only. More...
 
float et () const
 Transverse energy. Note this is taken from the first SimTrack only. More...
 
float eta () const
 Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter. More...
 
EncodedEventId eventId () const
 Signal source, crossing number. More...
 
g4t_iterator g4Track_begin () const
 
g4t_iterator g4Track_end () const
 
const std::vector< SimTrack > & g4Tracks () const
 
genp_iterator genParticle_begin () const
 iterators More...
 
genp_iterator genParticle_end () const
 
const reco::GenParticleRefVectorgenParticles () const
 
std::vector< std::pair< uint32_t, float > > hits_and_energies () const
 Returns list of rechit IDs and energies for this SimCluster. More...
 
std::vector< std::pair< uint32_t, float > > hits_and_fractions () const
 Returns list of rechit IDs and fractions for this SimCluster. More...
 
bool longLived () const
 is long lived? More...
 
float mass () const
 Mass. Note this is taken from the first SimTrack only. More...
 
float massSqr () const
 Mass squared. Note this is taken from the first SimTrack only. More...
 
math::XYZVectorF momentum () const
 spatial momentum vector More...
 
float mt () const
 Transverse mass. Note this is taken from the first SimTrack only. More...
 
float mtSqr () const
 Transverse mass squared. Note this is taken from the first SimTrack only. More...
 
int numberOfRecHits () const
 Gives the total number of SimHits, in the cluster. More...
 
int numberOfSimHits () const
 Gives the total number of SimHits, in the cluster. More...
 
float p () const
 Magnitude of momentum vector. Note this is taken from the first SimTrack only. More...
 
const math::XYZTLorentzVectorFp4 () const
 Four-momentum Lorentz vector. Note this is taken from the first SimTrack only. More...
 
uint64_t particleId () const
 
int pdgId () const
 PDG ID. More...
 
float phi () const
 Momentum azimuthal angle. Note this is taken from the first SimTrack only. More...
 
float pt () const
 Transverse momentum. Note this is taken from the first SimTrack only. More...
 
float px () const
 x coordinate of momentum vector. Note this is taken from the first SimTrack only. More...
 
float py () const
 y coordinate of momentum vector. Note this is taken from the first SimTrack only. More...
 
float pz () const
 z coordinate of momentum vector. Note this is taken from the first SimTrack only. More...
 
float rapidity () const
 Rapidity. Note this is taken from the simtrack before the calorimeter. More...
 
 SimCluster ()
 
 SimCluster (const SimTrack &simtrk)
 
 SimCluster (EncodedEventId eventID, uint32_t particleID)
 
float simEnergy () const
 returns the accumulated sim energy in the cluster More...
 
int status () const
 Status word. More...
 
float theta () const
 Momentum polar angle. Note this is taken from the first SimTrack only. More...
 
int threeCharge () const
 Gives charge in unit of quark charge (should be 3 times "charge()") More...
 
float y () const
 Same as rapidity(). More...
 
 ~SimCluster ()
 

Protected Attributes

unsigned int idOffset_ {0}
 
std::vector< uint64_t > mtdHits_
 
std::vector< LocalPointpositions_
 
std::vector< float > times_
 
- Protected Attributes inherited from SimCluster
std::vector< float > energies_
 
EncodedEventId event_
 
std::vector< float > fractions_
 
std::vector< SimTrackg4Tracks_
 references to G4 and reco::GenParticle tracks More...
 
reco::GenParticleRefVector genParticles_
 
std::vector< uint32_t > hits_
 
uint64_t nsimhits_ {0}
 
uint32_t particleId_ {0}
 
float simhit_energy_ {0.f}
 
math::XYZTLorentzVectorF theMomentum_
 

Friends

std::ostream & operator<< (std::ostream &s, MtdSimCluster const &tp)
 

Additional Inherited Members

- Public Types inherited from SimCluster
typedef int Charge
 electric charge type More...
 
typedef std::vector< SimTrack >::const_iterator g4t_iterator
 
typedef reco::GenParticleRefVector::iterator genp_iterator
 reference to reco::GenParticle More...
 
typedef math::XYZTLorentzVectorD LorentzVector
 Lorentz vector. More...
 
typedef math::XYZPointD Point
 point in the space More...
 
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector
 Lorentz vector. More...
 
typedef math::XYZVectorD Vector
 point in the space More...
 
- Static Public Attributes inherited from SimCluster
static const unsigned int longLivedTag = 65536
 long lived flag More...
 

Detailed Description

Definition at line 12 of file MtdSimCluster.h.

Constructor & Destructor Documentation

◆ MtdSimCluster() [1/3]

MtdSimCluster::MtdSimCluster ( )

Definition at line 7 of file MtdSimCluster.cc.

7  {
8  // No operation
9 }

◆ MtdSimCluster() [2/3]

MtdSimCluster::MtdSimCluster ( const SimTrack simtrk)

Definition at line 11 of file MtdSimCluster.cc.

References SimCluster::addG4Track(), SimCluster::event_, CoreSimTrack::eventId(), CoreSimTrack::momentum(), SimCluster::particleId_, SimCluster::theMomentum_, and CoreSimTrack::trackId().

11  {
12  addG4Track(simtrk);
13  event_ = simtrk.eventId();
14  particleId_ = simtrk.trackId();
15 
16  theMomentum_.SetPxPyPzE(
17  simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E());
18 }
void addG4Track(const SimTrack &t)
Definition: SimCluster.h:76
EncodedEventId event_
Definition: SimCluster.h:251
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
EncodedEventId eventId() const
Definition: CoreSimTrack.h:28
unsigned int trackId() const
Definition: CoreSimTrack.h:31
uint32_t particleId_
Definition: SimCluster.h:253
math::XYZTLorentzVectorF theMomentum_
Definition: SimCluster.h:259

◆ MtdSimCluster() [3/3]

MtdSimCluster::MtdSimCluster ( EncodedEventId  eventID,
uint32_t  particleID 
)

Definition at line 20 of file MtdSimCluster.cc.

References SimCluster::event_, EgammaObjectsElectrons_cfi::particleID, and SimCluster::particleId_.

20  {
21  event_ = eventID;
23 }
EncodedEventId event_
Definition: SimCluster.h:251
uint32_t particleId_
Definition: SimCluster.h:253

◆ ~MtdSimCluster()

MtdSimCluster::~MtdSimCluster ( )

Definition at line 25 of file MtdSimCluster.cc.

25 {}

Member Function Documentation

◆ addHitAndFraction()

void MtdSimCluster::addHitAndFraction ( uint64_t  hit,
float  fraction 
)
inline

add hit with fraction

Definition at line 30 of file MtdSimCluster.h.

References HLT_2024v14_cff::fraction, SimCluster::fractions_, and mtdHits_.

30  {
31  mtdHits_.emplace_back(hit);
32  fractions_.emplace_back(fraction);
33  }
std::vector< float > fractions_
Definition: SimCluster.h:256
std::vector< uint64_t > mtdHits_

◆ addHitPosition()

void MtdSimCluster::addHitPosition ( LocalPoint  pos)
inline

add hit position

Definition at line 36 of file MtdSimCluster.h.

References positions_.

36 { positions_.emplace_back(pos); }
std::vector< LocalPoint > positions_

◆ addHitTime()

void MtdSimCluster::addHitTime ( float  time)
inline

add hit time

Definition at line 24 of file MtdSimCluster.h.

References SimCluster::nsimhits_, hcalRecHitTable_cff::time, and times_.

24  {
25  times_.emplace_back(time);
26  ++nsimhits_;
27  }
uint64_t nsimhits_
Definition: SimCluster.h:250
std::vector< float > times_

◆ addSimHit()

void MtdSimCluster::addSimHit ( const PSimHit hit)
inline

add simhit's energy to cluster

Definition at line 114 of file MtdSimCluster.h.

References SimCluster::nsimhits_, and SimCluster::simhit_energy_.

114  {
115  simhit_energy_ += hit.energyLoss();
116  ++nsimhits_;
117  }
float simhit_energy_
Definition: SimCluster.h:254
uint64_t nsimhits_
Definition: SimCluster.h:250

◆ clear()

void MtdSimCluster::clear ( void  )
inline

Definition at line 106 of file MtdSimCluster.h.

References clearHitsAndFractions(), SimCluster::clearHitsEnergy(), clearHitsPosition(), and clearHitsTime().

106  {
108  clearHitsEnergy();
109  clearHitsTime();
111  }
void clearHitsEnergy()
clear the energies list
Definition: SimCluster.h:238
void clearHitsAndFractions()
clear the hits and fractions list
Definition: MtdSimCluster.h:61
void clearHitsPosition()
clear the positions list
void clearHitsTime()
clear the times list

◆ clearHitsAndFractions()

void MtdSimCluster::clearHitsAndFractions ( )
inline

clear the hits and fractions list

Definition at line 61 of file MtdSimCluster.h.

References SimCluster::fractions_, mtdHits_, and edm::swap().

Referenced by clear().

61  {
62  std::vector<uint64_t>().swap(mtdHits_);
63  std::vector<float>().swap(fractions_);
64  }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
std::vector< float > fractions_
Definition: SimCluster.h:256
std::vector< uint64_t > mtdHits_

◆ clearHitsPosition()

void MtdSimCluster::clearHitsPosition ( )
inline

clear the positions list

Definition at line 104 of file MtdSimCluster.h.

References positions_, and edm::swap().

Referenced by clear().

104 { std::vector<LocalPoint>().swap(positions_); }
std::vector< LocalPoint > positions_
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112

◆ clearHitsTime()

void MtdSimCluster::clearHitsTime ( )
inline

clear the times list

Definition at line 101 of file MtdSimCluster.h.

References edm::swap(), and times_.

Referenced by clear().

101 { std::vector<float>().swap(times_); }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
std::vector< float > times_

◆ detIds_and_rows()

std::vector<std::pair<uint32_t, std::pair<uint8_t, uint8_t> > > MtdSimCluster::detIds_and_rows ( ) const
inline

Returns list of detIds, rows and columns for this SimCluster.

Definition at line 89 of file MtdSimCluster.h.

References mps_fire::i, mtdHits_, and mps_fire::result.

89  {
90  std::vector<std::pair<uint32_t, std::pair<uint8_t, uint8_t>>> result;
91  result.reserve(mtdHits_.size());
92  for (size_t i = 0; i < mtdHits_.size(); ++i) {
93  result.emplace_back(
94  mtdHits_[i] >> 32,
95  std::pair<uint8_t, uint8_t>(static_cast<uint8_t>(mtdHits_[i] >> 16), static_cast<uint8_t>(mtdHits_[i])));
96  }
97  return result;
98  }
std::vector< uint64_t > mtdHits_

◆ hits_and_energies()

std::vector<std::pair<uint64_t, float> > MtdSimCluster::hits_and_energies ( ) const
inline

Returns list of hit IDs and energies for this SimCluster.

Definition at line 50 of file MtdSimCluster.h.

References cms::cuda::assert(), SimCluster::energies_, mps_fire::i, mtdHits_, and mps_fire::result.

50  {
51  assert(mtdHits_.size() == energies_.size());
52  std::vector<std::pair<uint64_t, float>> result;
53  result.reserve(mtdHits_.size());
54  for (size_t i = 0; i < mtdHits_.size(); ++i) {
55  result.emplace_back(mtdHits_[i], energies_[i]);
56  }
57  return result;
58  }
assert(be >=bs)
std::vector< uint64_t > mtdHits_
std::vector< float > energies_
Definition: SimCluster.h:257

◆ hits_and_fractions()

std::vector<std::pair<uint64_t, float> > MtdSimCluster::hits_and_fractions ( ) const
inline

Returns list of hit IDs and fractions for this SimCluster.

Definition at line 39 of file MtdSimCluster.h.

References cms::cuda::assert(), SimCluster::fractions_, mps_fire::i, mtdHits_, and mps_fire::result.

39  {
40  assert(mtdHits_.size() == fractions_.size());
41  std::vector<std::pair<uint64_t, float>> result;
42  result.reserve(mtdHits_.size());
43  for (size_t i = 0; i < mtdHits_.size(); ++i) {
44  result.emplace_back(mtdHits_[i], fractions_[i]);
45  }
46  return result;
47  }
assert(be >=bs)
std::vector< float > fractions_
Definition: SimCluster.h:256
std::vector< uint64_t > mtdHits_

◆ hits_and_positions()

std::vector<std::pair<uint64_t, LocalPoint> > MtdSimCluster::hits_and_positions ( ) const
inline

Returns list of hit IDs and times for this SimCluster.

Definition at line 78 of file MtdSimCluster.h.

References cms::cuda::assert(), mps_fire::i, mtdHits_, positions_, mps_fire::result, and times_.

78  {
79  assert(mtdHits_.size() == times_.size());
80  std::vector<std::pair<uint64_t, LocalPoint>> result;
81  result.reserve(mtdHits_.size());
82  for (size_t i = 0; i < mtdHits_.size(); ++i) {
83  result.emplace_back(mtdHits_[i], positions_[i]);
84  }
85  return result;
86  }
std::vector< LocalPoint > positions_
assert(be >=bs)
std::vector< float > times_
std::vector< uint64_t > mtdHits_

◆ hits_and_times()

std::vector<std::pair<uint64_t, float> > MtdSimCluster::hits_and_times ( ) const
inline

Returns list of hit IDs and times for this SimCluster.

Definition at line 67 of file MtdSimCluster.h.

References cms::cuda::assert(), mps_fire::i, mtdHits_, mps_fire::result, and times_.

67  {
68  assert(mtdHits_.size() == times_.size());
69  std::vector<std::pair<uint64_t, float>> result;
70  result.reserve(mtdHits_.size());
71  for (size_t i = 0; i < mtdHits_.size(); ++i) {
72  result.emplace_back(mtdHits_[i], times_[i]);
73  }
74  return result;
75  }
assert(be >=bs)
std::vector< float > times_
std::vector< uint64_t > mtdHits_

◆ setTrackIdOffset()

void MtdSimCluster::setTrackIdOffset ( unsigned int  offset)
inline

◆ trackIdOffset()

unsigned int MtdSimCluster::trackIdOffset ( ) const
inline

Definition at line 121 of file MtdSimCluster.h.

References idOffset_.

121 { return idOffset_; }
unsigned int idOffset_

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
MtdSimCluster const &  tp 
)
friend

Definition at line 27 of file MtdSimCluster.cc.

27  {
28  s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
29  << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
30 
31  for (MtdSimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) {
32  s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
33  }
34 
35  for (MtdSimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) {
36  s << " Geant Track Momentum " << g4T->momentum() << std::endl;
37  s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
38  if (g4T->type() != tp.pdgId()) {
39  s << " Mismatch b/t MtdSimCluster and Geant types" << std::endl;
40  }
41  }
42  s << " # of cells = " << tp.hits_.size()
43  << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl;
44  return s;
45 }
std::vector< SimTrack >::const_iterator g4t_iterator
Definition: SimCluster.h:45

Member Data Documentation

◆ idOffset_

unsigned int MtdSimCluster::idOffset_ {0}
protected

Definition at line 127 of file MtdSimCluster.h.

Referenced by setTrackIdOffset(), and trackIdOffset().

◆ mtdHits_

std::vector<uint64_t> MtdSimCluster::mtdHits_
protected

◆ positions_

std::vector<LocalPoint> MtdSimCluster::positions_
protected

Definition at line 126 of file MtdSimCluster.h.

Referenced by addHitPosition(), clearHitsPosition(), and hits_and_positions().

◆ times_

std::vector<float> MtdSimCluster::times_
protected