9 #include "TLorentzVector.h"
11 #include "CLHEP/Units/defs.h"
12 #include "CLHEP/Units/PhysicalConstants.h"
19 wmanager_(iPSet,consumesCollector()),
20 hepmcCollection_(iPSet.getParameter<edm::
InputTag>(
"hepmcCollection")),
21 _flavor(iPSet.getParameter<int>(
"decaysTo")),
22 _name(iPSet.getParameter<std::
string>(
"name"))
76 const HepMC::GenEvent *myGenEvent = evt->GetEvent();
82 std::vector<const HepMC::GenParticle*> allleptons;
83 std::vector<const HepMC::GenParticle*> allneutrinos;
90 for(HepMC::GenEvent::particle_const_iterator
iter = myGenEvent->particles_begin();
iter != myGenEvent->particles_end(); ++
iter) {
92 if ((*iter)->status()==3 &&
abs((*iter)->pdg_id() == 15) )
return;
94 if((*iter)->status()==requiredstatus) {
97 allleptons.push_back(*
iter);
99 allneutrinos.push_back(*
iter);
104 if (allleptons.empty() || allneutrinos.empty())
return;
111 std::vector<const HepMC::GenParticle*>
products;
112 if (allleptons.front()->pdg_id() * allneutrinos.front()->pdg_id() > 0)
return;
115 if (allleptons.front()->momentum().perp() < 20. || allneutrinos.front()->momentum().perp() < 20. )
return;
118 std::vector<const HepMC::GenParticle*> selectedLepton;
119 selectedLepton.push_back(allleptons.front());
120 std::vector<const HepMC::GenParticle*> fsrphotons;
127 TLorentzVector lep1(allleptons[0]->momentum().
x(), allleptons[0]->momentum().
y(), allleptons[0]->momentum().
z(), allleptons[0]->momentum().
t());
128 TLorentzVector lep2(allneutrinos[0]->momentum().
x(), allneutrinos[0]->momentum().
y(), allneutrinos[0]->momentum().
z(), allneutrinos[0]->momentum().
t());
129 TLorentzVector dilepton_mom = lep1 + lep2;
130 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
131 std::vector<TLorentzVector> gammasMomenta;
132 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
133 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(), fsrphotons[ipho]->momentum().
y(), fsrphotons[ipho]->momentum().
z(), fsrphotons[ipho]->momentum().
t());
134 dilepton_andphoton_mom += phomom;
136 gammasMomenta.push_back(phomom);
142 WptLog->
Fill(log10(dilepton_andphoton_mom.Pt()),weight);
146 TLorentzVector lep1T(lep1.Px(), lep1.Py(), 0., lep1.Et());
147 TLorentzVector lepmet_mom = lep1T + met_mom;
160 TVector3 boost = dilepton_andphoton_mom.BoostVector();
164 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
165 gammasMomenta[ipho].Boost(boost);
167 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
170 if (gammasMomenta.size() != 0 && dilepton_andphoton_mom.M() > 50.) {
172 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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string _name
decay flavor name
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
void getData(T &iHolder) const
MonitorElement * lepmet_mT
MonitorElement * lepmet_pt
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
ESProducts< T, S > products(const T &i1, const S &i2)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
MonitorElement * gamma_energy
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
void setCurrentFolder(const std::string &fullpath)
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 &) override
MonitorElement * book1dHisto(TString name, TString title, int n, double xmin, double xmax, TString xaxis, TString yaxis)
MonitorElement * lepmet_ptLog
MonitorElement * Wdaughters
double weight(const edm::Event &)
MonitorElement * cos_theta_gamma_lepton