CMS 3D CMS Logo

PhotonIsolationCalculator.cc
Go to the documentation of this file.
1 
19 
23 
26 
28 
30  std::vector<int> const& flagsEB,
31  std::vector<int> const& flagsEE,
32  std::vector<int> const& severitiesEB,
33  std::vector<int> const& severitiesEE,
35  trackInputTag_ = iC.consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("trackProducer"));
36  beamSpotProducerTag_ = iC.consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpotProducer"));
38  iC.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("barrelEcalRecHitCollection"));
40  iC.consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("endcapEcalRecHitCollection"));
41 
42  auto hbhetag = conf.getParameter<edm::InputTag>("HBHERecHitCollection");
43  if (not hbhetag.label().empty())
44  hbheRecHitsTag_ = iC.consumes<HBHERecHitCollection>(hbhetag);
45 
46  caloGeometryToken_ = decltype(caloGeometryToken_){iC.esConsumes()};
47  hcalTopologyToken_ = decltype(hcalTopologyToken_){iC.esConsumes()};
48  hcalChannelQualityToken_ = decltype(hcalChannelQualityToken_){iC.esConsumes(edm::ESInputTag("", "withTopo"))};
49  hcalSevLvlComputerToken_ = decltype(hcalSevLvlComputerToken_){iC.esConsumes()};
50  towerMapToken_ = decltype(towerMapToken_){iC.esConsumes()};
51 
52  // gsfRecoInputTag_ = conf.getParameter<edm::InputTag>("GsfRecoCollection");
53  modulePhiBoundary_ = conf.getParameter<double>("modulePhiBoundary");
54  moduleEtaBoundary_ = conf.getParameter<std::vector<double>>("moduleEtaBoundary");
55  //
56  vetoClusteredEcalHits_ = conf.getParameter<bool>("vetoClustered");
57  useNumCrystals_ = conf.getParameter<bool>("useNumCrystals");
58 
60  int i = 0;
61  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("TrackConeOuterRadiusA_Barrel"));
62  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("TrackConeInnerRadiusA_Barrel"));
63  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("isolationtrackThresholdA_Barrel"));
64  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("longImpactParameterA_Barrel"));
65  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("transImpactParameterA_Barrel"));
66  trkIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("isolationtrackEtaSliceA_Barrel"));
67 
68  i = 0;
69  ecalIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitInnerRadiusA_Barrel"));
70  ecalIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitOuterRadiusA_Barrel"));
71  ecalIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitEtaSliceA_Barrel"));
72  ecalIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitThreshEA_Barrel"));
73  ecalIsoBarrelRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitThreshEtA_Barrel"));
74 
75  hcalIsoInnerRadAEB_ = conf.getParameter<std::array<double, 7>>("HcalRecHitInnerRadiusA_Barrel");
76  hcalIsoOuterRadAEB_ = conf.getParameter<std::array<double, 7>>("HcalRecHitOuterRadiusA_Barrel");
77 
78  i = 0;
79  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("TrackConeOuterRadiusB_Barrel"));
80  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("TrackConeInnerRadiusB_Barrel"));
81  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("isolationtrackThresholdB_Barrel"));
82  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("longImpactParameterB_Barrel"));
83  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("transImpactParameterB_Barrel"));
84  trkIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("isolationtrackEtaSliceB_Barrel"));
85 
86  i = 0;
87  ecalIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitInnerRadiusB_Barrel"));
88  ecalIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitOuterRadiusB_Barrel"));
89  ecalIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitEtaSliceB_Barrel"));
90  ecalIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitThreshEB_Barrel"));
91  ecalIsoBarrelRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitThreshEtB_Barrel"));
92 
93  hcalIsoInnerRadBEB_ = conf.getParameter<std::array<double, 7>>("HcalRecHitInnerRadiusB_Barrel");
94  hcalIsoOuterRadBEB_ = conf.getParameter<std::array<double, 7>>("HcalRecHitOuterRadiusB_Barrel");
95 
97  i = 0;
98  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("TrackConeOuterRadiusA_Endcap"));
99  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("TrackConeInnerRadiusA_Endcap"));
100  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("isolationtrackThresholdA_Endcap"));
101  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("longImpactParameterA_Endcap"));
102  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("transImpactParameterA_Endcap"));
103  trkIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("isolationtrackEtaSliceA_Endcap"));
104 
105  i = 0;
106  ecalIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitInnerRadiusA_Endcap"));
107  ecalIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitOuterRadiusA_Endcap"));
108  ecalIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitEtaSliceA_Endcap"));
109  ecalIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitThreshEA_Endcap"));
110  ecalIsoEndcapRadiusA_[i++] = (conf.getParameter<double>("EcalRecHitThreshEtA_Endcap"));
111 
112  hcalIsoInnerRadAEE_ = conf.getParameter<std::array<double, 7>>("HcalRecHitInnerRadiusA_Endcap");
113  hcalIsoOuterRadAEE_ = conf.getParameter<std::array<double, 7>>("HcalRecHitOuterRadiusA_Endcap");
114 
115  i = 0;
116  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("TrackConeOuterRadiusB_Endcap"));
117  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("TrackConeInnerRadiusB_Endcap"));
118  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("isolationtrackThresholdB_Endcap"));
119  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("longImpactParameterB_Endcap"));
120  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("transImpactParameterB_Endcap"));
121  trkIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("isolationtrackEtaSliceB_Endcap"));
122 
123  i = 0;
124  ecalIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitInnerRadiusB_Endcap"));
125  ecalIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitOuterRadiusB_Endcap"));
126  ecalIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitEtaSliceB_Endcap"));
127  ecalIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitThreshEB_Endcap"));
128  ecalIsoEndcapRadiusB_[i++] = (conf.getParameter<double>("EcalRecHitThreshEtB_Endcap"));
129 
130  hcalIsoInnerRadBEE_ = conf.getParameter<std::array<double, 7>>("HcalRecHitInnerRadiusB_Endcap");
131  hcalIsoOuterRadBEE_ = conf.getParameter<std::array<double, 7>>("HcalRecHitOuterRadiusB_Endcap");
132 
133  //Pick up the variables for the spike removal
134  flagsEB_ = flagsEB;
135  flagsEE_ = flagsEE;
136  severityExclEB_ = severitiesEB;
137  severityExclEE_ = severitiesEE;
138 
139  hcalIsoEThresHB_ = conf.getParameter<EgammaHcalIsolation::arrayHB>("recHitEThresholdHB");
140  hcalIsoEThresHE_ = conf.getParameter<EgammaHcalIsolation::arrayHE>("recHitEThresholdHE");
141  maxHcalSeverity_ = conf.getParameter<int>("maxHcalRecHitSeverity");
142 }
143 
145  const edm::Event& e,
146  const edm::EventSetup& es,
149  reco::Photon::IsolationVariables& phoisolR2) const {
150  //Get fiducial flags. This does not really belong here
151  bool isEBPho = false;
152  bool isEEPho = false;
153  bool isEBEtaGap = false;
154  bool isEBPhiGap = false;
155  bool isEERingGap = false;
156  bool isEEDeeGap = false;
157  bool isEBEEGap = false;
158  classify(pho, isEBPho, isEEPho, isEBEtaGap, isEBPhiGap, isEERingGap, isEEDeeGap, isEBEEGap);
159  phofid.isEB = isEBPho;
160  phofid.isEE = isEEPho;
161  phofid.isEBEtaGap = isEBEtaGap;
162  phofid.isEBPhiGap = isEBPhiGap;
163  phofid.isEERingGap = isEERingGap;
164  phofid.isEEDeeGap = isEEDeeGap;
165  phofid.isEBEEGap = isEBEEGap;
166 
167  auto const& caloGeometry = es.getData(caloGeometryToken_);
168  auto const& hcalTopology = &es.getData(hcalTopologyToken_);
169  auto const& hcalChannelQuality = &es.getData(hcalChannelQualityToken_);
170  auto const& hcalSevLvlComputer = &es.getData(hcalSevLvlComputerToken_);
171  auto const& towerMap = es.getData(towerMapToken_);
172 
173  // Calculate isolation variables. cone sizes and thresholds
174  // are set for Barrel and endcap separately
175 
176  reco::SuperClusterRef scRef = pho->superCluster();
177  const reco::BasicCluster& seedCluster = *(scRef->seed());
178  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
179  int detector = seedXtalId.subdetId();
180 
181  //Isolation parameters variables
182  double photonEcalRecHitConeInnerRadiusA_;
183  double photonEcalRecHitConeOuterRadiusA_;
184  double photonEcalRecHitEtaSliceA_;
185  double photonEcalRecHitThreshEA_;
186  double photonEcalRecHitThreshEtA_;
187  double trackConeOuterRadiusA_;
188  double trackConeInnerRadiusA_;
189  double isolationtrackThresholdA_;
190  double isolationtrackEtaSliceA_;
191  double trackLipRadiusA_;
192  double trackD0RadiusA_;
193  double photonEcalRecHitConeInnerRadiusB_;
194  double photonEcalRecHitConeOuterRadiusB_;
195  double photonEcalRecHitEtaSliceB_;
196  double photonEcalRecHitThreshEB_;
197  double photonEcalRecHitThreshEtB_;
198  double trackConeOuterRadiusB_;
199  double trackConeInnerRadiusB_;
200  double isolationtrackThresholdB_;
201  double isolationtrackEtaSliceB_;
202  double trackLipRadiusB_;
203  double trackD0RadiusB_;
204 
205  if (detector == EcalBarrel) {
206  trackConeOuterRadiusA_ = trkIsoBarrelRadiusA_[0];
207  trackConeInnerRadiusA_ = trkIsoBarrelRadiusA_[1];
208  isolationtrackThresholdA_ = trkIsoBarrelRadiusA_[2];
209  trackLipRadiusA_ = trkIsoBarrelRadiusA_[3];
210  trackD0RadiusA_ = trkIsoBarrelRadiusA_[4];
211  isolationtrackEtaSliceA_ = trkIsoBarrelRadiusA_[5];
212 
213  photonEcalRecHitConeInnerRadiusA_ = ecalIsoBarrelRadiusA_[0];
214  photonEcalRecHitConeOuterRadiusA_ = ecalIsoBarrelRadiusA_[1];
215  photonEcalRecHitEtaSliceA_ = ecalIsoBarrelRadiusA_[2];
216  photonEcalRecHitThreshEA_ = ecalIsoBarrelRadiusA_[3];
217  photonEcalRecHitThreshEtA_ = ecalIsoBarrelRadiusA_[4];
218 
219  trackConeOuterRadiusB_ = trkIsoBarrelRadiusB_[0];
220  trackConeInnerRadiusB_ = trkIsoBarrelRadiusB_[1];
221  isolationtrackThresholdB_ = trkIsoBarrelRadiusB_[2];
222  trackLipRadiusB_ = trkIsoBarrelRadiusB_[3];
223  trackD0RadiusB_ = trkIsoBarrelRadiusB_[4];
224  isolationtrackEtaSliceB_ = trkIsoBarrelRadiusB_[5];
225 
226  photonEcalRecHitConeInnerRadiusB_ = ecalIsoBarrelRadiusB_[0];
227  photonEcalRecHitConeOuterRadiusB_ = ecalIsoBarrelRadiusB_[1];
228  photonEcalRecHitEtaSliceB_ = ecalIsoBarrelRadiusB_[2];
229  photonEcalRecHitThreshEB_ = ecalIsoBarrelRadiusB_[3];
230  photonEcalRecHitThreshEtB_ = ecalIsoBarrelRadiusB_[4];
231  } else {
232  // detector==EcalEndcap
233 
234  trackConeOuterRadiusA_ = trkIsoEndcapRadiusA_[0];
235  trackConeInnerRadiusA_ = trkIsoEndcapRadiusA_[1];
236  isolationtrackThresholdA_ = trkIsoEndcapRadiusA_[2];
237  trackLipRadiusA_ = trkIsoEndcapRadiusA_[3];
238  trackD0RadiusA_ = trkIsoEndcapRadiusA_[4];
239  isolationtrackEtaSliceA_ = trkIsoEndcapRadiusA_[5];
240 
241  photonEcalRecHitConeInnerRadiusA_ = ecalIsoEndcapRadiusA_[0];
242  photonEcalRecHitConeOuterRadiusA_ = ecalIsoEndcapRadiusA_[1];
243  photonEcalRecHitEtaSliceA_ = ecalIsoEndcapRadiusA_[2];
244  photonEcalRecHitThreshEA_ = ecalIsoEndcapRadiusA_[3];
245  photonEcalRecHitThreshEtA_ = ecalIsoEndcapRadiusA_[4];
246 
247  trackConeOuterRadiusB_ = trkIsoEndcapRadiusB_[0];
248  trackConeInnerRadiusB_ = trkIsoEndcapRadiusB_[1];
249  isolationtrackThresholdB_ = trkIsoEndcapRadiusB_[2];
250  trackLipRadiusB_ = trkIsoEndcapRadiusB_[3];
251  trackD0RadiusB_ = trkIsoEndcapRadiusB_[4];
252  isolationtrackEtaSliceB_ = trkIsoEndcapRadiusB_[5];
253 
254  photonEcalRecHitConeInnerRadiusB_ = ecalIsoEndcapRadiusB_[0];
255  photonEcalRecHitConeOuterRadiusB_ = ecalIsoEndcapRadiusB_[1];
256  photonEcalRecHitEtaSliceB_ = ecalIsoEndcapRadiusB_[2];
257  photonEcalRecHitThreshEB_ = ecalIsoEndcapRadiusB_[3];
258  photonEcalRecHitThreshEtB_ = ecalIsoEndcapRadiusB_[4];
259  }
260 
261  //Calculate hollow cone track isolation, CONE A
262  int ntrkA = 0;
263  double trkisoA = 0;
264  calculateTrackIso(pho,
265  e,
266  trkisoA,
267  ntrkA,
268  isolationtrackThresholdA_,
269  trackConeOuterRadiusA_,
270  trackConeInnerRadiusA_,
271  isolationtrackEtaSliceA_,
272  trackLipRadiusA_,
273  trackD0RadiusA_);
274 
275  //Calculate solid cone track isolation, CONE A
276  int sntrkA = 0;
277  double strkisoA = 0;
278  calculateTrackIso(pho,
279  e,
280  strkisoA,
281  sntrkA,
282  isolationtrackThresholdA_,
283  trackConeOuterRadiusA_,
284  0.,
285  isolationtrackEtaSliceA_,
286  trackLipRadiusA_,
287  trackD0RadiusA_);
288 
289  phoisolR1.nTrkHollowCone = ntrkA;
290  phoisolR1.trkSumPtHollowCone = trkisoA;
291  phoisolR1.nTrkSolidCone = sntrkA;
292  phoisolR1.trkSumPtSolidCone = strkisoA;
293 
294  //Calculate hollow cone track isolation, CONE B
295  int ntrkB = 0;
296  double trkisoB = 0;
297  calculateTrackIso(pho,
298  e,
299  trkisoB,
300  ntrkB,
301  isolationtrackThresholdB_,
302  trackConeOuterRadiusB_,
303  trackConeInnerRadiusB_,
304  isolationtrackEtaSliceB_,
305  trackLipRadiusB_,
306  trackD0RadiusB_);
307 
308  //Calculate solid cone track isolation, CONE B
309  int sntrkB = 0;
310  double strkisoB = 0;
311  calculateTrackIso(pho,
312  e,
313  strkisoB,
314  sntrkB,
315  isolationtrackThresholdB_,
316  trackConeOuterRadiusB_,
317  0.,
318  isolationtrackEtaSliceB_,
319  trackLipRadiusB_,
320  trackD0RadiusB_);
321 
322  phoisolR2.nTrkHollowCone = ntrkB;
323  phoisolR2.trkSumPtHollowCone = trkisoB;
324  phoisolR2.nTrkSolidCone = sntrkB;
325  phoisolR2.trkSumPtSolidCone = strkisoB;
326 
327  // std::cout << "Output from solid cone track isolation: ";
328  // std::cout << " Sum pT: " << strkiso << " ntrk: " << sntrk << std::endl;
329 
330  double EcalRecHitIsoA = calculateEcalRecHitIso(pho,
331  e,
332  es,
333  photonEcalRecHitConeOuterRadiusA_,
334  photonEcalRecHitConeInnerRadiusA_,
335  photonEcalRecHitEtaSliceA_,
336  photonEcalRecHitThreshEA_,
337  photonEcalRecHitThreshEtA_,
340  phoisolR1.ecalRecHitSumEt = EcalRecHitIsoA;
341 
342  double EcalRecHitIsoB = calculateEcalRecHitIso(pho,
343  e,
344  es,
345  photonEcalRecHitConeOuterRadiusB_,
346  photonEcalRecHitConeInnerRadiusB_,
347  photonEcalRecHitEtaSliceB_,
348  photonEcalRecHitThreshEB_,
349  photonEcalRecHitThreshEtB_,
352  phoisolR2.ecalRecHitSumEt = EcalRecHitIsoB;
353 
354  if (not hbheRecHitsTag_.isUninitialized()) {
355  auto const& hbheRecHits = e.get(hbheRecHitsTag_);
356 
357  auto fcone = [this,
358  pho,
359  &caloGeometry,
360  &hcalTopo = *hcalTopology,
361  &hcalQual = *hcalChannelQuality,
362  &hcalSev = *hcalSevLvlComputer,
363  &towerMap,
364  &hbheRecHits](double outer, double inner, int depth) {
365  return calculateHcalRecHitIso<false>(
366  pho, caloGeometry, hcalTopo, hcalQual, hcalSev, towerMap, hbheRecHits, outer, inner, depth);
367  };
368 
369  auto fbc = [this,
370  pho,
371  &caloGeometry,
372  &hcalTopo = *hcalTopology,
373  &hcalQual = *hcalChannelQuality,
374  &hcalSev = *hcalSevLvlComputer,
375  &towerMap,
376  &hbheRecHits](double outer, int depth) {
377  return calculateHcalRecHitIso<true>(
378  pho, caloGeometry, hcalTopo, hcalQual, hcalSev, towerMap, hbheRecHits, outer, 0., depth);
379  };
380 
381  for (size_t id = 0; id < phoisolR1.hcalRecHitSumEt.size(); ++id) {
382  const auto& outerA = detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id];
383  const auto& outerB = detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id];
384  const auto& innerA = detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id];
385  const auto& innerB = detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id];
386 
387  phoisolR1.hcalRecHitSumEt[id] = fcone(outerA, innerA, id + 1);
388  phoisolR2.hcalRecHitSumEt[id] = fcone(outerB, innerB, id + 1);
389 
390  phoisolR1.hcalRecHitSumEtBc[id] = fbc(outerA, id + 1);
391  phoisolR2.hcalRecHitSumEtBc[id] = fbc(outerB, id + 1);
392  }
393  }
394 
395  phoisolR1.pre7DepthHcal = false;
396  phoisolR2.pre7DepthHcal = false;
397 }
398 
400  bool& isEBPho,
401  bool& isEEPho,
402  bool& isEBEtaGap,
403  bool& isEBPhiGap,
404  bool& isEERingGap,
405  bool& isEEDeeGap,
406  bool& isEBEEGap) {
407  const reco::CaloCluster& seedCluster = *(photon->superCluster()->seed());
408  // following line is temporary until the D. Evans or F. Ferri submit the new tag for ClusterAlgos
409  // DEfinitive will be
410  // DetId seedXtalId = scRef->seed()->seed();
411  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
412  int detector = seedXtalId.subdetId();
413 
414  //Set fiducial flags for this photon.
415  double eta = photon->superCluster()->position().eta();
416  double feta = fabs(eta);
417 
418  if (detector == EcalBarrel) {
419  isEBPho = true;
420  if (EBDetId::isNextToEtaBoundary(EBDetId(seedXtalId))) {
421  if (fabs(feta - 1.479) < .1)
422  isEBEEGap = true;
423  else
424  isEBEtaGap = true;
425  }
426 
427  if (EBDetId::isNextToPhiBoundary(EBDetId(seedXtalId)))
428  isEBPhiGap = true;
429 
430  } else if (detector == EcalEndcap) {
431  isEEPho = true;
432  if (EEDetId::isNextToRingBoundary(EEDetId(seedXtalId))) {
433  if (fabs(feta - 1.479) < .1)
434  isEBEEGap = true;
435  else
436  isEERingGap = true;
437  }
438 
439  if (EEDetId::isNextToDBoundary(EEDetId(seedXtalId)))
440  isEEDeeGap = true;
441  }
442 }
443 
445  const edm::Event& e,
446  double& trkCone,
447  int& ntrkCone,
448  double pTThresh,
449  double RCone,
450  double RinnerCone,
451  double etaSlice,
452  double lip,
453  double d0) const {
454  ntrkCone = 0;
455  trkCone = 0;
456  //get the tracks
458  e.getByToken(trackInputTag_, tracks);
459  if (!tracks.isValid()) {
460  return;
461  }
462  const reco::TrackCollection* trackCollection = tracks.product();
463  //Photon Eta and Phi. Hope these are correct.
464  reco::BeamSpot vertexBeamSpot;
465  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
466  e.getByToken(beamSpotProducerTag_, recoBeamSpotHandle);
467  vertexBeamSpot = *recoBeamSpotHandle;
468 
469  PhotonTkIsolation phoIso(RCone,
470  RinnerCone,
471  etaSlice,
472  pTThresh,
473  lip,
474  d0,
476  math::XYZPoint(vertexBeamSpot.x0(), vertexBeamSpot.y0(), vertexBeamSpot.z0()));
477 
478  std::pair<int, double> res = phoIso.getIso(photon);
479  ntrkCone = res.first;
480  trkCone = res.second;
481 }
482 
484  const edm::Event& iEvent,
485  const edm::EventSetup& iSetup,
486  double RCone,
487  double RConeInner,
488  double etaSlice,
489  double eMin,
490  double etMin,
491  bool vetoClusteredHits,
492  bool useNumXtals) const {
493  edm::Handle<EcalRecHitCollection> ecalhitsCollEB;
494  edm::Handle<EcalRecHitCollection> ecalhitsCollEE;
495  iEvent.getByToken(endcapecalCollection_, ecalhitsCollEE);
496 
497  iEvent.getByToken(barrelecalCollection_, ecalhitsCollEB);
498 
499  const EcalRecHitCollection* rechitsCollectionEE_ = ecalhitsCollEE.product();
500  const EcalRecHitCollection* rechitsCollectionEB_ = ecalhitsCollEB.product();
501 
503  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
504  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
505 
506  edm::ESHandle<CaloGeometry> geoHandle;
507  iSetup.get<CaloGeometryRecord>().get(geoHandle);
508 
509  EgammaRecHitIsolation phoIsoEB(
510  RCone, RConeInner, etaSlice, etMin, eMin, geoHandle, *rechitsCollectionEB_, sevLevel, DetId::Ecal);
511 
512  phoIsoEB.setVetoClustered(vetoClusteredHits);
513  phoIsoEB.setUseNumCrystals(useNumXtals);
514  phoIsoEB.doSeverityChecks(ecalhitsCollEB.product(), severityExclEB_);
515  phoIsoEB.doFlagChecks(flagsEB_);
516  double ecalIsolEB = phoIsoEB.getEtSum(photon);
517 
518  EgammaRecHitIsolation phoIsoEE(
519  RCone, RConeInner, etaSlice, etMin, eMin, geoHandle, *rechitsCollectionEE_, sevLevel, DetId::Ecal);
520 
521  phoIsoEE.setVetoClustered(vetoClusteredHits);
522  phoIsoEE.setUseNumCrystals(useNumXtals);
523  phoIsoEE.doSeverityChecks(ecalhitsCollEE.product(), severityExclEE_);
524  phoIsoEE.doFlagChecks(flagsEE_);
525 
526  double ecalIsolEE = phoIsoEE.getEtSum(photon);
527  // delete phoIso;
528  double ecalIsol = ecalIsolEB + ecalIsolEE;
529 
530  return ecalIsol;
531 }
532 
533 template <bool isoBC>
535  const CaloGeometry& geometry,
536  const HcalTopology& hcalTopology,
537  const HcalChannelQuality& hcalChStatus,
538  const HcalSeverityLevelComputer& hcalSevLvlComputer,
539  const CaloTowerConstituentsMap& towerMap,
541  double RCone,
542  double RConeInner,
543  int depth) const {
544  const EgammaHcalIsolation::arrayHB e04{{0., 0., 0., 0.}};
545  const EgammaHcalIsolation::arrayHE e07{{0., 0., 0., 0., 0., 0., 0.}};
546 
547  if constexpr (isoBC) {
549  RCone,
551  RConeInner,
553  e04,
556  e07,
558  hbheRecHits,
559  geometry,
560  hcalTopology,
561  hcalChStatus,
562  hcalSevLvlComputer,
563  towerMap);
564 
565  return hcaliso.getHcalEtSumBc(photon, depth);
566  } else {
568  RCone,
570  RConeInner,
572  e04,
575  e07,
577  hbheRecHits,
578  geometry,
579  hcalTopology,
580  hcalChStatus,
581  hcalSevLvlComputer,
582  towerMap);
583 
584  return hcaliso.getHcalEtSum(photon, depth);
585  }
586 }
PhotonIsolationCalculator::vetoClusteredEcalHits_
bool vetoClusteredEcalHits_
Definition: PhotonIsolationCalculator.h:107
PhotonIsolationCalculator.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PhotonTkIsolation
Definition: PhotonTkIsolation.h:20
EcalSeverityLevelAlgo
Definition: EcalSeverityLevelAlgo.h:33
PhotonIsolationCalculator::flagsEB_
std::vector< int > flagsEB_
Definition: PhotonIsolationCalculator.h:136
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
EBDetId::isNextToEtaBoundary
static bool isNextToEtaBoundary(EBDetId id)
Definition: EBDetId.cc:108
PhotonIsolationCalculator::setup
void setup(const edm::ParameterSet &conf, std::vector< int > const &flagsEB_, std::vector< int > const &flagsEE_, std::vector< int > const &severitiesEB_, std::vector< int > const &severitiesEE_, edm::ConsumesCollector &&iC)
Definition: PhotonIsolationCalculator.cc:29
photonAnalyzer_cfi.etMin
etMin
Definition: photonAnalyzer_cfi.py:54
PhotonIsolationCalculator::trkIsoEndcapRadiusA_
std::array< double, 6 > trkIsoEndcapRadiusA_
Definition: PhotonIsolationCalculator.h:115
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
reco::Photon::IsolationVariables::pre7DepthHcal
bool pre7DepthHcal
Definition: Photon.h:418
reco::Photon::superCluster
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
EgammaEcalIsolation.h
PhotonIsolationCalculator::ecalIsoEndcapRadiusB_
std::array< double, 5 > ecalIsoEndcapRadiusB_
Definition: PhotonIsolationCalculator.h:118
edm::Handle::product
T const * product() const
Definition: Handle.h:70
PhotonIsolationCalculator::hbheRecHitsTag_
edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag_
Definition: PhotonIsolationCalculator.h:95
EgammaHcalIsolation::InclusionRule::withinConeAroundCluster
EcalSeverityLevelAlgoRcd.h
reco::BeamSpot::z0
double z0() const
z coordinate
Definition: BeamSpot.h:65
reco::Photon::FiducialFlags::isEE
bool isEE
Definition: Photon.h:97
BasicCluster.h
EgammaHcalIsolation::arrayHB
std::array< double, 4 > arrayHB
Definition: EgammaHcalIsolation.h:41
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
reco::Photon::IsolationVariables::hcalRecHitSumEtBc
std::array< float, 7 > hcalRecHitSumEtBc
Definition: Photon.h:417
EBDetId
Definition: EBDetId.h:17
PhotonIsolationCalculator::caloGeometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: PhotonIsolationCalculator.h:97
geometry
Definition: geometry.py:1
HcalTopology
Definition: HcalTopology.h:26
EBDetId.h
EEDetId.h
reco::Photon::IsolationVariables::ecalRecHitSumEt
float ecalRecHitSumEt
Definition: Photon.h:403
EgammaRecHitIsolation::setUseNumCrystals
void setUseNumCrystals(bool b=true)
Definition: EgammaRecHitIsolation.h:45
reco::Photon::IsolationVariables::hcalRecHitSumEt
std::array< float, 7 > hcalRecHitSumEt
Definition: Photon.h:416
edm::SortedCollection< EcalRecHit >
PhotonIsolationCalculator::hcalIsoInnerRadBEB_
std::array< double, 7 > hcalIsoInnerRadBEB_
Definition: PhotonIsolationCalculator.h:123
PhotonIsolationCalculator::flagsEE_
std::vector< int > flagsEE_
Definition: PhotonIsolationCalculator.h:137
HcalChannelQuality
Definition: HcalChannelQuality.h:17
EgammaRecHitIsolation::setVetoClustered
void setVetoClustered(bool b=true)
Definition: EgammaRecHitIsolation.h:46
EgammaRecHitIsolation
Definition: EgammaRecHitIsolation.h:26
PhotonIsolationCalculator::ecalIsoBarrelRadiusA_
std::array< double, 5 > ecalIsoBarrelRadiusA_
Definition: PhotonIsolationCalculator.h:111
edm::Handle< reco::TrackCollection >
PhotonIsolationCalculator::hcalSevLvlComputerToken_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > hcalSevLvlComputerToken_
Definition: PhotonIsolationCalculator.h:100
PhotonIsolationCalculator::moduleEtaBoundary_
std::vector< double > moduleEtaBoundary_
Definition: PhotonIsolationCalculator.h:106
EcalBarrel
Definition: EcalSubdetector.h:10
EcalRecHitCollections.h
BasicClusterFwd.h
PhotonIsolationCalculator::hcalIsoOuterRadAEE_
std::array< double, 7 > hcalIsoOuterRadAEE_
Definition: PhotonIsolationCalculator.h:127
edm::Ref< SuperClusterCollection >
qcdUeDQM_cfi.lip
lip
Definition: qcdUeDQM_cfi.py:25
PhotonIsolationCalculator::trkIsoEndcapRadiusB_
std::array< double, 6 > trkIsoEndcapRadiusB_
Definition: PhotonIsolationCalculator.h:117
PhotonIsolationCalculator::towerMapToken_
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
Definition: PhotonIsolationCalculator.h:101
DetId
Definition: DetId.h:17
PhotonIsolationCalculator::beamSpotProducerTag_
edm::EDGetToken beamSpotProducerTag_
Definition: PhotonIsolationCalculator.h:104
EgammaHcalIsolation
Definition: EgammaHcalIsolation.h:38
CaloGeometry
Definition: CaloGeometry.h:21
EgammaRecHitIsolation::getEtSum
double getEtSum(const reco::Candidate *emObject) const
Definition: EgammaRecHitIsolation.h:39
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
TrackFwd.h
BeamSpot.h
reco::Photon::FiducialFlags::isEBEEGap
bool isEBEEGap
Definition: Photon.h:102
reco::Photon::FiducialFlags::isEB
bool isEB
Definition: Photon.h:96
PhotonTkIsolation::getIso
std::pair< int, float > getIso(const reco::Candidate *) const
Definition: PhotonTkIsolation.cc:52
PhotonIsolationCalculator::trkIsoBarrelRadiusB_
std::array< double, 6 > trkIsoBarrelRadiusB_
Definition: PhotonIsolationCalculator.h:112
PVValHelper::eta
Definition: PVValidationHelpers.h:70
SurfaceOrientation::inner
Definition: Surface.h:19
reco::Photon::FiducialFlags::isEEDeeGap
bool isEEDeeGap
Definition: Photon.h:101
reco::CaloCluster
Definition: CaloCluster.h:31
PhotonIsolationCalculator::hcalIsoInnerRadAEB_
std::array< double, 7 > hcalIsoInnerRadAEB_
Definition: PhotonIsolationCalculator.h:120
photonAnalyzer_cfi.eMin
eMin
Definition: photonAnalyzer_cfi.py:50
HcalSeverityLevelComputer
Definition: HcalSeverityLevelComputer.h:24
reco::BeamSpot
Definition: BeamSpot.h:21
CaloTowerConstituentsMap
Definition: CaloTowerConstituentsMap.h:18
edm::ESHandle< EcalSeverityLevelAlgo >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
PhotonIsolationCalculator::trkIsoBarrelRadiusA_
std::array< double, 6 > trkIsoBarrelRadiusA_
Definition: PhotonIsolationCalculator.h:110
EcalRecHit.h
reco::Photon::FiducialFlags::isEERingGap
bool isEERingGap
Definition: Photon.h:100
PhotonIsolationCalculator::hcalIsoInnerRadBEE_
std::array< double, 7 > hcalIsoInnerRadBEE_
Definition: PhotonIsolationCalculator.h:129
EgammaRecHitIsolation::doSeverityChecks
void doSeverityChecks(const EcalRecHitCollection *const recHits, const std::vector< int > &v)
Definition: EgammaRecHitIsolation.h:47
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
PhotonIsolationCalculator::hcalIsoEThresHE_
EgammaHcalIsolation::arrayHE hcalIsoEThresHE_
Definition: PhotonIsolationCalculator.h:133
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
reco::Photon::IsolationVariables::trkSumPtSolidCone
float trkSumPtSolidCone
Definition: Photon.h:420
CaloGeometryRecord.h
fbc
cc *****************************************************cc the common blocks pinput and cwdidth are for input parameters cc these parameters needed to be interfaced to other program common pinput fbc
Definition: inclcon.h:4
EcalEndcap
Definition: EcalSubdetector.h:10
JetMETHLTOfflineSource_cfi.feta
feta
Definition: JetMETHLTOfflineSource_cfi.py:30
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
EgammaHcalIsolation::InclusionRule::isBehindClusterSeed
reco::Photon::IsolationVariables::nTrkSolidCone
int nTrkSolidCone
Definition: Photon.h:424
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
EEDetId::isNextToRingBoundary
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
PhotonIsolationCalculator::trackInputTag_
edm::EDGetToken trackInputTag_
Definition: PhotonIsolationCalculator.h:103
PhotonIsolationCalculator::hcalIsoOuterRadAEB_
std::array< double, 7 > hcalIsoOuterRadAEB_
Definition: PhotonIsolationCalculator.h:121
reco::Photon::FiducialFlags::isEBPhiGap
bool isEBPhiGap
Definition: Photon.h:99
PhotonIsolationCalculator::calculateEcalRecHitIso
double calculateEcalRecHitIso(const reco::Photon *photon, const edm::Event &iEvent, const edm::EventSetup &iSetup, double RCone, double RConeInner, double etaSlice, double eMin, double etMin, bool vetoClusteredHits, bool useNumCrystals) const
Definition: PhotonIsolationCalculator.cc:483
reco::Photon::FiducialFlags
Definition: Photon.h:94
iEvent
int iEvent
Definition: GenABIO.cc:224
PhotonIsolationCalculator::severityExclEE_
std::vector< int > severityExclEE_
Definition: PhotonIsolationCalculator.h:139
PhotonIsolationCalculator::classify
static void classify(const reco::Photon *photon, bool &isEBPho, bool &isEEPho, bool &isEBEtaGap, bool &isEBPhiGap, bool &isEERingGap, bool &isEEDeeGap, bool &isEBEEGap)
Definition: PhotonIsolationCalculator.cc:399
PhotonIsolationCalculator::calculateTrackIso
void calculateTrackIso(const reco::Photon *photon, const edm::Event &e, double &trkCone, int &ntrkCone, double pTThresh=0, double RCone=.4, double RinnerCone=.1, double etaSlice=0.015, double lip=0.2, double d0=0.1) const
Definition: PhotonIsolationCalculator.cc:444
edm::EventSetup
Definition: EventSetup.h:58
PhotonIsolationCalculator::calculateHcalRecHitIso
double calculateHcalRecHitIso(const reco::Photon *photon, const CaloGeometry &geometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap, const HBHERecHitCollection &hbheRecHits, double RCone, double RConeInner, int depth) const
Definition: PhotonIsolationCalculator.cc:534
EgammaRecHitIsolation::doFlagChecks
void doFlagChecks(const std::vector< int > &v)
Definition: EgammaRecHitIsolation.h:54
DetId::Ecal
Definition: DetId.h:27
get
#define get
res
Definition: Electron.h:6
reco::Photon::IsolationVariables
Definition: Photon.h:399
PhotonIsolationCalculator::ecalIsoBarrelRadiusB_
std::array< double, 5 > ecalIsoBarrelRadiusB_
Definition: PhotonIsolationCalculator.h:113
reco::Photon::IsolationVariables::trkSumPtHollowCone
float trkSumPtHollowCone
Definition: Photon.h:422
PhotonIsolationCalculator::hcalTopologyToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalTopologyToken_
Definition: PhotonIsolationCalculator.h:98
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
reco::Photon::FiducialFlags::isEBEtaGap
bool isEBEtaGap
Definition: Photon.h:98
PhotonIsolationCalculator::hcalIsoOuterRadBEB_
std::array< double, 7 > hcalIsoOuterRadBEB_
Definition: PhotonIsolationCalculator.h:124
EBDetId::isNextToPhiBoundary
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:113
PhotonTkIsolation.h
reco::Photon
Definition: Photon.h:22
PhotonIsolationCalculator::endcapecalCollection_
edm::EDGetToken endcapecalCollection_
Definition: PhotonIsolationCalculator.h:94
reco::BeamSpot::x0
double x0() const
x coordinate
Definition: BeamSpot.h:61
PhotonIsolationCalculator::hcalIsoOuterRadBEE_
std::array< double, 7 > hcalIsoOuterRadBEE_
Definition: PhotonIsolationCalculator.h:130
PhotonIsolationCalculator::hcalIsoInnerRadAEE_
std::array< double, 7 > hcalIsoInnerRadAEE_
Definition: PhotonIsolationCalculator.h:126
reco::Photon::IsolationVariables::nTrkHollowCone
int nTrkHollowCone
Definition: Photon.h:426
DetId.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EEDetId::isNextToDBoundary
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:279
EgammaRecHitIsolation.h
SuperCluster.h
CaloGeometry.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PhotonIsolationCalculator::hcalIsoEThresHB_
EgammaHcalIsolation::arrayHB hcalIsoEThresHB_
Definition: PhotonIsolationCalculator.h:132
PhotonIsolationCalculator::modulePhiBoundary_
double modulePhiBoundary_
Definition: PhotonIsolationCalculator.h:105
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
PhotonIsolationCalculator::calculate
void calculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::FiducialFlags &phofid, reco::Photon::IsolationVariables &phoisolR03, reco::Photon::IsolationVariables &phoisolR04) const
Definition: PhotonIsolationCalculator.cc:144
PhotonIsolationCalculator::severityExclEB_
std::vector< int > severityExclEB_
Definition: PhotonIsolationCalculator.h:138
SurfaceOrientation::outer
Definition: Surface.h:19
PhotonIsolationCalculator::ecalIsoEndcapRadiusA_
std::array< double, 5 > ecalIsoEndcapRadiusA_
Definition: PhotonIsolationCalculator.h:116
reco::BeamSpot::y0
double y0() const
y coordinate
Definition: BeamSpot.h:63
edm::Event
Definition: Event.h:73
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
EgammaHcalIsolation::arrayHE
std::array< double, 7 > arrayHE
Definition: EgammaHcalIsolation.h:42
PhotonIsolationCalculator::hcalChannelQualityToken_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
Definition: PhotonIsolationCalculator.h:99
ecalDrivenElectronSeeds_cfi.hbheRecHits
hbheRecHits
Definition: ecalDrivenElectronSeeds_cfi.py:7
PhotonIsolationCalculator::useNumCrystals_
bool useNumCrystals_
Definition: PhotonIsolationCalculator.h:108
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
PhotonIsolationCalculator::maxHcalSeverity_
int maxHcalSeverity_
Definition: PhotonIsolationCalculator.h:134
PhotonIsolationCalculator::barrelecalCollection_
edm::EDGetToken barrelecalCollection_
Definition: PhotonIsolationCalculator.h:93