CMS 3D CMS Logo

TkConvValidator.cc
Go to the documentation of this file.
1 #include <iostream>
2 //
5 //
7 
8 //
12 //
18 //
22 //
27 //
31 //
32 #include "CLHEP/Units/GlobalPhysicalConstants.h"
34 //
43 
44 //
67 
68 //
75 
76 //
77 //
78 #include "TFile.h"
79 #include "TH1.h"
80 #include "TH2.h"
81 #include "TTree.h"
82 #include "TVector3.h"
83 #include "TProfile.h"
84 //
93 using namespace std;
94 
96  : magneticFieldToken_{esConsumes<edm::Transition::BeginRun>()},
97  caloGeometryToken_{esConsumes()},
98  transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))},
99  trackerGeometryToken_{esConsumes()} {
100  fName_ = pset.getUntrackedParameter<std::string>("Name");
101  verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
102  parameters_ = pset;
103 
104  photonCollectionProducer_ = pset.getParameter<std::string>("phoProducer");
105  photonCollection_ = pset.getParameter<std::string>("photonCollection");
106  photonCollectionPr_Token_ =
107  consumes<reco::PhotonCollection>(edm::InputTag(photonCollectionProducer_, photonCollection_));
108 
109  conversionCollectionProducer_ = pset.getParameter<std::string>("convProducer");
110  conversionCollection_ = pset.getParameter<std::string>("conversionCollection");
111  conversionCollectionPr_Token_ =
112  consumes<reco::ConversionCollection>(edm::InputTag(conversionCollectionProducer_, conversionCollection_));
113 
114  // conversionTrackProducer_ = pset.getParameter<std::string>("trackProducer");
115  dqmpath_ = pset.getParameter<std::string>("dqmpath");
116  minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
117  generalTracksOnly_ = pset.getParameter<bool>("generalTracksOnly");
118  arbitratedMerged_ = pset.getParameter<bool>("arbitratedMerged");
119  arbitratedEcalSeeded_ = pset.getParameter<bool>("arbitratedEcalSeeded");
120  ecalalgotracks_ = pset.getParameter<bool>("ecalalgotracks");
121  highPurity_ = pset.getParameter<bool>("highPurity");
122  minProb_ = pset.getParameter<double>("minProb");
123  maxHitsBeforeVtx_ = pset.getParameter<uint>("maxHitsBeforeVtx");
124  minLxy_ = pset.getParameter<double>("minLxy");
125  isRunCentrally_ = pset.getParameter<bool>("isRunCentrally");
126 
127  offline_pvToken_ = consumes<reco::VertexCollection>(
128  pset.getUntrackedParameter<edm::InputTag>("offlinePV", edm::InputTag("offlinePrimaryVertices")));
129  beamspotToken_ =
130  consumes<reco::BeamSpot>(pset.getUntrackedParameter<edm::InputTag>("beamspot", edm::InputTag("offlineBeamSpot")));
131  g4_simTk_Token_ = consumes<edm::SimTrackContainer>(pset.getParameter<edm::InputTag>("simTracks"));
132  g4_simVtx_Token_ = consumes<edm::SimVertexContainer>(pset.getParameter<edm::InputTag>("simTracks"));
133 
134  tpSelForEff_Token_ = consumes<TrackingParticleRefVector>(edm::InputTag("tpSelecForEfficiency"));
135  tpSelForFake_Token_ = consumes<TrackingParticleRefVector>(edm::InputTag("tpSelecForFakeRate"));
136  //hepMC_Token_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
137  //genjets_Token_ = consumes<reco::GenJetCollection>(
138  // edm::InputTag("ak4GenJets"));
139 
140  trackAssociator_Token_ =
141  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag("trackAssociatorByHitsForConversionValidation"));
142 }
143 
145 
147  nEvt_ = 0;
148  nEntry_ = 0;
149  nRecConv_ = 0;
150  nRecConvAss_ = 0;
152 
153  nInvalidPCA_ = 0;
154 
155  dbe_ = nullptr;
157 
158  double etMin = parameters_.getParameter<double>("etMin");
159  double etMax = parameters_.getParameter<double>("etMax");
160  int etBin = parameters_.getParameter<int>("etBin");
161 
162  double resMin = parameters_.getParameter<double>("resMin");
163  double resMax = parameters_.getParameter<double>("resMax");
164  int resBin = parameters_.getParameter<int>("resBin");
165 
166  double etaMin = parameters_.getParameter<double>("etaMin");
167  double etaMax = parameters_.getParameter<double>("etaMax");
168  int etaBin = parameters_.getParameter<int>("etaBin");
169  int etaBin2 = parameters_.getParameter<int>("etaBin2");
170 
171  double phiMin = parameters_.getParameter<double>("phiMin");
172  double phiMax = parameters_.getParameter<double>("phiMax");
173  int phiBin = parameters_.getParameter<int>("phiBin");
174 
175  double rMin = parameters_.getParameter<double>("rMin");
176  double rMax = parameters_.getParameter<double>("rMax");
177  int rBin = parameters_.getParameter<int>("rBin");
178 
179  double zMin = parameters_.getParameter<double>("zMin");
180  double zMax = parameters_.getParameter<double>("zMax");
181  int zBin = parameters_.getParameter<int>("zBin");
182 
183  double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
184  double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
185  int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
186 
187  double eoverpMin = parameters_.getParameter<double>("eoverpMin");
188  double eoverpMax = parameters_.getParameter<double>("eoverpMax");
189  int eoverpBin = parameters_.getParameter<int>("eoverpBin");
190 
191  // double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin"); // unused
192  // double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax"); // unused
193  // int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin"); // unused
194 
195  double dCotTracksMin = parameters_.getParameter<double>("dCotTracksMin");
196  double dCotTracksMax = parameters_.getParameter<double>("dCotTracksMax");
197  int dCotTracksBin = parameters_.getParameter<int>("dCotTracksBin");
198 
199  double chi2Min = parameters_.getParameter<double>("chi2Min");
200  double chi2Max = parameters_.getParameter<double>("chi2Max");
201 
202  double rMinForXray = parameters_.getParameter<double>("rMinForXray");
203  double rMaxForXray = parameters_.getParameter<double>("rMaxForXray");
204  int rBinForXray = parameters_.getParameter<int>("rBinForXray");
205  double zMinForXray = parameters_.getParameter<double>("zMinForXray");
206  double zMaxForXray = parameters_.getParameter<double>("zMaxForXray");
207  int zBinForXray = parameters_.getParameter<int>("zBinForXray");
208  int zBin2ForXray = parameters_.getParameter<int>("zBin2ForXray");
209 
210  minPhoPtForEffic = parameters_.getParameter<double>("minPhoPtForEffic");
211  maxPhoEtaForEffic = parameters_.getParameter<double>("maxPhoEtaForEffic");
212  maxPhoZForEffic = parameters_.getParameter<double>("maxPhoZForEffic");
213  maxPhoRForEffic = parameters_.getParameter<double>("maxPhoRForEffic");
214  minPhoPtForPurity = parameters_.getParameter<double>("minPhoPtForPurity");
215  maxPhoEtaForPurity = parameters_.getParameter<double>("maxPhoEtaForPurity");
216  maxPhoZForPurity = parameters_.getParameter<double>("maxPhoZForPurity");
217  maxPhoRForPurity = parameters_.getParameter<double>("maxPhoRForPurity");
218 
219  if (dbe_) {
221  // SC from reco photons
222 
223  //TString simfolder = TString(
224  std::string simpath = dqmpath_ + "SimulationInfo";
225  iBooker.setCurrentFolder(simpath);
226  //
227  // simulation information about conversions
229  std::string histname = "nOfSimConversions";
230  h_nSimConv_[0] = iBooker.book1D(histname, "# of Sim conversions per event ", 20, -0.5, 19.5);
232  histname = "h_AllSimConvEta";
233  h_AllSimConv_[0] = iBooker.book1D(histname, " All conversions: simulated #eta", etaBin2, etaMin, etaMax);
234  histname = "h_AllSimConvPhi";
235  h_AllSimConv_[1] = iBooker.book1D(histname, " All conversions: simulated #phi", phiBin, phiMin, phiMax);
236  histname = "h_AllSimConvR";
237  h_AllSimConv_[2] = iBooker.book1D(histname, " All conversions: simulated R", rBin, rMin, rMax);
238  histname = "h_AllSimConvZ";
239  h_AllSimConv_[3] = iBooker.book1D(histname, " All conversions: simulated Z", zBin, zMin, zMax);
240  histname = "h_AllSimConvEt";
241  h_AllSimConv_[4] = iBooker.book1D(histname, " All conversions: simulated Et", etBin, etMin, etMax);
242  //
243  histname = "nOfVisSimConversions";
244  h_nSimConv_[1] = iBooker.book1D(histname, "# of Sim conversions per event ", 20, -0.5, 19.5);
245  histname = "h_VisSimConvEta";
246  h_VisSimConv_[0] = iBooker.book1D(histname, " All vis conversions: simulated #eta", etaBin2, etaMin, etaMax);
247  histname = "h_VisSimConvPhi";
248  h_VisSimConv_[1] = iBooker.book1D(histname, " All vis conversions: simulated #phi", phiBin, phiMin, phiMax);
249  histname = "h_VisSimConvR";
250  h_VisSimConv_[2] = iBooker.book1D(histname, " All vis conversions: simulated R", rBin, rMin, rMax);
251  histname = "h_VisSimConvZ";
252  h_VisSimConv_[3] = iBooker.book1D(histname, " All vis conversions: simulated Z", zBin, zMin, zMax);
253  histname = "h_VisSimConvEt";
254  h_VisSimConv_[4] = iBooker.book1D(histname, " All vis conversions: simulated Et", etBin, etMin, etMax);
255 
256  //
257  histname = "h_SimConvTwoMTracksEta";
258  h_SimConvTwoMTracks_[0] = iBooker.book1D(
259  histname, " All vis conversions with 2 reco-matching tracks: simulated #eta", etaBin2, etaMin, etaMax);
260  histname = "h_SimConvTwoMTracksPhi";
261  h_SimConvTwoMTracks_[1] = iBooker.book1D(
262  histname, " All vis conversions with 2 reco-matching tracks: simulated #phi", phiBin, phiMin, phiMax);
263  histname = "h_SimConvTwoMTracksR";
265  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated R", rBin, rMin, rMax);
266  histname = "h_SimConvTwoMTracksZ";
268  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Z", zBin, zMin, zMax);
269  histname = "h_SimConvTwoMTracksEt";
271  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Et", etBin, etMin, etMax);
272  //
273  histname = "h_SimConvTwoTracksEta";
275  iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated #eta", etaBin2, etaMin, etaMax);
276  histname = "h_SimConvTwoTracksPhi";
278  iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated #phi", phiBin, phiMin, phiMax);
279  histname = "h_SimConvTwoTracksR";
281  iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated R", rBin, rMin, rMax);
282  histname = "h_SimConvTwoTracksZ";
284  iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated Z", zBin, zMin, zMax);
285  histname = "h_SimConvTwoTracksEt";
287  iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated Et", etBin, etMin, etMax);
288  //
289  histname = "h_SimConvTwoMTracksEtaAndVtxPGT0";
291  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #eta", etaBin2, etaMin, etaMax);
292  histname = "h_SimConvTwoMTracksPhiAndVtxPGT0";
294  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #phi", phiBin, phiMin, phiMax);
295  histname = "h_SimConvTwoMTracksRAndVtxPGT0";
297  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated R", rBin, rMin, rMax);
298  histname = "h_SimConvTwoMTracksZAndVtxPGT0";
300  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Z", zBin, zMin, zMax);
301  histname = "h_SimConvTwoMTracksEtAndVtxPGT0";
303  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Et", etBin, etMin, etMax);
304 
305  //
306  histname = "h_SimConvTwoMTracksEtaAndVtxPGT0005";
308  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #eta", etaBin2, etaMin, etaMax);
309  histname = "h_SimConvTwoMTracksPhiAndVtxPGT0005";
311  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #phi", phiBin, phiMin, phiMax);
312  histname = "h_SimConvTwoMTracksRAndVtxPGT0005";
314  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated R", rBin, rMin, rMax);
315  histname = "h_SimConvTwoMTracksZAndVtxPGT0005";
317  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Z", zBin, zMin, zMax);
318  histname = "h_SimConvTwoMTracksEtAndVtxPGT0005";
320  histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Et", etBin, etMin, etMax);
321 
322  histname = "h_SimRecConvTwoMTracksEta";
323  h_SimRecConvTwoMTracks_[0] = iBooker.book1D(
324  histname, " All vis conversions with 2 reco-matching tracks: simulated #eta", etaBin2, etaMin, etaMax);
325  histname = "h_SimRecConvTwoMTracksPhi";
326  h_SimRecConvTwoMTracks_[1] = iBooker.book1D(
327  histname, " All vis conversions with 2 reco-matching tracks: simulated #phi", phiBin, phiMin, phiMax);
328  histname = "h_SimRecConvTwoMTracksR";
330  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated R", rBin, rMin, rMax);
331  histname = "h_SimRecConvTwoMTracksZ";
333  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Z", zBin, zMin, zMax);
334  histname = "h_SimRecConvTwoMTracksEt";
336  iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Et", etBin, etMin, etMax);
337  //
338 
339  h_SimConvEtaPix_[0] = iBooker.book1D("simConvEtaPix", " sim converted Photon Eta: Pix ", etaBin, etaMin, etaMax);
340  h_simTkPt_ = iBooker.book1D("simTkPt", "Sim conversion tracks pt ", etBin * 3, 0., etMax);
341  h_simTkEta_ = iBooker.book1D("simTkEta", "Sim conversion tracks eta ", etaBin, etaMin, etaMax);
342 
343  h_simConvVtxRvsZ_[0] = iBooker.book2D("simConvVtxRvsZAll",
344  " Photon Sim conversion vtx position",
345  zBinForXray,
346  zMinForXray,
347  zMaxForXray,
348  rBinForXray,
349  rMinForXray,
350  rMaxForXray);
351  h_simConvVtxRvsZ_[1] = iBooker.book2D("simConvVtxRvsZBarrel",
352  " Photon Sim conversion vtx position",
353  zBinForXray,
354  zMinForXray,
355  zMaxForXray,
356  rBinForXray,
357  rMinForXray,
358  rMaxForXray);
359  h_simConvVtxRvsZ_[2] = iBooker.book2D("simConvVtxRvsZEndcap",
360  " Photon Sim conversion vtx position",
361  zBin2ForXray,
362  zMinForXray,
363  zMaxForXray,
364  rBinForXray,
365  rMinForXray,
366  rMaxForXray);
367  h_simConvVtxRvsZ_[3] = iBooker.book2D("simConvVtxRvsZBarrel2",
368  " Photon Sim conversion vtx position when reco R<4cm",
369  zBinForXray,
370  zMinForXray,
371  zMaxForXray,
372  rBinForXray,
373  rMinForXray,
374  rMaxForXray);
375  h_simConvVtxYvsX_ = iBooker.book2D(
376  "simConvVtxYvsXTrkBarrel", " Photon Sim conversion vtx position, (x,y) eta<1 ", 100, -80., 80., 100, -80., 80.);
377 
378  std::string convpath = dqmpath_ + "ConversionInfo";
379  iBooker.setCurrentFolder(convpath);
380 
381  histname = "nConv";
382  h_nConv_[0][0] = iBooker.book1D(
383  histname + "All", "Number Of Conversions per isolated candidates per events: All Ecal ", 10, -0.5, 9.5);
384  h_nConv_[0][1] = iBooker.book1D(
385  histname + "Barrel", "Number Of Conversions per isolated candidates per events: Ecal Barrel ", 10, -0.5, 9.5);
386  h_nConv_[0][2] = iBooker.book1D(
387  histname + "Endcap", "Number Of Conversions per isolated candidates per events: Ecal Endcap ", 10, -0.5, 9.5);
388  h_nConv_[1][0] = iBooker.book1D(histname + "All_Ass",
389  "Number Of associated Conversions per isolated candidates per events: All Ecal ",
390  10,
391  -0.5,
392  9.5);
393 
394  h_convEta_[0][0] = iBooker.book1D("convEta", " converted Photon Eta ", etaBin, etaMin, etaMax);
395  h_convEtaMatchSC_[0][0] =
396  iBooker.book1D("convEtaMatchSC", " converted Photon Eta when SC is matched ", etaBin, etaMin, etaMax);
397  h_convEta2_[0][0] = iBooker.book1D("convEta2", " converted Photon Eta ", etaBin2, etaMin, etaMax);
398  h_convPhi_[0][0] = iBooker.book1D("convPhi", " converted Photon Phi ", phiBin, phiMin, phiMax);
399  h_convR_[0][0] = iBooker.book1D("convR", " converted photon R", rBin, rMin, rMax);
400  h_convZ_[0][0] = iBooker.book1D("convZ", " converted photon Z", zBin, zMin, zMax);
401  h_convPt_[0][0] = iBooker.book1D("convPt", " conversions Transverse Energy: all eta ", etBin, etMin, etMax);
402 
403  h_convEta_[1][0] = iBooker.book1D("convEtaAss2", " Matched converted Photon Eta ", etaBin2, etaMin, etaMax);
404  h_convEta_[1][1] = iBooker.book1D("convEtaAss", " Matched converted Photon Eta ", etaBin, etaMin, etaMax);
405  h_convEtaMatchSC_[1][0] =
406  iBooker.book1D("convEtaMatchSCAss", " converted Photon Eta when SC is matched ", etaBin, etaMin, etaMax);
407  h_convPhi_[1][0] = iBooker.book1D("convPhiAss", " Matched converted Photon Phi ", phiBin, phiMin, phiMax);
408  h_convR_[1][0] = iBooker.book1D("convRAss", " Matched converted photon R", rBin, rMin, rMax);
409  h_convZ_[1][0] = iBooker.book1D("convZAss", " Matched converted photon Z", zBin, zMin, zMax);
410  h_convPt_[1][0] =
411  iBooker.book1D("convPtAss", "Matched conversions Transverse Energy: all eta ", etBin, etMin, etMax);
412 
413  h_convEta_[2][0] = iBooker.book1D("convEtaFake2", " Fake converted Photon Eta ", etaBin2, etaMin, etaMax);
414  h_convEta_[2][1] = iBooker.book1D("convEtaFake", " Fake converted Photon Eta ", etaBin, etaMin, etaMax);
415  h_convEtaMatchSC_[2][0] =
416  iBooker.book1D("convEtaMatchSCFake", " converted Photon Eta when SC is matched ", etaBin, etaMin, etaMax);
417  h_convPhi_[2][0] = iBooker.book1D("convPhiFake", " Fake converted Photon Phi ", phiBin, phiMin, phiMax);
418  h_convR_[2][0] = iBooker.book1D("convRFake", " Fake converted photon R", rBin, rMin, rMax);
419  h_convZ_[2][0] = iBooker.book1D("convZFake", " Fake converted photon Z", zBin, zMin, zMax);
420  h_convPt_[2][0] = iBooker.book1D("convPtFake", "Fake conversions Transverse Energy: all eta ", etBin, etMin, etMax);
421 
422  h_convRplot_ = iBooker.book1D("convRplot", " converted photon R", 600, 0., 120.);
423  h_convZplot_ = iBooker.book1D("convZplot", " converted photon Z", 320, -160., 160.);
424 
425  histname = "convSCdPhi";
426  h_convSCdPhi_[0][0] = iBooker.book1D(histname + "All", "dPhi between SC and conversion", 100, -0.1, 0.1);
427  h_convSCdPhi_[0][1] =
428  iBooker.book1D(histname + "Barrel", " dPhi between SC and conversion: Barrel", 100, -0.1, 0.1);
429  h_convSCdPhi_[0][2] =
430  iBooker.book1D(histname + "Endcap", " dPhi between SC and conversion: Endcap", 100, -0.1, 0.1);
431  h_convSCdPhi_[1][0] = iBooker.book1D(histname + "All_Ass", "dPhi between SC and conversion", 100, -0.1, 0.1);
432  h_convSCdPhi_[1][1] =
433  iBooker.book1D(histname + "Barrel_Ass", " dPhi between SC and conversion: Barrel", 100, -0.1, 0.1);
434  h_convSCdPhi_[1][2] =
435  iBooker.book1D(histname + "Endcap_Ass", " dPhi between SC and conversion: Endcap", 100, -0.1, 0.1);
436  h_convSCdPhi_[2][0] = iBooker.book1D(histname + "All_Fakes", "dPhi between SC and conversion", 100, -0.1, 0.1);
437  h_convSCdPhi_[2][1] =
438  iBooker.book1D(histname + "Barrel_Fakes", " dPhi between SC and conversion: Barrel", 100, -0.1, 0.1);
439  h_convSCdPhi_[2][2] =
440  iBooker.book1D(histname + "Endcap_Fakes", " dPhi between SC and conversion: Endcap", 100, -0.1, 0.1);
441  histname = "convSCdEta";
442  h_convSCdEta_[0][0] = iBooker.book1D(histname + "All", " dEta between SC and conversion", 100, -0.1, 0.1);
443  h_convSCdEta_[0][1] =
444  iBooker.book1D(histname + "Barrel", " dEta between SC and conversion: Barrel", 100, -0.1, 0.1);
445  h_convSCdEta_[0][2] =
446  iBooker.book1D(histname + "Endcap", " dEta between SC and conversion: Endcap", 100, -0.1, 0.1);
447  h_convSCdEta_[1][0] = iBooker.book1D(histname + "All_Ass", " dEta between SC and conversion", 100, -0.1, 0.1);
448  h_convSCdEta_[1][1] =
449  iBooker.book1D(histname + "Barrel_Ass", " dEta between SC and conversion: Barrel", 100, -0.1, 0.1);
450  h_convSCdEta_[1][2] =
451  iBooker.book1D(histname + "Endcap_Ass", " dEta between SC and conversion: Endcap", 100, -0.1, 0.1);
452  h_convSCdEta_[2][0] = iBooker.book1D(histname + "All_Fakes", " dEta between SC and conversion", 100, -0.1, 0.1);
453  h_convSCdEta_[2][1] =
454  iBooker.book1D(histname + "Barrel_Fakes", " dEta between SC and conversion: Barrel", 100, -0.1, 0.1);
455  h_convSCdEta_[2][2] =
456  iBooker.book1D(histname + "Endcap_Fakes", " dEta between SC and conversion: Endcap", 100, -0.1, 0.1);
457 
458  histname = "convPtRes";
459  h_convPtRes_[0] = iBooker.book1D(histname + "All", " Conversion Pt rec/true : All ecal ", resBin, resMin, resMax);
460  h_convPtRes_[1] = iBooker.book1D(histname + "Barrel", " Conversion Pt rec/true : Barrel ", resBin, resMin, resMax);
461  h_convPtRes_[2] = iBooker.book1D(histname + "Endcap", " Conversion Pt rec/true : Endcap ", resBin, resMin, resMax);
462 
463  histname = "hInvMass";
464  h_invMass_[0][0] = iBooker.book1D(
465  histname + "All_AllTracks", " Photons:Tracks from conversion: Pair invariant mass: all Ecal ", 100, 0., 1.5);
466  h_invMass_[0][1] = iBooker.book1D(histname + "Barrel_AllTracks",
467  " Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",
468  100,
469  0.,
470  1.5);
471  h_invMass_[0][2] = iBooker.book1D(histname + "Endcap_AllTracks",
472  " Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",
473  100,
474  0.,
475  1.5);
476  //
477  h_invMass_[1][0] = iBooker.book1D(
478  histname + "All_AssTracks", " Photons:Tracks from conversion: Pair invariant mass: all Ecal ", 100, 0., 1.5);
479  h_invMass_[1][1] = iBooker.book1D(histname + "Barrel_AssTracks",
480  " Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",
481  100,
482  0.,
483  1.5);
484  h_invMass_[1][2] = iBooker.book1D(histname + "Endcap_AssTracks",
485  " Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",
486  100,
487  0.,
488  1.5);
489  //
490  h_invMass_[2][0] = iBooker.book1D(
491  histname + "All_FakeTracks", " Photons:Tracks from conversion: Pair invariant mass: all Ecal ", 100, 0., 1.5);
492  h_invMass_[2][1] = iBooker.book1D(histname + "Barrel_FakeTracks",
493  " Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ",
494  100,
495  0.,
496  1.5);
497  h_invMass_[2][2] = iBooker.book1D(histname + "Endcap_FaleTracks",
498  " Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ",
499  100,
500  0.,
501  1.5);
502 
503  histname = "hDPhiTracksAtVtx";
504  h_DPhiTracksAtVtx_[0][0] = iBooker.book1D(histname + "All",
505  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",
508  dPhiTracksMax);
509  h_DPhiTracksAtVtx_[0][1] =
510  iBooker.book1D(histname + "Barrel",
511  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",
514  dPhiTracksMax);
515  h_DPhiTracksAtVtx_[0][2] =
516  iBooker.book1D(histname + "Endcap",
517  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",
520  dPhiTracksMax);
521  h_DPhiTracksAtVtx_[1][0] = iBooker.book1D(histname + "All_Ass",
522  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",
525  dPhiTracksMax);
526  h_DPhiTracksAtVtx_[1][1] =
527  iBooker.book1D(histname + "Barrel_Ass",
528  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",
531  dPhiTracksMax);
532  h_DPhiTracksAtVtx_[1][2] =
533  iBooker.book1D(histname + "Endcap_Ass",
534  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",
537  dPhiTracksMax);
538  h_DPhiTracksAtVtx_[2][0] = iBooker.book1D(histname + "All_Fakes",
539  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",
542  dPhiTracksMax);
543  h_DPhiTracksAtVtx_[2][1] =
544  iBooker.book1D(histname + "Barrel_Fakes",
545  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",
548  dPhiTracksMax);
549  h_DPhiTracksAtVtx_[2][2] =
550  iBooker.book1D(histname + "Endcap_Fakes",
551  " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",
554  dPhiTracksMax);
555 
556  histname = "hDPhiTracksAtVtxVsEta";
557  h2_DPhiTracksAtVtxVsEta_ = iBooker.book2D(histname + "All",
558  " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta",
559  etaBin2,
560  etaMin,
561  etaMax,
562  100,
563  -0.5,
564  0.5);
565  histname = "pDPhiTracksAtVtxVsEta";
567  iBooker.bookProfile(histname + "All",
568  " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta ",
569  etaBin2,
570  etaMin,
571  etaMax,
572  100,
573  -0.5,
574  0.5,
575  "");
576 
577  histname = "hDPhiTracksAtVtxVsR";
578  h2_DPhiTracksAtVtxVsR_ = iBooker.book2D(histname + "All",
579  " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R",
580  rBin,
581  rMin,
582  rMax,
583  100,
584  -0.5,
585  0.5);
586  histname = "pDPhiTracksAtVtxVsR";
587  p_DPhiTracksAtVtxVsR_ = iBooker.bookProfile(histname + "All",
588  " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R ",
589  rBin,
590  rMin,
591  rMax,
592  100,
593  -0.5,
594  0.5,
595  "");
596 
597  histname = "hDCotTracks";
598  h_DCotTracks_[0][0] = iBooker.book1D(histname + "All",
599  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",
602  dCotTracksMax);
603  h_DCotTracks_[0][1] = iBooker.book1D(histname + "Barrel",
604  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",
607  dCotTracksMax);
608  h_DCotTracks_[0][2] = iBooker.book1D(histname + "Endcap",
609  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",
612  dCotTracksMax);
613  h_DCotTracks_[1][0] = iBooker.book1D(histname + "All_Ass",
614  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",
617  dCotTracksMax);
618  h_DCotTracks_[1][1] = iBooker.book1D(histname + "Barrel_Ass",
619  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",
622  dCotTracksMax);
623  h_DCotTracks_[1][2] = iBooker.book1D(histname + "Endcap_Ass",
624  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",
627  dCotTracksMax);
628  h_DCotTracks_[2][0] = iBooker.book1D(histname + "All_Fakes",
629  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",
632  dCotTracksMax);
633  h_DCotTracks_[2][1] = iBooker.book1D(histname + "Barrel_Fakes",
634  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",
637  dCotTracksMax);
638  h_DCotTracks_[2][2] = iBooker.book1D(histname + "Endcap_Fakes",
639  " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",
642  dCotTracksMax);
643 
644  histname = "hDCotTracksVsEta";
645  h2_DCotTracksVsEta_ = iBooker.book2D(histname + "All",
646  " Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta",
647  etaBin2,
648  etaMin,
649  etaMax,
650  100,
651  -0.2,
652  0.2);
653  histname = "pDCotTracksVsEta";
654  p_DCotTracksVsEta_ = iBooker.bookProfile(histname + "All",
655  " Photons:Tracks from conversions: #delta cotg(#Theta) Tracks vs #eta ",
656  etaBin2,
657  etaMin,
658  etaMax,
659  100,
660  -0.2,
661  0.2,
662  "");
663 
664  histname = "hDCotTracksVsR";
665  h2_DCotTracksVsR_ = iBooker.book2D(histname + "All",
666  " Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R",
667  rBin,
668  rMin,
669  rMax,
670  100,
671  -0.2,
672  0.2);
673  histname = "pDCotTracksVsR";
675  iBooker.bookProfile(histname + "All",
676  " Photons:Tracks from conversions: #delta cotg(#Theta) Tracks at vertex vs R ",
677  rBin,
678  rMin,
679  rMax,
680  100,
681  -0.2,
682  0.2,
683  "");
684 
685  histname = "hDistMinAppTracks";
686  h_distMinAppTracks_[0][0] = iBooker.book1D(
687  histname + "All", " Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ", 120, -0.5, 1.0);
688  h_distMinAppTracks_[0][1] = iBooker.book1D(
689  histname + "Barrel", " Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ", 120, -0.5, 1.0);
690  h_distMinAppTracks_[0][2] = iBooker.book1D(
691  histname + "Endcap", " Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ", 120, -0.5, 1.0);
692  h_distMinAppTracks_[1][0] = iBooker.book1D(
693  histname + "All_Ass", " Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ", 120, -0.5, 1.0);
694  h_distMinAppTracks_[1][1] =
695  iBooker.book1D(histname + "Barrel_Ass",
696  " Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",
697  120,
698  -0.5,
699  1.0);
700  h_distMinAppTracks_[1][2] =
701  iBooker.book1D(histname + "Endcap_Ass",
702  " Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",
703  120,
704  -0.5,
705  1.0);
706  h_distMinAppTracks_[2][0] = iBooker.book1D(
707  histname + "All_Fakes", " Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ", 120, -0.5, 1.0);
708  h_distMinAppTracks_[2][1] =
709  iBooker.book1D(histname + "Barrel_Fakes",
710  " Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",
711  120,
712  -0.5,
713  1.0);
714  h_distMinAppTracks_[2][2] =
715  iBooker.book1D(histname + "Endcap_Fakes",
716  " Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",
717  120,
718  -0.5,
719  1.0);
720 
721  h_convVtxRvsZ_[0] = iBooker.book2D("convVtxRvsZAll",
722  " Photon Reco conversion vtx position",
723  zBinForXray,
724  zMinForXray,
725  zMaxForXray,
726  rBinForXray,
727  rMinForXray,
728  rMaxForXray);
729  h_convVtxRvsZ_[1] = iBooker.book2D("convVtxRvsZBarrel",
730  " Photon Reco conversion vtx position",
731  zBinForXray,
732  zMinForXray,
733  zMaxForXray,
734  rBinForXray,
735  rMinForXray,
736  rMaxForXray);
737  h_convVtxRvsZ_[2] = iBooker.book2D("convVtxRvsZEndcap",
738  " Photon Reco conversion vtx position",
739  zBin2ForXray,
740  zMinForXray,
741  zMaxForXray,
742  rBinForXray,
743  rMinForXray,
744  rMaxForXray);
745  h_convVtxYvsX_ = iBooker.book2D(
746  "convVtxYvsXTrkBarrel", " Photon Reco conversion vtx position, (x,y) eta<1 ", 1000, -60., 60., 1000, -60., 60.);
748  h_convVtxRvsZ_zoom_[0] = iBooker.book2D("convVtxRvsZBarrelZoom1",
749  " Photon Reco conversion vtx position",
750  zBinForXray,
751  zMinForXray,
752  zMaxForXray,
753  rBinForXray,
754  -10.,
755  40.);
756  h_convVtxRvsZ_zoom_[1] = iBooker.book2D("convVtxRvsZBarrelZoom2",
757  " Photon Reco conversion vtx position",
758  zBinForXray,
759  zMinForXray,
760  zMaxForXray,
761  rBinForXray,
762  -10.,
763  20.);
764  h_convVtxYvsX_zoom_[0] = iBooker.book2D("convVtxYvsXTrkBarrelZoom1",
765  " Photon Reco conversion vtx position, (x,y) eta<1 ",
766  100,
767  -40.,
768  40.,
769  100,
770  -40.,
771  40.);
772  h_convVtxYvsX_zoom_[1] = iBooker.book2D("convVtxYvsXTrkBarrelZoom2",
773  " Photon Reco conversion vtx position, (x,y) eta<1 ",
774  100,
775  -20.,
776  20.,
777  100,
778  -20.,
779  20.);
780 
781  h_convVtxdR_ = iBooker.book1D("convVtxdR", " Photon Reco conversion vtx dR", 100, -10., 10.);
782  h_convVtxdX_ = iBooker.book1D("convVtxdX", " Photon Reco conversion vtx dX", 100, -10., 10.);
783  h_convVtxdY_ = iBooker.book1D("convVtxdY", " Photon Reco conversion vtx dY", 100, -10., 10.);
784  h_convVtxdZ_ = iBooker.book1D("convVtxdZ", " Photon Reco conversion vtx dZ", 100, -20., 20.);
785 
786  h_convVtxdPhi_ = iBooker.book1D("convVtxdPhi", " Photon Reco conversion vtx dPhi", 100, -0.01, 0.01);
787  h_convVtxdEta_ = iBooker.book1D("convVtxdEta", " Photon Reco conversion vtx dEta", 100, -0.5, 0.5);
788 
790  iBooker.book1D("convVtxdR_barrel", " Photon Reco conversion vtx dR, |eta|<=1.2", 100, -10., 10.);
792  iBooker.book1D("convVtxdX_barrel", " Photon Reco conversion vtx dX, |eta|<=1.2", 100, -10., 10.);
794  iBooker.book1D("convVtxdY_barrel", " Photon Reco conversion vtx dY, |eta|<=1.2 ", 100, -10., 10.);
796  iBooker.book1D("convVtxdZ_barrel", " Photon Reco conversion vtx dZ, |eta|<=1.2,", 100, -20., 20.);
797 
799  iBooker.book1D("convVtxdR_endcap", " Photon Reco conversion vtx dR, |eta|>1.2 ", 100, -10., 10.);
801  iBooker.book1D("convVtxdX_endcap", " Photon Reco conversion vtx dX, |eta|>1.2", 100, -10., 10.);
803  iBooker.book1D("convVtxdY_endcap", " Photon Reco conversion vtx dY, |eta|>1.2", 100, -10., 10.);
805  iBooker.book1D("convVtxdZ_endcap", " Photon Reco conversion vtx dZ, |eta|>1.2", 100, -20., 20.);
806 
807  h2_convVtxdRVsR_ = iBooker.book2D("h2ConvVtxdRVsR", " Conversion vtx dR vsR", rBin, rMin, rMax, 100, -20., 20.);
809  iBooker.book2D("h2ConvVtxdRVsEta", "Conversion vtx dR vs Eta", etaBin2, etaMin, etaMax, 100, -20., 20.);
810 
812  iBooker.bookProfile("pConvVtxdRVsR", " Conversion vtx dR vsR", rBin, rMin, rMax, 100, -20., 20., "");
814  iBooker.bookProfile("pConvVtxdRVsEta", "Conversion vtx dR vs Eta", etaBin2, etaMin, etaMax, 100, -20., 20., "");
815  p_convVtxdXVsX_ = iBooker.bookProfile("pConvVtxdXVsX", "Conversion vtx dX vs X", 120, -60, 60, 100, -20., 20., "");
816  p_convVtxdYVsY_ = iBooker.bookProfile("pConvVtxdYVsY", "Conversion vtx dY vs Y", 120, -60, 60, 100, -20., 20., "");
818  iBooker.bookProfile("pConvVtxdZVsZ", "Conversion vtx dZ vs Z", zBin, zMin, zMax, 100, -20., 20., "");
819 
821  iBooker.bookProfile("pConvVtxdZVsR", "Conversion vtx dZ vs R", rBin, rMin, rMax, 100, -20., 20., "");
823  "p2ConvVtxdRVsRZ", "Conversion vtx dR vs RZ", zBin, zMin, zMax, rBin, rMin, rMax, 100, 0., 20., "s");
825  "p2ConvVtxdZVsRZ", "Conversion vtx dZ vs RZ", zBin, zMin, zMax, rBin, rMin, rMax, 100, 0., 20., "s");
826 
827  histname = "EoverPtracks";
828  h_EoverPTracks_[0][0] =
829  iBooker.book1D(histname + "All", " photons conversion E/p: all Ecal ", eoverpBin, eoverpMin, eoverpMax);
830  h_EoverPTracks_[0][1] =
831  iBooker.book1D(histname + "Barrel", " photons conversion E/p: Barrel Ecal", eoverpBin, eoverpMin, eoverpMax);
832  h_EoverPTracks_[0][2] =
833  iBooker.book1D(histname + "Endcap", " photons conversion E/p: Endcap Ecal ", eoverpBin, eoverpMin, eoverpMax);
834  h_EoverPTracks_[1][0] =
835  iBooker.book1D(histname + "All_Ass", " photons conversion E/p: all Ecal ", eoverpBin, eoverpMin, eoverpMax);
836  h_EoverPTracks_[1][1] = iBooker.book1D(
837  histname + "Barrel_Ass", " photons conversion E/p: Barrel Ecal", eoverpBin, eoverpMin, eoverpMax);
838  h_EoverPTracks_[1][2] = iBooker.book1D(
839  histname + "Endcap_Ass", " photons conversion E/p: Endcap Ecal ", eoverpBin, eoverpMin, eoverpMax);
840  h_EoverPTracks_[2][0] =
841  iBooker.book1D(histname + "All_Fakes", " photons conversion E/p: all Ecal ", eoverpBin, eoverpMin, eoverpMax);
842  h_EoverPTracks_[2][1] = iBooker.book1D(
843  histname + "Barrel_Fakes", " photons conversion E/p: Barrel Ecal", eoverpBin, eoverpMin, eoverpMax);
844  h_EoverPTracks_[2][2] = iBooker.book1D(
845  histname + "Endcap_Fakes", " photons conversion E/p: Endcap Ecal ", eoverpBin, eoverpMin, eoverpMax);
846 
847  h2_convVtxRrecVsTrue_ = iBooker.book2D(
848  "h2ConvVtxRrecVsTrue", "Photon Reco conversion vtx R rec vs true", rBin, rMin, rMax, rBin, rMin, rMax);
849 
850  histname = "vtxChi2Prob";
851  h_vtxChi2Prob_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 100, 0., 1.);
852  h_vtxChi2Prob_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 100, 0., 1.);
853  h_vtxChi2Prob_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 100, 0., 1.);
854  h_vtxChi2Prob_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 100, 0., 1.);
855  h_vtxChi2Prob_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 100, 0., 1.);
856  h_vtxChi2Prob_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 100, 0., 1.);
857  h_vtxChi2Prob_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 100, 0., 1.);
858  h_vtxChi2Prob_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 100, 0., 1.);
859  h_vtxChi2Prob_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 100, 0., 1.);
860 
861  h_zPVFromTracks_[1] = iBooker.book1D("zPVFromTracks", " Photons: PV z from conversion tracks", 100, -25., 25.);
862  h_dzPVFromTracks_[1] =
863  iBooker.book1D("dzPVFromTracks", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -5., 5.);
864  h2_dzPVVsR_ = iBooker.book2D("h2dzPVVsR", "Photon Reco conversions: dz(PV) vs R", rBin, rMin, rMax, 100, -3., 3.);
865  p_dzPVVsR_ =
866  iBooker.bookProfile("pdzPVVsR", "Photon Reco conversions: dz(PV) vs R", rBin, rMin, rMax, 100, -3., 3., "");
867 
868  histname = "lxybs";
869  h_lxybs_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 200, -100., 100.);
870  h_lxybs_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 200, -100., 100.);
871  h_lxybs_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 200, -100., 100.);
872  h_lxybs_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 200, -100., 100.);
873  h_lxybs_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 200, -100., 100.);
874  h_lxybs_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 200, -100., 100.);
875  h_lxybs_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 200, -100., 100.);
876  h_lxybs_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 200, -100., 100.);
877  h_lxybs_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 200, -100., 100.);
878 
879  histname = "maxNHitsBeforeVtx";
880  h_maxNHitsBeforeVtx_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
881  h_maxNHitsBeforeVtx_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
882  h_maxNHitsBeforeVtx_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
883  h_maxNHitsBeforeVtx_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
884  h_maxNHitsBeforeVtx_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
885  h_maxNHitsBeforeVtx_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
886  h_maxNHitsBeforeVtx_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
887  h_maxNHitsBeforeVtx_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
888  h_maxNHitsBeforeVtx_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
889 
890  histname = "leadNHitsBeforeVtx";
891  h_leadNHitsBeforeVtx_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
892  h_leadNHitsBeforeVtx_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
893  h_leadNHitsBeforeVtx_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
894  h_leadNHitsBeforeVtx_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
895  h_leadNHitsBeforeVtx_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
896  h_leadNHitsBeforeVtx_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
897  h_leadNHitsBeforeVtx_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
898  h_leadNHitsBeforeVtx_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
899  h_leadNHitsBeforeVtx_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
900 
901  histname = "trailNHitsBeforeVtx";
902  h_trailNHitsBeforeVtx_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
903  h_trailNHitsBeforeVtx_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
904  h_trailNHitsBeforeVtx_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
905  h_trailNHitsBeforeVtx_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
906  h_trailNHitsBeforeVtx_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
907  h_trailNHitsBeforeVtx_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
908  h_trailNHitsBeforeVtx_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
909  h_trailNHitsBeforeVtx_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
910  h_trailNHitsBeforeVtx_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
911 
912  histname = "sumNHitsBeforeVtx";
913  h_sumNHitsBeforeVtx_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
914  h_sumNHitsBeforeVtx_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
915  h_sumNHitsBeforeVtx_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
916  h_sumNHitsBeforeVtx_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
917  h_sumNHitsBeforeVtx_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
918  h_sumNHitsBeforeVtx_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
919  h_sumNHitsBeforeVtx_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
920  h_sumNHitsBeforeVtx_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
921  h_sumNHitsBeforeVtx_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
922 
923  histname = "maxDlClosestHitToVtx";
924  h_maxDlClosestHitToVtx_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 100, -10., 10.);
925  h_maxDlClosestHitToVtx_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 100, -10., 10.);
926  h_maxDlClosestHitToVtx_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 100, -10., 10.);
927  h_maxDlClosestHitToVtx_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 100, -10., 10.);
928  h_maxDlClosestHitToVtx_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 100, -10., 10.);
929  h_maxDlClosestHitToVtx_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 100, -10., 10.);
930  h_maxDlClosestHitToVtx_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 100, -10., 10.);
931  h_maxDlClosestHitToVtx_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 100, -10., 10.);
932  h_maxDlClosestHitToVtx_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 100, -10., 10.);
933 
934  histname = "maxDlClosestHitToVtxSig";
935  h_maxDlClosestHitToVtxSig_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 100, -8., 8.);
936  h_maxDlClosestHitToVtxSig_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 100, -8., 8.);
937  h_maxDlClosestHitToVtxSig_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 100, -8., 8.);
938  h_maxDlClosestHitToVtxSig_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 100, -8., 8.);
939  h_maxDlClosestHitToVtxSig_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 100, -8., 8.);
940  h_maxDlClosestHitToVtxSig_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 100, -8., 8.);
941  h_maxDlClosestHitToVtxSig_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 100, -8., 8.);
943  iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 100, -8., 8.);
945  iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 100, -8., 8.);
946 
947  histname = "deltaExpectedHitsInner";
948  h_deltaExpectedHitsInner_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 31, -15.5, 15.5);
949  h_deltaExpectedHitsInner_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 31, -15.5, 15.5);
950  h_deltaExpectedHitsInner_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 31, -15.5, 15.5);
951  h_deltaExpectedHitsInner_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 31, -15.5, 15.5);
953  iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 31, -15.5, 15.5);
955  iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 31, -15.5, 15.5);
956  h_deltaExpectedHitsInner_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 31, -15.5, 15.5);
958  iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 31, -15.5, 15.5);
960  iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 31, -15.5, 15.5);
961 
962  histname = "leadExpectedHitsInner";
963  h_leadExpectedHitsInner_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
964  h_leadExpectedHitsInner_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
965  h_leadExpectedHitsInner_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
966  h_leadExpectedHitsInner_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
967  h_leadExpectedHitsInner_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
968  h_leadExpectedHitsInner_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
969  h_leadExpectedHitsInner_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
971  iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
973  iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
974 
975  histname = "nSharedHits";
976  h_nSharedHits_[0][0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 16, -0.5, 15.5);
977  h_nSharedHits_[0][1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
978  h_nSharedHits_[0][2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
979  h_nSharedHits_[1][0] = iBooker.book1D(histname + "All_Ass", "vertex #chi^{2} all", 16, -0.5, 15.5);
980  h_nSharedHits_[1][1] = iBooker.book1D(histname + "Barrel_Ass", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
981  h_nSharedHits_[1][2] = iBooker.book1D(histname + "Endcap_Ass", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
982  h_nSharedHits_[2][0] = iBooker.book1D(histname + "All_Fakes", "vertex #chi^{2} all", 16, -0.5, 15.5);
983  h_nSharedHits_[2][1] = iBooker.book1D(histname + "Barrel_Fakes", "vertex #chi^{2} barrel", 16, -0.5, 15.5);
984  h_nSharedHits_[2][2] = iBooker.book1D(histname + "Endcap_Fakes", "vertex #chi^{2} endcap", 16, -0.5, 15.5);
985 
987  histname = "nHits";
988  nHits_[0] = iBooker.book2D(histname + "AllTracks",
989  "Photons:Tracks from conversions: # of hits all tracks",
990  etaBin,
991  etaMin,
992  etaMax,
993  30,
994  0.,
995  30.);
996  nHits_[1] = iBooker.book2D(histname + "AllTracks_Ass",
997  "Photons:Tracks from conversions: # of hits all tracks ass",
998  etaBin,
999  etaMin,
1000  etaMax,
1001  30,
1002  0.,
1003  30.);
1004  nHits_[2] = iBooker.book2D(histname + "AllTracks_Fakes",
1005  "Photons:Tracks from conversions: # of hits all tracks fakes",
1006  etaBin,
1007  etaMin,
1008  etaMax,
1009  30,
1010  0.,
1011  30.);
1012 
1013  histname = "nHitsVsEta";
1014  nHitsVsEta_[0] = iBooker.book2D(histname + "AllTracks",
1015  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1016  etaBin,
1017  etaMin,
1018  etaMax,
1019  30,
1020  0.,
1021  30.);
1022  nHitsVsEta_[1] = iBooker.book2D(histname + "AllTracks_Ass",
1023  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1024  etaBin,
1025  etaMin,
1026  etaMax,
1027  30,
1028  0.,
1029  30.);
1030  nHitsVsEta_[2] = iBooker.book2D(histname + "AllTracks_Fakes",
1031  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1032  etaBin,
1033  etaMin,
1034  etaMax,
1035  30,
1036  0.,
1037  30.);
1038  histname = "h_nHitsVsEta";
1039  p_nHitsVsEta_[0] = iBooker.bookProfile(histname + "AllTracks",
1040  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1041  etaBin,
1042  etaMin,
1043  etaMax,
1044  30,
1045  -0.5,
1046  29.5,
1047  "");
1048  p_nHitsVsEta_[1] = iBooker.bookProfile(histname + "AllTracks_Ass",
1049  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1050  etaBin,
1051  etaMin,
1052  etaMax,
1053  30,
1054  -0.5,
1055  29.5,
1056  "");
1057  p_nHitsVsEta_[2] = iBooker.bookProfile(histname + "AllTracks_Fakes",
1058  "Photons:Tracks from conversions: # of hits vs #eta all tracks",
1059  etaBin,
1060  etaMin,
1061  etaMax,
1062  30,
1063  -0.5,
1064  29.5,
1065  "");
1066 
1067  histname = "nHitsVsR";
1068  nHitsVsR_[0] = iBooker.book2D(histname + "AllTracks",
1069  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1070  rBin,
1071  rMin,
1072  rMax,
1073  30,
1074  0.,
1075  30.);
1076  nHitsVsR_[1] = iBooker.book2D(histname + "AllTracks_Ass",
1077  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1078  rBin,
1079  rMin,
1080  rMax,
1081  30,
1082  0.,
1083  30.);
1084  nHitsVsR_[2] = iBooker.book2D(histname + "AllTracks_Fakes",
1085  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1086  rBin,
1087  rMin,
1088  rMax,
1089  30,
1090  0.,
1091  30.);
1092 
1093  histname = "h_nHitsVsR";
1094  p_nHitsVsR_[0] = iBooker.bookProfile(histname + "AllTracks",
1095  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1096  rBin,
1097  rMin,
1098  rMax,
1099  30,
1100  -0.5,
1101  29.5,
1102  "");
1103  p_nHitsVsR_[1] = iBooker.bookProfile(histname + "AllTracks_Ass",
1104  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1105  rBin,
1106  rMin,
1107  rMax,
1108  30,
1109  -0.5,
1110  29.5,
1111  "");
1112  p_nHitsVsR_[2] = iBooker.bookProfile(histname + "AllTracks_Fakes",
1113  "Photons:Tracks from conversions: # of hits vs radius all tracks",
1114  rBin,
1115  rMin,
1116  rMax,
1117  30,
1118  -0.5,
1119  29.5,
1120  "");
1121 
1122  histname = "tkChi2";
1123  h_tkChi2_[0] = iBooker.book1D(
1124  histname + "AllTracks", "Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
1125  h_tkChi2_[1] = iBooker.book1D(
1126  histname + "AllTracks_Ass", "Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
1127  h_tkChi2_[2] = iBooker.book1D(
1128  histname + "AllTracks_Fakes", "Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
1129 
1130  histname = "tkChi2Large";
1131  h_tkChi2Large_[0] = iBooker.book1D(
1132  histname + "AllTracks", "Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
1133  h_tkChi2Large_[1] = iBooker.book1D(
1134  histname + "AllTracks_Ass", "Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
1135  h_tkChi2Large_[2] = iBooker.book1D(
1136  histname + "AllTracks_Fakes", "Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
1137 
1138  histname = "h2Chi2VsEta";
1139  h2_Chi2VsEta_[0] = iBooker.book2D(
1140  histname + "All", " Reco Track #chi^{2} vs #eta: All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max);
1141  h2_Chi2VsEta_[1] = iBooker.book2D(
1142  histname + "All_Ass", " Reco Track #chi^{2} vs #eta: All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max);
1143  h2_Chi2VsEta_[2] = iBooker.book2D(
1144  histname + "All_Fakes", " Reco Track #chi^{2} vs #eta: All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max);
1145  histname = "pChi2VsEta";
1146  p_Chi2VsEta_[0] = iBooker.bookProfile(
1147  histname + "All", " Reco Track #chi^{2} vs #eta : All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max, "");
1148  p_Chi2VsEta_[1] = iBooker.bookProfile(
1149  histname + "All_Ass", " Reco Track #chi^{2} vs #eta : All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max, "");
1150  p_Chi2VsEta_[2] = iBooker.bookProfile(histname + "All_Fakes",
1151  " Reco Track #chi^{2} vs #eta : All ",
1152  etaBin2,
1153  etaMin,
1154  etaMax,
1155  100,
1156  chi2Min,
1157  chi2Max,
1158  "");
1159 
1160  histname = "h2Chi2VsR";
1161  h2_Chi2VsR_[0] =
1162  iBooker.book2D(histname + "All", " Reco Track #chi^{2} vs R: All ", rBin, rMin, rMax, 100, chi2Min, chi2Max);
1163  h2_Chi2VsR_[1] = iBooker.book2D(
1164  histname + "All_Ass", " Reco Track #chi^{2} vs R: All ", rBin, rMin, rMax, 100, chi2Min, chi2Max);
1165  h2_Chi2VsR_[2] = iBooker.book2D(
1166  histname + "All_Fakes", " Reco Track #chi^{2} vs R: All ", rBin, rMin, rMax, 100, chi2Min, chi2Max);
1167  histname = "pChi2VsR";
1168  p_Chi2VsR_[0] = iBooker.bookProfile(
1169  histname + "All", " Reco Track #chi^{2} vas R : All ", rBin, rMin, rMax, 100, chi2Min, chi2Max, "");
1170  p_Chi2VsR_[1] = iBooker.bookProfile(
1171  histname + "All_Ass", " Reco Track #chi^{2} vas R : All ", rBin, rMin, rMax, 100, chi2Min, chi2Max, "");
1172  p_Chi2VsR_[2] = iBooker.bookProfile(
1173  histname + "All_Fakes", " Reco Track #chi^{2} vas R : All ", rBin, rMin, rMax, 100, chi2Min, chi2Max, "");
1174 
1175  histname = "hTkD0";
1176  h_TkD0_[0] = iBooker.book1D(histname + "All", " Reco Track D0*q: All ", 200, -0.1, 60);
1177  h_TkD0_[1] = iBooker.book1D(histname + "All_Ass", " Reco Track D0*q: Barrel ", 200, -0.1, 60);
1178  h_TkD0_[2] = iBooker.book1D(histname + "All_Fakes", " Reco Track D0*q: Endcap ", 200, -0.1, 60);
1179 
1180  histname = "hTkPtPull";
1181  h_TkPtPull_[0] = iBooker.book1D(histname + "All", " Reco Track Pt pull: All ", 100, -20., 10.);
1182  histname = "hTkPtPull";
1183  h_TkPtPull_[1] = iBooker.book1D(histname + "Barrel", " Reco Track Pt pull: Barrel ", 100, -20., 10.);
1184  histname = "hTkPtPull";
1185  h_TkPtPull_[2] = iBooker.book1D(histname + "Endcap", " Reco Track Pt pull: Endcap ", 100, -20., 10.);
1186 
1187  histname = "h2TkPtPullEta";
1188  h2_TkPtPull_[0] =
1189  iBooker.book2D(histname + "All", " Reco Track Pt pull: All ", etaBin2, etaMin, etaMax, 100, -20., 10.);
1190  histname = "pTkPtPullEta";
1191  p_TkPtPull_[0] = iBooker.bookProfile(
1192  histname + "All", " Reco Track Pt pull: All ", etaBin2, etaMin, etaMax, 100, -20., 10., " ");
1193 
1194  histname = "PtRecVsPtSim";
1195  h2_PtRecVsPtSim_[0] =
1196  iBooker.book2D(histname + "All", "Pt Rec vs Pt sim: All ", etBin, etMin, etMax, etBin, etMin, etMax);
1197  h2_PtRecVsPtSim_[1] =
1198  iBooker.book2D(histname + "Barrel", "Pt Rec vs Pt sim: Barrel ", etBin, etMin, etMax, etBin, etMin, etMax);
1199  h2_PtRecVsPtSim_[2] =
1200  iBooker.book2D(histname + "Endcap", "Pt Rec vs Pt sim: Endcap ", etBin, etMin, etMax, etBin, etMin, etMax);
1201 
1202  histname = "photonPtRecVsPtSim";
1204  iBooker.book2D(histname + "All", "Pt Rec vs Pt sim: All ", etBin, etMin, etMax, etBin, etMin, etMax);
1205 
1206  histname = "nHitsBeforeVtx";
1207  h_nHitsBeforeVtx_[0] = iBooker.book1D(histname + "All", "Pt Rec vs Pt sim: All ", 16, -0.5, 15.5);
1208  h_nHitsBeforeVtx_[1] = iBooker.book1D(histname + "Barrel", "Pt Rec vs Pt sim: Barrel ", 16, -0.5, 15.5);
1209  h_nHitsBeforeVtx_[2] = iBooker.book1D(histname + "Endcap", "Pt Rec vs Pt sim: Endcap ", 16, -0.5, 15.5);
1210 
1211  histname = "dlClosestHitToVtx";
1212  h_dlClosestHitToVtx_[0] = iBooker.book1D(histname + "All", "Pt Rec vs Pt sim: All ", 100, -10., 10.);
1213  h_dlClosestHitToVtx_[1] = iBooker.book1D(histname + "Barrel", "Pt Rec vs Pt sim: Barrel ", 100, -10., 10.);
1214  h_dlClosestHitToVtx_[2] = iBooker.book1D(histname + "Endcap", "Pt Rec vs Pt sim: Endcap ", 100, -10., 10.);
1215 
1216  histname = "dlClosestHitToVtxSig";
1217  h_dlClosestHitToVtxSig_[0] = iBooker.book1D(histname + "All", "Pt Rec vs Pt sim: All ", 100, -8., 8.);
1218  h_dlClosestHitToVtxSig_[1] = iBooker.book1D(histname + "Barrel", "Pt Rec vs Pt sim: Barrel ", 100, -8., 8.);
1219  h_dlClosestHitToVtxSig_[2] = iBooker.book1D(histname + "Endcap", "Pt Rec vs Pt sim: Endcap ", 100, -8., 8.);
1220 
1221  h_match_ = iBooker.book1D("h_match", " ", 3, -0.5, 2.5);
1222 
1223  } // if DQM
1224 }
1225 
1226 void TkConvValidator::dqmBeginRun(edm::Run const& r, edm::EventSetup const& theEventSetup) {
1227  //get magnetic field
1228  edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field"
1229  << "\n";
1230  theMF_ = theEventSetup.getHandle(magneticFieldToken_);
1231 
1233 }
1234 
1236 
1239  using namespace edm;
1240  // const float etaPhiDistance=0.01;
1241  // Fiducial region
1242  // const float TRK_BARL =0.9;
1243  const float BARL = 1.4442; // DAQ TDR p.290
1244  // const float END_LO = 1.566; // unused
1245  const float END_HI = 2.5;
1246  // Electron mass
1247  // const Float_t mElec= 0.000511; // unused
1248 
1250  e.getByToken(trackAssociator_Token_, theTrackAssociator);
1251 
1252  nEvt_++;
1253  LogInfo("TkConvValidator") << "TkConvValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_
1254  << "\n";
1255  // std::cout << "TkConvValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
1256 
1257  // get the geometry from the event setup:
1259 
1260  // Transform Track into TransientTrack (needed by the Vertex fitter)
1261  auto theTTB = esup.getHandle(transientTrackBuilderToken_);
1262 
1265  e.getByToken(conversionCollectionPr_Token_, convHandle);
1266  const reco::ConversionCollection convCollection = *(convHandle.product());
1267  if (!convHandle.isValid()) {
1268  edm::LogError("ConversionsProducer") << "Error! Can't get the collection " << std::endl;
1269  return;
1270  }
1271 
1273  Handle<reco::PhotonCollection> photonHandle;
1274  e.getByToken(photonCollectionPr_Token_, photonHandle);
1275  const reco::PhotonCollection photonCollection = *(photonHandle.product());
1276  if (!photonHandle.isValid()) {
1277  edm::LogError("PhotonProducer") << "Error! Can't get the Photon collection " << std::endl;
1278  return;
1279  }
1280 
1281  // offline Primary vertex
1284  e.getByToken(offline_pvToken_, vertexHandle);
1285  if (!vertexHandle.isValid()) {
1286  edm::LogError("TrackerOnlyConversionProducer") << "Error! Can't get the product primary Vertex Collection "
1287  << "\n";
1288  } else {
1289  vertexCollection = *(vertexHandle.product());
1290  }
1291  reco::Vertex the_pvtx;
1292  bool valid_pvtx = false;
1293  if (!vertexCollection.empty()) {
1294  the_pvtx = *(vertexCollection.begin());
1295  //asking for one good vertex
1296  if (the_pvtx.isValid() && fabs(the_pvtx.position().z()) <= 15 && the_pvtx.position().Rho() <= 2) {
1297  valid_pvtx = true;
1298  }
1299  }
1300 
1301  edm::Handle<reco::BeamSpot> bsHandle;
1302  e.getByToken(beamspotToken_, bsHandle);
1303  if (!bsHandle.isValid()) {
1304  edm::LogError("TrackerOnlyConversionProducer") << "Error! Can't get the product primary Vertex Collection "
1305  << "\n";
1306  return;
1307  }
1308  const reco::BeamSpot& thebs = *bsHandle.product();
1309 
1310  //get tracker geometry for hits positions
1311  //edm::ESHandle<TrackerGeometry> tracker;
1312  //esup.get<TrackerDigiGeometryRecord>().get(tracker);
1314  const TrackerGeometry* trackerGeom = tracker.product();
1315 
1317  //get simtrack info
1318  //std::vector<SimTrack> theSimTracks;
1319  //std::vector<SimVertex> theSimVertices;
1320 
1323  e.getByToken(g4_simTk_Token_, SimTk);
1324  e.getByToken(g4_simVtx_Token_, SimVtx);
1325 
1326  bool useTP = parameters_.getParameter<bool>("useTP");
1329  edm::Handle<TrackingParticleRefVector> TPHandleForFakeRate;
1330  if (useTP) {
1331  e.getByToken(tpSelForEff_Token_, TPHandleForEff);
1332  e.getByToken(tpSelForFake_Token_, TPHandleForFakeRate);
1333  }
1334 
1335  const TrackingParticleRefVector& tpForEfficiency = useTP ? *(TPHandleForEff.product()) : dummy;
1336  const TrackingParticleRefVector& tpForFakeRate = useTP ? *(TPHandleForFakeRate.product()) : dummy;
1337 
1338  const std::vector<SimTrack>& theSimTracks = *SimTk;
1339  const std::vector<SimVertex>& theSimVertices = *SimVtx;
1340 
1341  //theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
1342  //theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
1343  std::vector<PhotonMCTruth> mcPhotons = thePhotonMCTruthFinder_->find(theSimTracks, theSimVertices);
1344 
1345  //edm::Handle<edm::HepMCProduct> hepMC;
1346  //e.getByToken(hepMC_Token_, hepMC);
1347  // const HepMC::GenEvent *myGenEvent = hepMC->GetEvent(); // unused
1348 
1349  // get generated jets
1350  //edm::Handle<reco::GenJetCollection> GenJetsHandle;
1351  //e.getByToken(genjets_Token_, GenJetsHandle);
1352  //const reco::GenJetCollection &genJetCollection = *(GenJetsHandle.product());
1353 
1354  // ################ SIM to RECO ######################### //
1355  std::map<const reco::Track*, TrackingParticleRef> myAss;
1356  std::map<const reco::Track*, TrackingParticleRef>::const_iterator itAss;
1357 
1358  for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
1359  mcConvPt_ = (*mcPho).fourMomentum().et();
1360  float mcPhi = (*mcPho).fourMomentum().phi();
1361  mcPhi_ = phiNormalization(mcPhi);
1362  mcEta_ = (*mcPho).fourMomentum().pseudoRapidity();
1363  mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z());
1364  mcConvR_ = (*mcPho).vertex().perp();
1365  mcConvX_ = (*mcPho).vertex().x();
1366  mcConvY_ = (*mcPho).vertex().y();
1367  mcConvZ_ = (*mcPho).vertex().z();
1368  mcConvEta_ = (*mcPho).vertex().eta();
1369  mcConvPhi_ = (*mcPho).vertex().phi();
1370 
1371  if (fabs(mcEta_) > END_HI)
1372  continue;
1373 
1375  continue;
1376  if (fabs(mcEta_) > maxPhoEtaForEffic)
1377  continue;
1378  if (fabs(mcConvZ_) > maxPhoZForEffic)
1379  continue;
1380  if (mcConvR_ > maxPhoRForEffic)
1381  continue;
1383 
1384  bool goodSimConversion = false;
1385  bool visibleConversion = false;
1386  bool visibleConversionsWithTwoSimTracks = false;
1387  if ((*mcPho).isAConversion() == 1) {
1388  nSimConv_[0]++;
1389  h_AllSimConv_[0]->Fill(mcEta_);
1390  h_AllSimConv_[1]->Fill(mcPhi_);
1393  h_AllSimConv_[4]->Fill((*mcPho).fourMomentum().et());
1394 
1395  if (mcConvR_ < 15)
1397 
1398  if ((fabs(mcEta_) <= BARL && mcConvR_ < 85) ||
1399  (fabs(mcEta_) > BARL && fabs(mcEta_) <= END_HI && fabs((*mcPho).vertex().z()) < 210))
1400  visibleConversion = true;
1401 
1402  theConvTP_.clear();
1403  // std::cout << " TkConvValidator TrackingParticles TrackingParticleCollection size "<< trackingParticles.size() << "\n";
1404  //duplicated TP collections for two associations
1405  for (const TrackingParticleRef& tp : tpForEfficiency) {
1406  if (fabs(tp->vx() - (*mcPho).vertex().x()) < 0.0001 && fabs(tp->vy() - (*mcPho).vertex().y()) < 0.0001 &&
1407  fabs(tp->vz() - (*mcPho).vertex().z()) < 0.0001) {
1409  }
1410  }
1411  //std::cout << " TkConvValidator theConvTP_ size " << theConvTP_.size() << std::endl;
1412 
1413  if (theConvTP_.size() == 2)
1414  visibleConversionsWithTwoSimTracks = true;
1415  goodSimConversion = false;
1416 
1417  if (visibleConversion && visibleConversionsWithTwoSimTracks)
1418  goodSimConversion = true;
1419  if (goodSimConversion) {
1420  nSimConv_[1]++;
1421  h_VisSimConv_[0]->Fill(mcEta_);
1422  h_VisSimConv_[1]->Fill(mcPhi_);
1425  h_VisSimConv_[4]->Fill((*mcPho).fourMomentum().et());
1426  }
1427 
1429  ++iTrk) {
1430  h_simTkPt_->Fill((*iTrk)->pt());
1431  h_simTkEta_->Fill((*iTrk)->eta());
1432  }
1433 
1434  }
1435 
1436  if (!(visibleConversion && visibleConversionsWithTwoSimTracks))
1437  continue;
1438 
1440  if (fabs(mcEta_) <= 1.) {
1443  } else
1445 
1446  //std::cout << " TkConvValidator theConvTP_ size " << theConvTP_.size() << std::endl;
1448  iTP++) {
1449  // std::cout << " SIM to RECO TP vertex " << (*iTP)->vx() << " " << (*iTP)->vy() << " " << (*iTP)->vz() << " pt " << (*iTP)->pt() << std::endl;
1450  }
1451 
1452  bool recomatch = false;
1453  float chi2Prob = 0.;
1455  // cout << " size of conversions " << convHandle->size() << endl;
1456  for (reco::ConversionCollection::const_iterator conv = convHandle->begin(); conv != convHandle->end(); ++conv) {
1457  const reco::Conversion& aConv = (*conv);
1459  continue;
1461  continue;
1463  continue;
1464 
1466  continue;
1467 
1468  //problematic?
1469  const std::vector<edm::RefToBase<reco::Track> >& tracks = aConv.tracks();
1470 
1471  const reco::Vertex& vtx = aConv.conversionVertex();
1472  //requires two tracks and a valid vertex
1473  if (tracks.size() != 2 || !(vtx.isValid()))
1474  continue;
1475 
1477  continue;
1478  if (aConv.nHitsBeforeVtx().size() > 1 &&
1479  max(aConv.nHitsBeforeVtx().at(0), aConv.nHitsBeforeVtx().at(1)) > maxHitsBeforeVtx_)
1480  continue;
1481 
1482  //compute transverse decay length with respect to beamspot
1483  math::XYZVectorF themom = aConv.refittedPairMomentum();
1484  double dbsx = aConv.conversionVertex().x() - thebs.x0();
1485  double dbsy = aConv.conversionVertex().y() - thebs.y0();
1486  double lxy = (themom.x() * dbsx + themom.y() * dbsy) / themom.rho();
1487 
1488  if (lxy < minLxy_)
1489  continue;
1490 
1491  // bool phoIsInBarrel=false; // unused
1492  // bool phoIsInEndcap=false; // unused
1493  RefToBase<reco::Track> tfrb1 = aConv.tracks().front();
1494  RefToBase<reco::Track> tfrb2 = aConv.tracks().back();
1495 
1500  continue;
1501 
1502  //reco::TrackRef tk1 = aConv.tracks().front();
1503  //reco::TrackRef tk2 = aConv.tracks().back();
1504  //std::cout << "SIM to RECO conversion track pt " << tk1->pt() << " " << tk2->pt() << endl;
1505  //
1506  //Use two RefToBaseVector and do two association actions to avoid that if two tracks from different collection
1508  tc1.push_back(tfrb1);
1509  tc2.push_back(tfrb2);
1510  bool isAssociated = false;
1511  reco::SimToRecoCollection q1 = theTrackAssociator->associateSimToReco(tc1, theConvTP_);
1512  reco::SimToRecoCollection q2 = theTrackAssociator->associateSimToReco(tc2, theConvTP_);
1513  //try {
1514  std::vector<std::pair<RefToBase<reco::Track>, double> > trackV1, trackV2;
1515 
1516  int tp_1 = 0, tp_2 = 1; //the index of associated tp in theConvTP_ for two tracks
1517  if (q1.find(theConvTP_[0]) != q1.end()) {
1518  trackV1 = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q1[theConvTP_[0]];
1519  } else if (q1.find(theConvTP_[1]) != q1.end()) {
1520  trackV1 = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q1[theConvTP_[1]];
1521  tp_1 = 1;
1522  }
1523  if (q2.find(theConvTP_[1]) != q2.end()) {
1524  trackV2 = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q2[theConvTP_[1]];
1525  } else if (q2.find(theConvTP_[0]) != q2.end()) {
1526  trackV2 = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q2[theConvTP_[0]];
1527  tp_2 = 0;
1528  }
1529  if (!(!trackV1.empty() && !trackV2.empty()))
1530  continue;
1531  if (tp_1 == tp_2)
1532  continue;
1533 
1534  edm::RefToBase<reco::Track> tr1 = trackV1.front().first;
1535  edm::RefToBase<reco::Track> tr2 = trackV2.front().first;
1536  //std::cout << "associated tp1 " <<theConvTP_[0]->pt() << " to track with pT=" << tr1->pt() << " " << (tr1.get())->pt() << endl;
1537  //std::cout << "associated tp2 " <<theConvTP_[1]->pt() << " to track with pT=" << tr2->pt() << " " << (tr2.get())->pt() << endl;
1538  myAss.insert(std::make_pair(tr1.get(), theConvTP_[tp_1]));
1539  myAss.insert(std::make_pair(tr2.get(), theConvTP_[tp_2]));
1540 
1541  //} catch (Exception const& event) {
1542  //cout << "continue: " << event.what() << endl;
1543  // continue;
1544  //}
1545 
1546  isAssociated = true;
1547  recomatch = true;
1548  chi2Prob = ChiSquaredProbability(aConv.conversionVertex().chi2(), aConv.conversionVertex().ndof());
1549 
1550  if (isAssociated) {
1555  h_SimRecConvTwoMTracks_[4]->Fill((*mcPho).fourMomentum().et());
1556  }
1557 
1558  // break;
1559  } // loop over reco conversions
1560  if (recomatch) {
1566  h_SimConvTwoMTracks_[4]->Fill((*mcPho).fourMomentum().et());
1567 
1568  if (chi2Prob > 0) {
1573  h_SimConvTwoMTracksAndVtxPGT0_[4]->Fill((*mcPho).fourMomentum().et());
1574  }
1575  if (chi2Prob > 0.0005) {
1580  h_SimConvTwoMTracksAndVtxPGT0005_[4]->Fill((*mcPho).fourMomentum().et());
1581  }
1582  }
1583 
1584  } //End loop over simulated conversions
1585 
1586  // ########################### RECO to SIM ############################## //
1587 
1588  for (reco::ConversionCollection::const_iterator conv = convHandle->begin(); conv != convHandle->end(); ++conv) {
1589  const reco::Conversion& aConv = (*conv);
1591  continue;
1593  continue;
1595  continue;
1596 
1598  continue;
1599 
1600  //problematic?
1601  std::vector<edm::RefToBase<reco::Track> > tracks = aConv.tracks();
1602 
1603  const reco::Vertex& vtx = aConv.conversionVertex();
1604  //requires two tracks and a valid vertex
1605  if (tracks.size() != 2 || !(vtx.isValid()))
1606  continue;
1607  //if (tracks.size() !=2) continue;
1608 
1610  continue;
1611  if (aConv.nHitsBeforeVtx().size() > 1 &&
1612  max(aConv.nHitsBeforeVtx().at(0), aConv.nHitsBeforeVtx().at(1)) > maxHitsBeforeVtx_)
1613  continue;
1614 
1615  //compute transverse decay length with respect to beamspot
1616  math::XYZVectorF themom = aConv.refittedPairMomentum();
1617  double dbsx = aConv.conversionVertex().x() - thebs.x0();
1618  double dbsy = aConv.conversionVertex().y() - thebs.y0();
1619  double lxy = (themom.x() * dbsx + themom.y() * dbsy) / themom.rho();
1620 
1621  if (lxy < minLxy_)
1622  continue;
1623 
1624  bool phoIsInBarrel = false;
1625  bool phoIsInEndcap = false;
1626  RefToBase<reco::Track> tk1 = aConv.tracks().front();
1627  RefToBase<reco::Track> tk2 = aConv.tracks().back();
1629  tc1.push_back(tk1);
1630  tc2.push_back(tk2);
1631 
1632  if (ecalalgotracks_ &&
1636  continue;
1637 
1638  //std::cout << " RECO to SIM conversion track pt " << tk1->pt() << " " << tk2->pt() << endl;
1639  const reco::Track refTk1 = aConv.conversionVertex().refittedTracks().front();
1640  const reco::Track refTk2 = aConv.conversionVertex().refittedTracks().back();
1641 
1642  float dPhiTracksAtVtx;
1643  // override with the phi calculated at the vertex
1644  math::XYZVector p1AtVtx = recalculateMomentumAtFittedVertex((*theMF_), *trackerGeom, tk1, aConv.conversionVertex());
1645  math::XYZVector p2AtVtx = recalculateMomentumAtFittedVertex((*theMF_), *trackerGeom, tk2, aConv.conversionVertex());
1646  if (p1AtVtx.perp2() > p2AtVtx.perp2())
1647  dPhiTracksAtVtx = p1AtVtx.phi() - p2AtVtx.phi();
1648  else
1649  dPhiTracksAtVtx = p2AtVtx.phi() - p1AtVtx.phi();
1650 
1651  math::XYZVectorF refittedMom = aConv.refittedPairMomentum();
1652 
1653  if (fabs(refittedMom.eta()) < 1.479) {
1654  phoIsInBarrel = true;
1655  } else {
1656  phoIsInEndcap = true;
1657  }
1658 
1659  nRecConv_++;
1660 
1661  // check matching with reco photon
1662  double Mindeltaeta = 999999;
1663  double Mindeltaphi = 999999;
1664  bool matchConvSC = false;
1665  reco::PhotonCollection::const_iterator iMatchingSC;
1666  for (reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end();
1667  iPho++) {
1668  reco::Photon aPho = reco::Photon(*iPho);
1669  const double deltaphi = reco::deltaPhi(aConv.refittedPairMomentum().phi(), aPho.superCluster()->position().phi());
1670  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
1671  double deltaeta = abs(aPho.superCluster()->position().eta() - ConvEta);
1672  if (abs(deltaeta) < abs(Mindeltaeta) && abs(deltaphi) < abs(Mindeltaphi)) {
1673  Mindeltaphi = abs(deltaphi);
1674  Mindeltaeta = abs(deltaeta);
1675  iMatchingSC = iPho;
1676  }
1677  }
1678  if (abs(Mindeltaeta) < 0.1 && abs(Mindeltaphi) < 0.1) {
1679  matchConvSC = true;
1680  }
1681 
1683  int match = 0;
1684  float invM = aConv.pairInvariantMass();
1685  float chi2Prob = ChiSquaredProbability(aConv.conversionVertex().chi2(), aConv.conversionVertex().ndof());
1686  uint maxNHitsBeforeVtx =
1687  aConv.nHitsBeforeVtx().size() > 1 ? max(aConv.nHitsBeforeVtx().at(0), aConv.nHitsBeforeVtx().at(1)) : 0;
1688  uint sumNHitsBeforeVtx =
1689  aConv.nHitsBeforeVtx().size() > 1 ? aConv.nHitsBeforeVtx().at(0) + aConv.nHitsBeforeVtx().at(1) : 0;
1690  float maxDlClosestHitToVtx = aConv.dlClosestHitToVtx().size() > 1 ? max(aConv.dlClosestHitToVtx().at(0).value(),
1691  aConv.dlClosestHitToVtx().at(1).value())
1692  : 0;
1693  float maxDlClosestHitToVtxSig =
1694  aConv.dlClosestHitToVtx().size() > 1
1695  ? max(aConv.dlClosestHitToVtx().at(0).value() / aConv.dlClosestHitToVtx().at(0).error(),
1696  aConv.dlClosestHitToVtx().at(1).value() / aConv.dlClosestHitToVtx().at(1).error())
1697  : 0;
1698 
1699  int ilead = 0, itrail = 1;
1700  if (tk2->pt() > tk1->pt()) {
1701  ilead = 1;
1702  itrail = 0;
1703  }
1704  RefToBase<reco::Track> tklead = aConv.tracks().at(ilead);
1705  RefToBase<reco::Track> tktrail = aConv.tracks().at(itrail);
1706 
1707  int deltaExpectedHitsInner = tklead->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) -
1709  int leadExpectedHitsInner = tklead->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
1710  uint leadNHitsBeforeVtx = aConv.nHitsBeforeVtx().size() > 1 ? aConv.nHitsBeforeVtx().at(ilead) : 0;
1711  uint trailNHitsBeforeVtx = aConv.nHitsBeforeVtx().size() > 1 ? aConv.nHitsBeforeVtx().at(itrail) : 0;
1712 
1713  h_convEta_[match][0]->Fill(refittedMom.eta());
1714  h_convEta2_[match][0]->Fill(refittedMom.eta());
1715 
1716  h_convPhi_[match][0]->Fill(refittedMom.phi());
1717  h_convR_[match][0]->Fill(sqrt(aConv.conversionVertex().position().perp2()));
1718  h_convRplot_->Fill(sqrt(aConv.conversionVertex().position().perp2()));
1719  h_convZ_[match][0]->Fill(aConv.conversionVertex().position().z());
1720  h_convZplot_->Fill(aConv.conversionVertex().position().z());
1721  h_convPt_[match][0]->Fill(sqrt(refittedMom.perp2()));
1722  h_invMass_[match][0]->Fill(invM);
1723  h_vtxChi2Prob_[match][0]->Fill(chi2Prob);
1724  h_lxybs_[match][0]->Fill(lxy);
1725  h_maxNHitsBeforeVtx_[match][0]->Fill(maxNHitsBeforeVtx);
1726  h_leadNHitsBeforeVtx_[match][0]->Fill(leadNHitsBeforeVtx);
1727  h_trailNHitsBeforeVtx_[match][0]->Fill(trailNHitsBeforeVtx);
1728  h_sumNHitsBeforeVtx_[match][0]->Fill(sumNHitsBeforeVtx);
1729  h_deltaExpectedHitsInner_[match][0]->Fill(deltaExpectedHitsInner);
1730  h_leadExpectedHitsInner_[match][0]->Fill(leadExpectedHitsInner);
1731  h_maxDlClosestHitToVtx_[match][0]->Fill(maxDlClosestHitToVtx);
1732  h_maxDlClosestHitToVtxSig_[match][0]->Fill(maxDlClosestHitToVtxSig);
1733  h_nSharedHits_[match][0]->Fill(aConv.nSharedHits());
1734 
1735  if (matchConvSC) {
1736  h_convEtaMatchSC_[match][0]->Fill(refittedMom.eta());
1737  h_EoverPTracks_[match][0]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
1738  h_convSCdPhi_[match][0]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
1739  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
1740  h_convSCdEta_[match][0]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
1741  }
1742 
1744  h_DPhiTracksAtVtx_[match][0]->Fill(dPhiTracksAtVtx);
1745  h2_DPhiTracksAtVtxVsEta_->Fill(mcEta_, dPhiTracksAtVtx);
1746  h2_DPhiTracksAtVtxVsR_->Fill(mcConvR_, dPhiTracksAtVtx);
1747  p_DPhiTracksAtVtxVsEta_->Fill(mcEta_, dPhiTracksAtVtx);
1748  p_DPhiTracksAtVtxVsR_->Fill(mcConvR_, dPhiTracksAtVtx);
1749 
1755 
1756  if (phoIsInBarrel) {
1757  h_invMass_[match][1]->Fill(invM);
1758  h_vtxChi2Prob_[match][1]->Fill(chi2Prob);
1760  h_DPhiTracksAtVtx_[match][1]->Fill(dPhiTracksAtVtx);
1762  h_lxybs_[match][1]->Fill(lxy);
1763  h_maxNHitsBeforeVtx_[match][1]->Fill(maxNHitsBeforeVtx);
1764  h_leadNHitsBeforeVtx_[match][1]->Fill(leadNHitsBeforeVtx);
1765  h_trailNHitsBeforeVtx_[match][1]->Fill(trailNHitsBeforeVtx);
1766  h_sumNHitsBeforeVtx_[match][1]->Fill(sumNHitsBeforeVtx);
1767  h_deltaExpectedHitsInner_[match][1]->Fill(deltaExpectedHitsInner);
1768  h_leadExpectedHitsInner_[match][1]->Fill(leadExpectedHitsInner);
1769  h_maxDlClosestHitToVtx_[match][1]->Fill(maxDlClosestHitToVtx);
1770  h_maxDlClosestHitToVtxSig_[match][1]->Fill(maxDlClosestHitToVtxSig);
1771  h_nSharedHits_[match][1]->Fill(aConv.nSharedHits());
1772 
1773  /*
1774  if ( aConv.caloCluster().size() ) {
1775  h_convSCdPhi_[match][1]->Fill( aConv.caloCluster()[0]->phi() - refittedMom.phi() );
1776  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(),aConv.zOfPrimaryVertexFromTracks());
1777  h_convSCdEta_[match][1]->Fill( aConv.caloCluster()[0]->eta() - ConvEta );
1778  }
1779  */
1780 
1781  if (matchConvSC) {
1782  h_EoverPTracks_[match][1]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
1783  h_convSCdPhi_[match][1]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
1784  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
1785  h_convSCdEta_[match][1]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
1786  }
1787  }
1788 
1789  if (phoIsInEndcap) {
1790  h_invMass_[match][2]->Fill(invM);
1791  h_vtxChi2Prob_[match][2]->Fill(chi2Prob);
1793  h_DPhiTracksAtVtx_[match][2]->Fill(dPhiTracksAtVtx);
1795  h_lxybs_[match][2]->Fill(lxy);
1796  h_maxNHitsBeforeVtx_[match][2]->Fill(maxNHitsBeforeVtx);
1797  h_leadNHitsBeforeVtx_[match][2]->Fill(leadNHitsBeforeVtx);
1798  h_trailNHitsBeforeVtx_[match][2]->Fill(trailNHitsBeforeVtx);
1799  h_sumNHitsBeforeVtx_[match][2]->Fill(sumNHitsBeforeVtx);
1800  h_deltaExpectedHitsInner_[match][2]->Fill(deltaExpectedHitsInner);
1801  h_leadExpectedHitsInner_[match][2]->Fill(leadExpectedHitsInner);
1802  h_maxDlClosestHitToVtx_[match][2]->Fill(maxDlClosestHitToVtx);
1803  h_maxDlClosestHitToVtxSig_[match][2]->Fill(maxDlClosestHitToVtxSig);
1804  h_nSharedHits_[match][2]->Fill(aConv.nSharedHits());
1805  if (matchConvSC) {
1806  h_EoverPTracks_[match][2]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
1807  h_convSCdPhi_[match][2]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
1808  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
1809  h_convSCdEta_[match][2]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
1810  }
1811  }
1812 
1813  h_convVtxRvsZ_[0]->Fill(fabs(aConv.conversionVertex().position().z()),
1814  sqrt(aConv.conversionVertex().position().perp2()));
1815  h_convVtxYvsX_->Fill(aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y());
1816  h_convVtxYvsX_zoom_[0]->Fill(aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y());
1817  h_convVtxYvsX_zoom_[1]->Fill(aConv.conversionVertex().position().x(), aConv.conversionVertex().position().y());
1818 
1819  // quantities per track: all conversions
1820  for (unsigned int i = 0; i < tracks.size(); i++) {
1821  double d0;
1822  if (valid_pvtx) {
1823  d0 = -tracks[i]->dxy(the_pvtx.position());
1824  } else {
1825  d0 = tracks[i]->d0();
1826  }
1827  h_TkD0_[match]->Fill(d0 * tracks[i]->charge());
1828  h_nHitsBeforeVtx_[match]->Fill(aConv.nHitsBeforeVtx().size() > 1 ? aConv.nHitsBeforeVtx().at(i) : 0);
1829  h_dlClosestHitToVtx_[match]->Fill(aConv.dlClosestHitToVtx().size() > 1 ? aConv.dlClosestHitToVtx().at(i).value()
1830  : 0);
1832  ? aConv.dlClosestHitToVtx().at(i).value() /
1833  aConv.dlClosestHitToVtx().at(i).error()
1834  : 0);
1835 
1838  p_nHitsVsEta_[match]->Fill(mcEta_, float(tracks[i]->numberOfValidHits()) - 0.0001);
1839  p_nHitsVsR_[match]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits()) - 0.0001);
1846  }
1847 
1848  bool associated = false;
1849  float mcConvPt_ = -99999999.0;
1850  // float mcPhi= 0; // unused
1851  float simPV_Z = 0;
1852  for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
1853  mcConvPt_ = (*mcPho).fourMomentum().et();
1854  float mcPhi = (*mcPho).fourMomentum().phi();
1855  simPV_Z = (*mcPho).primaryVertex().z();
1856  mcPhi_ = phiNormalization(mcPhi);
1857  mcEta_ = (*mcPho).fourMomentum().pseudoRapidity();
1858  mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z());
1859  mcConvR_ = (*mcPho).vertex().perp();
1860  mcConvX_ = (*mcPho).vertex().x();
1861  mcConvY_ = (*mcPho).vertex().y();
1862  mcConvZ_ = (*mcPho).vertex().z();
1863  mcConvEta_ = (*mcPho).vertex().eta();
1864  mcConvPhi_ = (*mcPho).vertex().phi();
1865  if (fabs(mcEta_) > END_HI)
1866  continue;
1868  continue;
1869  if (fabs(mcEta_) > maxPhoEtaForPurity)
1870  continue;
1871  if (fabs(mcConvZ_) > maxPhoZForPurity)
1872  continue;
1873  if (mcConvR_ > maxPhoRForEffic)
1874  continue;
1875 
1876  if ((*mcPho).isAConversion() != 1)
1877  continue;
1878  if (!((fabs(mcEta_) <= BARL && mcConvR_ < 85) ||
1879  (fabs(mcEta_) > BARL && fabs(mcEta_) <= END_HI && fabs((*mcPho).vertex().z()) < 210)))
1880  continue;
1881 
1882  theConvTP_.clear();
1883  for (const TrackingParticleRef& tp : tpForFakeRate) {
1884  if (fabs(tp->vx() - (*mcPho).vertex().x()) < 0.0001 && fabs(tp->vy() - (*mcPho).vertex().y()) < 0.0001 &&
1885  fabs(tp->vz() - (*mcPho).vertex().z()) < 0.0001) {
1887  }
1888  }
1889 
1890  if (theConvTP_.size() < 2)
1891  continue;
1892 
1893  //associated = false;
1894  reco::RecoToSimCollection const& p1 = theTrackAssociator->associateRecoToSim(tc1, theConvTP_);
1895  reco::RecoToSimCollection const& p2 = theTrackAssociator->associateRecoToSim(tc2, theConvTP_);
1896 
1897  auto itP1 = p1.find(tk1);
1898  auto itP2 = p2.find(tk2);
1899  bool good = (itP1 != p1.end()) and (not itP1->val.empty()) and (itP2 != p2.end()) and (not itP2->val.empty());
1900  if (not good) {
1901  itP1 = p1.find(tk2);
1902  itP2 = p2.find(tk1);
1903  good = (itP1 != p1.end()) and (not itP1->val.empty()) and (itP2 != p2.end()) and (not itP2->val.empty());
1904  }
1905 
1906  if (good) {
1907  std::vector<std::pair<TrackingParticleRef, double> > const& tp1 = itP1->val;
1908  std::vector<std::pair<TrackingParticleRef, double> > const& tp2 = itP2->val;
1909  TrackingParticleRef tpr1 = tp1.front().first;
1910  TrackingParticleRef tpr2 = tp2.front().first;
1911  if (abs(tpr1->pdgId()) == 11 && abs(tpr2->pdgId()) == 11 && tpr1->pdgId() * tpr2->pdgId() < 0) {
1912  if ((tpr1->parentVertex()->sourceTracks_end() - tpr1->parentVertex()->sourceTracks_begin() == 1) &&
1913  (tpr2->parentVertex()->sourceTracks_end() - tpr2->parentVertex()->sourceTracks_begin() == 1)) {
1914  if (tpr1->parentVertex().key() == tpr2->parentVertex().key() &&
1915  ((*tpr1->parentVertex()->sourceTracks_begin())->pdgId() == 22)) {
1916  mcConvR_ = sqrt(tpr1->parentVertex()->position().Perp2());
1917  mcConvZ_ = tpr1->parentVertex()->position().z();
1918  mcConvX_ = tpr1->parentVertex()->position().x();
1919  mcConvY_ = tpr1->parentVertex()->position().y();
1920  mcConvEta_ = tpr1->parentVertex()->position().eta();
1921  mcConvPhi_ = tpr1->parentVertex()->position().phi();
1922  mcConvPt_ = sqrt((*tpr1->parentVertex()->sourceTracks_begin())->momentum().Perp2());
1923  //std::cout << " Reco to Sim mcconvpt " << mcConvPt_ << std::endl;
1924  //cout << "associated track1 to " << tpr1->pdgId() << " with p=" << tpr1->p4() << " with pT=" << tpr1->pt() << endl;
1925  //cout << "associated track2 to " << tpr2->pdgId() << " with p=" << tpr2->p4() << " with pT=" << tpr2->pt() << endl;
1926  associated = true;
1927  break;
1928  }
1929  }
1930  }
1931  }
1932 
1933  } // end loop on sim photons
1934 
1935  if (false) {
1936  theConvTP_.clear();
1937  theConvTP_ = tpForFakeRate;
1938  reco::RecoToSimCollection p1incl = theTrackAssociator->associateRecoToSim(tc1, theConvTP_);
1939  reco::RecoToSimCollection p2incl = theTrackAssociator->associateRecoToSim(tc2, theConvTP_);
1940 
1941  for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
1942  mcConvPt_ = (*mcPho).fourMomentum().et();
1943  float mcPhi = (*mcPho).fourMomentum().phi();
1944  simPV_Z = (*mcPho).primaryVertex().z();
1945  mcPhi_ = phiNormalization(mcPhi);
1946  mcEta_ = (*mcPho).fourMomentum().pseudoRapidity();
1947  mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z());
1948  mcConvR_ = (*mcPho).vertex().perp();
1949  mcConvX_ = (*mcPho).vertex().x();
1950  mcConvY_ = (*mcPho).vertex().y();
1951  mcConvZ_ = (*mcPho).vertex().z();
1952  mcConvEta_ = (*mcPho).vertex().eta();
1953  mcConvPhi_ = (*mcPho).vertex().phi();
1954  if (fabs(mcEta_) > END_HI)
1955  continue;
1957  continue;
1958  if (fabs(mcEta_) > maxPhoEtaForPurity)
1959  continue;
1960  if (fabs(mcConvZ_) > maxPhoZForPurity)
1961  continue;
1962  if (mcConvR_ > maxPhoRForEffic)
1963  continue;
1964 
1965  if ((*mcPho).isAConversion() != 1)
1966  continue;
1967  if (!((fabs(mcEta_) <= BARL && mcConvR_ < 85) ||
1968  (fabs(mcEta_) > BARL && fabs(mcEta_) <= END_HI && fabs((*mcPho).vertex().z()) < 210)))
1969  continue;
1970 
1971  theConvTP_.clear();
1972  for (const TrackingParticleRef& tp : tpForFakeRate) {
1973  if (fabs(tp->vx() - (*mcPho).vertex().x()) < 0.0001 && fabs(tp->vy() - (*mcPho).vertex().y()) < 0.0001 &&
1974  fabs(tp->vz() - (*mcPho).vertex().z()) < 0.0001) {
1976  }
1977  }
1978 
1979  if (theConvTP_.size() < 2)
1980  continue;
1981 
1982  //associated = false;
1983  reco::RecoToSimCollection p1 = theTrackAssociator->associateRecoToSim(tc1, theConvTP_);
1984  reco::RecoToSimCollection p2 = theTrackAssociator->associateRecoToSim(tc2, theConvTP_);
1985 
1986  if ((!p1incl.empty() && !p2incl.empty()) && (!p1.empty() || !p2.empty())) { // associated = true;
1987  try {
1988  std::vector<std::pair<TrackingParticleRef, double> > tp1 = p1incl[tk1];
1989  std::vector<std::pair<TrackingParticleRef, double> > tp2 = p2incl[tk2];
1990  if (!(!tp1.empty() && !tp2.empty())) {
1991  tp1 = p1[tk2];
1992  tp2 = p2[tk1];
1993  }
1994  if (!tp1.empty() && !tp2.empty()) {
1995  TrackingParticleRef tpr1 = tp1.front().first;
1996  TrackingParticleRef tpr2 = tp2.front().first;
1997  if (abs(tpr1->pdgId()) == 11 && abs(tpr2->pdgId()) == 11 && tpr1->pdgId() * tpr2->pdgId() < 0) {
1998  if (((tpr1->parentVertex()->sourceTracks_end() - tpr1->parentVertex()->sourceTracks_begin() >= 1) &&
1999  (*tpr1->parentVertex()->sourceTracks_begin())->pdgId() == 22) &&
2000  ((tpr2->parentVertex()->sourceTracks_end() - tpr2->parentVertex()->sourceTracks_begin() >= 1) &&
2001  (*tpr2->parentVertex()->sourceTracks_begin())->pdgId() == 22)) {
2002  // if ( fabs(tpr1->vx() - tpr2->vx()) < 0.1 && fabs(tpr1->vy() - tpr2->vy()) < 0.1 && fabs(tpr1->vz() - tpr2->vz()) < 0.1) {
2003  //if (((*tpr1->parentVertex()->sourceTracks_begin())->pdgId()==22) || ((*tpr2->parentVertex()->sourceTracks_begin())->pdgId()==22)) {
2004  // mcConvR_ = sqrt(tpr1->parentVertex()->position().Perp2());
2005  // mcConvZ_ = tpr1->parentVertex()->position().z();
2006  // mcConvX_ = tpr1->parentVertex()->position().x();
2007  // mcConvY_ = tpr1->parentVertex()->position().y();
2008  // mcConvEta_ = tpr1->parentVertex()->position().eta();
2009  // mcConvPhi_ = tpr1->parentVertex()->position().phi();
2010  // mcConvPt_ = sqrt((*tpr1->parentVertex()->sourceTracks_begin())->momentum().Perp2());
2011  //std::cout << " Reco to Sim mcconvpt " << mcConvPt_ << std::endl;
2012  //cout << "associated track1 to " << tpr1->pdgId() << " with p=" << tpr1->p4() << " with pT=" << tpr1->pt() << endl;
2013  //cout << "associated track2 to " << tpr2->pdgId() << " with p=" << tpr2->p4() << " with pT=" << tpr2->pt() << endl;
2014  associated = true;
2015  break;
2016  //}
2017  //}
2018  }
2019  }
2020  }
2021  } catch (Exception const& event) {
2022  //cout << "do not continue: " << event.what() << endl;
2023  //continue;
2024  }
2025  }
2026  }
2027  }
2028 
2029  if (associated)
2030  match = 1;
2031  else
2032  match = 2;
2033 
2034  h_match_->Fill(float(match));
2036  if (match == 1)
2037  nRecConvAss_++;
2038  h_convEta_[match][0]->Fill(refittedMom.eta());
2039  h_convEta_[match][1]->Fill(refittedMom.eta());
2040  if (matchConvSC)
2041  h_convEtaMatchSC_[match][0]->Fill(refittedMom.eta());
2042  h_convPhi_[match][0]->Fill(refittedMom.phi());
2043  h_convR_[match][0]->Fill(sqrt(aConv.conversionVertex().position().perp2()));
2044  h_convZ_[match][0]->Fill(aConv.conversionVertex().position().z());
2045  h_convPt_[match][0]->Fill(sqrt(refittedMom.perp2()));
2046  h_invMass_[match][0]->Fill(invM);
2047  h_vtxChi2Prob_[match][0]->Fill(chi2Prob);
2048  h_DPhiTracksAtVtx_[match][0]->Fill(dPhiTracksAtVtx);
2051  h_lxybs_[match][0]->Fill(lxy);
2052  h_maxNHitsBeforeVtx_[match][0]->Fill(maxNHitsBeforeVtx);
2053  h_leadNHitsBeforeVtx_[match][0]->Fill(leadNHitsBeforeVtx);
2054  h_trailNHitsBeforeVtx_[match][0]->Fill(trailNHitsBeforeVtx);
2055  h_sumNHitsBeforeVtx_[match][0]->Fill(sumNHitsBeforeVtx);
2056  h_deltaExpectedHitsInner_[match][0]->Fill(deltaExpectedHitsInner);
2057  h_leadExpectedHitsInner_[match][0]->Fill(leadExpectedHitsInner);
2058  h_maxDlClosestHitToVtx_[match][0]->Fill(maxDlClosestHitToVtx);
2059  h_maxDlClosestHitToVtxSig_[match][0]->Fill(maxDlClosestHitToVtxSig);
2060  h_nSharedHits_[match][0]->Fill(aConv.nSharedHits());
2061  if (matchConvSC) {
2062  //h_EoverPTracks_[match][0] ->Fill (aConv.EoverPrefittedTracks());
2063  h_EoverPTracks_[match][0]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
2064  h_convSCdPhi_[match][0]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
2065  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
2066  h_convSCdEta_[match][0]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
2067  }
2068  if (match == 1) {
2069  h2_photonPtRecVsPtSim_->Fill(mcConvPt_, sqrt(refittedMom.perp2()));
2070  h_convPtRes_[0]->Fill(sqrt(refittedMom.perp2()) / mcConvPt_);
2071  }
2072 
2073  if (phoIsInBarrel) {
2074  h_invMass_[match][1]->Fill(invM);
2075  h_vtxChi2Prob_[match][1]->Fill(chi2Prob);
2076  h_DPhiTracksAtVtx_[match][1]->Fill(dPhiTracksAtVtx);
2079  h_lxybs_[match][1]->Fill(lxy);
2080  h_maxNHitsBeforeVtx_[match][1]->Fill(maxNHitsBeforeVtx);
2081  h_leadNHitsBeforeVtx_[match][1]->Fill(leadNHitsBeforeVtx);
2082  h_trailNHitsBeforeVtx_[match][1]->Fill(trailNHitsBeforeVtx);
2083  h_sumNHitsBeforeVtx_[match][1]->Fill(sumNHitsBeforeVtx);
2084  h_deltaExpectedHitsInner_[match][1]->Fill(deltaExpectedHitsInner);
2085  h_leadExpectedHitsInner_[match][1]->Fill(leadExpectedHitsInner);
2086  h_maxDlClosestHitToVtx_[match][1]->Fill(maxDlClosestHitToVtx);
2087  h_maxDlClosestHitToVtxSig_[match][1]->Fill(maxDlClosestHitToVtxSig);
2088  h_nSharedHits_[match][1]->Fill(aConv.nSharedHits());
2089  if (matchConvSC) {
2090  // h_EoverPTracks_[match][1] ->Fill (aConv.EoverPrefittedTracks());
2091  h_EoverPTracks_[match][1]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
2092  h_convSCdPhi_[match][1]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
2093  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
2094  h_convSCdEta_[match][1]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
2095  }
2096  if (match == 1)
2097  h_convPtRes_[1]->Fill(sqrt(refittedMom.perp2()) / mcConvPt_);
2098  }
2099 
2100  if (phoIsInEndcap) {
2101  h_invMass_[match][2]->Fill(invM);
2102  h_vtxChi2Prob_[match][2]->Fill(chi2Prob);
2103  h_DPhiTracksAtVtx_[match][2]->Fill(dPhiTracksAtVtx);
2106  h_lxybs_[match][2]->Fill(lxy);
2107  h_maxNHitsBeforeVtx_[match][2]->Fill(maxNHitsBeforeVtx);
2108  h_leadNHitsBeforeVtx_[match][2]->Fill(leadNHitsBeforeVtx);
2109  h_trailNHitsBeforeVtx_[match][2]->Fill(trailNHitsBeforeVtx);
2110  h_sumNHitsBeforeVtx_[match][2]->Fill(sumNHitsBeforeVtx);
2111  h_deltaExpectedHitsInner_[match][2]->Fill(deltaExpectedHitsInner);
2112  h_leadExpectedHitsInner_[match][2]->Fill(leadExpectedHitsInner);
2113  h_maxDlClosestHitToVtx_[match][2]->Fill(maxDlClosestHitToVtx);
2114  h_maxDlClosestHitToVtxSig_[match][2]->Fill(maxDlClosestHitToVtxSig);
2115  h_nSharedHits_[match][2]->Fill(aConv.nSharedHits());
2116  if (matchConvSC) {
2117  // h_EoverPTracks_[match][2] ->Fill (aConv.EoverPrefittedTracks());
2118  h_EoverPTracks_[match][2]->Fill(iMatchingSC->superCluster()->energy() / sqrt(refittedMom.mag2()));
2119  h_convSCdPhi_[match][2]->Fill(iMatchingSC->superCluster()->position().phi() - refittedMom.phi());
2120  double ConvEta = etaTransformation(aConv.refittedPairMomentum().eta(), aConv.zOfPrimaryVertexFromTracks());
2121  h_convSCdEta_[match][2]->Fill(iMatchingSC->superCluster()->position().eta() - ConvEta);
2122  }
2123  if (match == 1)
2124  h_convPtRes_[2]->Fill(sqrt(refittedMom.perp2()) / mcConvPt_);
2125  }
2126 
2127  if (match == 1) {
2131  h_convVtxdR_->Fill(sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_);
2142 
2143  float dR = sqrt(aConv.conversionVertex().position().perp2()) - mcConvR_;
2144  float dZ = aConv.conversionVertex().position().z() - mcConvZ_;
2147 
2149 
2152  h2_dzPVVsR_->Fill(mcConvR_, aConv.zOfPrimaryVertexFromTracks() - simPV_Z);
2153  p_dzPVVsR_->Fill(mcConvR_, aConv.zOfPrimaryVertexFromTracks() - simPV_Z);
2154 
2155  if (phoIsInBarrel) {
2160  }
2161  if (phoIsInEndcap) {
2166  }
2167  }
2168 
2170  for (unsigned int i = 0; i < tracks.size(); i++) {
2171  //std::cout << " Loop over tracks pt " << tracks[i]->pt() << std::endl;
2172  RefToBase<reco::Track> tfrb(aConv.tracks()[i]);
2173  itAss = myAss.find(tfrb.get());
2174 
2177  p_nHitsVsEta_[match]->Fill(mcEta_, float(tracks[i]->numberOfValidHits()) - 0.0001);
2178  p_nHitsVsR_[match]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits()) - 0.0001);
2185  double d0;
2186  if (valid_pvtx) {
2187  d0 = -tracks[i]->dxy(the_pvtx.position());
2188  } else {
2189  d0 = tracks[i]->d0();
2190  }
2191  h_TkD0_[match]->Fill(d0 * tracks[i]->charge());
2192  h_nHitsBeforeVtx_[match]->Fill(aConv.nHitsBeforeVtx().size() > 1 ? aConv.nHitsBeforeVtx().at(i) : 0);
2193  h_dlClosestHitToVtx_[match]->Fill(aConv.dlClosestHitToVtx().size() > 1 ? aConv.dlClosestHitToVtx().at(i).value()
2194  : 0);
2196  ? aConv.dlClosestHitToVtx().at(i).value() /
2197  aConv.dlClosestHitToVtx().at(i).error()
2198  : 0);
2199 
2200  if (itAss == myAss.end())
2201  continue;
2202  reco::Track refTrack = aConv.conversionVertex().refittedTracks()[i];
2203 
2204  float simPt = sqrt(((*itAss).second)->momentum().perp2());
2205  float recPt = refTrack.pt();
2206  float ptres = recPt - simPt;
2207  //float pterror = aConv.tracks()[i]->ptError();
2208  float pterror = aConv.conversionVertex().refittedTracks()[i].ptError();
2209  h2_PtRecVsPtSim_[0]->Fill(simPt, recPt);
2210  h_TkPtPull_[0]->Fill(ptres / pterror);
2211  h2_TkPtPull_[0]->Fill(mcEta_, ptres / pterror);
2212 
2213  if (phoIsInBarrel) {
2214  h_TkPtPull_[1]->Fill(ptres / pterror);
2215  h2_PtRecVsPtSim_[1]->Fill(simPt, recPt);
2216  }
2217  if (phoIsInEndcap) {
2218  h_TkPtPull_[2]->Fill(ptres / pterror);
2219  h2_PtRecVsPtSim_[2]->Fill(simPt, recPt);
2220  }
2221  } // end loop over track
2222 
2223  } // loop over reco conversions
2224 
2225  h_nConv_[0][0]->Fill(float(nRecConv_));
2226  h_nConv_[1][0]->Fill(float(nRecConvAss_));
2227 }
2228 
2231  if (!isRunCentrally_) {
2233  }
2234 
2235  edm::LogInfo("TkConvValidator") << "Analyzed " << nEvt_ << "\n";
2236  // std::cout << "::endJob Analyzed " << nEvt_ << " events " << " with total " << nPho_ << " Photons " << "\n";
2237  // std::cout << "TkConvValidator::endJob Analyzed " << nEvt_ << " events " << "\n";
2238 
2239  return;
2240 }
2241 
2243  const TrackerGeometry& trackerGeom,
2244  const edm::RefToBase<reco::Track>& tk,
2245  const reco::Vertex& vtx) {
2248  auto scp = new SimpleCylinderBounds(sqrt(vtx.position().perp2()) - 0.001f,
2249  sqrt(vtx.position().perp2()) + 0.001f,
2250  -fabs(vtx.position().z()),
2251  fabs(vtx.position().z()));
2253  new Cylinder(Cylinder::computeRadius(*scp), Surface::PositionType(0, 0, 0), rot, scp));
2254 
2256  new Disk(Surface::PositionType(0, 0, vtx.position().z()),
2257  rot,
2258  new SimpleDiskBounds(0, sqrt(vtx.position().perp2()), -0.001, 0.001)));
2259 
2260  const TrajectoryStateOnSurface myTSOS = trajectoryStateTransform::innerStateOnSurface(*tk, trackerGeom, &mf);
2261  PropagatorWithMaterial propag(anyDirection, 0.000511, &mf);
2262  TrajectoryStateOnSurface stateAtVtx;
2263  stateAtVtx = propag.propagate(myTSOS, *theBarrel_);
2264  if (!stateAtVtx.isValid()) {
2265  stateAtVtx = propag.propagate(myTSOS, *theDisk_);
2266  }
2267  if (stateAtVtx.isValid()) {
2268  return math::XYZVector(double(stateAtVtx.globalMomentum().x()),
2269  double(stateAtVtx.globalMomentum().y()),
2270  double(stateAtVtx.globalMomentum().z()));
2271  } else {
2272  return math::XYZVector(0., 0., 0.);
2273  }
2274 }
2275 
2277  //---Definitions
2278  const float PI = 3.1415927;
2279  const float TWOPI = 2.0 * PI;
2280 
2281  if (phi > PI) {
2282  phi = phi - TWOPI;
2283  }
2284  if (phi < -PI) {
2285  phi = phi + TWOPI;
2286  }
2287 
2288  // cout << " Float_t PHInormalization out " << PHI << endl;
2289  return phi;
2290 }
2291 
2292 float TkConvValidator::etaTransformation(float EtaParticle, float Zvertex) {
2293  //---Definitions
2294  const float PI = 3.1415927;
2295 
2296  //---Definitions for ECAL
2297  const float R_ECAL = 136.5;
2298  const float Z_Endcap = 328.0;
2299  const float etaBarrelEndcap = 1.479;
2300 
2301  //---ETA correction
2302 
2303  float Theta = 0.0;
2304  float ZEcal = R_ECAL * sinh(EtaParticle) + Zvertex;
2305 
2306  if (ZEcal != 0.0)
2307  Theta = atan(R_ECAL / ZEcal);
2308  if (Theta < 0.0)
2309  Theta = Theta + PI;
2310  float ETA = -log(tan(0.5 * Theta));
2311 
2312  if (fabs(ETA) > etaBarrelEndcap) {
2313  float Zend = Z_Endcap;
2314  if (EtaParticle < 0.0)
2315  Zend = -Zend;
2316  float Zlen = Zend - Zvertex;
2317  float RR = Zlen / sinh(EtaParticle);
2318  Theta = atan(RR / Zend);
2319  if (Theta < 0.0)
2320  Theta = Theta + PI;
2321  ETA = -log(tan(0.5 * Theta));
2322  }
2323  //---Return the result
2324  return ETA;
2325  //---end
2326 }
MonitorElement * h2_DPhiTracksAtVtxVsR_
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
MonitorElement * h2_dzPVVsR_
MonitorElement * h_maxDlClosestHitToVtx_[3][3]
MonitorElement * h_convPt_[3][3]
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
MonitorElement * p_convVtxdYVsY_
std::string dqmpath_
MonitorElement * h2_DCotTracksVsR_
MonitorElement * h_convVtxdR_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
MonitorElement * h2_DCotTracksVsEta_
MonitorElement * h_simConvVtxRvsZ_[4]
MonitorElement * h_convZplot_
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:891
double zOfPrimaryVertexFromTracks(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.h:136
const std::vector< Measurement1DFloat > & dlClosestHitToVtx() const
Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positi...
Definition: Conversion.h:156
MonitorElement * h_nSimConv_[2]
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:485
MonitorElement * h_convSCdPhi_[3][3]
MonitorElement * h_SimConvTwoMTracksAndVtxPGT0_[5]
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
MonitorElement * h_SimConvTwoMTracksAndVtxPGT0005_[5]
double distOfMinimumApproach() const
Definition: Conversion.h:116
MonitorElement * h_DCotTracks_[3][3]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * nHitsVsEta_[3]
edm::EDGetTokenT< TrackingParticleRefVector > tpSelForFake_Token_
T z() const
Definition: PV3DBase.h:61
MonitorElement * h_lxybs_[3][3]
edm::RefVector< TrackingParticleCollection > theConvTP_
MonitorElement * h_trailNHitsBeforeVtx_[3][3]
const Point & position() const
position
Definition: Vertex.h:128
double pairCotThetaSeparation() const
Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used.
Definition: Conversion.cc:179
math::XYZVector recalculateMomentumAtFittedVertex(const MagneticField &mf, const TrackerGeometry &trackerGeom, const edm::RefToBase< reco::Track > &tk, const reco::Vertex &vtx)
MonitorElement * p_Chi2VsR_[3]
MonitorElement * h_convVtxYvsX_zoom_[2]
edm::EDGetTokenT< reco::PhotonCollection > photonCollectionPr_Token_
MonitorElement * p_DCotTracksVsR_
MonitorElement * h_tkChi2_[3]
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:206
MonitorElement * h_convVtxdX_
T const * product() const
Definition: Handle.h:70
MonitorElement * h_convPtRes_[3]
MonitorElement * h_convEtaMatchSC_[3][3]
MonitorElement * h2_Chi2VsEta_[3]
MonitorElement * p_TkPtPull_[3]
MonitorElement * h_SimRecConvTwoMTracks_[5]
MonitorElement * h_vtxChi2Prob_[3][3]
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
uint8_t nSharedHits() const
number of shared hits btw the two track
Definition: Conversion.h:158
void endJob() override
MonitorElement * h_convVtxdX_endcap_
MonitorElement * h_convVtxdR_endcap_
edm::EDGetTokenT< reco::VertexCollection > offline_pvToken_
MonitorElement * h_zPVFromTracks_[2]
MonitorElement * h_convVtxdY_barrel_
MonitorElement * h_tkChi2Large_[3]
bool empty() const
return true if empty
Log< level::Error, false > LogError
edm::ParameterSet parameters_
edm::EDGetTokenT< edm::SimTrackContainer > g4_simTk_Token_
MonitorElement * p_DCotTracksVsEta_
edm::EDGetTokenT< edm::SimVertexContainer > g4_simVtx_Token_
static constexpr float R_ECAL
MonitorElement * h_maxDlClosestHitToVtxSig_[3][3]
double ndof() const
Definition: Vertex.h:124
MonitorElement * h_convVtxdR_barrel_
MonitorElement * h_leadExpectedHitsInner_[3][3]
key_type key() const
Accessor for product key.
Definition: Ref.h:244
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
const_iterator find(const key_type &k) const
find element with specified reference key
MonitorElement * h_convSCdEta_[3][3]
MonitorElement * h_sumNHitsBeforeVtx_[3][3]
MonitorElement * h_dzPVFromTracks_[2]
const_iterator end() const
last iterator over the map (read only)
Definition: BoundDisk.h:19
void Fill(long long x)
MonitorElement * h_nConv_[3][3]
info per conversion
edm::ESHandle< CaloGeometry > theCaloGeom_
double x0() const
x coordinate
Definition: BeamSpot.h:61
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_convVtxdY_
double pt() const
track transverse momentum
Definition: TrackBase.h:637
MonitorElement * p_DPhiTracksAtVtxVsEta_
MonitorElement * h_deltaExpectedHitsInner_[3][3]
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
MonitorElement * h_convVtxdEta_
#define ETA
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
MonitorElement * h_convVtxYvsX_
MonitorElement * p_convVtxdZVsR_
edm::EDGetTokenT< TrackingParticleRefVector > tpSelForEff_Token_
MonitorElement * p_convVtxdRVsR_
MonitorElement * h_convR_[3][3]
float etaTransformation(float a, float b)
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
float phiNormalization(float &a)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
MonitorElement * h_VisSimConv_[6]
MonitorElement * h2_photonPtRecVsPtSim_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
MonitorElement * h_EoverPTracks_[3][3]
edm::ESHandle< MagneticField > theMF_
T sqrt(T t)
Definition: SSEVec.h:23
PhotonMCTruthFinder * thePhotonMCTruthFinder_
MonitorElement * h_leadNHitsBeforeVtx_[3][3]
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > trackAssociator_Token_
~TkConvValidator() override
edm::EDGetTokenT< reco::ConversionCollection > conversionCollectionPr_Token_
MonitorElement * h_distMinAppTracks_[3][3]
MonitorElement * p_DPhiTracksAtVtxVsR_
TkConvValidator(const edm::ParameterSet &)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * h_SimConvEtaPix_[2]
#define TWOPI
MonitorElement * h_convVtxdX_barrel_
MonitorElement * p_nHitsVsEta_[3]
double f[11][100]
MonitorElement * h_simTkPt_
float ChiSquaredProbability(double chiSquared, double nrDOF)
static constexpr float etaBarrelEndcap
MonitorElement * p_convVtxdXVsX_
double y0() const
y coordinate
Definition: BeamSpot.h:63
MonitorElement * h_convVtxdY_endcap_
double x() const
x coordinate
Definition: Vertex.h:130
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:16
MonitorElement * h_convEta_[3][3]
#define PI
Definition: QcdUeDQM.h:37
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
double y() const
y coordinate
Definition: Vertex.h:132
MonitorElement * h_convVtxRvsZ_zoom_[2]
MonitorElement * h_simConvVtxYvsX_
MonitorElement * h_convEta2_[3][3]
MonitorElement * h_nHitsBeforeVtx_[3]
MonitorElement * p2_convVtxdRVsRZ_
MonitorElement * p_Chi2VsEta_[3]
MonitorElement * nHits_[3]
Log< level::Info, false > LogInfo
MonitorElement * h_SimConvTwoTracks_[5]
static constexpr float d0
TrackAlgorithm algo() const
Definition: TrackBase.h:547
MonitorElement * h_convVtxdZ_
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
MonitorElement * h_convVtxRvsZ_[3]
MonitorElement * h2_DPhiTracksAtVtxVsEta_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
MonitorElement * h_convPhi_[3][3]
void clear()
Clear the vector.
Definition: RefVector.h:142
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const std::vector< Track > & refittedTracks() const
Returns the container of refitted tracks.
Definition: Vertex.h:197
MonitorElement * h_convVtxdZ_barrel_
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
MonitorElement * h2_convVtxRrecVsTrue_
double pairInvariantMass() const
if nTracks=2 returns the pair invariant mass. Original tracks are used here
Definition: Conversion.cc:159
MonitorElement * h_AllSimConv_[5]
Denominator for efficiencies.
MonitorElement * h_convRplot_
MonitorElement * p_nHitsVsR_[3]
GlobalVector globalMomentum() const
MonitorElement * p_dzPVVsR_
MonitorElement * h2_Chi2VsR_[3]
EPOS::IO_EPOS conv
std::vector< PhotonMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
bool isValid() const
Definition: HandleBase.h:70
bool quality(ConversionQuality q) const
Definition: Conversion.h:178
double chi2() const
chi-squares
Definition: Vertex.h:117
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:88
MonitorElement * h_convVtxdPhi_
MonitorElement * h_invMass_[3][3]
MonitorElement * h_convZ_[3][3]
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:824
MonitorElement * h_dlClosestHitToVtxSig_[3]
HLT enums.
MonitorElement * h2_PtRecVsPtSim_[3]
MonitorElement * h_match_
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:28
const std::vector< uint8_t > & nHitsBeforeVtx() const
Vector of the number of hits before the vertex along each track trajector.
Definition: Conversion.h:154
double mcPhi_
global variable for the MC photon
MonitorElement * p_convVtxdZVsZ_
MonitorElement * h2_TkPtPull_[3]
void push_back(const RefToBase< T > &)
MonitorElement * h_convVtxdZ_endcap_
MonitorElement * h2_convVtxdRVsR_
MonitorElement * h_DPhiTracksAtVtx_[3][3]
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * nHitsVsR_[3]
void dqmEndRun(edm::Run const &r, edm::EventSetup const &es) override
MonitorElement * h_simTkEta_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
MonitorElement * h_TkPtPull_[3]
MonitorElement * p2_convVtxdZVsRZ_
MonitorElement * h_SimConvTwoMTracks_[5]
MonitorElement * p_convVtxdRVsEta_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * h_dlClosestHitToVtx_[3]
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
MonitorElement * h_TkD0_[3]
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
MonitorElement * h2_convVtxdRVsEta_
value_type const * get() const
Definition: RefToBase.h:216
MonitorElement * h_nSharedHits_[3][3]
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:73
static constexpr float Z_Endcap
Definition: event.py:1
Definition: Run.h:45
MonitorElement * h_maxNHitsBeforeVtx_[3][3]
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackBuilderToken_
void dqmBeginRun(edm::Run const &r, edm::EventSetup const &theEventSetup) override