CMS 3D CMS Logo

WenuPlots.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: WenuPlots
4 // Class: WenuPlots
5 //
6 /*
7 
8  Description:
9  this is an analyzer that reads pat::CompositeCandidate WenuCandidates
10  and creates some plots
11  Implementation:
12  The code takes the output of the WenuCandidateFilter and
13  * implements on them a user defined selection
14  * implements the selection with one cut (configurable which cut) inverted
15  * creates a set of basic plots with the Wenu Candidate distribution
16  vs MET, MT etc. These plots are stored in a root file
17  If you have several root files from different runs you have to run a macro
18  to combine the output and have the final plots
19 
20  This analyser is PAT based in the sense that it reads CompositeCandidates,
21  which are composed of a pat::MET plus a pat::Electron. You normally
22  don't have to change this file when the CMSSW version changes because it
23  contains only methods from the stable core of pat Objects. Most
24  version dependent changes should be in WenuCandidateFilter.cc
25  TO DO LIST:
26  * more plots to be added
27  * there should be an base Plots class from which WenuPlots and ZeePlots
28  inherit. this makes sense since they have so many common methods
29 
30  Changes Log:
31  12Feb09 First Release of the code for CMSSW_2_2_X
32  16Sep09 tested that it works with 3_1_2 as well
33  09Sep09 added one extra iso with the name userIso_XX_
34  23Feb09 added option to include extra IDs that are in CMSSW, such as
35  categorized, likehood etc
36  added extra variables TIP and E/P
37  27May10 changes to apply the Spring10 selections, relative isolations
38  the 3 default ones, pat user isolations added in the end
39  change to framework independent variable definitions
40  double->Double_t etc and math.h functions from TMath
41  01Jul10 second electron information added
42  Contact:
43  Nikolaos Rompotis - Nikolaos.Rompotis@Cern.ch
44  Imperial College London
45 
46 
47 */
48 //
49 // Original Author: Nikolaos Rompotis
50 
51 
54 //#include "RecoEcal/EgammaCoreTools/plugins/EcalClusterCrackCorrectionFunctor.h"
55 
57 
58 {
60 // I N P U T P A R A M E T E R S
62 //
64 // WENU COLLECTION //////////////////////////////////////////////////////
65 //
66 
67  wenuCollectionToken_ = consumes<pat::CompositeCandidateCollection>(iConfig.getUntrackedParameter<edm::InputTag>("wenuCollectionTag"));
68  //
69  // code parameters
70  //
71  std::string outputFile_D = "histos.root";
72  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", outputFile_D);
73  WENU_VBTFselectionFileName_ = iConfig.getUntrackedParameter<std::string>("WENU_VBTFselectionFileName");
74  WENU_VBTFpreseleFileName_ = iConfig.getUntrackedParameter<std::string>("WENU_VBTFpreseleFileName");
75  DatasetTag_ = iConfig.getUntrackedParameter<Int_t>("DatasetTag");
76  //
77  // use of precalculatedID
78  // if you use it, then no other cuts are applied
79  usePrecalcID_ = iConfig.getUntrackedParameter<Bool_t>("usePrecalcID",false);
80  if (usePrecalcID_) {
81  usePrecalcIDType_ = iConfig.getUntrackedParameter<std::string>("usePrecalcIDType");
82  usePrecalcIDSign_ = iConfig.getUntrackedParameter<std::string>("usePrecalcIDSign","=");
83  usePrecalcIDValue_= iConfig.getUntrackedParameter<Double_t>("usePrecalcIDValue");
84  }
85  useValidFirstPXBHit_ = iConfig.getUntrackedParameter<Bool_t>("useValidFirstPXBHit",false);
86  useConversionRejection_ = iConfig.getUntrackedParameter<Bool_t>("useConversionRejection",false);
87  useExpectedMissingHits_ = iConfig.getUntrackedParameter<Bool_t>("useExpectedMissingHits",false);
88 
89  maxNumberOfExpectedMissingHits_ = iConfig.getUntrackedParameter<Int_t>("maxNumberOfExpectedMissingHits",1);
90  if (not usePrecalcID_) {
91  if (useValidFirstPXBHit_) std::cout << "WenuPlots: Warning: you have demanded a valid 1st layer PXB hit" << std::endl;
92  if (useConversionRejection_) std::cout << "WenuPlots: Warning: you have demanded egamma conversion rejection criteria to be applied" << std::endl;
93  if (useExpectedMissingHits_) std::cout << "WenuPlots: Warning: you have demanded at most "
94  <<maxNumberOfExpectedMissingHits_ << " missing inner hits "<< std::endl;
95  }
96  else {
97  std::cout << "WenuPlots: Using Precalculated ID with type " << usePrecalcIDType_
98  << usePrecalcIDSign_ << usePrecalcIDValue_ << std::endl;
99  }
100  if ((useValidFirstPXBHit_ || useExpectedMissingHits_ || useConversionRejection_) && (not usePrecalcID_)) {
101  usePreselection_ = true;
102  } else { usePreselection_ = false; }
103  includeJetInformationInNtuples_ = iConfig.getUntrackedParameter<Bool_t>("includeJetInformationInNtuples", false);
105  caloJetCollectionTag_ = iConfig.getUntrackedParameter<edm::InputTag>("caloJetCollectionTag");
106  caloJetCollectionToken_ = consumes< reco::CaloJetCollection >(caloJetCollectionTag_);
107  pfJetCollectionTag_ = iConfig.getUntrackedParameter<edm::InputTag>("pfJetCollectionTag");
108  pfJetCollectionToken_ = consumes< reco::PFJetCollection >(pfJetCollectionTag_);
109  DRJetFromElectron_ = iConfig.getUntrackedParameter<Double_t>("DRJetFromElectron");
110  }
111  storeExtraInformation_ = iConfig.getUntrackedParameter<Bool_t>("storeExtraInformation");
112  storeAllSecondElectronVariables_ = iConfig.getUntrackedParameter<Bool_t>("storeAllSecondElectronVariables", false);
113  // primary vtx collections
114  PrimaryVerticesCollectionToken_=consumes< std::vector<reco::Vertex> >(iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVerticesCollection", edm::InputTag("offlinePrimaryVertices")));
115  PrimaryVerticesCollectionBSToken_=consumes< std::vector<reco::Vertex> >(iConfig.getUntrackedParameter<edm::InputTag>("PrimaryVerticesCollectionBS",edm::InputTag("offlinePrimaryVerticesWithBS")));
116  //
117  // the selection cuts:
118  trackIso_EB_ = iConfig.getUntrackedParameter<Double_t>("trackIso_EB", 1000.);
119  ecalIso_EB_ = iConfig.getUntrackedParameter<Double_t>("ecalIso_EB", 1000.);
120  hcalIso_EB_ = iConfig.getUntrackedParameter<Double_t>("hcalIso_EB", 1000.);
121  //
122  trackIso_EE_ = iConfig.getUntrackedParameter<Double_t>("trackIso_EE", 1000.);
123  ecalIso_EE_ = iConfig.getUntrackedParameter<Double_t>("ecalIso_EE", 1000.);
124  hcalIso_EE_ = iConfig.getUntrackedParameter<Double_t>("hcalIso_EE", 1000.);
125  //
126  sihih_EB_ = iConfig.getUntrackedParameter<Double_t>("sihih_EB");
127  dphi_EB_ = iConfig.getUntrackedParameter<Double_t>("dphi_EB");
128  deta_EB_ = iConfig.getUntrackedParameter<Double_t>("deta_EB");
129  hoe_EB_ = iConfig.getUntrackedParameter<Double_t>("hoe_EB");
130  cIso_EB_ = iConfig.getUntrackedParameter<Double_t>("cIso_EB", 1000.);
131  tip_bspot_EB_=iConfig.getUntrackedParameter<Double_t>("tip_bspot_EB", 1000.);
132  eop_EB_=iConfig.getUntrackedParameter<Double_t>("eop_EB", 1000.);
133  //
134  sihih_EE_ = iConfig.getUntrackedParameter<Double_t>("sihih_EE");
135  dphi_EE_ = iConfig.getUntrackedParameter<Double_t>("dphi_EE");
136  deta_EE_ = iConfig.getUntrackedParameter<Double_t>("deta_EE");
137  hoe_EE_ = iConfig.getUntrackedParameter<Double_t>("hoe_EE");
138  cIso_EE_ = iConfig.getUntrackedParameter<Double_t>("cIso_EE", 1000.);
139  tip_bspot_EE_=iConfig.getUntrackedParameter<Double_t>("tip_bspot_EE", 1000.);
140  eop_EE_=iConfig.getUntrackedParameter<Double_t>("eop_EE", 1000.);
141  //
142  trackIsoUser_EB_ = iConfig.getUntrackedParameter<Double_t>("trackIsoUser_EB", 1000.);
143  ecalIsoUser_EB_ = iConfig.getUntrackedParameter<Double_t>("ecalIsoUser_EB", 1000.);
144  hcalIsoUser_EB_ = iConfig.getUntrackedParameter<Double_t>("hcalIsoUser_EB", 1000.);
145  trackIsoUser_EE_ = iConfig.getUntrackedParameter<Double_t>("trackIsoUser_EE", 1000.);
146  ecalIsoUser_EE_ = iConfig.getUntrackedParameter<Double_t>("ecalIsoUser_EE", 1000.);
147  hcalIsoUser_EE_ = iConfig.getUntrackedParameter<Double_t>("hcalIsoUser_EE", 1000.);
148  //
149  trackIso_EB_inv = iConfig.getUntrackedParameter<Bool_t>("trackIso_EB_inv", false);
150  ecalIso_EB_inv = iConfig.getUntrackedParameter<Bool_t>("ecalIso_EB_inv", false);
151  hcalIso_EB_inv = iConfig.getUntrackedParameter<Bool_t>("hcalIso_EB_inv", false);
152  //
153  trackIso_EE_inv = iConfig.getUntrackedParameter<Bool_t>("trackIso_EE_inv", false);
154  ecalIso_EE_inv = iConfig.getUntrackedParameter<Bool_t>("ecalIso_EE_inv", false);
155  hcalIso_EE_inv = iConfig.getUntrackedParameter<Bool_t>("hcalIso_EE_inv", false);
156  //
157  sihih_EB_inv = iConfig.getUntrackedParameter<Bool_t>("sihih_EB_inv", false);
158  dphi_EB_inv = iConfig.getUntrackedParameter<Bool_t>("dphi_EB_inv", false);
159  deta_EB_inv = iConfig.getUntrackedParameter<Bool_t>("deta_EB_inv", false);
160  hoe_EB_inv = iConfig.getUntrackedParameter<Bool_t>("hoe_EB_inv", false);
161  cIso_EB_inv = iConfig.getUntrackedParameter<Bool_t>("cIso_EB_inv", false);
162  tip_bspot_EB_inv=iConfig.getUntrackedParameter<Bool_t>("tip_bspot_EB_inv", false);
163  eop_EB_inv=iConfig.getUntrackedParameter<Bool_t>("eop_EB_inv", false);
164  //
165  sihih_EE_inv = iConfig.getUntrackedParameter<Bool_t>("sihih_EE_inv", false);
166  dphi_EE_inv = iConfig.getUntrackedParameter<Bool_t>("dphi_EE_inv", false);
167  deta_EE_inv = iConfig.getUntrackedParameter<Bool_t>("deta_EE_inv", false);
168  hoe_EE_inv = iConfig.getUntrackedParameter<Bool_t>("hoe_EE_inv", false);
169  cIso_EE_inv = iConfig.getUntrackedParameter<Bool_t>("cIso_EE_inv", false);
170  tip_bspot_EE_inv=iConfig.getUntrackedParameter<Bool_t>("tip_bspot_EE_inv", false);
171  eop_EE_inv=iConfig.getUntrackedParameter<Bool_t>("eop_EE_inv", false);
172  //
173  trackIsoUser_EB_inv = iConfig.getUntrackedParameter<Bool_t>("trackIsoUser_EB_inv", false);
174  ecalIsoUser_EB_inv = iConfig.getUntrackedParameter<Bool_t>("ecalIsoUser_EB_inv", false);
175  hcalIsoUser_EB_inv = iConfig.getUntrackedParameter<Bool_t>("hcalIsoUser_EB_inv", false);
176  trackIsoUser_EE_inv = iConfig.getUntrackedParameter<Bool_t>("trackIsoUser_EE_inv", false);
177  ecalIsoUser_EE_inv = iConfig.getUntrackedParameter<Bool_t>("ecalIsoUser_EE_inv", false);
178  hcalIsoUser_EE_inv = iConfig.getUntrackedParameter<Bool_t>("hcalIsoUser_EE_inv", false);
179 
180 }
181 
182 
183 
185 {
186 
187  // do anything here that needs to be done at desctruction time
188  // (e.g. close files, deallocate resources etc.)
189 
190 }
191 
192 
193 //
194 // member functions
195 //
196 
197 // ------------ method called to for each event ------------
198 void
200 {
201  using namespace std;
202  //
203  // Get the collections here
204  //
206  iEvent.getByToken(wenuCollectionToken_, WenuCands);
207 
208  if (not WenuCands.isValid()) {
209  cout << "Warning: no wenu candidates in this event..." << endl;
210  return;
211  }
212  const pat::CompositeCandidateCollection *wcands = WenuCands.product();
213  const pat::CompositeCandidateCollection::const_iterator
214  wenuIter = wcands->begin();
215  const pat::CompositeCandidate wenu = *wenuIter;
216  //
217  // get the parts of the composite candidate:
218  const pat::Electron * myElec=
219  dynamic_cast<const pat::Electron*> (wenu.daughter("electron"));
220  const pat::MET * myMet=
221  dynamic_cast<const pat::MET*> (wenu.daughter("met"));
222  const pat::MET * myPfMet=
223  dynamic_cast<const pat::MET*> (wenu.daughter("pfmet"));
224  const pat::MET * myTcMet=
225  dynamic_cast<const pat::MET*> (wenu.daughter("tcmet"));
226  // _______________________________________________________________________
227  //
228  // VBTF Root tuple production --------------------------------------------
229  // _______________________________________________________________________
230  //
231  // .......................................................................
232  // vbtf produces 2 root tuples: one that contains the highest pT electron
233  // that passes a user defined selection and one other with only the
234  // preselection criteria applied
235  // .......................................................................
236  //
237  // fill the tree variables
238  runNumber = iEvent.run();
239  eventNumber = Long64_t( iEvent.eventAuxiliary().event() );
240  lumiSection = (Int_t) iEvent.luminosityBlock();
241  //
242  ele_sc_eta = (Float_t) myElec->superCluster()->eta();
243  ele_sc_phi = (Float_t) myElec->superCluster()->phi();
244  double scx = myElec->superCluster()->x();
245  double scy = myElec->superCluster()->y();
246  double scz = myElec->superCluster()->z();
247  ele_sc_rho = (Float_t) sqrt( scx*scx + scy*scy + scz*scz );
248  ele_sc_energy = (Float_t) myElec->superCluster()->energy();
249  ele_sc_gsf_et = (Float_t) myElec->superCluster()->energy()/TMath::CosH(myElec->gsfTrack()->eta());
250  ele_cand_eta = (Float_t) myElec->eta();
251  ele_cand_phi = (Float_t) myElec->phi();
252  ele_cand_et = (Float_t) myElec->et();
253  //
258  //
259  ele_id_sihih = (Float_t) myElec->sigmaIetaIeta();
260  ele_id_deta = (Float_t) myElec->deltaEtaSuperClusterTrackAtVtx();
261  ele_id_dphi = (Float_t) myElec->deltaPhiSuperClusterTrackAtVtx();
262  ele_id_hoe = (Float_t) myElec->hadronicOverEm();
263  //
264  ele_cr_mhitsinner= myElec->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
265  ele_cr_dcot = myElec->convDcot();
266  ele_cr_dist = myElec->convDist();
267  //
268  ele_vx = (Float_t) myElec->vx();
269  ele_vy = (Float_t) myElec->vy();
270  ele_vz = (Float_t) myElec->vz();
271  // get the primary vtx information
272  // no BS
275  const std::vector<reco::Vertex> Vtx = *(pVtx.product());
276  // with BS
279  const std::vector<reco::Vertex> VtxBS = *(pVtxBS.product());
280  if (!Vtx.empty()) {
281  pv_x = Float_t(Vtx[0].position().x());
282  pv_y = Float_t(Vtx[0].position().y());
283  pv_z = Float_t(Vtx[0].position().z());
284  ele_tip_pv = myElec->gsfTrack()->dxy(Vtx[0].position());
285  } else {
286  pv_x = -999999.;
287  pv_y = -999999.;
288  pv_z = -999999.;
289  ele_tip_pv = -999999.;
290  }
291  if (!VtxBS.empty()) {
292  pvbs_x = Float_t(VtxBS[0].position().x());
293  pvbs_y = Float_t(VtxBS[0].position().y());
294  pvbs_z = Float_t(VtxBS[0].position().z());
295  ele_tip_pvbs = myElec->gsfTrack()->dxy(VtxBS[0].position());
296  } else {
297  pvbs_x = -999999.;
298  pvbs_y = -999999.;
299  pvbs_z = -999999.;
300  ele_tip_pvbs = -999999.;
301  }
302 
303  //
304  ele_gsfCharge = (Int_t) myElec->gsfTrack()->charge();
305  // must keep the ctf track collection, i.e. general track collection
306  ele_ctfCharge = (Int_t) myElec->closestCtfTrackRef().isNonnull() ? myElec->closestCtfTrackRef()->charge():-9999;
307  ele_scPixCharge = (Int_t) myElec->chargeInfo().scPixCharge;
308  ele_eop = (Float_t) myElec->eSuperClusterOverP();
309  ele_tip_bs = (Float_t) -myElec->dB();
310  //ele_tip_pv = myElec->userFloat("ele_tip_pv");
311  ele_pin = (Float_t) myElec->trackMomentumAtVtx().R();
312  ele_pout = (Float_t) myElec->trackMomentumOut().R();
313  //
314  event_caloMET = (Float_t) myMet->et();
315  event_pfMET = (Float_t) myPfMet->et();
316  event_tcMET = (Float_t) myTcMet->et();
317  event_caloMET_phi= (Float_t) myMet->phi();
318  event_pfMET_phi = (Float_t) myPfMet->phi();
319  event_tcMET_phi = (Float_t) myTcMet->phi();
320  event_caloSumEt = (Float_t) myMet->sumEt();
321  event_pfSumEt = (Float_t) myPfMet->sumEt();
322  event_tcSumEt = (Float_t) myTcMet->sumEt();
323  // transverse mass for the user's convenience
324  event_caloMT = (Float_t) TMath::Sqrt(2.*(ele_sc_gsf_et*event_caloMET -
326  + ele_sc_gsf_et*TMath::Sin(ele_sc_phi)*event_caloMET*TMath::Sin(event_caloMET_phi)
327  ) ) );
328  event_pfMT = (Float_t) TMath::Sqrt(2.*(ele_sc_gsf_et*event_pfMET -
329  (ele_sc_gsf_et*TMath::Cos(ele_sc_phi)*event_pfMET*TMath::Cos(event_pfMET_phi)
330  + ele_sc_gsf_et*TMath::Sin(ele_sc_phi)*event_pfMET*TMath::Sin(event_pfMET_phi)
331  ) ) );
332  event_tcMT = (Float_t) TMath::Sqrt(2.*(ele_sc_gsf_et*event_tcMET -
333  (ele_sc_gsf_et*TMath::Cos(ele_sc_phi)*event_tcMET*TMath::Cos(event_tcMET_phi)
334  + ele_sc_gsf_et*TMath::Sin(ele_sc_phi)*event_tcMET*TMath::Sin(event_tcMET_phi)
335  ) ) );
337  // jet information - only if the user asks for it
338  // keep the 5 highest et jets of the event that are further than DR> DRJetFromElectron_
340  // initialize the array of the jet information
341  for (int i=0; i<5; ++i) {
342  calojet_et[i] = -999999; calojet_eta[i] = -999999; calojet_phi[i] = -999999;
343  pfjet_et[i] = -999999; pfjet_eta[i] = -999999; pfjet_phi[i] = -999999;
344  }
345  // get hold of the jet collections
348  iEvent.getByToken(caloJetCollectionToken_, pCaloJets);
349  iEvent.getByToken(pfJetCollectionToken_, pPfJets);
350  //
351  // calo jets now:
352  if (pCaloJets.isValid()) {
353  const reco::CaloJetCollection *caloJets = pCaloJets.product();
354  int nCaloJets = (int) caloJets->size();
355  if (nCaloJets>0) {
356  float *nCaloET = new float[nCaloJets];
357  float *nCaloEta = new float[nCaloJets];
358  float *nCaloPhi = new float[nCaloJets];
359  reco::CaloJetCollection::const_iterator cjet = caloJets->begin();
360  int counter = 0;
361  for (; cjet != caloJets->end(); ++cjet) {
362  // store them only if they are far enough from the electron
363  Double_t DR = reco::deltaR(cjet->eta(), cjet->phi(), myElec->gsfTrack()->eta(), ele_sc_phi);
364  if (DR > DRJetFromElectron_) {
365  nCaloET[counter] = cjet->et();
366  nCaloEta[counter] = cjet->eta();
367  nCaloPhi[counter] = cjet->phi();
368  ++counter;
369  }
370  }
371  int *caloJetSorted = new int[nCaloJets];
372  TMath::Sort(nCaloJets, nCaloET, caloJetSorted, true);
373  for (int i=0; i<nCaloJets; ++i) {
374  if (i>=5) break;
375  calojet_et[i] = nCaloET[ caloJetSorted[i] ];
376  calojet_eta[i] = nCaloEta[ caloJetSorted[i] ];
377  calojet_phi[i] = nCaloPhi[ caloJetSorted[i] ];
378  }
379  delete [] caloJetSorted;
380  delete [] nCaloET;
381  delete [] nCaloEta;
382  delete [] nCaloPhi;
383  }
384  } else {
385  std::cout << "WenuPlots: Could not get caloJet collection with name "
386  << caloJetCollectionTag_ << std::endl;
387  }
388  //
389  // pf jets now:
390  if (pPfJets.isValid()) {
391  const reco::PFJetCollection *pfJets = pPfJets.product();
392  int nPfJets = (int) pfJets->size();
393  if (nPfJets>0) {
394  float *nPfET = new float[nPfJets];
395  float *nPfEta = new float[nPfJets];
396  float *nPfPhi = new float[nPfJets];
397  reco::PFJetCollection::const_iterator pjet = pfJets->begin();
398  int counter = 0;
399  for (; pjet != pfJets->end(); ++pjet) {
400  // store them only if they are far enough from the electron
401  Double_t DR = reco::deltaR(pjet->eta(), pjet->phi(), myElec->gsfTrack()->eta(), ele_sc_phi);
402  if (DR > DRJetFromElectron_) {
403  nPfET[counter] = pjet->et();
404  nPfEta[counter] = pjet->eta();
405  nPfPhi[counter] = pjet->phi();
406  ++counter;
407  }
408  }
409  int *pfJetSorted = new int[nPfJets];
410  TMath::Sort(nPfJets, nPfET, pfJetSorted, true);
411  for (int i=0; i<nPfJets; ++i) {
412  if (i>=5) break;
413  pfjet_et[i] = nPfET[ pfJetSorted[i] ];
414  pfjet_eta[i] = nPfEta[ pfJetSorted[i] ];
415  pfjet_phi[i] = nPfPhi[ pfJetSorted[i] ];
416  }
417  delete [] pfJetSorted;
418  delete [] nPfET;
419  delete [] nPfEta;
420  delete [] nPfPhi;
421  }
422  } else {
423  std::cout << "WenuPlots: Could not get pfJet collection with name "
424  << pfJetCollectionTag_ << std::endl;
425  }
426 
427  }
428  // second electron information - in preselected ntuple only
429  ele2nd_sc_gsf_et = -1; // also in sele tree
430  ele2nd_sc_eta = -1;
431  ele2nd_sc_phi = -1;
432  ele2nd_sc_rho = 0;
433  ele2nd_cand_eta = 0;
434  ele2nd_cand_phi = 0;
435  ele2nd_cand_et = 0;
436  ele2nd_pin = 0;
437  ele2nd_pout = 0;
438  ele2nd_passes_selection = -1; // also in sele tree
440  //
441  // second electron selection variables: only if requested by the user
442  //
443  ele2nd_iso_track = 0;
444  ele2nd_iso_ecal = 0;
445  ele2nd_iso_hcal = 0;
446  //
447  ele2nd_id_sihih = 0;
448  ele2nd_id_deta = 0;
449  ele2nd_id_dphi = 0;
450  ele2nd_id_hoe = 0;
451  //
453  ele2nd_cr_dcot = 0;
454  ele2nd_cr_dist = 0;
455  //
456  ele2nd_vx = 0;
457  ele2nd_vy = 0;
458  ele2nd_vz = 0;
459  //
460  ele2nd_gsfCharge = 0;
461  // must keep the ctf track collection, i.e. general track collection
462  ele2nd_ctfCharge = 0;
463  ele2nd_scPixCharge = 0;
464  ele2nd_eop = 0;
465  ele2nd_tip_bs = 0;
466  ele2nd_tip_pv = 0;
468  //
469  // convention for ele2nd_passes_selection
470  // 0 passes no selection
471  // 1 passes WP95
472  // 2 passes WP90
473  // 3 passes WP85
474  // 4 passes WP80
475  // 5 passes WP70
476  // 6 passes WP60
477  if (myElec->userInt("hasSecondElectron") == 1 && storeExtraInformation_) {
478  const pat::Electron * mySecondElec=
479  dynamic_cast<const pat::Electron*> (wenu.daughter("secondElec"));
480  ele2nd_sc_gsf_et = (Float_t) mySecondElec->superCluster()->energy()/TMath::CosH(mySecondElec->gsfTrack()->eta());
481 
482  ele2nd_sc_eta = (Float_t) mySecondElec->superCluster()->eta();
483  ele2nd_sc_phi = (Float_t) mySecondElec->superCluster()->phi();
484  double sc2x = mySecondElec->superCluster()->x();
485  double sc2y = mySecondElec->superCluster()->y();
486  double sc2z = mySecondElec->superCluster()->z();
487  ele2nd_sc_rho = (Float_t) sqrt(sc2x*sc2x + sc2y*sc2y + sc2z*sc2z);
488  ele2nd_cand_eta = (Float_t) mySecondElec->eta();
489  ele2nd_cand_phi = (Float_t) mySecondElec->phi();
490  ele2nd_cand_et = (Float_t) mySecondElec->et();
491  ele2nd_pin = (Float_t) mySecondElec->trackMomentumAtVtx().R();;
492  ele2nd_pout = (Float_t) mySecondElec->trackMomentumOut().R();
493  ele2nd_ecalDriven= (Int_t) mySecondElec->ecalDrivenSeed();
494  // check the selections
495  bool isIDCalc = mySecondElec->isElectronIDAvailable("simpleEleId95relIso") &&
496  mySecondElec->isElectronIDAvailable("simpleEleId90relIso") &&
497  mySecondElec->isElectronIDAvailable("simpleEleId85relIso") &&
498  mySecondElec->isElectronIDAvailable("simpleEleId80relIso") &&
499  mySecondElec->isElectronIDAvailable("simpleEleId70relIso") &&
500  mySecondElec->isElectronIDAvailable("simpleEleId60relIso");
501  if (isIDCalc) {
503  if (fabs(mySecondElec->electronID("simpleEleId60relIso")-7) < 0.1) ele2nd_passes_selection = 6;
504  else if (fabs(mySecondElec->electronID("simpleEleId70relIso")-7) < 0.1) ele2nd_passes_selection = 5;
505  else if (fabs(mySecondElec->electronID("simpleEleId80relIso")-7) < 0.1) ele2nd_passes_selection = 4;
506  else if (fabs(mySecondElec->electronID("simpleEleId85relIso")-7) < 0.1) ele2nd_passes_selection = 3;
507  else if (fabs(mySecondElec->electronID("simpleEleId90relIso")-7) < 0.1) ele2nd_passes_selection = 2;
508  else if (fabs(mySecondElec->electronID("simpleEleId95relIso")-7) < 0.1) ele2nd_passes_selection = 1;
509  }
511  ele2nd_iso_track = (Float_t) mySecondElec->dr03IsolationVariables().tkSumPt / ele2nd_cand_et;
513  ele2nd_iso_hcal = (Float_t) ( mySecondElec->dr03IsolationVariables().hcalDepth1TowerSumEt +
515  ele2nd_id_sihih = (Float_t) mySecondElec->sigmaIetaIeta();
516  ele2nd_id_deta = (Float_t) mySecondElec->deltaEtaSuperClusterTrackAtVtx();
517  ele2nd_id_dphi = (Float_t) mySecondElec->deltaPhiSuperClusterTrackAtVtx();
518  ele2nd_id_hoe = (Float_t) mySecondElec->hadronicOverEm();
519 
520  ele2nd_cr_mhitsinner = mySecondElec->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
521  ele2nd_cr_dcot = mySecondElec->convDcot();
522  ele2nd_cr_dist = mySecondElec->convDist();
523 
524  ele2nd_vx = (Float_t) mySecondElec->vx();
525  ele2nd_vy = (Float_t) mySecondElec->vy();
526  ele2nd_vz = (Float_t) mySecondElec->vz();
527  ele2nd_gsfCharge = (Int_t) mySecondElec->gsfTrack()->charge();
528  // must keep the ctf track collection, i.e. general track collection
529  ele2nd_ctfCharge = (Int_t) mySecondElec->closestCtfTrackRef().isNonnull() ? mySecondElec->closestCtfTrackRef()->charge():-9999;
530  ele2nd_scPixCharge = (Int_t) mySecondElec->chargeInfo().scPixCharge;
531  ele2nd_eop = (Float_t) mySecondElec->eSuperClusterOverP();
532  ele2nd_tip_bs = (Float_t) -mySecondElec->dB();
533  if (!Vtx.empty()) {
534  ele2nd_tip_pv = mySecondElec->gsfTrack()->dxy(Vtx[0].position());
535  }
536  if (!VtxBS.empty()) {
537  ele2nd_tip_pvbs = mySecondElec->gsfTrack()->dxy(VtxBS[0].position());
538  }
539  ele2nd_hltmatched_dr = mySecondElec->userFloat("HLTMatchingDR");
540  }
541  }
542  // some extra information
544  ele_hltmatched_dr = -999.;
545  VtxTracksSize.clear();
546  VtxNormalizedChi2.clear();
547  VtxTracksSizeBS.clear();
548  VtxNormalizedChi2BS.clear();
550  if (myElec->hasUserFloat("HLTMatchingDR")) {
551  ele_hltmatched_dr = myElec->userFloat("HLTMatchingDR");
552  }
553  if (myElec->hasUserInt("triggerDecision")) {
554  event_triggerDecision = myElec->userInt("triggerDecision");
555  }
556  // extra information related to the primary vtx collection
557  for (Int_t i=0; i < (Int_t) Vtx.size(); ++i) {
558  VtxTracksSize.push_back(Vtx[i].tracksSize());
559  VtxNormalizedChi2.push_back(Vtx[i].normalizedChi2());
560  }
561  for (Int_t i=0; i < (Int_t) VtxBS.size(); ++i) {
562  VtxTracksSizeBS.push_back(VtxBS[i].tracksSize());
563  VtxNormalizedChi2BS.push_back(VtxBS[i].normalizedChi2());
564  }
565  }
566  // if the electron passes the selection
567  // it is meant to be a precalculated selection here, in order to include
568  // conversion rejection too
569  if (CheckCuts(myElec) && myElec->userInt("failsSecondElectronCut") == 0) {
570  vbtfSele_tree->Fill();
571  }
572  vbtfPresele_tree->Fill();
573 
574 
575 
576  //
577  // _______________________________________________________________________
578  //
579  // histogram production --------------------------------------------------
580  // _______________________________________________________________________
581  //
582  // if you want some preselection: Conv rejection, hit pattern
583  if (usePreselection_) {
584  if (not PassPreselectionCriteria(myElec)) return;
585  }
586  //
587  // some variables here
588  Double_t scEta = myElec->superCluster()->eta();
589  Double_t scPhi = myElec->superCluster()->phi();
590  Double_t scEt = myElec->superCluster()->energy()/TMath::CosH(scEta);
591  Double_t met = myMet->et();
592  Double_t metPhi = myMet->phi();
593  Double_t mt = TMath::Sqrt(2.0*scEt*met*(1.0-(TMath::Cos(scPhi)*TMath::Cos(metPhi)+TMath::Sin(scPhi)*TMath::Sin(metPhi))));
594 
595  Double_t trackIso = myElec->userIsolation(pat::TrackIso);
596  Double_t ecalIso = myElec->userIsolation(pat::EcalIso);
597  Double_t hcalIso = myElec->userIsolation(pat::HcalIso);
598  Double_t sihih = myElec->scSigmaIEtaIEta();
599  Double_t dphi = myElec->deltaPhiSuperClusterTrackAtVtx();
600  Double_t deta = myElec->deltaEtaSuperClusterTrackAtVtx();
601  Double_t HoE = myElec->hadronicOverEm();
602  //
603  //
604  //
605  // the inverted selection plots:
606  // only if not using precalcID
607  if (not usePrecalcID_) {
608  if (CheckCutsInverse(myElec)){
609  //std::cout << "-----------------INVERSION-----------passed" << std::endl;
610  h_met_inverse->Fill(met);
611  h_mt_inverse->Fill(mt);
612  if(TMath::Abs(scEta)<1.479){
613  h_met_inverse_EB->Fill(met);
614  h_mt_inverse_EB->Fill(mt);
615  }
616  if(TMath::Abs(scEta)>1.479){
617  h_met_inverse_EE->Fill(met);
618  h_mt_inverse_EE->Fill(mt);
619  }
620  }
621  }
622  //
624  //
625  // N-1 plots: plot some variable so that all the other cuts are satisfied
626  //
627  // make these plots only if you have the normal selection, not pre-calced
628  if (not usePrecalcID_) {
629  if ( TMath::Abs(scEta) < 1.479) { // reminder: the precise fiducial cuts are in
630  // in the filter
631  if (CheckCutsNminusOne(myElec, 0))
632  h_trackIso_eb_NmOne->Fill(trackIso);
633  }
634  else {
635  if (CheckCutsNminusOne(myElec, 0))
636  h_trackIso_ee_NmOne->Fill(trackIso);
637  }
638  }
639  //
640  // SELECTION APPLICATION
641  //
642  // from here on you have only events that pass the full selection
643  if (not CheckCuts(myElec)) return;
645 
646  h_met->Fill(met);
647  h_mt->Fill(mt);
648  if(TMath::Abs(scEta)<1.479){
649  h_met_EB->Fill(met);
650  h_mt_EB->Fill(mt);
651 
652  h_EB_trkiso->Fill( trackIso );
653  h_EB_ecaliso->Fill( ecalIso );
654  h_EB_hcaliso->Fill( hcalIso );
655  h_EB_sIetaIeta->Fill( sihih );
656  h_EB_dphi->Fill( dphi );
657  h_EB_deta->Fill( deta );
658  h_EB_HoE->Fill( HoE );
659 
660  }
661  if(TMath::Abs(scEta)>1.479){
662  h_met_EE->Fill(met);
663  h_mt_EE->Fill(mt);
664 
665  h_EE_trkiso->Fill( trackIso );
666  h_EE_ecaliso->Fill( ecalIso );
667  h_EE_hcaliso->Fill( hcalIso );
668  h_EE_sIetaIeta->Fill( sihih );
669  h_EE_dphi->Fill( dphi );
670  h_EE_deta->Fill( deta );
671  h_EE_HoE->Fill( HoE );
672 
673  }
674  // uncomment for debugging purposes
675  /*
676  std::cout << "tracIso: " << trackIso << ", " << myElec->trackIso() << ", ecaliso: " << ecalIso
677  << ", " << myElec->ecalIso() << ", hcaliso: " << hcalIso << ", " << myElec->hcalIso()
678  << ", mishits: "
679  << myElec->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS)
680  << std::endl;
681  std::cout << "Electron ID: 95relIso=" << myElec->electronID("simpleEleId95relIso")
682  << " 90relIso=" << myElec->electronID("simpleEleId90relIso")
683  << " 85relIso=" << myElec->electronID("simpleEleId85relIso")
684  << " 80relIso=" << myElec->electronID("simpleEleId80relIso")
685  << " 70relIso=" << myElec->electronID("simpleEleId70relIso")
686  << " 60relIso=" << myElec->electronID("simpleEleId60relIso")
687  << " 95cIso=" << myElec->electronID("simpleEleId95cIso")
688  << " 90cIso=" << myElec->electronID("simpleEleId90cIso")
689  << " 85cIso=" << myElec->electronID("simpleEleId85cIso")
690  << " 80cIso=" << myElec->electronID("simpleEleId80cIso")
691  << " 70cIso=" << myElec->electronID("simpleEleId70cIso")
692  << " 60cIso=" << myElec->electronID("simpleEleId60cIso")
693  << std::endl;
694  std::cout << "mySelection: " << (CheckCuts(myElec) && PassPreselectionCriteria(myElec)) << endl;
695  */
696  h_scEt->Fill(scEt);
697  h_scEta->Fill(scEta);
698  h_scPhi->Fill(scPhi);
699 
700 }
701 
702 /***********************************************************************
703  *
704  * Checking Cuts and making selections:
705  * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
706  * all the available methods take input a pointer to a pat::Electron
707  *
708  * Bool_t CheckCuts(const pat::Electron *):
709  * true if the input selection is satisfied
710  * Bool_t CheckCutsInverse(const pat::Electron *ele):
711  * true if the cuts with inverted the ones specified in the
712  * cfg are satisfied
713  * Bool_t CheckCutsNminusOne(const pat::Electron *ele, int jj):
714  * true if all the cuts with cut #jj ignored are satisfied
715  *
716  ***********************************************************************/
718 {
719  if (usePrecalcID_) {
720  if (not ele-> isElectronIDAvailable(usePrecalcIDType_)) {
721  std::cout << "Error! not existing ID with name: "
722  << usePrecalcIDType_ << " function will return true!"
723  << std::endl;
724  return true;
725  }
726  Double_t val = ele->electronID(usePrecalcIDType_);
727  if (usePrecalcIDSign_ == "<") {
728  return val < usePrecalcIDValue_;
729  }
730  else if (usePrecalcIDSign_ == ">") {
731  return val > usePrecalcIDValue_;
732  }
733  else { // equality: it returns 0,1,2,3 but as float
734  return TMath::Abs(val-usePrecalcIDValue_)<0.1;
735  }
736  }
737  else {
738  for (int i=0; i<nBarrelVars_; ++i) {
739  if (not CheckCut(ele, i)) return false;
740  }
741  return true;
742  }
743 }
745 
747 {
748  for (int i=0; i<nBarrelVars_; ++i){
749  if ( CheckCutInv(ele, i) == false) return false;
750  }
751  return true;
752 
753 }
756 {
757  for (int i=0; i<nBarrelVars_; ++i){
758  if (i==jj) continue;
759  if ( CheckCut(ele, i) == false) return false;
760  }
761  return true;
762 }
764 Bool_t WenuPlots::CheckCut(const pat::Electron *ele, int i) {
765  Double_t fabseta = TMath::Abs(ele->superCluster()->eta());
766  if ( fabseta<1.479) {
767  return TMath::Abs(ReturnCandVar(ele, i)) < CutVars_[i];
768  }
769  return TMath::Abs(ReturnCandVar(ele, i)) < CutVars_[i+nBarrelVars_];
770 }
772 Bool_t WenuPlots::CheckCutInv(const pat::Electron *ele, int i) {
773  Double_t fabseta = TMath::Abs(ele->superCluster()->eta());
774  if ( fabseta<1.479) {
775  if (InvVars_[i])
776  return TMath::Abs(ReturnCandVar(ele, i))>CutVars_[i];
777  return TMath::Abs(ReturnCandVar(ele, i)) < CutVars_[i];
778  }
779  if (InvVars_[i+nBarrelVars_]) {
780  if (InvVars_[i])
781  return TMath::Abs(ReturnCandVar(ele, i))>CutVars_[i+nBarrelVars_];
782  }
783  return TMath::Abs(ReturnCandVar(ele, i)) < CutVars_[i+nBarrelVars_];
784 }
786 Double_t WenuPlots::ReturnCandVar(const pat::Electron *ele, int i) {
787  if (i==0) return ele->dr03TkSumPt()/ele->p4().Pt();
788  else if (i==1) return ele->dr03EcalRecHitSumEt()/ele->p4().Pt();
789  else if (i==2) return ele->dr03HcalTowerSumEt()/ele->p4().Pt();
790  else if (i==3) return ele->scSigmaIEtaIEta();
791  else if (i==4) return ele->deltaPhiSuperClusterTrackAtVtx();
792  else if (i==5) return ele->deltaEtaSuperClusterTrackAtVtx();
793  else if (i==6) return ele->hadronicOverEm();
794  else if (i==7) {
795  if (ele->isEB()){
796  return ( ele->dr03TkSumPt()+std::max(float(0.),ele->dr03EcalRecHitSumEt()-1)
797  + ele->dr03HcalTowerSumEt())/ele->p4().Pt(); }
798  else { // pedestal subtraction is only in barrel
799  return ( ele->dr03TkSumPt()+ele->dr03EcalRecHitSumEt()
800  + ele->dr03HcalTowerSumEt())/ele->p4().Pt(); }
801  }
802  // else if (i==8) return ele->gsfTrack()->dxy(bspotPosition_);
803  else if (i==8) return fabs(ele->dB());
804  else if (i==9) return ele->eSuperClusterOverP();
805  else if (i==10) return ele->userIsolation(pat::TrackIso);
806  else if (i==11) return ele->userIsolation(pat::EcalIso);
807  else if (i==12) return ele->userIsolation(pat::HcalIso);
808  std::cout << "Error in WenuPlots::ReturnCandVar" << std::endl;
809  return -1.;
810 
811 }
814  Bool_t passConvRej = true;
815  Bool_t passPXB = true;
816  Bool_t passEMH = true;
818  if (ele->hasUserInt("PassConversionRejection")) {
819  //std::cout << "con rej: " << ele->userInt("PassConversionRejection") << std::endl;
820  if (not (ele->userInt("PassConversionRejection")==1)) passConvRej = false;
821  }
822  else {
823  std::cout << "WenuPlots: WARNING: Conversion Rejection Request Disregarded: "
824  << "you must calculate it before " << std::endl;
825  // return true;
826  }
827  }
828  if (useValidFirstPXBHit_) {
829  if (ele->hasUserInt("PassValidFirstPXBHit")) {
830  //std::cout << "valid1stPXB: " << ele->userInt("PassValidFirstPXBHit") << std::endl;
831  if (not (ele->userInt("PassValidFirstPXBHit")==1)) passPXB = false;
832  }
833  else {
834  std::cout << "WenuPlots: WARNING: Valid First PXB Hit Request Disregarded: "
835  << "you must calculate it before " << std::endl;
836  // return true;
837  }
838  }
840  if (ele->hasUserInt("NumberOfExpectedMissingHits")) {
841  //std::cout << "missing hits: " << ele->userInt("NumberOfExpectedMissingHits") << std::endl;
842  if (ele->userInt("NumberOfExpectedMissingHits")>maxNumberOfExpectedMissingHits_)
843  passEMH = false;
844  }
845  else {
846  std::cout << "WenuPlots: WARNING: Number of Expected Missing Hits Request Disregarded: "
847  << "you must calculate it before " << std::endl;
848  // return true;
849  }
850  }
851  return passConvRej && passPXB && passEMH;
852 }
853 // ------------ method called once each job just before starting event loop --
854 void
856 {
857  //std::cout << "In beginJob()" << std::endl;
858  // Double_t Pi = TMath::Pi();
859  // TString histo_file = outputFile_;
860  // histofile = new TFile( histo_file,"RECREATE");
861 
862  h_met = new TH1F("h_met", "h_met", 200, 0, 200);
863  h_met_inverse = new TH1F("h_met_inverse", "h_met_inverse", 200, 0, 200);
864 
865  h_mt = new TH1F("h_mt", "h_mt", 200, 0, 200);
866  h_mt_inverse = new TH1F("h_mt_inverse", "h_mt_inverse", 200, 0, 200);
867 
868 
869  h_met_EB = new TH1F("h_met_EB", "h_met_EB", 200, 0, 200);
870  h_met_inverse_EB = new TH1F("h_met_inverse_EB", "h_met_inverse_EB", 200, 0, 200);
871 
872  h_mt_EB = new TH1F("h_mt_EB", "h_mt_EB", 200, 0, 200);
873  h_mt_inverse_EB = new TH1F("h_mt_inverse_EB", "h_mt_inverse_EB", 200, 0, 200);
874 
875 
876  h_met_EE = new TH1F("h_met_EE", "h_met_EE", 200, 0, 200);
877  h_met_inverse_EE = new TH1F("h_met_inverse_EE", "h_met_inverse_EE", 200, 0, 200);
878 
879  h_mt_EE = new TH1F("h_mt_EE", "h_mt_EE", 200, 0, 200);
880  h_mt_inverse_EE = new TH1F("h_mt_inverse_EE", "h_mt_inverse_EE", 200, 0, 200);
881 
882 
883  h_scEt = new TH1F("h_scEt", "h_scEt", 200, 0, 100);
884  h_scEta = new TH1F("h_scEta", "h_scEta", 200, -3, 3);
885  h_scPhi = new TH1F("h_scPhi", "h_scPhi", 200, -4, 4);
886 
887 
888  //VALIDATION PLOTS
889  //EB
890  h_EB_trkiso = new TH1F("h_EB_trkiso","h_EB_trkiso",200 , 0.0, 9.0);
891  h_EB_ecaliso = new TH1F("h_EB_ecaliso","h_EB_ecaliso",200, 0.0 , 9.0);
892  h_EB_hcaliso = new TH1F("h_EB_hcaliso","h_EB_hcaliso",200, 0.0 , 9.0);
893  h_EB_sIetaIeta = new TH1F("h_EB_sIetaIeta","h_EB_sIetaIeta",200, 0.0 , 0.02 );
894  h_EB_dphi = new TH1F("h_EB_dphi","h_EB_dphi",200, -0.03 , 0.03 );
895  h_EB_deta = new TH1F("h_EB_deta","h_EB_deta",200, -0.01 , 0.01) ;
896  h_EB_HoE = new TH1F("h_EB_HoE","h_EB_HoE",200, 0.0 , 0.2 );
897  //EE
898  h_EE_trkiso = new TH1F("h_EE_trkiso","h_EE_trkiso",200 , 0.0, 9.0);
899  h_EE_ecaliso = new TH1F("h_EE_ecaliso","h_EE_ecaliso",200, 0.0 , 9.0);
900  h_EE_hcaliso = new TH1F("h_EE_hcaliso","h_EE_hcaliso",200, 0.0 , 9.0);
901  h_EE_sIetaIeta = new TH1F("h_EE_sIetaIeta","h_EE_sIetaIeta",200, 0.0 , 0.1 );
902  h_EE_dphi = new TH1F("h_EE_dphi","h_EE_dphi",200, -0.03 , 0.03 );
903  h_EE_deta = new TH1F("h_EE_deta","h_EE_deta",200, -0.01 , 0.01) ;
904  h_EE_HoE = new TH1F("h_EE_HoE","h_EE_HoE",200, 0.0 , 0.2 );
905 
906 
907  //
908  //
910  new TH1F("h_trackIso_eb_NmOne","trackIso EB N-1 plot",80,0,8);
912  new TH1F("h_trackIso_ee_NmOne","trackIso EE N-1 plot",80,0,8);
913 
914 
915  // if you add some new variable change the nBarrelVars_ accordingly
916  // reminder: in the current implementation you must have the same number
917  // of vars in both barrel and endcaps
918  nBarrelVars_ = 13;
919  //
920  // Put EB variables together and EE variables together
921  // number of barrel variables = number of endcap variable
922  // if you don't want to use some variable put a very high cut
923  CutVars_.push_back( trackIso_EB_ );//0
924  CutVars_.push_back( ecalIso_EB_ ); //1
925  CutVars_.push_back( hcalIso_EB_ ); //2
926  CutVars_.push_back( sihih_EB_ ); //3
927  CutVars_.push_back( dphi_EB_ ); //4
928  CutVars_.push_back( deta_EB_ ); //5
929  CutVars_.push_back( hoe_EB_ ); //6
930  CutVars_.push_back( cIso_EB_ ); //7
931  CutVars_.push_back( tip_bspot_EB_);//8
932  CutVars_.push_back( eop_EB_ ); //9
933  CutVars_.push_back( trackIsoUser_EB_ );//10
934  CutVars_.push_back( ecalIsoUser_EB_ );//11
935  CutVars_.push_back( hcalIsoUser_EB_ );//12
936  //
937  CutVars_.push_back( trackIso_EE_);//0
938  CutVars_.push_back( ecalIso_EE_); //1
939  CutVars_.push_back( hcalIso_EE_); //2
940  CutVars_.push_back( sihih_EE_); //3
941  CutVars_.push_back( dphi_EE_); //4
942  CutVars_.push_back( deta_EE_); //5
943  CutVars_.push_back( hoe_EE_ ); //6
944  CutVars_.push_back( cIso_EE_ ); //7
945  CutVars_.push_back(tip_bspot_EE_);//8
946  CutVars_.push_back( eop_EE_ ); //9
947  CutVars_.push_back( trackIsoUser_EE_ );//10
948  CutVars_.push_back( ecalIsoUser_EE_ );//11
949  CutVars_.push_back( hcalIsoUser_EE_ );//12
950  //
951  InvVars_.push_back( trackIso_EB_inv);//0
952  InvVars_.push_back( ecalIso_EB_inv); //1
953  InvVars_.push_back( hcalIso_EB_inv); //2
954  InvVars_.push_back( sihih_EB_inv); //3
955  InvVars_.push_back( dphi_EB_inv); //4
956  InvVars_.push_back( deta_EB_inv); //5
957  InvVars_.push_back( hoe_EB_inv); //6
958  InvVars_.push_back( cIso_EB_inv); //7
959  InvVars_.push_back(tip_bspot_EB_inv);//8
960  InvVars_.push_back( eop_EB_inv); //9
961  InvVars_.push_back( trackIsoUser_EB_inv );//10
962  InvVars_.push_back( ecalIsoUser_EB_inv );//11
963  InvVars_.push_back( hcalIsoUser_EB_inv );//12
964  //
965  InvVars_.push_back( trackIso_EE_inv);//0
966  InvVars_.push_back( ecalIso_EE_inv); //1
967  InvVars_.push_back( hcalIso_EE_inv); //2
968  InvVars_.push_back( sihih_EE_inv); //3
969  InvVars_.push_back( dphi_EE_inv); //4
970  InvVars_.push_back( deta_EE_inv); //5
971  InvVars_.push_back( hoe_EE_inv); //6
972  InvVars_.push_back( cIso_EE_inv); //7
973  InvVars_.push_back(tip_bspot_EE_inv);//8
974  InvVars_.push_back( eop_EE_inv); //9
975  InvVars_.push_back( trackIsoUser_EE_inv );//10
976  InvVars_.push_back( ecalIsoUser_EE_inv );//11
977  InvVars_.push_back( hcalIsoUser_EE_inv );//12
978  //
979  //
980  // ________________________________________________________________________
981  //
982  // The VBTF Root Tuples ---------------------------------------------------
983  // ________________________________________________________________________
984  //
986  "RECREATE");
987 
988  vbtfSele_tree = new TTree("vbtfSele_tree",
989  "Tree to store the W Candidates that pass the VBTF selection");
990  vbtfSele_tree->Branch("runNumber", &runNumber, "runNumber/I");
991  vbtfSele_tree->Branch("eventNumber", &eventNumber, "eventNumber/L");
992  vbtfSele_tree->Branch("lumiSection", &lumiSection, "lumiSection/I");
993  //
994  vbtfSele_tree->Branch("ele_sc_gsf_et", &ele_sc_gsf_et,"ele_sc_gsf_et/F");
995  vbtfSele_tree->Branch("ele_sc_energy", &ele_sc_energy,"ele_sc_energy/F");
996  vbtfSele_tree->Branch("ele_sc_eta", &ele_sc_eta,"ele_sc_eta/F");
997  vbtfSele_tree->Branch("ele_sc_phi", &ele_sc_phi,"ele_sc_phi/F");
998  vbtfSele_tree->Branch("ele_sc_rho", &ele_sc_rho,"ele_sc_rho/F");
999  vbtfSele_tree->Branch("ele_cand_et", &ele_cand_et, "ele_cand_et/F");
1000  vbtfSele_tree->Branch("ele_cand_eta", &ele_cand_eta,"ele_cand_eta/F");
1001  vbtfSele_tree->Branch("ele_cand_phi",&ele_cand_phi,"ele_cand_phi/F");
1002  vbtfSele_tree->Branch("ele_iso_track",&ele_iso_track,"ele_iso_track/F");
1003  vbtfSele_tree->Branch("ele_iso_ecal",&ele_iso_ecal,"ele_iso_ecal/F");
1004  vbtfSele_tree->Branch("ele_iso_hcal",&ele_iso_hcal,"ele_iso_hcal/F");
1005  vbtfSele_tree->Branch("ele_id_sihih",&ele_id_sihih,"ele_id_sihih/F");
1006  vbtfSele_tree->Branch("ele_id_deta",&ele_id_deta,"ele_id_deta/F");
1007  vbtfSele_tree->Branch("ele_id_dphi",&ele_id_dphi,"ele_id_dphi/F");
1008  vbtfSele_tree->Branch("ele_id_hoe",&ele_id_hoe,"ele_id_hoe/F");
1009  vbtfSele_tree->Branch("ele_cr_mhitsinner",&ele_cr_mhitsinner,"ele_cr_mhitsinner/I");
1010  vbtfSele_tree->Branch("ele_cr_dcot",&ele_cr_dcot,"ele_cr_dcot/F");
1011  vbtfSele_tree->Branch("ele_cr_dist",&ele_cr_dist,"ele_cr_dist/F");
1012  vbtfSele_tree->Branch("ele_vx",&ele_vx,"ele_vx/F");
1013  vbtfSele_tree->Branch("ele_vy",&ele_vy,"ele_vy/F");
1014  vbtfSele_tree->Branch("ele_vz",&ele_vz,"ele_vz/F");
1015  vbtfSele_tree->Branch("pv_x",&pv_x,"pv_x/F");
1016  vbtfSele_tree->Branch("pv_y",&pv_y,"pv_y/F");
1017  vbtfSele_tree->Branch("pv_z",&pv_z,"pv_z/F");
1018  vbtfSele_tree->Branch("ele_gsfCharge",&ele_gsfCharge,"ele_gsfCharge/I");
1019  vbtfSele_tree->Branch("ele_ctfCharge",&ele_ctfCharge,"ele_ctfCharge/I");
1020  vbtfSele_tree->Branch("ele_scPixCharge",&ele_scPixCharge,"ele_scPixCharge/I");
1021  vbtfSele_tree->Branch("ele_eop",&ele_eop,"ele_eop/F");
1022  vbtfSele_tree->Branch("ele_tip_bs",&ele_tip_bs,"ele_tip_bs/F");
1023  vbtfSele_tree->Branch("ele_tip_pv",&ele_tip_pv,"ele_tip_pv/F");
1024  vbtfSele_tree->Branch("ele_pin",&ele_pin,"ele_pin/F");
1025  vbtfSele_tree->Branch("ele_pout",&ele_pout,"ele_pout/F");
1026  vbtfSele_tree->Branch("event_caloMET",&event_caloMET,"event_caloMET/F");
1027  vbtfSele_tree->Branch("event_pfMET",&event_pfMET,"event_pfMET/F");
1028  vbtfSele_tree->Branch("event_tcMET",&event_tcMET,"event_tcMET/F");
1029  vbtfSele_tree->Branch("event_caloMT",&event_caloMT,"event_caloMT/F");
1030  vbtfSele_tree->Branch("event_pfMT",&event_pfMT,"event_pfMT/F");
1031  vbtfSele_tree->Branch("event_tcMT",&event_tcMT,"event_tcMT/F");
1032  vbtfSele_tree->Branch("event_caloMET_phi",&event_caloMET_phi,"event_caloMET_phi/F");
1033  vbtfSele_tree->Branch("event_pfMET_phi",&event_pfMET_phi,"event_pfMET_phi/F");
1034  vbtfSele_tree->Branch("event_tcMET_phi",&event_tcMET_phi,"event_tcMET_phi/F");
1035  //
1036  // the extra jet variables:
1038  vbtfSele_tree->Branch("calojet_et",calojet_et,"calojet_et[5]/F");
1039  vbtfSele_tree->Branch("calojet_eta",calojet_eta,"calojet_eta[5]/F");
1040  vbtfSele_tree->Branch("calojet_phi",calojet_phi,"calojet_phi[5]/F");
1041  vbtfSele_tree->Branch("pfjet_et",pfjet_et,"pfjet_et[5]/F");
1042  vbtfSele_tree->Branch("pfjet_eta",pfjet_eta,"pfjet_eta[5]/F");
1043  vbtfSele_tree->Branch("pfjet_phi",pfjet_phi,"pfjet_phi[5]/F");
1044  }
1045  if (storeExtraInformation_) {
1046  vbtfSele_tree->Branch("ele2nd_sc_gsf_et", &ele2nd_sc_gsf_et,"ele2nd_sc_gsf_et/F");
1047  vbtfSele_tree->Branch("ele2nd_passes_selection", &ele2nd_passes_selection,"ele2nd_passes_selection/I");
1048  vbtfSele_tree->Branch("ele2nd_ecalDriven",&ele2nd_ecalDriven,"ele2nd_ecalDriven/I");
1049  vbtfSele_tree->Branch("event_caloSumEt",&event_caloSumEt,"event_caloSumEt/F");
1050  vbtfSele_tree->Branch("event_pfSumEt",&event_pfSumEt,"event_pfSumEt/F");
1051  vbtfSele_tree->Branch("event_tcSumEt",&event_tcSumEt,"event_tcSumEt/F");
1052  }
1053  vbtfSele_tree->Branch("event_datasetTag",&event_datasetTag,"event_dataSetTag/I");
1054  //
1055  //
1056  // everything after preselection
1057  //
1058  WENU_VBTFpreseleFile_ = new TFile(TString(WENU_VBTFpreseleFileName_),
1059  "RECREATE");
1060 
1061  vbtfPresele_tree = new TTree("vbtfPresele_tree",
1062  "Tree to store the W Candidates that pass the VBTF preselection");
1063  vbtfPresele_tree->Branch("runNumber", &runNumber, "runNumber/I");
1064  vbtfPresele_tree->Branch("eventNumber", &eventNumber, "eventNumber/L");
1065  vbtfPresele_tree->Branch("lumiSection", &lumiSection, "lumiSection/I");
1066  //
1067  vbtfPresele_tree->Branch("ele_sc_gsf_et", &ele_sc_gsf_et,"ele_sc_gsf_et/F");
1068  vbtfPresele_tree->Branch("ele_sc_energy", &ele_sc_energy,"ele_sc_energy/F");
1069  vbtfPresele_tree->Branch("ele_sc_eta", &ele_sc_eta,"ele_sc_eta/F");
1070  vbtfPresele_tree->Branch("ele_sc_phi", &ele_sc_phi,"ele_sc_phi/F");
1071  vbtfPresele_tree->Branch("ele_sc_rho", &ele_sc_rho,"ele_sc_rho/F");
1072  vbtfPresele_tree->Branch("ele_cand_et", &ele_cand_et, "ele_cand_et/F");
1073  vbtfPresele_tree->Branch("ele_cand_eta", &ele_cand_eta,"ele_cand_eta/F");
1074  vbtfPresele_tree->Branch("ele_cand_phi",&ele_cand_phi,"ele_cand_phi/F");
1075  vbtfPresele_tree->Branch("ele_iso_track",&ele_iso_track,"ele_iso_track/F");
1076  vbtfPresele_tree->Branch("ele_iso_ecal",&ele_iso_ecal,"ele_iso_ecal/F");
1077  vbtfPresele_tree->Branch("ele_iso_hcal",&ele_iso_hcal,"ele_iso_hcal/F");
1078  vbtfPresele_tree->Branch("ele_id_sihih",&ele_id_sihih,"ele_id_sihih/F");
1079  vbtfPresele_tree->Branch("ele_id_deta",&ele_id_deta,"ele_id_deta/F");
1080  vbtfPresele_tree->Branch("ele_id_dphi",&ele_id_dphi,"ele_id_dphi/F");
1081  vbtfPresele_tree->Branch("ele_id_hoe",&ele_id_hoe,"ele_id_hoe/F");
1082  vbtfPresele_tree->Branch("ele_cr_mhitsinner",&ele_cr_mhitsinner,"ele_cr_mhitsinner/I");
1083  vbtfPresele_tree->Branch("ele_cr_dcot",&ele_cr_dcot,"ele_cr_dcot/F");
1084  vbtfPresele_tree->Branch("ele_cr_dist",&ele_cr_dist,"ele_cr_dist/F");
1085  vbtfPresele_tree->Branch("ele_vx",&ele_vx,"ele_vx/F");
1086  vbtfPresele_tree->Branch("ele_vy",&ele_vy,"ele_vy/F");
1087  vbtfPresele_tree->Branch("ele_vz",&ele_vz,"ele_vz/F");
1088  vbtfPresele_tree->Branch("pv_x",&pv_x,"pv_x/F");
1089  vbtfPresele_tree->Branch("pv_y",&pv_y,"pv_y/F");
1090  vbtfPresele_tree->Branch("pv_z",&pv_z,"pv_z/F");
1091  vbtfPresele_tree->Branch("ele_gsfCharge",&ele_gsfCharge,"ele_gsfCharge/I");
1092  vbtfPresele_tree->Branch("ele_ctfCharge",&ele_ctfCharge,"ele_ctfCharge/I");
1093  vbtfPresele_tree->Branch("ele_scPixCharge",&ele_scPixCharge,"ele_scPixCharge/I");
1094  vbtfPresele_tree->Branch("ele_eop",&ele_eop,"ele_eop/F");
1095  vbtfPresele_tree->Branch("ele_tip_bs",&ele_tip_bs,"ele_tip_bs/F");
1096  vbtfPresele_tree->Branch("ele_tip_pv",&ele_tip_pv,"ele_tip_pv/F");
1097  vbtfPresele_tree->Branch("ele_pin",&ele_pin,"ele_pin/F");
1098  vbtfPresele_tree->Branch("ele_pout",&ele_pout,"ele_pout/F");
1099  vbtfPresele_tree->Branch("event_caloMET",&event_caloMET,"event_caloMET/F");
1100  vbtfPresele_tree->Branch("event_pfMET",&event_pfMET,"event_pfMET/F");
1101  vbtfPresele_tree->Branch("event_tcMET",&event_tcMET,"event_tcMET/F");
1102  vbtfPresele_tree->Branch("event_caloMT",&event_caloMT,"event_caloMT/F");
1103  vbtfPresele_tree->Branch("event_pfMT",&event_pfMT,"event_pfMT/F");
1104  vbtfPresele_tree->Branch("event_tcMT",&event_tcMT,"event_tcMT/F");
1105  vbtfPresele_tree->Branch("event_caloMET_phi",&event_caloMET_phi,"event_caloMET_phi/F");
1106  vbtfPresele_tree->Branch("event_pfMET_phi",&event_pfMET_phi,"event_pfMET_phi/F");
1107  vbtfPresele_tree->Branch("event_tcMET_phi",&event_tcMET_phi,"event_tcMET_phi/F");
1108  vbtfPresele_tree->Branch("event_caloSumEt",&event_caloSumEt,"event_caloSumEt/F");
1109  vbtfPresele_tree->Branch("event_pfSumEt",&event_pfSumEt,"event_pfSumEt/F");
1110  vbtfPresele_tree->Branch("event_tcSumEt",&event_tcSumEt,"event_tcSumEt/F");
1111  // the extra jet variables:
1113  vbtfPresele_tree->Branch("calojet_et",calojet_et,"calojet_et[5]/F");
1114  vbtfPresele_tree->Branch("calojet_eta",calojet_eta,"calojet_eta[5]/F");
1115  vbtfPresele_tree->Branch("calojet_phi",calojet_phi,"calojet_phi[5]/F");
1116  vbtfPresele_tree->Branch("pfjet_et",pfjet_et,"pfjet_et[5]/F");
1117  vbtfPresele_tree->Branch("pfjet_eta",pfjet_eta,"pfjet_eta[5]/F");
1118  vbtfPresele_tree->Branch("pfjet_phi",pfjet_phi,"pfjet_phi[5]/F");
1119  }
1120  if (storeExtraInformation_) {
1121  vbtfPresele_tree->Branch("ele2nd_sc_gsf_et",&ele2nd_sc_gsf_et,"ele2nd_sc_gsf_et/F");
1122  vbtfPresele_tree->Branch("ele2nd_sc_eta",&ele2nd_sc_eta,"ele2nd_sc_eta/F");
1123  vbtfPresele_tree->Branch("ele2nd_sc_phi",&ele2nd_sc_phi,"ele2nd_sc_phi/F");
1124  vbtfPresele_tree->Branch("ele2nd_sc_rho",&ele2nd_sc_rho,"ele2nd_sc_rho/F");
1125  vbtfPresele_tree->Branch("ele2nd_cand_eta",&ele2nd_cand_eta,"ele2nd_cand_eta/F");
1126  vbtfPresele_tree->Branch("ele2nd_cand_phi",&ele2nd_cand_phi,"ele2nd_cand_phi/F");
1127  vbtfPresele_tree->Branch("ele2nd_pin",&ele2nd_pin,"ele2nd_pin/F");
1128  vbtfPresele_tree->Branch("ele2nd_pout",&ele2nd_pout,"ele2nd_pout/F");
1129  vbtfPresele_tree->Branch("ele2nd_ecalDriven",&ele2nd_ecalDriven,"ele2nd_ecalDriven/I");
1130  vbtfPresele_tree->Branch("ele2nd_passes_selection",&ele2nd_passes_selection,"ele2nd_passes_selection/I");
1131  vbtfPresele_tree->Branch("ele_hltmatched_dr",&ele_hltmatched_dr,"ele_hltmatched_dr/F");
1132  vbtfPresele_tree->Branch("event_triggerDecision",&event_triggerDecision,"event_triggerDecision/I");
1133  vbtfPresele_tree->Branch("VtxTracksSize",&VtxTracksSize);
1134  vbtfPresele_tree->Branch("VtxNormalizedChi2",&VtxNormalizedChi2);
1135  vbtfPresele_tree->Branch("VtxTracksSizeBS",&VtxTracksSizeBS);
1136  vbtfPresele_tree->Branch("VtxNormalizedChi2BS",&VtxNormalizedChi2BS);
1137  }
1139  vbtfPresele_tree->Branch("ele2nd_cand_et",&ele2nd_cand_et,"ele2nd_cand_et/F");
1140  vbtfPresele_tree->Branch("ele2nd_iso_track",&ele2nd_iso_track ,"ele2nd_iso_track /F");
1141  vbtfPresele_tree->Branch("ele2nd_iso_ecal",&ele2nd_iso_ecal,"ele2nd_iso_ecal/F");
1142  vbtfPresele_tree->Branch("ele2nd_iso_hcal",&ele2nd_iso_hcal,"ele2nd_iso_hcal/F");
1143  vbtfPresele_tree->Branch("ele2nd_id_sihih",&ele2nd_id_sihih,"ele2nd_id_sihih/F");
1144  vbtfPresele_tree->Branch("ele2nd_id_deta",&ele2nd_id_deta,"ele2nd_id_deta/F");
1145  vbtfPresele_tree->Branch("ele2nd_id_dphi",&ele2nd_id_dphi,"ele2nd_id_dphi/F");
1146  vbtfPresele_tree->Branch("ele2nd_id_hoe",&ele2nd_id_hoe,"ele2nd_id_hoe/F");
1147  vbtfPresele_tree->Branch("ele2nd_cr_mhitsinner",&ele2nd_cr_mhitsinner,"ele2nd_cr_mhitsinner/I");
1148  vbtfPresele_tree->Branch("ele2nd_cr_dcot",&ele2nd_cr_dcot,"ele2nd_cr_dcot/F");
1149  vbtfPresele_tree->Branch("ele2nd_cr_dist",&ele2nd_cr_dist ,"ele2nd_cr_dist/F");
1150  vbtfPresele_tree->Branch("ele2nd_vx",&ele2nd_vx,"ele2nd_vx/F");
1151  vbtfPresele_tree->Branch("ele2nd_vy",&ele2nd_vy,"ele2nd_vy/F");
1152  vbtfPresele_tree->Branch("ele2nd_vz",&ele2nd_vz,"ele2nd_vz/F");
1153 
1154  vbtfPresele_tree->Branch("ele2nd_gsfCharge",&ele2nd_gsfCharge,"ele2nd_gsfCharge/I");
1155  vbtfPresele_tree->Branch("ele2nd_ctfCharge",&ele2nd_ctfCharge,"ele2nd_ctfCharge/I");
1156  vbtfPresele_tree->Branch("ele2nd_scPixCharge",&ele2nd_scPixCharge,"ele2nd_scPixCharge/I");
1157  vbtfPresele_tree->Branch("ele2nd_eop",&ele2nd_eop,"ele2nd_eop/F");
1158  vbtfPresele_tree->Branch("ele2nd_tip_bs",&ele2nd_tip_bs,"ele2nd_tip_bs/F");
1159  vbtfPresele_tree->Branch("ele2nd_tip_pv",&ele2nd_tip_pv,"ele2nd_tip_pv/F");
1160  vbtfPresele_tree->Branch("ele2nd_hltmatched_dr",&ele2nd_hltmatched_dr,"ele2nd_hltmatched_dr/F");
1161  }
1162  vbtfPresele_tree->Branch("event_datasetTag",&event_datasetTag,"event_dataSetTag/I");
1163 
1164  //
1165  // _________________________________________________________________________
1166  //
1167  //
1168  //
1169 
1170 
1171 }
1172 
1173 // ------------ method called once each job just after ending the event loop -
1174 void
1176  TFile * newfile = new TFile(TString(outputFile_),"RECREATE");
1177  //
1178  // for consistency all the plots are in the root file
1179  // even though they may be empty (in the case when
1180  // usePrecalcID_== true inverted and N-1 are empty)
1181  h_met->Write();
1182  h_met_inverse->Write();
1183  h_mt->Write();
1184  h_mt_inverse->Write();
1185 
1186  h_met_EB->Write();
1187  h_met_inverse_EB->Write();
1188  h_mt_EB->Write();
1189  h_mt_inverse_EB->Write();
1190 
1191  h_met_EE->Write();
1192  h_met_inverse_EE->Write();
1193  h_mt_EE->Write();
1194  h_mt_inverse_EE->Write();
1195 
1196  h_scEt->Write();
1197  h_scEta->Write();
1198  h_scPhi->Write();
1199 
1200  h_EB_trkiso->Write();
1201  h_EB_ecaliso->Write();
1202  h_EB_hcaliso->Write();
1203  h_EB_sIetaIeta->Write();
1204  h_EB_dphi->Write();
1205  h_EB_deta->Write();
1206  h_EB_HoE->Write();
1207 
1208  h_EE_trkiso->Write();
1209  h_EE_ecaliso->Write();
1210  h_EE_hcaliso->Write();
1211  h_EE_sIetaIeta->Write();
1212  h_EE_dphi->Write();
1213  h_EE_deta->Write();
1214  h_EE_HoE->Write();
1215 
1216  //
1217  h_trackIso_eb_NmOne->Write();
1218  h_trackIso_ee_NmOne->Write();
1219  //
1220  newfile->Close();
1221  //
1222  // write the VBTF trees
1223  //
1224  WENU_VBTFpreseleFile_->Write();
1225  WENU_VBTFpreseleFile_->Close();
1226  WENU_VBTFselectionFile_->Write();
1227  WENU_VBTFselectionFile_->Close();
1228 
1229 }
1230 
1231 
1232 //define this as a plug-in
Float_t ele_vy
Definition: WenuPlots.h:203
TH1F * h_mt_inverse_EE
Definition: WenuPlots.h:95
Analysis-level particle class.
Analysis-level MET class.
Definition: MET.h:43
Float_t ele2nd_cr_dcot
Definition: WenuPlots.h:247
Double_t trackIsoUser_EB_
Definition: WenuPlots.h:148
T getUntrackedParameter(std::string const &, T const &) const
Int_t ele2nd_ctfCharge
Definition: WenuPlots.h:249
Float_t ele2nd_id_deta
Definition: WenuPlots.h:246
Float_t ele2nd_sc_gsf_et
Definition: WenuPlots.h:218
bool isElectronIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Electron.
Int_t maxNumberOfExpectedMissingHits_
Definition: WenuPlots.h:66
Double_t cIso_EE_
Definition: WenuPlots.h:144
Double_t trackIso_EB_
Definition: WenuPlots.h:124
Bool_t PassPreselectionCriteria(const pat::Electron *ele)
Definition: WenuPlots.cc:813
Float_t ele_iso_ecal
Definition: WenuPlots.h:199
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:92
std::string WENU_VBTFselectionFileName_
Definition: WenuPlots.h:236
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
double eta() const final
momentum pseudorapidity
TH1F * h_met_inverse_EB
Definition: WenuPlots.h:88
void endJob() override
Definition: WenuPlots.cc:1175
Bool_t hcalIso_EE_inv
Definition: WenuPlots.h:161
edm::EDGetTokenT< std::vector< reco::Vertex > > PrimaryVerticesCollectionBSToken_
Definition: WenuPlots.h:75
Bool_t deta_EE_inv
Definition: WenuPlots.h:172
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
Float_t event_caloMET
Definition: WenuPlots.h:208
Float_t ele_iso_hcal
Definition: WenuPlots.h:199
Float_t ele2nd_tip_bs
Definition: WenuPlots.h:250
Float_t ele2nd_id_hoe
Definition: WenuPlots.h:246
Double_t eop_EE_
Definition: WenuPlots.h:146
Float_t ele_eop
Definition: WenuPlots.h:207
Bool_t ecalIso_EB_inv
Definition: WenuPlots.h:156
TH1F * h_EE_trkiso
Definition: WenuPlots.h:110
Double_t trackIsoUser_EE_
Definition: WenuPlots.h:151
Int_t nBarrelVars_
Definition: WenuPlots.h:187
double vy() const override
y coordinate of vertex position
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Float_t pfjet_eta[5]
Definition: WenuPlots.h:216
Float_t ele2nd_eop
Definition: WenuPlots.h:250
TH1F * h_EB_HoE
Definition: WenuPlots.h:108
TH1F * h_met_EB
Definition: WenuPlots.h:87
Float_t pvbs_z
Definition: WenuPlots.h:256
Int_t lumiSection
Definition: WenuPlots.h:194
Float_t event_tcMET_phi
Definition: WenuPlots.h:210
Int_t ele2nd_passes_selection
Definition: WenuPlots.h:226
TH1F * h_mt
Definition: WenuPlots.h:84
Float_t ele_vz
Definition: WenuPlots.h:203
Double_t cIso_EB_
Definition: WenuPlots.h:136
Float_t ele_pout
Definition: WenuPlots.h:204
Float_t ele_sc_rho
Definition: WenuPlots.h:196
Int_t ele2nd_scPixCharge
Definition: WenuPlots.h:249
Bool_t tip_bspot_EE_inv
Definition: WenuPlots.h:176
Float_t event_caloMET_phi
Definition: WenuPlots.h:210
Float_t ele_id_dphi
Definition: WenuPlots.h:200
TH1F * h_trackIso_ee_NmOne
Definition: WenuPlots.h:120
Bool_t tip_bspot_EB_inv
Definition: WenuPlots.h:168
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:295
Float_t ele_cr_dist
Definition: WenuPlots.h:201
edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollectionToken_
Definition: WenuPlots.h:71
std::string WENU_VBTFpreseleFileName_
Definition: WenuPlots.h:237
WenuPlots(const edm::ParameterSet &)
Definition: WenuPlots.cc:56
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:334
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
Bool_t CheckCutInv(const pat::Electron *wenu, Int_t i)
Definition: WenuPlots.cc:772
TH1F * h_scPhi
Definition: WenuPlots.h:100
Int_t ele2nd_ecalDriven
Definition: WenuPlots.h:227
Double_t ecalIsoUser_EB_
Definition: WenuPlots.h:149
Int_t ele_gsfCharge
Definition: WenuPlots.h:206
Float_t calojet_eta[5]
Definition: WenuPlots.h:213
Bool_t includeJetInformationInNtuples_
Definition: WenuPlots.h:238
Int_t runNumber
Definition: WenuPlots.h:194
Double_t dphi_EE_
Definition: WenuPlots.h:142
Bool_t sihih_EE_inv
Definition: WenuPlots.h:171
TTree * vbtfSele_tree
Definition: WenuPlots.h:234
TH1F * h_EB_trkiso
Definition: WenuPlots.h:102
Float_t ele2nd_pout
Definition: WenuPlots.h:225
Bool_t dphi_EE_inv
Definition: WenuPlots.h:173
Bool_t hcalIsoUser_EE_inv
Definition: WenuPlots.h:184
Float_t pv_x
Definition: WenuPlots.h:205
edm::EDGetTokenT< std::vector< reco::Vertex > > PrimaryVerticesCollectionToken_
Definition: WenuPlots.h:74
Bool_t usePreselection_
Definition: WenuPlots.h:67
Float_t ele2nd_vy
Definition: WenuPlots.h:248
Float_t event_caloSumEt
Definition: WenuPlots.h:209
Double_t tip_bspot_EB_
Definition: WenuPlots.h:137
Float_t ele2nd_sc_eta
Definition: WenuPlots.h:219
Bool_t CheckCutsInverse(const pat::Electron *ele)
Definition: WenuPlots.cc:746
Float_t ele2nd_sc_phi
Definition: WenuPlots.h:220
Bool_t ecalIso_EE_inv
Definition: WenuPlots.h:160
float convDist() const
Definition: GsfElectron.h:618
Bool_t CheckCuts(const pat::Electron *ele)
Definition: WenuPlots.cc:717
std::vector< Double_t > CutVars_
Definition: WenuPlots.h:189
Float_t ele_sc_eta
Definition: WenuPlots.h:196
Double_t deta_EE_
Definition: WenuPlots.h:141
TH1F * h_EE_sIetaIeta
Definition: WenuPlots.h:113
Float_t ele2nd_vx
Definition: WenuPlots.h:248
Float_t ele2nd_id_sihih
Definition: WenuPlots.h:246
Float_t event_pfMET
Definition: WenuPlots.h:208
bool isEB() const
Definition: GsfElectron.h:356
Bool_t useExpectedMissingHits_
Definition: WenuPlots.h:65
float userFloat(const std::string &key) const
Definition: PATObject.h:791
TH1F * h_EB_sIetaIeta
Definition: WenuPlots.h:105
Int_t DatasetTag_
Definition: WenuPlots.h:241
Float_t ele2nd_cand_phi
Definition: WenuPlots.h:223
Double_t hcalIso_EB_
Definition: WenuPlots.h:126
std::string usePrecalcIDSign_
Definition: WenuPlots.h:59
Float_t pv_y
Definition: WenuPlots.h:205
Float_t ele_sc_phi
Definition: WenuPlots.h:196
Double_t trackIso_EE_
Definition: WenuPlots.h:128
float convDcot() const
Definition: GsfElectron.h:619
TH1F * h_met_EE
Definition: WenuPlots.h:92
Double_t deta_EB_
Definition: WenuPlots.h:133
TH1F * h_met
Definition: WenuPlots.h:82
edm::EDGetTokenT< reco::PFJetCollection > pfJetCollectionToken_
Definition: WenuPlots.h:73
TH1F * h_EB_ecaliso
Definition: WenuPlots.h:103
bool hasUserInt(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:351
Float_t ele_id_deta
Definition: WenuPlots.h:200
TH1F * h_scEt
Definition: WenuPlots.h:98
Double_t hcalIsoUser_EB_
Definition: WenuPlots.h:150
Double_t hcalIso_EE_
Definition: WenuPlots.h:130
Float_t ele2nd_cand_et
Definition: WenuPlots.h:244
Float_t ele_cand_et
Definition: WenuPlots.h:198
Bool_t deta_EB_inv
Definition: WenuPlots.h:164
TFile * WENU_VBTFselectionFile_
Definition: WenuPlots.h:233
Bool_t hcalIsoUser_EB_inv
Definition: WenuPlots.h:181
Double_t sihih_EE_
Definition: WenuPlots.h:140
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:253
int iEvent
Definition: GenABIO.cc:224
double sumEt() const
Definition: MET.h:56
TH1F * h_EE_ecaliso
Definition: WenuPlots.h:111
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TH1F * h_EB_hcaliso
Definition: WenuPlots.h:104
float sigmaIetaIeta() const
Definition: GsfElectron.h:440
Float_t ele2nd_pin
Definition: WenuPlots.h:224
float hadronicOverEm() const
Definition: GsfElectron.h:495
TH1F * h_met_inverse
Definition: WenuPlots.h:83
Float_t ele2nd_tip_pvbs
Definition: WenuPlots.h:257
Bool_t ecalIsoUser_EE_inv
Definition: WenuPlots.h:183
Int_t event_triggerDecision
Definition: WenuPlots.h:229
Float_t ele2nd_hltmatched_dr
Definition: WenuPlots.h:251
Bool_t eop_EE_inv
Definition: WenuPlots.h:177
Float_t pvbs_x
Definition: WenuPlots.h:256
double et() const final
transverse energy
T sqrt(T t)
Definition: SSEVec.h:18
Float_t ele2nd_sc_rho
Definition: WenuPlots.h:221
Double_t ecalIso_EB_
Definition: WenuPlots.h:125
Float_t ele2nd_cand_eta
Definition: WenuPlots.h:222
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:297
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
Float_t ele_hltmatched_dr
Definition: WenuPlots.h:228
Float_t ele_vx
Definition: WenuPlots.h:203
Double_t eop_EB_
Definition: WenuPlots.h:138
TH1F * h_met_inverse_EE
Definition: WenuPlots.h:93
TH1F * h_mt_inverse
Definition: WenuPlots.h:85
Double_t usePrecalcIDValue_
Definition: WenuPlots.h:61
TH1F * h_EE_dphi
Definition: WenuPlots.h:114
Double_t hcalIsoUser_EE_
Definition: WenuPlots.h:153
Bool_t trackIso_EE_inv
Definition: WenuPlots.h:159
T Abs(T a)
Definition: MathUtil.h:49
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
Float_t ele_tip_pvbs
Definition: WenuPlots.h:257
RunNumber_t run() const
Definition: Event.h:101
float dr03TkSumPt() const
Definition: GsfElectron.h:552
edm::InputTag caloJetCollectionTag_
Definition: WenuPlots.h:70
Float_t ele_id_hoe
Definition: WenuPlots.h:200
Int_t ele_scPixCharge
Definition: WenuPlots.h:206
std::vector< Int_t > VtxTracksSizeBS
Definition: WenuPlots.h:254
Bool_t eop_EB_inv
Definition: WenuPlots.h:169
Bool_t storeAllSecondElectronVariables_
Definition: WenuPlots.h:243
Bool_t useConversionRejection_
Definition: WenuPlots.h:64
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: WenuPlots.cc:199
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Float_t calojet_phi[5]
Definition: WenuPlots.h:214
std::vector< Int_t > VtxTracksSize
Definition: WenuPlots.h:252
Double_t ReturnCandVar(const pat::Electron *ele, Int_t i)
Definition: WenuPlots.cc:786
TH1F * h_EB_deta
Definition: WenuPlots.h:107
Float_t ele_tip_pv
Definition: WenuPlots.h:207
TFile * WENU_VBTFpreseleFile_
Definition: WenuPlots.h:232
bool isValid() const
Definition: HandleBase.h:74
float scSigmaIEtaIEta() const
Definition: GsfElectron.h:491
TH1F * h_scEta
Definition: WenuPlots.h:99
Float_t ele2nd_iso_hcal
Definition: WenuPlots.h:245
Float_t pfjet_phi[5]
Definition: WenuPlots.h:217
Float_t ele_iso_track
Definition: WenuPlots.h:199
Int_t ele2nd_gsfCharge
Definition: WenuPlots.h:249
TTree * vbtfPresele_tree
Definition: WenuPlots.h:235
Int_t event_datasetTag
Definition: WenuPlots.h:230
Float_t ele_pin
Definition: WenuPlots.h:204
TH1F * h_EB_dphi
Definition: WenuPlots.h:106
double vz() const override
z coordinate of vertex position
myMet
store a preIso track event.preIsoTrack.append(track)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
edm::EDGetTokenT< pat::CompositeCandidateCollection > wenuCollectionToken_
Definition: WenuPlots.h:69
Float_t event_tcSumEt
Definition: WenuPlots.h:209
Int_t ele_cr_mhitsinner
Definition: WenuPlots.h:202
TH1F * h_trackIso_eb_NmOne
Definition: WenuPlots.h:119
Float_t pv_z
Definition: WenuPlots.h:205
Bool_t sihih_EB_inv
Definition: WenuPlots.h:163
const ChargeInfo & chargeInfo() const
Definition: GsfElectron.h:158
Float_t ele2nd_iso_track
Definition: WenuPlots.h:245
Bool_t CheckCutsNminusOne(const pat::Electron *ele, Int_t jj)
Definition: WenuPlots.cc:755
float userIsolation(IsolationKeys key) const
Definition: Lepton.h:50
std::vector< CompositeCandidate > CompositeCandidateCollection
T const * product() const
Definition: Handle.h:74
Float_t ele_cand_eta
Definition: WenuPlots.h:198
Bool_t cIso_EB_inv
Definition: WenuPlots.h:167
met
===> hadronic RAZOR
Bool_t trackIsoUser_EE_inv
Definition: WenuPlots.h:182
Float_t pfjet_et[5]
Definition: WenuPlots.h:215
Bool_t hcalIso_EB_inv
Definition: WenuPlots.h:157
int32_t userInt(const std::string &key) const
Definition: PATObject.h:833
Bool_t storeExtraInformation_
Definition: WenuPlots.h:239
~WenuPlots() override
Definition: WenuPlots.cc:184
Bool_t hoe_EE_inv
Definition: WenuPlots.h:174
Float_t ele2nd_vz
Definition: WenuPlots.h:248
Int_t ele_ctfCharge
Definition: WenuPlots.h:206
Analysis-level electron class.
Definition: Electron.h:52
reco::TrackRef closestCtfTrackRef() const override
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
Float_t event_pfMT
Definition: WenuPlots.h:211
Float_t event_tcMT
Definition: WenuPlots.h:211
void beginJob() override
Definition: WenuPlots.cc:855
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:554
Bool_t useValidFirstPXBHit_
Definition: WenuPlots.h:63
edm::InputTag pfJetCollectionTag_
Definition: WenuPlots.h:72
std::string usePrecalcIDType_
Definition: WenuPlots.h:60
Float_t ele_cand_phi
Definition: WenuPlots.h:198
Bool_t ecalIsoUser_EB_inv
Definition: WenuPlots.h:180
double dB(IPTYPE type) const
Impact parameter wrt primary vertex or beamspot.
std::vector< PFJet > PFJetCollection
collection of PFJet objects
TH1F * h_EE_deta
Definition: WenuPlots.h:115
TH1F * h_mt_inverse_EB
Definition: WenuPlots.h:90
Double_t DRJetFromElectron_
Definition: WenuPlots.h:240
const IsolationVariables & dr03IsolationVariables() const
Definition: GsfElectron.h:561
Float_t ele2nd_tip_pv
Definition: WenuPlots.h:250
Float_t ele2nd_cr_dist
Definition: WenuPlots.h:247
static std::atomic< unsigned int > counter
Float_t event_tcMET
Definition: WenuPlots.h:208
Float_t event_pfMET_phi
Definition: WenuPlots.h:210
static int position[264][3]
Definition: ReadPGInfo.cc:509
Float_t pvbs_y
Definition: WenuPlots.h:256
Bool_t cIso_EE_inv
Definition: WenuPlots.h:175
Float_t event_caloMT
Definition: WenuPlots.h:211
std::string outputFile_
Definition: WenuPlots.h:68
TH1F * h_mt_EB
Definition: WenuPlots.h:89
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:557
Float_t ele2nd_id_dphi
Definition: WenuPlots.h:246
Bool_t dphi_EB_inv
Definition: WenuPlots.h:165
Float_t calojet_et[5]
Definition: WenuPlots.h:212
Double_t hoe_EB_
Definition: WenuPlots.h:135
Float_t ele_id_sihih
Definition: WenuPlots.h:200
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Bool_t trackIsoUser_EB_inv
Definition: WenuPlots.h:179
Float_t ele_tip_bs
Definition: WenuPlots.h:207
std::vector< Float_t > VtxNormalizedChi2BS
Definition: WenuPlots.h:255
TH1F * h_mt_EE
Definition: WenuPlots.h:94
Int_t ele2nd_cr_mhitsinner
Definition: WenuPlots.h:249
Double_t tip_bspot_EE_
Definition: WenuPlots.h:145
Double_t dphi_EB_
Definition: WenuPlots.h:134
Double_t sihih_EB_
Definition: WenuPlots.h:132
Float_t ele2nd_iso_ecal
Definition: WenuPlots.h:245
std::vector< Bool_t > InvVars_
Definition: WenuPlots.h:190
double phi() const final
momentum azimuthal angle
Float_t ele_cr_dcot
Definition: WenuPlots.h:201
Bool_t trackIso_EB_inv
Definition: WenuPlots.h:155
Double_t ecalIsoUser_EE_
Definition: WenuPlots.h:152
Float_t ele_sc_energy
Definition: WenuPlots.h:196
Double_t ecalIso_EE_
Definition: WenuPlots.h:129
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
EventNumber_t event() const
TH1F * h_EE_HoE
Definition: WenuPlots.h:116
Float_t ele_sc_gsf_et
Definition: WenuPlots.h:197
Bool_t usePrecalcID_
Definition: WenuPlots.h:58
TH1F * h_EE_hcaliso
Definition: WenuPlots.h:112
Float_t event_pfSumEt
Definition: WenuPlots.h:209
double vx() const override
x coordinate of vertex position
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Bool_t hoe_EB_inv
Definition: WenuPlots.h:166
Double_t hoe_EE_
Definition: WenuPlots.h:143
bool ecalDrivenSeed() const
Definition: GsfElectron.h:188
std::vector< Float_t > VtxNormalizedChi2
Definition: WenuPlots.h:253
Long64_t eventNumber
Definition: WenuPlots.h:195
Bool_t CheckCut(const pat::Electron *wenu, Int_t i)
Definition: WenuPlots.cc:764