CMS 3D CMS Logo

ElectronMcMiniAODSignalValidator.cc
Go to the documentation of this file.
1 // system include files
2 //#include <memory>
3 
4 // user include files
6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 
8 // user include files
9 
10 using namespace reco;
11 using namespace pat;
12 
14 
16 {
17  mcTruthCollection_ = consumes<edm::View<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("mcTruthCollection")); // prunedGenParticles
18  electronToken_ = consumes<pat::ElectronCollection>(iConfig.getParameter<edm::InputTag>("electrons")); // slimmedElectrons
19 
20  //recomp
21  ValueMaps_ChargedHadrons_ = consumes<edm::ValueMap<float> > (iConfig.getParameter<edm::InputTag>( "ValueMaps_ChargedHadrons_src" ) ) ;
22  ValueMaps_NeutralHadrons_ = consumes<edm::ValueMap<float> > (iConfig.getParameter<edm::InputTag>( "ValueMaps_NeutralHadrons_src" ) );
23  ValueMaps_Photons_ = consumes<edm::ValueMap<float> > (iConfig.getParameter<edm::InputTag>( "ValueMaps_Photons_src" ) );
24 
25  maxPt_ = iConfig.getParameter<double>("MaxPt");
26  maxAbsEta_ = iConfig.getParameter<double>("MaxAbsEta");
27  deltaR_ = iConfig.getParameter<double>("DeltaR");
28  deltaR2_ = deltaR_ * deltaR_;
29  matchingIDs_ = iConfig.getParameter<std::vector<int> >("MatchingID");
30  matchingMotherIDs_ = iConfig.getParameter<std::vector<int> >("MatchingMotherID");
31  outputInternalPath_ = iConfig.getParameter<std::string>("OutputFolderName") ;
32 
33  // histos bining and limits
34 
35  edm::ParameterSet histosSet = iConfig.getParameter<edm::ParameterSet>("histosCfg") ;
36 
37  xyz_nbin=histosSet.getParameter<int>("Nbinxyz");
38 
39  pt_nbin=histosSet.getParameter<int>("Nbinpt");
40  pt2D_nbin=histosSet.getParameter<int>("Nbinpt2D");
41  pteff_nbin=histosSet.getParameter<int>("Nbinpteff");
42  pt_max=histosSet.getParameter<double>("Ptmax");
43 
44  fhits_nbin=histosSet.getParameter<int>("Nbinfhits");
45  fhits_max=histosSet.getParameter<double>("Fhitsmax");
46 
47  eta_nbin=histosSet.getParameter<int>("Nbineta");
48  eta2D_nbin=histosSet.getParameter<int>("Nbineta2D");
49  eta_min=histosSet.getParameter<double>("Etamin");
50  eta_max=histosSet.getParameter<double>("Etamax");
51 
52  detamatch_nbin=histosSet.getParameter<int>("Nbindetamatch");
53  detamatch2D_nbin=histosSet.getParameter<int>("Nbindetamatch2D");
54  detamatch_min=histosSet.getParameter<double>("Detamatchmin");
55  detamatch_max=histosSet.getParameter<double>("Detamatchmax");
56 
57  dphi_nbin=histosSet.getParameter<int>("Nbindphi");
58  dphi_min=histosSet.getParameter<double>("Dphimin");
59  dphi_max=histosSet.getParameter<double>("Dphimax");
60 
61  dphimatch_nbin=histosSet.getParameter<int>("Nbindphimatch");
62  dphimatch2D_nbin=histosSet.getParameter<int>("Nbindphimatch2D");
63  dphimatch_min=histosSet.getParameter<double>("Dphimatchmin");
64  dphimatch_max=histosSet.getParameter<double>("Dphimatchmax");
65 
66  hoe_nbin= histosSet.getParameter<int>("Nbinhoe");
67  hoe_min=histosSet.getParameter<double>("Hoemin");
68  hoe_max=histosSet.getParameter<double>("Hoemax");
69 
70  mee_nbin= histosSet.getParameter<int>("Nbinmee");
71  mee_min=histosSet.getParameter<double>("Meemin");
72  mee_max=histosSet.getParameter<double>("Meemax");
73 
74  poptrue_nbin= histosSet.getParameter<int>("Nbinpoptrue");
75  poptrue_min=histosSet.getParameter<double>("Poptruemin");
76  poptrue_max=histosSet.getParameter<double>("Poptruemax");
77 
78  set_EfficiencyFlag=histosSet.getParameter<bool>("EfficiencyFlag");
79  set_StatOverflowFlag=histosSet.getParameter<bool>("StatOverflowFlag");
80 
81  // so to please coverity...
82 
83  h1_recEleNum = 0 ;
84 
85  h1_ele_vertexPt = 0 ;
86  h1_ele_vertexEta = 0 ;
88 
92 
95 
98 
99  h1_ele_HoE_mAOD = 0 ;
102  h1_ele_mee_all = 0 ;
103  h1_ele_mee_os = 0 ;
104 
105  h1_ele_fbrem_mAOD = 0 ;
108 
115 
125 
129 
130 }
131 
133 {
134 }
135 
137  {
139 
140  setBookIndex(-1) ;
141  setBookPrefix("h") ;
144 
145  // rec event collections sizes
146  h1_recEleNum = bookH1(iBooker, "recEleNum","# rec electrons",11, -0.5,10.5,"N_{ele}");
147  // matched electrons
148  setBookPrefix("h_mc") ;
149  setBookPrefix("h_ele") ;
150  h1_ele_vertexPt = bookH1withSumw2(iBooker, "vertexPt","ele transverse momentum",pt_nbin,0.,pt_max,"p_{T vertex} (GeV/c)");
151  h1_ele_vertexEta = bookH1withSumw2(iBooker, "vertexEta","ele momentum eta",eta_nbin,eta_min,eta_max,"#eta");
152  h1_ele_vertexPt_nocut = bookH1withSumw2(iBooker, "vertexPt_nocut","pT of prunned electrons",pt_nbin,0.,20.,"p_{T vertex} (GeV/c)");
153  h2_ele_PoPtrueVsEta = bookH2withSumw2(iBooker, "PoPtrueVsEta","ele momentum / gen momentum vs eta",eta2D_nbin,eta_min,eta_max,50,poptrue_min,poptrue_max);
154 // h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker,"sigmaIetaIetaVsPt","SigmaIetaIeta vs pt",pt_nbin,0.,pt_max,100,0.,0.05);
155  h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker,"sigmaIetaIetaVsPt","SigmaIetaIeta vs pt",100,0.,pt_max,100,0.,0.05);
156 
157  // all electrons
158  setBookPrefix("h_ele") ;
159  h1_ele_mee_all = bookH1withSumw2(iBooker, "mee_all","ele pairs invariant mass, all reco electrons",mee_nbin, mee_min, mee_max,"m_{ee} (GeV/c^{2})","Events","ELE_LOGY E1 P");
160  h1_ele_mee_os = bookH1withSumw2(iBooker, "mee_os","ele pairs invariant mass, opp. sign",mee_nbin, mee_min, mee_max,"m_{e^{+}e^{-}} (GeV/c^{2})","Events","ELE_LOGY E1 P");
161 
162  // matched electron, superclusters
163  setBookPrefix("h_scl") ;
164  h1_scl_SigIEtaIEta_mAOD = bookH1withSumw2(iBooker, "SigIEtaIEta_mAOD","ele supercluster sigma ieta ieta",100,0.,0.05,"#sigma_{i#eta i#eta}","Events","ELE_LOGY E1 P");
165  h1_scl_SigIEtaIEta_mAOD_barrel = bookH1withSumw2(iBooker, "SigIEtaIEta_mAOD_barrel","ele supercluster sigma ieta ieta, barrel",100,0.,0.05,"#sigma_{i#eta i#eta}","Events","ELE_LOGY E1 P");
166  h1_scl_SigIEtaIEta_mAOD_endcaps = bookH1withSumw2(iBooker, "SigIEtaIEta_mAOD_endcaps","ele supercluster sigma ieta ieta, endcaps",100,0.,0.05,"#sigma_{i#eta i#eta}","Events","ELE_LOGY E1 P");
167 
168  // matched electron, gsf tracks
169  setBookPrefix("h_ele") ;
170  h2_ele_foundHitsVsEta = bookH2(iBooker, "foundHitsVsEta","ele track # found hits vs eta",eta2D_nbin,eta_min,eta_max,fhits_nbin,0.,fhits_max);
171  h2_ele_foundHitsVsEta_mAOD = bookH2(iBooker, "foundHitsVsEta_mAOD","ele track # found hits vs eta",eta2D_nbin,eta_min,eta_max,fhits_nbin,0.,fhits_max);
172 
173  // matched electrons, matching
174  setBookPrefix("h_ele") ;
175  h1_ele_HoE_mAOD = bookH1withSumw2(iBooker, "HoE_mAOD","ele hadronic energy / em energy",hoe_nbin, hoe_min, hoe_max,"H/E","Events","ELE_LOGY E1 P") ;
176  h1_ele_HoE_mAOD_barrel = bookH1withSumw2(iBooker, "HoE_mAOD_barrel","ele hadronic energy / em energy, barrel",hoe_nbin, hoe_min, hoe_max,"H/E","Events","ELE_LOGY E1 P") ;
177  h1_ele_HoE_mAOD_endcaps = bookH1withSumw2(iBooker, "HoE_mAOD_endcaps","ele hadronic energy / em energy, endcaps",hoe_nbin, hoe_min, hoe_max,"H/E","Events","ELE_LOGY E1 P") ;
178  h1_ele_dEtaSc_propVtx_mAOD = bookH1withSumw2(iBooker, "dEtaSc_propVtx_mAOD","ele #eta_{sc} - #eta_{tr}, prop from vertex",detamatch_nbin,detamatch_min,detamatch_max,"#eta_{sc} - #eta_{tr}","Events","ELE_LOGY E1 P");
179  h1_ele_dEtaSc_propVtx_mAOD_barrel = bookH1withSumw2(iBooker, "dEtaSc_propVtx_mAOD_barrel","ele #eta_{sc} - #eta_{tr}, prop from vertex, barrel",detamatch_nbin,detamatch_min,detamatch_max,"#eta_{sc} - #eta_{tr}","Events","ELE_LOGY E1 P");
180  h1_ele_dEtaSc_propVtx_mAOD_endcaps = bookH1withSumw2(iBooker, "dEtaSc_propVtx_mAOD_endcaps","ele #eta_{sc} - #eta_{tr}, prop from vertex, endcaps",detamatch_nbin,detamatch_min,detamatch_max,"#eta_{sc} - #eta_{tr}","Events","ELE_LOGY E1 P");
181  h1_ele_dPhiCl_propOut_mAOD = bookH1withSumw2(iBooker, "dPhiCl_propOut_mAOD","ele #phi_{cl} - #phi_{tr}, prop from outermost",dphimatch_nbin,dphimatch_min,dphimatch_max,"#phi_{seedcl} - #phi_{tr} (rad)","Events","ELE_LOGY E1 P");
182  h1_ele_dPhiCl_propOut_mAOD_barrel = bookH1withSumw2(iBooker, "dPhiCl_propOut_mAOD_barrel","ele #phi_{cl} - #phi_{tr}, prop from outermost, barrel",dphimatch_nbin,dphimatch_min,dphimatch_max,"#phi_{seedcl} - #phi_{tr} (rad)","Events","ELE_LOGY E1 P");
183  h1_ele_dPhiCl_propOut_mAOD_endcaps = bookH1withSumw2(iBooker, "dPhiCl_propOut_mAOD_endcaps","ele #phi_{cl} - #phi_{tr}, prop from outermost, endcaps",dphimatch_nbin,dphimatch_min,dphimatch_max,"#phi_{seedcl} - #phi_{tr} (rad)","Events","ELE_LOGY E1 P");
184 
185  // fbrem
186  h1_ele_fbrem_mAOD = bookH1withSumw2(iBooker, "fbrem_mAOD","ele brem fraction, mode of GSF components",100,0.,1.,"P_{in} - P_{out} / P_{in}");
187  h1_ele_fbrem_mAOD_barrel = bookH1withSumw2(iBooker, "fbrem_mAOD_barrel","ele brem fraction for barrel, mode of GSF components", 100, 0.,1.,"P_{in} - P_{out} / P_{in}");
188  h1_ele_fbrem_mAOD_endcaps = bookH1withSumw2(iBooker, "fbrem_mAOD_endcaps", "ele brem franction for endcaps, mode of GSF components", 100, 0.,1.,"P_{in} - P_{out} / P_{in}");
189 
190  // -- pflow over pT
191  h1_ele_chargedHadronRelativeIso_mAOD = bookH1withSumw2(iBooker, "chargedHadronRelativeIso_mAOD","chargedHadronRelativeIso",100,0.0,2.,"chargedHadronRelativeIso","Events","ELE_LOGY E1 P");
192  h1_ele_chargedHadronRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker, "chargedHadronRelativeIso_mAOD_barrel","chargedHadronRelativeIso for barrel",100,0.0,2.,"chargedHadronRelativeIso_barrel","Events","ELE_LOGY E1 P");
193  h1_ele_chargedHadronRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker, "chargedHadronRelativeIso_mAOD_endcaps","chargedHadronRelativeIso for endcaps",100,0.0,2.,"chargedHadronRelativeIso_endcaps","Events","ELE_LOGY E1 P");
194  h1_ele_neutralHadronRelativeIso_mAOD = bookH1withSumw2(iBooker, "neutralHadronRelativeIso_mAOD","neutralHadronRelativeIso",100,0.0,2.,"neutralHadronRelativeIso","Events","ELE_LOGY E1 P");
195  h1_ele_neutralHadronRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker, "neutralHadronRelativeIso_mAOD_barrel","neutralHadronRelativeIso for barrel",100,0.0,2.,"neutralHadronRelativeIso_barrel","Events","ELE_LOGY E1 P");
196  h1_ele_neutralHadronRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker, "neutralHadronRelativeIso_mAOD_endcaps","neutralHadronRelativeIso for endcaps",100,0.0,2.,"neutralHadronRelativeIso_endcaps","Events","ELE_LOGY E1 P");
197  h1_ele_photonRelativeIso_mAOD = bookH1withSumw2(iBooker, "photonRelativeIso_mAOD","photonRelativeIso",100,0.0,2.,"photonRelativeIso","Events","ELE_LOGY E1 P");
198  h1_ele_photonRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker, "photonRelativeIso_mAOD_barrel","photonRelativeIso for barrel",100,0.0,2.,"photonRelativeIso_barrel","Events","ELE_LOGY E1 P");
199  h1_ele_photonRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker, "photonRelativeIso_mAOD_endcaps","photonRelativeIso for endcaps",100,0.0,2.,"photonRelativeIso_endcaps","Events","ELE_LOGY E1 P");
200 
201  // -- recomputed pflow over pT
202  h1_ele_chargedHadronRelativeIso_mAOD_recomp = bookH1withSumw2(iBooker, "chargedHadronRelativeIso_mAOD_recomp","recomputed chargedHadronRelativeIso",100,0.0,2.,"chargedHadronRelativeIso","Events","ELE_LOGY E1 P");
203  h1_ele_neutralHadronRelativeIso_mAOD_recomp = bookH1withSumw2(iBooker, "neutralHadronRelativeIso_mAOD_recomp","recomputed neutralHadronRelativeIso",100,0.0,2.,"neutralHadronRelativeIso","Events","ELE_LOGY E1 P");
204  h1_ele_photonRelativeIso_mAOD_recomp = bookH1withSumw2(iBooker, "photonRelativeIso_mAOD_recomp","recomputed photonRelativeIso",100,0.0,2.,"photonRelativeIso","Events","ELE_LOGY E1 P");
205 
206  }
207 
209 {
210  // get collections
212  iEvent.getByToken(electronToken_, electrons);
213 
215  iEvent.getByToken(mcTruthCollection_, genParticles) ;
216 
217  //recomp
218  edm::Handle <edm::ValueMap <float> > ValueMaps_ChargedHadrons;
219  edm::Handle <edm::ValueMap <float> > ValueMaps_NeutralHadrons;
220  edm::Handle <edm::ValueMap <float> > ValueMaps_Photons;
221 
222  //recomp
223  iEvent.getByToken( ValueMaps_ChargedHadrons_ , ValueMaps_ChargedHadrons);
224  iEvent.getByToken( ValueMaps_NeutralHadrons_ , ValueMaps_NeutralHadrons);
225  iEvent.getByToken( ValueMaps_Photons_ , ValueMaps_Photons);
226 
227  edm::LogInfo("ElectronMcSignalValidatorMiniAOD::analyze")
228  <<"Treating event "<<iEvent.id()
229  <<" with "<<electrons.product()->size()<<" electrons" ;
230  h1_recEleNum->Fill((*electrons).size()) ;
231 
232  //===============================================
233  // all rec electrons
234  //===============================================
235 
236  pat::Electron gsfElectron ;
237 
238  pat::ElectronCollection::const_iterator el1 ;
239  pat::ElectronCollection::const_iterator el2 ;
240  for(el1=electrons->begin(); el1!=electrons->end(); el1++) {
241  for (el2=el1+1 ; el2!=electrons->end() ; el2++ )
242  {
243  math::XYZTLorentzVector p12 = el1->p4()+el2->p4();
244  float mee2 = p12.Dot(p12);
245  h1_ele_mee_all->Fill(sqrt(mee2));
246  if ( el1->charge() * el2->charge() < 0. )
247  {
248  h1_ele_mee_os->Fill(sqrt(mee2));
249  }
250  }
251  }
252 
253  //===============================================
254  // charge mis-ID
255  //===============================================
256 
257  int mcNum=0, gamNum=0, eleNum=0 ;
258 // bool matchingID;//, matchingMotherID ;
259  bool matchingMotherID ;
260 
261  //===============================================
262  // association mc-reco
263  //===============================================
264 
265  for(size_t i=0; i<genParticles->size(); i++) {
266 /* // DEBUG LINES - KEEP IT !
267  std::cout << "\nevt ID = " << iEvent.id() ;
268  std::cout << ", mcIter position : " << i << std::endl;
269  std::cout << "pdgID : " << (*genParticles)[i].pdgId() << ", Pt : " << (*genParticles)[i].pt() ;
270  std::cout << ", eta : " << (*genParticles)[i].eta() << ", phi : " << (*genParticles)[i].phi() << std::endl;
271  // DEBUG LINES - KEEP IT ! */
272 
273  // number of mc particles
274  mcNum++ ;
275 
276  // counts photons
277  if ( (*genParticles)[i].pdgId() == 22 )
278  { gamNum++ ; }
279 
280  // select requested mother matching gen particle
281  // always include single particle with no mother
282  const Candidate * mother = (*genParticles)[i].mother(0) ;
283  matchingMotherID = false ;
284  for ( unsigned int ii=0 ; ii<matchingMotherIDs_.size() ; ii++ ) {
285 
286 /* // DEBUG LINES - KEEP IT !
287  std::cout << "Matching : matchingMotherID[" << ii << "] : "<< matchingMotherIDs_[ii] << ", evt ID = " << iEvent.id() << ", mother : " << mother ;
288  if (mother != 0) {
289  std::cout << "mother : " << mother << ", mother pdgID : " << mother->pdgId() << std::endl ;
290  std::cout << "mother pdgID : " << mother->pdgId() << ", Pt : " << mother->pt() << ", eta : " << mother->eta() << ", phi : " << mother->phi() << std::endl;
291  }
292  else {
293  std::cout << std::endl;
294  }
295  // DEBUG LINES - KEEP IT ! */
296 
297  if ( mother == 0 ) {
298  matchingMotherID = true ;
299  }
300  else if ( mother->pdgId() == matchingMotherIDs_[ii] ) {
301  if ( mother->numberOfDaughters() <= 2 ) {
302  matchingMotherID = true ;
303  //std::cout << "evt ID = " << iEvent.id() ; // debug lines
304  //std::cout << " - nb of Daughters : " << mother->numberOfDaughters() << " - pdgId() : " << mother->pdgId() << std::endl; // debug lines
305  }
306  } // end of mother if test
307 
308 /* // DEBUG LINES - KEEP IT !
309  if (mother != 0) {
310  std::cout << "mother : " << mother << ", mother pdgID : " << mother->pdgId() << std::endl ;
311  std::cout << "mother pdgID : " << mother->pdgId() << ", Pt : " << mother->pt() << ", eta : " << mother->eta() << ", phi : " << mother->phi() << std::endl;
312  }
313  // DEBUG LINES - KEEP IT ! */
314  } // end of for loop
315  if (!matchingMotherID) {continue ;}
316 
317  // electron preselection
318  if ((*genParticles)[i].pt()> maxPt_ || std::abs((*genParticles)[i].eta())> maxAbsEta_)
319  { continue ; }
320  eleNum++;
321 
322  // find best matched electron
323  bool okGsfFound = false ;
324  bool passMiniAODSelection = true ;
325  double gsfOkRatio = 999999. ;
326  pat::Electron bestGsfElectron ;
327  for (const pat::Electron &el : *electrons ) {
328  double dphi = el.phi()-(*genParticles)[i].phi() ;
329  if (std::abs(dphi)>CLHEP::pi)
330  { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
331  double deltaR2 = (el.eta()-(*genParticles)[i].eta()) * (el.eta()-(*genParticles)[i].eta()) + dphi * dphi;
332  if ( deltaR2 < deltaR2_ )
333  {
334  if ( ( ((*genParticles)[i].pdgId() == 11) && (el.charge() < 0.) ) ||
335  ( ((*genParticles)[i].pdgId() == -11) && (el.charge() > 0.) ) )
336  {
337  double tmpGsfRatio = el.p()/(*genParticles)[i].p() ;
338  if ( std::abs(tmpGsfRatio-1) < std::abs(gsfOkRatio-1) )
339  {
340  gsfOkRatio = tmpGsfRatio;
341  bestGsfElectron=el;
342  PatElectronPtr elePtr(electrons, &el-&(*electrons)[0]) ;
343  pt_ = elePtr->pt();
344  sumChargedHadronPt_recomp = (*ValueMaps_ChargedHadrons)[elePtr];
345  sumNeutralHadronPt_recomp = (*ValueMaps_NeutralHadrons)[elePtr];
346  sumPhotonPt_recomp = (*ValueMaps_Photons)[elePtr];
350  okGsfFound = true;
351 
352  // DEBUG LINES - KEEP IT !
353  // std::cout << "evt ID : " << iEvent.id() << " - Pt : " << bestGsfElectron.pt() << " - eta : " << bestGsfElectron.eta() << " - phi : " << bestGsfElectron.phi() << std::endl;
354  // DEBUG LINES - KEEP IT ! /**/
355  }
356  }
357  }
358  }
359 
360  if (! okGsfFound) continue ;
361 
362  //------------------------------------
363  // analysis when the mc track is found
364  //------------------------------------
365  passMiniAODSelection = bestGsfElectron.pt() >= 5.;
366 
367  // electron related distributions
368  h1_ele_vertexPt->Fill( bestGsfElectron.pt() );
369  h1_ele_vertexEta->Fill( bestGsfElectron.eta() );
370  if ( (bestGsfElectron.scSigmaIEtaIEta()==0.) && (bestGsfElectron.fbrem()==0.) ) h1_ele_vertexPt_nocut->Fill( bestGsfElectron.pt() );
371 
372  // generated distributions for matched electrons
373  h2_ele_PoPtrueVsEta->Fill( bestGsfElectron.eta(), bestGsfElectron.p()/(*genParticles)[i].p());
374  if ( passMiniAODSelection ) { // Pt > 5.
375  h2_ele_sigmaIetaIetaVsPt->Fill( bestGsfElectron.pt(), bestGsfElectron.scSigmaIEtaIEta());
376  }
377 
378  // supercluster related distributions
379  if ( passMiniAODSelection ) { // Pt > 5.
380  h1_scl_SigIEtaIEta_mAOD->Fill(bestGsfElectron.scSigmaIEtaIEta());
383  if (bestGsfElectron.isEB()) {
387  }
388  if (bestGsfElectron.isEE()) {
392  }
393 
394  }
395 
396  // track related distributions
397  h2_ele_foundHitsVsEta->Fill( bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits() );
398  if (passMiniAODSelection) { // Pt > 5.
399  h2_ele_foundHitsVsEta_mAOD->Fill( bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits() );
400  }
401 
402  // match distributions
403  if (passMiniAODSelection) { // Pt > 5.
404  h1_ele_HoE_mAOD->Fill(bestGsfElectron.hcalOverEcal());
405  if (bestGsfElectron.isEB()) h1_ele_HoE_mAOD_barrel->Fill(bestGsfElectron.hcalOverEcal());
406  if (bestGsfElectron.isEE()) h1_ele_HoE_mAOD_endcaps->Fill(bestGsfElectron.hcalOverEcal());
407  }
408 
409  // fbrem
410 
411  // double fbrem_mode = bestGsfElectron.fbrem();
412  if (passMiniAODSelection) { // Pt > 5.
413  h1_ele_fbrem_mAOD->Fill( bestGsfElectron.fbrem() );
414  if (bestGsfElectron.isEB()) h1_ele_fbrem_mAOD_barrel->Fill( bestGsfElectron.fbrem() );
415  if (bestGsfElectron.isEE()) h1_ele_fbrem_mAOD_endcaps->Fill( bestGsfElectron.fbrem() );
416 
417  // -- pflow over pT
418  double one_over_pt = 1. / bestGsfElectron.pt();
419 
422  h1_ele_photonRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt * one_over_pt );
423 
424  if (bestGsfElectron.isEB()) {
428  }
429 
430  if (bestGsfElectron.isEE()) {
434  }
435 
436  // -- recomputed pflow over pT
440 
441  }
442 
443  } // fin boucle size_t i
444 
445  //std::cout << ("fin analyze\n"); //
446 }
447 
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:670
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
MonitorElement * bookH2withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
edm::EDGetTokenT< edm::ValueMap< float > > ValueMaps_Photons_
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
MonitorElement * bookH1withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
MonitorElement * bookH2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
float fbrem() const
Definition: GsfElectron.h:750
ElectronMcSignalValidatorMiniAOD(const edm::ParameterSet &)
bool isEE() const
Definition: GsfElectron.h:353
edm::EDGetTokenT< edm::ValueMap< float > > ValueMaps_NeutralHadrons_
bool isEB() const
Definition: GsfElectron.h:352
void Fill(long long x)
Definition: HeavyIon.h:7
const Double_t pi
virtual double phi() const final
momentum azimuthal angle
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::EDGetTokenT< edm::View< reco::GenParticle > > mcTruthCollection_
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:249
int iEvent
Definition: GenABIO.cc:230
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:253
virtual int pdgId() const =0
PDG identifier.
T sqrt(T t)
Definition: SSEVec.h:18
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:627
float hcalOverEcal() const
Definition: GsfElectron.h:442
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual double p() const final
magnitude of momentum vector
void setBookPrefix(const std::string &)
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:626
float scSigmaIEtaIEta() const
Definition: GsfElectron.h:483
ii
Definition: cuy.py:588
void setBookEfficiencyFlag(const bool &)
edm::Ptr< pat::Electron > PatElectronPtr
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
T const * product() const
Definition: Handle.h:81
Analysis-level electron class.
Definition: Electron.h:52
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventID id() const
Definition: EventBase.h:58
fixed size matrix
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * bookH1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
edm::EDGetTokenT< edm::ValueMap< float > > ValueMaps_ChargedHadrons_
edm::EDGetTokenT< pat::ElectronCollection > electronToken_
virtual size_type numberOfDaughters() const =0
number of daughters
void setBookStatOverflowFlag(const bool &)
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:625
Definition: Run.h:42