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")) {
36 nEvt = dqm.
book1dHisto(
"nEvt",
"n analyzed Events", 1, 0., 1.,
"bin",
"Number of Events");
39 Wmass = dqm.
book1dHisto(
"Wmass",
"inv. Mass W", 70, 0, 140,
"M_{T}^{W} (GeV)",
"Number of Events");
40 WmassPeak = dqm.
book1dHisto(
"WmassPeak",
"inv. Mass W", 80, 80, 100,
"M_{T}^{W} (GeV)",
"Number of Events");
41 Wpt = dqm.
book1dHisto(
"Wpt",
"W pt", 100, 0, 200,
"P_{T}^{W} (GeV)",
"Number of Events");
42 WptLog = dqm.
book1dHisto(
"WptLog",
"log(W pt)", 100, 0., 5.,
"Log_{10}(P_{T}^{W}) (GeV)",
"Number of Events");
43 Wrap = dqm.
book1dHisto(
"Wrap",
"W y", 100, -5, 5,
"Y^{W}",
"Number of Events");
44 Wdaughters = dqm.
book1dHisto(
"Wdaughters",
"W daughters", 60, -30, 30,
"W daughters (PDG ID)",
"Number of Events");
47 "lepton-met transverse mass",
51 "M_{T}^{Lepton_{T}+E_{T}^{Miss}} (GeV)",
54 "lepton-met transverse mass",
58 "M_{T}^{Lepton_{T}+E_{T}^{Miss}} (GeV)",
61 "lepmet_pt",
"lepton-met", 100, 0, 200,
"P_{T}^{Lepton_{T}+E_{T}^{Miss}} (GeV)",
"Number of Events");
67 "log_{10}(P_{T}^{Lepton_{T}+E_{T}^{Miss}}) (Log_{10}(GeV))",
71 "gamma_energy",
"photon energy in W rest frame", 200, 0., 100.,
"E_{#gamma}^{W rest-frame}",
"Number of Events");
73 "cos_theta_gamma_lepton in W rest frame",
77 "cos(#theta_{#gamma-lepton}^{W rest-frame})",
80 leppt = dqm.
book1dHisto(
"leadpt",
"lepton pt", 200, 0., 200.,
"P_{t}^{Lead-Lepton} (GeV)",
"Number of Events");
81 met = dqm.
book1dHisto(
"met",
"met", 200, 0., 200.,
"E_{T}^{Miss} (GeV)",
"Number of Events");
82 lepeta = dqm.
book1dHisto(
"leadeta",
"leading lepton eta", 100, -5., 5.,
"#eta^{Lead-Lepton}",
"Number of Events");
103 std::vector<const HepMC::GenParticle*> allleptons;
104 std::vector<const HepMC::GenParticle*> allneutrinos;
112 for (HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin();
113 iter != myGenEvent->particles_end();
116 if ((*iter)->status() == 3 &&
std::abs((*iter)->pdg_id()) == 15)
119 if ((*iter)->status() == requiredstatus) {
121 if ((*iter)->pdg_id() ==
_flavor)
122 allleptons.push_back(*iter);
124 allneutrinos.push_back(*iter);
129 if (allleptons.empty() || allneutrinos.empty())
137 std::vector<const HepMC::GenParticle*>
products;
138 if (allleptons.front()->pdg_id() * allneutrinos.front()->pdg_id() > 0)
142 if (allleptons.front()->momentum().perp() < 20. || allneutrinos.front()->momentum().perp() < 20.)
146 std::vector<const HepMC::GenParticle*> selectedLepton;
147 selectedLepton.push_back(allleptons.front());
148 std::vector<const HepMC::GenParticle*> fsrphotons;
155 TLorentzVector
lep1(allleptons[0]->momentum().
x(),
156 allleptons[0]->momentum().
y(),
157 allleptons[0]->momentum().
z(),
158 allleptons[0]->momentum().
t());
159 TLorentzVector
lep2(allneutrinos[0]->momentum().
x(),
160 allneutrinos[0]->momentum().
y(),
161 allneutrinos[0]->momentum().
z(),
162 allneutrinos[0]->momentum().
t());
163 TLorentzVector dilepton_mom = lep1 +
lep2;
164 TLorentzVector dilepton_andphoton_mom = dilepton_mom;
165 std::vector<TLorentzVector> gammasMomenta;
166 for (
unsigned int ipho = 0; ipho < fsrphotons.size(); ++ipho) {
167 TLorentzVector phomom(fsrphotons[ipho]->momentum().
x(),
168 fsrphotons[ipho]->momentum().
y(),
169 fsrphotons[ipho]->momentum().
z(),
170 fsrphotons[ipho]->momentum().
t());
171 dilepton_andphoton_mom += phomom;
173 gammasMomenta.push_back(phomom);
179 WptLog->
Fill(log10(dilepton_andphoton_mom.Pt()), weight);
183 TLorentzVector lep1T(lep1.Px(), lep1.Py(), 0., lep1.Et());
184 TLorentzVector lepmet_mom = lep1T + met_mom;
197 TVector3
boost = dilepton_andphoton_mom.BoostVector();
201 for (
unsigned int ipho = 0; ipho < gammasMomenta.size(); ++ipho) {
202 gammasMomenta[ipho].Boost(boost);
204 std::sort(gammasMomenta.begin(), gammasMomenta.end(), HepMCValidationHelper::GreaterByE<TLorentzVector>);
207 if (!gammasMomenta.empty() && dilepton_andphoton_mom.M() > 50.) {
209 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
void setCurrentFolder(std::string const &fullpath)
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
MonitorElement * lepmet_mT
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
MonitorElement * lepmet_pt
bool getData(T &iHolder) const
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
MonitorElement * book1dHisto(std::string name, std::string title, int n, double xmin, double xmax, std::string xaxis, std::string yaxis)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
MonitorElement * gamma_energy
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
const HepMC::GenEvent * GetEvent() const
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
MonitorElement * lepmet_mTPeak
MonitorElement * WmassPeak
void analyze(const edm::Event &, const edm::EventSetup &) override
lep1
print 'MRbb(1b)',event.mr_bb
MonitorElement * lepmet_ptLog
MonitorElement * Wdaughters
double weight(const edm::Event &)
MonitorElement * cos_theta_gamma_lepton