CMS 3D CMS Logo

PhotonValidator.cc
Go to the documentation of this file.
1 #include <iostream>
2 //
5 //
7 
8 //
12 //
14 //
18 //
23 //
28 //
31 #include "CLHEP/Units/GlobalPhysicalConstants.h"
33 
34 //
54 
55 //
60 
64 //
65 //#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
66 //
67 #include "TFile.h"
68 #include "TH1.h"
69 #include "TH2.h"
70 #include "TTree.h"
71 #include "TVector3.h"
72 #include "TProfile.h"
73 //
82 using namespace std;
83 
84 
86 
87 {
88  fName_ = pset.getParameter<std::string>("analyzerName");
89  verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
90  parameters_ = pset;
91  fastSim_ = pset.getParameter<bool>("fastSim");
92  isRunCentrally_= pset.getParameter<bool>("isRunCentrally");
93 
94  photonCollectionProducer_ = pset.getParameter<std::string>("phoProducer");
95  photonCollection_ = pset.getParameter<std::string>("photonCollection");
96  photonCollectionToken_ = consumes<reco::PhotonCollection>(
97  edm::InputTag(photonCollectionProducer_,
98  photonCollection_));
99 
100  token_tp_ = consumes<TrackingParticleCollection>(
101  pset.getParameter<edm::InputTag>("label_tp"));
102 
103  barrelEcalHits_ = consumes<EcalRecHitCollection>(
104  pset.getParameter<edm::InputTag>("barrelEcalHits"));
105  endcapEcalHits_ = consumes<EcalRecHitCollection>(
106  pset.getParameter<edm::InputTag>("endcapEcalHits"));
107 
108  conversionOITrackProducer_ = pset.getParameter<std::string>("conversionOITrackProducer");
109  conversionIOTrackProducer_ = pset.getParameter<std::string>("conversionIOTrackProducer");
110  conversionOITrackPr_Token_ = consumes<edm::View<reco::Track> >(
111  edm::InputTag(conversionOITrackProducer_));
112  conversionIOTrackPr_Token_ = consumes<edm::View<reco::Track> >(
113  edm::InputTag(conversionIOTrackProducer_));
114 
115  pfCandidates_ = consumes<reco::PFCandidateCollection>(pset.getParameter<edm::InputTag>("pfCandidates"));
116  valueMapPhoPFCandIso_ = pset.getParameter<std::string>("valueMapPhoToParticleBasedIso");
117  particleBasedIso_token = consumes<edm::ValueMap<std::vector<reco::PFCandidateRef> > >(pset.getUntrackedParameter<edm::InputTag>("particleBasedIso",edm::InputTag("particleBasedIsolation",valueMapPhoPFCandIso_)));
118 
119  minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
120  convTrackMinPtCut_ = pset.getParameter<double>("convTrackMinPtCut");
121  likelihoodCut_ = pset.getParameter<double>("likelihoodCut");
122 
123  trkIsolExtRadius_ = pset.getParameter<double>("trkIsolExtR");
124  trkIsolInnRadius_ = pset.getParameter<double>("trkIsolInnR");
125  trkPtLow_ = pset.getParameter<double>("minTrackPtCut");
126  lip_ = pset.getParameter<double>("lipCut");
127  ecalIsolRadius_ = pset.getParameter<double>("ecalIsolR");
128  bcEtLow_ = pset.getParameter<double>("minBcEtCut");
129  hcalIsolExtRadius_ = pset.getParameter<double>("hcalIsolExtR");
130  hcalIsolInnRadius_ = pset.getParameter<double>("hcalIsolInnR");
131  hcalHitEtLow_ = pset.getParameter<double>("minHcalHitEtCut");
132 
133  numOfTracksInCone_ = pset.getParameter<int>("maxNumOfTracksInCone");
134  trkPtSumCut_ = pset.getParameter<double>("trkPtSumCut");
135  ecalEtSumCut_ = pset.getParameter<double>("ecalEtSumCut");
136  hcalEtSumCut_ = pset.getParameter<double>("hcalEtSumCut");
137  dCotCutOn_ = pset.getParameter<bool>("dCotCutOn");
138  dCotCutValue_ = pset.getParameter<double>("dCotCutValue");
139  dCotHardCutValue_ = pset.getParameter<double>("dCotHardCutValue");
140 
141  offline_pvToken_ = consumes<reco::VertexCollection>(
142  pset.getUntrackedParameter<edm::InputTag>("offlinePV",
143  edm::InputTag("offlinePrimaryVertices")));
144  g4_simTk_Token_ = consumes<edm::SimTrackContainer>(edm::InputTag("g4SimHits"));
145  g4_simVtx_Token_ = consumes<edm::SimVertexContainer>(edm::InputTag("g4SimHits"));
146  famos_simTk_Token_ = consumes<edm::SimTrackContainer>(
147  edm::InputTag("fastSimProducer"));
148  famos_simVtx_Token_ = consumes<edm::SimVertexContainer>(
149  edm::InputTag("fastSimProducer"));
150  hepMC_Token_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
151  genjets_Token_ = consumes<reco::GenJetCollection>(
152  edm::InputTag("ak4GenJets"));
153 
154  genpartToken_ = consumes<reco::GenParticleCollection>(edm::InputTag( "genParticles" ));
155 
156  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag("trackAssociatorByHitsForPhotonValidation"));
157 
158 
159  nEvt_=0;
160  nEntry_=0;
161  nRecConv_=0;
162  nRecConvAss_=0;
163  nRecConvAssWithEcal_=0;
164  nInvalidPCA_=0;
165 
166 
167 }
168 
169 
170 
171 
173 
174 
175 
177 
178 
179 
180  double resMin = parameters_.getParameter<double>("resMin");
181  double resMax = parameters_.getParameter<double>("resMax");
182  int resBin = parameters_.getParameter<int>("resBin");
183 
184  double eMin = parameters_.getParameter<double>("eMin");
185  double eMax = parameters_.getParameter<double>("eMax");
186  int eBin = parameters_.getParameter<int>("eBin");
187 
188  double etMin = parameters_.getParameter<double>("etMin");
189  double etMax = parameters_.getParameter<double>("etMax");
190  int etBin = parameters_.getParameter<int>("etBin");
191 
192  double etScale = parameters_.getParameter<double>("etScale");
193 
194  double etaMin = parameters_.getParameter<double>("etaMin");
195  double etaMax = parameters_.getParameter<double>("etaMax");
196  int etaBin = parameters_.getParameter<int>("etaBin");
197  int etaBin2 = parameters_.getParameter<int>("etaBin2");
198 
199  double dEtaMin = parameters_.getParameter<double>("dEtaMin");
200  double dEtaMax = parameters_.getParameter<double>("dEtaMax");
201  int dEtaBin = parameters_.getParameter<int>("dEtaBin");
202 
203  double phiMin = parameters_.getParameter<double>("phiMin");
204  double phiMax = parameters_.getParameter<double>("phiMax");
205  int phiBin = parameters_.getParameter<int>("phiBin");
206 
207  double dPhiMin = parameters_.getParameter<double>("dPhiMin");
208  double dPhiMax = parameters_.getParameter<double>("dPhiMax");
209  int dPhiBin = parameters_.getParameter<int>("dPhiBin");
210 
211  double rMin = parameters_.getParameter<double>("rMin");
212  double rMax = parameters_.getParameter<double>("rMax");
213  int rBin = parameters_.getParameter<int>("rBin");
214 
215  double zMin = parameters_.getParameter<double>("zMin");
216  double zMax = parameters_.getParameter<double>("zMax");
217  int zBin = parameters_.getParameter<int>("zBin");
218 
219 
220 
221  double r9Min = parameters_.getParameter<double>("r9Min");
222  double r9Max = parameters_.getParameter<double>("r9Max");
223  int r9Bin = parameters_.getParameter<int>("r9Bin");
224 
225  double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
226  double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
227  int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
228 
229  double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin");
230  double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax");
231  int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin");
232 
233  double dCotTracksMin = parameters_.getParameter<double>("dCotTracksMin");
234  double dCotTracksMax = parameters_.getParameter<double>("dCotTracksMax");
235  int dCotTracksBin = parameters_.getParameter<int>("dCotTracksBin");
236 
237 
238  double povereMin = parameters_.getParameter<double>("povereMin");
239  double povereMax = parameters_.getParameter<double>("povereMax");
240  int povereBin = parameters_.getParameter<int>("povereBin");
241 
242  double eoverpMin = parameters_.getParameter<double>("eoverpMin");
243  double eoverpMax = parameters_.getParameter<double>("eoverpMax");
244  int eoverpBin = parameters_.getParameter<int>("eoverpBin");
245 
246  double chi2Min = parameters_.getParameter<double>("chi2Min");
247  double chi2Max = parameters_.getParameter<double>("chi2Max");
248 
249  int ggMassBin = parameters_.getParameter<int>("ggMassBin");
250  double ggMassMin = parameters_.getParameter<double>("ggMassMin");
251  double ggMassMax = parameters_.getParameter<double>("ggMassMax");
252 
253 
254  double rMinForXray = parameters_.getParameter<double>("rMinForXray");
255  double rMaxForXray = parameters_.getParameter<double>("rMaxForXray");
256  int rBinForXray = parameters_.getParameter<int>("rBinForXray");
257  double zMinForXray = parameters_.getParameter<double>("zMinForXray");
258  double zMaxForXray = parameters_.getParameter<double>("zMaxForXray");
259  int zBinForXray = parameters_.getParameter<int>("zBinForXray");
260  int zBin2ForXray = parameters_.getParameter<int>("zBin2ForXray");
261 
262 
263 
265  // SC from reco photons
266 
267 
268  iBooker.setCurrentFolder("EgammaV/"+fName_+"/SimulationInfo");
269 
270  // simulation information about all MC photons found
271  std::string histname = "nOfSimPhotons";
272  if ( ! isRunCentrally_ ) {
273  h_nSimPho_[0] = iBooker.book1D(histname,"# of Sim photons per event ",20,-0.5,19.5);
274  histname = "SimPhoMotherEt";
275  h_SimPhoMotherEt_[0] = iBooker.book1D(histname,"Sim photon Mother tranverse energy spectrum",etBin,etMin,etMax);
276  h_SimPhoMotherEta_[0] = iBooker.book1D("SimPhoMotherEta"," Sim Photon Mother Eta ",etaBin,etaMin, etaMax) ;
277  histname = "SimPhoMotherEtMatched";
278  h_SimPhoMotherEt_[1] = iBooker.book1D(histname,"Sim photon matched by a reco Photon: Mother tranverse energy spectrum",etBin,etMin,etMax);
279  h_SimPhoMotherEta_[1] = iBooker.book1D("SimPhoMotherEtaMatched"," Sim Photon matched by a reco Photon: Mother Eta ",etaBin,etaMin, etaMax) ;
280  }
281 
282  histname = "h_SimPhoEta";
283  h_SimPho_[0] = iBooker.book1D(histname," All photons simulated #eta",etaBin,etaMin, etaMax);
284  histname = "h_SimPhoPhi";
285  h_SimPho_[1] = iBooker.book1D(histname," All photons simulated #phi",phiBin,phiMin, phiMax);
286  histname = "h_SimPhoEt";
287  h_SimPho_[2] = iBooker.book1D(histname," All photons simulated Et",etBin,etMin, etMax);
288  // Numerators
289  histname = "nOfSimPhotonsMatched";
290  h_nSimPho_[1] = iBooker.book1D(histname,"# of Sim photons matched by a reco Photon per event ",20,-0.5,19.5);
291  histname = "h_MatchedSimPhoEta";
292  h_MatchedSimPho_[0] = iBooker.book1D(histname," Matching photons simulated #eta",etaBin,etaMin, etaMax);
293  histname = "h_MatchedSimPhoPhi";
294  h_MatchedSimPho_[1] = iBooker.book1D(histname," Matching photons simulated #phi",phiBin,phiMin, phiMax);
295  histname = "h_MatchedSimPhoEt";
296  h_MatchedSimPho_[2] = iBooker.book1D(histname," Matching photons simulated Et",etBin,etMin, etMax);
297  //
298  histname = "h_MatchedSimPhoBadChEta";
299  h_MatchedSimPhoBadCh_[0] = iBooker.book1D(histname," Matching photons simulated #eta",etaBin,etaMin, etaMax);
300  histname = "h_MatchedSimPhoBadChPhi";
301  h_MatchedSimPhoBadCh_[1] = iBooker.book1D(histname," Matching photons simulated #phi",phiBin,phiMin, phiMax);
302  histname = "h_MatchedSimPhoBadChEt";
303  h_MatchedSimPhoBadCh_[2] = iBooker.book1D(histname," Matching photons simulated Et",etBin,etMin, etMax);
304 
305 
307  histname = "nOfSimConversions";
308  if ( ! isRunCentrally_ ) {
309  h_nSimConv_[0] = iBooker.book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
310  histname = "nOfVisSimConversions";
311  h_nSimConv_[1] = iBooker.book1D(histname,"# of Sim conversions per event ",20,-0.5,19.5);
312  }
314  histname = "h_AllSimConvEta";
315  h_AllSimConv_[0] = iBooker.book1D(histname," All conversions: simulated #eta",etaBin2,etaMin,etaMax);
316  histname = "h_AllSimConvPhi";
317  h_AllSimConv_[1] = iBooker.book1D(histname," All conversions: simulated #phi",phiBin,phiMin,phiMax);
318  histname = "h_AllSimConvR";
319  h_AllSimConv_[2] = iBooker.book1D(histname," All conversions: simulated R",rBin,rMin,rMax);
320  histname = "h_AllSimConvZ";
321  h_AllSimConv_[3] = iBooker.book1D(histname," All conversions: simulated Z",zBin,zMin,zMax);
322  histname = "h_AllSimConvEt";
323  h_AllSimConv_[4] = iBooker.book1D(histname," All conversions: simulated Et",etBin,etMin,etMax);
324  //
325  histname = "h_VisSimConvEta";
326  h_VisSimConv_[0] = iBooker.book1D(histname," All vis conversions: simulated #eta",etaBin2,etaMin, etaMax);
327  histname = "h_VisSimConvPhi";
328  h_VisSimConv_[1] = iBooker.book1D(histname," All vis conversions: simulated #phi",phiBin,phiMin, phiMax);
329  histname = "h_VisSimConvR";
330  h_VisSimConv_[2] = iBooker.book1D(histname," All vis conversions: simulated R",rBin,rMin,rMax);
331  histname = "h_VisSimConvZ";
332  h_VisSimConv_[3] = iBooker.book1D(histname," All vis conversions: simulated Z",zBin,zMin, zMax);
333  histname = "h_VisSimConvEt";
334  h_VisSimConv_[4] = iBooker.book1D(histname," All vis conversions: simulated Et",etBin,etMin, etMax);
336  histname = "h_SimConvOneTracksEta";
337  h_SimConvOneTracks_[0] = iBooker.book1D(histname," All vis conversions with 1 reco tracks: simulated #eta",etaBin2,etaMin, etaMax);
338  histname = "h_SimConvOneTracksPhi";
339  h_SimConvOneTracks_[1] = iBooker.book1D(histname," All vis conversions with 1 reco tracks: simulated #phi",phiBin,phiMin, phiMax);
340  histname = "h_SimConvOneTracksR";
341  h_SimConvOneTracks_[2] = iBooker.book1D(histname," All vis conversions with 1 reco tracks: simulated R",rBin,rMin, rMax);
342  histname = "h_SimConvOneTracksZ";
343  h_SimConvOneTracks_[3] = iBooker.book1D(histname," All vis conversions with 1 reco tracks: simulated Z",zBin,zMin, zMax);
344  histname = "h_SimConvOneTracksEt";
345  h_SimConvOneTracks_[4] = iBooker.book1D(histname," All vis conversions with 1 reco tracks: simulated Et",etBin,etMin, etMax);
346  //
347  histname = "h_SimConvTwoMTracksEta";
348  h_SimConvTwoMTracks_[0] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks: simulated #eta",etaBin2,etaMin, etaMax);
349  histname = "h_SimConvTwoMTracksPhi";
350  h_SimConvTwoMTracks_[1] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks: simulated #phi",phiBin,phiMin, phiMax);
351  histname = "h_SimConvTwoMTracksR";
352  h_SimConvTwoMTracks_[2] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks: simulated R",rBin,rMin, rMax);
353  histname = "h_SimConvTwoMTracksZ";
354  h_SimConvTwoMTracks_[3] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks: simulated Z",zBin,zMin, zMax);
355  histname = "h_SimConvTwoMTracksEt";
356  h_SimConvTwoMTracks_[4] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks: simulated Et",etBin,etMin, etMax);
357  //
358  histname = "h_SimConvTwoTracksEta";
359  h_SimConvTwoTracks_[0] = iBooker.book1D(histname," All vis conversions with 2 reco tracks: simulated #eta",etaBin2,etaMin, etaMax);
360  histname = "h_SimConvTwoTracksPhi";
361  h_SimConvTwoTracks_[1] = iBooker.book1D(histname," All vis conversions with 2 reco tracks: simulated #phi",phiBin,phiMin, phiMax);
362  histname = "h_SimConvTwoTracksR";
363  h_SimConvTwoTracks_[2] = iBooker.book1D(histname," All vis conversions with 2 reco tracks: simulated R",rBin,rMin, rMax);
364  histname = "h_SimConvTwoTracksZ";
365  h_SimConvTwoTracks_[3] = iBooker.book1D(histname," All vis conversions with 2 reco tracks: simulated Z",zBin,zMin, zMax);
366  histname = "h_SimConvTwoTracksEt";
367  h_SimConvTwoTracks_[4] = iBooker.book1D(histname," All vis conversions with 2 reco tracks: simulated Et",etBin,etMin, etMax);
368  //
369  histname = "h_SimConvOneMTracksEta";
370  h_SimConvOneMTracks_[0] = iBooker.book1D(histname," All vis conversions with 1 reco-matching tracks: simulated #eta",etaBin2,etaMin, etaMax);
371  histname = "h_SimConvOneMTracksPhi";
372  h_SimConvOneMTracks_[1] = iBooker.book1D(histname," All vis conversions with 1 reco-matching tracks: simulated #phi",phiBin,phiMin, phiMax);
373  histname = "h_SimConvOneMTracksR";
374  h_SimConvOneMTracks_[2] = iBooker.book1D(histname," All vis conversions with 1 reco-matching tracks: simulated R",rBin,rMin, rMax);
375  histname = "h_SimConvOneMTracksZ";
376  h_SimConvOneMTracks_[3] = iBooker.book1D(histname," All vis conversions with 1 reco-matching tracks: simulated Z",zBin,zMin, zMax);
377  histname = "h_SimConvOneMTracksEt";
378  h_SimConvOneMTracks_[4] = iBooker.book1D(histname," All vis conversions with 1 reco-matching tracks: simulated Et",etBin,etMin, etMax);
379  //
380  histname = "h_SimConvTwoMTracksEtaAndVtxPGT0";
381  h_SimConvTwoMTracksAndVtxPGT0_[0] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #eta",etaBin2,etaMin, etaMax);
382  histname = "h_SimConvTwoMTracksPhiAndVtxPGT0";
383  h_SimConvTwoMTracksAndVtxPGT0_[1] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #phi",phiBin,phiMin, phiMax);
384  histname = "h_SimConvTwoMTracksRAndVtxPGT0";
385  h_SimConvTwoMTracksAndVtxPGT0_[2] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated R",rBin,rMin, rMax);
386  histname = "h_SimConvTwoMTracksZAndVtxPGT0";
387  h_SimConvTwoMTracksAndVtxPGT0_[3] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Z",zBin,zMin, zMax);
388  histname = "h_SimConvTwoMTracksEtAndVtxPGT0";
389  h_SimConvTwoMTracksAndVtxPGT0_[4] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Et",etBin,etMin, etMax);
390  //
391  histname = "h_SimConvTwoMTracksEtaAndVtxPGT0005";
392  h_SimConvTwoMTracksAndVtxPGT0005_[0] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #eta",etaBin2,etaMin, etaMax);
393  histname = "h_SimConvTwoMTracksPhiAndVtxPGT0005";
394  h_SimConvTwoMTracksAndVtxPGT0005_[1] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated #phi",phiBin,phiMin, phiMax);
395  histname = "h_SimConvTwoMTracksRAndVtxPGT0005";
396  h_SimConvTwoMTracksAndVtxPGT0005_[2] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated R",rBin,rMin, rMax);
397  histname = "h_SimConvTwoMTracksZAndVtxPGT0005";
398  h_SimConvTwoMTracksAndVtxPGT0005_[3] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Z",zBin,zMin, zMax);
399  histname = "h_SimConvTwoMTracksEtAndVtxPGT0005";
400  h_SimConvTwoMTracksAndVtxPGT0005_[4] = iBooker.book1D(histname," All vis conversions with 2 reco-matching tracks + vertex: simulated Et",etBin,etMin, etMax);
401 
402 
403 
404  if ( ! isRunCentrally_ ) {
405  h_SimConvEtaPix_[0] = iBooker.book1D("simConvEtaPix"," sim converted Photon Eta: Pix ",etaBin,etaMin, etaMax) ;
406  h_simTkPt_ = iBooker.book1D("simTkPt","Sim conversion tracks pt ",etBin*3,0.,etMax);
407  h_simTkEta_ = iBooker.book1D("simTkEta","Sim conversion tracks eta ",etaBin,etaMin,etaMax);
408  h_simConvVtxRvsZ_[0] = iBooker.book2D("simConvVtxRvsZAll"," Photon Sim conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
409  h_simConvVtxRvsZ_[1] = iBooker.book2D("simConvVtxRvsZBarrel"," Photon Sim conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
410  h_simConvVtxRvsZ_[2] = iBooker.book2D("simConvVtxRvsZEndcap"," Photon Sim conversion vtx position",zBin2ForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
411  h_simConvVtxYvsX_ = iBooker.book2D("simConvVtxYvsXTrkBarrel"," Photon Sim conversion vtx position, (x,y) eta<1 ",100, -80., 80., 100, -80., 80.);
412  }
413 
415  histname = "h_SimJetEta";
416  h_SimJet_[0] = iBooker.book1D(histname," Jet bkg simulated #eta",etaBin,etaMin, etaMax);
417  histname = "h_SimJetPhi";
418  h_SimJet_[1] = iBooker.book1D(histname," Jet bkg simulated #phi",phiBin,phiMin, phiMax);
419  histname = "h_SimJetEt";
420  h_SimJet_[2] = iBooker.book1D(histname," Jet bkg simulated Et",etBin,etMin, etMax);
421  //
422  histname = "h_MatchedSimJetEta";
423  h_MatchedSimJet_[0] = iBooker.book1D(histname," Matching jet simulated #eta",etaBin,etaMin, etaMax);
424  histname = "h_MatchedSimJetPhi";
425  h_MatchedSimJet_[1] = iBooker.book1D(histname," Matching jet simulated #phi",phiBin,phiMin, phiMax);
426  histname = "h_MatchedSimJetEt";
427  h_MatchedSimJet_[2] = iBooker.book1D(histname," Matching jet simulated Et",etBin,etMin, etMax);
428  //
429  histname = "h_MatchedSimJetBadChEta";
430  h_MatchedSimJetBadCh_[0] = iBooker.book1D(histname," Matching jet simulated #eta",etaBin,etaMin, etaMax);
431  histname = "h_MatchedSimJetBadChPhi";
432  h_MatchedSimJetBadCh_[1] = iBooker.book1D(histname," Matching jet simulated #phi",phiBin,phiMin, phiMax);
433  histname = "h_MatchedSimJetBadChEt";
434  h_MatchedSimJetBadCh_[2] = iBooker.book1D(histname," Matching jet simulated Et",etBin,etMin, etMax);
435 
436 
437  iBooker.setCurrentFolder("EgammaV/"+fName_+"/Background");
438 
439  histname = "nOfPhotons";
440  h_nPho_ = iBooker.book1D(histname,"# of Reco photons per event ",20,-0.5,19.5);
441 
442  h_scBkgEta_ = iBooker.book1D("scBkgEta"," SC Bkg Eta ",etaBin,etaMin, etaMax) ;
443  h_scBkgPhi_ = iBooker.book1D("scBkgPhi"," SC Bkg Phi ",phiBin,phiMin,phiMax) ;
444  //
445  h_phoBkgEta_ = iBooker.book1D("phoBkgEta"," Photon Bkg Eta ",etaBin,etaMin, etaMax) ;
446  h_phoBkgPhi_ = iBooker.book1D("phoBkgPhi"," Photon Bkg Phi ",phiBin,phiMin,phiMax) ;
447  //
448  h_phoBkgDEta_ = iBooker.book1D("phoBkgDEta"," Photon Eta(rec)-Eta(true) ",dEtaBin,dEtaMin, dEtaMax) ;
449  h_phoBkgDPhi_ = iBooker.book1D("phoBkgDPhi"," Photon Phi(rec)-Phi(true) ",dPhiBin,dPhiMin,dPhiMax) ;
450  //
451  histname = "phoBkgE";
452  h_phoBkgE_[0]=iBooker.book1D(histname+"All"," Photon Bkg Energy: All ecal ", eBin,eMin, eMax);
453  h_phoBkgE_[1]=iBooker.book1D(histname+"Barrel"," Photon Bkg Energy: barrel ",eBin,eMin, eMax);
454  h_phoBkgE_[2]=iBooker.book1D(histname+"Endcap"," Photon Bkg Energy: Endcap ",eBin,eMin, eMax);
455  //
456  histname = "phoBkgEt";
457  h_phoBkgEt_[0] = iBooker.book1D(histname+"All"," Photon Bkg Transverse Energy: All ecal ", etBin,etMin, etMax);
458  h_phoBkgEt_[1] = iBooker.book1D(histname+"Barrel"," Photon Bkg Transverse Energy: Barrel ",etBin,etMin, etMax);
459  h_phoBkgEt_[2] = iBooker.book1D(histname+"Endcap"," Photon BkgTransverse Energy: Endcap ",etBin,etMin, etMax);
460 
461  //
462  histname = "scBkgE";
463  h_scBkgE_[0] = iBooker.book1D(histname+"All"," SC bkg Energy: All Ecal ",eBin,eMin, eMax);
464  h_scBkgE_[1] = iBooker.book1D(histname+"Barrel"," SC bkg Energy: Barrel ",eBin,eMin, eMax);
465  h_scBkgE_[2] = iBooker.book1D(histname+"Endcap"," SC bkg Energy: Endcap ",eBin,eMin, eMax);
466  histname = "scBkgEt";
467  h_scBkgEt_[0] = iBooker.book1D(histname+"All"," SC bkg Et: All Ecal ",eBin,eMin, eMax);
468  h_scBkgEt_[1] = iBooker.book1D(histname+"Barrel"," SC bkg Et: Barrel ",eBin,eMin, eMax);
469  h_scBkgEt_[2] = iBooker.book1D(histname+"Endcap"," SC bkg Et: Endcap ",eBin,eMin, eMax);
470  //
471  histname = "r9Bkg";
472  h_r9Bkg_[0] = iBooker.book1D(histname+"All", " r9 bkg: All Ecal",r9Bin,r9Min, r9Max) ;
473  h_r9Bkg_[1] = iBooker.book1D(histname+"Barrel"," r9 bkg: Barrel ",r9Bin,r9Min, r9Max) ;
474  h_r9Bkg_[2] = iBooker.book1D(histname+"Endcap"," r9 bkg: Endcap ",r9Bin,r9Min, r9Max) ;
475  //
476  histname="R9VsEtaBkg";
477  if ( ! isRunCentrally_ ) h2_r9VsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
478  //
479  histname="R9VsEtBkg";
480  if ( ! isRunCentrally_ ) h2_r9VsEtBkg_ = iBooker.book2D(histname+"All"," Bkg photons r9 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
481  //
482  histname = "r1Bkg";
483  h_r1Bkg_[0] = iBooker.book1D(histname+"All", " Bkg photon e1x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
484  h_r1Bkg_[1] = iBooker.book1D(histname+"Barrel"," Bkg photon e1x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
485  h_r1Bkg_[2] = iBooker.book1D(histname+"Endcap"," Bkg photon e1x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
486  //
487  histname="R1VsEtaBkg";
488  if ( ! isRunCentrally_ ) h2_r1VsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg photons e1x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
489  histname="pR1VsEtaBkg";
490  if ( ! isRunCentrally_ ) p_r1VsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons e1x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
491  //
492  histname="R1VsEtBkg";
493  if ( ! isRunCentrally_ ) h2_r1VsEtBkg_ = iBooker.book2D(histname+"All"," Bkg photons e1x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
494  histname="pR1VsEtBkg";
495  if ( ! isRunCentrally_ ) p_r1VsEtBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons e2x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
496  //
497  histname = "r2Bkg";
498  h_r2Bkg_[0] = iBooker.book1D(histname+"All", " Bkg photon e2x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
499  h_r2Bkg_[1] = iBooker.book1D(histname+"Barrel"," Bkg photon e2x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
500  h_r2Bkg_[2] = iBooker.book1D(histname+"Endcap"," Bkg photon e2x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
501  //
502  histname="R2VsEtaBkg";
503  if ( ! isRunCentrally_ ) h2_r2VsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg photons e2x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
504  histname="pR2VsEtaBkg";
505  if ( ! isRunCentrally_ ) p_r2VsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons e2x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
506  //
507  histname="R2VsEtBkg";
508  if ( ! isRunCentrally_ ) h2_r2VsEtBkg_ = iBooker.book2D(histname+"All"," Bkg photons e2x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
509  histname="pR2VsEtBkg";
510  if ( ! isRunCentrally_ ) p_r2VsEtBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons e2x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
511 
512 
513  histname = "sigmaIetaIetaBkg";
514  h_sigmaIetaIetaBkg_[0] = iBooker.book1D(histname+"All", "Bkg sigmaIetaIeta: All Ecal",100,0., 0.1) ;
515  h_sigmaIetaIetaBkg_[1] = iBooker.book1D(histname+"Barrel","Bkg sigmaIetaIeta: Barrel ", 100,0., 0.05) ;
516  h_sigmaIetaIetaBkg_[2] = iBooker.book1D(histname+"Endcap","Bkg sigmaIetaIeta: Endcap ", 100,0., 0.1) ;
517  //
518  histname="sigmaIetaIetaVsEtaBkg";
519  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
520  histname="pSigmaIetaIetaVsEtaBkg";
521  if ( ! isRunCentrally_ ) p_sigmaIetaIetaVsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
522  //
523  histname="sigmaIetaIetaVsEtBkg";
524  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEtBkg_[0] = iBooker.book2D(histname+"All"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
525  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEtBkg_[1] = iBooker.book2D(histname+"Barrel"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
526  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEtBkg_[2] = iBooker.book2D(histname+"Endcap"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
527  //
528  histname="pSigmaIetaIetaVsEtBkg";
529  if ( ! isRunCentrally_ ) p_sigmaIetaIetaVsEtBkg_[0] = iBooker.bookProfile(histname+"All"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
530  if ( ! isRunCentrally_ ) p_sigmaIetaIetaVsEtBkg_[1] = iBooker.bookProfile(histname+"Barrel"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
531  if ( ! isRunCentrally_ ) p_sigmaIetaIetaVsEtBkg_[2] = iBooker.bookProfile(histname+"Endcap"," Bkg photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
532  //
533  histname = "hOverEBkg";
534  h_hOverEBkg_[0] = iBooker.book1D(histname+"All", "H/E bkg: All Ecal",100,0., 1.) ;
535  h_hOverEBkg_[1] = iBooker.book1D(histname+"Barrel","H/E bkg: Barrel ", 100,0., 1.) ;
536  h_hOverEBkg_[2] = iBooker.book1D(histname+"Endcap","H/E bkg: Endcap ", 100,0., 1.) ;
537  //
538  histname="pHOverEVsEtaBkg";
539  if ( ! isRunCentrally_ ) p_hOverEVsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg H/E vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
540  histname="pHOverEVsEtBkg";
541  if ( ! isRunCentrally_ ) p_hOverEVsEtBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
542  if ( ! isRunCentrally_ ) {
543  histname="hOverEVsEtaBkg";
544  h2_hOverEVsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg H/E vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
545  //
546  histname="hOverEVsEtBkg";
547  h2_hOverEVsEtBkg_ = iBooker.book2D(histname+"All"," Bkg photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
548  }
549  //
550  histname = "ecalRecHitSumEtConeDR04Bkg";
551  h_ecalRecHitSumEtConeDR04Bkg_[0] = iBooker.book1D(histname+"All", "bkg ecalRecHitSumEtDR04: All Ecal",etBin,etMin,50.);
552  h_ecalRecHitSumEtConeDR04Bkg_[1] = iBooker.book1D(histname+"Barrel","bkg ecalRecHitSumEtDR04: Barrel ", etBin,etMin,50.);
553  h_ecalRecHitSumEtConeDR04Bkg_[2] = iBooker.book1D(histname+"Endcap","bkg ecalRecHitSumEtDR04: Endcap ", etBin,etMin,50.);
554  //
555  if ( ! isRunCentrally_ ) {
556  histname="ecalRecHitSumEtConeDR04VsEtaBkg";
557  h2_ecalRecHitSumEtConeDR04VsEtaBkg_ = iBooker.book2D(histname+"All"," bkg ecalRecHitSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale);
558  histname="ecalRecHitSumEtConeDR04VsEtBkg";
559  h2_ecalRecHitSumEtConeDR04VsEtBkg_[0] = iBooker.book2D(histname+"All"," Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
560  h2_ecalRecHitSumEtConeDR04VsEtBkg_[1] = iBooker.book2D(histname+"Barrel"," Bkg ecalRecHitSumEtDR04 vs Et: Barrel ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
561  h2_ecalRecHitSumEtConeDR04VsEtBkg_[2] = iBooker.book2D(histname+"Endcap"," Bkg ecalRecHitSumEtDR04 vs Et: Endcap ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
562  histname="hcalTowerSumEtConeDR04VsEtaBkg";
563  h2_hcalTowerSumEtConeDR04VsEtaBkg_ = iBooker.book2D(histname+"All"," bkg hcalTowerSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale);
564  histname="hcalTowerSumEtConeDR04VsEtBkg";
565  h2_hcalTowerSumEtConeDR04VsEtBkg_[0] = iBooker.book2D(histname+"All"," Bkg hcalTowerSumEtDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
566  h2_hcalTowerSumEtConeDR04VsEtBkg_[1] = iBooker.book2D(histname+"Barrel"," Bkg hcalTowerSumEtDR04 vs Et: Barrel ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
567  h2_hcalTowerSumEtConeDR04VsEtBkg_[2] = iBooker.book2D(histname+"Endcap"," Bkg hcalTowerSumEtDR04 vs Et: Endcap ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
568  }
569 
570  histname="pEcalRecHitSumEtConeDR04VsEtaBkg";
571  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEtaBkg_ = iBooker.bookProfile(histname+"All","bkg photons ecalRecHitSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale, "");
572  //
573  histname="pEcalRecHitSumEtConeDR04VsEtBkg";
574  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname+"All","Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
575  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname+"Barrel","Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
576  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname+"Endcap","Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
577  //
578  histname = "hcalTowerSumEtConeDR04Bkg";
579  h_hcalTowerSumEtConeDR04Bkg_[0] = iBooker.book1D(histname+"All", "bkg hcalTowerSumEtDR04: All Ecal",etBin,etMin,20.);
580  h_hcalTowerSumEtConeDR04Bkg_[1] = iBooker.book1D(histname+"Barrel","bkg hcalTowerSumEtDR04: Barrel ", etBin,etMin,20.);
581  h_hcalTowerSumEtConeDR04Bkg_[2] = iBooker.book1D(histname+"Endcap","bkg hcalTowerSumEtDR04: Endcap ", etBin,etMin,20.);
582  //
583  histname="pHcalTowerSumEtConeDR04VsEtaBkg";
584  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEtaBkg_ = iBooker.bookProfile(histname+"All","bkg photons hcalTowerSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale, "");
585  //
586  histname="pHcalTowerSumEtConeDR04VsEtBkg";
587  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname+"All","Bkg hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
588  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname+"Barrel","Bkg hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
589  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname+"Endcap","Bkg hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
590  //
591  histname = "isoTrkSolidConeDR04Bkg";
592  h_isoTrkSolidConeDR04Bkg_[0] = iBooker.book1D(histname+"All", "isoTrkSolidConeDR04 Bkg: All Ecal",etBin,etMin,etMax*0.1);
593  h_isoTrkSolidConeDR04Bkg_[1] = iBooker.book1D(histname+"Barrel","isoTrkSolidConeDR04 Bkg: Barrel ", etBin,etMin,etMax*0.1);
594  h_isoTrkSolidConeDR04Bkg_[2] = iBooker.book1D(histname+"Endcap","isoTrkSolidConeDR04 Bkg: Endcap ", etBin,etMin,etMax*0.1);
595  //
596  histname="isoTrkSolidConeDR04VsEtaBkg";
597  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg photons isoTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1);
598  histname="pIsoTrkSolidConeDR04VsEtaBkg";
599  if ( ! isRunCentrally_ ) p_isoTrkSolidConeDR04VsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons isoTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1);
600  //
601  histname="isoTrkSolidConeDR04VsEtBkg";
602  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEtBkg_[0] = iBooker.book2D(histname+"All"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
603  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEtBkg_[1] = iBooker.book2D(histname+"Barrel"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
604  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEtBkg_[2] = iBooker.book2D(histname+"Endcap"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
605  histname="pIsoTrkSolidConeDR04VsEtBkg";
606  if ( ! isRunCentrally_ ) p_isoTrkSolidConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname+"All"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
607  if ( ! isRunCentrally_ ) p_isoTrkSolidConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname+"Barrel"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
608  if ( ! isRunCentrally_ ) p_isoTrkSolidConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname+"Endcap"," Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
609  //
610  histname = "nTrkSolidConeDR04Bkg";
611  h_nTrkSolidConeDR04Bkg_[0] = iBooker.book1D(histname+"All", "Bkg nTrkSolidConeDR04: All Ecal",20,0., 20) ;
612  h_nTrkSolidConeDR04Bkg_[1] = iBooker.book1D(histname+"Barrel","Bkg nTrkSolidConeDR04: Barrel ", 20,0., 20) ;
613  h_nTrkSolidConeDR04Bkg_[2] = iBooker.book1D(histname+"Endcap","Bkg nTrkSolidConeDR04: Endcap ", 20,0., 20) ;
614  //
615  histname="nTrkSolidConeDR04VsEtaBkg";
616  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEtaBkg_ = iBooker.book2D(histname+"All"," Bkg photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, 20,0., 20) ;
617  histname="p_nTrkSolidConeDR04VsEtaBkg";
618  if ( ! isRunCentrally_ ) p_nTrkSolidConeDR04VsEtaBkg_ = iBooker.bookProfile(histname+"All"," Bkg photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, 20,0., 20) ;
619  //
620  histname="nTrkSolidConeDR04VsEtBkg";
621  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEtBkg_[0] = iBooker.book2D(histname+"All","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
622  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEtBkg_[1] = iBooker.book2D(histname+"Barrel","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
623  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEtBkg_[2] = iBooker.book2D(histname+"Endcap","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
624  //
625  histname="pnTrkSolidConeDR04VsEtBkg";
626  if ( ! isRunCentrally_ ) p_nTrkSolidConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname+"All","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
627  if ( ! isRunCentrally_ ) p_nTrkSolidConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname+"Barrel","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
628  if ( ! isRunCentrally_ ) p_nTrkSolidConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname+"Endcap","Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
629  //
630  h_convEtaBkg_ = iBooker.book1D("convEtaBkg"," converted Photon Bkg Eta 2 tracks",etaBin,etaMin, etaMax) ;
631  h_convPhiBkg_ = iBooker.book1D("convPhiBkg"," converted Photon Bkg Phi ",phiBin,phiMin,phiMax) ;
632  //
633  histname="mvaOutBkg";
634  h_mvaOutBkg_[0] = iBooker.book1D(histname+"All"," mvaOut conversions bkg : All Ecal",100, 0., 1.);
635  h_mvaOutBkg_[1] = iBooker.book1D(histname+"Barrel"," mvaOut conversions bkg: Barrel Ecal",100, 0., 1.);
636  h_mvaOutBkg_[2] = iBooker.book1D(histname+"Endcap"," mvaOut conversions bkg: Endcap Ecal",100, 0., 1.);
637 
638  histname="PoverEtracksBkg";
639  h_PoverETracksBkg_[0] = iBooker.book1D(histname+"All"," bkg photons conversion p/E: all Ecal ",povereBin, povereMin, povereMax);
640  h_PoverETracksBkg_[1] = iBooker.book1D(histname+"Barrel","bkg photons conversion p/E: Barrel Ecal",povereBin, povereMin, povereMax);
641  h_PoverETracksBkg_[2] = iBooker.book1D(histname+"Endcap"," bkg photons conversion p/E: Endcap Ecal ",povereBin, povereMin, povereMax);
642 
643  histname="EoverPtracksBkg";
644  h_EoverPTracksBkg_[0] = iBooker.book1D(histname+"All"," bkg photons conversion E/p: all Ecal ",eoverpBin, eoverpMin, eoverpMax);
645  h_EoverPTracksBkg_[1] = iBooker.book1D(histname+"Barrel","bkg photons conversion E/p: Barrel Ecal",eoverpBin, eoverpMin, eoverpMax);
646  h_EoverPTracksBkg_[2] = iBooker.book1D(histname+"Endcap"," bkg photons conversion E/p: Endcap Ecal ",eoverpBin, eoverpMin, eoverpMax);
647 
648  histname="hDCotTracksBkg";
649  h_DCotTracksBkg_[0]= iBooker.book1D(histname+"All"," bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
650  h_DCotTracksBkg_[1]= iBooker.book1D(histname+"Barrel"," bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
651  h_DCotTracksBkg_[2]= iBooker.book1D(histname+"Endcap"," bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
652 
653  histname="hDPhiTracksAtVtxBkg";
654  h_DPhiTracksAtVtxBkg_[0] =iBooker.book1D(histname+"All", " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
655  h_DPhiTracksAtVtxBkg_[1] =iBooker.book1D(histname+"Barrel", " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
656  h_DPhiTracksAtVtxBkg_[2] =iBooker.book1D(histname+"Endcap", " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
657 
658  if ( ! isRunCentrally_ ) {
659  h_convVtxRvsZBkg_[0] = iBooker.book2D("convVtxRvsZAllBkg"," Bkg Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
660  h_convVtxRvsZBkg_[1] = iBooker.book2D("convVtxRvsZBarrelBkg"," Bkg Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
661  h_convVtxYvsXBkg_ = iBooker.book2D("convVtxYvsXTrkBarrelBkg"," Bkg Photon Reco conversion vtx position, (x,y) eta<1 ",100, -80., 80., 100, -80., 80.);
662  }
663 
664  //
665  iBooker.setCurrentFolder("EgammaV/"+fName_+"/Photons");
666 
667  histname="nOfflineVtx";
668  h_nRecoVtx_ = iBooker.book1D(histname,"# of Offline Vertices",80, -0.5, 79.5);
669 
670  h_phoEta_[0] = iBooker.book1D("phoEta"," Photon Eta ",etaBin,etaMin, etaMax) ;
671  h_phoPhi_[0] = iBooker.book1D("phoPhi"," Photon Phi ",phiBin,phiMin,phiMax) ;
672 
673  h_phoDEta_[0] = iBooker.book1D("phoDEta"," Photon Eta(rec)-Eta(true) ",dEtaBin,dEtaMin, dEtaMax) ;
674  h_phoDPhi_[0] = iBooker.book1D("phoDPhi"," Photon Phi(rec)-Phi(true) ",dPhiBin,dPhiMin,dPhiMax) ;
675 
676  h_scEta_[0] = iBooker.book1D("scEta"," SC Eta ",etaBin,etaMin, etaMax);
677  h_scPhi_[0] = iBooker.book1D("scPhi"," SC Phi ",phiBin,phiMin,phiMax);
678 
679  if ( ! isRunCentrally_ ) {
680  h_scEtaWidth_[0] = iBooker.book1D("scEtaWidth"," SC Eta Width ",100,0., 0.1);
681  h_scPhiWidth_[0] = iBooker.book1D("scPhiWidth"," SC Phi Width ",100,0., 1.);
682  }
683 
684  histname = "scE";
685  h_scE_[0][0] = iBooker.book1D(histname+"All"," SC Energy: All Ecal ",eBin,eMin, eMax);
686  h_scE_[0][1] = iBooker.book1D(histname+"Barrel"," SC Energy: Barrel ",eBin,eMin, eMax);
687  h_scE_[0][2] = iBooker.book1D(histname+"Endcap"," SC Energy: Endcap ",eBin,eMin, eMax);
688 
689  histname = "psE";
690  h_psE_ = iBooker.book1D(histname+"Endcap"," ES Energy ",eBin,eMin, 50.);
691 
692 
693  histname = "scEt";
694  h_scEt_[0][0] = iBooker.book1D(histname+"All"," SC Et: All Ecal ",etBin,etMin, etMax) ;
695  h_scEt_[0][1] = iBooker.book1D(histname+"Barrel"," SC Et: Barrel",etBin,etMin, etMax) ;
696  h_scEt_[0][2] = iBooker.book1D(histname+"Endcap"," SC Et: Endcap",etBin,etMin, etMax) ;
697 
698  histname = "r9";
699  h_r9_[0][0] = iBooker.book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
700  h_r9_[0][1] = iBooker.book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
701  h_r9_[0][2] = iBooker.book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
702  //
703 
704  if ( ! isRunCentrally_ ) {
705  histname = "r9ConvFromMC";
706  h_r9_[1][0] = iBooker.book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
707  h_r9_[1][1] = iBooker.book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
708  h_r9_[1][2] = iBooker.book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
709  //
710  histname = "r9ConvFromReco";
711  h_r9_[2][0] = iBooker.book1D(histname+"All", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
712  h_r9_[2][1] = iBooker.book1D(histname+"Barrel"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
713  h_r9_[2][2] = iBooker.book1D(histname+"Endcap"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
715  histname = "EtR9Less093";
716  h_EtR9Less093_[0][0] = iBooker.book1D(histname+"All", " r9 < 0.94 or 0.95 : All Ecal",etBin,etMin, etMax);
717  h_EtR9Less093_[0][1] = iBooker.book1D(histname+"Barrel"," r9 < 0.94 : Barrel ",etBin,etMin, etMax);
718  h_EtR9Less093_[0][2] = iBooker.book1D(histname+"Endcap"," r9 < 0.95 : Endcap ",etBin,etMin, etMax);
719  histname = "EtR9Less093Conv";
720  h_EtR9Less093_[1][0] = iBooker.book1D(histname+"All", " r9 < 0.94, 0.95 and good conv : All Ecal",etBin,etMin, etMax);
721  h_EtR9Less093_[1][1] = iBooker.book1D(histname+"Barrel"," r9 < 0.94 and good conv : Barrel ",etBin,etMin, etMax);
722  h_EtR9Less093_[1][2] = iBooker.book1D(histname+"Endcap"," r9 < 0.95 and good conv : Endcap ",etBin,etMin, etMax);
723  }
724 
726  histname="pR9VsEta";
727  p_r9VsEta_[0] = iBooker.bookProfile(histname+"All"," All photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
728  p_r9VsEta_[1] = iBooker.bookProfile(histname+"Unconv"," Unconv photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
729  p_r9VsEta_[2] = iBooker.bookProfile(histname+"Conv"," Conv photons r9 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
730  //
731  histname="R9VsEt";
732  if ( ! isRunCentrally_ ) h2_r9VsEt_[0] = iBooker.book2D(histname+"All"," All photons r9 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
733  if ( ! isRunCentrally_ ) h2_r9VsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons r9 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
734  //
735  histname = "r1";
736  h_r1_[0][0] = iBooker.book1D(histname+"All", " e1x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
737  h_r1_[0][1] = iBooker.book1D(histname+"Barrel"," e1x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
738  h_r1_[0][2] = iBooker.book1D(histname+"Endcap"," e1x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
739  //
740  histname="R1VsEta";
741  if ( ! isRunCentrally_ ) h2_r1VsEta_[0] = iBooker.book2D(histname+"All"," All photons e1x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
742  if ( ! isRunCentrally_ ) h2_r1VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons e1x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
743  //
744  histname="R1VsEt";
745  if ( ! isRunCentrally_ ) h2_r1VsEt_[0] = iBooker.book2D(histname+"All"," All photons e1x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
746  if ( ! isRunCentrally_ ) h2_r1VsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons e1x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
747  //
748  histname = "r2";
749  h_r2_[0][0] = iBooker.book1D(histname+"All", " e2x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
750  h_r2_[0][1] = iBooker.book1D(histname+"Barrel"," e2x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
751  h_r2_[0][2] = iBooker.book1D(histname+"Endcap"," e2x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
752  //
753  histname="R2VsEta";
754  if ( ! isRunCentrally_ ) h2_r2VsEta_[0] = iBooker.book2D(histname+"All"," All photons e2x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
755  if ( ! isRunCentrally_ ) h2_r2VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons e2x5/e5x5 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,1.1);
756  //
757  histname="R2VsEt";
758  if ( ! isRunCentrally_ ) h2_r2VsEt_[0] = iBooker.book2D(histname+"All"," All photons e2x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
759  if ( ! isRunCentrally_ ) h2_r2VsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons e2x5/e5x5 vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,1.1);
760  //
761  histname = "sigmaIetaIeta";
762  h_sigmaIetaIeta_[0][0] = iBooker.book1D(histname+"All", "sigmaIetaIeta: All Ecal",100,0., 0.1) ;
763  h_sigmaIetaIeta_[0][1] = iBooker.book1D(histname+"Barrel","sigmaIetaIeta: Barrel ", 100,0., 0.05) ;
764  h_sigmaIetaIeta_[0][2] = iBooker.book1D(histname+"Endcap","sigmaIetaIeta: Endcap ", 100,0., 0.1) ;
765  //
766  histname="sigmaIetaIetaVsEta";
767  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEta_[0] = iBooker.book2D(histname+"All"," All photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
768  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons sigmaIetaIeta vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,0.1);
769  //
770  histname="sigmaIetaIetaVsEt";
771  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEt_[0] = iBooker.book2D(histname+"All"," All photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
772  if ( ! isRunCentrally_ ) h2_sigmaIetaIetaVsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons sigmaIetaIeta vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
773  //
774  histname = "hOverE";
775  h_hOverE_[0][0] = iBooker.book1D(histname+"All", "H/E: All Ecal",100,0., 0.1) ;
776  h_hOverE_[0][1] = iBooker.book1D(histname+"Barrel","H/E: Barrel ", 100,0., 0.1) ;
777  h_hOverE_[0][2] = iBooker.book1D(histname+"Endcap","H/E: Endcap ", 100,0., 0.1) ;
778  //
779  histname = "newhOverE";
780  h_newhOverE_[0][0] = iBooker.book1D(histname+"All", "new H/E: All Ecal",100,0., 0.1) ;
781  h_newhOverE_[0][1] = iBooker.book1D(histname+"Barrel","new H/E: Barrel ", 100,0., 0.1) ;
782  h_newhOverE_[0][2] = iBooker.book1D(histname+"Endcap","new H/E: Endcap ", 100,0., 0.1) ;
783 
784  //
785  if ( ! isRunCentrally_ ) {
786  histname="hOverEVsEta";
787  h2_hOverEVsEta_[0] = iBooker.book2D(histname+"All"," All photons H/E vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
788  h2_hOverEVsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons H/E vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,0.1);
789  //
790  histname="hOverEVsEt";
791  h2_hOverEVsEt_[0] = iBooker.book2D(histname+"All"," All photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
792  h2_hOverEVsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
793  //
794  }
795  histname="pHoverEVsEta";
796  p_hOverEVsEta_[0] = iBooker.bookProfile(histname+"All"," All photons H/E vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
797  p_hOverEVsEta_[1] = iBooker.bookProfile(histname+"Unconv"," All photons H/E vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,0.1);
798  //
799  histname="pHoverEVsEt";
800  p_hOverEVsEt_[0] = iBooker.bookProfile(histname+"All"," All photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
801  p_hOverEVsEt_[1] = iBooker.bookProfile(histname+"Unconv"," All photons H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
802  //
803  histname="pnewHoverEVsEta";
804  p_newhOverEVsEta_[0] = iBooker.bookProfile(histname+"All"," All photons new H/E vs #eta: all Ecal ", etaBin2,etaMin, etaMax,100, 0.,0.1);
805  p_newhOverEVsEta_[1] = iBooker.bookProfile(histname+"Unconv"," All photons new H/E vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0.,0.1);
806  //
807  histname="pnewHoverEVsEt";
808  p_newhOverEVsEt_[0] = iBooker.bookProfile(histname+"All"," All photons new H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
809  p_newhOverEVsEt_[1] = iBooker.bookProfile(histname+"Unconv"," All photons new H/E vs Et: all Ecal ",etBin,etMin, etMax,100, 0.,0.1);
810  //
811  histname = "ecalRecHitSumEtConeDR04";
812  h_ecalRecHitSumEtConeDR04_[0][0] = iBooker.book1D(histname+"All", "ecalRecHitSumEtDR04: All Ecal",etBin,etMin,20.);
813  h_ecalRecHitSumEtConeDR04_[0][1] = iBooker.book1D(histname+"Barrel","ecalRecHitSumEtDR04: Barrel ", etBin,etMin,20.);
814  h_ecalRecHitSumEtConeDR04_[0][2] = iBooker.book1D(histname+"Endcap","ecalRecHitSumEtDR04: Endcap ", etBin,etMin,20.);
815  //
816 
817  if ( ! isRunCentrally_ ) {
818  histname="ecalRecHitSumEtConeDR04VsEta";
819  h2_ecalRecHitSumEtConeDR04VsEta_[0] = iBooker.book2D(histname+"All"," All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale);
820  h2_ecalRecHitSumEtConeDR04VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,etBin,etMin,etMax*etScale);
821  }
822  histname="pEcalRecHitSumEtConeDR04VsEta";
823  p_ecalRecHitSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname+"All","All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale, "");
824  p_ecalRecHitSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname+"Unconv","All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*etScale, "");
825  //
826  if ( ! isRunCentrally_ ) {
827  histname="ecalRecHitSumEtConeDR04VsEt";
828  h2_ecalRecHitSumEtConeDR04VsEt_[0] = iBooker.book2D(histname+"All"," All photons ecalRecHitSumEtDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
829  h2_ecalRecHitSumEtConeDR04VsEt_[1] = iBooker.book2D(histname+"Barrel"," All photons ecalRecHitSumEtDR04 vs Et: Barrel ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
830  h2_ecalRecHitSumEtConeDR04VsEt_[2] = iBooker.book2D(histname+"Endcap"," All photons ecalRecHitSumEtDR04 vs Et: Endcap ",etBin,etMin, etMax, etBin,etMin,etMax*etScale);
831  }
832  histname="pEcalRecHitSumEtConeDR04VsEt";
833  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname+"All","All photons ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
834  p_ecalRecHitSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname+"Barrel","All photons ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
835  p_ecalRecHitSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname+"Endcap","All photons ecalRecHitSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
836  //
837  histname = "hcalTowerSumEtConeDR04";
838  h_hcalTowerSumEtConeDR04_[0][0] = iBooker.book1D(histname+"All", "hcalTowerSumEtConeDR04: All Ecal",etBin,etMin,20.);
839  h_hcalTowerSumEtConeDR04_[0][1] = iBooker.book1D(histname+"Barrel","hcalTowerSumEtConeDR04: Barrel ", etBin,etMin,20.);
840  h_hcalTowerSumEtConeDR04_[0][2] = iBooker.book1D(histname+"Endcap","hcalTowerSumEtConeDR04: Endcap ", etBin,etMin,20.);
841  //
842  histname = "hcalTowerBcSumEtConeDR04";
843  if ( ! isRunCentrally_ ) h_hcalTowerBcSumEtConeDR04_[0][0] = iBooker.book1D(histname+"All", "hcalTowerBcSumEtConeDR04: All Ecal",etBin,etMin,20.);
844  h_hcalTowerBcSumEtConeDR04_[0][1] = iBooker.book1D(histname+"Barrel","hcalTowerBcSumEtConeDR04: Barrel ", etBin,etMin,20.);
845  h_hcalTowerBcSumEtConeDR04_[0][2] = iBooker.book1D(histname+"Endcap","hcalTowerBcSumEtConeDR04: Endcap ", etBin,etMin,20.);
846 
847  //
848  if ( ! isRunCentrally_ ) {
849  histname="hcalTowerSumEtConeDR04VsEta";
850  h2_hcalTowerSumEtConeDR04VsEta_[0] = iBooker.book2D(histname+"All"," All photons hcalTowerSumEtConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1);
851  h2_hcalTowerSumEtConeDR04VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons hcalTowerSumEtConeDR04 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,etBin,etMin,etMax*0.1);
852  }
853  histname="pHcalTowerSumEtConeDR04VsEta";
854  p_hcalTowerSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname+"All","All photons hcalTowerSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1, "");
855  p_hcalTowerSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname+"Unconv","All photons hcalTowerSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1, "");
856  histname="pHcalTowerBcSumEtConeDR04VsEta";
857  p_hcalTowerBcSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname+"All","All photons hcalTowerBcSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1, "");
858  p_hcalTowerBcSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname+"Unconv","All photons hcalTowerBcSumEtDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1, "");
859  //
860  if ( ! isRunCentrally_ ) {
861  histname="hcalTowerSumEtConeDR04VsEt";
862  h2_hcalTowerSumEtConeDR04VsEt_[0] = iBooker.book2D(histname+"All"," All photons hcalTowerSumEtConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
863  h2_hcalTowerSumEtConeDR04VsEt_[1] = iBooker.book2D(histname+"Barrel"," All photons hcalTowerSumEtConeDR04 vs Et: Barrel ",etBin,etMin, etMax,etBin,etMin,etMax*0.1);
864  h2_hcalTowerSumEtConeDR04VsEt_[2] = iBooker.book2D(histname+"Endcap"," All photons hcalTowerSumEtConeDR04 vs Et: Endcap ",etBin,etMin, etMax,etBin,etMin,etMax*0.1);
865  }
866  histname="pHcalTowerSumEtConeDR04VsEt";
867  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname+"All","All photons hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
868  p_hcalTowerSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname+"Barrel","All photons hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
869  p_hcalTowerSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname+"Endcap","All photons hcalTowerSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
870  //
871  histname="pHcalTowerBcSumEtConeDR04VsEt";
872  if ( ! isRunCentrally_ ) p_hcalTowerBcSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname+"All","All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
873  p_hcalTowerBcSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname+"Barrel","All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
874  p_hcalTowerBcSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname+"Endcap","All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ", etBin,etMin, etMax, etBin,etMin,etMax*etScale, "");
875 
876  //
877  histname = "isoTrkSolidConeDR04";
878  h_isoTrkSolidConeDR04_[0][0] = iBooker.book1D(histname+"All", "isoTrkSolidConeDR04: All Ecal",etBin,etMin,etMax*0.1);
879  h_isoTrkSolidConeDR04_[0][1] = iBooker.book1D(histname+"Barrel","isoTrkSolidConeDR04: Barrel ", etBin,etMin,etMax*0.1);
880  h_isoTrkSolidConeDR04_[0][2] = iBooker.book1D(histname+"Endcap","isoTrkSolidConeDR04: Endcap ", etBin,etMin,etMax*0.1);
881  //
882 
883  histname="isoTrkSolidConeDR04VsEta";
884  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEta_[0] = iBooker.book2D(histname+"All"," All photons isoTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, etBin,etMin,etMax*0.1);
885  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons isoTrkSolidConeDR04 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,etBin,etMin,etMax*0.1);
886 
887  //
888  histname="isoTrkSolidConeDR04VsEt";
889  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEt_[0] = iBooker.book2D(histname+"All"," All photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
890  if ( ! isRunCentrally_ ) h2_isoTrkSolidConeDR04VsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons isoTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, etBin,etMin,etMax*0.1);
891  //
892  histname = "nTrkSolidConeDR04";
893  h_nTrkSolidConeDR04_[0][0] = iBooker.book1D(histname+"All", "nTrkSolidConeDR04: All Ecal",20,0., 20) ;
894  h_nTrkSolidConeDR04_[0][1] = iBooker.book1D(histname+"Barrel","nTrkSolidConeDR04: Barrel ", 20,0., 20) ;
895  h_nTrkSolidConeDR04_[0][2] = iBooker.book1D(histname+"Endcap","nTrkSolidConeDR04: Endcap ", 20,0., 20) ;
896  //
897  histname="nTrkSolidConeDR04VsEta";
898  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEta_[0] = iBooker.book2D(histname+"All"," All photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2,etaMin, etaMax, 20,0., 20) ;
899  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEta_[1] = iBooker.book2D(histname+"Unconv"," All photons nTrkSolidConeDR04 vs #eta: all Ecal ",etaBin2,etaMin, etaMax,20,0., 20) ;
900  //
901  histname="nTrkSolidConeDR04VsEt";
902  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEt_[0] = iBooker.book2D(histname+"All"," All photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax, 20,0., 20) ;
903  if ( ! isRunCentrally_ ) h2_nTrkSolidConeDR04VsEt_[1] = iBooker.book2D(histname+"Unconv"," All photons nTrkSolidConeDR04 vs Et: all Ecal ",etBin,etMin, etMax,20,0., 20) ;
904  //
905  histname = "phoE";
906  h_phoE_[0][0]=iBooker.book1D(histname+"All"," Photon Energy: All ecal ", eBin,eMin, eMax);
907  h_phoE_[0][1]=iBooker.book1D(histname+"Barrel"," Photon Energy: barrel ",eBin,eMin, eMax);
908  h_phoE_[0][2]=iBooker.book1D(histname+"Endcap"," Photon Energy: Endcap ",eBin,eMin, eMax);
909 
910  histname = "phoEt";
911  h_phoEt_[0][0] = iBooker.book1D(histname+"All"," Photon Transverse Energy: All ecal ", etBin,etMin, etMax);
912  h_phoEt_[0][1] = iBooker.book1D(histname+"Barrel"," Photon Transverse Energy: Barrel ",etBin,etMin, etMax);
913  h_phoEt_[0][2] = iBooker.book1D(histname+"Endcap"," Photon Transverse Energy: Endcap ",etBin,etMin, etMax);
914 
915 
916  histname = "eRes";
917  h_phoERes_[0][0] = iBooker.book1D(histname+"All"," Photon E/E_{true}: All ecal; E/E_{true} (GeV)", resBin,resMin, resMax);
918  h_phoERes_[0][1] = iBooker.book1D(histname+"Barrel","Photon E/E_{true}: Barrel; E/E_{true} (GeV)",resBin,resMin, resMax);
919  h_phoERes_[0][2] = iBooker.book1D(histname+"Endcap"," Photon E/E_{true}: Endcap; E/E_{true} (GeV)",resBin,resMin, resMax);
920 
921  h_phoERes_[1][0] = iBooker.book1D(histname+"unconvAll"," Photon E/E_{true} if r9>0.94, 0.95: All ecal; E/E_{true} (GeV)", resBin,resMin, resMax);
922  h_phoERes_[1][1] = iBooker.book1D(histname+"unconvBarrel"," Photon E/E_{true} if r9>0.94: Barrel; E/E_{true} (GeV)",resBin,resMin, resMax);
923  h_phoERes_[1][2] = iBooker.book1D(histname+"unconvEndcap"," Photon E/E_{true} if r9>0.95: Endcap; E/E_{true} (GeV)",resBin,resMin, resMax);
924 
925  h_phoERes_[2][0] = iBooker.book1D(histname+"convAll"," Photon E/E_{true} if r9<0.0.94, 0.95: All ecal; E/E_{true} (GeV)", resBin,resMin, resMax);
926  h_phoERes_[2][1] = iBooker.book1D(histname+"convBarrel"," Photon E/E_{true} if r9<0.94: Barrel; E/E_{true} (GeV)",resBin,resMin, resMax);
927  h_phoERes_[2][2] = iBooker.book1D(histname+"convEndcap"," Photon E/E_{true} if r9<0.95: Endcap; E/E_{true} (GeV)",resBin,resMin, resMax);
928 
929 
930  histname = "sigmaEoE";
931  h_phoSigmaEoE_[0][0] = iBooker.book1D(histname+"All","#sigma_{E}/E: All ecal; #sigma_{E}/E", 100,0., 0.08);
932  h_phoSigmaEoE_[0][1] = iBooker.book1D(histname+"Barrel","#sigma_{E}/E: Barrel; #sigma_{E}/E",100,0., 0.08);
933  h_phoSigmaEoE_[0][2] = iBooker.book1D(histname+"Endcap","#sigma_{E}/E: Endcap, #sigma_{E}/E",100,0., 0.08);
934 
935  h_phoSigmaEoE_[1][0] = iBooker.book1D(histname+"unconvAll","#sigma_{E}/E if r9>0.94, 0.95: All ecal; #sigma_{E}/E", 100,0., 0.08);
936  h_phoSigmaEoE_[1][1] = iBooker.book1D(histname+"unconvBarrel","#sigma_{E}/E if r9>0.94: Barrel; #sigma_{E}/E",100,0., 0.08);
937  h_phoSigmaEoE_[1][2] = iBooker.book1D(histname+"unconvEndcap","#sigma_{E}/E r9>0.95: Endcap; #sigma_{E}/E",100,0., 0.08);
938 
939  h_phoSigmaEoE_[2][0] = iBooker.book1D(histname+"convAll","#sigma_{E}/E if r9<0.0.94, 0.95: All ecal, #sigma_{E}/E", 100,0., 0.08);
940  h_phoSigmaEoE_[2][1] = iBooker.book1D(histname+"convBarrel","#sigma_{E}/E if r9<0.94: Barrel, #sigma_{E}/E",100,0., 0.08);
941  h_phoSigmaEoE_[2][2] = iBooker.book1D(histname+"convEndcap","#sigma_{E}/E if r9<0.95: Endcap, #sigma_{E}/E",100,0., 0.08);
942 
943 
944 
945 
946  histname="eResVsEta";
947  if ( ! isRunCentrally_ ) h2_eResVsEta_[0] = iBooker.book2D(histname+"All"," All photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
948  if ( ! isRunCentrally_ ) h2_eResVsEta_[1] = iBooker.book2D(histname+"Unconv"," Unconv photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
949 
950  histname="pEResVsEta";
951  p_eResVsEta_[0] = iBooker.bookProfile(histname+"All","All photons E/Etrue vs #eta: all Ecal ",etaBin2,etaMin,etaMax,resBin,resMin, resMax,"");
952  p_eResVsEta_[1] = iBooker.bookProfile(histname+"Unconv","Unconv photons E/Etrue vs #eta: all Ecal",etaBin2,etaMin,etaMax,resBin,resMin, resMax,"");
953  p_eResVsEta_[2] = iBooker.bookProfile(histname+"Conv","Conv photons E/Etrue vs #eta: all Ecal",etaBin2,etaMin,etaMax,resBin,resMin, resMax,"");
954 
955  histname="pSigmaEoEVsEta";
956  p_sigmaEoEVsEta_[0] = iBooker.bookProfile(histname+"All","All photons: #sigma_{E}/E vs #eta: all Ecal; #eta; #sigma_{E}/E",etaBin2,etaMin,etaMax,100,0., 0.08,"");
957  p_sigmaEoEVsEta_[1] = iBooker.bookProfile(histname+"Unconv","Unconv photons #sigma_{E}/E vs #eta: all Ecal; #eta; #sigma_{E}/E ",etaBin2,etaMin,etaMax,100,0., 0.08, "");
958  p_sigmaEoEVsEta_[2] = iBooker.bookProfile(histname+"Conv","Conv photons #sigma_{E}/E vs #eta: all Ecal; #eta; #sigma_{E}/E",etaBin2,etaMin,etaMax, 100,0., 0.08, "");
959 
960 
961 
962  histname="pSigmaEoEVsEt";
963  p_sigmaEoEVsEt_[1][0] = iBooker.bookProfile(histname+"Barrel","All photons #sigma_{E}/E vs E_{T}: Barrel; E_{T} (GeV); #sigma_{E}/E ",etBin,etMin,etMax, 100,0., 0.08, "");
964  p_sigmaEoEVsEt_[1][1] = iBooker.bookProfile(histname+"unconvBarrel","Unconv photons #sigma_{E}/E vs E_{T}: Barrel; E_{T} (GeV); #sigma_{E}/E ",etBin,etMin,etMax, 100,0., 0.08, "");
965  p_sigmaEoEVsEt_[1][2] = iBooker.bookProfile(histname+"convBarrel","Conv photons #sigma_{E}/E vs E_{T}: Barrel; E_{T} (GeV); #sigma_{E}/E",etBin,etMin,etMax, 100,0., 0.08, "");
966  p_sigmaEoEVsEt_[2][0] = iBooker.bookProfile(histname+"Endcap","All photons #sigma_{E}/E vs E_{T}: Endcap; E_{T} (GeV); #sigma_{E}/E ",etBin,etMin,etMax, 100,0., 0.08, "");
967  p_sigmaEoEVsEt_[2][1] = iBooker.bookProfile(histname+"unconvEndcap","Unconv photons #sigma_{E}/E vs E_{T}: Endcap; E_{T} (GeV); #sigma_{E}/E ",etBin,etMin,etMax, 100,0., 0.08, "");
968  p_sigmaEoEVsEt_[2][2] = iBooker.bookProfile(histname+"convEndcap","Conv photons #sigma_{E}/E vs E_{T}: Endcap; E_{T} (GeV); #sigma_{E}/E",etBin,etMin,etMax, 100,0., 0.08, "");
969 
970 
971 
972  histname="pSigmaEoEVsNVtx";
973  p_sigmaEoEVsNVtx_[1][0] = iBooker.bookProfile(histname+"Barrel","All photons: #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E",80, -0.5, 79.5, 100,0., 0.08, "");
974  p_sigmaEoEVsNVtx_[1][1] = iBooker.bookProfile(histname+"unconvBarrel","Unconv photons #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E ",80, -0.5, 79.5, 100,0., 0.08, "");
975  p_sigmaEoEVsNVtx_[1][2] = iBooker.bookProfile(histname+"convBarrel","Conv photons #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E",80, -0.5, 79.5, 100,0., 0.08, "");
976  p_sigmaEoEVsNVtx_[2][0] = iBooker.bookProfile(histname+"Endcap","All photons: #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E",80, -0.5, 79.5, 100,0., 0.08, "");
977  p_sigmaEoEVsNVtx_[2][1] = iBooker.bookProfile(histname+"unconvEndcap","Unconv photons #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E ",80, -0.5, 79.5, 100,0., 0.08, "");
978  p_sigmaEoEVsNVtx_[2][2] = iBooker.bookProfile(histname+"convEndcap","Conv photons #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E",80, -0.5, 79.5, 100,0., 0.08, "");
979 
980 
981  if ( ! isRunCentrally_ ) {
982  histname="eResVsEt";
983  h2_eResVsEt_[0][0] = iBooker.book2D(histname+"All"," All photons E/Etrue vs true Et: all Ecal ",etBin,etMin, etMax,100, 0.9, 1.1);
984  h2_eResVsEt_[0][1] = iBooker.book2D(histname+"unconv"," All photons E/Etrue vs true Et: all Ecal ",etBin,etMin, etMax,100, 0.9, 1.1);
985  h2_eResVsEt_[0][2] = iBooker.book2D(histname+"conv"," All photons E/Etrue vs true Et: all Ecal ",etBin,etMin, etMax,100, 0.9, 1.1);
986  h2_eResVsEt_[1][0] = iBooker.book2D(histname+"Barrel"," All photons E/Etrue vs true Et: Barrel ",etBin,etMin, etMax,100, 0.9, 1.1);
987  h2_eResVsEt_[1][1] = iBooker.book2D(histname+"unconvBarrel"," All photons E/Etrue vs true Et: Barrel ",etBin,etMin, etMax,100, 0.9, 1.1);
988  h2_eResVsEt_[1][2] = iBooker.book2D(histname+"convBarrel"," All photons E/Etrue vs true Et: Barrel ",etBin,etMin, etMax,100, 0.9, 1.1);
989  h2_eResVsEt_[2][0] = iBooker.book2D(histname+"Endcap"," All photons E/Etrue vs true Et: Endcap ",etBin,etMin, etMax,100, 0.9, 1.1);
990  h2_eResVsEt_[2][1] = iBooker.book2D(histname+"unconvEndcap"," All photons E/Etrue vs true Et: Endcap ",etBin,etMin, etMax,100, 0.9, 1.1);
991  h2_eResVsEt_[2][2] = iBooker.book2D(histname+"convEndcap"," All photons E/Etrue vs true Et: Endcap ",etBin,etMin, etMax,100, 0.9, 1.1);
992  }
993 
994  histname="pEResVsEt";
995  p_eResVsEt_[0][0] = iBooker.bookProfile(histname+"All","All photons E/Etrue vs Et: all Ecal ",etBin,etMin,etMax,resBin,resMin, resMax,"");
996  p_eResVsEt_[0][1] = iBooker.bookProfile(histname+"unconv","All photons E/Etrue vs Et: all Ecal ",etBin,etMin,etMax,resBin,resMin, resMax,"");
997  p_eResVsEt_[0][2] = iBooker.bookProfile(histname+"conv","All photons E/Etrue vs Et: all Ecal ",etBin,etMin,etMax,resBin,resMin, resMax,"");
998  p_eResVsEt_[1][0] = iBooker.bookProfile(histname+"Barrel","All photons E/Etrue vs Et: Barrel ",etBin,etMin,etMax,resBin,resMin, resMax,"");
999  p_eResVsEt_[1][1] = iBooker.bookProfile(histname+"unconvBarrel","All photons E/Etrue vs Et: Barrel ",etBin,etMin,etMax,resBin,resMin, resMax,"");
1000  p_eResVsEt_[1][2] = iBooker.bookProfile(histname+"convBarrel","All photons E/Etrue vs Et: Barrel ",etBin,etMin,etMax,resBin,resMin, resMax,"");
1001  p_eResVsEt_[2][0] = iBooker.bookProfile(histname+"Endcap","All photons E/Etrue vs Et: Endcap ",etBin,etMin,etMax,resBin,resMin, resMax,"");
1002  p_eResVsEt_[2][1] = iBooker.bookProfile(histname+"unconvEndcap","All photons E/Etrue vs Et: Endcap ",etBin,etMin,etMax,resBin,resMin, resMax,"");
1003  p_eResVsEt_[2][2] = iBooker.bookProfile(histname+"convEndcap","All photons E/Etrue vs Et: Endcap ",etBin,etMin,etMax,resBin,resMin, resMax,"");
1004 
1005 
1006  histname="pEResVsNVtx";
1007  p_eResVsNVtx_[1][0] = iBooker.bookProfile(histname+"Barrel","All photons E/E_{true} vs N_{vtx}: Barrel; N_{vtx}; E}/E_{true}",80, -0.5, 79.5,resBin,resMin, resMax,"");
1008  p_eResVsNVtx_[1][1] = iBooker.bookProfile(histname+"unconvBarrel","Unconverted photons E/E_{true} vs N_{vtx}: Barrel; N_{vtx}; E}/E_{true} ",80, -0.5, 79.5,resBin,resMin, resMax,"");
1009  p_eResVsNVtx_[1][2] = iBooker.bookProfile(histname+"convBarrel"," Converted photons E/E_{true} vs N_{vtx}: Barrel; N_{vtx}; E}/E_{true} ",80, -0.5, 79.5,resBin,resMin, resMax,"");
1010  p_eResVsNVtx_[2][0] = iBooker.bookProfile(histname+"Endcap","All photons E/E_{true} vs N_{vtx}: Endcap; N_{vtx}; E}/E_{true} ",80, -0.5, 79.5,resBin,resMin, resMax,"");
1011  p_eResVsNVtx_[2][1] = iBooker.bookProfile(histname+"unconvEndcap","Uncoverted photons E/E_{true} vs N_{vtx}: Endcap; N_{vtx}; E}/E_{true} ",80, -0.5, 79.5,resBin,resMin, resMax,"");
1012  p_eResVsNVtx_[2][2] = iBooker.bookProfile(histname+"convEndcap","Converted photons E/E_{true} vs N_{vtx}: Endcap; N_{vtx}; E}/E_{true} ",80, -0.5, 79.5,resBin,resMin, resMax,"");
1013 
1014 
1015 
1016  histname="eResVsR9";
1017  if ( ! isRunCentrally_ ) h2_eResVsR9_[0] = iBooker.book2D(histname+"All"," All photons E/Etrue vs R9: all Ecal ",r9Bin*2,r9Min, r9Max,100, 0., 2.5);
1018  if ( ! isRunCentrally_ ) h2_eResVsR9_[1] = iBooker.book2D(histname+"Barrel"," All photons E/Etrue vs R9: Barrel ", r9Bin*2,r9Min, r9Max,100, 0.,2.5);
1019  if ( ! isRunCentrally_ ) h2_eResVsR9_[2] = iBooker.book2D(histname+"Endcap"," All photons E/Etrue vs R9: Endcap ", r9Bin*2,r9Min, r9Max,100, 0., 2.5);
1020  histname="pEResVsR9";
1021  if ( ! isRunCentrally_ ) p_eResVsR9_[0] = iBooker.bookProfile(histname+"All"," All photons E/Etrue vs R9: all Ecal ",r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1022  p_eResVsR9_[1] = iBooker.bookProfile(histname+"Barrel"," All photons E/Etrue vs R9: Barrel ", r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1023  p_eResVsR9_[2] = iBooker.bookProfile(histname+"Endcap"," All photons E/Etrue vs R9: Endcap ", r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1024  histname="sceResVsR9";
1025  if ( ! isRunCentrally_ ) h2_sceResVsR9_[0] = iBooker.book2D(histname+"All"," All photons scE/Etrue vs R9: all Ecal ",r9Bin*2,r9Min, r9Max,100, 0., 2.5);
1026  if ( ! isRunCentrally_ ) h2_sceResVsR9_[1] = iBooker.book2D(histname+"Barrel"," All photons scE/Etrue vs R9: Barrel ", r9Bin*2,r9Min, r9Max,100, 0.,2.5);
1027  if ( ! isRunCentrally_ ) h2_sceResVsR9_[2] = iBooker.book2D(histname+"Endcap"," All photons scE/Etrue vs R9: Endcap ", r9Bin*2,r9Min, r9Max,100, 0., 2.5);
1028  histname="scpEResVsR9";
1029  if ( ! isRunCentrally_ ) p_sceResVsR9_[0] = iBooker.bookProfile(histname+"All"," All photons scE/Etrue vs R9: all Ecal ",r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1030  p_sceResVsR9_[1] = iBooker.bookProfile(histname+"Barrel"," All photons scE/Etrue vs R9: Barrel ", r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1031  p_sceResVsR9_[2] = iBooker.bookProfile(histname+"Endcap"," All photons scE/Etrue vs R9: Endcap ", r9Bin*2,r9Min, r9Max,resBin,resMin, resMax,"");
1032 
1033  // Photon E resolution when using energy values from regressions
1034  histname = "eResRegr1";
1035  h_phoEResRegr1_[0][0] = iBooker.book1D(histname+"All"," Photon rec/true Energy from Regression1 : All ecal ", resBin,resMin, resMax);
1036  h_phoEResRegr1_[0][1] = iBooker.book1D(histname+"Barrel"," Photon rec/true Energy from Regression1: Barrel ",resBin,resMin, resMax);
1037  h_phoEResRegr1_[0][2] = iBooker.book1D(histname+"Endcap"," Photon rec/true Energy from Regression1: Endcap ",resBin,resMin, resMax);
1038 
1039  h_phoEResRegr1_[1][0] = iBooker.book1D(histname+"unconvAll"," Photon rec/true Energy from Regression1 if r9>0.94, 0.95: All ecal ", resBin,resMin, resMax);
1040  h_phoEResRegr1_[1][1] = iBooker.book1D(histname+"unconvBarrel"," Photon rec/true Energy from Regression1 if r9>0.94: Barrel ",resBin,resMin, resMax);
1041  h_phoEResRegr1_[1][2] = iBooker.book1D(histname+"unconvEndcap"," Photon rec/true Energy from Regression1 if r9>0.95: Endcap ",resBin,resMin, resMax);
1042 
1043  h_phoEResRegr1_[2][0] = iBooker.book1D(histname+"convAll"," Photon rec/true Energy from Regression1if r9<0.0.94, 0.95: All ecal ", resBin,resMin, resMax);
1044  h_phoEResRegr1_[2][1] = iBooker.book1D(histname+"convBarrel"," Photon rec/true Energy from Regression1 if r9<0.94: Barrel ",resBin,resMin, resMax);
1045  h_phoEResRegr1_[2][2] = iBooker.book1D(histname+"convEndcap"," Photon rec/true Energy from Regression1 if r9<0.95: Endcap ",resBin,resMin, resMax);
1046 
1047  histname = "eResRegr2";
1048  h_phoEResRegr2_[0][0] = iBooker.book1D(histname+"All"," Photon rec/true Energy from Regression2 : All ecal ", resBin,resMin, resMax);
1049  h_phoEResRegr2_[0][1] = iBooker.book1D(histname+"Barrel"," Photon rec/true Energy from Regression2: Barrel ",resBin,resMin, resMax);
1050  h_phoEResRegr2_[0][2] = iBooker.book1D(histname+"Endcap"," Photon rec/true Energy from Regression2: Endcap ",resBin,resMin, resMax);
1051 
1052  h_phoEResRegr2_[1][0] = iBooker.book1D(histname+"unconvAll"," Photon rec/true Energy from Regression2 if r9>0.94, 0.95: All ecal ", resBin,resMin, resMax);
1053  h_phoEResRegr2_[1][1] = iBooker.book1D(histname+"unconvBarrel"," Photon rec/true Energy from Regression2 if r9>0.94: Barrel ",resBin,resMin, resMax);
1054  h_phoEResRegr2_[1][2] = iBooker.book1D(histname+"unconvEndcap"," Photon rec/true Energy from Regression2 if r9>0.95: Endcap ",resBin,resMin, resMax);
1055 
1056  h_phoEResRegr2_[2][0] = iBooker.book1D(histname+"convAll"," Photon rec/true Energy from Regression2 if r9<0.0.94, 0.95: All ecal ", resBin,resMin, resMax);
1057  h_phoEResRegr2_[2][1] = iBooker.book1D(histname+"convBarrel"," Photon rec/true Energy from Regression2 if r9<0.94: Barrel ",resBin,resMin, resMax);
1058  h_phoEResRegr2_[2][2] = iBooker.book1D(histname+"convEndcap"," Photon rec/true Energy from Regression2 if r9<0.95: Endcap ",resBin,resMin, resMax);
1059  //
1060  histname = "phoPixSeedSize";
1061  h_phoPixSeedSize_[0]= iBooker.book1D(histname+"Barrel","Pixel seeds size ", 100, 0., 100.);
1062  h_phoPixSeedSize_[1]= iBooker.book1D(histname+"Endcap","Pixel seeds size ", 100, 0., 100.);
1063 
1064  // Infos from Particle Flow - isolation and ID
1065  histname = "chargedHadIso";
1066  h_chHadIso_[0]= iBooker.book1D(histname+"All", "PF chargedHadIso: All Ecal",etBin,etMin,20.);
1067  h_chHadIso_[1]= iBooker.book1D(histname+"Barrel", "PF chargedHadIso: Barrel",etBin,etMin,20.);
1068  h_chHadIso_[2]= iBooker.book1D(histname+"Endcap", "PF chargedHadIso: Endcap",etBin,etMin,20.);
1069  histname = "neutralHadIso";
1070  h_nHadIso_[0]= iBooker.book1D(histname+"All", "PF neutralHadIso: All Ecal",etBin,etMin,20.);
1071  h_nHadIso_[1]= iBooker.book1D(histname+"Barrel", "PF neutralHadIso: Barrel",etBin,etMin,20.);
1072  h_nHadIso_[2]= iBooker.book1D(histname+"Endcap", "PF neutralHadIso: Endcap",etBin,etMin,20.);
1073  histname = "photonIso";
1074  h_phoIso_[0]= iBooker.book1D(histname+"All", "PF photonIso: All Ecal",etBin,etMin,20.);
1075  h_phoIso_[1]= iBooker.book1D(histname+"Barrel", "PF photonIso: Barrel",etBin,etMin,20.);
1076  h_phoIso_[2]= iBooker.book1D(histname+"Endcap", "PF photonIso: Endcap",etBin,etMin,20.);
1077  histname = "nCluOutMustache";
1078  h_nCluOutsideMustache_[0]= iBooker.book1D(histname+"All", "PF number of clusters outside Mustache: All Ecal",50,0.,50.);
1079  h_nCluOutsideMustache_[1]= iBooker.book1D(histname+"Barrel", "PF number of clusters outside Mustache: Barrel",50,0.,50.);
1080  h_nCluOutsideMustache_[2]= iBooker.book1D(histname+"Endcap", "PF number of clusters outside Mustache: Endcap",50,0.,50.);
1081  histname = "etOutMustache";
1082  h_etOutsideMustache_[0]= iBooker.book1D(histname+"All", "PF et outside Mustache: All Ecal",etBin,etMin,20.);
1083  h_etOutsideMustache_[1]= iBooker.book1D(histname+"Barrel", "PF et outside Mustache: Barrel",etBin,etMin,20.);
1084  h_etOutsideMustache_[2]= iBooker.book1D(histname+"Endcap", "PF et outside Mustache: Endcap",etBin,etMin,20.);
1085  histname = "pfMVA";
1086  h_pfMva_[0]= iBooker.book1D(histname+"All", "PF MVA output: All Ecal",50,-1.,2.);
1087  h_pfMva_[1]= iBooker.book1D(histname+"Barrel", "PF MVA output: Barrel",50,-1.,2.);
1088  h_pfMva_[2]= iBooker.book1D(histname+"Endcap", "PF MVA output: Endcap",50,-1,2.);
1090  histname = "SumPtOverPhoPt_ChHad_Cleaned";
1091  h_SumPtOverPhoPt_ChHad_Cleaned_[0]= iBooker.book1D(histname+"All","Pf Cand SumPt/P_{T}_{#gamma}: Charged Hadrons: All Ecal",etBin,etMin,2.);
1092  h_SumPtOverPhoPt_ChHad_Cleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand SumPt/P_{T}_{#gamma}: Charged Hadrons: Barrel",etBin,etMin,2.);
1093  h_SumPtOverPhoPt_ChHad_Cleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand SumPt/P_{T}_{#gamma}: Charged Hadrons: Endcap",etBin,etMin,2.);
1094  histname = "SumPtOverPhoPt_NeuHad_Cleaned";
1095  h_SumPtOverPhoPt_NeuHad_Cleaned_[0]= iBooker.book1D(histname+"All","Pf Cand SumPt/P_{T}_{#gamma}: Neutral Hadrons: All Ecal",etBin,etMin,2.);
1096  h_SumPtOverPhoPt_NeuHad_Cleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand SumPt/P_{T}_{#gamma}: Neutral Hadrons: Barrel",etBin,etMin,2.);
1097  h_SumPtOverPhoPt_NeuHad_Cleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand SumPt/P_{T}_{#gamma}: Neutral Hadrons: Endcap",etBin,etMin,2.);
1098  histname = "SumPtOverPhoPt_Pho_Cleaned";
1099  h_SumPtOverPhoPt_Pho_Cleaned_[0]= iBooker.book1D(histname+"All","Pf Cand SumPt/P_{T}_{#gamma}: Photons: All Ecal",etBin,etMin,2.);
1100  h_SumPtOverPhoPt_Pho_Cleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand SumPt/P_{T}_{#gamma}: Photons: Barrel",etBin,etMin,2.);
1101  h_SumPtOverPhoPt_Pho_Cleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand SumPt/P_{T}_{#gamma}: Photons: Endcap",etBin,etMin,2.);
1102 
1103  histname = "dRPhoPFcand_ChHad_Cleaned";
1104  h_dRPhoPFcand_ChHad_Cleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Charged Hadrons : All Ecal",etBin,etMin,0.7);
1105  h_dRPhoPFcand_ChHad_Cleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Charged Hadrons : Barrel",etBin,etMin,0.7);
1106  h_dRPhoPFcand_ChHad_Cleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Charged Hadrons : Endcap",etBin,etMin,0.7);
1107  histname = "dRPhoPFcand_NeuHad_Cleaned";
1108  h_dRPhoPFcand_NeuHad_Cleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Neutral Hadrons : All Ecal",etBin,etMin,0.7);
1109  h_dRPhoPFcand_NeuHad_Cleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Neutral Hadrons : Barrel",etBin,etMin,0.7);
1110  h_dRPhoPFcand_NeuHad_Cleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Neutral Hadrons : Endcap",etBin,etMin,0.7);
1111  histname = "dRPhoPFcand_Pho_Cleaned";
1112  h_dRPhoPFcand_Pho_Cleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Photons : All Ecal",etBin,etMin,0.7);
1113  h_dRPhoPFcand_Pho_Cleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Photons : Barrel",etBin,etMin,0.7);
1114  h_dRPhoPFcand_Pho_Cleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Photons : Endcap",etBin,etMin,0.7);
1115 
1116  //
1117  histname = "SumPtOverPhoPt_ChHad_unCleaned";
1118  h_SumPtOverPhoPt_ChHad_unCleaned_[0]= iBooker.book1D(histname+"All","Pf Cand Sum Pt Over photon pt Charged Hadrons : All Ecal",etBin,etMin,2.);
1119  h_SumPtOverPhoPt_ChHad_unCleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Charged Hadrons: Barrel",etBin,etMin,2.);
1120  h_SumPtOverPhoPt_ChHad_unCleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Charged Hadrons: Endcap",etBin,etMin,2.);
1121  histname = "SumPtOverPhoPt_NeuHad_unCleaned";
1122  h_SumPtOverPhoPt_NeuHad_unCleaned_[0]= iBooker.book1D(histname+"All","Pf Cand Sum Pt Over photon pt Neutral Hadrons : All Ecal",etBin,etMin,2.);
1123  h_SumPtOverPhoPt_NeuHad_unCleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Neutral Hadrons: Barrel",etBin,etMin,2.);
1124  h_SumPtOverPhoPt_NeuHad_unCleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Neutral Hadrons: Endcap",etBin,etMin,2.);
1125  histname = "SumPtOverPhoPt_Pho_unCleaned";
1126  h_SumPtOverPhoPt_Pho_unCleaned_[0]= iBooker.book1D(histname+"All","Pf Cand Sum Pt Over photon pt Photons: All Ecal",etBin,etMin,2.);
1127  h_SumPtOverPhoPt_Pho_unCleaned_[1]= iBooker.book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Photons: Barrel",etBin,etMin,2.);
1128  h_SumPtOverPhoPt_Pho_unCleaned_[2]= iBooker.book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Photons: Endcap",etBin,etMin,2.);
1129  histname = "dRPhoPFcand_ChHad_unCleaned";
1130  h_dRPhoPFcand_ChHad_unCleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Charged Hadrons : All Ecal",etBin,etMin,0.7);
1131  h_dRPhoPFcand_ChHad_unCleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Charged Hadrons : Barrel",etBin,etMin,0.7);
1132  h_dRPhoPFcand_ChHad_unCleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Charged Hadrons : Endcap",etBin,etMin,0.7);
1133  histname = "dRPhoPFcand_NeuHad_unCleaned";
1134  h_dRPhoPFcand_NeuHad_unCleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Neutral Hadrons : All Ecal",etBin,etMin,0.7);
1135  h_dRPhoPFcand_NeuHad_unCleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Neutral Hadrons : Barrel",etBin,etMin,0.7);
1136  h_dRPhoPFcand_NeuHad_unCleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Neutral Hadrons : Endcap",etBin,etMin,0.7);
1137  histname = "dRPhoPFcand_Pho_unCleaned";
1138  h_dRPhoPFcand_Pho_unCleaned_[0]= iBooker.book1D(histname+"All","dR(pho,cand) Photons: All Ecal",etBin,etMin,0.7);
1139  h_dRPhoPFcand_Pho_unCleaned_[1]= iBooker.book1D(histname+"Barrel","dR(pho,cand) Photons: Barrel",etBin,etMin,0.7);
1140  h_dRPhoPFcand_Pho_unCleaned_[2]= iBooker.book1D(histname+"Endcap","dR(pho,cand) Photons: Endcap",etBin,etMin,0.7);
1141 
1142 
1143 
1144  // if ( ! isRunCentrally_ ) {
1145  // Photon pair invariant mass
1146  histname = "gamgamMass";
1147  h_gamgamMass_[0][0] = iBooker.book1D(histname+"All","2 photons invariant mass: All ecal ", ggMassBin, ggMassMin, ggMassMax);
1148  h_gamgamMass_[0][1] = iBooker.book1D(histname+"Barrel","2 photons invariant mass: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1149  h_gamgamMass_[0][2] = iBooker.book1D(histname+"Endcap","2 photons invariant mass: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1150  //
1151  histname = "gamgamMassNoConv";
1152  h_gamgamMass_[1][0] = iBooker.book1D(histname+"All","2 photons with no conversion invariant mass: All ecal ",ggMassBin, ggMassMin, ggMassMax);
1153  h_gamgamMass_[1][1] = iBooker.book1D(histname+"Barrel","2 photons with no conversion invariant mass: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1154  h_gamgamMass_[1][2] = iBooker.book1D(histname+"Endcap","2 photons with no conversion invariant mass: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1155  //
1156  histname = "gamgamMassConv";
1157  h_gamgamMass_[2][0] = iBooker.book1D(histname+"All","2 photons with conversion invariant mass: All ecal ", ggMassBin, ggMassMin, ggMassMax);
1158  h_gamgamMass_[2][1] = iBooker.book1D(histname+"Barrel","2 photons with conversion invariant mass: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1159  h_gamgamMass_[2][2] = iBooker.book1D(histname+"Endcap","2 photons with conversion invariant mass: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1160  // with energy regression1
1161  histname = "gamgamMassRegr1";
1162  h_gamgamMassRegr1_[0][0] = iBooker.book1D(histname+"All","2 photons invariant mass Regr1 : All ecal ", ggMassBin, ggMassMin, ggMassMax);
1163  h_gamgamMassRegr1_[0][1] = iBooker.book1D(histname+"Barrel","2 photons invariant mass Regr1 : Barrel ",ggMassBin, ggMassMin, ggMassMax);
1164  h_gamgamMassRegr1_[0][2] = iBooker.book1D(histname+"Endcap","2 photons invariant mass Regr1 : Endcap ",ggMassBin, ggMassMin, ggMassMax);
1165  //
1166  histname = "gamgamMassRegr1NoConv";
1167  h_gamgamMassRegr1_[1][0] = iBooker.book1D(histname+"All","2 photons with no conversion invariant mass Regr1: All ecal ",ggMassBin, ggMassMin, ggMassMax);
1168  h_gamgamMassRegr1_[1][1] = iBooker.book1D(histname+"Barrel","2 photons with no conversion invariant mass Regr1: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1169  h_gamgamMassRegr1_[1][2] = iBooker.book1D(histname+"Endcap","2 photons with no conversion invariant mass Regr1: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1170  //
1171  histname = "gamgamMassRegr1Conv";
1172  h_gamgamMassRegr1_[2][0] = iBooker.book1D(histname+"All","2 photons with conversion invariant mass Regr1: All ecal ", ggMassBin, ggMassMin, ggMassMax);
1173  h_gamgamMassRegr1_[2][1] = iBooker.book1D(histname+"Barrel","2 photons with conversion invariant mass Regr1: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1174  h_gamgamMassRegr1_[2][2] = iBooker.book1D(histname+"Endcap","2 photons with conversion invariant mass Regr1: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1175  // with energy regression2
1176  histname = "gamgamMassRegr2";
1177  h_gamgamMassRegr2_[0][0] = iBooker.book1D(histname+"All","2 photons invariant mass Regr2 : All ecal ", ggMassBin, ggMassMin, ggMassMax);
1178  h_gamgamMassRegr2_[0][1] = iBooker.book1D(histname+"Barrel","2 photons invariant mass Regr2 : Barrel ",ggMassBin, ggMassMin, ggMassMax);
1179  h_gamgamMassRegr2_[0][2] = iBooker.book1D(histname+"Endcap","2 photons invariant mass Regr2 : Endcap ",ggMassBin, ggMassMin, ggMassMax);
1180  //
1181  histname = "gamgamMassRegr2NoConv";
1182  h_gamgamMassRegr2_[1][0] = iBooker.book1D(histname+"All","2 photons with no conversion invariant mass Regr2: All ecal ",ggMassBin, ggMassMin, ggMassMax);
1183  h_gamgamMassRegr2_[1][1] = iBooker.book1D(histname+"Barrel","2 photons with no conversion invariant mass Regr2: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1184  h_gamgamMassRegr2_[1][2] = iBooker.book1D(histname+"Endcap","2 photons with no conversion invariant mass Regr2: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1185  //
1186  histname = "gamgamMassRegr2Conv";
1187  h_gamgamMassRegr2_[2][0] = iBooker.book1D(histname+"All","2 photons with conversion invariant mass Regr2: All ecal ", ggMassBin, ggMassMin, ggMassMax);
1188  h_gamgamMassRegr2_[2][1] = iBooker.book1D(histname+"Barrel","2 photons with conversion invariant mass Regr2: Barrel ",ggMassBin, ggMassMin, ggMassMax);
1189  h_gamgamMassRegr2_[2][2] = iBooker.book1D(histname+"Endcap","2 photons with conversion invariant mass Regr2: Endcap ",ggMassBin, ggMassMin, ggMassMax);
1190 
1191 
1192  //}
1193 
1195 
1196  h_scEta_miniAOD_[0] = iBooker.book1D("scEta_miniAOD"," SC Eta ",etaBin,etaMin, etaMax);
1197  h_scPhi_miniAOD_[0] = iBooker.book1D("scPhi_miniAOD"," SC Phi ",phiBin,phiMin,phiMax);
1198  histname = "phoE";
1199  h_phoE_miniAOD_[0][0]=iBooker.book1D(histname+"All_miniAOD"," Photon Energy: All ecal ", eBin,eMin, eMax);
1200  h_phoE_miniAOD_[0][1]=iBooker.book1D(histname+"Barrel_miniAOD"," Photon Energy: barrel ",eBin,eMin, eMax);
1201  h_phoE_miniAOD_[0][2]=iBooker.book1D(histname+"Endcap_miniAOD"," Photon Energy: Endcap ",eBin,eMin, eMax);
1202 
1203  histname = "phoEt";
1204  h_phoEt_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD"," Photon Transverse Energy: All ecal ", etBin,etMin, etMax);
1205  h_phoEt_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD"," Photon Transverse Energy: Barrel ",etBin,etMin, etMax);
1206  h_phoEt_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," Photon Transverse Energy: Endcap ",etBin,etMin, etMax);
1207 
1208 
1209  histname = "eRes";
1210  h_phoERes_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD"," Photon E/E_{true}: All ecal; E/E_{true} (GeV)", resBin,resMin, resMax);
1211  h_phoERes_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","Photon E/E_{true}: Barrel; E/E_{true} (GeV)",resBin,resMin, resMax);
1212  h_phoERes_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," Photon E/E_{true}: Endcap; E/E_{true} (GeV)",resBin,resMin, resMax);
1213 
1214  histname = "sigmaEoE";
1215  h_phoSigmaEoE_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD","#sigma_{E}/E: All ecal; #sigma_{E}/E", 100,0., 0.08);
1216  h_phoSigmaEoE_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","#sigma_{E}/E: Barrel; #sigma_{E}/E",100,0., 0.08);
1217  h_phoSigmaEoE_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","#sigma_{E}/E: Endcap, #sigma_{E}/E",100,0., 0.08);
1218 
1219 
1220  histname = "r9";
1221  h_r9_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
1222  h_r9_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
1223  h_r9_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
1224  histname = "full5x5_r9";
1225  h_full5x5_r9_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", " r9: All Ecal",r9Bin,r9Min, r9Max) ;
1226  h_full5x5_r9_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD"," r9: Barrel ",r9Bin,r9Min, r9Max) ;
1227  h_full5x5_r9_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," r9: Endcap ",r9Bin,r9Min, r9Max) ;
1228  histname = "r1";
1229  h_r1_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", " e1x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
1230  h_r1_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD"," e1x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
1231  h_r1_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," e1x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
1232  histname = "r2";
1233  h_r2_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", " e2x5/e5x5: All Ecal",r9Bin,r9Min, r9Max) ;
1234  h_r2_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD"," e2x5/e5x5: Barrel ",r9Bin,r9Min, r9Max) ;
1235  h_r2_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD"," e2x5/e5x5: Endcap ",r9Bin,r9Min, r9Max) ;
1236  histname = "hOverE";
1237  h_hOverE_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "H/E: All Ecal",100,0., 0.2) ;
1238  h_hOverE_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","H/E: Barrel ", 100,0., 0.2) ;
1239  h_hOverE_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","H/E: Endcap ", 100,0., 0.2) ;
1240  //
1241  histname = "newhOverE";
1242  h_newhOverE_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "new H/E: All Ecal",100,0., 0.2) ;
1243  h_newhOverE_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","new H/E: Barrel ", 100,0., 0.2) ;
1244  h_newhOverE_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","new H/E: Endcap ", 100,0., 0.2) ;
1245  //
1246  histname = "sigmaIetaIeta";
1247  h_sigmaIetaIeta_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "sigmaIetaIeta: All Ecal",100,0., 0.1) ;
1248  h_sigmaIetaIeta_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","sigmaIetaIeta: Barrel ", 100,0., 0.05) ;
1249  h_sigmaIetaIeta_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","sigmaIetaIeta: Endcap ", 100,0., 0.1) ;
1250  histname = "full5x5_sigmaIetaIeta";
1251  h_full5x5_sigmaIetaIeta_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "Full5x5 sigmaIetaIeta: All Ecal",100,0., 0.1) ;
1252  h_full5x5_sigmaIetaIeta_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","Full5x5 sigmaIetaIeta: Barrel ", 100,0., 0.05) ;
1253  h_full5x5_sigmaIetaIeta_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","Full5x5 sigmaIetaIeta: Endcap ", 100,0., 0.1) ;
1254  //
1255  histname = "ecalRecHitSumEtConeDR04";
1256  h_ecalRecHitSumEtConeDR04_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "ecalRecHitSumEtDR04: All Ecal",etBin,etMin,20.);
1257  h_ecalRecHitSumEtConeDR04_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","ecalRecHitSumEtDR04: Barrel ", etBin,etMin,20.);
1258  h_ecalRecHitSumEtConeDR04_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","ecalRecHitSumEtDR04: Endcap ", etBin,etMin,20.);
1259  histname = "hcalTowerSumEtConeDR04";
1260  h_hcalTowerSumEtConeDR04_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "hcalTowerSumEtConeDR04: All Ecal",etBin,etMin,20.);
1261  h_hcalTowerSumEtConeDR04_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","hcalTowerSumEtConeDR04: Barrel ", etBin,etMin,20.);
1262  h_hcalTowerSumEtConeDR04_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","hcalTowerSumEtConeDR04: Endcap ", etBin,etMin,20.);
1263  //
1264  histname = "hcalTowerBcSumEtConeDR04";
1265  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "hcalTowerBcSumEtConeDR04: All Ecal",etBin,etMin,20.);
1266  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","hcalTowerBcSumEtConeDR04: Barrel ", etBin,etMin,20.);
1267  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","hcalTowerBcSumEtConeDR04: Endcap ", etBin,etMin,20.);
1268  histname = "isoTrkSolidConeDR04";
1269  h_isoTrkSolidConeDR04_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "isoTrkSolidConeDR04: All Ecal",etBin,etMin,etMax*0.1);
1270  h_isoTrkSolidConeDR04_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","isoTrkSolidConeDR04: Barrel ", etBin,etMin,etMax*0.1);
1271  h_isoTrkSolidConeDR04_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","isoTrkSolidConeDR04: Endcap ", etBin,etMin,etMax*0.1);
1272  histname = "nTrkSolidConeDR04";
1273  h_nTrkSolidConeDR04_miniAOD_[0][0] = iBooker.book1D(histname+"All_miniAOD", "nTrkSolidConeDR04: All Ecal",20,0., 20) ;
1274  h_nTrkSolidConeDR04_miniAOD_[0][1] = iBooker.book1D(histname+"Barrel_miniAOD","nTrkSolidConeDR04: Barrel ", 20,0., 20) ;
1275  h_nTrkSolidConeDR04_miniAOD_[0][2] = iBooker.book1D(histname+"Endcap_miniAOD","nTrkSolidConeDR04: Endcap ", 20,0., 20) ;
1276 
1277 
1278  // Infos from Particle Flow - isolation and ID
1279  histname = "chargedHadIso";
1280  h_chHadIso_miniAOD_[0]= iBooker.book1D(histname+"All_miniAOD", "PF chargedHadIso: All Ecal",etBin,etMin,20.);
1281  h_chHadIso_miniAOD_[1]= iBooker.book1D(histname+"Barrel_miniAOD", "PF chargedHadIso: Barrel",etBin,etMin,20.);
1282  h_chHadIso_miniAOD_[2]= iBooker.book1D(histname+"Endcap_miniAOD", "PF chargedHadIso: Endcap",etBin,etMin,20.);
1283  histname = "neutralHadIso";
1284  h_nHadIso_miniAOD_[0]= iBooker.book1D(histname+"All_miniAOD", "PF neutralHadIso: All Ecal",etBin,etMin,20.);
1285  h_nHadIso_miniAOD_[1]= iBooker.book1D(histname+"Barrel_miniAOD", "PF neutralHadIso: Barrel",etBin,etMin,20.);
1286  h_nHadIso_miniAOD_[2]= iBooker.book1D(histname+"Endcap_miniAOD", "PF neutralHadIso: Endcap",etBin,etMin,20.);
1287  histname = "photonIso";
1288  h_phoIso_miniAOD_[0]= iBooker.book1D(histname+"All_miniAOD", "PF photonIso: All Ecal",etBin,etMin,20.);
1289  h_phoIso_miniAOD_[1]= iBooker.book1D(histname+"Barrel_miniAOD", "PF photonIso: Barrel",etBin,etMin,20.);
1290  h_phoIso_miniAOD_[2]= iBooker.book1D(histname+"Endcap_miniAOD", "PF photonIso: Endcap",etBin,etMin,20.);
1291 
1292  iBooker.setCurrentFolder("EgammaV/"+fName_+"/ConversionInfo");
1293 
1294 
1295  histname="nConv";
1296  h_nConv_[0][0] = iBooker.book1D(histname+"All","Number Of two-tracks Conversions per isolated candidates per events: All Ecal ",10,-0.5, 9.5);
1297  h_nConv_[0][1] = iBooker.book1D(histname+"Barrel","Number Of two-tracks Conversions per isolated candidates per events: Ecal Barrel ",10,-0.5, 9.5);
1298  h_nConv_[0][2] = iBooker.book1D(histname+"Endcap","Number Of two-tracks Conversions per isolated candidates per events: Ecal Endcap ",10,-0.5, 9.5);
1299  h_nConv_[1][0] = iBooker.book1D(histname+"OneLegAll","Number Of single leg Conversions per isolated candidates per events: All Ecal ",10,-0.5, 9.5);
1300  h_nConv_[1][1] = iBooker.book1D(histname+"OneLegBarrel","Number Of single leg Conversions per isolated candidates per events: Ecal Barrel ",10,-0.5, 9.5);
1301  h_nConv_[1][2] = iBooker.book1D(histname+"OneLegEndcap","Number Of single leg Conversions per isolated candidates per events: Ecal Endcap ",10,-0.5, 9.5);
1302 
1303 
1304  h_convEta_[0] = iBooker.book1D("convEta1"," converted Photon Eta >1 track",etaBin,etaMin, etaMax) ;
1305  h_convEta_[1] = iBooker.book1D("convEta2"," converted Photon Eta =2 tracks ",etaBin,etaMin, etaMax) ;
1306  h_convEta_[2] = iBooker.book1D("convEta2ass"," converted Photon Eta =2 tracks, both ass ",etaBin,etaMin, etaMax) ;
1307  h_convPhi_[0] = iBooker.book1D("convPhi"," converted Photon Phi ",phiBin,phiMin,phiMax) ;
1308 
1309 
1310  histname = "convERes";
1311  h_convERes_[0][0] = iBooker.book1D(histname+"All"," Conversion rec/true Energy: All ecal ", resBin,resMin, resMax);
1312  h_convERes_[0][1] = iBooker.book1D(histname+"Barrel"," Conversion rec/true Energy: Barrel ",resBin,resMin, resMax);
1313  h_convERes_[0][2] = iBooker.book1D(histname+"Endcap"," Conversion rec/true Energy: Endcap ",resBin,resMin, resMax);
1314 
1315  histname="p_EResVsR";
1316  p_eResVsR_ = iBooker.bookProfile(histname+"All"," photons conversion E/Etrue vs R: all Ecal ",rBin,rMin,rMax, 100, 0.,1.5,"");
1317 
1318 
1319  histname = "convPtRes";
1320  h_convPtRes_[1][0] = iBooker.book1D(histname+"All"," Conversion Pt rec/true from tracks : All ecal ", resBin,0.,1.5);
1321  h_convPtRes_[1][1] = iBooker.book1D(histname+"Barrel"," Conversion Pt rec/true from tracks: Barrel ",resBin,0., 1.5);
1322  h_convPtRes_[1][2] = iBooker.book1D(histname+"Endcap"," Conversion Pt rec/true from tracks: Endcap ",resBin,0., 1.5);
1323 
1324 
1325  if ( ! isRunCentrally_ ) {
1326  histname="r9VsTracks";
1327  h_r9VsNofTracks_[0][0] = iBooker.book2D(histname+"All"," photons r9 vs nTracks from conversions: All Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
1328  h_r9VsNofTracks_[0][1] = iBooker.book2D(histname+"Barrel"," photons r9 vs nTracks from conversions: Barrel Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
1329  h_r9VsNofTracks_[0][2] = iBooker.book2D(histname+"Endcap"," photons r9 vs nTracks from conversions: Endcap Ecal",r9Bin,r9Min, r9Max, 3, -0.5, 2.5) ;
1330  }
1331 
1332  histname="mvaOut";
1333  h_mvaOut_[0] = iBooker.book1D(histname+"All"," mvaOut for all conversions : All Ecal",100, 0., 1.);
1334  h_mvaOut_[1] = iBooker.book1D(histname+"Barrel"," mvaOut for all conversions : Barrel Ecal",100, 0., 1.);
1335  h_mvaOut_[2] = iBooker.book1D(histname+"Endcap"," mvaOut for all conversions : Endcap Ecal",100, 0., 1.);
1336 
1337 
1338 
1339  histname="EoverPtracks";
1340  h_EoverPTracks_[0][0] = iBooker.book1D(histname+"BarrelPix"," photons conversion E/p: barrel pix",eoverpBin, eoverpMin,eoverpMax);
1341  h_EoverPTracks_[0][1] = iBooker.book1D(histname+"BarrelTib"," photons conversion E/p: barrel tib",eoverpBin, eoverpMin,eoverpMax);
1342  h_EoverPTracks_[0][2] = iBooker.book1D(histname+"BarrelTob"," photons conversion E/p: barrel tob ",eoverpBin, eoverpMin,eoverpMax);
1343 
1344  h_EoverPTracks_[1][0] = iBooker.book1D(histname+"All"," photons conversion E/p: all Ecal ",100, 0., 5.);
1345  h_EoverPTracks_[1][1] = iBooker.book1D(histname+"Barrel"," photons conversion E/p: Barrel Ecal",100, 0., 5.);
1346  h_EoverPTracks_[1][2] = iBooker.book1D(histname+"Endcap"," photons conversion E/p: Endcap Ecal ",100, 0., 5.);
1347  histname="EoverP_SL";
1348  h_EoverP_SL_[0] = iBooker.book1D(histname+"All"," photons single leg conversion E/p: all Ecal ",100, 0., 5.);
1349  h_EoverP_SL_[1] = iBooker.book1D(histname+"Barrel"," photons single leg conversion E/p: Barrel Ecal",100, 0., 5.);
1350  h_EoverP_SL_[2] = iBooker.book1D(histname+"Endcap"," photons single leg conversion E/p: Endcap Ecal ",100, 0., 5.);
1351 
1352 
1353  histname="PoverEtracks";
1354  h_PoverETracks_[1][0] = iBooker.book1D(histname+"All"," photons conversion p/E: all Ecal ",povereBin, povereMin, povereMax);
1355  h_PoverETracks_[1][1] = iBooker.book1D(histname+"Barrel"," photons conversion p/E: Barrel Ecal",povereBin, povereMin, povereMax);
1356  h_PoverETracks_[1][2] = iBooker.book1D(histname+"Endcap"," photons conversion p/E: Endcap Ecal ",povereBin, povereMin, povereMax);
1357 
1358  histname="pEoverEtrueVsEta";
1359  p_EoverEtrueVsEta_[0] = iBooker.bookProfile(histname+"All"," photons conversion with 2 (associated) reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax, 100,0.,2.5,"");
1360 
1361  histname="pEoverEtrueVsR";
1362  p_EoverEtrueVsR_[0] = iBooker.bookProfile(histname+"All"," photons conversion E/Etrue vs R: all Ecal ",rBin,rMin,rMax, 100, 0., 2.5, "");
1363 
1364  histname="pEoverEtrueVsEta";
1365  p_EoverEtrueVsEta_[1] = iBooker.bookProfile(histname+"All2"," photons conversion 2 reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5,"");
1366 
1367  histname="pPoverPtrueVsEta";
1368  p_PoverPtrueVsEta_[0] = iBooker.bookProfile(histname+"All"," photons conversion P/Ptrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 5.,"");
1369 
1370  histname="pEoverPVsEta";
1371  p_EoverPVsEta_[0] = iBooker.bookProfile(histname+"All"," photons conversion E/P vs #eta: all Ecal ",etaBin2,etaMin, etaMax, 100, 0., 5.,"");
1372 
1373 
1374  if ( ! isRunCentrally_ ) {
1375  histname="EoverEtrueVsEoverP";
1376  h2_EoverEtrueVsEoverP_[0] = iBooker.book2D(histname+"All"," photons conversion E/Etrue vs E/P: all Ecal ",100, 0., 5., 100, 0.5, 1.5);
1377  h2_EoverEtrueVsEoverP_[1] = iBooker.book2D(histname+"Barrel"," photons conversion E/Etrue vs E/: Barrel Ecal",100, 0., 5.,100, 0.5, 1.5);
1378  h2_EoverEtrueVsEoverP_[2] = iBooker.book2D(histname+"Endcap"," photons conversion E/Etrue vs E/: Endcap Ecal ",100, 0., 5., 100, 0.5, 1.5);
1379  histname="PoverPtrueVsEoverP";
1380  h2_PoverPtrueVsEoverP_[0] = iBooker.book2D(histname+"All"," photons conversion P/Ptrue vs E/P: all Ecal ",100, 0., 5., 100, 0., 2.5);
1381  h2_PoverPtrueVsEoverP_[1] = iBooker.book2D(histname+"Barrel"," photons conversion P/Ptrue vs E/: Barrel Ecal",100, 0., 5.,100, 0., 2.5);
1382  h2_PoverPtrueVsEoverP_[2] = iBooker.book2D(histname+"Endcap"," photons conversion P/Ptrue vs E/: Endcap Ecal ",100, 0., 5., 100, 0., 2.5);
1383 
1384  histname="EoverEtrueVsEta";
1385  h2_EoverEtrueVsEta_[0] = iBooker.book2D(histname+"All"," photons conversion with 2 (associated) reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
1386 
1387 
1388  histname="EoverEtrueVsEta";
1389  h2_EoverEtrueVsEta_[1] = iBooker.book2D(histname+"All2"," photons conversion 2 reco tracks E/Etrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 2.5);
1390 
1391  histname="EoverEtrueVsR";
1392  h2_EoverEtrueVsR_[0] = iBooker.book2D(histname+"All"," photons conversion E/Etrue vs R: all Ecal ",rBin,rMin, rMax,100, 0., 2.5);
1393 
1394  histname="PoverPtrueVsEta";
1395  h2_PoverPtrueVsEta_[0] = iBooker.book2D(histname+"All"," photons conversion P/Ptrue vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 5.);
1396 
1397  histname="EoverPVsEta";
1398  h2_EoverPVsEta_[0] = iBooker.book2D(histname+"All"," photons conversion E/P vs #eta: all Ecal ",etaBin2,etaMin, etaMax,100, 0., 5.);
1399 
1400  histname="EoverPVsR";
1401  h2_EoverPVsR_[0] = iBooker.book2D(histname+"All"," photons conversion E/P vs R: all Ecal ",rBin,rMin, rMax,100, 0., 5.);
1402 
1403  histname="etaVsRsim";
1404  h2_etaVsRsim_[0] = iBooker.book2D(histname+"All"," eta(sim) vs R (sim) for associated conversions: all Ecal ",etaBin, etaMin, etaMax,rBin,rMin, rMax);
1405  histname="etaVsRreco";
1406  h2_etaVsRreco_[0] = iBooker.book2D(histname+"All"," eta(reco) vs R (reco) for associated conversions: all Ecal ",etaBin, etaMin, etaMax,rBin,rMin, rMax);
1407 
1408  }
1409 
1410  histname="pEoverPVsR";
1411  p_EoverPVsR_[0] = iBooker.bookProfile(histname+"All"," photons conversion E/P vs R: all Ecal ",rBin,rMin,rMax, 100, 0., 5.,"");
1412 
1413 
1414  histname="hInvMass";
1415  h_invMass_[0][0]= iBooker.book1D(histname+"All_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
1416  h_invMass_[0][1]= iBooker.book1D(histname+"Barrel_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
1417  h_invMass_[0][2]= iBooker.book1D(histname+"Endcap_AllTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
1418  histname="hInvMass";
1419  h_invMass_[1][0]= iBooker.book1D(histname+"All_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: all Ecal ",100, 0., 1.5);
1420  h_invMass_[1][1]= iBooker.book1D(histname+"Barrel_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",100, 0., 1.5);
1421  h_invMass_[1][2]= iBooker.book1D(histname+"Endcap_AssTracks"," Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",100, 0., 1.5);
1422 
1423 
1424  histname="hDPhiTracksAtVtx";
1425  h_DPhiTracksAtVtx_[1][0] =iBooker.book1D(histname+"All", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
1426  h_DPhiTracksAtVtx_[1][1] =iBooker.book1D(histname+"Barrel", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
1427  h_DPhiTracksAtVtx_[1][2] =iBooker.book1D(histname+"Endcap", " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
1428 
1429 
1430  if ( ! isRunCentrally_ ) {
1431  histname="hDPhiTracksAtVtxVsEta";
1432  h2_DPhiTracksAtVtxVsEta_ = iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta",etaBin2,etaMin, etaMax,100, -0.5, 0.5);
1433 
1434  histname="hDPhiTracksAtVtxVsR";
1435  h2_DPhiTracksAtVtxVsR_ = iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R",rBin,rMin, rMax,100, -0.5, 0.5);
1436 
1437  histname="hDCotTracksVsEta";
1438  h2_DCotTracksVsEta_ = iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta",etaBin2,etaMin, etaMax,100, -0.2, 0.2);
1439 
1440  histname="hDCotTracksVsR";
1441  h2_DCotTracksVsR_ = iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R",rBin,rMin, rMax,100, -0.2, 0.2);
1442 
1443  histname="h2_DPhiTracksAtEcalVsR";
1444  if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator" ) h2_DPhiTracksAtEcalVsR_= iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs R : all Ecal ",rBin,rMin, rMax, dPhiTracksBin,0.,dPhiTracksMax);
1445 
1446  histname="h2_DPhiTracksAtEcalVsEta";
1447  if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator" ) h2_DPhiTracksAtEcalVsEta_= iBooker.book2D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs #eta : all Ecal ",etaBin2,etaMin, etaMax, dPhiTracksBin,0.,dPhiTracksMax);
1448 
1449 
1450  }
1451 
1452  histname="pDPhiTracksAtVtxVsEta";
1453  p_DPhiTracksAtVtxVsEta_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta ",etaBin2,etaMin, etaMax, 100, -0.5, 0.5,"");
1454 
1455  histname="pDPhiTracksAtVtxVsR";
1456  p_DPhiTracksAtVtxVsR_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R ",rBin,rMin, rMax,100, -0.5, 0.5,"");
1457 
1458 
1459  histname="hDCotTracks";
1460  h_DCotTracks_[1][0]= iBooker.book1D(histname+"All"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
1461  h_DCotTracks_[1][1]= iBooker.book1D(histname+"Barrel"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
1462  h_DCotTracks_[1][2]= iBooker.book1D(histname+"Endcap"," Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",dCotTracksBin,dCotTracksMin,dCotTracksMax);
1463 
1464 
1465  histname="pDCotTracksVsEta";
1466  p_DCotTracksVsEta_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta ",etaBin2,etaMin, etaMax, 100, -0.2, 0.2,"");
1467 
1468  histname="pDCotTracksVsR";
1469  p_DCotTracksVsR_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R ",rBin,rMin, rMax,100, -0.2, 0.2,"");
1470 
1471 
1472  histname="hDistMinAppTracks";
1473  h_distMinAppTracks_[1][0]= iBooker.book1D(histname+"All"," Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",dEtaTracksBin,-0.1,0.6);
1474  h_distMinAppTracks_[1][1]= iBooker.book1D(histname+"Barrel"," Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",dEtaTracksBin,-0.1,0.6);
1475  h_distMinAppTracks_[1][2]= iBooker.book1D(histname+"Endcap"," Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",dEtaTracksBin,-0.1,0.6);
1476 
1477  // if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator" ) {
1478  histname="hDPhiTracksAtEcal";
1479  h_DPhiTracksAtEcal_[1][0]= iBooker.book1D(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal : all Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
1480  h_DPhiTracksAtEcal_[1][1]= iBooker.book1D(histname+"Barrel"," Photons:Tracks from conversions: #delta#phi at Ecal : Barrel Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
1481  h_DPhiTracksAtEcal_[1][2]= iBooker.book1D(histname+"Endcap"," Photons:Tracks from conversions: #delta#phi at Ecal : Endcap Ecal ",dPhiTracksBin,0.,dPhiTracksMax);
1482 
1483  histname="pDPhiTracksAtEcalVsR";
1484  p_DPhiTracksAtEcalVsR_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs R ",rBin,rMin, rMax, dPhiTracksBin,0.,dPhiTracksMax,"");
1485 
1486  histname="pDPhiTracksAtEcalVsEta";
1487  p_DPhiTracksAtEcalVsEta_ = iBooker.bookProfile(histname+"All"," Photons:Tracks from conversions: #delta#phi at Ecal vs #eta ",etaBin2,etaMin, etaMax,dPhiTracksBin,0.,dPhiTracksMax,"");
1488 
1489 
1490  histname="hDEtaTracksAtEcal";
1491  h_DEtaTracksAtEcal_[1][0]= iBooker.book1D(histname+"All"," Photons:Tracks from conversions: #delta#eta at Ecal : all Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
1492  h_DEtaTracksAtEcal_[1][1]= iBooker.book1D(histname+"Barrel"," Photons:Tracks from conversions: #delta#eta at Ecal : Barrel Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
1493  h_DEtaTracksAtEcal_[1][2]= iBooker.book1D(histname+"Endcap"," Photons:Tracks from conversions: #delta#eta at Ecal : Endcap Ecal ",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
1494 
1495  // }
1496 
1497 
1498  h_convVtxRvsZ_[0] = iBooker.book2D("convVtxRvsZAll"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1499  h_convVtxRvsZ_[1] = iBooker.book2D("convVtxRvsZBarrel"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1500  h_convVtxRvsZ_[2] = iBooker.book2D("convVtxRvsZEndcap"," Photon Reco conversion vtx position",zBin2ForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1501  h_convVtxYvsX_ = iBooker.book2D("convVtxYvsXTrkBarrel"," Photon Reco conversion vtx position, (x,y) eta<1 ",100, -80., 80., 100, -80., 80.);
1502  //
1503  h_convSLVtxRvsZ_[0] = iBooker.book2D("convSLVtxRvsZAll"," Photon Reco single leg conversion innermost hit position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1504  h_convSLVtxRvsZ_[1] = iBooker.book2D("convSLVtxRvsZBarrel"," Photon Reco single leg conversion innermost hit position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1505  h_convSLVtxRvsZ_[2] = iBooker.book2D("convSLVtxRvsZEndcap"," Photon Reco single leg conversion innermost hit position",zBin2ForXray, zMinForXray, zMaxForXray, rBinForXray, rMinForXray, rMaxForXray);
1506 
1508  if ( ! isRunCentrally_ ) {
1509  h_convVtxRvsZ_zoom_[0] = iBooker.book2D("convVtxRvsZBarrelZoom1"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, -10., 40.);
1510  h_convVtxRvsZ_zoom_[1] = iBooker.book2D("convVtxRvsZBarrelZoom2"," Photon Reco conversion vtx position",zBinForXray, zMinForXray, zMaxForXray, rBinForXray, -10., 20.);
1511  h_convVtxYvsX_zoom_[0] = iBooker.book2D("convVtxYvsXTrkBarrelZoom1"," Photon Reco conversion vtx position, (x,y) eta<1 ",100, -40., 40., 100, -40., 40.);
1512  h_convVtxYvsX_zoom_[1] = iBooker.book2D("convVtxYvsXTrkBarrelZoom2"," Photon Reco conversion vtx position, (x,y) eta<1 ",100, -20., 20., 100, -20., 20.);
1513  }
1514 
1515  h_convVtxdX_ = iBooker.book1D("convVtxdX"," Photon Reco conversion vtx dX",100, -20.,20.);
1516  h_convVtxdY_ = iBooker.book1D("convVtxdY"," Photon Reco conversion vtx dY",100, -20.,20.);
1517  h_convVtxdZ_ = iBooker.book1D("convVtxdZ"," Photon Reco conversion vtx dZ",100, -20.,20.);
1518  h_convVtxdR_ = iBooker.book1D("convVtxdR"," Photon Reco conversion vtx dR",100, -20.,20.);
1519 
1520  h_convVtxdX_barrel_ = iBooker.book1D("convVtxdX_barrel"," Photon Reco conversion vtx dX, |eta|<=1.2",100, -20.,20.);
1521  h_convVtxdY_barrel_ = iBooker.book1D("convVtxdY_barrel"," Photon Reco conversion vtx dY, |eta|<=1.2 ",100, -20.,20.);
1522  h_convVtxdZ_barrel_ = iBooker.book1D("convVtxdZ_barrel"," Photon Reco conversion vtx dZ, |eta|<=1.2,",100, -20.,20.);
1523  h_convVtxdR_barrel_ = iBooker.book1D("convVtxdR_barrel"," Photon Reco conversion vtx dR, |eta|<=1.2",100, -20.,20.);
1524  h_convVtxdX_endcap_ = iBooker.book1D("convVtxdX_endcap"," Photon Reco conversion vtx dX, |eta|>1.2",100, -20.,20.);
1525  h_convVtxdY_endcap_ = iBooker.book1D("convVtxdY_endcap"," Photon Reco conversion vtx dY, |eta|>1.2",100, -20.,20.);
1526  h_convVtxdZ_endcap_ = iBooker.book1D("convVtxdZ_endcap"," Photon Reco conversion vtx dZ, |eta|>1.2",100, -20.,20.);
1527  h_convVtxdR_endcap_ = iBooker.book1D("convVtxdR_endcap"," Photon Reco conversion vtx dR, |eta|>1.2 ",100, -20.,20.);
1528 
1529 
1530  h_convVtxdPhi_ = iBooker.book1D("convVtxdPhi"," Photon Reco conversion vtx dPhi",100, -0.005,0.005);
1531  h_convVtxdEta_ = iBooker.book1D("convVtxdEta"," Photon Reco conversion vtx dEta",100, -0.5,0.5);
1532 
1533  if ( ! isRunCentrally_ ) {
1534  h2_convVtxdRVsR_ = iBooker.book2D("h2ConvVtxdRVsR","Photon Reco conversion vtx dR vsR" ,rBin,rMin, rMax,100, -20.,20.);
1535  h2_convVtxdRVsEta_ = iBooker.book2D("h2ConvVtxdRVsEta","Photon Reco conversion vtx dR vs Eta" ,etaBin2,etaMin, etaMax,100, -20.,20.);
1536  }
1537 
1538  p_convVtxdRVsR_ = iBooker.bookProfile("pConvVtxdRVsR","Photon Reco conversion vtx dR vsR" ,rBin,rMin, rMax ,100, -20.,20., "");
1539  p_convVtxdRVsEta_ = iBooker.bookProfile("pConvVtxdRVsEta","Photon Reco conversion vtx dR vs Eta" ,etaBin2,etaMin, etaMax, 100, -20.,20., "");
1540  p_convVtxdXVsX_ = iBooker.bookProfile("pConvVtxdXVsX","Conversion vtx dX vs X" ,120,-60, 60 ,100, -20.,20., "");
1541  p_convVtxdYVsY_ = iBooker.bookProfile("pConvVtxdYVsY","Conversion vtx dY vs Y" ,120,-60, 60 ,100, -20.,20., "");
1542  p_convVtxdZVsZ_ = iBooker.bookProfile("pConvVtxdZVsZ","Conversion vtx dZ vs Z" ,zBin,zMin,zMax ,100, -20.,20., "");
1543 
1544 
1545  if ( ! isRunCentrally_ ) {
1546  h2_convVtxRrecVsTrue_ = iBooker.book2D("h2ConvVtxRrecVsTrue","Photon Reco conversion vtx R rec vs true" ,rBin,rMin, rMax,rBin,rMin, rMax);
1547  }
1548 
1549  histname="vtxChi2";
1550  h_vtxChi2_[0] = iBooker.book1D(histname+"All","vertex #chi^{2} all", 100, chi2Min, chi2Max);
1551  h_vtxChi2_[1] = iBooker.book1D(histname+"Barrel","vertex #chi^{2} barrel", 100, chi2Min, chi2Max);
1552  h_vtxChi2_[2] = iBooker.book1D(histname+"Endcap","vertex #chi^{2} endcap", 100, chi2Min, chi2Max);
1553  histname="vtxChi2Prob";
1554  h_vtxChi2Prob_[0] = iBooker.book1D(histname+"All","vertex #chi^{2} all", 100, 0., 1.);
1555  h_vtxChi2Prob_[1] = iBooker.book1D(histname+"Barrel","vertex #chi^{2} barrel", 100, 0., 1.);
1556  h_vtxChi2Prob_[2] = iBooker.book1D(histname+"Endcap","vertex #chi^{2} endcap", 100, 0., 1.);
1557 
1558  histname="zPVFromTracks";
1559  h_zPVFromTracks_[0] = iBooker.book1D(histname+"All"," Photons: PV z from conversion tracks", 100, -30., 30.);
1560  h_zPVFromTracks_[1] = iBooker.book1D(histname+"Barrel"," Photons: PV z from conversion tracks",100, -30., 30.);
1561  h_zPVFromTracks_[2] = iBooker.book1D(histname+"Endcap"," Photons: PV z from conversion tracks",100, -30., 30.);
1562  h_zPVFromTracks_[3] = iBooker.book1D(histname+"EndcapP"," Photons: PV z from conversion tracks",100, -30., 30.);
1563  h_zPVFromTracks_[4] = iBooker.book1D(histname+"EndcapM"," Photons: PV z from conversion tracks",100, -30., 30.);
1564  histname="dzPVFromTracks";
1565  h_dzPVFromTracks_[0] = iBooker.book1D(histname+"All"," Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
1566  h_dzPVFromTracks_[1] = iBooker.book1D(histname+"Barrel"," Photons: PV Z_rec - Z_true from conversion tracks",100, -10., 10.);
1567  h_dzPVFromTracks_[2] = iBooker.book1D(histname+"Endcap"," Photons: PV Z_rec - Z_true from conversion tracks",100, -10., 10.);
1568  h_dzPVFromTracks_[3] = iBooker.book1D(histname+"EndcapP"," Photons: PV Z_rec - Z_true from conversion tracks",100, -10., 10.);
1569  h_dzPVFromTracks_[4] = iBooker.book1D(histname+"EndcapM"," Photons: PV Z_rec - Z_true from conversion tracks",100, -10., 10.);
1570  p_dzPVVsR_ = iBooker.bookProfile("pdzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax, 100, -3.,3.,"");
1571  p_dzPVVsEta_ = iBooker.bookProfile("pdzPVVsEta","Photon Reco conversions: dz(PV) vs Eta" ,etaBin,etaMin, etaMax, 100, -3.,3.,"");
1572 
1573  if ( ! isRunCentrally_ ) {
1574  h2_dzPVVsR_ = iBooker.book2D("h2dzPVVsR","Photon Reco conversions: dz(PV) vs R" ,rBin,rMin, rMax,100, -3.,3.);
1575  }
1576 
1578  if ( ! isRunCentrally_ ) {
1579  histname="nHitsVsEta";
1580  nHitsVsEta_[0] = iBooker.book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax,25,0., 25.);
1581 
1582  histname="nHitsVsEta";
1583  nHitsVsEta_[1] = iBooker.book2D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs #eta associated tracks",etaBin,etaMin, etaMax,25,0., 25.);
1584 
1585  histname="nHitsVsR";
1586  nHitsVsR_[0] = iBooker.book2D(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks" ,rBin,rMin, rMax,25,0.,25);
1587 
1588  histname="nHitsVsR";
1589  nHitsVsR_[1] = iBooker.book2D(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs radius associated tracks" ,rBin,rMin, rMax,25,0.,25);
1590 
1591  histname="h2Chi2VsEta";
1592  h2_Chi2VsEta_[0]=iBooker.book2D(histname+"All"," Reco Track #chi^{2} vs #eta: All ",etaBin2,etaMin, etaMax,100, chi2Min, chi2Max);
1593 
1594 
1595  histname="h2Chi2VsR";
1596  h2_Chi2VsR_[0]=iBooker.book2D(histname+"All"," Reco Track #chi^{2} vs R: All ",rBin,rMin, rMax,100,chi2Min, chi2Max);
1597  }
1598 
1599  histname="h_nHitsVsEta";
1600  p_nHitsVsEta_[0] = iBooker.bookProfile(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax, 25,-0.5, 24.5,"");
1601 
1602  histname="h_nHitsVsEta";
1603  p_nHitsVsEta_[1] = iBooker.bookProfile(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs #eta associated tracks",etaBin,etaMin, etaMax, 25,-0.5, 24.5,"");
1604 
1605  histname="p_nHitsVsEtaSL";
1606  p_nHitsVsEtaSL_[0] = iBooker.bookProfile(histname+"AllTracks","Photons:Tracks from single leg conversions: # of hits vs #eta all tracks",etaBin,etaMin, etaMax, 25,-0.5, 24.5,"");
1607 
1608 
1609  histname="h_nHitsVsR";
1610  p_nHitsVsR_[0] = iBooker.bookProfile(histname+"AllTracks","Photons:Tracks from conversions: # of hits vs radius all tracks",rBin,rMin, rMax, 25,-0.5, 24.5,"");
1611  histname="p_nHitsVsRSL";
1612  p_nHitsVsRSL_[0] = iBooker.bookProfile(histname+"AllTracks","Photons:Tracks from single leg conversions: # of hits vs radius all tracks",rBin,rMin, rMax, 25,-0.5, 24.5,"");
1613 
1614  histname="tkChi2";
1615  h_tkChi2_[0] = iBooker.book1D(histname+"AllTracks","Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
1616  histname="tkChi2SL";
1617  h_tkChi2SL_[0] = iBooker.book1D(histname+"AllTracks","Photons:Tracks from single leg conversions: #chi^{2} of associated tracks", 100, chi2Min, chi2Max);
1618  histname="tkChi2Large";
1619  h_tkChi2Large_[0] = iBooker.book1D(histname+"AllTracks","Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
1620 
1621 
1622  histname="h_nHitsVsR";
1623  p_nHitsVsR_[1] = iBooker.bookProfile(histname+"AssTracks","Photons:Tracks from conversions: # of hits vs radius associated tracks",rBin,rMin, rMax, 25,-0.5, 24.5,"");
1624 
1625  histname="tkChi2";
1626  h_tkChi2_[1] = iBooker.book1D(histname+"AssTracks","Photons:Tracks from conversions: #chi^{2} of associated tracks", 100, chi2Min, chi2Max);
1627  histname="tkChi2Large";
1628  h_tkChi2Large_[1] = iBooker.book1D(histname+"AssTracks","Photons:Tracks from conversions: #chi^{2} of associated tracks", 1000, 0., 5000.0);
1629 
1630  histname="pChi2VsEta";
1631  p_Chi2VsEta_[0]=iBooker.bookProfile(histname+"All"," Reco Track #chi^{2} vs #eta : All ",etaBin2,etaMin, etaMax, 100, chi2Min, chi2Max,"");
1632 
1633  histname="pChi2VsR";
1634  p_Chi2VsR_[0]=iBooker.bookProfile(histname+"All"," Reco Track #chi^{2} vas R : All ",rBin,rMin,rMax, 100,chi2Min, chi2Max,"");
1635 
1636 
1637  histname="hTkD0";
1638  h_TkD0_[0]=iBooker.book1D(histname+"All"," Reco Track D0*q: All ",100,-0.1,0.6);
1639  h_TkD0_[1]=iBooker.book1D(histname+"Barrel"," Reco Track D0*q: Barrel ",100,-0.1,0.6);
1640  h_TkD0_[2]=iBooker.book1D(histname+"Endcap"," Reco Track D0*q: Endcap ",100,-0.1,0.6);
1641 
1642 
1643  histname="hTkPtPull";
1644  h_TkPtPull_[0]=iBooker.book1D(histname+"All"," Reco Track Pt pull: All ",100, -10., 10.);
1645  histname="hTkPtPull";
1646  h_TkPtPull_[1]=iBooker.book1D(histname+"Barrel"," Reco Track Pt pull: Barrel ",100, -10., 10.);
1647  histname="hTkPtPull";
1648  h_TkPtPull_[2]=iBooker.book1D(histname+"Endcap"," Reco Track Pt pull: Endcap ",100, -10., 10.);
1649 
1650  histname="pTkPtPullEta";
1651  p_TkPtPull_[0]=iBooker.bookProfile(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax, 100, -10., 10., " ");
1652 
1653  if ( ! isRunCentrally_ ) {
1654  histname="h2TkPtPullEta";
1655  h2_TkPtPull_[0]=iBooker.book2D(histname+"All"," Reco Track Pt pull: All ",etaBin2,etaMin, etaMax,100, -10., 10.);
1656 
1657  histname="PtRecVsPtSim";
1658  h2_PtRecVsPtSim_[0]=iBooker.book2D(histname+"All", "Pt Rec vs Pt sim: All ", etBin,etMin,etMax,etBin,etMin, etMax);
1659  h2_PtRecVsPtSim_[1]=iBooker.book2D(histname+"Barrel", "Pt Rec vs Pt sim: Barrel ", etBin,etMin,etMax,etBin,etMin, etMax);
1660  h2_PtRecVsPtSim_[2]=iBooker.book2D(histname+"Endcap", "Pt Rec vs Pt sim: Endcap ", etBin,etMin,etMax,etBin,etMin, etMax);
1661  histname="PtRecVsPtSimMixProv";
1662  h2_PtRecVsPtSimMixProv_ =iBooker.book2D(histname+"All", "Pt Rec vs Pt sim All for mix with general tracks ", etBin,etMin,etMax,etBin,etMin, etMax);
1663  }
1664 
1665  // if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator" ) {
1666  histname="eBcOverTkPout";
1667  hBCEnergyOverTrackPout_[0] = iBooker.book1D(histname+"All","Matrching BC E/P_out: all Ecal ",100, 0., 5.);
1668  hBCEnergyOverTrackPout_[1] = iBooker.book1D(histname+"Barrel","Matrching BC E/P_out: Barrel ",100, 0., 5.);
1669  hBCEnergyOverTrackPout_[2] = iBooker.book1D(histname+"Endcap","Matrching BC E/P_out: Endcap ",100, 0., 5.);
1670  // }
1671 
1673  h_OIinnermostHitR_ = iBooker.book1D("OIinnermostHitR"," R innermost hit for OI tracks ",50, 0., 25);
1674  h_IOinnermostHitR_ = iBooker.book1D("IOinnermostHitR"," R innermost hit for IO tracks ",50, 0., 25);
1675 
1677  h_trkProv_[0] = iBooker.book1D("allTrkProv"," Track pair provenance ",4, 0., 4.);
1678  h_trkProv_[1] = iBooker.book1D("assTrkProv"," Track pair provenance ",4, 0., 4.);
1679  //
1680  h_trkAlgo_ = iBooker.book1D("allTrackAlgo"," Track Algo ", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize-0.5);
1681  h_convAlgo_ = iBooker.book1D("allConvAlgo"," Conv Algo ",5, -0.5, 4.5);
1682  h_convQuality_ = iBooker.book1D("allConvQuality","Conv quality ",11,-0.5,11.);
1683 
1684 
1685  // histos for fake rate
1686  histname = "h_RecoConvTwoTracksEta";
1687  h_RecoConvTwoTracks_[0] = iBooker.book1D(histname," All reco conversions with 2 reco tracks: simulated #eta",etaBin2,etaMin, etaMax);
1688  histname = "h_RecoConvTwoTracksPhi";
1689  h_RecoConvTwoTracks_[1] = iBooker.book1D(histname," All reco conversions with 2 reco tracks: simulated #phi",phiBin,phiMin, phiMax);
1690  histname = "h_RecoConvTwoTracksR";
1691  h_RecoConvTwoTracks_[2] = iBooker.book1D(histname," All reco conversions with 2 reco tracks: simulated R",rBin,rMin, rMax);
1692  histname = "h_RecoConvTwoTracksZ";
1693  h_RecoConvTwoTracks_[3] = iBooker.book1D(histname," All reco conversions with 2 reco tracks: simulated Z",zBin,zMin, zMax);
1694  histname = "h_RecoConvTwoTracksEt";
1695  h_RecoConvTwoTracks_[4] = iBooker.book1D(histname," All reco conversions with 2 reco tracks: simulated Et",etBin,etMin, etMax);
1696  //
1697  histname = "h_RecoConvTwoMTracksEta";
1698  h_RecoConvTwoMTracks_[0] = iBooker.book1D(histname," All reco conversions with 2 reco-ass tracks: simulated #eta",etaBin2,etaMin, etaMax);
1699  histname = "h_RecoConvTwoMTracksPhi";
1700  h_RecoConvTwoMTracks_[1] = iBooker.book1D(histname," All reco conversions with 2 reco-ass tracks: simulated #phi",phiBin,phiMin, phiMax);
1701  histname = "h_RecoConvTwoMTracksR";
1702  h_RecoConvTwoMTracks_[2] = iBooker.book1D(histname," All reco conversions with 2 reco-ass tracks: simulated R",rBin,rMin, rMax);
1703  histname = "h_RecoConvTwoMTracksZ";
1704  h_RecoConvTwoMTracks_[3] = iBooker.book1D(histname," All reco conversions with 2 reco-ass tracks: simulated Z",zBin,zMin, zMax);
1705  histname = "h_RecoConvTwoMTracksEt";
1706  h_RecoConvTwoMTracks_[4] = iBooker.book1D(histname," All reco conversions with 2 reco-ass tracks: simulated Et",etBin,etMin, etMax);
1707 
1708 }
1709 
1710 
1711 
1712 void PhotonValidator::dqmBeginRun (edm::Run const & r, edm::EventSetup const & theEventSetup) {
1713 
1714 
1715  //get magnetic field
1716  edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field" << "\n";
1717  theEventSetup.get<IdealMagneticFieldRecord>().get(theMF_);
1718 
1719 
1720  thePhotonMCTruthFinder_.reset(new PhotonMCTruthFinder() );
1721 
1722 }
1723 
1724 void PhotonValidator::endRun (edm::Run const& r, edm::EventSetup const & theEventSetup) {
1725 
1726  thePhotonMCTruthFinder_.reset();
1727 }
1728 
1729 
1730 
1732 
1733  thePhotonMCTruthFinder_->clear();
1734  using namespace edm;
1735  // const float etaPhiDistance=0.01;
1736  // Fiducial region
1737  // const float TRK_BARL =0.9;
1738  const float BARL = 1.4442; // DAQ TDR p.290
1739  // const float END_LO = 1.566; // unused
1740  const float END_HI = 2.5;
1741  // Electron mass
1742  //const Float_t mElec= 0.000511;
1743 
1745  e.getByLabel("trackAssociatorByHitsForPhotonValidation",theHitsAssociator);
1747 
1748 
1749 
1750  nEvt_++;
1751  LogInfo("PhotonValidator") << "PhotonValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
1752 
1753 
1754  // get the geometry from the event setup:
1755  esup.get<CaloGeometryRecord>().get(theCaloGeom_);
1756 
1758  e.getByToken(offline_pvToken_, vtxH);
1759  h_nRecoVtx_ ->Fill (float(vtxH->size()));
1760 
1761 
1762  // Transform Track into TransientTrack (needed by the Vertex fitter)
1764  esup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTB);
1765 
1766 
1768  Handle<reco::PhotonCollection> photonHandle;
1769  e.getByToken(photonCollectionToken_, photonHandle);
1770  const reco::PhotonCollection photonCollection = *(photonHandle.product());
1771  if (!photonHandle.isValid()) {
1772  edm::LogError("PhotonProducer")
1773  << "Error! Can't get the Photon collection "
1774  << std::endl;
1775  return;
1776  }
1777 
1778  // Get the PF refined cluster collection
1779  Handle<reco::PFCandidateCollection> pfCandidateHandle;
1780  e.getByToken(pfCandidates_,pfCandidateHandle);
1781  if (!pfCandidateHandle.isValid()) {
1782  edm::LogError("PhotonValidator") << "Error! Can't get the product pfCandidates "<< std::endl ;
1783  }
1784 
1785  edm::Handle<edm::ValueMap<std::vector<reco::PFCandidateRef> > > phoToParticleBasedIsoMapHandle;
1786  edm::ValueMap<std::vector<reco::PFCandidateRef> > phoToParticleBasedIsoMap;
1787  if ( fName_ == "pfPhotonValidator") {
1788  e.getByToken(particleBasedIso_token,phoToParticleBasedIsoMapHandle);
1789  if ( ! phoToParticleBasedIsoMapHandle.isValid()) {
1790  edm::LogInfo("PhotonValidator") << "Error! Can't get the product: valueMap photons to particle based iso " << std::endl;
1791 
1792  }
1793  phoToParticleBasedIsoMap = *(phoToParticleBasedIsoMapHandle.product());
1794  }
1795 
1796  Handle< edm::View<reco::Track> > outInTrkHandle;
1797  Handle< edm::View<reco::Track> > inOutTrkHandle;
1798  if ( !fastSim_) {
1800  e.getByToken(conversionOITrackPr_Token_, outInTrkHandle);
1802  e.getByToken(conversionIOTrackPr_Token_, inOutTrkHandle);
1803 
1804  // Loop over Out In Tracks
1805  int iTrk=0;
1806  int nHits=0;
1807  for( View<reco::Track>::const_iterator iTk = outInTrkHandle->begin(); iTk != outInTrkHandle->end(); iTk++) {
1808  h_OIinnermostHitR_ ->Fill ( sqrt( iTk->innerPosition().Perp2() ) );
1809  for ( trackingRecHit_iterator itHits=iTk->extra()->recHitsBegin(); itHits!=iTk->extra()->recHitsEnd(); ++itHits ) {
1810  if ( (*itHits)->isValid() ) {
1811  nHits++;
1812  }
1813 
1814 
1815  }
1816 
1817  iTrk++;
1818 
1819 
1820  }
1821 
1822  // Loop over In Out Tracks Barrel
1823  iTrk=0;
1824  for( View<reco::Track>::const_iterator iTk = inOutTrkHandle->begin(); iTk != inOutTrkHandle->end(); iTk++) {
1825  h_IOinnermostHitR_ ->Fill ( sqrt( iTk->innerPosition().Perp2() ) );
1826  nHits=0;
1827  for ( trackingRecHit_iterator itHits=iTk->extra()->recHitsBegin(); itHits!=iTk->extra()->recHitsEnd(); ++itHits ) {
1828  if ( (*itHits)->isValid() ) {
1829  nHits++;
1830  }
1831  }
1832  iTrk++;
1833  }
1834 
1835  } // if !fastSim
1836 
1837 
1839  //get simtrack info
1840  std::vector<SimTrack> theSimTracks;
1841  std::vector<SimVertex> theSimVertices;
1844 
1845  if ( ! fastSim_) {
1846  e.getByToken(g4_simTk_Token_, SimTk);
1847  e.getByToken(g4_simVtx_Token_, SimVtx);
1848  } else {
1849  e.getByToken(famos_simTk_Token_, SimTk);
1850  e.getByToken(famos_simVtx_Token_, SimVtx);
1851 
1852  }
1853 
1854 
1855 
1856  theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
1857  theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
1858  std::vector<PhotonMCTruth> mcPhotons=thePhotonMCTruthFinder_->find (theSimTracks, theSimVertices);
1859 
1861  e.getByToken(hepMC_Token_, hepMC);
1862  const HepMC::GenEvent *myGenEvent = hepMC->GetEvent();
1863 
1865  e.getByToken( genpartToken_, genParticles );
1866 
1867 
1868 
1869 
1870  // get generated jets
1871  Handle<reco::GenJetCollection> GenJetsHandle ;
1872  e.getByToken(genjets_Token_, GenJetsHandle);
1873  reco::GenJetCollection genJetCollection = *(GenJetsHandle.product());
1874 
1875 
1876 
1877  // Get electron tracking truth
1878  bool useTP= parameters_.getParameter<bool>("useTP");
1880  edm::Handle<TrackingParticleCollection> ElectronTPHandle;
1881  if ( useTP) {
1882  if ( ! fastSim_) {
1883  e.getByToken(token_tp_, ElectronTPHandle);
1884  trackingParticles = *(ElectronTPHandle.product());
1885  }
1886  }
1887 
1889  std::vector<reco::PhotonCollection::const_iterator> StoRMatchedConvertedPhotons;
1890  reco::SimToRecoCollection OISimToReco;
1891  reco::SimToRecoCollection IOSimToReco;
1892  // Reco to Sim
1893  reco::RecoToSimCollection OIRecoToSim;
1894  reco::RecoToSimCollection IORecoToSim;
1895 
1896  if ( useTP) {
1897  if ( ! fastSim_) {
1898  // Sim to Reco
1899  OISimToReco = trackAssociator->associateSimToReco(outInTrkHandle, ElectronTPHandle);
1900  IOSimToReco = trackAssociator->associateSimToReco(inOutTrkHandle, ElectronTPHandle);
1901  // Reco to Sim
1902  OIRecoToSim = trackAssociator->associateRecoToSim(outInTrkHandle, ElectronTPHandle);
1903  IORecoToSim = trackAssociator->associateRecoToSim(inOutTrkHandle, ElectronTPHandle);
1904  }
1905  }
1906  //
1907  vector<reco::SimToRecoCollection*> StoRCollPtrs;
1908  StoRCollPtrs.push_back(&OISimToReco);
1909  StoRCollPtrs.push_back(&IOSimToReco);
1910  vector<reco::RecoToSimCollection*> RtoSCollPtrs;
1911  RtoSCollPtrs.push_back(&OIRecoToSim);
1912  RtoSCollPtrs.push_back(&IORecoToSim);
1913  //
1914  for (int i=0; i<2; i++)
1915  nSimPho_[i]=0;
1916  for (int i=0; i<2; i++)
1917  nSimConv_[i]=0;
1918 
1919 
1920  std::vector<reco::PhotonRef> myPhotons;
1921 
1922  for(unsigned int iPho=0; iPho < photonHandle->size(); iPho++) {
1923  reco::PhotonRef phoRef(reco::PhotonRef(photonHandle, iPho));
1924  // for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
1925  if ( fabs(phoRef->eta()) > 2.5 ) continue;
1926  myPhotons.push_back(phoRef);
1927  }
1928 
1929  std::sort(myPhotons.begin(), myPhotons.end(), sortPhotons());
1930  // if ( ! isRunCentrally_ ) {
1931  if ( myPhotons.size() >=2 ) {
1932  if ( myPhotons[0]->et() > 40 && myPhotons[1]->et() > 25 ) {
1933 
1934  math::XYZTLorentzVector p12 = myPhotons[0]->p4()+myPhotons[1]->p4();
1935  math::XYZTLorentzVector p12_regr1 = myPhotons[0]->p4(reco::Photon::regression1)+myPhotons[1]->p4(reco::Photon::regression1);
1936  math::XYZTLorentzVector p12_regr2 = myPhotons[0]->p4(reco::Photon::regression2)+myPhotons[1]->p4(reco::Photon::regression2);
1937  float gamgamMass2 = p12.Dot(p12);
1938  float gamgamMass2_regr1 = p12_regr1.Dot(p12_regr1);
1939  float gamgamMass2_regr2 = p12_regr2.Dot(p12_regr2);
1940 
1942  if ( gamgamMass2 > 0 ) {
1943  // total
1944  h_gamgamMass_[0][0] -> Fill(sqrt( gamgamMass2 ));
1945  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
1946  h_gamgamMass_[0][1] -> Fill(sqrt( gamgamMass2 ));
1947  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
1948  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
1949  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
1950  h_gamgamMass_[0][2] -> Fill(sqrt( gamgamMass2 ));
1951  // Golden photons
1952  if ( myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94 ) {
1953  h_gamgamMass_[1][0] -> Fill(sqrt( gamgamMass2 ));
1954  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
1955  h_gamgamMass_[1][1] -> Fill(sqrt( gamgamMass2 ));
1956  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
1957  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
1958  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
1959  h_gamgamMass_[1][2] -> Fill(sqrt( gamgamMass2 ));
1960  }
1961  // both photons converted
1962  if ( !myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty() ) {
1963  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 && myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
1964  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
1965  float chi2Prob2 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
1966  if ( chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005 ) {
1967  h_gamgamMass_[2][0] -> Fill(sqrt( gamgamMass2 ));
1968  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
1969  h_gamgamMass_[2][1] -> Fill(sqrt( gamgamMass2 ));
1970  }
1971  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
1972  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
1973  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) ) {
1974  h_gamgamMass_[2][2] -> Fill(sqrt( gamgamMass2 ));
1975  }
1976  }
1977  }
1978  } else if ( !myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() && myPhotons[1]->r9() > 0.93 ) { // one photon converted
1979  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 ) {
1980  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
1981  if ( chi2Prob1 > 0.0005 ) {
1982  h_gamgamMass_[2][0] -> Fill(sqrt( gamgamMass2 ));
1983  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
1984  h_gamgamMass_[2][1] -> Fill(sqrt( gamgamMass2 ));
1985  }
1986  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
1987  h_gamgamMass_[2][2] -> Fill(sqrt( gamgamMass2 ));
1988  }
1989  }
1990  }
1991  } else if ( !myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() && myPhotons[0]->r9() > 0.93 ) { // one photon converted
1992  if ( myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
1993  float chi2Prob1 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
1994  if ( chi2Prob1 > 0.0005 ) {
1995  h_gamgamMass_[2][0] -> Fill(sqrt( gamgamMass2 ));
1996  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
1997  h_gamgamMass_[2][1] -> Fill(sqrt( gamgamMass2 ));
1998  }
1999  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
2000  h_gamgamMass_[2][2] -> Fill(sqrt( gamgamMass2 ));
2001  }
2002  }
2003  }
2004  }
2005  } // gamgamMass2 > 0
2006 
2008  if ( gamgamMass2_regr1 > 0 ) {
2009  // total
2010  h_gamgamMassRegr1_[0][0] -> Fill(sqrt( gamgamMass2_regr1 ));
2011  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
2012  h_gamgamMassRegr1_[0][1] -> Fill(sqrt( gamgamMass2_regr1 ));
2013  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2014  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2015  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
2016  h_gamgamMassRegr1_[0][2] -> Fill(sqrt( gamgamMass2_regr1 ));
2017  // Golden photons
2018  if ( myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94 ) {
2019  h_gamgamMassRegr1_[1][0] -> Fill(sqrt( gamgamMass2_regr1 ));
2020  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
2021  h_gamgamMassRegr1_[1][1] -> Fill(sqrt( gamgamMass2_regr1 ));
2022  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2023  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2024  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
2025  h_gamgamMassRegr1_[1][2] -> Fill(sqrt( gamgamMass2_regr1 ));
2026  }
2027 
2028 
2029  // both photons converted
2030  if ( !myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty() ) {
2031  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 && myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
2032  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
2033  float chi2Prob2 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
2034  if ( chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005 ) {
2035  h_gamgamMassRegr1_[2][0] -> Fill(sqrt( gamgamMass2_regr1 ));
2036  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2037  h_gamgamMassRegr1_[2][1] -> Fill(sqrt( gamgamMass2_regr1 ));
2038  }
2039  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2040  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2041  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) ) {
2042  h_gamgamMassRegr1_[2][2] -> Fill(sqrt( gamgamMass2_regr1 ));
2043  }
2044  }
2045  }
2046  } else if ( !myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() && myPhotons[1]->r9() > 0.93 ) { // one photon converted
2047  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 ) {
2048  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
2049  if ( chi2Prob1 > 0.0005 ) {
2050  h_gamgamMassRegr1_[2][0] -> Fill(sqrt( gamgamMass2_regr1 ));
2051  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2052  h_gamgamMassRegr1_[2][1] -> Fill(sqrt( gamgamMass2_regr1 ));
2053  }
2054  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
2055  h_gamgamMassRegr1_[2][2] -> Fill(sqrt( gamgamMass2_regr1 ));
2056  }
2057  }
2058  }
2059  } else if ( !myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() && myPhotons[0]->r9() > 0.93 ) { // one photon converted
2060  if ( myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
2061  float chi2Prob1 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
2062  if ( chi2Prob1 > 0.0005 ) {
2063  h_gamgamMassRegr1_[2][0] -> Fill(sqrt( gamgamMass2_regr1 ));
2064  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2065  h_gamgamMassRegr1_[2][1] -> Fill(sqrt( gamgamMass2_regr1 ));
2066  }
2067  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
2068  h_gamgamMassRegr1_[2][2] -> Fill(sqrt( gamgamMass2_regr1 ));
2069  }
2070  }
2071  }
2072  }
2073  } // gamgamMass2_regr1 > 0
2074 
2075 
2077  if ( gamgamMass2_regr2 > 0 ) {
2078  // total
2079  h_gamgamMassRegr2_[0][0] -> Fill(sqrt( gamgamMass2_regr2 ));
2080  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
2081  h_gamgamMassRegr2_[0][1] -> Fill(sqrt( gamgamMass2_regr2 ));
2082  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2083  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2084  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
2085  h_gamgamMassRegr2_[0][2] -> Fill(sqrt( gamgamMass2_regr2 ));
2086  // Golden photons
2087  if ( myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94 ) {
2088  h_gamgamMassRegr2_[1][0] -> Fill(sqrt( gamgamMass2_regr2 ));
2089  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() )
2090  h_gamgamMassRegr2_[1][1] -> Fill(sqrt( gamgamMass2_regr2 ));
2091  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2092  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2093  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) )
2094  h_gamgamMassRegr2_[1][2] -> Fill(sqrt( gamgamMass2_regr2 ));
2095  }
2096 
2097 
2098  // both photons converted
2099  if ( !myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty() ) {
2100  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 && myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
2101  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
2102  float chi2Prob2 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
2103  if ( chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005 ) {
2104  h_gamgamMassRegr2_[2][0] -> Fill(sqrt( gamgamMass2_regr2 ));
2105  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2106  h_gamgamMassRegr2_[2][1] -> Fill(sqrt( gamgamMass2_regr2 ));
2107  }
2108  if ( ( myPhotons[0]->isEE() && myPhotons[1]->isEE() ) ||
2109  ( myPhotons[0]->isEE() && myPhotons[1]->isEB() ) ||
2110  ( myPhotons[0]->isEB() && myPhotons[1]->isEE() ) ) {
2111  h_gamgamMassRegr2_[2][2] -> Fill(sqrt( gamgamMass2_regr2 ));
2112  }
2113  }
2114  }
2115  } else if ( !myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() && myPhotons[1]->r9() > 0.93 ) { // one photon converted
2116  if ( myPhotons[0]->conversions()[0]->nTracks() ==2 ) {
2117  float chi2Prob1 = ChiSquaredProbability( myPhotons[0]->conversions()[0]->conversionVertex().chi2(), myPhotons[0]->conversions()[0]->conversionVertex().ndof() );
2118  if ( chi2Prob1 > 0.0005 ) {
2119  h_gamgamMassRegr2_[2][0] -> Fill(sqrt( gamgamMass2_regr2 ));
2120  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2121  h_gamgamMassRegr2_[2][1] -> Fill(sqrt( gamgamMass2_regr2 ));
2122  }
2123  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
2124  h_gamgamMassRegr2_[2][2] -> Fill(sqrt( gamgamMass2_regr2 ));
2125  }
2126  }
2127  }
2128  } else if ( !myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() && myPhotons[0]->r9() > 0.93 ) { // one photon converted
2129  if ( myPhotons[1]->conversions()[0]->nTracks() ==2 ) {
2130  float chi2Prob1 = ChiSquaredProbability( myPhotons[1]->conversions()[0]->conversionVertex().chi2(), myPhotons[1]->conversions()[0]->conversionVertex().ndof() );
2131  if ( chi2Prob1 > 0.0005 ) {
2132  h_gamgamMassRegr2_[2][0] -> Fill(sqrt( gamgamMass2_regr2 ));
2133  if ( myPhotons[0]->isEB() && myPhotons[1]->isEB() ) {
2134  h_gamgamMassRegr2_[2][1] -> Fill(sqrt( gamgamMass2_regr2 ));
2135  }
2136  if ( myPhotons[0]->isEE() || myPhotons[1]->isEE() ) {
2137  h_gamgamMassRegr2_[2][2] -> Fill(sqrt( gamgamMass2_regr2 ));
2138  }
2139  }
2140  }
2141  }
2142  } // gamgamMass2_regr2 > 0
2143 
2144 
2145 
2146 
2147 
2148 
2149 
2150 
2151 
2152 
2153 
2154 
2155  }
2156  }
2157  // }
2158 
2159 
2160  for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
2161  if ( (*mcPho).fourMomentum().et() < minPhoEtCut_ ) continue;
2162 
2163  for ( HepMC::GenEvent::particle_const_iterator mcIter=myGenEvent->particles_begin(); mcIter != myGenEvent->particles_end(); mcIter++ ) {
2164  if ( (*mcIter)->pdg_id() != 22 ) continue;
2165  bool isTheSame= false;
2166  HepMC::GenParticle* mother = nullptr;
2167  if ( (*mcIter)->production_vertex() ) {
2168  if ( (*mcIter)->production_vertex()->particles_begin(HepMC::parents) !=
2169  (*mcIter)->production_vertex()->particles_end(HepMC::parents))
2170  mother = *((*mcIter)->production_vertex()->particles_begin(HepMC::parents));
2171  }
2172 
2173 
2174 
2175 
2176  float mcPhi= (*mcPho).fourMomentum().phi();
2177  mcPhi_= phiNormalization(mcPhi);
2178  mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
2179  mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z() );
2180  mcConvR_= (*mcPho).vertex().perp();
2181  mcConvX_= (*mcPho).vertex().x();
2182  mcConvY_= (*mcPho).vertex().y();
2183  mcConvZ_= (*mcPho).vertex().z();
2184  mcConvEta_= (*mcPho).vertex().eta();
2185  mcConvPhi_= (*mcPho).vertex().phi();
2186 
2187 
2188  if ( fabs(mcEta_) > END_HI ) continue;
2189 
2190 
2191 
2192  if ( mother ==nullptr
2193  || (mother != nullptr && mother->pdg_id() == 22)
2194  || (mother != nullptr && mother->pdg_id() == 25)
2195  || (mother != nullptr && mother->pdg_id() == 35) )
2196  {
2197  double dPt = fabs((*mcIter)->momentum().perp() - (*mcPho).fourMomentum().et());
2198  float phiMother=(*mcIter)->momentum().phi();
2199  double dPhi = phiNormalization(phiMother) - mcPhi_ ;
2200  double dEta = fabs( (*mcIter)->momentum().eta() - (*mcPho).fourMomentum().pseudoRapidity() );
2201 
2202  if ( dEta <=0.0001 && dPhi <=0.0001 && dPt <=0.0001)
2203  isTheSame = true;
2204 
2205  }
2206  if ( ! isTheSame ) continue;
2207 
2208  nSimPho_[0]++;
2209  if ( ! isRunCentrally_ ) {
2210  h_SimPhoMotherEt_[0]->Fill( (*mcPho).motherMomentum().et() );
2211  h_SimPhoMotherEta_[0]->Fill( (*mcPho).motherMomentum().pseudoRapidity());
2212  }
2213 
2214  h_SimPho_[0]->Fill ( mcEta_);
2215  h_SimPho_[1]->Fill ( mcPhi_);
2216  h_SimPho_[2]->Fill ( (*mcPho).fourMomentum().et() );
2217 
2218 
2219 
2220 
2222 
2223  bool goodSimConversion=false;
2224  bool visibleConversion=false;
2225  bool visibleConversionsWithTwoSimTracks=false;
2226  if ( (*mcPho).isAConversion() == 1 ) {
2227  nSimConv_[0]++;
2228  h_AllSimConv_[0]->Fill( mcEta_ ) ;
2229  h_AllSimConv_[1]->Fill( mcPhi_ );
2230  h_AllSimConv_[2]->Fill( mcConvR_ );
2231  h_AllSimConv_[3]->Fill( mcConvZ_ );
2232  h_AllSimConv_[4]->Fill( (*mcPho).fourMomentum().et());
2233 
2234  if ( ! isRunCentrally_ ) {
2235  if ( mcConvR_ <51) h_SimConvEtaPix_[0]->Fill( mcEta_ ) ;
2236  }
2237 
2238  if ( ( fabs(mcEta_) <= BARL && mcConvR_ <85 ) ||
2239  ( fabs(mcEta_) > BARL && fabs(mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) visibleConversion=true;
2240 
2241 
2242 
2243  theConvTP_.clear();
2244  for(size_t i = 0; i < trackingParticles.size(); ++i){
2245  TrackingParticleRef tp (ElectronTPHandle,i);
2246  if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.001 &&
2247  fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.001 &&
2248  fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.001) {
2249 
2250  theConvTP_.push_back( tp );
2251  }
2252  }
2253  if ( theConvTP_.size() == 2 ) visibleConversionsWithTwoSimTracks=true;
2254  goodSimConversion=false;
2255 
2256  if ( visibleConversion && visibleConversionsWithTwoSimTracks ) goodSimConversion=true;
2257  if ( goodSimConversion ) {
2258  nSimConv_[1]++;
2259  h_VisSimConv_[0]->Fill( mcEta_ ) ;
2260  h_VisSimConv_[1]->Fill( mcPhi_ );
2261  h_VisSimConv_[2]->Fill( mcConvR_ );
2262  h_VisSimConv_[3]->Fill( mcConvZ_ );
2263  h_VisSimConv_[4]->Fill( (*mcPho).fourMomentum().et());
2264 
2265 
2266  if ( useTP ) {
2267  if ( ! isRunCentrally_ ) {
2268  for ( edm::RefVector<TrackingParticleCollection>::iterator iTrk=theConvTP_.begin(); iTrk!=theConvTP_.end(); ++iTrk) {
2269  h_simTkPt_ -> Fill ( (*iTrk)->pt() );
2270  h_simTkEta_ -> Fill ( (*iTrk)->eta() );
2271  }
2272  }
2273 
2274  }
2275  }
2276  }
2277 
2278 
2279 
2280  float minDelta=10000.;
2281  std::vector<reco::PhotonRef> thePhotons;
2282  int index=0;
2283  int iMatch=-1;
2284  bool matched=false;
2285 
2286  for(unsigned int iPho=0; iPho < photonHandle->size(); iPho++) {
2287  reco::PhotonRef aPho(reco::PhotonRef(photonHandle, iPho));
2288  thePhotons.push_back(aPho);
2289  float phiPho=aPho->phi();
2290  float etaPho=aPho->eta();
2291  float deltaPhi = phiPho-mcPhi_;
2292  float deltaEta = etaPho-mcEta_;
2293  if ( deltaPhi > pi ) deltaPhi -= twopi;
2294  if ( deltaPhi < -pi) deltaPhi += twopi;
2295  deltaPhi=pow(deltaPhi,2);
2296  deltaEta=pow(deltaEta,2);
2297  float delta = sqrt( deltaPhi+deltaEta);
2298  if ( delta<0.1 && delta < minDelta ) {
2299  minDelta=delta;
2300  iMatch=index;
2301 
2302  }
2303  index++;
2304  } // end loop over reco photons
2305  if ( iMatch>-1 ) matched=true;
2306 
2307  if ( matched ) {
2308  nSimPho_[1]++;
2309  if ( ! isRunCentrally_ ) {
2310  h_SimPhoMotherEt_[1]->Fill( (*mcPho).motherMomentum().et() );
2311  h_SimPhoMotherEta_[1]->Fill( (*mcPho).motherMomentum().pseudoRapidity());
2312  }
2313  h_MatchedSimPho_[0]->Fill( mcEta_ ) ;
2314  h_MatchedSimPho_[1]->Fill( mcPhi_ );
2315  h_MatchedSimPho_[2]->Fill( (*mcPho).fourMomentum().et());
2316 
2317  }
2318 
2319 
2320 
2321 
2322  if ( ! matched) continue;
2323 
2324 
2325 
2326  bool phoIsInBarrel=false;
2327  bool phoIsInEndcap=false;
2328  bool phoIsInEndcapP=false;
2329  bool phoIsInEndcapM=false;
2330 
2331  reco::PhotonRef matchingPho = thePhotons[iMatch];
2332 
2333  if ( fabs(matchingPho->superCluster()->position().eta() ) < 1.479 ) {
2334  phoIsInBarrel=true;
2335  } else {
2336  phoIsInEndcap=true;
2337  if ( matchingPho->superCluster()->position().eta() > 0) phoIsInEndcapP=true;
2338  if ( matchingPho->superCluster()->position().eta() < 0) phoIsInEndcapM=true;
2339 
2340  }
2341 
2342  edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
2343  if ( phoIsInBarrel ) {
2344  // Get handle to rec hits ecal barrel
2345  e.getByToken(barrelEcalHits_, ecalRecHitHandle);
2346  if (!ecalRecHitHandle.isValid()) {
2347  Labels l;
2348  labelsForToken(barrelEcalHits_, l);
2349  edm::LogError("PhotonProducer")
2350  << "Error! Can't get the product "
2351  << l.module;
2352  return;
2353  }
2354 
2355  } else if ( phoIsInEndcap ) {
2356 
2357  // Get handle to rec hits ecal encap
2358  e.getByToken(endcapEcalHits_, ecalRecHitHandle);
2359  if (!ecalRecHitHandle.isValid()) {
2360  Labels l;
2361  labelsForToken(barrelEcalHits_, l);
2362  edm::LogError("PhotonProducer")
2363  << "Error! Can't get the product "
2364  << l.module;
2365  return;
2366  }
2367 
2368  }
2369 
2370  int type=0;
2371  const EcalRecHitCollection ecalRecHitCollection = *(ecalRecHitHandle.product());
2372  float photonE = matchingPho->energy();
2373  float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type())/matchingPho->energy();
2374  //float photonEt= matchingPho->energy()/cosh( matchingPho->eta()) ;
2375  float photonEt= matchingPho->pt();
2376  float photonERegr1 = matchingPho->getCorrectedEnergy(reco::Photon::regression1);
2377  float photonERegr2 = matchingPho->getCorrectedEnergy(reco::Photon::regression2);
2378  float r9 = matchingPho->r9();
2379  // float full5x5_r9 = matchingPho->full5x5_r9();
2380  float r1 = matchingPho->r1x5();
2381  float r2 = matchingPho->r2x5();
2382  float sigmaIetaIeta = matchingPho->sigmaIetaIeta();
2383  //float full5x5_sieie = matchingPho->full5x5_sigmaIetaIeta();
2384  float hOverE = matchingPho->hadronicOverEm();
2385  float newhOverE = matchingPho->hadTowOverEm();
2386  float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
2387  float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
2388  float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
2389  float trkIso = matchingPho->trkSumPtSolidConeDR04();
2390  float nIsoTrk = matchingPho->nTrkSolidConeDR04();
2391  // PF related quantities
2392  float chargedHadIso = matchingPho->chargedHadronIso();
2393  float neutralHadIso = matchingPho->neutralHadronIso();
2394  float photonIso = matchingPho->photonIso();
2395  float etOutsideMustache = matchingPho->etOutsideMustache();
2396  int nClusterOutsideMustache = matchingPho->nClusterOutsideMustache();
2397  float pfMVA = matchingPho->pfMVA();
2398 
2399 
2400 
2401 
2402 
2403  std::vector< std::pair<DetId, float> >::const_iterator rhIt;
2404  bool atLeastOneDeadChannel=false;
2405  for(reco::CaloCluster_iterator bcIt = matchingPho->superCluster()->clustersBegin();bcIt != matchingPho->superCluster()->clustersEnd(); ++bcIt) {
2406  for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
2407 
2408  for(EcalRecHitCollection::const_iterator it = ecalRecHitCollection.begin(); it != ecalRecHitCollection.end(); ++it) {
2409  if (rhIt->first == (*it).id() ) {
2410  if ( (*it).recoFlag() == 9 ) {
2411  atLeastOneDeadChannel=true;
2412  break;
2413  }
2414  }
2415  }
2416  }
2417  }
2418 
2419  if ( atLeastOneDeadChannel ) {
2420  h_MatchedSimPhoBadCh_[0]->Fill( mcEta_ ) ;
2421  h_MatchedSimPhoBadCh_[1]->Fill( mcPhi_ );
2422  h_MatchedSimPhoBadCh_[2]->Fill( (*mcPho).fourMomentum().et());
2423 
2424  }
2425 
2426  if ( phoIsInBarrel )
2427  h_phoPixSeedSize_[0] -> Fill( matchingPho->electronPixelSeeds().size());
2428  else
2429  h_phoPixSeedSize_[1] -> Fill( matchingPho->electronPixelSeeds().size());
2430 
2431  h_scEta_[type]->Fill( matchingPho->superCluster()->eta() );
2432  h_scPhi_[type]->Fill( matchingPho->superCluster()->phi() );
2433  if ( ! isRunCentrally_ ) {
2434  h_scEtaWidth_[type]->Fill( matchingPho->superCluster()->etaWidth() );
2435  h_scPhiWidth_[type]->Fill( matchingPho->superCluster()->phiWidth() );
2436  }
2437  h_scE_[type][0]->Fill( matchingPho->superCluster()->energy() );
2438  h_scEt_[type][0]->Fill( matchingPho->superCluster()->energy()/cosh( matchingPho->superCluster()->eta()) );
2439  if ( phoIsInEndcap ) h_psE_->Fill( matchingPho->superCluster()->preshowerEnergy() ) ;
2440  //
2441  h_r9_[type][0]->Fill( r9 );
2442  //
2443  h_r1_[type][0]->Fill( r1 );
2444  //
2445  h_r2_[type][0]->Fill( r2 );
2446  //
2447  h_sigmaIetaIeta_[type][0]->Fill( sigmaIetaIeta );
2448  //
2449  h_hOverE_[type][0]->Fill( hOverE );
2450  p_r9VsEta_[0] -> Fill (mcEta_, r9);
2451 
2452  if ( ! isRunCentrally_ ) {
2453  h2_r9VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), r9);
2454  h2_r1VsEta_[0] -> Fill (mcEta_, r1);
2455  h2_r1VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), r1);
2456  h2_r2VsEta_[0] -> Fill (mcEta_, r2);
2457  h2_r2VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), r2);
2458  h2_sigmaIetaIetaVsEta_[0] -> Fill (mcEta_, sigmaIetaIeta );
2459  h2_sigmaIetaIetaVsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), sigmaIetaIeta);
2460  h2_hOverEVsEta_[0] -> Fill (mcEta_, hOverE );
2461  h2_hOverEVsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), hOverE);
2462  }
2463  p_hOverEVsEta_[0] -> Fill (mcEta_, hOverE );
2464  p_hOverEVsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), hOverE);
2465  //
2466  h_newhOverE_[type][0]->Fill( newhOverE );
2467  p_newhOverEVsEta_[0] -> Fill (mcEta_, newhOverE );
2468  p_newhOverEVsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), newhOverE);
2469 
2470 
2471 
2472  //
2473  h_ecalRecHitSumEtConeDR04_[type][0]->Fill( ecalIso );
2474  if ( ! isRunCentrally_ ) {
2475  h2_ecalRecHitSumEtConeDR04VsEta_[0] -> Fill (mcEta_, ecalIso );
2476  h2_ecalRecHitSumEtConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2477  h2_hcalTowerSumEtConeDR04VsEta_[0] -> Fill (mcEta_, hcalIso );
2478  h2_hcalTowerSumEtConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2479 
2480  }
2481  p_ecalRecHitSumEtConeDR04VsEta_[0] -> Fill (mcEta_, ecalIso );
2482  if ( ! isRunCentrally_ ) p_ecalRecHitSumEtConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2483  //
2484  h_hcalTowerSumEtConeDR04_[type][0]->Fill( hcalIso );
2485  p_hcalTowerSumEtConeDR04VsEta_[0] -> Fill (mcEta_, hcalIso );
2486  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2487  //
2488  if ( ! isRunCentrally_ ) h_hcalTowerBcSumEtConeDR04_[type][0]->Fill( newhcalIso );
2489  p_hcalTowerBcSumEtConeDR04VsEta_[0] -> Fill (mcEta_, newhcalIso );
2490  if ( ! isRunCentrally_ ) p_hcalTowerBcSumEtConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), newhcalIso);
2491  //
2492  h_isoTrkSolidConeDR04_[type][0]->Fill( trkIso );
2493  h_nTrkSolidConeDR04_[type][0]->Fill( nIsoTrk );
2494 
2495  if ( ! isRunCentrally_ ) {
2496  h2_isoTrkSolidConeDR04VsEta_[0] -> Fill (mcEta_, trkIso );
2497  h2_isoTrkSolidConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), trkIso);
2498  h2_nTrkSolidConeDR04VsEta_[0] -> Fill (mcEta_, nIsoTrk );
2499  h2_nTrkSolidConeDR04VsEt_[0] -> Fill ((*mcPho).fourMomentum().et(), nIsoTrk);
2500  }
2501 
2502 
2503 
2504  h_chHadIso_[0]-> Fill (chargedHadIso);
2505  h_nHadIso_[0]-> Fill (neutralHadIso);
2506  h_phoIso_[0]-> Fill (photonIso);
2507  h_nCluOutsideMustache_[0]->Fill(float(nClusterOutsideMustache));
2508  h_etOutsideMustache_[0]->Fill(etOutsideMustache);
2509  h_pfMva_[0]->Fill(pfMVA);
2510  //
2511  h_phoEta_[type]->Fill( matchingPho->eta() );
2512  h_phoPhi_[type]->Fill( matchingPho->phi() );
2513  h_phoDEta_[0]->Fill ( matchingPho->eta() - (*mcPho).fourMomentum().eta() );
2514  h_phoDPhi_[0]->Fill ( matchingPho->phi() - mcPhi_ );
2515  h_phoE_[type][0]->Fill( photonE );
2516  h_phoEt_[type][0]->Fill( photonEt);
2517  h_nConv_[0][0]->Fill(float( matchingPho->conversions().size()));
2518  h_nConv_[1][0]->Fill(float( matchingPho->conversionsOneLeg().size()));
2519 
2520  //
2521  h_phoERes_[0][0]->Fill( photonE / (*mcPho).fourMomentum().e() );
2522  h_phoSigmaEoE_[0][0] -> Fill (sigmaEoE);
2523  h_phoEResRegr1_[0][0]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2524  h_phoEResRegr2_[0][0]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2525 
2526  p_eResVsEta_[0]->Fill (mcEta_, photonE/(*mcPho).fourMomentum().e() ) ;
2527  p_sigmaEoEVsEta_[0] ->Fill(mcEta_,sigmaEoE);
2528  p_eResVsEt_[0][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2529 
2530 
2531 
2532  if ( ! isRunCentrally_ ) h2_eResVsEta_[0]->Fill (mcEta_, photonE/(*mcPho).fourMomentum().e() ) ;
2533  if ( ! isRunCentrally_ ) h2_eResVsEt_[0][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2534  if ( ! isRunCentrally_ ) h2_eResVsR9_[0]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2535  if ( ! isRunCentrally_ ) h2_sceResVsR9_[0]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2536  if ( ! isRunCentrally_ ) p_eResVsR9_[0]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2537  if ( ! isRunCentrally_ ) p_sceResVsR9_[0]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2538  //
2539  if ( (*mcPho).isAConversion() == 0 ) {
2540  if ( ! isRunCentrally_ ) {
2541  h2_eResVsEta_[1]->Fill (mcEta_, photonE/ (*mcPho).fourMomentum().e() ) ;
2542  h2_r9VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), r9);
2543  //
2544  h2_r1VsEta_[1] -> Fill (mcEta_, r1);
2545  h2_r1VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), r1);
2546  //
2547  h2_r2VsEta_[1] -> Fill (mcEta_, r2);
2548  h2_r2VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), r2);
2549  //
2550  h2_sigmaIetaIetaVsEta_[1] -> Fill (mcEta_, sigmaIetaIeta );
2551  h2_sigmaIetaIetaVsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), sigmaIetaIeta);
2552  //
2553  h2_hOverEVsEta_[1] -> Fill (mcEta_, hOverE );
2554  h2_hOverEVsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), hOverE);
2555  }
2556 
2557  if ( ! isRunCentrally_ ) {
2558  h2_ecalRecHitSumEtConeDR04VsEta_[1] -> Fill (mcEta_, ecalIso );
2559  h2_hcalTowerSumEtConeDR04VsEta_[1] -> Fill (mcEta_, hcalIso );
2560  h2_isoTrkSolidConeDR04VsEta_[1] -> Fill (mcEta_, trkIso );
2561  h2_isoTrkSolidConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), trkIso);
2562  h2_nTrkSolidConeDR04VsEta_[1] -> Fill (mcEta_, nIsoTrk );
2563  h2_nTrkSolidConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), nIsoTrk);
2564 
2565  }
2566  p_ecalRecHitSumEtConeDR04VsEta_[1] -> Fill (mcEta_, ecalIso );
2567  if ( ! isRunCentrally_ ) p_hcalTowerSumEtConeDR04VsEta_[1] -> Fill (mcEta_, hcalIso );
2568  }
2569 
2570 
2571 
2572  if ( photonE/(*mcPho).fourMomentum().e() < 0.3 && photonE/(*mcPho).fourMomentum().e() > 0.1 ) {
2573 
2574  }
2575 
2576 
2577  if ( (r9>0.94 && phoIsInBarrel) || (r9>0.95 && phoIsInEndcap) ) {
2578  h_phoERes_[1][0]->Fill( photonE / (*mcPho).fourMomentum().e() );
2579  h_phoSigmaEoE_[1][0] -> Fill (sigmaEoE);
2580  h_phoEResRegr1_[1][0]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2581  h_phoEResRegr2_[1][0]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2582  if ( ! isRunCentrally_ ) h2_eResVsEt_[0][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2583  p_eResVsEt_[0][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2584  p_eResVsEta_[1]->Fill (mcEta_,photonE/ (*mcPho).fourMomentum().e() ) ;
2585  p_r9VsEta_[1] -> Fill (mcEta_, r9);
2586  p_sigmaEoEVsEta_[1] ->Fill(mcEta_,sigmaEoE);
2587 
2588 
2589  } else if ( ( r9 <= 0.94&& phoIsInBarrel) || ( r9 <= 0.95&& phoIsInEndcap) ) {
2590  h_phoERes_[2][0]->Fill(photonE / (*mcPho).fourMomentum().e() );
2591  h_phoSigmaEoE_[2][0] -> Fill (sigmaEoE);
2592  h_phoEResRegr1_[2][0]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2593  h_phoEResRegr2_[2][0]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2594  p_eResVsEt_[0][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2595  p_eResVsEta_[2]->Fill (mcEta_,photonE/ (*mcPho).fourMomentum().e() ) ;
2596  p_r9VsEta_[2] -> Fill (mcEta_, r9);
2597  p_sigmaEoEVsEta_[2] ->Fill(mcEta_, sigmaEoE);
2598 
2599  if ( ! isRunCentrally_ ) {
2600  h2_eResVsEt_[0][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2601  h_EtR9Less093_[0][0] ->Fill ( photonEt );
2602  }
2603 
2604  }
2605 
2606  if ( phoIsInBarrel ) {
2607  h_scE_[type][1]->Fill( matchingPho->superCluster()->energy() );
2608  h_scEt_[type][1]->Fill( matchingPho->superCluster()->energy()/cosh( matchingPho->superCluster()->eta()) );
2609  h_r9_[type][1]->Fill( r9 );
2610  h_r1_[type][1]->Fill( r1 );
2611  h_r2_[type][1]->Fill( r2 );
2612  h_sigmaIetaIeta_[type][1]->Fill( sigmaIetaIeta );
2613  h_hOverE_[type][1]->Fill( hOverE );
2614  h_newhOverE_[type][1]->Fill( newhOverE );
2615  h_ecalRecHitSumEtConeDR04_[type][1]->Fill( ecalIso );
2616  p_ecalRecHitSumEtConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2617  h_hcalTowerSumEtConeDR04_[type][1]->Fill( hcalIso );
2618  p_hcalTowerSumEtConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2619  h_hcalTowerBcSumEtConeDR04_[type][1]->Fill( newhcalIso );
2620  p_hcalTowerBcSumEtConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), newhcalIso);
2621  h_isoTrkSolidConeDR04_[type][1]->Fill( trkIso );
2622  h_nTrkSolidConeDR04_[type][1]->Fill( nIsoTrk );
2623  h_chHadIso_[1]-> Fill (chargedHadIso);
2624  h_nHadIso_[1]-> Fill (neutralHadIso);
2625  h_phoIso_[1]-> Fill (photonIso);
2626  h_nCluOutsideMustache_[1]->Fill(float(nClusterOutsideMustache));
2627  h_etOutsideMustache_[1]->Fill(etOutsideMustache);
2628  h_pfMva_[1]->Fill(pfMVA);
2629  h_phoE_[type][1]->Fill( photonE );
2630  h_phoEt_[type][1]->Fill( photonEt );
2631  h_nConv_[type][1]->Fill(float( matchingPho->conversions().size()));
2632  h_nConv_[1][1]->Fill(float( matchingPho->conversionsOneLeg().size()));
2633  h_phoERes_[0][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
2634  h_phoSigmaEoE_[0][1] -> Fill (sigmaEoE);
2635  h_phoEResRegr1_[0][1]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2636  h_phoEResRegr2_[0][1]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2637  p_eResVsR9_[1]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2638  p_sceResVsR9_[1]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2639  if ( ! isRunCentrally_ ) {
2640  h2_eResVsR9_[1]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2641  h2_sceResVsR9_[1]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2642  h2_ecalRecHitSumEtConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2643  h2_hcalTowerSumEtConeDR04VsEt_[1] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2644  h2_eResVsEt_[1][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2645  }
2646  p_eResVsEt_[1][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2647  p_eResVsNVtx_[1][0]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2648  p_sigmaEoEVsEt_[1][0] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2649  p_sigmaEoEVsNVtx_[1][0]->Fill ( float(vtxH->size()), sigmaEoE);
2650 
2651  if ( r9 > 0.94 ) {
2652  h_phoERes_[1][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
2653  h_phoSigmaEoE_[1][1] -> Fill (sigmaEoE);
2654  h_phoEResRegr1_[1][1]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2655  h_phoEResRegr2_[1][1]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2656  if ( ! isRunCentrally_ ) h2_eResVsEt_[1][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2657  p_eResVsEt_[1][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2658  p_eResVsNVtx_[1][1]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2659  p_sigmaEoEVsEt_[1][1] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2660  p_sigmaEoEVsNVtx_[1][1]->Fill ( float(vtxH->size()), sigmaEoE);
2661  }
2662  if ( r9 <= 0.94 ) {
2663  h_phoERes_[2][1]->Fill( photonE / (*mcPho).fourMomentum().e() );
2664  h_phoSigmaEoE_[2][1] -> Fill (sigmaEoE);
2665  h_phoEResRegr1_[2][1]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2666  h_phoEResRegr2_[2][1]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2667  p_eResVsEt_[1][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2668  p_eResVsNVtx_[1][2]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2669  p_sigmaEoEVsEt_[1][2] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2670  p_sigmaEoEVsNVtx_[1][2]->Fill ( float(vtxH->size()), sigmaEoE);
2671  if ( ! isRunCentrally_ ) {
2672  h2_eResVsEt_[1][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2673  h_EtR9Less093_[0][1] ->Fill ( photonEt );
2674  }
2675  }
2676  }
2677  if ( phoIsInEndcap ) {
2678  h_scE_[type][2]->Fill( matchingPho->superCluster()->energy() );
2679  h_scEt_[type][2]->Fill( matchingPho->superCluster()->energy()/cosh( matchingPho->superCluster()->eta()) );
2680  h_r9_[type][2]->Fill( r9 );
2681  h_r1_[type][2]->Fill( r1 );
2682  h_r2_[type][2]->Fill( r2 );
2683  h_sigmaIetaIeta_[type][2]->Fill( sigmaIetaIeta );
2684  h_hOverE_[type][2]->Fill( hOverE );
2685  h_newhOverE_[type][2]->Fill( newhOverE );
2686  h_ecalRecHitSumEtConeDR04_[type][2]->Fill( ecalIso );
2687  p_ecalRecHitSumEtConeDR04VsEt_[2] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2688  h_hcalTowerSumEtConeDR04_[type][2]->Fill( hcalIso );
2689  p_hcalTowerSumEtConeDR04VsEt_[2] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2690  h_hcalTowerBcSumEtConeDR04_[type][2]->Fill( newhcalIso );
2691  p_hcalTowerBcSumEtConeDR04VsEt_[2] -> Fill ((*mcPho).fourMomentum().et(), newhcalIso);
2692  h_isoTrkSolidConeDR04_[type][2]->Fill( trkIso );
2693  h_nTrkSolidConeDR04_[type][2]->Fill( nIsoTrk );
2694  h_chHadIso_[2]-> Fill (chargedHadIso);
2695  h_nHadIso_[2]-> Fill (neutralHadIso);
2696  h_phoIso_[2]-> Fill (photonIso);
2697  h_nCluOutsideMustache_[2]->Fill(float(nClusterOutsideMustache));
2698  h_etOutsideMustache_[2]->Fill(etOutsideMustache);
2699  h_pfMva_[2]->Fill(pfMVA);
2700  h_phoE_[type][2]->Fill( photonE );
2701  h_phoEt_[type][2]->Fill( photonEt );
2702  h_nConv_[type][2]->Fill(float( matchingPho->conversions().size()));
2703  h_nConv_[1][2]->Fill(float( matchingPho->conversionsOneLeg().size()));
2704  h_phoERes_[0][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
2705  h_phoSigmaEoE_[0][2] -> Fill (sigmaEoE);
2706  h_phoEResRegr1_[0][2]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2707  h_phoEResRegr2_[0][2]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2708  p_eResVsR9_[2]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2709  p_sceResVsR9_[2]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2710  if ( ! isRunCentrally_ ) {
2711  h2_eResVsR9_[2]->Fill (r9, photonE/(*mcPho).fourMomentum().e() ) ;
2712  h2_sceResVsR9_[2]->Fill (r9, matchingPho->superCluster()->energy()/(*mcPho).fourMomentum().e() ) ;
2713  h2_ecalRecHitSumEtConeDR04VsEt_[2] -> Fill ((*mcPho).fourMomentum().et(), ecalIso);
2714  h2_hcalTowerSumEtConeDR04VsEt_[2] -> Fill ((*mcPho).fourMomentum().et(), hcalIso);
2715  h2_eResVsEt_[2][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2716  }
2717 
2718  p_eResVsEt_[2][0]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2719  p_eResVsNVtx_[2][0]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2720  p_sigmaEoEVsEt_[2][0] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2721  p_sigmaEoEVsNVtx_[2][0]->Fill ( float(vtxH->size()), sigmaEoE);
2722 
2723  if ( r9 > 0.95 ) {
2724 
2725  h_phoERes_[1][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
2726  h_phoSigmaEoE_[1][2] -> Fill (sigmaEoE);
2727  h_phoEResRegr1_[1][2]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2728  h_phoEResRegr2_[1][2]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2729  if ( ! isRunCentrally_ ) h2_eResVsEt_[2][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2730  p_eResVsEt_[2][1]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2731  p_eResVsNVtx_[2][1]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2732  p_sigmaEoEVsEt_[2][1] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2733  p_sigmaEoEVsNVtx_[2][1]->Fill ( float(vtxH->size()), sigmaEoE);
2734  }
2735  if ( r9 <= 0.95 ) {
2736  h_phoERes_[2][2]->Fill( photonE / (*mcPho).fourMomentum().e() );
2737  h_phoSigmaEoE_[2][2] -> Fill (sigmaEoE);
2738  h_phoEResRegr1_[2][2]->Fill( photonERegr1 / (*mcPho).fourMomentum().e() );
2739  h_phoEResRegr2_[2][2]->Fill( photonERegr2 / (*mcPho).fourMomentum().e() );
2740  p_eResVsEt_[2][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2741  p_eResVsNVtx_[2][2]->Fill ( float(vtxH->size()), photonE/(*mcPho).fourMomentum().e() ) ;
2742  p_sigmaEoEVsEt_[2][2] ->Fill ((*mcPho).fourMomentum().et(),sigmaEoE);
2743  p_sigmaEoEVsNVtx_[2][2]->Fill ( float(vtxH->size()), sigmaEoE);
2744 
2745  if ( ! isRunCentrally_ ) {
2746  h2_eResVsEt_[2][2]->Fill ((*mcPho).fourMomentum().et(), photonE/(*mcPho).fourMomentum().e() ) ;
2747  h_EtR9Less093_[0][2] ->Fill ( photonEt );
2748  }
2749  }
2750  }
2751 
2753  if ( fName_ == "pfPhotonValidator") {
2754 
2755  float SumPtIsoValCh = 0.;
2756  float SumPtIsoValNh = 0.;
2757  float SumPtIsoValPh = 0.;
2758 
2759  float SumPtIsoValCleanCh = 0.;
2760  float SumPtIsoValCleanNh = 0.;
2761  float SumPtIsoValCleanPh = 0.;
2762 
2763  for(unsigned int lCand=0; lCand < pfCandidateHandle->size(); lCand++) {
2764  reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle,lCand));
2765  float dR= deltaR(matchingPho->eta(), matchingPho->phi(),pfCandRef->eta(), pfCandRef->phi());
2766  if ( dR<0.4) {
2768  reco::PFCandidate::ParticleType type = pfCandRef->particleId();
2769  if ( type == reco::PFCandidate::e ) continue;
2770  if ( type == reco::PFCandidate::gamma && pfCandRef->mva_nothing_gamma() > 0.) continue;
2771 
2772  if( type == reco::PFCandidate::h ) {
2773  SumPtIsoValCh += pfCandRef->pt();
2774  h_dRPhoPFcand_ChHad_unCleaned_[0]->Fill(dR);
2775  if( phoIsInBarrel)
2776  h_dRPhoPFcand_ChHad_unCleaned_[1]->Fill(dR);
2777  else
2778  h_dRPhoPFcand_ChHad_unCleaned_[2]->Fill(dR);
2779  }
2780  if( type == reco::PFCandidate::h0 ) {
2781  SumPtIsoValNh += pfCandRef->pt();
2782  h_dRPhoPFcand_NeuHad_unCleaned_[0]->Fill(dR);
2783  if( phoIsInBarrel)
2784  h_dRPhoPFcand_NeuHad_unCleaned_[1]->Fill(dR);
2785  else
2786  h_dRPhoPFcand_NeuHad_unCleaned_[2]->Fill(dR);
2787  }
2788  if( type == reco::PFCandidate::gamma ) {
2789  SumPtIsoValPh += pfCandRef->pt();
2790  h_dRPhoPFcand_Pho_unCleaned_[0]->Fill(dR);
2791  if( phoIsInBarrel)
2792  h_dRPhoPFcand_Pho_unCleaned_[1]->Fill(dR);
2793  else
2794  h_dRPhoPFcand_Pho_unCleaned_[2]->Fill(dR);
2795  }
2797  bool skip=false;
2798  for( std::vector<reco::PFCandidateRef>::const_iterator i = phoToParticleBasedIsoMap[matchingPho].begin(); i != phoToParticleBasedIsoMap[matchingPho].end(); ++i ) {
2799  if ( (*i) == pfCandRef ) {
2800  skip=true;
2801  }
2802  } // loop over the PFCandidates flagged as overlapping with the photon
2803 
2804  if ( skip ) continue;
2805  if( type == reco::PFCandidate::h ) {
2806  SumPtIsoValCleanCh += pfCandRef->pt();
2807  h_dRPhoPFcand_ChHad_Cleaned_[0]->Fill(dR);
2808  if( phoIsInBarrel)
2809  h_dRPhoPFcand_ChHad_Cleaned_[1]->Fill(dR);
2810  else
2811  h_dRPhoPFcand_ChHad_Cleaned_[2]->Fill(dR);
2812  }
2813  if( type == reco::PFCandidate::h0 ) {
2814  SumPtIsoValCleanNh += pfCandRef->pt();
2815  h_dRPhoPFcand_NeuHad_Cleaned_[0]->Fill(dR);
2816  if( phoIsInBarrel)
2817  h_dRPhoPFcand_NeuHad_Cleaned_[1]->Fill(dR);
2818  else
2819  h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
2820  }
2821  if( type == reco::PFCandidate::gamma ) {
2822  SumPtIsoValCleanPh += pfCandRef->pt();
2823  h_dRPhoPFcand_Pho_Cleaned_[0]->Fill(dR);
2824  if( phoIsInBarrel)
2825  h_dRPhoPFcand_Pho_Cleaned_[1]->Fill(dR);
2826  else
2827  h_dRPhoPFcand_Pho_Cleaned_[2]->Fill(dR);
2828  }
2829 
2830 
2831 
2832 
2833  } // dr=0.4
2834  } // loop over all PF Candidates
2835 
2836  h_SumPtOverPhoPt_ChHad_Cleaned_[0]->Fill(SumPtIsoValCleanCh/matchingPho->pt());
2837  h_SumPtOverPhoPt_NeuHad_Cleaned_[0]->Fill(SumPtIsoValCleanNh/matchingPho->pt());
2838  h_SumPtOverPhoPt_Pho_Cleaned_[0]->Fill(SumPtIsoValCleanPh/matchingPho->pt());
2839  h_SumPtOverPhoPt_ChHad_unCleaned_[0]->Fill(SumPtIsoValCh/matchingPho->pt());
2840  h_SumPtOverPhoPt_NeuHad_unCleaned_[0]->Fill(SumPtIsoValNh/matchingPho->pt());
2841  h_SumPtOverPhoPt_Pho_unCleaned_[0]->Fill(SumPtIsoValPh/matchingPho->pt());
2842  if( phoIsInBarrel) {
2843  h_SumPtOverPhoPt_ChHad_Cleaned_[1]->Fill(SumPtIsoValCleanCh/matchingPho->pt());
2844  h_SumPtOverPhoPt_NeuHad_Cleaned_[1]->Fill(SumPtIsoValCleanNh/matchingPho->pt());
2845  h_SumPtOverPhoPt_Pho_Cleaned_[1]->Fill(SumPtIsoValCleanPh/matchingPho->pt());
2846  h_SumPtOverPhoPt_ChHad_unCleaned_[1]->Fill(SumPtIsoValCh/matchingPho->pt());
2847  h_SumPtOverPhoPt_NeuHad_unCleaned_[1]->Fill(SumPtIsoValNh/matchingPho->pt());
2848  h_SumPtOverPhoPt_Pho_unCleaned_[1]->Fill(SumPtIsoValPh/matchingPho->pt());
2849  } else {
2850  h_SumPtOverPhoPt_ChHad_Cleaned_[2]->Fill(SumPtIsoValCleanCh/matchingPho->pt());
2851  h_SumPtOverPhoPt_NeuHad_Cleaned_[2]->Fill(SumPtIsoValCleanNh/matchingPho->pt());
2852  h_SumPtOverPhoPt_Pho_Cleaned_[2]->Fill(SumPtIsoValCleanPh/matchingPho->pt());
2853  h_SumPtOverPhoPt_ChHad_unCleaned_[2]->Fill(SumPtIsoValCh/matchingPho->pt());
2854  h_SumPtOverPhoPt_NeuHad_unCleaned_[2]->Fill(SumPtIsoValNh/matchingPho->pt());
2855  h_SumPtOverPhoPt_Pho_unCleaned_[2]->Fill(SumPtIsoValPh/matchingPho->pt());
2856  }
2857 
2858  } // only for pfPhotonValidator
2859 
2860 
2861  if ( ! (visibleConversion && visibleConversionsWithTwoSimTracks ) ) continue;
2862 
2863 
2864  if ( ! isRunCentrally_ ) {
2865  h_r9_[1][0]->Fill( r9 );
2866  if ( phoIsInBarrel ) h_r9_[1][1]->Fill( r9 );
2867  if ( phoIsInEndcap ) h_r9_[1][2]->Fill( r9 );
2868 
2869  h_simConvVtxRvsZ_[0] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
2870  if ( fabs(mcEta_) <=1.) {
2871  h_simConvVtxRvsZ_[1] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
2872  h_simConvVtxYvsX_ ->Fill ( mcConvX_, mcConvY_ ) ;
2873  }
2874  else
2875  h_simConvVtxRvsZ_[2] ->Fill ( fabs (mcConvZ_), mcConvR_ ) ;
2876  }
2877 
2878 
2879  if ( ! fastSim_) {
2881  reco::ConversionRefVector conversions = matchingPho->conversions();
2882  bool atLeastOneRecoTwoTrackConversion=false;
2883  for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
2884  reco::ConversionRef aConv=conversions[iConv];
2885  double like = aConv->MVAout();
2886  if ( like < likelihoodCut_ ) continue;
2887 
2888  if ( ! isRunCentrally_ ) h2_EoverEtrueVsEta_[1]->Fill (mcEta_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
2889  p_EoverEtrueVsEta_[1]->Fill (mcEta_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
2890 
2891 
2892  //std::vector<reco::TrackRef> tracks = aConv->tracks();
2893  const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
2894  if (tracks.size() < 2 ) continue;
2895  atLeastOneRecoTwoTrackConversion=true;
2896 
2897  h_mvaOut_[0]-> Fill(like);
2898 
2899  if ( tracks.size()==2 ) {
2900  if ( sqrt( aConv->tracksPin()[0].Perp2()) < convTrackMinPtCut_ || sqrt( aConv->tracksPin()[1].Perp2()) < convTrackMinPtCut_) continue;
2901  }
2902 
2903 
2904  if ( dCotCutOn_ ) {
2905  if ( (fabs(mcEta_) > 1.1 && fabs (mcEta_) < 1.4 ) &&
2906  fabs( aConv->pairCotThetaSeparation() ) > dCotHardCutValue_ ) continue;
2907  if ( fabs( aConv->pairCotThetaSeparation() ) > dCotCutValue_ ) continue;
2908  }
2909 
2910  nRecConv_++;
2911 
2912  std::map<const reco::Track*,TrackingParticleRef> myAss;
2913  std::map<const reco::Track*,TrackingParticleRef>::const_iterator itAss;
2914  std::map<reco::TrackRef,TrackingParticleRef>::const_iterator itAssMin;
2915  std::map<reco::TrackRef,TrackingParticleRef>::const_iterator itAssMax;
2916  //
2917 
2918  int nAssT2=0;
2919  for (unsigned int i=0; i<tracks.size(); i++) {
2920  // reco::TrackRef track = tracks[i].castTo<reco::TrackRef>();
2921 
2922  type =0;
2923  if ( ! isRunCentrally_ ) nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits())-0.0001 );
2924  if ( ! isRunCentrally_ ) nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits())-0.0001 );
2925  p_nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()-0.0001) );
2926  p_nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()-0.0001) );
2927  h_tkChi2_[type] ->Fill (tracks[i]->normalizedChi2() );
2928 
2929  RefToBase<reco::Track> tfrb = tracks[i];
2931  tc.push_back(tfrb);
2932  // reco::RecoToSimCollection q = trackAssociator->associateRecoToSim(tc,theConvTP_);
2933  reco::SimToRecoCollection q = trackAssociator->associateSimToReco(tc,theConvTP_);
2934  std::vector<std::pair<RefToBase<reco::Track>, double> > trackV;
2935  int tpI = 0;
2936 
2937  if (q.find(theConvTP_[0])!=q.end()){
2938  trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q[theConvTP_[0]];
2939  } else if (q.find(theConvTP_[1])!=q.end()){
2940  trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q[theConvTP_[1]];
2941  tpI = 1;
2942  }
2943 
2944  if ( trackV.empty() ) continue;
2945  edm::RefToBase<reco::Track> tr = trackV.front().first;
2946  myAss.insert( std::make_pair (tr.get(),theConvTP_[tpI] ) );
2947  nAssT2++;
2948 
2949  }
2950 
2951 
2952  type=0;
2953 
2954  // float totP = sqrt(aConv->pairMomentum().Mag2());
2955  float refP =-99999.;
2956  float refPt =-99999.;
2957  if ( aConv->conversionVertex().isValid() ) {
2958  refP=sqrt(aConv->refittedPairMomentum().Mag2());
2959  refPt=sqrt(aConv->refittedPairMomentum().perp2());
2960  }
2961  float invM = aConv->pairInvariantMass();
2962 
2963  h_invMass_[type][0] ->Fill( invM);
2964  if ( phoIsInBarrel ) h_invMass_[type][1] ->Fill(invM);
2965  if ( phoIsInEndcap ) h_invMass_[type][2] ->Fill(invM);
2966 
2968  if ( tracks.size() ==2 ) {
2969 
2970  h_SimConvTwoTracks_[0]->Fill( mcEta_ ) ;
2971  h_SimConvTwoTracks_[1]->Fill( mcPhi_ );
2972  h_SimConvTwoTracks_[2]->Fill( mcConvR_ );
2973  h_SimConvTwoTracks_[3]->Fill( mcConvZ_ );
2974  h_SimConvTwoTracks_[4]->Fill( (*mcPho).fourMomentum().et());
2975 
2976  if (!aConv->caloCluster().empty()) h_convEta_[1]->Fill( aConv->caloCluster()[0]->eta() );
2977 
2978  float trkProvenance=3;
2979  if ( tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "outInEcalSeededConv" ) trkProvenance=0;
2980  if ( tracks[0]->algoName() == "inOutEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv" ) trkProvenance=1;
2981  if ( ( tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv") ||
2982  ( tracks[1]->algoName() == "outInEcalSeededConv" && tracks[0]->algoName() == "inOutEcalSeededConv") ) trkProvenance=2;
2983  if ( trkProvenance==3 ) {
2984  }
2985  h_trkProv_[0]->Fill( trkProvenance );
2986  h_trkAlgo_->Fill ( tracks[0]->algo() );
2987  h_trkAlgo_->Fill ( tracks[1]->algo() );
2988  h_convAlgo_->Fill ( aConv->algo() );
2989 
2991  if ( nAssT2 ==2 ) {
2992 
2993 
2994 
2995  if ( ! isRunCentrally_ ) {
2996  h_r9_[2][0]->Fill( r9 );
2997  if ( phoIsInBarrel ) h_r9_[2][1]->Fill( r9 );
2998  if ( phoIsInEndcap ) h_r9_[2][2]->Fill( r9 );
2999  }
3000 
3001  if (!aConv->caloCluster().empty()) h_convEta_[2]->Fill( aConv->caloCluster()[0]->eta() );
3002  nRecConvAss_++;
3003 
3004 
3005  h_SimConvTwoMTracks_[0]->Fill( mcEta_ ) ;
3006  h_SimConvTwoMTracks_[1]->Fill( mcPhi_ );
3007  h_SimConvTwoMTracks_[2]->Fill( mcConvR_ );
3008  h_SimConvTwoMTracks_[3]->Fill( mcConvZ_ );
3009  h_SimConvTwoMTracks_[4]->Fill( (*mcPho).fourMomentum().et());
3010 
3011  if ( aConv->conversionVertex().isValid() ) {
3012  float chi2Prob = ChiSquaredProbability( aConv->conversionVertex().chi2(), aConv->conversionVertex().ndof() );
3013  if ( chi2Prob > 0) {
3014  h_SimConvTwoMTracksAndVtxPGT0_[0]->Fill( mcEta_ ) ;
3015  h_SimConvTwoMTracksAndVtxPGT0_[1]->Fill( mcPhi_ );
3016  h_SimConvTwoMTracksAndVtxPGT0_[2]->Fill( mcConvR_ );
3017  h_SimConvTwoMTracksAndVtxPGT0_[3]->Fill( mcConvZ_ );
3018  h_SimConvTwoMTracksAndVtxPGT0_[4]->Fill( (*mcPho).fourMomentum().et());
3019  }
3020  if ( chi2Prob > 0.0005) {
3021  h_SimConvTwoMTracksAndVtxPGT0005_[0]->Fill( mcEta_ ) ;
3022  h_SimConvTwoMTracksAndVtxPGT0005_[1]->Fill( mcPhi_ );
3023  h_SimConvTwoMTracksAndVtxPGT0005_[2]->Fill( mcConvR_ );
3024  h_SimConvTwoMTracksAndVtxPGT0005_[3]->Fill( mcConvZ_ );
3025  h_SimConvTwoMTracksAndVtxPGT0005_[4]->Fill( (*mcPho).fourMomentum().et());
3026 
3027 
3028  }
3029 
3030  if ( chi2Prob > 0.0005 ) {
3031  if (!aConv->caloCluster().empty()) {
3032  h_convEta_[0]->Fill( aConv->caloCluster()[0]->eta() );
3033  h_convPhi_[0]->Fill( aConv->caloCluster()[0]->phi() );
3034  h_convERes_[0][0]->Fill( aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
3035  }
3036  if ( ! isRunCentrally_ ) {
3037  h_r9VsNofTracks_[0][0]->Fill( r9, aConv->nTracks() ) ;
3038  h_EtR9Less093_[1][0] ->Fill ( photonEt );
3039  if ( phoIsInBarrel ) h_EtR9Less093_[1][1] ->Fill ( photonEt );
3040  if ( phoIsInEndcap ) h_EtR9Less093_[1][2] ->Fill ( photonEt );
3041  }
3042  if ( phoIsInBarrel ) {
3043  if (!aConv->caloCluster().empty()) h_convERes_[0][1]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
3044  if ( ! isRunCentrally_ ) h_r9VsNofTracks_[0][1]->Fill( r9, aConv->nTracks() ) ;
3045  h_mvaOut_[1]-> Fill(like);
3046  }
3047  if ( phoIsInEndcap ) {
3048  if (!aConv->caloCluster().empty()) h_convERes_[0][2]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e() );
3049  if ( ! isRunCentrally_ ) h_r9VsNofTracks_[0][2]->Fill( r9, aConv->nTracks() ) ;
3050  h_mvaOut_[2]-> Fill(like);
3051  }
3052 
3053  }
3054 
3055 
3056 
3057 
3058  }
3059 
3060 
3062  type =1;
3063 
3064  h_trkProv_[1]->Fill( trkProvenance );
3065  h_invMass_[type][0] ->Fill( invM);
3066 
3067  float eoverp= -99999.;
3068 
3069  if ( aConv->conversionVertex().isValid() ) {
3070  eoverp = photonE/sqrt(aConv->refittedPairMomentum().Mag2());
3071  //eoverp= aConv->EoverPrefittedTracks();
3072  h_convPtRes_[type][0]->Fill( refPt / (*mcPho).fourMomentum().et() );
3073  h_EoverPTracks_[type][0] ->Fill( eoverp ) ;
3074  h_PoverETracks_[type][0] ->Fill( 1./eoverp ) ;
3075  if ( ! isRunCentrally_ ) h2_EoverEtrueVsEoverP_[0] ->Fill( eoverp,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3076  if ( ! isRunCentrally_ ) h2_PoverPtrueVsEoverP_[0] ->Fill( eoverp, refP/ (*mcPho).fourMomentum().e() ) ;
3077  if ( ! isRunCentrally_ ) h2_EoverPVsEta_[0]->Fill (mcEta_, eoverp);
3078  if ( ! isRunCentrally_ ) h2_EoverPVsR_[0]->Fill (mcConvR_, eoverp);
3079  p_EoverPVsEta_[0]->Fill (mcEta_, eoverp);
3080  p_EoverPVsR_[0]->Fill (mcConvR_, eoverp);
3081  p_eResVsR_ ->Fill ( mcConvR_, photonE / (*mcPho).fourMomentum().e() );
3082  if ( ! isRunCentrally_ ) h2_PoverPtrueVsEta_[0]->Fill (mcEta_,refP/ (*mcPho).fourMomentum().e() ) ;
3083  p_PoverPtrueVsEta_[0]->Fill (mcEta_,refP/ (*mcPho).fourMomentum().e() ) ;
3084 
3085 
3086  }
3087 
3088  if ( ! isRunCentrally_ ) h2_EoverEtrueVsEta_[0]->Fill (mcEta_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3089  if ( ! isRunCentrally_ ) h2_EoverEtrueVsR_[0]->Fill (mcConvR_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3090  p_EoverEtrueVsEta_[0]->Fill (mcEta_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3091  p_EoverEtrueVsR_[0]->Fill (mcConvR_,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3092 
3093 
3094  if ( ! isRunCentrally_ ) h2_etaVsRsim_[0]->Fill (mcEta_,mcConvR_);
3095 
3096  // here original tracks and their inner momentum is considered
3097  float dPhiTracksAtVtx = aConv->dPhiTracksAtVtx();
3098  h_DPhiTracksAtVtx_[type][0]->Fill( dPhiTracksAtVtx);
3099  if ( ! isRunCentrally_ ) h2_DPhiTracksAtVtxVsEta_->Fill( mcEta_, dPhiTracksAtVtx);
3100  if ( ! isRunCentrally_ ) h2_DPhiTracksAtVtxVsR_->Fill( mcConvR_, dPhiTracksAtVtx);
3101  p_DPhiTracksAtVtxVsEta_->Fill( mcEta_, dPhiTracksAtVtx);
3102  p_DPhiTracksAtVtxVsR_->Fill( mcConvR_, dPhiTracksAtVtx);
3103 
3104  h_DCotTracks_[type][0] ->Fill ( aConv->pairCotThetaSeparation() );
3105  if ( ! isRunCentrally_ ) h2_DCotTracksVsEta_->Fill( mcEta_, aConv->pairCotThetaSeparation() );
3106  if ( ! isRunCentrally_ ) h2_DCotTracksVsR_->Fill( mcConvR_, aConv->pairCotThetaSeparation() );
3107  p_DCotTracksVsEta_->Fill( mcEta_, aConv->pairCotThetaSeparation() );
3108  p_DCotTracksVsR_->Fill( mcConvR_, aConv->pairCotThetaSeparation() );
3109 
3110  if ( phoIsInBarrel ) {
3111  h_invMass_[type][1] ->Fill(invM);
3112  if ( aConv->conversionVertex().isValid() ) {
3113  h_convPtRes_[type][1]->Fill( refPt / (*mcPho).fourMomentum().et() );
3114  h_EoverPTracks_[type][1] ->Fill( eoverp ) ;
3115  if ( mcConvR_ < 15 ) h_EoverPTracks_[0][0] ->Fill( eoverp ) ;
3116  if ( mcConvR_ > 15 && mcConvR_< 58 ) h_EoverPTracks_[0][1] ->Fill( eoverp ) ;
3117  if ( mcConvR_ > 58 ) h_EoverPTracks_[0][2] ->Fill( eoverp ) ;
3118  h_PoverETracks_[type][1] ->Fill( 1./eoverp ) ;
3119  if ( ! isRunCentrally_ ) h2_EoverEtrueVsEoverP_[1] ->Fill( eoverp,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3120  if ( ! isRunCentrally_ ) h2_PoverPtrueVsEoverP_[1] ->Fill( eoverp, refP/ (*mcPho).fourMomentum().e() ) ;
3121  }
3122  h_DPhiTracksAtVtx_[type][1]->Fill( dPhiTracksAtVtx);
3123  h_DCotTracks_[type][1] ->Fill ( aConv->pairCotThetaSeparation() );
3124 
3125 
3126  }
3127 
3128  if ( phoIsInEndcap ) {
3129  h_invMass_[type][2] ->Fill(invM);
3130  if ( aConv->conversionVertex().isValid() ) {
3131  h_convPtRes_[type][2]->Fill( refPt / (*mcPho).fourMomentum().et() );
3132  h_EoverPTracks_[type][2] ->Fill( eoverp ) ;
3133  h_PoverETracks_[type][2] ->Fill( 1./eoverp ) ;
3134  if ( ! isRunCentrally_ ) h2_EoverEtrueVsEoverP_[2] ->Fill( eoverp,matchingPho->superCluster()->energy()/ (*mcPho).fourMomentum().e() ) ;
3135  if ( ! isRunCentrally_ ) h2_PoverPtrueVsEoverP_[2] ->Fill( eoverp, refP/ (*mcPho).fourMomentum().e() ) ;
3136  }
3137  h_DPhiTracksAtVtx_[type][2]->Fill( dPhiTracksAtVtx);
3138  h_DCotTracks_[type][2] ->Fill ( aConv->pairCotThetaSeparation() );
3139 
3140  }
3141 
3142  if ( aConv->conversionVertex().isValid() ) {
3143 
3144  h_convVtxdX_ ->Fill ( aConv->conversionVertex().position().x() - mcConvX_);
3145  h_convVtxdY_ ->Fill ( aConv->conversionVertex().position().y() - mcConvY_);
3146  h_convVtxdZ_ ->Fill ( aConv->conversionVertex().position().z() - mcConvZ_);
3147  h_convVtxdR_ ->Fill ( sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
3148 
3149  if ( fabs( mcConvEta_ ) <= 1.2 ) {
3150  h_convVtxdX_barrel_ ->Fill ( aConv->conversionVertex().position().x() - mcConvX_);
3151  h_convVtxdY_barrel_ ->Fill ( aConv->conversionVertex().position().y() - mcConvY_);
3152  h_convVtxdZ_barrel_ ->Fill ( aConv->conversionVertex().position().z() - mcConvZ_);
3153  h_convVtxdR_barrel_ ->Fill ( sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
3154  } else {
3155  h_convVtxdX_endcap_ ->Fill ( aConv->conversionVertex().position().x() - mcConvX_);
3156  h_convVtxdY_endcap_ ->Fill ( aConv->conversionVertex().position().y() - mcConvY_);
3157  h_convVtxdZ_endcap_ ->Fill ( aConv->conversionVertex().position().z() - mcConvZ_);
3158  h_convVtxdR_endcap_ ->Fill ( sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
3159  }
3160 
3161  h_convVtxdPhi_ ->Fill ( aConv->conversionVertex().position().phi() - mcConvPhi_);
3162  h_convVtxdEta_ ->Fill ( aConv->conversionVertex().position().eta() - mcConvEta_);
3163  if ( ! isRunCentrally_ ) h2_convVtxdRVsR_ ->Fill (mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_ );
3164  if ( ! isRunCentrally_ ) h2_convVtxdRVsEta_ ->Fill (mcEta_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_ );
3165  p_convVtxdRVsR_ ->Fill (mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_ );
3166  p_convVtxdRVsEta_ ->Fill (mcEta_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_ );
3167  float signX= aConv->refittedPairMomentum().x()/fabs(aConv->refittedPairMomentum().x());
3168  float signY= aConv->refittedPairMomentum().y()/fabs(aConv->refittedPairMomentum().y());
3169  float signZ= aConv->refittedPairMomentum().z()/fabs(aConv->refittedPairMomentum().z());
3170  p_convVtxdXVsX_ ->Fill (mcConvX_, (aConv->conversionVertex().position().x() - mcConvX_)*signX );
3171  p_convVtxdYVsY_ ->Fill (mcConvY_, (aConv->conversionVertex().position().y() - mcConvY_)*signY );
3172  p_convVtxdZVsZ_ ->Fill (mcConvZ_, (aConv->conversionVertex().position().z() - mcConvZ_)*signZ );
3173 
3174 
3175  if ( ! isRunCentrally_ ) h2_convVtxRrecVsTrue_ -> Fill (mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) );
3176 
3177 
3178 
3179  //float zPV = aConv->zOfPrimaryVertexFromTracks();
3180  float thetaConv=aConv->refittedPairMomentum().Theta();
3181  float thetaSC=matchingPho->superCluster()->position().theta();
3182  float rSC=sqrt(matchingPho->superCluster()->position().x()*matchingPho->superCluster()->position().x() +
3183  matchingPho->superCluster()->position().y()*matchingPho->superCluster()->position().y() );
3184  float zSC=matchingPho->superCluster()->position().z();
3185  float zPV = sqrt(rSC*rSC+zSC*zSC)*sin( thetaConv - thetaSC)/sin(thetaConv);
3186 
3187  h_zPVFromTracks_[0]->Fill ( zPV );
3188  h_dzPVFromTracks_[0]->Fill ( zPV- (*mcPho).primaryVertex().z() );
3189 
3190  if ( phoIsInBarrel ) {
3191  h_zPVFromTracks_[1]->Fill ( zPV );
3192  h_dzPVFromTracks_[1]->Fill ( zPV - (*mcPho).primaryVertex().z() );
3193  } else if ( phoIsInEndcap) {
3194  h_zPVFromTracks_[2]->Fill ( zPV );
3195  h_dzPVFromTracks_[2]->Fill ( zPV - (*mcPho).primaryVertex().z() );
3196  } else if ( phoIsInEndcapP) {
3197  h_zPVFromTracks_[3]->Fill ( zPV );
3198  h_dzPVFromTracks_[3]->Fill ( zPV - (*mcPho).primaryVertex().z() );
3199  } else if ( phoIsInEndcapM) {
3200  h_zPVFromTracks_[4]->Fill ( zPV );
3201  h_dzPVFromTracks_[4]->Fill ( zPV - (*mcPho).primaryVertex().z() );
3202  }
3203 
3204  p_dzPVVsR_ ->Fill(mcConvR_, zPV - (*mcPho).primaryVertex().z() );
3205  p_dzPVVsEta_ ->Fill(mcConvEta_, zPV - (*mcPho).primaryVertex().z() );
3206  if ( ! isRunCentrally_ ) h2_dzPVVsR_ ->Fill(mcConvR_, zPV - (*mcPho).primaryVertex().z() );
3207  }
3208 
3209  float dPhiTracksAtEcal=-99;
3210  float dEtaTracksAtEcal=-99;
3211  if (!aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[0].isNonnull() && aConv->bcMatchingWithTracks()[1].isNonnull() ) {
3212  nRecConvAssWithEcal_++;
3213  float recoPhi1 = aConv->ecalImpactPosition()[0].phi();
3214  float recoPhi2 = aConv->ecalImpactPosition()[1].phi();
3215  float recoEta1 = aConv->ecalImpactPosition()[0].eta();
3216  float recoEta2 = aConv->ecalImpactPosition()[1].eta();
3217  float bcPhi1 = aConv->bcMatchingWithTracks()[0]->phi();
3218  float bcPhi2 = aConv->bcMatchingWithTracks()[1]->phi();
3219  // unused float bcEta1 = aConv->bcMatchingWithTracks()[0]->eta();
3220  // unused float bcEta2 = aConv->bcMatchingWithTracks()[1]->eta();
3221  recoPhi1 = phiNormalization(recoPhi1);
3222  recoPhi2 = phiNormalization(recoPhi2);
3223  bcPhi1 = phiNormalization(bcPhi1);
3224  bcPhi2 = phiNormalization(bcPhi2);
3225  dPhiTracksAtEcal = recoPhi1 -recoPhi2;
3226  dPhiTracksAtEcal = phiNormalization( dPhiTracksAtEcal );
3227  dEtaTracksAtEcal = recoEta1 -recoEta2;
3228 
3229  h_DPhiTracksAtEcal_[type][0]->Fill( fabs(dPhiTracksAtEcal));
3230  if ( ! isRunCentrally_ ) h2_DPhiTracksAtEcalVsR_ ->Fill (mcConvR_, fabs(dPhiTracksAtEcal));
3231  if ( ! isRunCentrally_ ) h2_DPhiTracksAtEcalVsEta_ ->Fill (mcEta_, fabs(dPhiTracksAtEcal));
3232  p_DPhiTracksAtEcalVsR_ ->Fill (mcConvR_, fabs(dPhiTracksAtEcal));
3233  p_DPhiTracksAtEcalVsEta_ ->Fill (mcEta_, fabs(dPhiTracksAtEcal));
3234 
3235  h_DEtaTracksAtEcal_[type][0]->Fill( dEtaTracksAtEcal);
3236 
3237  if ( phoIsInBarrel ) {
3238  h_DPhiTracksAtEcal_[type][1]->Fill( fabs(dPhiTracksAtEcal));
3239  h_DEtaTracksAtEcal_[type][1]->Fill( dEtaTracksAtEcal);
3240  }
3241  if ( phoIsInEndcap ) {
3242  h_DPhiTracksAtEcal_[type][2]->Fill( fabs(dPhiTracksAtEcal));
3243  h_DEtaTracksAtEcal_[type][2]->Fill( dEtaTracksAtEcal);
3244  }
3245  }
3247  for (unsigned int i=0; i<tracks.size(); i++) {
3248  RefToBase<reco::Track> tfrb(tracks[i] );
3249  itAss= myAss.find( tfrb.get() );
3250  if ( itAss == myAss.end() ) continue;
3251 
3252  float trkProvenance=3;
3253  if ( tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "outInEcalSeededConv" ) trkProvenance=0;
3254  if ( tracks[0]->algoName() == "inOutEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv" ) trkProvenance=1;
3255  if ( ( tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv") ||
3256  ( tracks[1]->algoName() == "outInEcalSeededConv" && tracks[0]->algoName() == "inOutEcalSeededConv") ) trkProvenance=2;
3257 
3258  if ( ! isRunCentrally_ ) nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) );
3259  if ( ! isRunCentrally_ ) nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) );
3260  p_nHitsVsEta_[type] ->Fill (mcEta_, float(tracks[i]->numberOfValidHits()) -0.0001);
3261  p_nHitsVsR_[type] ->Fill (mcConvR_, float(tracks[i]->numberOfValidHits()) -0.0001);
3262  h_tkChi2_[type] ->Fill (tracks[i]->normalizedChi2() );
3263  h_tkChi2Large_[type] ->Fill (tracks[i]->normalizedChi2() );
3264  if ( ! isRunCentrally_ ) h2_Chi2VsEta_[0] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
3265  if ( ! isRunCentrally_ ) h2_Chi2VsR_[0] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
3266  p_Chi2VsEta_[0] ->Fill( mcEta_, tracks[i]->normalizedChi2() );
3267  p_Chi2VsR_[0] ->Fill( mcConvR_, tracks[i]->normalizedChi2() );
3268 
3269 
3270  float simPt = sqrt( ((*itAss).second)->momentum().perp2() );
3271  // float recPt = sqrt( aConv->tracks()[i]->innerMomentum().Perp2() ) ;
3272  float refPt=-9999.;
3273  float px=0, py=0;
3274 
3275  if ( aConv->conversionVertex().isValid() ) {
3276  reco::Track refTrack= aConv->conversionVertex().refittedTracks()[i];
3277  px= refTrack.momentum().x() ;
3278  py= refTrack.momentum().y() ;
3279  refPt=sqrt (px*px + py*py );
3280 
3281  float ptres= refPt - simPt ;
3282  // float pterror = aConv->tracks()[i]->ptError();
3283  float pterror = aConv->conversionVertex().refittedTracks()[i].ptError();
3284  if ( ! isRunCentrally_ ) {
3285  h2_PtRecVsPtSim_[0]->Fill ( simPt, refPt);
3286  if ( trkProvenance ==3 ) h2_PtRecVsPtSimMixProv_->Fill ( simPt, refPt);
3287  }
3288 
3289  h_TkPtPull_[0] ->Fill(ptres/pterror);
3290  if ( ! isRunCentrally_ ) h2_TkPtPull_[0] ->Fill(mcEta_, ptres/pterror);
3291 
3292  h_TkD0_[0]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
3293 
3294 
3295  // if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator" )
3296  if ( !aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[0]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
3297 
3298  if ( phoIsInBarrel ) {
3299  h_TkD0_[1]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
3300  h_TkPtPull_[1] ->Fill(ptres/pterror);
3301  if ( ! isRunCentrally_ ) h2_PtRecVsPtSim_[1]->Fill ( simPt, refPt);
3302  //if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator")
3303  if ( !aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[1]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
3304 
3305  }
3306  if ( phoIsInEndcap ) {
3307  h_TkD0_[2]->Fill ( tracks[i]->d0()* tracks[i]->charge() );
3308  h_TkPtPull_[2] ->Fill(ptres/pterror);
3309  if ( ! isRunCentrally_ ) h2_PtRecVsPtSim_[2]->Fill ( simPt, refPt);
3310  // if ( fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator")
3311  if ( !aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[i].isNonnull() ) hBCEnergyOverTrackPout_[2]->Fill ( aConv->bcMatchingWithTracks()[i]->energy()/sqrt(aConv->tracks()[i]->outerMomentum().Mag2()) );
3312  }
3313 
3314  }
3315 
3316  } // end loop over track
3317  } // end analysis of two associated tracks
3318  } // end analysis of two tracks
3319 
3320  } // loop over conversions
3321 
3323 
3324  reco::ConversionRefVector conversionsOneLeg = matchingPho->conversionsOneLeg();
3325  if ( !atLeastOneRecoTwoTrackConversion ) {
3326  for (unsigned int iConv=0; iConv<conversionsOneLeg.size(); iConv++) {
3327  reco::ConversionRef aConv=conversionsOneLeg[iConv];
3328  const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
3329 
3330  h_trkAlgo_->Fill ( tracks[0]->algo() );
3331  h_convAlgo_->Fill ( aConv->algo() );
3332 
3333  int nAssT=0;
3334  std::map<const reco::Track*,TrackingParticleRef> myAss;
3335  for (unsigned int i=0; i<tracks.size(); i++) {
3336 
3337 
3338  p_nHitsVsEtaSL_[0] ->Fill (mcEta_, float(tracks[0]->numberOfValidHits()-0.0001) );
3339  p_nHitsVsRSL_[0] ->Fill (mcConvR_, float(tracks[0]->numberOfValidHits()-0.0001) );
3340  h_tkChi2SL_[0] ->Fill (tracks[0]->normalizedChi2() );
3341 
3342 
3343  float eoverp = photonE/tracks[0]->p();
3344  h_EoverP_SL_[0]->Fill ( eoverp );
3345  if ( phoIsInBarrel ) {
3346  h_EoverP_SL_[1]->Fill ( eoverp );
3347  } else {
3348  h_EoverP_SL_[2]->Fill ( eoverp );
3349  }
3350  h_convSLVtxRvsZ_[0] ->Fill ( tracks[0]->innerPosition().z(), sqrt( tracks[0]->innerPosition().Perp2() ) );
3351  if ( fabs(mcEta_) <=1.) {
3352  h_convSLVtxRvsZ_[1] ->Fill ( tracks[0]->innerPosition().z(), sqrt( tracks[0]->innerPosition().Perp2() ) );
3353  } else {
3354  h_convSLVtxRvsZ_[2] ->Fill ( tracks[0]->innerPosition().z(), sqrt( tracks[0]->innerPosition().Perp2() ) );
3355  }
3356 
3357  RefToBase<reco::Track> tfrb = tracks[i];
3359  tc.push_back(tfrb);
3360  reco::SimToRecoCollection q = trackAssociator->associateSimToReco(tc,theConvTP_);
3361  std::vector<std::pair<RefToBase<reco::Track>, double> > trackV;
3362  int tpI = 0;
3363 
3364  if (q.find(theConvTP_[0])!=q.end()){
3365  trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q[theConvTP_[0]];
3366  } else if (q.find(theConvTP_[1])!=q.end()){
3367  trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >) q[theConvTP_[1]];
3368  tpI = 1;
3369  }
3370 
3371  if ( trackV.empty() ) continue;
3372  edm::RefToBase<reco::Track> tr = trackV.front().first;
3373  myAss.insert( std::make_pair (tr.get(),theConvTP_[tpI] ) );
3374  nAssT++;
3375 
3376  }
3377 
3378  if ( nAssT > 0 ) {
3379  h_SimConvOneMTracks_[0]->Fill( mcEta_ ) ;
3380  h_SimConvOneMTracks_[1]->Fill( mcPhi_ );
3381  h_SimConvOneMTracks_[2]->Fill( mcConvR_ );
3382  h_SimConvOneMTracks_[3]->Fill( mcConvZ_ );
3383  h_SimConvOneMTracks_[4]->Fill( (*mcPho).fourMomentum().et());
3384 
3385  }
3386  } // End loop over single leg conversions
3387 
3388  }
3389 
3390  } // if !fastSim
3391  } // End loop over generated particles
3392  } // End loop over simulated Photons
3393 
3394 
3395  if ( ! isRunCentrally_ ) {
3396  h_nSimPho_[0]->Fill(float(nSimPho_[0]));
3397  h_nSimPho_[1]->Fill(float(nSimPho_[1]));
3398  h_nSimConv_[0]->Fill(float(nSimConv_[0]));
3399  h_nSimConv_[1]->Fill(float(nSimConv_[1]));
3400  }
3401 
3402  if ( !fastSim_) {
3404  for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
3405  reco::Photon aPho = reco::Photon(*iPho);
3406  // float et= aPho.superCluster()->energy()/cosh( aPho.superCluster()->eta()) ;
3408  for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
3409  reco::ConversionRef aConv=conversions[iConv];
3410  double like = aConv->MVAout();
3411  if ( like < likelihoodCut_ ) continue;
3412  //std::vector<reco::TrackRef> tracks = aConv->tracks();
3413  const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
3414  if (tracks.size() < 2 ) continue;
3415 
3416  RefToBase<reco::Track> tk1 = aConv->tracks().front();
3417  RefToBase<reco::Track> tk2 = aConv->tracks().back();
3419  tc1.push_back(tk1);
3420  tc2.push_back(tk2);
3421 
3422  bool phoIsInBarrel=false;
3423  bool phoIsInEndcap=false;
3424  if ( fabs(aPho.superCluster()->position().eta()) < 1.479 ) {
3425  phoIsInBarrel=true;
3426  } else {
3427  phoIsInEndcap=true;
3428  }
3429 
3430  if ( dCotCutOn_ ) {
3431  if ( ( fabs(mcEta_) > 1.1 && fabs (mcEta_) < 1.4 ) &&
3432  fabs( aConv->pairCotThetaSeparation() ) > dCotHardCutValue_ ) continue;
3433  if ( fabs( aConv->pairCotThetaSeparation() ) > dCotCutValue_ ) continue;
3434  }
3435 
3436 
3437  h_RecoConvTwoTracks_[0]->Fill( aPho.eta() ) ;
3438  h_RecoConvTwoTracks_[1]->Fill( aPho.phi() );
3439  if ( aConv->conversionVertex().isValid() ) h_RecoConvTwoTracks_[2]->Fill( aConv->conversionVertex().position().perp2() );
3440  h_RecoConvTwoTracks_[3]->Fill( aConv->conversionVertex().position().z() );
3441  h_RecoConvTwoTracks_[4]->Fill( aPho.et() ) ;
3442 
3443 
3444 
3445  int nAssT2=0;
3446  for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
3447  // mcConvPt_= (*mcPho).fourMomentum().et();
3448  float mcPhi= (*mcPho).fourMomentum().phi();
3449  //simPV_Z = (*mcPho).primaryVertex().z();
3450  mcPhi_= phiNormalization(mcPhi);
3451  mcEta_= (*mcPho).fourMomentum().pseudoRapidity();
3452  mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z() );
3453  //mcConvR_= (*mcPho).vertex().perp();
3454  //mcConvX_= (*mcPho).vertex().x();
3455  //mcConvY_= (*mcPho).vertex().y();
3456  //mcConvZ_= (*mcPho).vertex().z();
3457  //mcConvEta_= (*mcPho).vertex().eta();
3458  //mcConvPhi_= (*mcPho).vertex().phi();
3459  if ( fabs(mcEta_) > END_HI ) continue;
3460  // if (mcConvPt_<minPhoPtForPurity) continue;
3461  //if (fabs(mcEta_)>maxPhoEtaForPurity) continue;
3462  //if (fabs(mcConvZ_)>maxPhoZForPurity) continue;
3463  //if (mcConvR_>maxPhoRForEffic) continue;
3464 
3465  if ( (*mcPho).isAConversion() != 1 ) continue;
3466  if (!( ( fabs(mcEta_) <= BARL && mcConvR_ <85 ) ||
3467  ( fabs(mcEta_) > BARL && fabs(mcEta_) <=END_HI && fabs( (*mcPho).vertex().z() ) < 210 ) ) )
3468  continue;
3469 
3470  theConvTP_.clear();
3471  for(size_t i = 0; i < trackingParticles.size(); ++i){
3472  TrackingParticleRef tp (ElectronTPHandle,i);
3473  if ( fabs( tp->vx() - (*mcPho).vertex().x() ) < 0.0001 &&
3474  fabs( tp->vy() - (*mcPho).vertex().y() ) < 0.0001 &&
3475  fabs( tp->vz() - (*mcPho).vertex().z() ) < 0.0001) {
3476  theConvTP_.push_back( tp );
3477  }
3478  }
3479 
3480 
3481  if ( theConvTP_.size() < 2 ) continue;
3482 
3483  reco::RecoToSimCollection const& p1 = trackAssociator->associateRecoToSim(tc1,theConvTP_);
3484  reco::RecoToSimCollection const& p2 = trackAssociator->associateRecoToSim(tc2,theConvTP_);
3485  std::vector<std::pair<RefToBase<reco::Track>, double> > trackV1, trackV2;
3486 
3487  auto itP1 = p1.find(tk1);
3488  auto itP2 = p2.find(tk2);
3489  bool good = (itP1 != p1.end()) and (not itP1->val.empty()) and (itP2 != p2.end()) and (not itP2->val.empty());
3490  if(not good) {
3491  itP1 = p1.find(tk2);
3492  itP2 = p2.find(tk1);
3493  good = (itP1 != p1.end()) and (not itP1->val.empty()) and (itP2 != p2.end()) and (not itP2->val.empty());
3494  }
3495  if(good) {
3496  std::vector<std::pair<TrackingParticleRef, double> > const& tp1 = itP1->val;
3497  std::vector<std::pair<TrackingParticleRef, double> > const& tp2 = itP2->val;
3498 
3499  TrackingParticleRef tpr1 = tp1.front().first;
3500  TrackingParticleRef tpr2 = tp2.front().first;
3501 
3502  if (abs(tpr1->pdgId())==11&&abs(tpr2->pdgId())==11) {
3503  if ( (tpr1->parentVertex()->sourceTracks_end()-tpr1->parentVertex()->sourceTracks_begin()==1) &&
3504  (tpr2->parentVertex()->sourceTracks_end()-tpr2->parentVertex()->sourceTracks_begin()==1)) {
3505  if (tpr1->parentVertex().key()==tpr2->parentVertex().key() && ((*tpr1->parentVertex()->sourceTracks_begin())->pdgId()==22)) {
3506  nAssT2 = 2;
3507  break;
3508  }
3509  }
3510  }
3511 
3512  }
3513 
3514  } // end loop over simulated photons
3515 
3516 
3517  if ( nAssT2 == 2) {
3518 
3519 
3520  h_RecoConvTwoMTracks_[0]->Fill( aPho.eta() ) ;
3521  h_RecoConvTwoMTracks_[1]->Fill( aPho.phi() );
3522  if ( aConv->conversionVertex().isValid() ) h_RecoConvTwoMTracks_[2]->Fill( aConv->conversionVertex().position().perp2() );
3523  h_RecoConvTwoMTracks_[3]->Fill( aConv->conversionVertex().position().z() );
3524  h_RecoConvTwoMTracks_[4]->Fill( aPho.et() ) ;
3525 
3526  }
3527 
3528 
3530  if ( aConv->conversionVertex().isValid() ) {
3531 
3532  float chi2Prob = ChiSquaredProbability( aConv->conversionVertex().chi2(), aConv->conversionVertex().ndof() );
3533  double convR= sqrt(aConv->conversionVertex().position().perp2());
3534  double scalar = aConv->conversionVertex().position().x()*aConv->pairMomentum().x() +
3535  aConv->conversionVertex().position().y()*aConv->pairMomentum().y();
3536 
3537 
3538  if ( scalar < 0 ) convR= -sqrt(aConv->conversionVertex().position().perp2());
3539  h_convVtxRvsZ_[0] ->Fill ( fabs (aConv->conversionVertex().position().z() ), sqrt(aConv->conversionVertex().position().perp2()) ) ;
3540 
3541  if (!aConv->caloCluster().empty()) {
3542  if ( ! isRunCentrally_ ) h2_etaVsRreco_[0]->Fill (aConv->caloCluster()[0]->eta(),sqrt(aConv->conversionVertex().position().perp2()) );
3543  if ( fabs(aConv->caloCluster()[0]->eta() ) <= 1.) {
3544 
3545  h_convVtxYvsX_ ->Fill ( aConv->conversionVertex().position().y() , aConv->conversionVertex().position().x() ) ;
3546  h_convVtxRvsZ_[1] ->Fill ( fabs (aConv->conversionVertex().position().z() ), convR ) ;
3547 
3548  if ( ! isRunCentrally_ ) {
3549  h_convVtxYvsX_zoom_[0] ->Fill ( aConv->conversionVertex().position().y() , aConv->conversionVertex().position().x() ) ;
3550  h_convVtxYvsX_zoom_[1] ->Fill ( aConv->conversionVertex().position().y() , aConv->conversionVertex().position().x() ) ;
3551  h_convVtxRvsZ_zoom_[0] ->Fill ( fabs (aConv->conversionVertex().position().z() ), convR ) ;
3552  h_convVtxRvsZ_zoom_[1] ->Fill ( fabs (aConv->conversionVertex().position().z() ), convR ) ;
3553  }
3554 
3555  }
3556  if ( fabs(aConv->caloCluster()[0]->eta() ) > 1.) h_convVtxRvsZ_[2] ->Fill ( fabs (aConv->conversionVertex().position().z() ), convR ) ;
3557  }
3558 
3559 
3560  h_vtxChi2Prob_[0]->Fill( chi2Prob );
3561  h_vtxChi2_[0]->Fill( aConv->conversionVertex().normalizedChi2() );
3562  if ( phoIsInBarrel ) {
3563  h_vtxChi2Prob_[1]->Fill( chi2Prob );
3564  h_vtxChi2_[1]->Fill( aConv->conversionVertex().normalizedChi2() );
3565  }
3566  if ( phoIsInEndcap ) {
3567  h_vtxChi2Prob_[2]->Fill( chi2Prob );
3568  h_vtxChi2_[2]->Fill( aConv->conversionVertex().normalizedChi2() );
3569  }
3570 
3571 
3572  } // end conversion vertex valid
3573  } // end loop over reco conversions
3574  } // end loop on all reco photons
3575  } // if !fastSim
3576 
3577 
3578 
3580  float nPho=0;
3581  for (reco::GenJetCollection::const_iterator genJetIter = genJetCollection.begin();
3582  genJetIter != genJetCollection.end(); ++genJetIter) {
3583 
3584  if ( genJetIter->pt() < minPhoEtCut_ ) continue;
3585  if ( fabs(genJetIter->eta()) > 2.5 ) continue;
3586 
3587  float mcJetPhi= genJetIter->phi();
3588  mcJetPhi_= phiNormalization(mcJetPhi);
3589  mcJetEta_= genJetIter->eta();
3590  float mcJetPt = genJetIter->pt() ;
3591 
3592  h_SimJet_[0]->Fill ( mcJetEta_);
3593  h_SimJet_[1]->Fill ( mcJetPhi_);
3594  h_SimJet_[2]->Fill ( mcJetPt );
3595 
3596  std::vector<reco::Photon> thePhotons;
3597  bool matched=false;
3598 
3599  reco::Photon matchingPho;
3600  for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
3601  reco::Photon aPho = reco::Photon(*iPho);
3602  float phiPho=aPho.phi();
3603  float etaPho=aPho.eta();
3604  float deltaPhi = phiPho-mcJetPhi_;
3605  float deltaEta = etaPho-mcJetEta_;
3606  if ( deltaPhi > pi ) deltaPhi -= twopi;
3607  if ( deltaPhi < -pi) deltaPhi += twopi;
3608  deltaPhi=pow(deltaPhi,2);
3609  deltaEta=pow(deltaEta,2);
3610  float delta = sqrt( deltaPhi+deltaEta);
3611  if ( delta<0.3 ) {
3612  matchingPho = * iPho;
3613  matched = true;
3614  }
3615  } // end loop over reco photons
3616 
3617  if (! matched ) continue;
3618  nPho++;
3619 
3620  h_MatchedSimJet_[0]->Fill( mcJetEta_ ) ;
3621  h_MatchedSimJet_[1]->Fill( mcJetPhi_ );
3622  h_MatchedSimJet_[2]->Fill( mcJetPt );
3623 
3624 
3625  bool phoIsInBarrel=false;
3626  bool phoIsInEndcap=false;
3627  if ( fabs(matchingPho.superCluster()->position().eta() ) < 1.479 ) {
3628  phoIsInBarrel=true;
3629  } else {
3630  phoIsInEndcap=true;
3631  }
3632  edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
3633  if ( phoIsInBarrel ) {
3634  // Get handle to rec hits ecal barrel
3635  e.getByToken(barrelEcalHits_, ecalRecHitHandle);
3636  if (!ecalRecHitHandle.isValid()) {
3637  Labels l;
3638  labelsForToken(barrelEcalHits_, l);
3639  edm::LogError("PhotonProducer")
3640  << "Error! Can't get the product "
3641  << l.module;
3642  return;
3643  }
3644 
3645  } else if ( phoIsInEndcap ) {
3646 
3647  // Get handle to rec hits ecal encap
3648  e.getByToken(endcapEcalHits_, ecalRecHitHandle);
3649  if (!ecalRecHitHandle.isValid()) {
3650  Labels l;
3651  labelsForToken(barrelEcalHits_, l);
3652  edm::LogError("PhotonProducer")
3653  << "Error! Can't get the product "
3654  << l.module;
3655  return;
3656  }
3657 
3658  }
3659 
3660  const EcalRecHitCollection ecalRecHitCollection = *(ecalRecHitHandle.product());
3661  float photonE = matchingPho.energy();
3662  float photonEt= matchingPho.et();
3663  float r9 = matchingPho.r9();
3664  float r1 = matchingPho.r1x5();
3665  float r2 = matchingPho.r2x5();
3666  float sigmaIetaIeta = matchingPho.sigmaIetaIeta();
3667  float hOverE = matchingPho.hadronicOverEm();
3668  float ecalIso = matchingPho.ecalRecHitSumEtConeDR04();
3669  float hcalIso = matchingPho.hcalTowerSumEtConeDR04();
3670  float trkIso = matchingPho.trkSumPtSolidConeDR04();
3671  float nIsoTrk = matchingPho.nTrkSolidConeDR04();
3672  std::vector< std::pair<DetId, float> >::const_iterator rhIt;
3673 
3674  bool atLeastOneDeadChannel=false;
3675  for(reco::CaloCluster_iterator bcIt = matchingPho.superCluster()->clustersBegin();bcIt != matchingPho.superCluster()->clustersEnd(); ++bcIt) {
3676  for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
3677 
3678  for(EcalRecHitCollection::const_iterator it = ecalRecHitCollection.begin(); it != ecalRecHitCollection.end(); ++it) {
3679  if (rhIt->first == (*it).id() ) {
3680  if ( (*it).recoFlag() == 9 ) {
3681  atLeastOneDeadChannel=true;
3682  break;
3683  }
3684  }
3685  }
3686  }
3687  }
3688 
3689  if ( atLeastOneDeadChannel ) {
3690  h_MatchedSimJetBadCh_[0]->Fill( mcJetEta_ ) ;
3691  h_MatchedSimJetBadCh_[1]->Fill( mcJetPhi_ );
3692  h_MatchedSimJetBadCh_[2]->Fill( mcJetPt );
3693 
3694  }
3695 
3696  h_scBkgEta_->Fill( matchingPho.superCluster()->eta() );
3697  h_scBkgPhi_->Fill( matchingPho.superCluster()->phi() );
3698  h_scBkgE_[0]->Fill( matchingPho.superCluster()->energy() );
3699  h_scBkgEt_[0]->Fill( matchingPho.superCluster()->energy()/cosh( matchingPho.superCluster()->eta()) );
3700  //
3701  h_phoBkgEta_->Fill( matchingPho.eta() );
3702  h_phoBkgPhi_->Fill( matchingPho.phi() );
3703  h_phoBkgE_[0]->Fill( photonE );
3704  h_phoBkgEt_[0]->Fill( photonEt);
3705  h_phoBkgDEta_->Fill ( matchingPho.eta() - mcJetEta_ );
3706  h_phoBkgDPhi_->Fill ( matchingPho.phi() - mcJetPhi_ );
3707 
3708  h_r9Bkg_[0]->Fill( r9 );
3709  h_r1Bkg_[0]->Fill( r1 );
3710  h_r2Bkg_[0]->Fill( r2 );
3711  h_sigmaIetaIetaBkg_[0]->Fill( sigmaIetaIeta );
3712  h_hOverEBkg_[0]->Fill( hOverE );
3713  h_ecalRecHitSumEtConeDR04Bkg_[0]->Fill( ecalIso );
3714  h_hcalTowerSumEtConeDR04Bkg_[0]->Fill( hcalIso );
3715  h_isoTrkSolidConeDR04Bkg_[0]->Fill( trkIso );
3716  h_nTrkSolidConeDR04Bkg_[0]->Fill( nIsoTrk );
3717 
3718  if ( ! isRunCentrally_ ) {
3719 
3720  h2_r9VsEtaBkg_ -> Fill (mcJetEta_, r9);
3721  h2_r9VsEtBkg_ -> Fill (mcJetPt, r9);
3722  h2_r1VsEtaBkg_ -> Fill (mcJetEta_, r1);
3723  h2_r1VsEtBkg_ -> Fill (mcJetPt, r1);
3724  h2_r2VsEtaBkg_ -> Fill (mcJetEta_, r2);
3725  h2_r2VsEtBkg_ -> Fill (mcJetPt, r2);
3726  h2_sigmaIetaIetaVsEtaBkg_ -> Fill (mcJetEta_, sigmaIetaIeta );
3727  h2_sigmaIetaIetaVsEtBkg_[0] -> Fill (mcJetPt, sigmaIetaIeta);
3728  h2_hOverEVsEtaBkg_ -> Fill (mcJetEta_, hOverE );
3729  h2_hOverEVsEtBkg_ -> Fill (mcJetPt, hOverE);
3730 
3731  p_r1VsEtaBkg_ -> Fill (mcJetEta_, r1);
3732  p_r1VsEtBkg_ -> Fill (mcJetPt, r1);
3733  p_r2VsEtaBkg_ -> Fill (mcJetEta_, r2);
3734  p_r2VsEtBkg_ -> Fill (mcJetPt, r2);
3735  p_sigmaIetaIetaVsEtaBkg_ -> Fill (mcJetEta_, sigmaIetaIeta );
3736  p_sigmaIetaIetaVsEtBkg_[0] -> Fill (mcJetPt, sigmaIetaIeta);
3737  p_hOverEVsEtaBkg_ -> Fill (mcJetEta_, hOverE );
3738  p_hOverEVsEtBkg_ -> Fill (mcJetPt, hOverE);
3739 
3740  }
3741 
3742 
3743  if ( ! isRunCentrally_ ) {
3744  h2_ecalRecHitSumEtConeDR04VsEtaBkg_ -> Fill (mcJetEta_, ecalIso );
3745  h2_ecalRecHitSumEtConeDR04VsEtBkg_[0] -> Fill ( mcJetPt, ecalIso);
3746  h2_hcalTowerSumEtConeDR04VsEtaBkg_ -> Fill (mcJetEta_, hcalIso );
3747  h2_hcalTowerSumEtConeDR04VsEtBkg_[0] -> Fill ( mcJetPt, hcalIso);
3748  p_ecalRecHitSumEtConeDR04VsEtaBkg_ -> Fill (mcJetEta_, ecalIso );
3749  p_ecalRecHitSumEtConeDR04VsEtBkg_[0] -> Fill ( mcJetPt, ecalIso);
3750  p_hcalTowerSumEtConeDR04VsEtaBkg_ -> Fill (mcJetEta_, hcalIso );
3751  p_hcalTowerSumEtConeDR04VsEtBkg_[0] -> Fill ( mcJetPt, hcalIso);
3752  p_isoTrkSolidConeDR04VsEtaBkg_ -> Fill (mcJetEta_, trkIso );
3753  p_isoTrkSolidConeDR04VsEtBkg_[0] -> Fill (mcJetPt, trkIso);
3754  p_nTrkSolidConeDR04VsEtaBkg_ -> Fill (mcJetEta_, nIsoTrk );
3755  p_nTrkSolidConeDR04VsEtBkg_[0] -> Fill (mcJetPt, nIsoTrk);
3756  h2_isoTrkSolidConeDR04VsEtaBkg_ -> Fill (mcJetEta_, trkIso );
3757  h2_isoTrkSolidConeDR04VsEtBkg_[0] -> Fill (mcJetPt, trkIso);
3758  h2_nTrkSolidConeDR04VsEtaBkg_ -> Fill (mcJetEta_, nIsoTrk );
3759  h2_nTrkSolidConeDR04VsEtBkg_[0] -> Fill (mcJetPt, nIsoTrk);
3760 
3761  }
3762 
3763 
3764  if ( phoIsInBarrel ) {
3765 
3766  h_r9Bkg_[1]->Fill( r9 );
3767  h_r1Bkg_[1]->Fill( r1 );
3768  h_r2Bkg_[1]->Fill( r2 );
3769 
3770 
3771  h_sigmaIetaIetaBkg_[1]->Fill( sigmaIetaIeta );
3772  h_hOverEBkg_[1]->Fill( hOverE );
3773  h_ecalRecHitSumEtConeDR04Bkg_[1]->Fill( ecalIso );
3774  h_hcalTowerSumEtConeDR04Bkg_[1]->Fill( hcalIso );
3775  h_isoTrkSolidConeDR04Bkg_[1]->Fill( trkIso );
3776  h_nTrkSolidConeDR04Bkg_[1]->Fill( nIsoTrk );
3777 
3778  if ( ! isRunCentrally_ ) {
3779  h2_sigmaIetaIetaVsEtBkg_[1] -> Fill (mcJetPt, sigmaIetaIeta);
3780  h2_isoTrkSolidConeDR04VsEtBkg_[1] -> Fill (mcJetPt, trkIso);
3781  h2_nTrkSolidConeDR04VsEtBkg_[1] -> Fill (mcJetPt, nIsoTrk);
3782  h2_ecalRecHitSumEtConeDR04VsEtBkg_[1] -> Fill ( mcJetPt, ecalIso);
3783  h2_hcalTowerSumEtConeDR04VsEtBkg_[1] -> Fill ( mcJetPt, hcalIso);
3784  p_sigmaIetaIetaVsEtBkg_[1] -> Fill (mcJetPt, sigmaIetaIeta);
3785  p_ecalRecHitSumEtConeDR04VsEtBkg_[1] -> Fill ( mcJetPt, ecalIso);
3786  p_hcalTowerSumEtConeDR04VsEtBkg_[1] -> Fill ( mcJetPt, hcalIso);
3787  p_isoTrkSolidConeDR04VsEtBkg_[1] -> Fill (mcJetPt, trkIso);
3788  p_nTrkSolidConeDR04VsEtBkg_[1] -> Fill (mcJetPt, nIsoTrk);
3789  }
3790  } else if ( phoIsInEndcap ) {
3791 
3792  h_r9Bkg_[2]->Fill( r9 );
3793  h_r1Bkg_[2]->Fill( r1 );
3794  h_r2Bkg_[2]->Fill( r2 );
3795 
3796  h_sigmaIetaIetaBkg_[2]->Fill( sigmaIetaIeta );
3797  h_hOverEBkg_[2]->Fill( hOverE );
3798  h_ecalRecHitSumEtConeDR04Bkg_[2]->Fill( ecalIso );
3799  h_hcalTowerSumEtConeDR04Bkg_[2]->Fill( hcalIso );
3800  h_isoTrkSolidConeDR04Bkg_[2]->Fill( trkIso );
3801  h_nTrkSolidConeDR04Bkg_[2]->Fill( nIsoTrk );
3802 
3803  if ( ! isRunCentrally_ ) {
3804  h2_sigmaIetaIetaVsEtBkg_[2] -> Fill (mcJetPt, sigmaIetaIeta);
3805  h2_isoTrkSolidConeDR04VsEtBkg_[2] -> Fill (mcJetPt, trkIso);
3806  h2_nTrkSolidConeDR04VsEtBkg_[2] -> Fill (mcJetPt, nIsoTrk);
3807  h2_ecalRecHitSumEtConeDR04VsEtBkg_[2] -> Fill ( mcJetPt, ecalIso);
3808  h2_hcalTowerSumEtConeDR04VsEtBkg_[2] -> Fill ( mcJetPt, hcalIso);
3809  p_sigmaIetaIetaVsEtBkg_[2] -> Fill (mcJetPt, sigmaIetaIeta);
3810  p_ecalRecHitSumEtConeDR04VsEtBkg_[2] -> Fill ( mcJetPt, ecalIso);
3811  p_hcalTowerSumEtConeDR04VsEtBkg_[2] -> Fill ( mcJetPt, hcalIso);
3812  p_isoTrkSolidConeDR04VsEtBkg_[2] -> Fill (mcJetPt, trkIso);
3813  p_nTrkSolidConeDR04VsEtBkg_[2] -> Fill (mcJetPt, nIsoTrk);
3814  }
3815  }
3816 
3817  if ( !fastSim_) {
3820  for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
3821  reco::ConversionRef aConv=conversions[iConv];
3822  //std::vector<reco::TrackRef> tracks = aConv->tracks();
3823  const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
3824  double like = aConv->MVAout();
3825  if ( like < likelihoodCut_ ) continue;
3826  if ( tracks.size() < 2 ) continue;
3827  if (!aConv->caloCluster().empty()) {
3828  h_convEtaBkg_->Fill( aConv->caloCluster()[0]->eta() );
3829  h_convPhiBkg_->Fill( aConv->caloCluster()[0]->phi() );
3830  }
3831  h_mvaOutBkg_[0]-> Fill(like);
3832  float eoverp= aConv->EoverP();
3833  h_EoverPTracksBkg_[0] ->Fill( eoverp ) ;
3834  h_PoverETracksBkg_[0] ->Fill( 1./eoverp ) ;
3835  h_DCotTracksBkg_[0] ->Fill ( aConv->pairCotThetaSeparation() );
3836  float dPhiTracksAtVtx = aConv->dPhiTracksAtVtx();
3837  h_DPhiTracksAtVtxBkg_[0]->Fill( dPhiTracksAtVtx);
3838 
3839  if ( phoIsInBarrel ) {
3840  h_mvaOutBkg_[1]-> Fill(like);
3841  h_EoverPTracksBkg_[1] ->Fill( eoverp ) ;
3842  h_PoverETracksBkg_[1] ->Fill( 1./eoverp ) ;
3843  h_DCotTracksBkg_[1] ->Fill ( aConv->pairCotThetaSeparation() );
3844  h_DPhiTracksAtVtxBkg_[1]->Fill( dPhiTracksAtVtx);
3845  } else if ( phoIsInEndcap ) {
3846  h_mvaOutBkg_[2]-> Fill(like);
3847  h_EoverPTracksBkg_[2] ->Fill( eoverp ) ;
3848  h_PoverETracksBkg_[2] ->Fill( 1./eoverp ) ;
3849  h_DCotTracksBkg_[2] ->Fill ( aConv->pairCotThetaSeparation() );
3850  h_DPhiTracksAtVtxBkg_[2]->Fill( dPhiTracksAtVtx);
3851  }
3852 
3853  if ( aConv->conversionVertex().isValid() ) {
3854 
3855  double convR= sqrt(aConv->conversionVertex().position().perp2());
3856  double scalar = aConv->conversionVertex().position().x()*aConv->pairMomentum().x() +
3857  aConv->conversionVertex().position().y()*aConv->pairMomentum().y();
3858  if ( scalar < 0 ) convR= -sqrt(aConv->conversionVertex().position().perp2());
3859 
3860  if ( ! isRunCentrally_ ) {
3861  h_convVtxRvsZBkg_[0] ->Fill ( fabs (aConv->conversionVertex().position().z() ), sqrt(aConv->conversionVertex().position().perp2()) ) ;
3862  if ( !aConv->caloCluster().empty() && fabs(aConv->caloCluster()[0]->eta() ) <= 1. ) {
3863  h_convVtxYvsXBkg_ ->Fill ( aConv->conversionVertex().position().y() , aConv->conversionVertex().position().x() ) ;
3864  h_convVtxRvsZBkg_[1] ->Fill ( fabs (aConv->conversionVertex().position().z() ), convR ) ;
3865  }
3866  }
3867 
3868 
3869  } // end vertex valid
3870 
3871 
3872  } // end loop over conversions
3873  } // if !fastSim
3874  } // end loop over sim jets
3875 
3877  for ( reco::GenParticleCollection::const_iterator mcIter=genParticles->begin() ; mcIter!=genParticles->end() ; mcIter++ ) {
3878  if ( !(mcIter->pdgId() == 22 ) ) continue;
3879  if ( mcIter->mother() != nullptr and !(mcIter->mother()->pdgId()==25) ) continue;
3880  if ( fabs(mcIter->eta()) > 2.5 ) continue;
3881 
3882  float mcPhi= mcIter->phi();
3883  float mcEta= mcIter->eta();
3884  //mcEta = etaTransformation(mcEta, (*mcPho).primaryVertex().z() );
3885  float mcEnergy=mcIter->energy();
3886 
3887 
3888  double dR = 9999999.;
3889  float minDr=10000.;
3890  int iMatch=-1;
3891  bool matched=false;
3892 
3893  for(unsigned int ipho=0; ipho < photonHandle->size(); ipho++) {
3894  reco::PhotonRef pho(reco::PhotonRef(photonHandle, ipho));
3895 
3896  double dphi = pho->phi()-mcPhi;
3897  if (std::fabs(dphi)>CLHEP::pi)
3898  { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
3899  double deta = pho->superCluster()->position().eta()-mcEta;
3900 
3901  dR = sqrt(pow((deta),2) + pow(dphi,2));
3902  if ( dR<0.1 && dR< minDr ) {
3903  minDr=dR;
3904  iMatch=ipho;
3905  }
3906  }
3907 
3908 
3909  if ( iMatch >-1) matched=true;
3910  if ( ! matched) continue;
3911 
3912 
3913  reco::PhotonRef matchingPho(reco::PhotonRef(photonHandle, iMatch));
3914 
3915  bool phoIsInBarrel=false;
3916  bool phoIsInEndcap=false;
3917 
3918  float phoEta = matchingPho->superCluster()->position().eta();
3919  if ( fabs(phoEta) < 1.479) {
3920  phoIsInBarrel=true;
3921  } else {
3922  phoIsInEndcap=true;
3923  }
3924 
3925 
3926 
3927  float photonE = matchingPho->energy();
3928  float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type())/matchingPho->energy();
3929  float photonEt= matchingPho->energy()/cosh( matchingPho->eta()) ;
3930  // float photonERegr1 = matchingPho->getCorrectedEnergy(reco::Photon::regression1);
3931  //float photonERegr2 = matchingPho->getCorrectedEnergy(reco::Photon::regression2);
3932  float r9 = matchingPho->r9();
3933  float full5x5_r9 = matchingPho->full5x5_r9();
3934  float r1 = matchingPho->r1x5();
3935  float r2 = matchingPho->r2x5();
3936  float sigmaIetaIeta = matchingPho->sigmaIetaIeta();
3937  float full5x5_sieie = matchingPho->full5x5_sigmaIetaIeta();
3938  float hOverE = matchingPho->hadronicOverEm();
3939  float newhOverE = matchingPho->hadTowOverEm();
3940  float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
3941  float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
3942  float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
3943  float trkIso = matchingPho->trkSumPtSolidConeDR04();
3944  float nIsoTrk = matchingPho->nTrkSolidConeDR04();
3945  // PF related quantities
3946  float chargedHadIso = matchingPho->chargedHadronIso();
3947  float neutralHadIso = matchingPho->neutralHadronIso();
3948  float photonIso = matchingPho->photonIso();
3949  // float etOutsideMustache = matchingPho->etOutsideMustache();
3950  // int nClusterOutsideMustache = matchingPho->nClusterOutsideMustache();
3951  //float pfMVA = matchingPho->pfMVA();
3952 
3953  if ( ( photonEt > 14 && newhOverE <0.15 ) || ( photonEt > 10 && photonEt < 14 && chargedHadIso <10 ) ) {
3954 
3955 
3956  h_scEta_miniAOD_[0]->Fill( matchingPho->superCluster()->eta() );
3957  h_scPhi_miniAOD_[0]->Fill( matchingPho->superCluster()->phi() );
3958 
3959  h_phoE_miniAOD_[0][0]->Fill( photonE );
3960  h_phoEt_miniAOD_[0][0]->Fill( photonEt);
3961 
3962  h_phoERes_miniAOD_[0][0]->Fill( photonE / mcEnergy );
3963  h_phoSigmaEoE_miniAOD_[0][0] -> Fill (sigmaEoE);
3964 
3965 
3966  h_r9_miniAOD_[0][0]->Fill( r9 );
3967  h_full5x5_r9_miniAOD_[0][0]->Fill( full5x5_r9 );
3968  h_r1_miniAOD_[0][0]->Fill( r1 );
3969  h_r2_miniAOD_[0][0]->Fill( r2 );
3970 
3971  h_sigmaIetaIeta_miniAOD_[0][0]->Fill(sigmaIetaIeta);
3972  h_full5x5_sigmaIetaIeta_miniAOD_[0][0]->Fill(full5x5_sieie);
3973  h_hOverE_miniAOD_[0][0]->Fill( hOverE );
3974  h_newhOverE_miniAOD_[0][0]->Fill( newhOverE );
3975 
3976  h_ecalRecHitSumEtConeDR04_miniAOD_[0][0]->Fill( ecalIso );
3977  h_hcalTowerSumEtConeDR04_miniAOD_[0][0]->Fill( hcalIso );
3978  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][0]->Fill( newhcalIso );
3979  h_isoTrkSolidConeDR04_miniAOD_[0][0]->Fill( trkIso );
3980  h_nTrkSolidConeDR04_miniAOD_[0][0]->Fill( nIsoTrk );
3981 
3982  //
3983  h_chHadIso_miniAOD_[0]-> Fill (chargedHadIso);
3984  h_nHadIso_miniAOD_[0]-> Fill (neutralHadIso);
3985  h_phoIso_miniAOD_[0]-> Fill (photonIso);
3986 
3987  //
3988  if ( phoIsInBarrel ) {
3989  h_phoE_miniAOD_[0][1]->Fill( photonE );
3990  h_phoEt_miniAOD_[0][1]->Fill( photonEt);
3991 
3992  h_phoERes_miniAOD_[0][1]->Fill( photonE / mcEnergy );
3993  h_phoSigmaEoE_miniAOD_[0][1] -> Fill (sigmaEoE);
3994 
3995  h_r9_miniAOD_[0][1]->Fill( r9 );
3996  h_full5x5_r9_miniAOD_[0][1]->Fill( full5x5_r9 );
3997  h_r1_miniAOD_[0][1]->Fill( r1 );
3998  h_r2_miniAOD_[0][1]->Fill( r2 );
3999  h_sigmaIetaIeta_miniAOD_[0][1]->Fill(sigmaIetaIeta);
4000  h_full5x5_sigmaIetaIeta_miniAOD_[0][1]->Fill(full5x5_sieie);
4001  h_hOverE_miniAOD_[0][1]->Fill( hOverE );
4002  h_newhOverE_miniAOD_[0][1]->Fill( newhOverE );
4003  h_ecalRecHitSumEtConeDR04_miniAOD_[0][1]->Fill( ecalIso );
4004  h_hcalTowerSumEtConeDR04_miniAOD_[0][1]->Fill( hcalIso );
4005  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][1]->Fill( newhcalIso );
4006  h_isoTrkSolidConeDR04_miniAOD_[0][1]->Fill( trkIso );
4007  h_nTrkSolidConeDR04_miniAOD_[0][1]->Fill( nIsoTrk );
4008  h_chHadIso_miniAOD_[1]-> Fill (chargedHadIso);
4009  h_nHadIso_miniAOD_[1]-> Fill (neutralHadIso);
4010  h_phoIso_miniAOD_[1]-> Fill (photonIso);
4011 
4012  }
4013  if ( phoIsInEndcap ) {
4014  h_phoE_miniAOD_[0][2]->Fill( photonE );
4015  h_phoEt_miniAOD_[0][2]->Fill( photonEt);
4016 
4017  h_phoERes_miniAOD_[0][2]->Fill( photonE / mcEnergy);
4018  h_phoSigmaEoE_miniAOD_[0][2] -> Fill (sigmaEoE);
4019  h_r9_miniAOD_[0][2]->Fill( r9 );
4020  h_full5x5_r9_miniAOD_[0][2]->Fill( full5x5_r9 );
4021  h_r1_miniAOD_[0][2]->Fill( r1 );
4022  h_r2_miniAOD_[0][2]->Fill( r2 );
4023  h_sigmaIetaIeta_miniAOD_[0][2]->Fill(sigmaIetaIeta);
4024  h_full5x5_sigmaIetaIeta_miniAOD_[0][2]->Fill(full5x5_sieie);
4025  h_hOverE_miniAOD_[0][2]->Fill( hOverE );
4026  h_newhOverE_miniAOD_[0][2]->Fill( newhOverE );
4027  h_ecalRecHitSumEtConeDR04_miniAOD_[0][2]->Fill( ecalIso );
4028  h_hcalTowerSumEtConeDR04_miniAOD_[0][2]->Fill( hcalIso );
4029  h_hcalTowerBcSumEtConeDR04_miniAOD_[0][2]->Fill( newhcalIso );
4030  h_isoTrkSolidConeDR04_miniAOD_[0][2]->Fill( trkIso );
4031  h_nTrkSolidConeDR04_miniAOD_[0][2]->Fill( nIsoTrk );
4032  h_chHadIso_miniAOD_[2]-> Fill (chargedHadIso);
4033  h_nHadIso_miniAOD_[2]-> Fill (neutralHadIso);
4034  h_phoIso_miniAOD_[2]-> Fill (photonIso);
4035 
4036  }
4037  } // end histos for comparing with miniAOD
4038 
4039 
4040 
4041 
4042 
4043  } // end loop over gen photons
4044 
4045 
4046 
4047 
4048  h_nPho_->Fill(float(nPho));
4049 
4050 }
4051 
4053 {
4054  //---Definitions
4055  const float PI = 3.1415927;
4056  const float TWOPI = 2.0*PI;
4057 
4058 
4059  if(phi > PI) {phi = phi - TWOPI;}
4060  if(phi < -PI) {phi = phi + TWOPI;}
4061 
4062  return phi;
4063 
4064 }
4065 
4066 
4067 float PhotonValidator::etaTransformation( float EtaParticle , float Zvertex) {
4068 
4069  //---Definitions
4070  const float PI = 3.1415927;
4071 
4072  //---Definitions for ECAL
4073  const float R_ECAL = 136.5;
4074  const float Z_Endcap = 328.0;
4075  const float etaBarrelEndcap = 1.479;
4076 
4077  //---ETA correction
4078 
4079  float Theta = 0.0 ;
4080  float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
4081 
4082  if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
4083  if(Theta<0.0) Theta = Theta+PI ;
4084  float ETA = - log(tan(0.5*Theta));
4085 
4086  if( fabs(ETA) > etaBarrelEndcap )
4087  {
4088  float Zend = Z_Endcap ;
4089  if(EtaParticle<0.0 ) Zend = -Zend ;
4090  float Zlen = Zend - Zvertex ;
4091  float RR = Zlen/sinh(EtaParticle);
4092  Theta = atan(RR/Zend);
4093  if(Theta<0.0) Theta = Theta+PI ;
4094  ETA = - log(tan(0.5*Theta));
4095  }
4096  //---Return the result
4097  return ETA;
4098  //---end
4099 }
4100 
4101 
dbl * delta
Definition: mlp_gen.cc:36
type
Definition: HCALResponse.h:21
value_type const * get() const
Definition: RefToBase.h:234
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:412
const unsigned int nTracks(const reco::Vertex &sv)
ParticleType
particle types
Definition: PFCandidate.h:45
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
TPRegexp parents
Definition: eve_filter.cc:21
double eta() const final
momentum pseudorapidity
const_iterator end() const
Definition: ValueMap.h:209
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float trkSumPtSolidConeDR04() const
Definition: Photon.h:424
std::vector< GenJet > GenJetCollection
collection of GenJet objects
void endRun(edm::Run const &r, edm::EventSetup const &es) override
const_iterator find(const key_type &k) const
find element with specified reference key
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< EcalRecHit >::const_iterator const_iterator
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:410
key_type key() const
Accessor for product key.
Definition: Ref.h:265
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:708
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
static const double deltaEta
Definition: CaloConstants.h:8
const Double_t pi
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
#define ETA
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
double et() const final
transverse energy
reco::ConversionRefVector conversions() const
vector of references to Conversion&#39;s
Definition: Photon.h:64
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
float phiNormalization(float &a)
T sqrt(T t)
Definition: SSEVec.h:18
float sigmaIetaIeta() const
Definition: Photon.h:231
double energy() const final
energy
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define TWOPI
Definition: DQMSourcePi0.cc:37
float ChiSquaredProbability(double chiSquared, double nrDOF)
~PhotonValidator() override
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:206
bool isValid() const
Definition: HandleBase.h:74
double p2[4]
Definition: TauolaWrapper.h:90
#define PI
Definition: QcdUeDQM.h:36
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
float r1x5() const
Definition: Photon.h:232
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
int nTrkSolidConeDR04() const
Definition: Photon.h:428
static const float etaBarrelEndcap
float etaTransformation(float a, float b)
et
define resolution functions of each parameter
static const float Z_Endcap
float r2x5() const
Definition: Photon.h:233
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:32
HLT enums.
double p1[4]
Definition: TauolaWrapper.h:89
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
T get() const
Definition: EventSetup.h:68
float r9() const
Definition: Photon.h:234
void push_back(const RefToBase< T > &)
static const float R_ECAL
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
void dqmBeginRun(edm::Run const &r, edm::EventSetup const &theEventSetup) override
void analyze(const edm::Event &, const edm::EventSetup &) override
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
const_iterator begin() const
Definition: Run.h:44
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:183
PhotonValidator(const edm::ParameterSet &)