CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EwkDQM.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/10/25 11:54:49 $
5  * $Revision: 1.22 $
6  * \author Valentina Gori, University of Firenze
7  */
8 
10 
11 #include <vector>
12 #include <string>
13 #include <cmath>
14 
19 
23 
25 
28 
29 // Physics Objects
41 
42 #include "TLorentzVector.h"
43 
44 using namespace std;
45 using namespace edm;
46 using namespace reco;
47 
48 
49 
50 // EwkDQM::EwkDQM(const ParameterSet& parameters) {
52  eJetMin_ = parameters.getUntrackedParameter<double>("EJetMin", 999999.);
53 
54  // riguardare questa sintassi
55  // Get parameters from configuration file
56  theElecTriggerPathToPass_ =
57  parameters.getParameter<std::vector<string> >("elecTriggerPathToPass");
58  theMuonTriggerPathToPass_ =
59  parameters.getParameter<std::vector<string> >("muonTriggerPathToPass");
60  // eleTrigPathNames_ =
61  // parameters.getUntrackedParameter<std::vector<std::string> >("eleTrigPathNames");
62  // muTrigPathNames_ =
63  // parameters.getUntrackedParameter< std::vector<std::string> >("muTrigPathNames");
64  theTriggerResultsCollection_ =
65  parameters.getParameter<InputTag>("triggerResultsCollection");
66  theMuonCollectionLabel_ = parameters.getParameter<InputTag>("muonCollection");
67  theElectronCollectionLabel_ =
68  parameters.getParameter<InputTag>("electronCollection");
69  // theCaloJetCollectionLabel_ = parameters.getParameter<InputTag>("caloJetCollection");
70  thePFJetCollectionLabel_ =
71  parameters.getParameter<InputTag>("PFJetCollection");
72  theCaloMETCollectionLabel_ = parameters.getParameter<InputTag>("caloMETCollection");
73 
74  // just to initialize
75  isValidHltConfig_ = false;
76 
77  h_vertex_number = 0;
78  h_vertex_chi2 = 0;
79  h_vertex_numTrks = 0;
80  h_vertex_sumTrks = 0;
81  h_vertex_d0 = 0;
82 
83  h_jet_count = 0;
84  h_jet_et = 0;
85  h_jet_pt = 0;
86  h_jet_eta = 0;
87  h_jet_phi = 0;
88  h_jet2_et = 0;
89  // h_jet2_pt = 0;
90  h_jet2_eta = 0;
91  h_jet2_phi = 0;
92 
93  h_e1_et = 0;
94  h_e2_et = 0;
95  h_e1_eta = 0;
96  h_e2_eta = 0;
97  h_e1_phi = 0;
98  h_e2_phi = 0;
99 
100  h_m1_pt = 0;
101  h_m2_pt = 0;
102  h_m1_eta = 0;
103  h_m2_eta = 0;
104  h_m1_phi = 0;
105  h_m2_phi = 0;
106 
107  // h_t1_et = 0;
108  // h_t1_eta = 0;
109  // h_t1_phi = 0;
110 
111  h_met = 0;
112  h_met_phi = 0;
113 
114  h_e_invWMass = 0;
115  h_m_invWMass = 0;
116  h_mumu_invMass = 0;
117  h_ee_invMass = 0;
118 
119  theDbe = Service<DQMStore>().operator->();
120 }
121 
123 }
124 
125 
127  char chtitle[256] = "";
128  const size_t title_s = sizeof(chtitle);
129 
130  logTraceName = "EwkAnalyzer";
131 
132  LogTrace(logTraceName) << "Parameters initialization";
133  theDbe->setCurrentFolder("Physics/EwkDQM"); // Use folder with name of PAG
134 
135  const float pi = 4*atan(1);
136 
137  // Keep the number of plots and number of bins to a minimum!
138  h_vertex_number = theDbe->book1D("vertex_number",
139  "Number of event vertices in collection",
140  10, -0.5, 9.5);
141  h_vertex_chi2 = theDbe->book1D("vertex_chi2",
142  "Event Vertex #chi^{2}/n.d.o.f.",
143  20, 0.0, 2.0);
144  h_vertex_numTrks = theDbe->book1D("vertex_numTrks",
145  "Event Vertex, number of tracks",
146  20, -0.5, 59.5);
147  h_vertex_sumTrks = theDbe->book1D("vertex_sumTrks",
148  "Event Vertex, sum of track pt",
149  20, 0.0, 100.0);
150  h_vertex_d0 = theDbe->book1D("vertex_d0",
151  "Event Vertex d0", 20, 0.0, 0.05);
152 
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);
156 
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);
160 
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);
164 
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);
171 
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);
175  // snprintf(chtitle, title_s, "2^{nd} leading jet p_{T} (from %s);p_{T}(2^{nd} jet) (GeV/c)",
176  // thePFJetCollectionLabel_.label().data());
177  // h_jet2_pt = theDbe->book1D("jet2_pt", chtitle, 20, 0., 200.0);
178 
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);
182 
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);
186 
187  h_e1_et = theDbe->book1D("e1_et", "E_{T} of Leading Electron;E_{T} (GeV)",
188  20, 0.0, 100.0);
189  h_e2_et = theDbe->book1D("e2_et", "E_{T} of Second Electron;E_{T} (GeV)",
190  20, 0.0, 100.0);
191  h_e1_eta = theDbe->book1D("e1_eta", "#eta of Leading Electron;#eta",
192  20, -4.0, 4.0);
193  h_e2_eta = theDbe->book1D("e2_eta", "#eta of Second Electron;#eta",
194  20, -4.0, 4.0);
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)",
200  20, 0.0, 100.0);
201  h_m2_pt = theDbe->book1D("m2_pt", "p_{T} of Second Muon;p_{T}(2^{nd} #mu) (GeV)",
202  20, 0.0, 100.0);
203  h_m1_eta = theDbe->book1D("m1_eta", "#eta of Leading Muon;#eta(1^{st} #mu)",
204  20, -4.0, 4.0);
205  h_m2_eta = theDbe->book1D("m2_eta", "#eta of Second Muon;#eta(2^{nd} #mu)",
206  20, -4.0, 4.0);
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);
211  // h_t1_et = theDbe->book1D("t1_et", "E_{T} of Leading Tau;E_{T} (GeV)",
212  // 20, 0.0 , 100.0);
213  // h_t1_eta = theDbe->book1D("t1_eta", "#eta of Leading Tau;#eta",
214  // 20, -4.0, 4.0);
215  // h_t1_phi = theDbe->book1D("t1_phi", "#phi of Leading Tau;#phi",
216  // 20, -4.0, 4.0);
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);
222 
223  h_e_invWMass = theDbe->book1D("we_invWMass", "W-> e #nu Transverse Mass;M_{T} (GeV)",
224  20, 0.0, 140.0);
225  h_m_invWMass = theDbe->book1D("wm_invWMass", "W-> #mu #nu Transverse Mass;M_{T} (GeV)",
226  20, 0.0, 140.0);
227  h_mumu_invMass = theDbe->book1D("z_mm_invMass", "#mu#mu Invariant Mass;InvMass (GeV)",
228  20, 40.0, 140.0);
229  h_ee_invMass = theDbe->book1D("z_ee_invMass", "ee Invariant Mass;InvMass (Gev)",
230  20, 40.0, 140.0);
231 }
232 
236 void EwkDQM::beginRun(const edm::Run& theRun, const edm::EventSetup& theSetup) {
237  // passed as parameter to HLTConfigProvider::init(), not yet used
238  bool isConfigChanged = false;
239 
240  // isValidHltConfig_ used to short-circuit analyze() in case of problems
241  const std::string hltProcessName(theTriggerResultsCollection_.process());
242  isValidHltConfig_ = hltConfigProvider_.init(theRun, theSetup,
243  hltProcessName, isConfigChanged);
244 }
245 
246 
247 void EwkDQM::analyze(const Event& iEvent, const EventSetup& iSetup) {
248  // short-circuit if hlt problems
249  if (!isValidHltConfig_)
250  return;
251 
252  LogTrace(logTraceName) << "Analysis of event # ";
253  // Did it pass certain HLT path?
254  Handle<TriggerResults> HLTresults;
255  iEvent.getByLabel(theTriggerResultsCollection_, HLTresults);
256  if (!HLTresults.isValid())
257  return;
258 
259  const edm::TriggerNames & trigNames = iEvent.triggerNames(*HLTresults);
260 
261  // a temporary, until we have a list of triggers of interest
262  std::vector<std::string> eleTrigPathNames;
263  std::vector<std::string> muTrigPathNames;
264 
265  // eleTrigPathNames.push_back(theElecTriggerPathToPass_);
266  // muTrigPathNames.push_back(theMuonTriggerPathToPass_);
267  // end of temporary
268 
269  bool passed_electron_HLT = false;
270  bool passed_muon_HLT = false;
271  for (unsigned int i = 0; i < HLTresults->size(); i++) {
272  const std::string trigName = trigNames.triggerName(i);
273  // check if triggerName matches electronPath
274  for (unsigned int index = 0;
275  index < theElecTriggerPathToPass_.size() && !passed_electron_HLT;
276  index++) {
277  // 0 if found, pos if not
278  size_t trigPath = trigName.find(theElecTriggerPathToPass_[index]);
279  if (trigPath == 0) {
280  // cout << "MuonTrigger passed (=trigName): " << trigName <<endl;
281  passed_electron_HLT = HLTresults->accept(i);
282  }
283  }
284  // check if triggerName matches muonPath
285  for (unsigned int index = 0;
286  index < theMuonTriggerPathToPass_.size() && !passed_muon_HLT;
287  index++) {
288  // 0 if found, pos if not
289  size_t trigPath = trigName.find(theMuonTriggerPathToPass_[index]);
290  if (trigPath == 0) {
291  // cout << "MuonTrigger passed (=trigName): " << trigName <<endl;
292  passed_muon_HLT = HLTresults->accept(i);
293  }
294  }
295  }
296 
297  // we are interested in events with a valid electron or muon
298  if (!(passed_electron_HLT || passed_muon_HLT))
299  return;
300 
302  // Vertex information
303  Handle<VertexCollection> vertexHandle;
304  iEvent.getByLabel("offlinePrimaryVertices", vertexHandle);
305  if (!vertexHandle.isValid())
306  return;
307  VertexCollection vertexCollection = *(vertexHandle.product());
308  VertexCollection::const_iterator v = vertexCollection.begin();
309  int vertex_number = vertexCollection.size();
310  double vertex_chi2 = v->normalizedChi2(); // v->chi2();
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;
314  // std::cout << "vertex_d0=" << vertex_d0 << "\n";
315  // double vertex_ndof = v->ndof();cout << "ndof="<<vertex_ndof<<endl;
316  for (Vertex::trackRef_iterator vertex_curTrack = v->tracks_begin();
317  vertex_curTrack != v->tracks_end(); vertex_curTrack++)
318  vertex_sumTrks += (*vertex_curTrack)->pt();
319 
321  // Missing ET
322  Handle< View<MET> > caloMETCollection;
323  iEvent.getByLabel(theCaloMETCollectionLabel_, caloMETCollection);
324  if (!caloMETCollection.isValid())
325  return;
326  float missing_et = caloMETCollection->begin()->et();
327  float met_phi = caloMETCollection->begin()->phi();
328 
329 
331  // grab "gaussian sum fitting" electrons
332  Handle<GsfElectronCollection> electronCollection;
333  iEvent.getByLabel(theElectronCollectionLabel_, electronCollection);
334  if (!electronCollection.isValid())
335  return;
336 
337  // Find the highest and 2nd highest electron
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;
346 
347  // If it passed electron HLT and the collection was found, find electrons near Z mass
348  if (passed_electron_HLT) {
349  for (reco::GsfElectronCollection::const_iterator recoElectron = electronCollection->begin();
350  recoElectron != electronCollection->end(); recoElectron++) {
351  // Require electron to pass some basic cuts
352  if (recoElectron->et() < 20 || fabs(recoElectron->eta()) > 2.5)
353  continue;
354 
355  // Tighter electron cuts
356  if (recoElectron->deltaPhiSuperClusterTrackAtVtx() > 0.58 ||
357  recoElectron->deltaEtaSuperClusterTrackAtVtx() > 0.01 ||
358  recoElectron->sigmaIetaIeta() > 0.027)
359  continue;
360 
361  if (recoElectron->et() > electron_et) {
362  electron2_et = electron_et; // 2nd highest gets values from current highest
363  electron2_eta = electron_eta;
364  electron2_phi = electron_phi;
365  electron_et = recoElectron->et(); // 1st highest gets values from new highest
366  electron_eta = recoElectron->eta();
367  electron_phi = recoElectron->phi();
368  e1 = TLorentzVector(recoElectron->momentum().x(),
369  recoElectron->momentum().y(),
370  recoElectron->momentum().z(),
371  recoElectron->p());
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(),
379  recoElectron->p());
380  }
381  } // end of loop over electrons
382  if (electron2_et > 0.0) {
383  TLorentzVector pair = e1+e2;
384  ee_invMass = pair.M();
385  }
386  } // end of "are electrons valid"
388 
389 
390 
392  // Take the STA muon container
393  Handle<MuonCollection> muonCollection;
394  iEvent.getByLabel(theMuonCollectionLabel_, muonCollection);
395  if (!muonCollection.isValid())
396  return;
397 
398  // Find the highest pt muons
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;
407 
408  if (passed_muon_HLT) {
409  for (reco::MuonCollection::const_iterator recoMuon = muonCollection->begin();
410  recoMuon != muonCollection->end(); recoMuon++) {
411  // Require muon to pass some basic cuts
412  if (recoMuon->pt() < 20 || !recoMuon->isGlobalMuon())
413  continue;
414  // Some tighter muon cuts
415  if (recoMuon->globalTrack()->normalizedChi2() > 10)
416  continue;
417 
418  if (recoMuon->pt() > muon_pt) {
419  muon2_pt = muon_pt; // 2nd highest gets values from current highest
420  muon2_eta = muon_eta;
421  muon2_phi = muon_phi;
422  muon_pt = recoMuon->pt(); // 1st highest gets values from new highest
423  muon_eta = recoMuon->eta();
424  muon_phi = recoMuon->phi();
425  m1 = TLorentzVector(recoMuon->momentum().x(),
426  recoMuon->momentum().y(),
427  recoMuon->momentum().z(),
428  recoMuon->p());
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(),
436  recoMuon->p());
437  }
438  }
439  }
440  if (muon2_pt > 0.0) {
441  TLorentzVector pair = m1+m2;
442  mm_invMass = pair.M();
443  }
445 
446 
448  // Find the highest et jet
449 
450  // Handle<CaloJetCollection> caloJetCollection;
452  // iEvent.getByLabel (theCaloJetCollectionLabel,caloJetCollection);
453  iEvent.getByLabel(thePFJetCollectionLabel_, PFJetCollection);
454  // if ( !caloJetCollection.isValid() ) return;
455  if (!PFJetCollection.isValid())
456  return;
457 
458  unsigned int muonCollectionSize = muonCollection->size();
459  // unsigned int jetCollectionSize = jetCollection->size();
460  unsigned int PFJetCollectionSize = PFJetCollection->size();
461  int jet_count = 0;
462  // int LEADJET=-1; double max_pt=0;
463 
464 
465  float jet_et = -80.0;
466  float jet_pt = -80.0; // prova
467  float jet_eta = -80.0; // now USED
468  float jet_phi = -80.0; // now USED
469  float jet2_et = -90.0;
470  float jet2_eta = -90.0; // now USED
471  float jet2_phi = -90.0; // now USED
472  // for (CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin();
473  // i_calojet != caloJetCollection->end(); i_calojet++) {
474  // for (PFJetCollection::const_iterator i_pfjet = PFJetCollection->begin();
475  // i_pfjet != PFJetCollection->end(); i_pfjet++) {
476  // float jet_current_et = i_calojet->et();
477  // float jet_current_et = i_pfjet->et(); // e` identico a jet.et()
478  // jet_count++;
479 
480  // cleaning: va messo prima del riempimento dell'istogramma // This is in order to use PFJets
481  for (unsigned int i = 0; i < PFJetCollectionSize; i++) {
482  const Jet& jet = PFJetCollection->at(i);
483  // la classe "jet" viene definita qui!!!
484  double minDistance = 99999;
485  for (unsigned int j = 0; j < muonCollectionSize; j++) {
486  const Muon& mu = muonCollection->at(j);
487  double distance = sqrt((mu.eta() - jet.eta()) * (mu.eta() - jet.eta()) +
488  (mu.phi() - jet.phi()) * (mu.phi() - jet.phi()));
489  if (minDistance > distance)
490  minDistance = distance;
491  }
492  if (minDistance < 0.3)
493  continue; // 0.3 is the isolation cone around the muon
494  // se la distanza muone-cono del jet e` minore di 0.3, passo avanti e non conteggio il mio jet
495 
496  // If it overlaps with ELECTRON, it is not a jet
497  if (electron_et > 0.0 &&
498  fabs(jet.eta() - electron_eta) < 0.2 &&
499  calcDeltaPhi(jet.phi(), electron_phi) < 0.2)
500  continue;
501  if (electron2_et > 0.0 &&
502  fabs(jet.eta() - electron2_eta) < 0.2 &&
503  calcDeltaPhi(jet.phi(), electron2_phi) < 0.2)
504  continue;
505 
506  // provo a cambiare la parte degli elettroni in modo simmetrico alla parte per i muoni
507 
508  // ...
509  // ...
510 
511 
512  // if it has too low Et, throw away
513  if (jet.et() < eJetMin_)
514  continue;
515  jet_count++;
516 
517  // ovvero: incrementa jet_count se:
518  // - non c'e un muone entro 0.3 di distanza dal cono del jet;
519  // - se il jet non si sovrappone ad un elettrone;
520  // - se l'energia trasversa e` maggiore della soglia impostata (15?)
521 
522  // if(jet.et()>max_pt) { LEADJET=i; max_pt=jet.et();}
523  // se l'energia del jet e` maggiore di max_pt, diventa "i"
524  // l'indice del jet piu` energetico e max_pt la sua energia
525 
526  // riguardare questo!!!
527  // fino ad ora, jet_et era inizializzato a -8.0
528  if (jet.et() > jet_et) {
529  jet2_et = jet_et; // 2nd highest jet gets et from current highest
530  // perche` prende l'energia del primo jet??
531  jet2_eta = jet_eta; // now USED
532  jet2_phi = jet_phi; // now USED
533  // jet_et = i_calojet->et(); // current highest jet gets
534  // et from the new highest
535  jet_et = jet.et(); // current highest jet gets et from the new highest
536  // ah, ok! lo riaggiorna solo dopo!
537  jet_pt = jet.pt(); // e` il pT del leading jet
538  jet_eta = jet.eta(); // now USED
539  jet_phi = jet.phi() * (Geom::pi() / 180.); // now USED
540  } else if (jet.et() > jet2_et) {
541  // jet2_et = i_calojet->et();
542  jet2_et = jet.et();
543  // jet2_eta = i_calojet->eta(); // UNUSED
544  // jet2_phi = i_calojet->phi(); // UNUSED
545  jet2_eta = jet.eta(); // now USED
546  jet2_phi = jet.phi(); // now USED
547  }
548  // questo elseif funziona
549  }
551 
552 
553 
555  // Fill Histograms //
557 
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;
563 
564  // Was Z->ee found?
565  if (ee_invMass > 0.0) {
566  h_ee_invMass->Fill(ee_invMass);
567  fill_e1 = true;
568  fill_e2 = true;
569  }
570 
571  // Was Z->mu mu found?
572  if (mm_invMass > 0.0) {
573  h_mumu_invMass->Fill(mm_invMass);
574  fill_m1 = true;
575  fill_m2 = true;
576  h_jet2_et ->Fill(jet2_et);
577  }
578 
579  // Was W->e nu found?
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);
584  fill_e1 = true;
585  fill_met = true;
586  }
587 
588  // Was W->mu nu found?
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);
593  fill_m1 = true;
594  fill_met = true;
595  }
596 
597  if (jet_et > -10.0) {
598  h_jet_et->Fill(jet_et);
599  h_jet_count->Fill(jet_count);
600  }
601 
602  if (jet_pt > 0.) {
603  h_jet_pt->Fill(jet_pt);
604  }
605 
606  if (jet_eta > -50.) {
607  h_jet_eta->Fill(jet_eta);
608  }
609 
610  if (jet_phi > -10.) {
611  h_jet_phi->Fill(jet_phi);
612  }
613 
614  if (jet2_et > -10.0) {
615  h_jet2_et->Fill(jet2_et);
616  }
617 
618  // if (jet2_pt>0.) {
619  // h_jet2_pt ->Fill(jet2_pt);
620  // }
621 
622  if (jet2_eta > -50.) {
623  h_jet2_eta->Fill(jet2_eta);
624  }
625 
626  if (jet2_phi > -10.) {
627  h_jet2_phi->Fill(jet2_phi);
628  }
629 
630 
631 
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);
638  }
639 
640  if (fill_e1) {
641  h_e1_et->Fill(electron_et);
642  h_e1_eta->Fill(electron_eta);
643  h_e1_phi->Fill(electron_phi);
644  }
645  if (fill_e2) {
646  h_e2_et->Fill(electron2_et);
647  h_e2_eta->Fill(electron2_eta);
648  h_e2_phi->Fill(electron2_phi);
649  }
650  if (fill_m1) {
651  h_m1_pt->Fill(muon_pt);
652  h_m1_eta->Fill(muon_eta);
653  h_m1_phi->Fill(muon_phi);
654  }
655  if (fill_m2) {
656  h_m2_pt->Fill(muon2_pt);
657  h_m2_eta->Fill(muon2_eta);
658  h_m2_phi->Fill(muon2_phi);
659  }
660  if (fill_met) {
661  h_met->Fill(missing_et);
662  h_met_phi->Fill(met_phi);
663  }
665 }
666 
667 
668 void EwkDQM::endJob(void) {}
669 
670 
671 // This always returns only a positive deltaPhi
672 double EwkDQM::calcDeltaPhi(double phi1, double phi2) {
673  double deltaPhi = phi1 - phi2;
674 
675  if (deltaPhi < 0)
676  deltaPhi = -deltaPhi;
677 
678  if (deltaPhi > 3.1415926)
679  deltaPhi = 2 * 3.1415926 - deltaPhi;
680 
681  return deltaPhi;
682 }
void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: EwkDQM.cc:236
T getParameter(std::string const &) const
double calcDeltaPhi(double phi1, double phi2)
Definition: EwkTauDQM.cc:972
T getUntrackedParameter(std::string const &, T const &) const
virtual double et() const GCC11_FINAL
transverse energy
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:207
EwkDQM(const edm::ParameterSet &)
Constructor.
Definition: EwkDQM.cc:51
Base class for all types of Jets.
Definition: Jet.h:21
void endJob(void)
Save the histos.
Definition: EwkDQM.cc:668
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
Definition: EwkDQM.cc:247
tuple vertexCollection
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
int iEvent
Definition: GenABIO.cc:243
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int j
Definition: DBlmapReader.cc:9
void beginJob()
Inizialize parameters for histo binning.
Definition: EwkDQM.cc:126
const int mu
Definition: Constants.h:23
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:75
Float e1
Definition: deltaR.h:22
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
virtual ~EwkDQM()
Destructor.
Definition: EwkDQM.cc:122
T const * product() const
Definition: Handle.h:74
Float e2
Definition: deltaR.h:23
std::vector< PFJet > PFJetCollection
collection of PFJet objects
double pi()
Definition: Pi.h:31
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
double calcDeltaPhi(double phi1, double phi2)
Definition: EwkDQM.cc:672
double pi
virtual float pt() const GCC11_FINAL
transverse momentum
Definition: Run.h:36