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 Attributes
DrellYanValidation Class Reference

#include <DrellYanValidation.h>

Inheritance diagram for DrellYanValidation:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 DrellYanValidation (const edm::ParameterSet &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
virtual ~DrellYanValidation ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

int _flavor
 decay flavor More...
 
std::string _name
 decay flavor name More...
 
MonitorElementcos_theta_gamma_lepton
 
DQMStoredbe
 ME's "container". More...
 
MonitorElementdilep_mass
 
MonitorElementdilep_massPeak
 
MonitorElementdilep_pt
 
MonitorElementdilep_ptLog
 
MonitorElementdilep_rap
 
edm::ESHandle
< HepPDT::ParticleDataTable
fPDGTable
 PDT table. More...
 
MonitorElementgamma_energy
 
edm::InputTag hepmcCollection_
 
MonitorElementleadeta
 
MonitorElementleadpt
 
MonitorElementnEvt
 
MonitorElementseceta
 
MonitorElementsecpt
 
MonitorElementZdaughters
 
MonitorElementZmass
 
MonitorElementZmassPeak
 
MonitorElementZpt
 
MonitorElementZptLog
 
MonitorElementZrap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 34 of file DrellYanValidation.h.

Constructor & Destructor Documentation

DrellYanValidation::DrellYanValidation ( const edm::ParameterSet iPSet)
explicit

Definition at line 20 of file DrellYanValidation.cc.

References dbe, and cmsCodeRules.cppFunctionSkipper::operator.

20  :
21  hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
22  _flavor(iPSet.getParameter<int>("decaysTo")),
23  _name(iPSet.getParameter<std::string>("name"))
24 {
25  dbe = 0;
27 }
T getParameter(std::string const &) const
edm::InputTag hepmcCollection_
int _flavor
decay flavor
DQMStore * dbe
ME&#39;s &quot;container&quot;.
std::string _name
decay flavor name
DrellYanValidation::~DrellYanValidation ( )
virtual

Definition at line 29 of file DrellYanValidation.cc.

29 {}

Member Function Documentation

void DrellYanValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Gathering the HepMCProduct information

Implements edm::EDAnalyzer.

Definition at line 76 of file DrellYanValidation.cc.

References _flavor, abs, funct::cos(), cos_theta_gamma_lepton, dilep_mass, dilep_massPeak, dilep_pt, dilep_ptLog, dilep_rap, MonitorElement::Fill(), HepMCValidationHelper::findFSRPhotons(), fPDGTable, gamma_energy, edm::Event::getByLabel(), hepmcCollection_, i, leadeta, leadpt, nEvt, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, perp(), edm::es::products(), seceta, secpt, python.multivaluedict::sort(), HepMCValidationHelper::sortByPt(), matplotRender::t, x, detailsBasic3DVector::y, detailsBasic3DVector::z, Zdaughters, Zmass, ZmassPeak, Zpt, ZptLog, and Zrap.

77 {
78 
79  // we *DO NOT* rely on a Z entry in the particle listings!
80 
83  iEvent.getByLabel(hepmcCollection_, evt);
84 
85  //Get EVENT
86  const HepMC::GenEvent *myGenEvent = evt->GetEvent();
87 
88  nEvt->Fill(0.5);
89 
90  std::vector<const HepMC::GenParticle*> allproducts;
91 
92  //requires status 1 for leptons and neutrinos (except tau)
93  int requiredstatus = (abs(_flavor) == 11 || abs(_flavor) == 12 || abs(_flavor) ==13 || abs(_flavor) ==14 || abs(_flavor) ==16) ? 1 : 3;
94 
95  bool vetotau = true; //(abs(_flavor) == 11 || abs(_flavor) == 12 || abs(_flavor) ==13 || abs(_flavor) ==14 || abs(_flavor) ==16) ? true : false;
96 
97  for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter) {
98  if (vetotau) {
99  if ((*iter)->status()==3 && abs((*iter)->pdg_id() == 15) ) return;
100  }
101  if((*iter)->status()==requiredstatus) {
102  if(abs((*iter)->pdg_id())==_flavor)
103  allproducts.push_back(*iter);
104  }
105  }
106 
107  //nothing to do if we don't have 2 particles
108  if (allproducts.size() < 2) return;
109 
110  //sort them in pt
111  std::sort(allproducts.begin(), allproducts.end(), HepMCValidationHelper::sortByPt);
112 
113  //get the first element and the first following element with opposite charge
114  std::vector<const HepMC::GenParticle*> products;
115  products.push_back(allproducts.front());
116  const HepPDT::ParticleData* PData1 = fPDGTable->particle(HepPDT::ParticleID(allproducts.front()->pdg_id()));
117  double charge1 = PData1->charge();
118  for (unsigned int i = 1; i < allproducts.size(); ++i ){
119  const HepPDT::ParticleData* PData2 = fPDGTable->particle(HepPDT::ParticleID(allproducts[i]->pdg_id()));
120  double charge2 = PData2->charge();
121  if (charge1*charge2 < 0) products.push_back(allproducts[i]);
122  }
123 
124  //if we did not find any opposite charge pair there is nothing to do
125  if (products.size() < 2) return;
126 
127  assert(products[0]->momentum().perp() > products[1]->momentum().perp());
128 
129  //leading lepton with pt > 20.
130  if (products[0]->momentum().perp() < 20.) return;
131 
132  //assemble FourMomenta
133  TLorentzVector lep1(products[0]->momentum().x(), products[0]->momentum().y(), products[0]->momentum().z(), products[0]->momentum().t());
134  TLorentzVector lep2(products[1]->momentum().x(), products[1]->momentum().y(), products[1]->momentum().z(), products[1]->momentum().t());
135  TLorentzVector dilepton_mom = lep1 + lep2;
136  TLorentzVector dilepton_andphoton_mom = dilepton_mom;
137 
138  //mass > 60.
139  if (dilepton_mom.M() < 60.) return;
140 
141  //find possible qed fsr photons
142  std::vector<const HepMC::GenParticle*> fsrphotons;
143  HepMCValidationHelper::findFSRPhotons(products, myGenEvent, 0.1, fsrphotons);
144 
145  Zdaughters->Fill(products[0]->pdg_id());
146  Zdaughters->Fill(products[1]->pdg_id());
147 
148  std::vector<TLorentzVector> gammasMomenta;
149  for (unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
150  TLorentzVector phomom(fsrphotons[ipho]->momentum().x(), fsrphotons[ipho]->momentum().y(), fsrphotons[ipho]->momentum().z(), fsrphotons[ipho]->momentum().t());
151  dilepton_andphoton_mom += phomom;
152  Zdaughters->Fill(fsrphotons[ipho]->pdg_id());
153  gammasMomenta.push_back(phomom);
154  }
155  //Fill Z histograms
156  Zmass->Fill(dilepton_andphoton_mom.M());
157  ZmassPeak->Fill(dilepton_andphoton_mom.M());
158  Zpt->Fill(dilepton_andphoton_mom.Pt());
159  ZptLog->Fill(log10(dilepton_andphoton_mom.Pt()));
160  Zrap->Fill(dilepton_andphoton_mom.Rapidity());
161 
162  //Fill dilepton histograms
163  dilep_mass->Fill(dilepton_mom.M());
164  dilep_massPeak->Fill(dilepton_mom.M());
165  dilep_pt->Fill(dilepton_mom.Pt());
166  dilep_ptLog->Fill(log10(dilepton_mom.Pt()));
167  dilep_rap->Fill(dilepton_mom.Rapidity());
168 
169  //Fill lepton histograms
170  leadpt->Fill(lep1.Pt());
171  secpt->Fill(lep2.Pt());
172  leadeta->Fill(lep1.Eta());
173  seceta->Fill(lep2.Eta());
174 
175  //boost everything in the Z frame
176  TVector3 boost = dilepton_andphoton_mom.BoostVector();
177  boost*=-1.;
178  lep1.Boost(boost);
179  lep2.Boost(boost);
180  for (unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
181  gammasMomenta[ipho].Boost(boost);
182  }
183  std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
184 
185  //fill gamma histograms
186  if (gammasMomenta.size() != 0 && dilepton_andphoton_mom.M() > 50.) {
187  gamma_energy->Fill(gammasMomenta.front().E());
188  double dphi = lep1.DeltaR(gammasMomenta.front()) < lep2.DeltaR(gammasMomenta.front()) ?
189  lep1.DeltaPhi(gammasMomenta.front()) : lep2.DeltaPhi(gammasMomenta.front());
191  }
192 
193 }//analyze
MonitorElement * secpt
MonitorElement * gamma_energy
int i
Definition: DBlmapReader.cc:9
MonitorElement * dilep_rap
void findFSRPhotons(const std::vector< const HepMC::GenParticle * > &leptons, const std::vector< const HepMC::GenParticle * > &all, double deltaR, std::vector< const HepMC::GenParticle * > &photons)
MonitorElement * Zmass
edm::InputTag hepmcCollection_
MonitorElement * cos_theta_gamma_lepton
MonitorElement * nEvt
MonitorElement * leadeta
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
#define abs(x)
Definition: mlp_lapack.h:159
MonitorElement * Zrap
MonitorElement * leadpt
double double double z
void Fill(long long x)
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
int _flavor
decay flavor
MonitorElement * dilep_massPeak
ESProducts< T, S > products(const T &i1, const S &i2)
Definition: ESProducts.h:189
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * Zdaughters
MonitorElement * dilep_pt
HepPDT::ParticleData ParticleData
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
MonitorElement * ZptLog
MonitorElement * seceta
T perp() const
Magnitude of transverse component.
MonitorElement * dilep_mass
MonitorElement * ZmassPeak
MonitorElement * dilep_ptLog
Definition: DDAxes.h:10
MonitorElement * Zpt
void DrellYanValidation::beginJob ( void  )
virtual

