42 #include "TLorentzVector.h"
56 theElecTriggerPathToPass_ =
57 parameters.
getParameter<std::vector<string> >(
"elecTriggerPathToPass");
58 theMuonTriggerPathToPass_ =
59 parameters.
getParameter<std::vector<string> >(
"muonTriggerPathToPass");
64 theTriggerResultsCollection_ =
67 theElectronCollectionLabel_ =
70 thePFJetCollectionLabel_ =
75 isValidHltConfig_ =
false;
127 char chtitle[256] =
"";
128 const size_t title_s =
sizeof(chtitle);
130 logTraceName =
"EwkAnalyzer";
132 LogTrace(logTraceName) <<
"Parameters initialization";
133 theDbe->setCurrentFolder(
"Physics/EwkDQM");
135 const float pi = 4*atan(1);
138 h_vertex_number = theDbe->book1D(
"vertex_number",
139 "Number of event vertices in collection",
141 h_vertex_chi2 = theDbe->book1D(
"vertex_chi2",
142 "Event Vertex #chi^{2}/n.d.o.f.",
144 h_vertex_numTrks = theDbe->book1D(
"vertex_numTrks",
145 "Event Vertex, number of tracks",
147 h_vertex_sumTrks = theDbe->book1D(
"vertex_sumTrks",
148 "Event Vertex, sum of track pt",
150 h_vertex_d0 = theDbe->book1D(
"vertex_d0",
151 "Event Vertex d0", 20, 0.0, 0.05);
153 snprintf(chtitle, title_s,
"Number of %s (E_{T} > 15 GeV);Number of Jets",
154 thePFJetCollectionLabel_.label().data());
155 h_jet_count = theDbe->book1D(
"jet_count", chtitle, 8, -0.5, 7.5);
157 snprintf(chtitle, title_s,
"Leading jet E_{T} (from %s);E_{T}(1^{st} jet) (GeV)",
158 thePFJetCollectionLabel_.label().data());
159 h_jet_et = theDbe->book1D(
"jet_et", chtitle, 20, 0., 200.0);
161 snprintf(chtitle, title_s,
"Leading jet p_{T} (from %s);p_{T}(1^{st} jet) (GeV/c)",
162 thePFJetCollectionLabel_.label().data());
163 h_jet_pt = theDbe->book1D(
"jet_pt", chtitle, 20, 0., 200.0);
165 snprintf(chtitle, title_s,
"Leading jet #eta (from %s); #eta (1^{st} jet)",
166 thePFJetCollectionLabel_.label().data());
167 h_jet_eta = theDbe->book1D(
"jet_eta", chtitle, 20, -10., 10.0);
168 snprintf(chtitle, title_s,
"Leading jet #phi (from %s); #phi(1^{st} jet)",
169 thePFJetCollectionLabel_.label().data());
170 h_jet_phi = theDbe->book1D(
"jet_phi", chtitle, 22, -1.1*pi, 1.1*pi);
172 snprintf(chtitle, title_s,
"2^{nd} leading jet E_{T} (from %s);E_{T}(2^{nd} jet) (GeV)",
173 thePFJetCollectionLabel_.label().data());
174 h_jet2_et = theDbe->book1D(
"jet2_et", chtitle, 20, 0., 200.0);
179 snprintf(chtitle, title_s,
"2^{nd} leading jet #eta (from %s); #eta (2^{nd} jet)",
180 thePFJetCollectionLabel_.label().data());
181 h_jet2_eta = theDbe->book1D(
"jet2_eta", chtitle, 20, -10., 10.0);
183 snprintf(chtitle, title_s,
"2^{nd} leading jet #phi (from %s); #phi(2^{nd} jet)",
184 thePFJetCollectionLabel_.label().data());
185 h_jet2_phi = theDbe->book1D(
"jet2_phi", chtitle, 22, -1.1*pi, 1.1*pi);
187 h_e1_et = theDbe->book1D(
"e1_et",
"E_{T} of Leading Electron;E_{T} (GeV)",
189 h_e2_et = theDbe->book1D(
"e2_et",
"E_{T} of Second Electron;E_{T} (GeV)",
191 h_e1_eta = theDbe->book1D(
"e1_eta",
"#eta of Leading Electron;#eta",
193 h_e2_eta = theDbe->book1D(
"e2_eta",
"#eta of Second Electron;#eta",
195 h_e1_phi = theDbe->book1D(
"e1_phi",
"#phi of Leading Electron;#phi",
196 22, -1.1*pi, 1.1*pi);
197 h_e2_phi = theDbe->book1D(
"e2_phi",
"#phi of Second Electron;#phi",
198 22, -1.1*pi, 1.1*pi);
199 h_m1_pt = theDbe->book1D(
"m1_pt",
"p_{T} of Leading Muon;p_{T}(1^{st} #mu) (GeV)",
201 h_m2_pt = theDbe->book1D(
"m2_pt",
"p_{T} of Second Muon;p_{T}(2^{nd} #mu) (GeV)",
203 h_m1_eta = theDbe->book1D(
"m1_eta",
"#eta of Leading Muon;#eta(1^{st} #mu)",
205 h_m2_eta = theDbe->book1D(
"m2_eta",
"#eta of Second Muon;#eta(2^{nd} #mu)",
207 h_m1_phi = theDbe->book1D(
"m1_phi",
"#phi of Leading Muon;#phi(1^{st} #mu)",
208 20, (-1. - 1./10.)*pi, (1. + 1./10.)*pi);
209 h_m2_phi = theDbe->book1D(
"m2_phi",
"#phi of Second Muon;#phi(2^{nd} #mu)",
210 20, (-1. - 1./10.)*pi, (1. + 1./10.)*pi);
217 snprintf(chtitle, title_s,
"Missing E_{T} (%s); GeV",
218 theCaloMETCollectionLabel_.label().data());
219 h_met = theDbe->book1D(
"met", chtitle, 20, 0.0, 100);
220 h_met_phi = theDbe->book1D(
"met_phi",
"Missing E_{T} #phi;#phi(MET)",
221 22, (-1. - 1./10.)*pi, (1. + 1./10.)*pi);
223 h_e_invWMass = theDbe->book1D(
"we_invWMass",
"W-> e #nu Transverse Mass;M_{T} (GeV)",
225 h_m_invWMass = theDbe->book1D(
"wm_invWMass",
"W-> #mu #nu Transverse Mass;M_{T} (GeV)",
227 h_mumu_invMass = theDbe->book1D(
"z_mm_invMass",
"#mu#mu Invariant Mass;InvMass (GeV)",
229 h_ee_invMass = theDbe->book1D(
"z_ee_invMass",
"ee Invariant Mass;InvMass (Gev)",
238 bool isConfigChanged =
false;
241 const std::string hltProcessName(theTriggerResultsCollection_.process());
242 isValidHltConfig_ = hltConfigProvider_.init(theRun, theSetup,
243 hltProcessName, isConfigChanged);
249 if (!isValidHltConfig_)
252 LogTrace(logTraceName) <<
"Analysis of event # ";
255 iEvent.
getByLabel(theTriggerResultsCollection_, HLTresults);
262 std::vector<std::string> eleTrigPathNames;
263 std::vector<std::string> muTrigPathNames;
269 bool passed_electron_HLT =
false;
270 bool passed_muon_HLT =
false;
271 for (
unsigned int i = 0;
i < HLTresults->size();
i++) {
274 for (
unsigned int index = 0;
275 index < theElecTriggerPathToPass_.size() && !passed_electron_HLT;
278 size_t trigPath = trigName.find(theElecTriggerPathToPass_[
index]);
281 passed_electron_HLT = HLTresults->accept(
i);
285 for (
unsigned int index = 0;
286 index < theMuonTriggerPathToPass_.size() && !passed_muon_HLT;
289 size_t trigPath = trigName.find(theMuonTriggerPathToPass_[
index]);
292 passed_muon_HLT = HLTresults->accept(
i);
298 if (!(passed_electron_HLT || passed_muon_HLT))
304 iEvent.
getByLabel(
"offlinePrimaryVertices", vertexHandle);
308 VertexCollection::const_iterator
v = vertexCollection.begin();
309 int vertex_number = vertexCollection.size();
310 double vertex_chi2 = v->normalizedChi2();
311 double vertex_d0 =
sqrt(v->x()*v->x()+v->y()*v->y());
312 double vertex_numTrks = v->tracksSize();
313 double vertex_sumTrks = 0.0;
317 vertex_curTrack != v->tracks_end(); vertex_curTrack++)
318 vertex_sumTrks += (*vertex_curTrack)->pt();
323 iEvent.
getByLabel(theCaloMETCollectionLabel_, caloMETCollection);
324 if (!caloMETCollection.
isValid())
326 float missing_et = caloMETCollection->begin()->et();
327 float met_phi = caloMETCollection->begin()->phi();
333 iEvent.
getByLabel(theElectronCollectionLabel_, electronCollection);
334 if (!electronCollection.
isValid())
338 float electron_et = -8.0;
339 float electron_eta = -8.0;
340 float electron_phi = -8.0;
341 float electron2_et = -9.0;
342 float electron2_eta = -9.0;
343 float electron2_phi = -9.0;
344 float ee_invMass = -9.0;
345 TLorentzVector
e1,
e2;
348 if (passed_electron_HLT) {
349 for (reco::GsfElectronCollection::const_iterator recoElectron = electronCollection->begin();
350 recoElectron != electronCollection->end(); recoElectron++) {
352 if (recoElectron->et() < 20 || fabs(recoElectron->eta()) > 2.5)
356 if (recoElectron->deltaPhiSuperClusterTrackAtVtx() > 0.58 ||
357 recoElectron->deltaEtaSuperClusterTrackAtVtx() > 0.01 ||
358 recoElectron->sigmaIetaIeta() > 0.027)
361 if (recoElectron->et() > electron_et) {
362 electron2_et = electron_et;
363 electron2_eta = electron_eta;
364 electron2_phi = electron_phi;
365 electron_et = recoElectron->et();
366 electron_eta = recoElectron->eta();
367 electron_phi = recoElectron->phi();
368 e1 = TLorentzVector(recoElectron->momentum().x(),
369 recoElectron->momentum().y(),
370 recoElectron->momentum().z(),
372 }
else if (recoElectron->et() > electron2_et) {
373 electron2_et = recoElectron->et();
374 electron2_eta = recoElectron->eta();
375 electron2_phi = recoElectron->phi();
376 e2 = TLorentzVector(recoElectron->momentum().x(),
377 recoElectron->momentum().y(),
378 recoElectron->momentum().z(),
382 if (electron2_et > 0.0) {
383 TLorentzVector pair = e1+
e2;
384 ee_invMass = pair.M();
394 iEvent.
getByLabel(theMuonCollectionLabel_, muonCollection);
399 float mm_invMass = -9.0;
400 float muon_pt = -9.0;
401 float muon_eta = -9.0;
402 float muon_phi = -9.0;
403 float muon2_pt = -9.0;
404 float muon2_eta = -9.0;
405 float muon2_phi = -9.0;
406 TLorentzVector m1, m2;
408 if (passed_muon_HLT) {
409 for (reco::MuonCollection::const_iterator recoMuon = muonCollection->begin();
410 recoMuon != muonCollection->end(); recoMuon++) {
412 if (recoMuon->pt() < 20 || !recoMuon->isGlobalMuon())
415 if (recoMuon->globalTrack()->normalizedChi2() > 10)
418 if (recoMuon->pt() > muon_pt) {
420 muon2_eta = muon_eta;
421 muon2_phi = muon_phi;
422 muon_pt = recoMuon->pt();
423 muon_eta = recoMuon->eta();
424 muon_phi = recoMuon->phi();
425 m1 = TLorentzVector(recoMuon->momentum().x(),
426 recoMuon->momentum().y(),
427 recoMuon->momentum().z(),
429 }
else if (recoMuon->pt() > muon2_pt) {
430 muon2_pt = recoMuon->pt();
431 muon2_eta = recoMuon->eta();
432 muon2_phi = recoMuon->phi();
433 m2 = TLorentzVector(recoMuon->momentum().x(),
434 recoMuon->momentum().y(),
435 recoMuon->momentum().z(),
440 if (muon2_pt > 0.0) {
441 TLorentzVector pair = m1+m2;
442 mm_invMass = pair.M();
453 iEvent.
getByLabel(thePFJetCollectionLabel_, PFJetCollection);
455 if (!PFJetCollection.
isValid())
458 unsigned int muonCollectionSize = muonCollection->size();
460 unsigned int PFJetCollectionSize = PFJetCollection->size();
465 float jet_et = -80.0;
466 float jet_pt = -80.0;
467 float jet_eta = -80.0;
468 float jet_phi = -80.0;
469 float jet2_et = -90.0;
470 float jet2_eta = -90.0;
471 float jet2_phi = -90.0;
481 for (
unsigned int i = 0;
i < PFJetCollectionSize;
i++) {
482 const Jet&
jet = PFJetCollection->at(
i);
484 double minDistance = 99999;
485 for (
unsigned int j = 0;
j < muonCollectionSize;
j++) {
486 const Muon&
mu = muonCollection->at(
j);
489 if (minDistance > distance)
490 minDistance = distance;
492 if (minDistance < 0.3)
497 if (electron_et > 0.0 &&
498 fabs(jet.
eta() - electron_eta) < 0.2 &&
501 if (electron2_et > 0.0 &&
502 fabs(jet.
eta() - electron2_eta) < 0.2 &&
513 if (jet.
et() < eJetMin_)
528 if (jet.
et() > jet_et) {
540 }
else if (jet.
et() > jet2_et) {
545 jet2_eta = jet.
eta();
546 jet2_phi = jet.
phi();
558 bool fill_e1 =
false;
559 bool fill_e2 =
false;
560 bool fill_m1 =
false;
561 bool fill_m2 =
false;
562 bool fill_met =
false;
565 if (ee_invMass > 0.0) {
566 h_ee_invMass->Fill(ee_invMass);
572 if (mm_invMass > 0.0) {
573 h_mumu_invMass->Fill(mm_invMass);
576 h_jet2_et ->Fill(jet2_et);
580 if (electron_et > 0.0 && missing_et > 20.0) {
581 float dphiW = fabs(met_phi-electron_phi);
582 float W_mt_e =
sqrt(2 * missing_et * electron_et * (1 -
cos(dphiW)));
583 h_e_invWMass->Fill(W_mt_e);
589 if (muon_pt > 0.0 && missing_et > 20.0) {
590 float dphiW = fabs(met_phi - muon_phi);
591 float W_mt_m =
sqrt(2 * missing_et * muon_pt * (1 -
cos(dphiW)));
592 h_m_invWMass->Fill(W_mt_m);
597 if (jet_et > -10.0) {
598 h_jet_et->Fill(jet_et);
599 h_jet_count->Fill(jet_count);
603 h_jet_pt->Fill(jet_pt);
606 if (jet_eta > -50.) {
607 h_jet_eta->Fill(jet_eta);
610 if (jet_phi > -10.) {
611 h_jet_phi->Fill(jet_phi);
614 if (jet2_et > -10.0) {
615 h_jet2_et->Fill(jet2_et);
622 if (jet2_eta > -50.) {
623 h_jet2_eta->Fill(jet2_eta);
626 if (jet2_phi > -10.) {
627 h_jet2_phi->Fill(jet2_phi);
632 if (fill_e1 || fill_m1) {
633 h_vertex_number->Fill(vertex_number);
634 h_vertex_chi2->Fill(vertex_chi2);
635 h_vertex_d0->Fill(vertex_d0);
636 h_vertex_numTrks->Fill(vertex_numTrks);
637 h_vertex_sumTrks->Fill(vertex_sumTrks);
641 h_e1_et->Fill(electron_et);
642 h_e1_eta->Fill(electron_eta);
643 h_e1_phi->Fill(electron_phi);
646 h_e2_et->Fill(electron2_et);
647 h_e2_eta->Fill(electron2_eta);
648 h_e2_phi->Fill(electron2_phi);
651 h_m1_pt->Fill(muon_pt);
652 h_m1_eta->Fill(muon_eta);
653 h_m1_phi->Fill(muon_phi);
656 h_m2_pt->Fill(muon2_pt);
657 h_m2_eta->Fill(muon2_eta);
658 h_m2_phi->Fill(muon2_phi);
661 h_met->Fill(missing_et);
662 h_met_phi->Fill(met_phi);
678 if (deltaPhi > 3.1415926)
679 deltaPhi = 2 * 3.1415926 -
deltaPhi;
void beginRun(const edm::Run &, const edm::EventSetup &)
T getParameter(std::string const &) const
double calcDeltaPhi(double phi1, double phi2)
T getUntrackedParameter(std::string const &, T const &) const
virtual double et() const GCC11_FINAL
transverse energy
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
EwkDQM(const edm::ParameterSet &)
Constructor.
Base class for all types of Jets.
void endJob(void)
Save the histos.
std::vector< Vertex > VertexCollection
collection of Vertex objects
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Cos< T >::type cos(const T &t)
void beginJob()
Inizialize parameters for histo binning.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
static const char *const trigNames[]
std::string const & triggerName(unsigned int index) const
virtual ~EwkDQM()
Destructor.
T const * product() const
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
double calcDeltaPhi(double phi1, double phi2)
virtual float pt() const GCC11_FINAL
transverse momentum