CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BasicHepMCValidation::ParticleMonitor Class Reference

Public Member Functions

bool Fill (const HepMC::GenParticle *p, double weight)
 
void FillCount (double weight)
 
 ParticleMonitor (std::string name_, int pdgid_, DQMStore::IBooker &i, bool nlog_=false)
 
int PDGID ()
 
 ~ParticleMonitor ()
 

Private Member Functions

const HepMC::GenParticle * GetFinal (const HepMC::GenParticle *p)
 
bool isFirst (const HepMC::GenParticle *p)
 

Private Attributes

unsigned int count
 
MonitorElementeta_init
 
MonitorElementlifetime_final
 
MonitorElementlifetime_init
 
std::string name
 
bool nlog
 
MonitorElementnumberPerEvent
 
MonitorElementp_final
 
MonitorElementp_init
 
int pdgid
 

Detailed Description

Definition at line 51 of file BasicHepMCValidation.h.

Constructor & Destructor Documentation

◆ ParticleMonitor()

BasicHepMCValidation::ParticleMonitor::ParticleMonitor ( std::string  name_,
int  pdgid_,
DQMStore::IBooker i,
bool  nlog_ = false 
)
inline

Definition at line 53 of file BasicHepMCValidation.h.

References eta_init, mps_fire::i, lifetime_final, lifetime_init, name, nlog, numberPerEvent, p_final, and p_init.

54  : name(name_), pdgid(pdgid_), count(0), nlog(nlog_) {
55  DQMHelper dqm(&i);
56  // Number of analyzed events
57  if (!nlog) {
58  numberPerEvent = dqm.book1dHisto(
59  name + "Number", "Number of " + name + "'s per event", 20, 0, 20, "No. of " + name, "Number of Events");
60  } else {
61  numberPerEvent = dqm.book1dHisto(name + "Number",
62  "Number of " + name + "'s per event",
63  20,
64  0,
65  20,
66  "log_{10}(No. of " + name + ")",
67  "Number of Events");
68  }
69  p_init = dqm.book1dHisto(name + "Momentum",
70  "log_{10}(P) of the " + name + "s",
71  60,
72  -2,
73  4,
74  "log_{10}(P) (log_{10}(GeV))",
75  "Number of " + name);
76 
77  eta_init = dqm.book1dHisto(name + "Eta", "#eta of the " + name + "s", 100, -5., 5., "#eta", "Number of " + name);
78 
79  lifetime_init = dqm.book1dHisto(name + "LifeTime",
80  "#phi of the " + name + "s",
81  100,
82  -15,
83  -5,
84  "Log_{10}(life-time^{final}) (log_{10}(s))",
85  "Number of " + name);
86 
87  p_final = dqm.book1dHisto(name + "MomentumFinal",
88  "log_{10}(P^{final}) of " + name + "s at end of decay chain",
89  60,
90  -2,
91  4,
92  "log_{10}(P^{final}) (log_{10}(GeV))",
93  "Number of " + name);
94 
95  lifetime_final = dqm.book1dHisto(name + "LifeTimeFinal",
96  "Log_{10}(life-time^{final}) of " + name + "s at end of decay chain",
97  100,
98  -15,
99  -5,
100  "Log_{10}(life-time^{final}) (log_{10}(s))",
101  "Number of " + name);
102  }
Definition: DQMStore.h:18

◆ ~ParticleMonitor()

BasicHepMCValidation::ParticleMonitor::~ParticleMonitor ( )
inline

Definition at line 104 of file BasicHepMCValidation.h.

104 {}

Member Function Documentation

◆ Fill()

bool BasicHepMCValidation::ParticleMonitor::Fill ( const HepMC::GenParticle *  p,
double  weight 
)
inline

Definition at line 106 of file BasicHepMCValidation.h.

References HLT_2024v14_cff::beta, DummyCfis::c, count, eta_init, dqm::impl::MonitorElement::Fill(), GenParticle::GenParticle, GetFinal(), isFirst(), lifetime_final, lifetime_init, AlCaHLTBitMon_ParallelJobs::p, p_final, p_init, pdgid, packedPFCandidateRefMixer_cfi::pf, nanoDQM_cfi::PV, nanoDQM_cfi::SV, and mps_merge::weight.

