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 50 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 52 of file BasicHepMCValidation.h.

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

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

◆ ~ParticleMonitor()

BasicHepMCValidation::ParticleMonitor::~ParticleMonitor ( )
inline

Definition at line 103 of file BasicHepMCValidation.h.

103 {};

Member Function Documentation

◆ Fill()

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

Definition at line 105 of file BasicHepMCValidation.h.

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

References zMuMuMuonUserData::beta, HltBtagPostValidation_cff::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.

◆ FillCount()

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

Definition at line 140 of file BasicHepMCValidation.h.

140  {
141  if (nlog)
142  numberPerEvent->Fill(log10(count), weight);
143  else
145  count = 0;
146  }

References count, dqm::impl::MonitorElement::Fill(), nlog, and numberPerEvent.

◆ GetFinal()

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

Definition at line 164 of file BasicHepMCValidation.h.

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

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

Referenced by Fill().

◆ isFirst()

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

Definition at line 151 of file BasicHepMCValidation.h.

151  {
152  if (p->production_vertex()) {
153  for (HepMC::GenVertex::particles_in_const_iterator m = p->production_vertex()->particles_in_const_begin();
154  m != p->production_vertex()->particles_in_const_end();
155  m++) {
156  if (abs((*m)->pdg_id()) == abs(p->pdg_id()))
157  return false;
158  }
159  }
160  return true;
161  }

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

Referenced by Fill().

◆ PDGID()

int BasicHepMCValidation::ParticleMonitor::PDGID ( )
inline

Definition at line 148 of file BasicHepMCValidation.h.

148 { return pdgid; }

References pdgid.

Member Data Documentation

◆ count

unsigned int BasicHepMCValidation::ParticleMonitor::count
private

Definition at line 189 of file BasicHepMCValidation.h.

Referenced by Fill(), and FillCount().

◆ eta_init

MonitorElement * BasicHepMCValidation::ParticleMonitor::eta_init
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ lifetime_final

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_final
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ lifetime_init

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_init
private

Definition at line 191 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 190 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

◆ numberPerEvent

MonitorElement * BasicHepMCValidation::ParticleMonitor::numberPerEvent
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

◆ p_final

MonitorElement * BasicHepMCValidation::ParticleMonitor::p_final
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ p_init

MonitorElement* BasicHepMCValidation::ParticleMonitor::p_init
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

◆ pdgid

int BasicHepMCValidation::ParticleMonitor::pdgid
private

Definition at line 188 of file BasicHepMCValidation.h.

Referenced by Fill(), and PDGID().

mps_fire.i
i
Definition: mps_fire.py:355
BasicHepMCValidation::ParticleMonitor::nlog
bool nlog
Definition: BasicHepMCValidation.h:190
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
mps_merge.weight
weight
Definition: mps_merge.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BasicHepMCValidation::ParticleMonitor::lifetime_init
MonitorElement * lifetime_init
Definition: BasicHepMCValidation.h:191
BasicHepMCValidation::ParticleMonitor::eta_init
MonitorElement * eta_init
Definition: BasicHepMCValidation.h:191
BasicHepMCValidation::ParticleMonitor::count
unsigned int count
Definition: BasicHepMCValidation.h:189
nanoDQM_cfi.PV
PV
Definition: nanoDQM_cfi.py:440
BasicHepMCValidation::ParticleMonitor::p_final
MonitorElement * p_final
Definition: BasicHepMCValidation.h:191
BasicHepMCValidation::ParticleMonitor::numberPerEvent
MonitorElement * numberPerEvent
Definition: BasicHepMCValidation.h:191
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
BasicHepMCValidation::ParticleMonitor::p_init
MonitorElement * p_init
Definition: BasicHepMCValidation.h:191
nanoDQM_cfi.SV
SV
Definition: nanoDQM_cfi.py:528
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
BasicHepMCValidation::ParticleMonitor::lifetime_final
MonitorElement * lifetime_final
Definition: BasicHepMCValidation.h:191
DQMHelper
Definition: DQMHelper.h:15
BasicHepMCValidation::ParticleMonitor::isFirst
bool isFirst(const HepMC::GenParticle *p)
Definition: BasicHepMCValidation.h:151
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
BasicHepMCValidation::ParticleMonitor::name
std::string name
Definition: BasicHepMCValidation.h:187
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
BasicHepMCValidation::ParticleMonitor::GetFinal
const HepMC::GenParticle * GetFinal(const HepMC::GenParticle *p)
Definition: BasicHepMCValidation.h:164
BasicHepMCValidation::ParticleMonitor::pdgid
int pdgid
Definition: BasicHepMCValidation.h:188
ztail.d
d
Definition: ztail.py:151
dqm
Definition: DQMStore.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
weight
Definition: weight.py:1