11 #include "TLorentzVector.h"
13 #include "CLHEP/Units/defs.h"
14 #include "CLHEP/Units/PhysicalConstants.h"
21 hepmcCollection_(iPSet.getParameter<edm::
InputTag>(
"hepmcCollection")),
22 _flavor(iPSet.getParameter<int>(
"decaysTo")),
23 _name(iPSet.getParameter<std::string>(
"name"))
35 std::string folderName =
"Generator/W";
84 const HepMC::GenEvent *myGenEvent = evt->GetEvent();
88 std::vector<const HepMC::GenParticle*> allleptons;
89 std::vector<const HepMC::GenParticle*> allneutrinos;
96 for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter) {
98 if ((*iter)->status()==3 &&
abs((*iter)->pdg_id() == 15) )
return;
100 if((*iter)->status()==requiredstatus) {
103 allleptons.push_back(*iter);
105 allneutrinos.push_back(*iter);
110 if (allleptons.empty() || allneutrinos.empty())
return;
117 std::vector<const HepMC::GenParticle*>
products;
118 if (allleptons.front()->pdg_id() * allneutrinos.front()->pdg_id() > 0)
return;
121 if (allleptons.front()->momentum().perp() < 20. || allneutrinos.front()->momentum().perp() < 20. )
return;
124 std::vector<const HepMC::GenParticle*> selectedLepton;
125 selectedLepton.push_back(allleptons.front());
126 std::vector<const HepMC::GenParticle*> fsrphotons;
133 TLorentzVector lep1(allleptons[0]->momentum().
x(), allleptons[0]->momentum().
y(), allleptons[0]->momentum().
z(), allleptons[0]->momentum().
t());
134 TLorentzVector lep2(allneutrinos[0]->momentum().
x(), allneutrinos[0]->momentum().
y(), allneutrinos[0]->momentum().
z(), allneutrinos[0]->momentum().
t());
135 TLorentzVector dilepton_mom = lep1 + lep2;
136 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
137 std::vector<TLorentzVector> gammasMomenta;
138 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
139 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(), fsrphotons[ipho]->momentum().
y(), fsrphotons[ipho]->momentum().
z(), fsrphotons[ipho]->momentum().
t());
140 dilepton_andphoton_mom += phomom;
142 gammasMomenta.push_back(phomom);
147 Wpt->
Fill(dilepton_andphoton_mom.Pt());
148 WptLog->
Fill(log10(dilepton_andphoton_mom.Pt()));
149 Wrap->
Fill(dilepton_andphoton_mom.Rapidity());
152 TLorentzVector lep1T(lep1.Px(), lep1.Py(), 0., lep1.Et());
153 TLorentzVector lepmet_mom = lep1T + met_mom;
166 TVector3 boost = dilepton_andphoton_mom.BoostVector();
170 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
171 gammasMomenta[ipho].Boost(boost);
173 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
176 if (gammasMomenta.size() != 0 && dilepton_andphoton_mom.M() > 50.) {
178 double dphi = lep1.DeltaR(gammasMomenta.front());
WValidation(const edm::ParameterSet &)
edm::InputTag hepmcCollection_
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 * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
std::string _name
decay flavor name
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
DQMStore * dbe
ME's "container".
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
virtual void endRun(const edm::Run &, const edm::EventSetup &)
void getData(T &iHolder) const
MonitorElement * lepmet_mT
MonitorElement * lepmet_pt
ESProducts< T, S > products(const T &i1, const S &i2)
Cos< T >::type cos(const T &t)
MonitorElement * gamma_energy
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
MonitorElement * lepmet_mTPeak
MonitorElement * WmassPeak
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * lepmet_ptLog
MonitorElement * Wdaughters
MonitorElement * cos_theta_gamma_lepton
void setCurrentFolder(const std::string &fullpath)