Setting the DQM top directories

Reimplemented from edm::EDAnalyzer.

Definition at line 31 of file DrellYanValidation.cc.

References _name, DQMStore::book1D(), cos_theta_gamma_lepton, dbe, dilep_mass, dilep_massPeak, dilep_pt, dilep_ptLog, dilep_rap, gamma_energy, leadeta, leadpt, nEvt, seceta, secpt, DQMStore::setCurrentFolder(), Zdaughters, Zmass, ZmassPeak, Zpt, ZptLog, and Zrap.

32 {
33  if(dbe){
35  std::string folderName = "Generator/DrellYan";
36  folderName+=_name;
37  dbe->setCurrentFolder(folderName.c_str());
38 
39  // Number of analyzed events
40  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
41 
42  //Kinematics
43  Zmass = dbe->book1D("Zmass","inv. Mass Z", 70 ,0,140);
44  ZmassPeak = dbe->book1D("ZmassPeak","inv. Mass Z", 80 ,80 ,100);
45  Zpt = dbe->book1D("Zpt","Z pt",100,0,200);
46  ZptLog = dbe->book1D("ZptLog","log(Z pt)",100,0.,5.);
47  Zrap = dbe->book1D("Zrap", "Z y", 100, -5, 5);
48  Zdaughters = dbe->book1D("Zdaughters", "Z daughters", 60, -30, 30);
49 
50  dilep_mass = dbe->book1D("dilep_mass","inv. Mass dilepton", 70 ,0,140);
51  dilep_massPeak = dbe->book1D("dilep_massPeak","inv. Mass dilepton", 80 ,80 ,100);
52  dilep_pt = dbe->book1D("dilep_pt","dilepton pt",100,0,200);
53  dilep_ptLog = dbe->book1D("dilep_ptLog","log(dilepton pt)",100,0.,5.);
54  dilep_rap = dbe->book1D("dilep_rap", "dilepton y", 100, -5, 5);
55 
56  gamma_energy = dbe->book1D("gamma_energy", "photon energy in Z rest frame", 200, 0., 100.);
57  cos_theta_gamma_lepton = dbe->book1D("cos_theta_gamma_lepton", "cos_theta_gamma_lepton in Z rest frame", 200, -1, 1);
58 
59  leadpt = dbe->book1D("leadpt","leading lepton pt", 200, 0., 200.);
60  secpt = dbe->book1D("secpt","second lepton pt", 200, 0., 200.);
61  leadeta = dbe->book1D("leadeta","leading lepton eta", 100, -5., 5.);
62  seceta = dbe->book1D("seceta","second lepton eta", 100, -5., 5.);
63 
64  }
65  return;
66 }
MonitorElement * secpt
MonitorElement * gamma_energy
MonitorElement * dilep_rap
MonitorElement * Zmass
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
MonitorElement * cos_theta_gamma_lepton
MonitorElement * nEvt
MonitorElement * leadeta
MonitorElement * Zrap
MonitorElement * leadpt
MonitorElement * dilep_massPeak
DQMStore * dbe
ME&#39;s &quot;container&quot;.
MonitorElement * Zdaughters
MonitorElement * dilep_pt
MonitorElement * ZptLog
std::string _name
decay flavor name
MonitorElement * seceta
MonitorElement * dilep_mass
MonitorElement * ZmassPeak
MonitorElement * dilep_ptLog
MonitorElement * Zpt
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void DrellYanValidation::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Get PDT Table

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file DrellYanValidation.cc.

