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