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...
 
WeightManager _wmanager
 
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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 35 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 cppFunctionSkipper::operator.

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

Definition at line 30 of file DrellYanValidation.cc.

30 {}

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 77 of file DrellYanValidation.cc.

References _flavor, _wmanager, 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(), lumiQTWidget::t, WeightManager::weight(), CommonMethods::weight(), vdt::x, detailsBasic3DVector::y, detailsBasic3DVector::z, Zdaughters, Zmass, ZmassPeak, Zpt, ZptLog, and Zrap.

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

Setting the DQM top directories

Reimplemented from edm::EDAnalyzer.

Definition at line 32 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.

33 {
34  if(dbe){
36  std::string folderName = "Generator/DrellYan";
37  folderName+=_name;
38  dbe->setCurrentFolder(folderName.c_str());
39 
40  // Number of analyzed events
41  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
42 
43  //Kinematics
44  Zmass = dbe->book1D("Zmass","inv. Mass Z", 70 ,0,140);
45  ZmassPeak = dbe->book1D("ZmassPeak","inv. Mass Z", 80 ,80 ,100);
46  Zpt = dbe->book1D("Zpt","Z pt",100,0,200);
47  ZptLog = dbe->book1D("ZptLog","log(Z pt)",100,0.,5.);
48  Zrap = dbe->book1D("Zrap", "Z y", 100, -5, 5);
49  Zdaughters = dbe->book1D("Zdaughters", "Z daughters", 60, -30, 30);
50 
51  dilep_mass = dbe->book1D("dilep_mass","inv. Mass dilepton", 70 ,0,140);
52  dilep_massPeak = dbe->book1D("dilep_massPeak","inv. Mass dilepton", 80 ,80 ,100);
53  dilep_pt = dbe->book1D("dilep_pt","dilepton pt",100,0,200);
54  dilep_ptLog = dbe->book1D("dilep_ptLog","log(dilepton pt)",100,0.,5.);
55  dilep_rap = dbe->book1D("dilep_rap", "dilepton y", 100, -5, 5);
56 
57  gamma_energy = dbe->book1D("gamma_energy", "photon energy in Z rest frame", 200, 0., 100.);
58  cos_theta_gamma_lepton = dbe->book1D("cos_theta_gamma_lepton", "cos_theta_gamma_lepton in Z rest frame", 200, -1, 1);
59 
60  leadpt = dbe->book1D("leadpt","leading lepton pt", 200, 0., 200.);
61  secpt = dbe->book1D("secpt","second lepton pt", 200, 0., 200.);
62  leadeta = dbe->book1D("leadeta","leading lepton eta", 100, -5., 5.);
63  seceta = dbe->book1D("seceta","second lepton eta", 100, -5., 5.);
64 
65  }
66  return;
67 }
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:717
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:429
void DrellYanValidation::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Get PDT Table

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file DrellYanValidation.cc.

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

71 {
73  iSetup.getData( fPDGTable );
74  return;
75 }
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 69 of file DrellYanValidation.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DrellYanValidation.cc.

76 {return;}

Member Data Documentation

int DrellYanValidation::_flavor
private

decay flavor

Definition at line 65 of file DrellYanValidation.h.

Referenced by analyze().

std::string DrellYanValidation::_name
private

decay flavor name

Definition at line 67 of file DrellYanValidation.h.

Referenced by beginJob().

WeightManager DrellYanValidation::_wmanager
private

Definition at line 48 of file DrellYanValidation.h.

Referenced by analyze().

MonitorElement * DrellYanValidation::cos_theta_gamma_lepton
private

Definition at line 62 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

DQMStore* DrellYanValidation::dbe
private

ME's "container".

Definition at line 56 of file DrellYanValidation.h.

Referenced by beginJob(), and DrellYanValidation().

MonitorElement* DrellYanValidation::dilep_mass
private

Definition at line 60 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_massPeak
private

Definition at line 60 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_pt
private

Definition at line 60 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_ptLog
private

Definition at line 60 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::dilep_rap
private

Definition at line 60 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

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

PDT table.

Definition at line 53 of file DrellYanValidation.h.

Referenced by analyze(), and beginRun().

MonitorElement* DrellYanValidation::gamma_energy
private

Definition at line 62 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

edm::InputTag DrellYanValidation::hepmcCollection_
private

Definition at line 50 of file DrellYanValidation.h.

Referenced by analyze().

MonitorElement * DrellYanValidation::leadeta
private

Definition at line 61 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::leadpt
private

Definition at line 61 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::nEvt
private

Definition at line 58 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::seceta
private

Definition at line 61 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::secpt
private

Definition at line 61 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zdaughters
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement* DrellYanValidation::Zmass
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::ZmassPeak
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zpt
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::ZptLog
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().

MonitorElement * DrellYanValidation::Zrap
private

Definition at line 59 of file DrellYanValidation.h.

Referenced by analyze(), and beginJob().