test
CMS 3D CMS Logo

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