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