CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EwkElecDQM.cc
Go to the documentation of this file.
2 
6 
9 
12 
16 
17 //#include "DataFormats/MuonReco/interface/Muon.h"
18 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" // I guess this is the right one??
19 // also need Fwd.h file ???
22 //#include "DataFormats/JetReco/interface/CaloJet.h"
23 //#include "DataFormats/METReco/interface/CaloMET.h"
24 //#include "DataFormats/METReco/interface/CaloMETCollection.h"
25 //#include "DataFormats/METReco/interface/CaloMETFwd.h"
26 
28 
32 
34 
35 using namespace edm;
36 using namespace std;
37 using namespace reco;
38 
40  // Input collections
41  trigTag_(cfg.getUntrackedParameter<edm::InputTag> ("TrigTag", edm::InputTag("TriggerResults::HLT"))),
42  // muonTag_(cfg.getUntrackedParameter<edm::InputTag> ("MuonTag", edm::InputTag("muons"))),
43  elecTag_(cfg.getUntrackedParameter<edm::InputTag> ("ElecTag", edm::InputTag("gsfElectrons"))),
44  metTag_(cfg.getUntrackedParameter<edm::InputTag> ("METTag", edm::InputTag("met"))),
45  // metIncludesMuons_(cfg.getUntrackedParameter<bool> ("METIncludesMuons", false)),
46  jetTag_(cfg.getUntrackedParameter<edm::InputTag> ("JetTag", edm::InputTag("sisCone5CaloJets"))),
47  vertexTag_ (cfg.getUntrackedParameter<edm::InputTag> ("VertexTag", edm::InputTag("offlinePrimaryVertices"))),
48 
49  // Main cuts
50  // muonTrig_(cfg.getUntrackedParameter<std::string> ("MuonTrig", "HLT_Mu9")),
51  //elecTrig_(cfg.getUntrackedParameter<std::vector< std::string > >("ElecTrig", "HLT_Ele10_SW_L1R")),
52  elecTrig_(cfg.getUntrackedParameter<std::vector< std::string > >("ElecTrig")),
53  // ptCut_(cfg.getUntrackedParameter<double>("PtCut", 25.)),
54  ptCut_(cfg.getUntrackedParameter<double>("PtCut", 10.)),
55  // etaCut_(cfg.getUntrackedParameter<double>("EtaCut", 2.1)),
56  etaCut_(cfg.getUntrackedParameter<double>("EtaCut", 2.4)),
57  sieieCutBarrel_(cfg.getUntrackedParameter<double>("SieieBarrel", 0.01)),
58  sieieCutEndcap_(cfg.getUntrackedParameter<double>("SieieEndcap", 0.028)),
59  detainCutBarrel_(cfg.getUntrackedParameter<double>("DetainBarrel", 0.0071)),
60  detainCutEndcap_(cfg.getUntrackedParameter<double>("DetainEndcap", 0.0066)),
61  // isRelativeIso_(cfg.getUntrackedParameter<bool>("IsRelativeIso", true)),
62  // isCombinedIso_(cfg.getUntrackedParameter<bool>("IsCombinedIso", false)),
63  // isoCut03_(cfg.getUntrackedParameter<double>("IsoCut03", 0.1)),
64  ecalIsoCutBarrel_(cfg.getUntrackedParameter<double>("EcalIsoCutBarrel", 5.7)),
65  ecalIsoCutEndcap_(cfg.getUntrackedParameter<double>("EcalIsoCutEndcap", 5.0)),
66  hcalIsoCutBarrel_(cfg.getUntrackedParameter<double>("HcalIsoCutBarrel", 8.1)),
67  hcalIsoCutEndcap_(cfg.getUntrackedParameter<double>("HcalIsoCutEndcap", 3.4)),
68  trkIsoCutBarrel_(cfg.getUntrackedParameter<double>("TrkIsoCutBarrel", 7.2)),
69  trkIsoCutEndcap_(cfg.getUntrackedParameter<double>("TrkIsoCutEndcap", 5.1)),
70  mtMin_(cfg.getUntrackedParameter<double>("MtMin", -999999)),
71  mtMax_(cfg.getUntrackedParameter<double>("MtMax", 999999.)),
72  metMin_(cfg.getUntrackedParameter<double>("MetMin", -999999.)),
73  metMax_(cfg.getUntrackedParameter<double>("MetMax", 999999.)),
74  // acopCut_(cfg.getUntrackedParameter<double>("AcopCut", 2.)),
75 
76  // Muon quality cuts
77  // dxyCut_(cfg.getUntrackedParameter<double>("DxyCut", 0.2)),
78  // normalizedChi2Cut_(cfg.getUntrackedParameter<double>("NormalizedChi2Cut", 10.)),
79  // trackerHitsCut_(cfg.getUntrackedParameter<int>("TrackerHitsCut", 11)),
80  // isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true)),
81 
82  // Z rejection
83  // ptThrForZ1_(cfg.getUntrackedParameter<double>("PtThrForZ1", 20.)),
84  // ptThrForZ2_(cfg.getUntrackedParameter<double>("PtThrForZ2", 10.)),
85 
86  // Top rejection
87  eJetMin_(cfg.getUntrackedParameter<double>("EJetMin", 999999.)),
88  nJetMax_(cfg.getUntrackedParameter<int>("NJetMax", 999999)),
89  PUMax_(cfg.getUntrackedParameter<unsigned int>("PUMax", 60)),
90  PUBinCount_(cfg.getUntrackedParameter<unsigned int>("PUBinCount", 12))
91 
92 // caloJetCollection_(cfg.getUntrackedParameter<edm:InputTag>("CaloJetCollection","sisCone5CaloJets"))
93 
94 
95 
96 {
97  isValidHltConfig_ = false;
98 
99  // access to dbe
101  theDbe->setCurrentFolder("Physics/EwkElecDQM");
102  init_histograms();
103 
104 }
105 
106 void EwkElecDQM::beginRun(const Run& iRun, const EventSetup& iSet) {
107  nall = 0;
108  nsel = 0;
109 
110  nrec = 0;
111  neid = 0;
112  niso = 0;
113 // nhlt = 0;
114 // nmet = 0;
115 
116  // passed as parameter to HLTConfigProvider::init(), not yet used
117  bool isConfigChanged = false;
118  // isValidHltConfig_ could be used to short-circuit analyze() in case of problems
119  isValidHltConfig_ = hltConfigProvider_.init( iRun, iSet, "HLT", isConfigChanged );
120 
121  LogTrace("") << "isValidHltConfig_=" << isValidHltConfig_ << "\n";
122 }
123 
124 
126 
127 }
128 
130 
131  char chtitle[256] = "";
132  // pt_before_ = theDbe->book1D("PT_BEFORECUTS","Muon transverse momentum (global muon) [GeV],100,0.,100.);
133  // pt_after_ = theDbe->book1D("PT_LASTCUT","Muon transverse momentum (global muon) [GeV],100,0.,100.);
134 
135  pt_before_ = theDbe->book1D("PT_BEFORECUTS","Electron transverse momentum [GeV]",100,0.,100.);
136  pt_after_ = theDbe->book1D("PT_LASTCUT","Electron transverse momentum [GeV]",100,0.,100.);
137 
138  eta_before_ = theDbe->book1D("ETA_BEFORECUTS","Electron pseudo-rapidity",50,-2.5,2.5);
139  eta_after_ = theDbe->book1D("ETA_LASTCUT","Electron pseudo-rapidity",50,-2.5,2.5);
140 
141  sieiebarrel_before_ = theDbe->book1D("SIEIEBARREL_BEFORECUTS","Electron #sigma_{i#etai#eta} (barrel)",70,0.,0.07);
142  sieiebarrel_after_ = theDbe->book1D("SIEIEBARREL_LASTCUT","Electron #sigma_{i#etai#eta} (barrel)",70,0.,0.07);
143 
144  sieieendcap_before_ = theDbe->book1D("SIEIEENDCAP_BEFORECUTS","Electron #sigma_{i#etai#eta} (endcap)",70,0.,0.07);
145  sieieendcap_after_ = theDbe->book1D("SIEIEENDCAP_LASTCUT","Electron #sigma_{i#etai#eta} (endcap)",70,0.,0.07);
146 
147  detainbarrel_before_ = theDbe->book1D("DETAINBARREL_BEFORECUTS","Electron #Delta#eta_{in} (barrel)",40,-0.02,0.02);
148  detainbarrel_after_ = theDbe->book1D("DETAINBARREL_LASTCUT","Electron #Delta#eta_{in} (barrel)",40,-0.02,0.02);
149 
150  detainendcap_before_ = theDbe->book1D("DETAINENDCAP_BEFORECUTS","Electron #Delta#eta_{in} (endcap)",40,-0.02,0.02);
151  detainendcap_after_ = theDbe->book1D("DETAINENDCAP_LASTCUT","Electron #Delta#eta_{in} (endcap)",40,-0.02,0.02);
152 
153  // dxy_before_ = theDbe->book1D("DXY_BEFORECUTS","Muon transverse distance to beam spot [cm]",100,-0.5,0.5);
154  // dxy_after_ = theDbe->book1D("DXY_LASTCUT","Muon transverse distance to beam spot [cm]",100,-0.5,0.5);
155 
156  // chi2_before_ = theDbe->book1D("CHI2_BEFORECUTS","Normalized Chi2, inner track fit",100,0.,100.);
157  // chi2_after_ = theDbe->book1D("CHI2_LASTCUT","Normalized Chi2, inner track fit",100,0.,100.);
158 
159  // nhits_before_ = theDbe->book1D("NHITS_BEFORECUTS","Number of hits, inner track",40,-0.5,39.5);
160  // nhits_after_ = theDbe->book1D("NHITS_LASTCUT","Number of hits, inner track",40,-0.5,39.5);
161 
162  // tkmu_before_ = theDbe->book1D("TKMU_BEFORECUTS","Tracker-muon flag (for global muons)",2,-0.5,1.5);
163  // tkmu_after_ = theDbe->book1D("TKMU_LASTCUT","Tracker-muon flag (for global muons)",2,-0.5,1.5);
164 
165  // if (isRelativeIso_) {
166  // if (isCombinedIso_) {
167  // snprintf(chtitle, 255, "Relative (combined) isolation variable");
168  // iso_before_ = theDbe->book1D("ISO_BEFORECUTS","Relative (combined) isolation variable",100, 0., 1.);
169  // iso_after_ = theDbe->book1D("ISO_LASTCUT","Relative (combined) isolation variable",100, 0., 1.);
170  // } else {
171  // snprintf(chtitle, 255, "Relative (tracker) isolation variable");
172  // iso_before_ = theDbe->book1D("ISO_BEFORECUTS","Relative (tracker) isolation variable",100, 0., 1.);
173  // iso_after_ = theDbe->book1D("ISO_LASTCUT","Relative (tracker) isolation variable",100, 0., 1.);
174  // }
175  // } else {
176  // if (isCombinedIso_) {
177  // iso_before_ = theDbe->book1D("ISO_BEFORECUTS","Absolute (combined) isolation variable [GeV]",100, 0., 20.);
178  // iso_after_ = theDbe->book1D("ISO_LASTCUT","Absolute (combined) isolation variable [GeV]",100, 0., 20.);
179  // } else {
180  // iso_before_ = theDbe->book1D("ISO_BEFORECUTS","Absolute (tracker) isolation variable [GeV]",100, 0., 20.);
181  // iso_after_ = theDbe->book1D("ISO_LASTCUT","Absolute (tracker) isolation variable [GeV]",100, 0., 20.);
182  // }
183  // }
184 
185  ecalisobarrel_before_ = theDbe->book1D("ECALISOBARREL_BEFORECUTS","Absolute electron ECAL isolation variable (barrel) [GeV]",50,0.,50.);
186  ecalisobarrel_after_ = theDbe->book1D("ECALISOBARREL_LASTCUT","Absolute electron ECAL isolation variable (barrel) [GeV]",50,0.,50.);
187 
188  ecalisoendcap_before_ = theDbe->book1D("ECALISOENDCAP_BEFORECUTS","Absolute electron ECAL isolation variable (endcap) [GeV]",50,0.,50.);
189  ecalisoendcap_after_ = theDbe->book1D("ECALISOENDCAP_LASTCUT","Absolute electron ECAL isolation variable (endcap) [GeV]",50,0.,50.);
190 
191  hcalisobarrel_before_ = theDbe->book1D("HCALISOBARREL_BEFORECUTS","Absolute electron HCAL isolation variable (barrel) [GeV]",50,0.,50.);
192  hcalisobarrel_after_ = theDbe->book1D("HCALISOBARREL_LASTCUT","Absolute electron HCAL isolation variable (barrel) [GeV]",50,0.,50.);
193 
194  hcalisoendcap_before_ = theDbe->book1D("HCALISOENDCAP_BEFORECUTS","Absolute electron HCAL isolation variable (endcap) [GeV]",50,0.,50.);
195  hcalisoendcap_after_ = theDbe->book1D("HCALISOENDCAP_LASTCUT","Absolute electron HCAL isolation variable (endcap) [GeV]",50,0.,50.);
196 
197  trkisobarrel_before_ = theDbe->book1D("TRKISOBARREL_BEFORECUTS","Absolute electron track isolation variable (barrel) [GeV]",50,0.,50.);
198  trkisobarrel_after_ = theDbe->book1D("TRKISOBARREL_LASTCUT","Absolute electron track isolation variable (barrel) [GeV]",50,0.,50.);
199 
200  trkisoendcap_before_ = theDbe->book1D("TRKISOENDCAP_BEFORECUTS","Absolute electron track isolation variable (endcap) [GeV]",50,0.,50.);
201  trkisoendcap_after_ = theDbe->book1D("TRKISOENDCAP_LASTCUT","Absolute electron track isolation variable (endcap) [GeV]",50,0.,50.);
202 
203 // snprintf(chtitle, 255, "Trigger response (bit %s)", muonTrig_.data());
204 // trig_before_ = theDbe->book1D("TRIG_BEFORECUTS",chtitle,2,-0.5,1.5);
205 // trig_after_ = theDbe->book1D("TRIG_LASTCUT",chtitle,2,-0.5,1.5);
206 
207  //snprintf(chtitle, 255, "Trigger response (bit %s)", elecTrig_.data());
208  trig_before_ = theDbe->book1D("TRIG_BEFORECUTS","Trigger response",2,-0.5,1.5); // elecTrig_ is now a vector of strings!
209  trig_after_ = theDbe->book1D("TRIG_LASTCUT","Trigger response",2,-0.5,1.5);
210 
211  invmass_before_ = theDbe->book1D("INVMASS_BEFORECUTS","Di-electron invariant mass [GeV]",100,0.,200.);
212  invmass_after_ = theDbe->book1D("INVMASS_AFTERCUTS","Di-electron invariant mass [GeV]",100,0.,200.);
213 
214  invmassPU_before_ = theDbe->book2D("INVMASS_PU_BEFORECUTS","Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count",100,0.,200., PUBinCount_, -0.5, PUMax_+0.5);
215  invmassPU_afterZ_ = theDbe->book2D("INVMASS_PU_AFTERZCUTS","Di-electron invariant mass [GeV] vs PU; mass [GeV]; PU count",100,0.,200., PUBinCount_, -0.5, PUMax_+0.5);
216 
217  npvs_before_ = theDbe->book1D("NPVs_BEFORECUTS","Number of Valid Primary Vertices; nGoodPVs",PUMax_+1,-0.5,PUMax_+0.5);
218  //npvs_afterW_ = theDbe->book1D("NPVs_AFTERWCUTS","Number of Valid Primary Vertices",PUMax_+1,-0.5,PUMax_+0.5);
219  npvs_afterZ_ = theDbe->book1D("NPVs_AFTERZCUTS","Number of Valid Primary Vertices; nGoodPVs",PUMax_+1,-0.5,PUMax_+0.5);
220 
221 
222  nelectrons_before_ = theDbe->book1D("NELECTRONS_BEFORECUTS","Number of electrons in event",10,-0.5,9.5);
223  nelectrons_after_ = theDbe->book1D("NELECTRONS_AFTERCUTS","Number of electrons in event",10,-0.5,9.5);
224 
225  snprintf(chtitle, 255, "Transverse mass (%s) [GeV]", metTag_.label().data());
226  mt_before_ = theDbe->book1D("MT_BEFORECUTS",chtitle,150,0.,300.);
227  mt_after_ = theDbe->book1D("MT_LASTCUT",chtitle,150,0.,300.);
228 
229 // snprintf(chtitle, 255, "Transverse mass (%s) [GeV]", metTag_.label().data());
230 // mt_before_ = theDbe->book1D("MT_BEFORECUTS",chtitle,150,0.,300.);
231 // mt_after_ = theDbe->book1D("MT_LASTCUT",chtitle,150,0.,300.);
232 
233  snprintf(chtitle, 255, "Missing transverse energy (%s) [GeV]", metTag_.label().data());
234  met_before_ = theDbe->book1D("MET_BEFORECUTS",chtitle,100,0.,200.);
235  met_after_ = theDbe->book1D("MET_LASTCUT",chtitle,100,0.,200.);
236 
237 // snprintf(chtitle, 255, "MU-MET (%s) acoplanarity", metTag_.label().data());
238 // acop_before_ = theDbe->book1D("ACOP_BEFORECUTS",chtitle,50,0.,M_PI);
239 // acop_after_ = theDbe->book1D("ACOP_LASTCUT",chtitle,50,0.,M_PI);
240 
241 // snprintf(chtitle, 255, "Z rejection: number of muons above %.2f GeV", ptThrForZ1_);
242 // nz1_before_ = theDbe->book1D("NZ1_BEFORECUTS",chtitle,10,-0.5,9.5);
243 // nz1_after_ = theDbe->book1D("NZ1_LASTCUT",chtitle,10,-0.5,9.5);
244 
245 // snprintf(chtitle, 255, "Z rejection: number of muons above %.2f GeV", ptThrForZ2_);
246 // nz2_before_ = theDbe->book1D("NZ2_BEFORECUTS",chtitle,10,-0.5,9.5);
247 // nz2_after_ = theDbe->book1D("NZ2_LASTCUT",chtitle,10,-0.5,9.5);
248 
249  snprintf(chtitle, 255, "Number of jets (%s) above %.2f GeV", jetTag_.label().data(), eJetMin_);
250  njets_before_ = theDbe->book1D("NJETS_BEFORECUTS",chtitle,10,-0.5,9.5);
251  njets_after_ = theDbe->book1D("NJETS_LASTCUT",chtitle,10,-0.5,9.5);
252 
253  snprintf(chtitle, 255, "Jet with highest E_{T} (%s)", jetTag_.label().data());
254  jet_et_before_ = theDbe->book1D("JETET1_BEFORECUTS",chtitle, 20, 0., 200.0);
255  jet_et_after_ = theDbe->book1D("JETET1_AFTERCUTS",chtitle, 20, 0., 200.0);
256 
257  snprintf(chtitle, 255, "Eta of Jet with highest E_{T} (%s)", jetTag_.label().data());
258  jet_eta_before_ = theDbe->book1D("JETETA1_BEFORECUTS",chtitle, 20, -5, 5);
259  jet_eta_after_ = theDbe->book1D("JETETA1_AFTERCUTS",chtitle, 20, -5, 5);
260 
261 // snprintf(chtitle, 255, "Jet with 2nd highest E_{T} (%s)", jetTag_.label().data());
262 // jet2_et_before = theDbe->book1D("JETET2_BEFORECUTS",chtitle, 20, 0., 200.0);
263 // jet2_et_after = theDbe->book1D("JETET2_AFTERCUTS",chtitle, 20, 0., 200.0);
264 
265 
266 
267 }
268 
269 
271 }
272 
273 void EwkElecDQM::endRun(const Run& r, const EventSetup&) {
274 
275  // overall
276  double all = nall;
277  double esel = nsel/all;
278  LogVerbatim("") << "\n>>>>>> SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
279  LogVerbatim("") << "Total number of events analyzed: " << nall << " [events]";
280  LogVerbatim("") << "Total number of events selected: " << nsel << " [events]";
281  LogVerbatim("") << "Overall efficiency: " << "(" << setprecision(4) << esel*100. <<" +/- "<< setprecision(2) << sqrt(esel*(1-esel)/all)*100. << ")%";
282 
283  double erec = nrec/all;
284  double eeid = neid/all;
285  double eiso = niso/all;
286 // double ehlt = nhlt/all;
287 // double emet = nmet/all;
288 
289  // general reconstruction step??
290  double num = nrec;
291  double eff = erec;
292  double err = sqrt(eff*(1-eff)/all);
293  LogVerbatim("") << "Passing Pt/Eta/Quality cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%";
294 
295  // electron ID step
296  num = neid;
297  eff = eeid;
298  err = sqrt(eff*(1-eff)/all);
299  double effstep = 0.;
300  double errstep = 0.;
301  if (nrec>0) effstep = eeid/erec;
302  if (nrec>0) errstep = sqrt(effstep*(1-effstep)/nrec);
303  LogVerbatim("") << "Passing eID cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
304 
305  // isolation step
306  num = niso;
307  eff = eiso;
308  err = sqrt(eff*(1-eff)/all);
309  effstep = 0.;
310  errstep = 0.;
311  if (neid>0) effstep = eiso/eeid;
312  if (neid>0) errstep = sqrt(effstep*(1-effstep)/neid);
313  LogVerbatim("") << "Passing isolation cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
314 
315 // // trigger step
316 // num = nhlt;
317 // eff = ehlt;
318 // err = sqrt(eff*(1-eff)/all);
319 // effstep = 0.;
320 // errstep = 0.;
321 // if (niso>0) effstep = ehlt/eiso;
322 // if (niso>0) errstep = sqrt(effstep*(1-effstep)/niso);
323 // LogVerbatim("") << "Passing HLT criteria: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
324 
325  // trigger step
326  num = nsel;
327  eff = esel;
328  err = sqrt(eff*(1-eff)/all);
329  effstep = 0.;
330  errstep = 0.;
331  if (niso>0) effstep = esel/eiso;
332  if (niso>0) errstep = sqrt(effstep*(1-effstep)/niso);
333  LogVerbatim("") << "Passing HLT criteria: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
334 
335 // // met/acoplanarity cuts
336 // num = nmet;
337 // eff = emet;
338 // err = sqrt(eff*(1-eff)/all);
339 // effstep = 0.;
340 // errstep = 0.;
341 // if (nhlt>0) effstep = emet/ehlt;
342 // if (nhlt>0) errstep = sqrt(effstep*(1-effstep)/nhlt);
343 // LogVerbatim("") << "Passing MET/acoplanarity cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
344 
345 // // Z/top selection cuts ALSO LAST STEP so "sel" for "selection"
346 // num = nsel;
347 // eff = esel;
348 // err = sqrt(eff*(1-eff)/all);
349 // effstep = 0.;
350 // errstep = 0.;
351 // if (nmet>0) effstep = esel/emet;
352 // if (nmet>0) errstep = sqrt(effstep*(1-effstep)/nmet);
353 // LogVerbatim("") << "Passing Z/top rejection cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
354 
355  LogVerbatim("") << ">>>>>> SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
356 }
357 
358 void EwkElecDQM::analyze (const Event & ev, const EventSetup &) {
359 
360  // Reset global event selection flags
361  bool rec_sel = false;
362  bool eid_sel = false;
363  bool iso_sel = false;
364 // bool hlt_sel = false;
365  bool all_sel = false;
366 
367 // // Muon collection
368 // Handle<View<Muon> > muonCollection;
369 // if (!ev.getByLabel(muonTag_, muonCollection)) {
370 // LogWarning("") << ">>> Muon collection does not exist !!!";
371 // return;
372 // }
373 // unsigned int muonCollectionSize = muonCollection->size();
374 
375  // Electron collection
376  Handle<View<GsfElectron> > electronCollection;
377  if (!ev.getByLabel(elecTag_, electronCollection)) {
378  //LogWarning("") << ">>> Electron collection does not exist !!!";
379  return;
380  }
381  unsigned int electronCollectionSize = electronCollection->size();
382 
383  // Beam spot
384  Handle<reco::BeamSpot> beamSpotHandle;
385  if (!ev.getByLabel(InputTag("offlineBeamSpot"), beamSpotHandle)) {
386  //LogWarning("") << ">>> No beam spot found !!!";
387  return;
388  }
389  // MET
390  double met_px = 0.;
391  double met_py = 0.;
392  Handle<View<MET> > metCollection;
393  if (!ev.getByLabel(metTag_, metCollection)) {
394  //LogWarning("") << ">>> MET collection does not exist !!!";
395  return;
396  }
397  const MET& met = metCollection->at(0);
398  met_px = met.px();
399  met_py = met.py();
400 // if (!metIncludesMuons_) {
401 // for (unsigned int i=0; i<muonCollectionSize; i++) {
402 // const Muon& mu = muonCollection->at(i);
403 // if (!mu.isGlobalMuon()) continue;
404 // met_px -= mu.px();
405 // met_py -= mu.py();
406 // }
407 // }
408  double met_et = sqrt(met_px*met_px+met_py*met_py);
409  LogTrace("") << ">>> MET, MET_px, MET_py: " << met_et << ", " << met_px << ", " << met_py << " [GeV]";
410  met_before_->Fill(met_et);
411 
412 
413  // Vertices in the event
414  int npvCount = 0;
416  if (!ev.getByLabel(vertexTag_, vertexCollection)) {
417  LogError("") << ">>> Vertex collection does not exist !!!";
418  return;
419  }
420  for (unsigned int i=0; i<vertexCollection->size(); i++) {
421  const Vertex& vertex = vertexCollection->at(i);
422  if (vertex.isValid()) npvCount++;
423  }
424  npvs_before_->Fill(npvCount);
425 
426 
427  // Trigger
429  if (!ev.getByLabel(trigTag_, triggerResults)) {
430  //LogWarning("") << ">>> TRIGGER collection does not exist !!!";
431  return;
432  }
433  const edm::TriggerNames & trigNames = ev.triggerNames(*triggerResults);
434  bool trigger_fired = false;
435  /*
436  for (unsigned int i=0; i<triggerResults->size(); i++) {
437  if (triggerResults->accept(i)) {
438  LogTrace("") << "Accept by: " << i << ", Trigger: " << trigNames.triggerName(i);
439  }
440  }
441  */
442 
443  // the following gives error on CRAFT08 data where itrig1=19 (vector index out of range)
444  /*
445  int itrig1 = trigNames.triggerIndex(muonTrig_);
446  if (triggerResults->accept(itrig1)) trigger_fired = true;
447  */
448  //suggested replacement: lm250909
449  for (unsigned int i=0; i<triggerResults->size(); i++)
450  {
451  std::string trigName = trigNames.triggerName(i);
452  bool found=false;
453 
454 // for (unsigned int j = 0; j < elecTrig_.size(); j++)
455 // {
456 // if ( trigName == elecTrig_.at(j) && triggerResults->accept(i))
457 // {
458 // trigger_fired = true;
459 // }
460 // }
461 
462 
463  for(unsigned int index=0; index<elecTrig_.size() && found==false; index++) {
464  size_t trigPath = trigName.find(elecTrig_.at(index)); // 0 if found, pos if not
465  if (trigPath==0) found=true;
466  }
467  if(!found) continue;
468 
469  bool prescaled=false;
470  for (unsigned int ps= 0; ps< hltConfigProvider_.prescaleSize(); ps++){
471  const unsigned int prescaleValue = hltConfigProvider_.prescaleValue(ps, trigName) ;
472  if (prescaleValue != 1) prescaled =true;
473  }
474 
475  if(triggerResults->accept(i) && !prescaled) trigger_fired=true;
476 
477  }
478 
479 
480  LogTrace("") << ">>> Trigger bit: " << trigger_fired << " for one of ( " ;
481  for (unsigned int k = 0; k < elecTrig_.size(); k++)
482  {
483  LogTrace("") << elecTrig_.at(k) << " ";
484  }
485  LogTrace("") << ")";
486  trig_before_->Fill(trigger_fired);
487 
488 // // Loop to reject/control Z->mumu is done separately
489 // unsigned int nmuonsForZ1 = 0;
490 // unsigned int nmuonsForZ2 = 0;
491 // for (unsigned int i=0; i<muonCollectionSize; i++) {
492 // const Muon& mu = muonCollection->at(i);
493 // if (!mu.isGlobalMuon()) continue;
494 // double pt = mu.pt();
495 // if (pt>ptThrForZ1_) nmuonsForZ1++;
496 // if (pt>ptThrForZ2_) nmuonsForZ2++;
497 // }
498 // LogTrace("") << "> Z rejection: muons above " << ptThrForZ1_ << " [GeV]: " << nmuonsForZ1;
499 // LogTrace("") << "> Z rejection: muons above " << ptThrForZ2_ << " [GeV]: " << nmuonsForZ2;
500 // nz1_before_->Fill(nmuonsForZ1);
501 // nz2_before_->Fill(nmuonsForZ2);
502 
503  // Jet collection
504  Handle<View<Jet> > jetCollection;
505  if (!ev.getByLabel(jetTag_, jetCollection)) {
506  //LogError("") << ">>> JET collection does not exist !!!";
507  return;
508  }
509  float electron_et = -8.0;
510  float electron_eta = -8.0;
511  float electron_phi = -8.0;
512  float electron2_et = -9.0;
513  float electron2_eta = -9.0;
514  float electron2_phi = -9.0;
515  //need to get some electron info so jets can be cleaned of them
516  for (unsigned int i=0; i<electronCollectionSize; i++)
517  {
518  const GsfElectron& elec = electronCollection->at(i);
519 
520  if (i < 1)
521  {
522  electron_et = elec.pt();
523  electron_eta = elec.eta();
524  electron_phi = elec.phi();
525  }
526  if (i == 2)
527  {
528  electron2_et = elec.pt();
529  electron2_eta = elec.eta();
530  electron2_phi = elec.phi();
531  }
532  }
533 
534  float jet_et = -8.0;
535  float jet_eta = -8.0;
536  int jet_count = 0;
537  float jet2_et = -9.0;
538  unsigned int jetCollectionSize = jetCollection->size();
539  int njets = 0;
540  for (unsigned int i=0; i<jetCollectionSize; i++) {
541  const Jet& jet = jetCollection->at(i);
542 
543  float jet_current_et = jet.et();
544 // cout << "jet_current_et " << jet_current_et << endl;
545  // if it overlaps with electron, it is not a jet
546  if ( electron_et>0.0 && fabs(jet.eta()-electron_eta ) < 0.2
547  && calcDeltaPhi(jet.phi(), electron_phi ) < 0.2)
548  continue;
549  if ( electron2_et>0.0&& fabs(jet.eta()-electron2_eta) < 0.2
550  && calcDeltaPhi(jet.phi(), electron2_phi) < 0.2)
551  continue;
552 
553  // if it has too low Et, throw away
554 // if (jet_current_et < eJetMin_) continue; //Keep if only want to plot above jet cut
555 
556  if (jet.et()>eJetMin_)
557  {
558  njets++;
559  jet_count++;
560  }
561  if (jet_current_et > jet_et)
562  {
563  jet2_et = jet_et; // 2nd highest jet get's et from current highest
564  jet_et = jet.et(); // current highest jet gets et from the new highest
565  jet_eta = jet.eta();
566  }
567  else if (jet_current_et > jet2_et)
568  {
569  jet2_et = jet.et();
570  }
571  }
572 
573  //Fill After all electron cuts (or both before and after)
574  if (jet_et>10) //don't want low energy "jets"
575  {
576  jet_et_before_ ->Fill(jet_et);
577 // jet2_et_before_ ->Fill(jet2_et);
578  jet_eta_before_ ->Fill(jet_eta);
579  }
580 
581 
582  LogTrace("") << ">>> Total number of jets: " << jetCollectionSize;
583  LogTrace("") << ">>> Number of jets above " << eJetMin_ << " [GeV]: " << njets;
584  njets_before_->Fill(njets);
585 
586 
587  // Start counting
588  nall++;
589 
590  // Histograms per event should be done only once, so keep track of them
591  bool hlt_hist_done = false;
592  //bool minv_hist_done = false;
593  bool met_hist_done = false;
594 // bool nz1_hist_done = false;
595 // bool nz2_hist_done = false;
596  bool njets_hist_done = false;
597 
598  // Central selection criteria
599  //const int NFLAGS = 13; // number of individual selection criteria
600  const int NFLAGS = 11; // number of individual selection criteria
601  // 0: pt cut | rec
602  // 1: eta cut | rec
603  // 2: sieie | eid
604  // 3: detain | eid
605  // 4: ecal iso | iso
606  // 5: hcal iso | iso
607  // 6: trk iso | iso
608  // 7: trigger fired | hlt/all
609  bool electron_sel[NFLAGS];
610 
611  // for invariant mass calculation
612  // keep track of highest-pt electrons for initial (RECO) electrons
613  // and "good" electrons (passing all cuts)
614  // first array dimension is for first or second good electron
615  // second array dimension is for relevant quantities of good electron
616  // [0]: 1 for electron found or 0 for not found (if 0, no other quantities filled)
617  // [1]: mSqr
618  // [2]: E
619  // [3]: px
620  // [4]: py
621  // [5]: pz
622  // inv mass = sqrt(m_1^2 + m_2^2 + 2*(E_1*E_2 - (px1*px2 + py1*py2 + pz1+pz2) ) )
623  double electron[2][6];
624  double goodElectron[2][6];
625  nGoodElectrons = 0;
626  for (unsigned int i = 0; i < 2; i++)
627  {
628  for (unsigned int j = 0; j < 6; j++)
629  {
630  electron[i][j] = 0.;
631  goodElectron[i][j] = 0.;
632  }
633  }
634 
635  for (unsigned int i=0; i<electronCollectionSize; i++)
636  {
637  for (int j=0; j<NFLAGS; ++j)
638  {
639  electron_sel[j] = false;
640  }
641 
642  const GsfElectron& elec = electronCollection->at(i);
643  //if (!mu.isGlobalMuon()) continue;
644  //if (mu.globalTrack().isNull()) continue;
645  //if (mu.innerTrack().isNull()) continue;
646 
647  LogTrace("") << "> elec: processing electron number " << i << "...";
648  //reco::TrackRef gm = mu.globalTrack();
649  //reco::TrackRef tk = mu.innerTrack();
650  // should have stuff for electron track?
651 
652  if (i < 2)
653  {
654  electron[i][0] = 1.;
655  electron[i][1] = elec.massSqr();
656  electron[i][2] = elec.energy();
657  electron[i][3] = elec.px();
658  electron[i][4] = elec.py();
659  electron[i][5] = elec.pz();
660  }
661 
662  // Pt,eta cuts
663  double pt = elec.pt();
664  double px = elec.px();
665  double py = elec.py();
666  double eta = elec.eta();
667  LogTrace("") << "\t... pt, eta: " << pt << " [GeV], " << eta;;
668  if (pt>ptCut_) electron_sel[0] = true;
669  if (fabs(eta)<etaCut_) electron_sel[1] = true;
670 
671  bool isBarrel = false;
672  bool isEndcap = false;
673  if (eta < 1.4442 && eta > -1.4442)
674  {
675  isBarrel = true;
676  }
677  else if ((eta > 1.56 && eta < 2.4) || (eta < -1.56 && eta > -2.4))
678  {
679  isEndcap = true;
680  }
681 
682  // // d0, chi2, nhits quality cuts
683  // double dxy = tk->dxy(beamSpotHandle->position());
684  // double normalizedChi2 = gm->normalizedChi2();
685  // double trackerHits = tk->numberOfValidHits();
686  // LogTrace("") << "\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy << " [cm], " << normalizedChi2 << ", " << trackerHits << ", " << mu.isTrackerMuon();
687  // if (fabs(dxy)<dxyCut_) muon_sel[2] = true;
688  // if (normalizedChi2<normalizedChi2Cut_) muon_sel[3] = true;
689  // if (trackerHits>=trackerHitsCut_) muon_sel[4] = true;
690  // if (mu.isTrackerMuon()) muon_sel[5] = true;
691 
692  pt_before_->Fill(pt);
693  eta_before_->Fill(eta);
694  // dxy_before_->Fill(dxy);
695  // chi2_before_->Fill(normalizedChi2);
696  // nhits_before_->Fill(trackerHits);
697  // tkmu_before_->Fill(mu.isTrackerMuon());
698 
699 
700  // Electron ID cuts
701  double sieie = (double) elec.sigmaIetaIeta();
702  double detain = (double) elec.deltaEtaSuperClusterTrackAtVtx(); // think this is detain
703  if (sieie < sieieCutBarrel_ && isBarrel) electron_sel[2] = true;
704  if (sieie < sieieCutEndcap_ && isEndcap) electron_sel[2] = true;
705  if (detain < detainCutBarrel_ && isBarrel) electron_sel[3] = true;
706  if (detain < detainCutEndcap_ && isEndcap) electron_sel[3] = true;
707  if (isBarrel)
708  {
709  LogTrace("") << "\t... sieie value " << sieie << " (barrel), pass? " << electron_sel[2];
710  LogTrace("") << "\t... detain value " << detain << " (barrel), pass? " << electron_sel[3];
711  }
712  else if (isEndcap)
713  {
714  LogTrace("") << "\t... sieie value " << sieie << " (endcap), pass? " << electron_sel[2];
715  LogTrace("") << "\t... detain value " << detain << " (endcap), pass? " << electron_sel[2];
716  }
717 
718  if (isBarrel)
719  {
720  sieiebarrel_before_->Fill(sieie);
721  detainbarrel_before_->Fill(detain);
722  }
723  else if (isEndcap)
724  {
725  sieieendcap_before_->Fill(sieie);
726  detainendcap_before_->Fill(detain);
727  }
728 
729 
730 
731  // Isolation cuts
732  //double isovar = mu.isolationR03().sumPt;
733  double ecalisovar = elec.dr03EcalRecHitSumEt(); // picked one set!
734  double hcalisovar = elec.dr03HcalTowerSumEt(); // try others if
735  double trkisovar = elec.dr04TkSumPt(); // doesn't work
736  //if (isCombinedIso_) {
737  //isovar += mu.isolationR03().emEt;
738  //isovar += mu.isolationR03().hadEt;
739  //}
740  //if (isRelativeIso_) isovar /= pt;
741  if (ecalisovar<ecalIsoCutBarrel_ && isBarrel) electron_sel[4] = true;
742  if (ecalisovar<ecalIsoCutEndcap_ && isEndcap) electron_sel[4] = true;
743  if (hcalisovar<hcalIsoCutBarrel_ && isBarrel) electron_sel[5] = true;
744  if (hcalisovar<hcalIsoCutEndcap_ && isEndcap) electron_sel[5] = true;
745  if (trkisovar<trkIsoCutBarrel_ && isBarrel) electron_sel[6] = true;
746  if (trkisovar<trkIsoCutEndcap_ && isEndcap) electron_sel[6] = true;
747  if (isBarrel)
748  {
749  LogTrace("") << "\t... ecal isolation value " << ecalisovar << " (barrel), pass? " << electron_sel[4];
750  LogTrace("") << "\t... hcal isolation value " << hcalisovar << " (barrel), pass? " << electron_sel[5];
751  LogTrace("") << "\t... trk isolation value " << trkisovar << " (barrel), pass? " << electron_sel[6];
752  }
753  else if (isEndcap)
754  {
755  LogTrace("") << "\t... ecal isolation value " << ecalisovar << " (endcap), pass? " << electron_sel[4];
756  LogTrace("") << "\t... hcal isolation value " << hcalisovar << " (endcap), pass? " << electron_sel[5];
757  LogTrace("") << "\t... trk isolation value " << trkisovar << " (endcap), pass? " << electron_sel[6];
758  }
759 
760  //iso_before_->Fill(isovar);
761  if (isBarrel)
762  {
763  ecalisobarrel_before_->Fill(ecalisovar);
764  hcalisobarrel_before_->Fill(hcalisovar);
765  trkisobarrel_before_->Fill(trkisovar);
766  }
767  else if (isEndcap)
768  {
769  ecalisoendcap_before_->Fill(ecalisovar);
770  hcalisoendcap_before_->Fill(hcalisovar);
771  trkisoendcap_before_->Fill(trkisovar);
772  }
773 
774 
775  // HLT
776  if (trigger_fired) electron_sel[7] = true;
777 
778 
779  // // MET/MT cuts
780  double w_et = met_et+pt;
781  double w_px = met_px+px;
782  double w_py = met_py+py;
783 
784  double massT = w_et*w_et - w_px*w_px - w_py*w_py;
785  massT = (massT>0) ? sqrt(massT) : 0;
786 
787  LogTrace("") << "\t... W mass, W_et, W_px, W_py: " << massT << ", " << w_et << ", " << w_px << ", " << w_py << " [GeV]";
788  if (massT>mtMin_ && massT<mtMax_) electron_sel[8] = true;
789  mt_before_->Fill(massT);
790  if (met_et>metMin_ && met_et<metMax_) electron_sel[9] = true;
791 
792  // // Acoplanarity cuts
793  // Geom::Phi<double> deltaphi(mu.phi()-atan2(met_py,met_px));
794  // double acop = deltaphi.value();
795  // if (acop<0) acop = - acop;
796  // acop = M_PI - acop;
797  // LogTrace("") << "\t... acoplanarity: " << acop;
798  // if (acop<acopCut_) muon_sel[10] = true;
799  // acop_before_->Fill(acop);
800 
801  // // Remaining flags (from global event information)
802  // if (nmuonsForZ1<1 || nmuonsForZ2<2) muon_sel[11] = true;
803  if (njets<=nJetMax_) electron_sel[10] = true;
804 
805  // Collect necessary flags "per electron"
806  int flags_passed = 0;
807  bool rec_sel_this = true;
808  bool eid_sel_this = true;
809  bool iso_sel_this = true;
810  bool all_sel_this = true;
811  for (int j=0; j<NFLAGS; ++j)
812  {
813  if (electron_sel[j]) flags_passed += 1;
814  if (j<2 && !electron_sel[j]) rec_sel_this = false;
815  if (j<4 && !electron_sel[j]) eid_sel_this = false;
816  if (j<7 && !electron_sel[j]) iso_sel_this = false;
817  if (!electron_sel[j]) all_sel_this = false;
818  }
819 
820  if (all_sel_this)
821  {
822  if (nGoodElectrons < 2)
823  {
824  goodElectron[nGoodElectrons][0] = 1.;
825  goodElectron[nGoodElectrons][1] = elec.massSqr();
826  goodElectron[nGoodElectrons][2] = elec.energy();
827  goodElectron[nGoodElectrons][3] = elec.px();
828  goodElectron[nGoodElectrons][4] = elec.py();
829  goodElectron[nGoodElectrons][5] = elec.pz();
830  }
831  nGoodElectrons++;
832  }
833 
834  // // "rec" => pt,eta and quality cuts are satisfied
835  // if (rec_sel_this) rec_sel = true;
836  // // "iso" => "rec" AND "muon is isolated"
837  // if (iso_sel_this) iso_sel = true;
838  // // "hlt" => "iso" AND "event is triggered"
839  // if (hlt_sel_this) hlt_sel = true;
840  // // "all" => "met" AND "Z/top rejection cuts"
841  // if (all_sel_this) all_sel = true;
842 
843  // "rec" => pt,eta cuts are satisfied
844  if (rec_sel_this) rec_sel = true;
845  // "eid" => "rec" AND "electron passes ID"
846  if (eid_sel_this) iso_sel = true;
847  // "iso" => "eid" AND "electron is isolated"
848  if (iso_sel_this) iso_sel = true;
849  // "met" => "iso" AND "MET/MT"
850  // "all" => "met" AND "event is triggered"
851  if (all_sel_this) all_sel = true;
852 
853  // Do N-1 histograms now (and only once for global event quantities)
854  if (flags_passed >= (NFLAGS-1))
855  {
856  if (!electron_sel[0] || flags_passed==NFLAGS)
857  {
858  pt_after_->Fill(pt);
859  }
860  if (!electron_sel[1] || flags_passed==NFLAGS)
861  {
862  eta_after_->Fill(eta);
863  }
864  if (!electron_sel[2] || flags_passed==NFLAGS)
865  {
866  if (isBarrel)
867  {
868  sieiebarrel_after_->Fill(sieie);
869  }
870  else if (isEndcap)
871  {
872  sieieendcap_after_->Fill(sieie);
873  }
874  }
875  if (!electron_sel[3] || flags_passed==NFLAGS)
876  {
877  if (isBarrel)
878  {
879  detainbarrel_after_->Fill(detain);
880  }
881  else if (isEndcap)
882  {
883  detainendcap_after_->Fill(detain);
884  }
885  }
886  if (!electron_sel[4] || flags_passed==NFLAGS)
887  {
888  if (isBarrel)
889  {
890  ecalisobarrel_after_->Fill(ecalisovar);
891  }
892  else if (isEndcap)
893  {
894  ecalisoendcap_after_->Fill(ecalisovar);
895  }
896  }
897  if (!electron_sel[5] || flags_passed==NFLAGS)
898  {
899  if (isBarrel)
900  {
901  hcalisobarrel_after_->Fill(hcalisovar);
902  }
903  else if (isEndcap)
904  {
905  hcalisoendcap_after_->Fill(hcalisovar);
906  }
907  }
908  if (!electron_sel[6] || flags_passed==NFLAGS)
909  {
910  if (isBarrel)
911  {
912  trkisobarrel_after_->Fill(trkisovar);
913  }
914  else if (isEndcap)
915  {
916  trkisoendcap_after_->Fill(trkisovar);
917  }
918  }
919  // if (!electron_sel[3] || flags_passed==NFLAGS)
920  // {
921  // detain_after_->Fill(detain);
922  // }
923  // if (!electron_sel[4] || flags_passed==NFLAGS)
924  // {
925  // ecaliso_after_->Fill(trackerHits);
926  // }
927  // if (!electron_sel[5] || flags_passed==NFLAGS)
928  // {
929  // tkelectr_after_->Fill(electr.isTrackerElectron());
930  // }
931  // if (!electron_sel[6] || flags_passed==NFLAGS)
932  // {
933  // iso_after_->Fill(isovar);
934  // }
935  if (!electron_sel[7] || flags_passed==NFLAGS)
936  {
937  if (!hlt_hist_done)
938  {
939  trig_after_->Fill(trigger_fired);
940  }
941  }
942  hlt_hist_done = true;
943  if (!electron_sel[8] || flags_passed==NFLAGS)
944  {
945  mt_after_->Fill(massT);
946  }
947  if (!electron_sel[9] || flags_passed==NFLAGS)
948  {
949  if (!met_hist_done) {
950  met_after_->Fill(met_et);
951  }
952  }
953  met_hist_done = true;
954  // if (!muon_sel[10] || flags_passed==NFLAGS)
955  // acop_after_->Fill(acop);
956  // if (!muon_sel[11] || flags_passed==NFLAGS)
957  // if (!nz1_hist_done) nz1_after_->Fill(nmuonsForZ1);
958  // nz1_hist_done = true;
959  // if (!muon_sel[11] || flags_passed==NFLAGS)
960  // if (!nz2_hist_done) nz2_after_->Fill(nmuonsForZ2);
961  // nz2_hist_done = true;
962  if (!electron_sel[10] || flags_passed==NFLAGS) {
963  if (!njets_hist_done)
964  {
965  njets_after_->Fill(njets);
966  if (jet_et>10) //don't want low energy "jets"
967  {
968  jet_et_after_ ->Fill(jet_et);
969  jet_eta_after_ ->Fill(jet_eta);
970  }
971  }
972  }
973  njets_hist_done = true;
974 
975  } // end N-1 histos block
976 
977  } // end loop through electrons
978 
979  // inv mass = sqrt(m_1^2 + m_2^2 + 2*(E_1*E_2 - (px1*px2 + py1*py2 + pz1+pz2) ) )
980  double invMass=0;
981 
982  nelectrons_before_->Fill(electronCollectionSize);
983  if (electronCollectionSize > 1)
984  {
985  invMass = sqrt(electron[0][1] + electron[1][1] + 2*(electron[0][2]*electron[1][2] - (electron[0][3]*electron[1][3] + electron[0][4]*electron[1][4] + electron[0][5]*electron[1][5]) ) );
986  invmass_before_->Fill(invMass);
987  invmassPU_before_->Fill(invMass,npvCount);
988  }
989 
991  if (nGoodElectrons > 1)
992  {
993  invMass = sqrt(goodElectron[0][1] + goodElectron[1][1] + 2*(goodElectron[0][2]*goodElectron[1][2] - (goodElectron[0][3]*goodElectron[1][3] + goodElectron[0][4]*goodElectron[1][4] + goodElectron[0][5]*goodElectron[1][5]) ) );
994  invmass_after_->Fill(invMass);
995  invmassPU_afterZ_->Fill(invMass,npvCount);
996  npvs_afterZ_->Fill(npvCount);
997  }
998 
999  // Collect final flags
1000  if (rec_sel) nrec++;
1001  if (eid_sel) neid++;
1002  if (iso_sel) niso++;
1003  // if (hlt_sel) nhlt++;
1004  // if (met_sel) nmet++;
1005 
1006  if (all_sel) {
1007  nsel++;
1008  LogTrace("") << ">>>> Event ACCEPTED";
1009  } else {
1010  LogTrace("") << ">>>> Event REJECTED";
1011  }
1012 
1013 
1014 
1015  return;
1016 
1017 }
1018 
1019 // This always returns only a positive deltaPhi
1020 double EwkElecDQM::calcDeltaPhi(double phi1, double phi2) {
1021 
1022  double deltaPhi = phi1 - phi2;
1023 
1024  if (deltaPhi < 0) deltaPhi = -deltaPhi;
1025 
1026  if (deltaPhi > 3.1415926) {
1027  deltaPhi = 2 * 3.1415926 - deltaPhi;
1028  }
1029 
1030  return deltaPhi;
1031 }
1032 
MonitorElement * ecalisoendcap_after_
Definition: EwkElecDQM.h:131
virtual double energy() const GCC11_FINAL
energy
MonitorElement * jet_et_after_
Definition: EwkElecDQM.h:178
virtual double et() const GCC11_FINAL
transverse energy
int i
Definition: DBlmapReader.cc:9
unsigned int nGoodElectrons
Definition: EwkElecDQM.h:93
MonitorElement * invmass_after_
Definition: EwkElecDQM.h:149
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:207
unsigned int nall
Definition: EwkElecDQM.h:84
MonitorElement * hcalisobarrel_after_
Definition: EwkElecDQM.h:134
DQMStore * theDbe
Definition: EwkElecDQM.h:95
unsigned int nsel
Definition: EwkElecDQM.h:90
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: EwkElecDQM.cc:358
double metMax_
Definition: EwkElecDQM.h:64
MonitorElement * nelectrons_before_
Definition: EwkElecDQM.h:157
HLTConfigProvider hltConfigProvider_
Definition: EwkElecDQM.h:82
double sieieCutBarrel_
Definition: EwkElecDQM.h:46
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * sieieendcap_before_
Definition: EwkElecDQM.h:106
MonitorElement * sieieendcap_after_
Definition: EwkElecDQM.h:107
Base class for all types of Jets.
Definition: Jet.h:21
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:61
MonitorElement * ecalisobarrel_before_
Definition: EwkElecDQM.h:127
edm::InputTag jetTag_
Definition: EwkElecDQM.h:38
virtual void beginJob()
Definition: EwkElecDQM.cc:125
MonitorElement * sieiebarrel_before_
Definition: EwkElecDQM.h:103
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: EwkElecDQM.cc:106
MonitorElement * hcalisobarrel_before_
Definition: EwkElecDQM.h:133
float dr04TkSumPt() const
Definition: GsfElectron.h:447
MonitorElement * detainbarrel_after_
Definition: EwkElecDQM.h:110
MonitorElement * ecalisobarrel_after_
Definition: EwkElecDQM.h:128
MonitorElement * detainendcap_before_
Definition: EwkElecDQM.h:112
T eta() const
MonitorElement * trig_before_
Definition: EwkElecDQM.h:145
MonitorElement * sieiebarrel_after_
Definition: EwkElecDQM.h:104
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
MonitorElement * detainbarrel_before_
Definition: EwkElecDQM.h:109
tuple vertexCollection
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
MonitorElement * mt_before_
Definition: EwkElecDQM.h:160
MonitorElement * nelectrons_after_
Definition: EwkElecDQM.h:158
edm::InputTag vertexTag_
Definition: EwkElecDQM.h:39
MonitorElement * hcalisoendcap_before_
Definition: EwkElecDQM.h:136
MonitorElement * npvs_afterZ_
Definition: EwkElecDQM.h:155
void Fill(long long x)
unsigned int niso
Definition: EwkElecDQM.h:87
double calcDeltaPhi(double phi1, double phi2)
Definition: EwkElecDQM.cc:1020
MonitorElement * mt_after_
Definition: EwkElecDQM.h:161
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
double ecalIsoCutEndcap_
Definition: EwkElecDQM.h:56
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
MonitorElement * jet_et_before_
Definition: EwkElecDQM.h:177
double detainCutEndcap_
Definition: EwkElecDQM.h:49
MonitorElement * njets_after_
Definition: EwkElecDQM.h:176
MonitorElement * pt_before_
Definition: EwkElecDQM.h:97
MonitorElement * pt_after_
Definition: EwkElecDQM.h:98
edm::InputTag elecTag_
Definition: EwkElecDQM.h:35
double metMin_
Definition: EwkElecDQM.h:63
double trkIsoCutEndcap_
Definition: EwkElecDQM.h:60
unsigned int PUBinCount_
Definition: EwkElecDQM.h:79
Definition: MET.h:32
virtual void endRun(const edm::Run &, const edm::EventSetup &)
Definition: EwkElecDQM.cc:273
T sqrt(T t)
Definition: SSEVec.h:48
unsigned int nrec
Definition: EwkElecDQM.h:85
MonitorElement * hcalisoendcap_after_
Definition: EwkElecDQM.h:137
int nJetMax_
Definition: EwkElecDQM.h:76
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
edm::InputTag trigTag_
Definition: EwkElecDQM.h:33
EwkElecDQM(const edm::ParameterSet &)
Definition: EwkElecDQM.cc:39
int j
Definition: DBlmapReader.cc:9
double ecalIsoCutBarrel_
Definition: EwkElecDQM.h:55
double trkIsoCutBarrel_
Definition: EwkElecDQM.h:59
edm::InputTag metTag_
Definition: EwkElecDQM.h:36
MonitorElement * invmass_before_
Definition: EwkElecDQM.h:148
MonitorElement * ecalisoendcap_before_
Definition: EwkElecDQM.h:130
unsigned int PUMax_
Definition: EwkElecDQM.h:79
MonitorElement * jet_eta_after_
Definition: EwkElecDQM.h:180
MonitorElement * trig_after_
Definition: EwkElecDQM.h:146
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
MonitorElement * jet_eta_before_
Definition: EwkElecDQM.h:179
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
int k[5][pyjets_maxn]
unsigned int neid
Definition: EwkElecDQM.h:86
double etaCut_
Definition: EwkElecDQM.h:44
double hcalIsoCutBarrel_
Definition: EwkElecDQM.h:57
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:75
bool isValidHltConfig_
Definition: EwkElecDQM.h:81
MonitorElement * detainendcap_after_
Definition: EwkElecDQM.h:113
MonitorElement * njets_before_
Definition: EwkElecDQM.h:175
MonitorElement * invmassPU_afterZ_
Definition: EwkElecDQM.h:151
MonitorElement * trkisobarrel_before_
Definition: EwkElecDQM.h:139
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
double sieieCutEndcap_
Definition: EwkElecDQM.h:47
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
MonitorElement * met_before_
Definition: EwkElecDQM.h:163
long long int num
Definition: procUtils.cc:71
MonitorElement * trkisoendcap_before_
Definition: EwkElecDQM.h:142
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:437
std::string const & label() const
Definition: InputTag.h:42
virtual float massSqr() const GCC11_FINAL
mass squared
MonitorElement * met_after_
Definition: EwkElecDQM.h:164
double eJetMin_
Definition: EwkElecDQM.h:75
virtual void endJob()
Definition: EwkElecDQM.cc:270
MonitorElement * trkisobarrel_after_
Definition: EwkElecDQM.h:140
void init_histograms()
Definition: EwkElecDQM.cc:129
double mtMax_
Definition: EwkElecDQM.h:62
MonitorElement * eta_after_
Definition: EwkElecDQM.h:101
double detainCutBarrel_
Definition: EwkElecDQM.h:48
const std::vector< std::string > elecTrig_
Definition: EwkElecDQM.h:42
MonitorElement * npvs_before_
Definition: EwkElecDQM.h:153
unsigned int prescaleSize() const
MonitorElement * trkisoendcap_after_
Definition: EwkElecDQM.h:143
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:440
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
virtual float pt() const GCC11_FINAL
transverse momentum
double hcalIsoCutEndcap_
Definition: EwkElecDQM.h:58
MonitorElement * eta_before_
Definition: EwkElecDQM.h:100
MonitorElement * invmassPU_before_
Definition: EwkElecDQM.h:150
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36
double mtMin_
Definition: EwkElecDQM.h:61
double ptCut_
Definition: EwkElecDQM.h:43