10 #include "TLorentzVector.h" 12 #include "CLHEP/Units/defs.h" 13 #include "CLHEP/Units/PhysicalConstants.h" 20 wmanager_(iPSet,consumesCollector()),
21 hepmcCollection_(iPSet.getParameter<
edm::
InputTag>(
"hepmcCollection")),
22 _flavor(iPSet.getParameter<
int>(
"decaysTo")),
23 _name(iPSet.getParameter<
std::
string>(
"name"))
42 nEvt = dqm.
book1dHisto(
"nEvt",
"n analyzed Events", 1, 0., 1.,
"bin",
"Number of Events");
45 Zmass = dqm.
book1dHisto(
"Zmass",
"inv. Mass Z", 70 ,0,140,
"M_{Z} (GeV)",
"Number of Events");
46 ZmassPeak = dqm.
book1dHisto(
"ZmassPeak",
"inv. Mass Z", 80 ,80 ,100,
"M_{Z} (GeV)",
"Number of Events");
47 Zpt = dqm.
book1dHisto(
"Zpt",
"Z pt",100,0,200,
"P_{t}^{Z} (GeV)",
"Number of Events");
48 ZptLog = dqm.
book1dHisto(
"ZptLog",
"log(Z pt)",100,0.,5.,
"log_{10}(P_{t}^{Z}) (log_{10}(GeV))",
"Number of Events");
49 Zrap = dqm.
book1dHisto(
"Zrap",
"Z y", 100, -5, 5,
"Y_{Z}",
"Number of Events");
50 Zdaughters = dqm.
book1dHisto(
"Zdaughters",
"Z daughters", 60, -30, 30,
"Z daughters (PDG ID)",
"Number of Events");
52 dilep_mass = dqm.
book1dHisto(
"dilep_mass",
"inv. Mass dilepton", 70 ,0,140,
"M_{ll} (GeV)",
"Number of Events");
54 dilep_pt = dqm.
book1dHisto(
"dilep_pt",
"dilepton pt",100,0,200,
"P_{t}^{ll} (GeV)",
"Number of Events");
55 dilep_ptLog = dqm.
book1dHisto(
"dilep_ptLog",
"log(dilepton pt)",100,0.,5.,
"log_{10}(P_{t}^{ll}) (log_{10}(GeV))",
"Number of Events");
58 gamma_energy = dqm.
book1dHisto(
"gamma_energy",
"photon energy in Z rest frame", 200, 0., 100.,
"E_{#gamma}^{Z rest-frame} (GeV)",
"Number of Events");
59 cos_theta_gamma_lepton = dqm.
book1dHisto(
"cos_theta_gamma_lepton",
"cos_theta_gamma_lepton in Z rest frame", 200, -1, 1,
"cos(#theta_{#gamma-lepton}^{Z rest-frame})",
"Number of Events");
61 leadpt = dqm.
book1dHisto(
"leadpt",
"leading lepton pt", 200, 0., 200.,
"P_{t}^{1st-lepton}",
"Number of Events");
62 secpt = dqm.
book1dHisto(
"secpt",
"second lepton pt", 200, 0., 200.,
"P_{t}^{2nd-lepton}",
"Number of Events");
63 leadeta = dqm.
book1dHisto(
"leadeta",
"leading lepton eta", 100, -5., 5.,
"#eta^{1st-lepton}",
"Number of Events");
64 seceta = dqm.
book1dHisto(
"seceta",
"second lepton eta", 100, -5., 5.,
"#eta^{2nd-lepton}",
"Number of Events");
79 const HepMC::GenEvent *myGenEvent = evt->
GetEvent();
87 std::vector<const HepMC::GenParticle*> allproducts;
94 for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter) {
96 if ((*iter)->status()==3 &&
std::abs((*iter)->pdg_id()) == 15)
return;
98 if((*iter)->status()==requiredstatus) {
100 allproducts.push_back(*iter);
105 if (allproducts.size() < 2)
return;
111 std::vector<const HepMC::GenParticle*>
products;
112 products.push_back(allproducts.front());
114 double charge1 = PData1->charge();
115 for (
unsigned int i = 1;
i < allproducts.size(); ++
i ){
117 double charge2 = PData2->charge();
118 if (charge1*charge2 < 0) products.push_back(allproducts[
i]);
122 if (products.size() < 2)
return;
124 assert(products[0]->momentum().
perp() >= products[1]->momentum().
perp());
127 if (products[0]->momentum().
perp() < 20.)
return;
130 TLorentzVector
lep1(products[0]->momentum().
x(), products[0]->momentum().
y(), products[0]->momentum().
z(), products[0]->momentum().
t());
131 TLorentzVector
lep2(products[1]->momentum().
x(), products[1]->momentum().
y(), products[1]->momentum().
z(), products[1]->momentum().
t());
132 TLorentzVector dilepton_mom = lep1 +
lep2;
133 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
136 if (dilepton_mom.M() < 60.)
return;
139 std::vector<const HepMC::GenParticle*> fsrphotons;
145 std::vector<TLorentzVector> gammasMomenta;
146 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho){
147 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(), fsrphotons[ipho]->momentum().
y(), fsrphotons[ipho]->momentum().
z(), fsrphotons[ipho]->momentum().
t());
148 dilepton_andphoton_mom += phomom;
150 gammasMomenta.push_back(phomom);
156 ZptLog->
Fill(log10(dilepton_andphoton_mom.Pt()),weight);
173 TVector3
boost = dilepton_andphoton_mom.BoostVector();
177 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho){
178 gammasMomenta[ipho].Boost(boost);
180 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
183 if (!gammasMomenta.empty() && dilepton_andphoton_mom.M() > 50.) {
185 double dphi = lep1.DeltaR(gammasMomenta.front()) < lep2.DeltaR(gammasMomenta.front()) ?
186 lep1.DeltaPhi(gammasMomenta.front()) : lep2.DeltaPhi(gammasMomenta.front());
MonitorElement * gamma_energy
MonitorElement * dilep_rap
void findFSRPhotons(const std::vector< const HepMC::GenParticle * > &leptons, const std::vector< const HepMC::GenParticle * > &all, double deltaR, std::vector< const HepMC::GenParticle * > &photons)
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::InputTag hepmcCollection_
MonitorElement * cos_theta_gamma_lepton
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
~DrellYanValidation() override
MonitorElement * book1dHisto(std::string name, std::string title, int n, double xmin, double xmax, std::string xaxis, std::string yaxis)
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
bool getData(T &iHolder) const
MonitorElement * dilep_massPeak
void setCurrentFolder(std::string const &fullpath)
void analyze(edm::Event const &, edm::EventSetup const &) override
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
MonitorElement * Zdaughters
MonitorElement * dilep_pt
HepPDT::ParticleData ParticleData
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
const HepMC::GenEvent * GetEvent() const
std::string _name
decay flavor name
T perp() const
Magnitude of transverse component.
MonitorElement * dilep_mass
MonitorElement * ZmassPeak
MonitorElement * dilep_ptLog
lep1
print 'MRbb(1b)',event.mr_bb
double weight(const edm::Event &)
DrellYanValidation(const edm::ParameterSet &)