References fPDGTable, and edm::EventSetup::getData().

70 {
72  iSetup.getData( fPDGTable );
73  return;
74 }
void getData(T &iHolder) const
Definition: EventSetup.h:67
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
void DrellYanValidation::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file DrellYanValidation.cc.

68 {return;}
void DrellYanValidation::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file DrellYanValidation.cc.

75 {return;}

Member Data Documentation

int DrellYanValidation::_flavor
private

decay flavor

Definition at line 62 of file DrellYanValidation.h.

Referenced by analyze().

std::string DrellYanValidation::_name
private

decay flavor name

Definition at line 64 of file DrellYanValidation.h.

Referenced by beginJob().

MonitorElement * DrellYanValidation::cos_theta_gamma_lepton
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

DQMStore* DrellYanValidation::dbe
private

ME's "container".

Definition at line 53 of file DrellYanValidation.h.

Referenced by beginJob(), and DrellYanValidation().

MonitorElement* DrellYanValidation::dilep_mass
private

Definition at line 57 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_massPeak
private

Definition at line 57 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_pt
private

Definition at line 57 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_ptLog
private

Definition at line 57 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_rap
private

Definition at line 57 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

edm::ESHandle<HepPDT::ParticleDataTable> DrellYanValidation::fPDGTable
private

PDT table.

Definition at line 50 of file DrellYanValidation.h.

Referenced by analyze(), and beginRun().

MonitorElement* DrellYanValidation::gamma_energy
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

edm::InputTag DrellYanValidation::hepmcCollection_
private

Definition at line 47 of file DrellYanValidation.h.

Referenced by analyze().

MonitorElement * DrellYanValidation::leadeta
private

Definition at line 58 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::leadpt
private

Definition at line 58 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::nEvt
private

Definition at line 55 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::seceta
private

Definition at line 58 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::secpt
private

Definition at line 58 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zdaughters
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::Zmass
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::ZmassPeak
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zpt
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::ZptLog
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zrap
private

Definition at line 56 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().