11 #include "TLorentzVector.h"
13 #include "CLHEP/Units/defs.h"
14 #include "CLHEP/Units/PhysicalConstants.h"
22 hepmcCollection_(iPSet.getParameter<edm::
InputTag>(
"hepmcCollection")),
23 _flavor(iPSet.getParameter<int>(
"decaysTo")),
24 _name(iPSet.getParameter<std::
string>(
"name"))
85 const HepMC::GenEvent *myGenEvent = evt->GetEvent();
91 std::vector<const HepMC::GenParticle*> allleptons;
92 std::vector<const HepMC::GenParticle*> allneutrinos;
99 for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter) {
101 if ((*iter)->status()==3 &&
abs((*iter)->pdg_id() == 15) )
return;
103 if((*iter)->status()==requiredstatus) {
106 allleptons.push_back(*iter);
108 allneutrinos.push_back(*iter);
113 if (allleptons.empty() || allneutrinos.empty())
return;
120 std::vector<const HepMC::GenParticle*>
products;
121 if (allleptons.front()->pdg_id() * allneutrinos.front()->pdg_id() > 0)
return;
124 if (allleptons.front()->momentum().perp() < 20. || allneutrinos.front()->momentum().perp() < 20. )
return;
127 std::vector<const HepMC::GenParticle*> selectedLepton;
128 selectedLepton.push_back(allleptons.front());
129 std::vector<const HepMC::GenParticle*> fsrphotons;
136 TLorentzVector lep1(allleptons[0]->momentum().
x(), allleptons[0]->momentum().
y(), allleptons[0]->momentum().
z(), allleptons[0]->momentum().
t());
137 TLorentzVector lep2(allneutrinos[0]->momentum().
x(), allneutrinos[0]->momentum().
y(), allneutrinos[0]->momentum().
z(), allneutrinos[0]->momentum().
t());
138 TLorentzVector dilepton_mom = lep1 + lep2;
139 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
140 std::vector<TLorentzVector> gammasMomenta;
141 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
142 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(), fsrphotons[ipho]->momentum().
y(), fsrphotons[ipho]->momentum().
z(), fsrphotons[ipho]->momentum().
t());
143 dilepton_andphoton_mom += phomom;
145 gammasMomenta.push_back(phomom);
151 WptLog->
Fill(log10(dilepton_andphoton_mom.Pt()),weight);
155 TLorentzVector lep1T(lep1.Px(), lep1.Py(), 0., lep1.Et());
156 TLorentzVector lepmet_mom = lep1T + met_mom;
169 TVector3 boost = dilepton_andphoton_mom.BoostVector();
173 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
174 gammasMomenta[ipho].Boost(boost);
176 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
179 if (gammasMomenta.size() != 0 && dilepton_andphoton_mom.M() > 50.) {
181 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
double weight(const edm::Event &)
MonitorElement * cos_theta_gamma_lepton
void setCurrentFolder(const std::string &fullpath)