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/DrellYan";
86 const HepMC::GenEvent *myGenEvent = evt->GetEvent();
90 std::vector<const HepMC::GenParticle*> allproducts;
97 for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter) {
99 if ((*iter)->status()==3 &&
abs((*iter)->pdg_id() == 15) )
return;
101 if((*iter)->status()==requiredstatus) {
103 allproducts.push_back(*iter);
108 if (allproducts.size() < 2)
return;
114 std::vector<const HepMC::GenParticle*>
products;
115 products.push_back(allproducts.front());
117 double charge1 = PData1->charge();
118 for (
unsigned int i = 1;
i < allproducts.size(); ++
i ){
120 double charge2 = PData2->charge();
121 if (charge1*charge2 < 0) products.push_back(allproducts[
i]);
125 if (products.size() < 2)
return;
127 assert(products[0]->momentum().
perp() > products[1]->momentum().
perp());
130 if (products[0]->momentum().
perp() < 20.)
return;
133 TLorentzVector lep1(products[0]->momentum().
x(), products[0]->momentum().
y(), products[0]->momentum().
z(), products[0]->momentum().
t());
134 TLorentzVector lep2(products[1]->momentum().
x(), products[1]->momentum().
y(), products[1]->momentum().
z(), products[1]->momentum().
t());
135 TLorentzVector dilepton_mom = lep1 + lep2;
136 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
139 if (dilepton_mom.M() < 60.)
return;
142 std::vector<const HepMC::GenParticle*> fsrphotons;
148 std::vector<TLorentzVector> gammasMomenta;
149 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
150 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(), fsrphotons[ipho]->momentum().
y(), fsrphotons[ipho]->momentum().
z(), fsrphotons[ipho]->momentum().
t());
151 dilepton_andphoton_mom += phomom;
153 gammasMomenta.push_back(phomom);
158 Zpt->
Fill(dilepton_andphoton_mom.Pt());
159 ZptLog->
Fill(log10(dilepton_andphoton_mom.Pt()));
160 Zrap->
Fill(dilepton_andphoton_mom.Rapidity());
176 TVector3 boost = dilepton_andphoton_mom.BoostVector();
180 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
181 gammasMomenta[ipho].Boost(boost);
183 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
186 if (gammasMomenta.size() != 0 && dilepton_andphoton_mom.M() > 50.) {
188 double dphi = lep1.DeltaR(gammasMomenta.front()) < lep2.DeltaR(gammasMomenta.front()) ?
189 lep1.DeltaPhi(gammasMomenta.front()) : lep2.DeltaPhi(gammasMomenta.front());
MonitorElement * gamma_energy
MonitorElement * dilep_rap
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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.
edm::InputTag hepmcCollection_
MonitorElement * cos_theta_gamma_lepton
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
virtual void endRun(const edm::Run &, const edm::EventSetup &)
void getData(T &iHolder) const
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
MonitorElement * dilep_massPeak
virtual ~DrellYanValidation()
ESProducts< T, S > products(const T &i1, const S &i2)
Cos< T >::type cos(const T &t)
DQMStore * dbe
ME's "container".
MonitorElement * Zdaughters
MonitorElement * dilep_pt
HepPDT::ParticleData ParticleData
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
std::string _name
decay flavor name
T perp() const
Magnitude of transverse component.
MonitorElement * dilep_mass
MonitorElement * ZmassPeak
MonitorElement * dilep_ptLog
DrellYanValidation(const edm::ParameterSet &)
void setCurrentFolder(const std::string &fullpath)