CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 53 of file BasicHepMCValidation.h.

References DQMHelper::book1dHisto(), eta_init, 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  }
BasicHepMCValidation::ParticleMonitor::~ParticleMonitor ( )
inline

Definition at line 104 of file BasicHepMCValidation.h.

104 {};

Member Function Documentation

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

Definition at line 106 of file BasicHepMCValidation.h.

References HLT_FULL_cff::beta, c, count, eta_init, dqm::impl::MonitorElement::Fill(), GenParticle::GenParticle, GetFinal(), isFirst(), lifetime_final, lifetime_init, lt, p_final, p_init, pdgid, and histoStyle::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  }
const edm::EventSetup & c
bool isFirst(const HepMC::GenParticle *p)
void Fill(long long x)
const HepMC::GenParticle * GetFinal(const HepMC::GenParticle *p)
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
int weight
Definition: histoStyle.py:51
void BasicHepMCValidation::ParticleMonitor::FillCount ( double  weight)
inline
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  }
tuple d
Definition: ztail.py:151
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool BasicHepMCValidation::ParticleMonitor::isFirst ( const HepMC::GenParticle *  p)
inlineprivate

Definition at line 152 of file BasicHepMCValidation.h.

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

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
int BasicHepMCValidation::ParticleMonitor::PDGID ( )
inline

Definition at line 149 of file BasicHepMCValidation.h.

References pdgid.

Member Data Documentation

unsigned int BasicHepMCValidation::ParticleMonitor::count
private

Definition at line 190 of file BasicHepMCValidation.h.

Referenced by Fill(), and FillCount().

MonitorElement * BasicHepMCValidation::ParticleMonitor::eta_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_final
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

std::string BasicHepMCValidation::ParticleMonitor::name
private
bool BasicHepMCValidation::ParticleMonitor::nlog
private

Definition at line 191 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::numberPerEvent
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::p_final
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement* BasicHepMCValidation::ParticleMonitor::p_init
private

Definition at line 192 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

int BasicHepMCValidation::ParticleMonitor::pdgid
private

Definition at line 189 of file BasicHepMCValidation.h.

Referenced by Fill(), and PDGID().