CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 52 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 54 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(name+"Number", "Number of "+name+"'s per event",
59  20, 0, 20,"No. of "+name,"Number of Events");
60  }
61  else{
62  numberPerEvent= dqm.book1dHisto(name+"Number", "Number of "+name+"'s per event",
63  20, 0, 20,"log_{10}(No. of "+name+")","Number of Events");
64  }
65  p_init = dqm.book1dHisto(name+"Momentum", "log_{10}(P) of the "+name+"s",
66  60, -2, 4,"log_{10}(P) (log_{10}(GeV))","Number of "+name );
67 
68  eta_init = dqm.book1dHisto(name+"Eta", "#eta of the "+name+"s",
69  100, -5., 5.,"#eta","Number of "+name);
70 
71  lifetime_init = dqm.book1dHisto(name+"LifeTime", "#phi of the "+name+"s",
72  100, -15, -5,"Log_{10}(life-time^{final}) (log_{10}(s))","Number of "+name);
73 
74  p_final = dqm.book1dHisto(name+"MomentumFinal", "log_{10}(P^{final}) of "+name+"s at end of decay chain",
75  60, -2, 4,"log_{10}(P^{final}) (log_{10}(GeV))","Number of "+name);
76 
77  lifetime_final=dqm.book1dHisto(name+"LifeTimeFinal", "Log_{10}(life-time^{final}) of "+name+"s at end of decay chain",
78  100,-15,-5,"Log_{10}(life-time^{final}) (log_{10}(s))","Number of "+name);
79  }
BasicHepMCValidation::ParticleMonitor::~ParticleMonitor ( )
inline

Definition at line 81 of file BasicHepMCValidation.h.

81 {};

Member Function Documentation

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

Definition at line 83 of file BasicHepMCValidation.h.

References beta, EnergyCorrector::c, count, eta_init, MonitorElement::Fill(), GenParticle::GenParticle, GetFinal(), isFirst(), lifetime_final, lifetime_init, lt, p_final, p_init, pdgid, and histoStyle::weight.

83  {
84  if(p->pdg_id()==pdgid){
85  if(isFirst(p)){
86  p_init->Fill(log10(p->momentum().rho()),weight);
87  eta_init->Fill(p->momentum().eta(),weight);
88  const HepMC::GenParticle* pf=GetFinal(p); // inlcude mixing
89  p_final->Fill(log10(pf->momentum().rho()),weight);
90  // compute lifetime...
91  if(p->production_vertex() && p->end_vertex()){
92  TVector3 PV(p->production_vertex()->point3d().x(),p->production_vertex()->point3d().y(),p->production_vertex()->point3d().z());
93  TVector3 SV(p->end_vertex()->point3d().x(),p->end_vertex()->point3d().y(),p->end_vertex()->point3d().z());
94  TVector3 DL=SV-PV;
95  double c(2.99792458E8),Ltau(DL.Mag()/100)/*cm->m*/,beta(p->momentum().rho()/p->momentum().m());
96  double lt=Ltau/(c*beta);
97  if(lt>1E-16)lifetime_init->Fill(log10(lt),weight);
98  if(pf->end_vertex()){
99  TVector3 SVf(pf->end_vertex()->point3d().x(),pf->end_vertex()->point3d().y(),pf->end_vertex()->point3d().z());
100  DL=SVf-PV;
101  Ltau=DL.Mag()/100;
102  lt=Ltau/(c*beta);
103  if(lt>1E-16)lifetime_final->Fill(log10(lt),weight);
104  }
105  }
106  count++;
107  }
108  return true;
109  }
110  return false;
111  }
const double beta
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:50
void BasicHepMCValidation::ParticleMonitor::FillCount ( double  weight)
inline
const HepMC::GenParticle* BasicHepMCValidation::ParticleMonitor::GetFinal ( const HepMC::GenParticle *  p)
inlineprivate

Definition at line 131 of file BasicHepMCValidation.h.

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

Referenced by Fill().

131  { // includes mixing (assuming mixing is not occurring more than 5 times back and forth)
132  HepMC::GenParticle* aPart = new HepMC::GenParticle(*p);
133  for (unsigned int iMix = 0; iMix < 10; iMix++) {
134  bool foundSimilar = false;
135  if(aPart->end_vertex()){
136  if(aPart->end_vertex()->particles_out_size()!=0){
137  for(HepMC::GenVertex::particles_out_const_iterator d=aPart->end_vertex()->particles_out_const_begin(); d!=aPart->end_vertex()->particles_out_const_end();d++){
138  if(abs((*d)->pdg_id())==abs(aPart->pdg_id())){
139  aPart = *d;
140  foundSimilar = true;
141  break;
142  }
143  }
144  }
145  if (!foundSimilar) break;
146  }
147  }
148  return aPart;
149  }
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 122 of file BasicHepMCValidation.h.

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

Referenced by Fill().

122  {
123  if(p->production_vertex()){
124  for(HepMC::GenVertex::particles_in_const_iterator m=p->production_vertex()->particles_in_const_begin(); m!=p->production_vertex()->particles_in_const_end();m++){
125  if(abs((*m)->pdg_id())==abs(p->pdg_id())) return false;
126  }
127  }
128  return true;
129  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int BasicHepMCValidation::ParticleMonitor::PDGID ( )
inline

Definition at line 119 of file BasicHepMCValidation.h.

References pdgid.

Member Data Documentation

unsigned int BasicHepMCValidation::ParticleMonitor::count
private

Definition at line 153 of file BasicHepMCValidation.h.

Referenced by Fill(), and FillCount().

MonitorElement * BasicHepMCValidation::ParticleMonitor::eta_init
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_final
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::lifetime_init
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

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

Definition at line 154 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::numberPerEvent
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by FillCount(), and ParticleMonitor().

MonitorElement * BasicHepMCValidation::ParticleMonitor::p_final
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

MonitorElement* BasicHepMCValidation::ParticleMonitor::p_init
private

Definition at line 155 of file BasicHepMCValidation.h.

Referenced by Fill(), and ParticleMonitor().

int BasicHepMCValidation::ParticleMonitor::pdgid
private

Definition at line 152 of file BasicHepMCValidation.h.

Referenced by Fill(), and PDGID().