CMS 3D CMS Logo

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