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());
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 sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
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
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
MonitorElement * lepmet_ptLog
MonitorElement * Wdaughters
double weight(const edm::Event &)
MonitorElement * cos_theta_gamma_lepton