106  {
107  if (p->pdg_id() == pdgid) {
108  if (isFirst(p)) {
109  p_init->Fill(log10(p->momentum().rho()), weight);
110  eta_init->Fill(p->momentum().eta(), weight);
111  const HepMC::GenParticle *pf = GetFinal(p); // inlcude mixing
112  p_final->Fill(log10(pf->momentum().rho()), weight);
113  // compute lifetime...
114  if (p->production_vertex() && p->end_vertex()) {
115  TVector3 PV(p->production_vertex()->point3d().x(),
116  p->production_vertex()->point3d().y(),
117  p->production_vertex()->point3d().z());
118  TVector3 SV(p->end_vertex()->point3d().x(), p->end_vertex()->point3d().y(), p->end_vertex()->point3d().z());
119  TVector3 DL = SV - PV;
120  double c(2.99792458E8), Ltau(DL.Mag() / 100) /*cm->m*/, beta(p->momentum().rho() / p->momentum().m());
121  double lt = Ltau / (c * beta);
122  if (lt > 1E-16)
123  lifetime_init->Fill(log10(lt), weight);
124  if (pf->end_vertex()) {
125  TVector3 SVf(
126  pf->end_vertex()->point3d().x(), pf->end_vertex()->point3d().y(), pf->end_vertex()->point3d().z());
127  DL = SVf - PV;
128  Ltau = DL.Mag() / 100;
129  lt = Ltau / (c * beta);
130  if (lt > 1E-16)
131  lifetime_final->Fill(log10(lt), weight);
132  }
133  }
134  count++;
135  }
136  return true;
137  }
138  return false;
139  }
bool isFirst(const HepMC::GenParticle *p)
Definition: weight.py:1
void Fill(long long x)
const HepMC::GenParticle * GetFinal(const HepMC::GenParticle *p)

◆ FillCount()

void BasicHepMCValidation::ParticleMonitor::FillCount ( double  weight)
inline

◆ GetFinal()

const HepMC::GenParticle* BasicHepMCValidation::ParticleMonitor::GetFinal ( const HepMC::GenParticle *  p)
inlineprivate

Definition at line 165 of file BasicHepMCValidation.h.

References funct::abs(), ztail::d, GenParticle::GenParticle, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by Fill().

165  {
166  const HepMC::GenParticle *aPart = p;
167  for (unsigned int iMix = 0; iMix < 10; iMix++) {
168  bool foundSimilar = false;
169  if (aPart->end_vertex()) {
170  if (aPart->end_vertex()->particles_out_size() != 0) {
171  for (HepMC::GenVertex::particles_out_const_iterator d = aPart->end_vertex()->particles_out_const_begin();
172  d != aPart->end_vertex()->particles_out_const_end();
173  d++) {
174  if (abs((*d)->pdg_id()) == abs(aPart->pdg_id())) {
175  aPart = *d;
176  foundSimilar = true;
177  break;
178  }
179  }
180  }
181  if (!foundSimilar)
182  break;
183  }
184  }
185  return aPart;
186  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
d
Definition: ztail.py:151

◆ isFirst()

bool BasicHepMCValidation::ParticleMonitor::isFirst ( const HepMC::GenParticle *  p)
inlineprivate

Definition at line 152 of file BasicHepMCValidation.h.

References funct::abs(), visualization-live-secondInstance_cfg::m, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by Fill().

152  {
153  if (p->production_vertex()) {
154  for (HepMC::GenVertex::particles_in_const_iterator m = p->production_vertex()->particles_in_const_begin();
155  m != p->production_vertex()->particles_in_const_end();
156  m++) {
157  if (abs((*m)->pdg_id()) == abs(p->pdg_id()))
158  return false;
159  }
160  }
161  return true;
162  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ PDGID()

int BasicHepMCValidation::ParticleMonitor::PDGID ( )
inline

Definition at line 149 of file BasicHepMCValidation.h.

References pdgid.

Member Data Documentation

◆ count

unsigned int BasicHepMCValidation::ParticleMonitor::count
private

Definition at line 190 of file BasicHepMCValidation.h.

Referenced by Fill(), and FillCount().

◆ eta_init

MonitorElement * BasicHepMCValidation::ParticleMonitor::eta_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ lifetime_final

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_final
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ lifetime_init

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ name

std::string BasicHepMCValidation::ParticleMonitor::name
private

◆ nlog

bool BasicHepMCValidation::ParticleMonitor::nlog
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

◆ numberPerEvent

MonitorElement * BasicHepMCValidation::ParticleMonitor::numberPerEvent
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

◆ p_final

MonitorElement * BasicHepMCValidation::ParticleMonitor::p_final
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ p_init

MonitorElement* BasicHepMCValidation::ParticleMonitor::p_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ pdgid

int BasicHepMCValidation::ParticleMonitor::pdgid
private

Definition at line 189 of file BasicHepMCValidation.h.

Referenced by Fill(), and PDGID().