36 #include "TLorentzVector.h"
52 theElecTriggerPathToPass_ = parameters.
getParameter<std::vector<string> >(
"elecTriggerPathToPass");
53 theMuonTriggerPathToPass_ = parameters.
getParameter<std::vector<string> >(
"muonTriggerPathToPass");
54 theTriggerResultsToken_ =
56 theMuonCollectionLabel_ = consumes<reco::MuonCollection>(parameters.
getParameter<
InputTag>(
"muonCollection"));
57 theElectronCollectionLabel_ =
59 thePFJetCollectionToken_ = consumes<edm::View<reco::Jet> >(parameters.
getParameter<
InputTag>(
"PFJetCollection"));
60 theCaloMETCollectionToken_ = consumes<edm::View<reco::MET> >(parameters.
getParameter<
InputTag>(
"caloMETCollection"));
61 theVertexToken_ = consumes<reco::VertexCollection>(parameters.
getParameter<
InputTag>(
"vertexCollection"));
64 isValidHltConfig_ =
false;
66 h_vertex_number =
nullptr;
67 h_vertex_chi2 =
nullptr;
68 h_vertex_numTrks =
nullptr;
69 h_vertex_sumTrks =
nullptr;
70 h_vertex_d0 =
nullptr;
72 h_jet_count =
nullptr;
103 h_e_invWMass =
nullptr;
104 h_m_invWMass =
nullptr;
105 h_mumu_invMass =
nullptr;
106 h_ee_invMass =
nullptr;
114 char chtitle[256] =
"";
115 const size_t title_s =
sizeof(chtitle);
117 logTraceName =
"EwkAnalyzer";
119 LogTrace(logTraceName) <<
"Parameters initialization";
121 const float pi = 4 * atan(1);
125 h_vertex_number = ibooker.
book1D(
"vertex_number",
"Number of event vertices in collection", 10, -0.5, 9.5);
126 h_vertex_chi2 = ibooker.
book1D(
"vertex_chi2",
"Event Vertex #chi^{2}/n.d.o.f.", 20, 0.0, 2.0);
127 h_vertex_numTrks = ibooker.
book1D(
"vertex_numTrks",
"Event Vertex, number of tracks", 20, -0.5, 59.5);
128 h_vertex_sumTrks = ibooker.
book1D(
"vertex_sumTrks",
"Event Vertex, sum of track pt", 20, 0.0, 100.0);
129 h_vertex_d0 = ibooker.
book1D(
"vertex_d0",
"Event Vertex d0", 20, 0.0, 0.05);
131 h_jet_count = ibooker.
book1D(
"jet_count", chtitle, 8, -0.5, 7.5);
134 chtitle, title_s,
"Leading jet E_{T} (from %s);E_{T}(1^{st} jet) (GeV)", thePFJetCollectionLabel_.label().data());
135 h_jet_et = ibooker.
book1D(
"jet_et", chtitle, 20, 0., 200.0);
139 "Leading jet p_{T} (from %s);p_{T}(1^{st} jet) (GeV/c)",
140 thePFJetCollectionLabel_.label().data());
141 h_jet_pt = ibooker.
book1D(
"jet_pt", chtitle, 20, 0., 200.0);
143 snprintf(chtitle, title_s,
"Leading jet #eta (from %s); #eta (1^{st} jet)", thePFJetCollectionLabel_.label().data());
144 h_jet_eta = ibooker.
book1D(
"jet_eta", chtitle, 20, -10., 10.0);
146 snprintf(chtitle, title_s,
"Leading jet #phi (from %s); #phi(1^{st} jet)", thePFJetCollectionLabel_.label().data());
147 h_jet_phi = ibooker.
book1D(
"jet_phi", chtitle, 22, -1.1 * pi, 1.1 * pi);
151 "2^{nd} leading jet E_{T} (from %s);E_{T}(2^{nd} jet) (GeV)",
152 thePFJetCollectionLabel_.label().data());
153 h_jet2_et = ibooker.
book1D(
"jet2_et", chtitle, 20, 0., 200.0);
157 "2^{nd} leading jet #eta (from %s); #eta (2^{nd} jet)",
158 thePFJetCollectionLabel_.label().data());
159 h_jet2_eta = ibooker.
book1D(
"jet2_eta", chtitle, 20, -10., 10.0);
162 chtitle, title_s,
"2^{nd} leading jet #phi (from %s); #phi(2^{nd} jet)", thePFJetCollectionLabel_.label().data());
163 h_jet2_phi = ibooker.
book1D(
"jet2_phi", chtitle, 22, -1.1 * pi, 1.1 * pi);
165 h_e1_et = ibooker.
book1D(
"e1_et",
"E_{T} of Leading Electron;E_{T} (GeV)", 20, 0.0, 100.0);
166 h_e2_et = ibooker.
book1D(
"e2_et",
"E_{T} of Second Electron;E_{T} (GeV)", 20, 0.0, 100.0);
167 h_e1_eta = ibooker.
book1D(
"e1_eta",
"#eta of Leading Electron;#eta", 20, -4.0, 4.0);
169 h_e2_eta = ibooker.
book1D(
"e2_eta",
"#eta of Second Electron;#eta", 20, -4.0, 4.0);
171 h_e1_phi = ibooker.
book1D(
"e1_phi",
"#phi of Leading Electron;#phi", 22, -1.1 * pi, 1.1 * pi);
172 h_e2_phi = ibooker.
book1D(
"e2_phi",
"#phi of Second Electron;#phi", 22, -1.1 * pi, 1.1 * pi);
173 h_m1_pt = ibooker.
book1D(
"m1_pt",
"p_{T} of Leading Muon;p_{T}(1^{st} #mu) (GeV)", 20, 0.0, 100.0);
174 h_m2_pt = ibooker.
book1D(
"m2_pt",
"p_{T} of Second Muon;p_{T}(2^{nd} #mu) (GeV)", 20, 0.0, 100.0);
175 h_m1_eta = ibooker.
book1D(
"m1_eta",
"#eta of Leading Muon;#eta(1^{st} #mu)", 20, -4.0, 4.0);
176 h_m2_eta = ibooker.
book1D(
"m2_eta",
"#eta of Second Muon;#eta(2^{nd} #mu)", 20, -4.0, 4.0);
177 h_m1_phi = ibooker.
book1D(
178 "m1_phi",
"#phi of Leading Muon;#phi(1^{st} #mu)", 20, (-1. - 1. / 10.) * pi, (1. + 1. / 10.) * pi);
180 ibooker.
book1D(
"m2_phi",
"#phi of Second Muon;#phi(2^{nd} #mu)", 20, (-1. - 1. / 10.) * pi, (1. + 1. / 10.) * pi);
182 snprintf(chtitle, title_s,
"Missing E_{T} (%s); GeV", theCaloMETCollectionLabel_.label().data());
183 h_met = ibooker.
book1D(
"met", chtitle, 20, 0.0, 100);
185 ibooker.
book1D(
"met_phi",
"Missing E_{T} #phi;#phi(MET)", 22, (-1. - 1. / 10.) * pi, (1. + 1. / 10.) * pi);
187 h_e_invWMass = ibooker.
book1D(
"we_invWMass",
"W-> e #nu Transverse Mass;M_{T} (GeV)", 20, 0.0, 140.0);
188 h_m_invWMass = ibooker.
book1D(
"wm_invWMass",
"W-> #mu #nu Transverse Mass;M_{T} (GeV)", 20, 0.0, 140.0);
189 h_mumu_invMass = ibooker.
book1D(
"z_mm_invMass",
"#mu#mu Invariant Mass;InvMass (GeV)", 20, 40.0, 140.0);
190 h_ee_invMass = ibooker.
book1D(
"z_ee_invMass",
"ee Invariant Mass;InvMass (Gev)", 20, 40.0, 140.0);
196 bool isConfigChanged =
false;
199 const std::string hltProcessName(theTriggerResultsCollection_.process());
200 isValidHltConfig_ = hltConfigProvider_.init(theRun, theSetup, hltProcessName, isConfigChanged);
205 if (!isValidHltConfig_)
208 LogTrace(logTraceName) <<
"Analysis of event # ";
211 iEvent.
getByToken(theTriggerResultsToken_, HLTresults);
218 std::vector<std::string> eleTrigPathNames;
219 std::vector<std::string> muTrigPathNames;
225 bool passed_electron_HLT =
false;
226 bool passed_muon_HLT =
false;
227 for (
unsigned int i = 0;
i < HLTresults->size();
i++) {
230 for (
unsigned int index = 0;
index < theElecTriggerPathToPass_.size() && !passed_electron_HLT;
index++) {
232 size_t trigPath = trigName.find(theElecTriggerPathToPass_[
index]);
235 passed_electron_HLT = HLTresults->accept(
i);
239 for (
unsigned int index = 0;
index < theMuonTriggerPathToPass_.size() && !passed_muon_HLT;
index++) {
241 size_t trigPath = trigName.find(theMuonTriggerPathToPass_[
index]);
244 passed_muon_HLT = HLTresults->accept(
i);
250 if (!(passed_electron_HLT || passed_muon_HLT))
256 iEvent.
getByToken(theVertexToken_, vertexHandle);
260 VertexCollection::const_iterator
v = vertexCollection.begin();
261 int vertex_number = vertexCollection.size();
262 double vertex_chi2 = v->normalizedChi2();
263 double vertex_d0 =
sqrt(v->x() * v->x() + v->y() * v->y());
264 double vertex_numTrks = v->tracksSize();
265 double vertex_sumTrks = 0.0;
270 vertex_sumTrks += (*vertex_curTrack)->pt();
275 iEvent.
getByToken(theCaloMETCollectionToken_, caloMETCollection);
276 if (!caloMETCollection.
isValid())
278 float missing_et = caloMETCollection->begin()->et();
279 float met_phi = caloMETCollection->begin()->phi();
284 iEvent.
getByToken(theElectronCollectionLabel_, electronCollection);
285 if (!electronCollection.
isValid())
289 float electron_et = -8.0;
290 float electron_eta = -8.0;
291 float electron_phi = -8.0;
292 float electron2_et = -9.0;
293 float electron2_eta = -9.0;
294 float electron2_phi = -9.0;
295 float ee_invMass = -9.0;
296 TLorentzVector e1, e2;
300 if (passed_electron_HLT) {
301 for (reco::GsfElectronCollection::const_iterator recoElectron = electronCollection->begin();
302 recoElectron != electronCollection->end();
305 if (recoElectron->et() < 20 || fabs(recoElectron->eta()) > 2.5)
309 if (recoElectron->deltaPhiSuperClusterTrackAtVtx() > 0.58 ||
310 recoElectron->deltaEtaSuperClusterTrackAtVtx() > 0.01 || recoElectron->sigmaIetaIeta() > 0.027)
313 if (recoElectron->et() > electron_et) {
314 electron2_et = electron_et;
315 electron2_eta = electron_eta;
316 electron2_phi = electron_phi;
317 electron_et = recoElectron->et();
318 electron_eta = recoElectron->eta();
319 electron_phi = recoElectron->phi();
320 e1 = TLorentzVector(recoElectron->momentum().x(),
321 recoElectron->momentum().y(),
322 recoElectron->momentum().z(),
324 }
else if (recoElectron->et() > electron2_et) {
325 electron2_et = recoElectron->et();
326 electron2_eta = recoElectron->eta();
327 electron2_phi = recoElectron->phi();
328 e2 = TLorentzVector(recoElectron->momentum().x(),
329 recoElectron->momentum().y(),
330 recoElectron->momentum().z(),
334 if (electron2_et > 0.0) {
335 TLorentzVector pair = e1 + e2;
336 ee_invMass = pair.M();
344 iEvent.
getByToken(theMuonCollectionLabel_, muonCollection);
349 float mm_invMass = -9.0;
350 float muon_pt = -9.0;
351 float muon_eta = -9.0;
352 float muon_phi = -9.0;
353 float muon2_pt = -9.0;
354 float muon2_eta = -9.0;
355 float muon2_phi = -9.0;
356 TLorentzVector m1,
m2;
358 if (passed_muon_HLT) {
359 for (reco::MuonCollection::const_iterator recoMuon = muonCollection->begin(); recoMuon != muonCollection->end();
362 if (recoMuon->pt() < 20 || !recoMuon->isGlobalMuon())
365 if (recoMuon->globalTrack()->normalizedChi2() > 10)
368 if (recoMuon->pt() > muon_pt) {
370 muon2_eta = muon_eta;
371 muon2_phi = muon_phi;
372 muon_pt = recoMuon->pt();
373 muon_eta = recoMuon->eta();
374 muon_phi = recoMuon->phi();
376 TLorentzVector(recoMuon->momentum().x(), recoMuon->momentum().y(), recoMuon->momentum().z(), recoMuon->p());
377 }
else if (recoMuon->pt() > muon2_pt) {
378 muon2_pt = recoMuon->pt();
379 muon2_eta = recoMuon->eta();
380 muon2_phi = recoMuon->phi();
382 TLorentzVector(recoMuon->momentum().x(), recoMuon->momentum().y(), recoMuon->momentum().z(), recoMuon->p());
386 if (muon2_pt > 0.0) {
387 TLorentzVector pair = m1 +
m2;
388 mm_invMass = pair.M();
397 iEvent.
getByToken(thePFJetCollectionToken_, PFJetCollection);
398 if (!PFJetCollection.
isValid())
401 unsigned int muonCollectionSize = muonCollection->size();
403 unsigned int PFJetCollectionSize = PFJetCollection->size();
407 float jet_et = -80.0;
408 float jet_pt = -80.0;
409 float jet_eta = -80.0;
410 float jet_phi = -80.0;
411 float jet2_et = -90.0;
412 float jet2_eta = -90.0;
413 float jet2_phi = -90.0;
425 for (
unsigned int i = 0;
i < PFJetCollectionSize;
i++) {
426 const Jet&
jet = PFJetCollection->at(
i);
428 double minDistance = 99999;
429 for (
unsigned int j = 0;
j < muonCollectionSize;
j++) {
430 const Muon&
mu = muonCollection->at(
j);
433 if (minDistance > distance)
436 if (minDistance < 0.3)
442 if (electron_et > 0.0 && fabs(jet.
eta() - electron_eta) < 0.2 &&
calcDeltaPhi(jet.
phi(), electron_phi) < 0.2)
444 if (electron2_et > 0.0 && fabs(jet.
eta() - electron2_eta) < 0.2 &&
calcDeltaPhi(jet.
phi(), electron2_phi) < 0.2)
454 if (jet.
et() < eJetMin_)
469 if (jet.
et() > jet_et) {
481 }
else if (jet.
et() > jet2_et) {
486 jet2_eta = jet.
eta();
487 jet2_phi = jet.
phi();
497 bool fill_e1 =
false;
498 bool fill_e2 =
false;
499 bool fill_m1 =
false;
500 bool fill_m2 =
false;
501 bool fill_met =
false;
504 if (ee_invMass > 0.0) {
505 h_ee_invMass->Fill(ee_invMass);
511 if (mm_invMass > 0.0) {
512 h_mumu_invMass->Fill(mm_invMass);
515 h_jet2_et->Fill(jet2_et);
519 if (electron_et > 0.0 && missing_et > 20.0) {
520 float dphiW = fabs(met_phi - electron_phi);
521 float W_mt_e =
sqrt(2 * missing_et * electron_et * (1 -
cos(dphiW)));
522 h_e_invWMass->Fill(W_mt_e);
528 if (muon_pt > 0.0 && missing_et > 20.0) {
529 float dphiW = fabs(met_phi - muon_phi);
530 float W_mt_m =
sqrt(2 * missing_et * muon_pt * (1 -
cos(dphiW)));
531 h_m_invWMass->Fill(W_mt_m);
536 if (jet_et > -10.0) {
537 h_jet_et->Fill(jet_et);
538 h_jet_count->Fill(jet_count);
542 h_jet_pt->Fill(jet_pt);
545 if (jet_eta > -50.) {
546 h_jet_eta->Fill(jet_eta);
549 if (jet_phi > -10.) {
550 h_jet_phi->Fill(jet_phi);
553 if (jet2_et > -10.0) {
554 h_jet2_et->Fill(jet2_et);
561 if (jet2_eta > -50.) {
562 h_jet2_eta->Fill(jet2_eta);
565 if (jet2_phi > -10.) {
566 h_jet2_phi->Fill(jet2_phi);
569 if (fill_e1 || fill_m1) {
570 h_vertex_number->Fill(vertex_number);
571 h_vertex_chi2->Fill(vertex_chi2);
572 h_vertex_d0->Fill(vertex_d0);
573 h_vertex_numTrks->Fill(vertex_numTrks);
574 h_vertex_sumTrks->Fill(vertex_sumTrks);
578 h_e1_et->Fill(electron_et);
579 h_e1_eta->Fill(electron_eta);
580 h_e1_phi->Fill(electron_phi);
583 h_e2_et->Fill(electron2_et);
584 h_e2_eta->Fill(electron2_eta);
585 h_e2_phi->Fill(electron2_phi);
588 h_m1_pt->Fill(muon_pt);
589 h_m1_eta->Fill(muon_eta);
590 h_m1_phi->Fill(muon_phi);
593 h_m2_pt->Fill(muon2_pt);
594 h_m2_eta->Fill(muon2_eta);
595 h_m2_phi->Fill(muon2_phi);
598 h_met->Fill(missing_et);
599 h_met_phi->Fill(met_phi);
611 if (deltaPhi > 3.1415926)
612 deltaPhi = 2 * 3.1415926 -
deltaPhi;
double calcDeltaPhi(double phi1, double phi2)
void analyze(const edm::Event &, const edm::EventSetup &) override
Get the analysis.
T getUntrackedParameter(std::string const &, T const &) const
double pt() const final
transverse momentum
EwkDQM(const edm::ParameterSet &)
Constructor.
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Base class for all types of Jets.
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
~EwkDQM() override
Destructor.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Cos< T >::type cos(const T &t)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
static const char *const trigNames[]
T const * product() const
std::string const & triggerName(unsigned int index) const
T getParameter(std::string const &) const
std::vector< PFJet > PFJetCollection
collection of PFJet objects
double et() const final
transverse energy
double calcDeltaPhi(double phi1, double phi2)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
double phi() const final
momentum azimuthal angle
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
double eta() const final
momentum pseudorapidity