CMS 3D CMS Logo

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