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