CMS 3D CMS Logo

PhotonProducer.cc
Go to the documentation of this file.
1 
44 
45 #include <vector>
46 
47 // PhotonProducer inherits from EDProducer, so it can be a module:
49 public:
51 
52  void produce(edm::Event& evt, const edm::EventSetup& es) override;
53 
54 private:
56  edm::EventSetup const& es,
57  const edm::Handle<reco::PhotonCoreCollection>& photonCoreHandle,
58  const CaloTopology* topology,
59  const HcalPFCuts* hcalCuts,
60  const EcalRecHitCollection* ecalBarrelHits,
61  const EcalRecHitCollection* ecalEndcapHits,
62  ElectronHcalHelper const& hcalHelperCone,
63  ElectronHcalHelper const& hcalHelperBc,
64  reco::VertexCollection& pvVertices,
65  reco::PhotonCollection& outputCollection,
66  int& iSC);
67 
68  // std::string PhotonCoreCollection_;
77 
78  //AA
79  //Flags and severities to be excluded from calculations
80 
81  std::vector<int> flagsexclEB_;
82  std::vector<int> flagsexclEE_;
83  std::vector<int> severitiesexclEB_;
84  std::vector<int> severitiesexclEE_;
85 
87  double highEt_;
88  double minR9Barrel_;
89  double minR9Endcap_;
92 
94 
96 
98 
101 
102  //MIP
104  //MVA based Halo tagger for the EE photons
105  std::unique_ptr<PhotonMVABasedHaloTagger> photonMVABasedHaloTagger_ = nullptr;
106 
107  std::vector<double> preselCutValuesBarrel_;
108  std::vector<double> preselCutValuesEndcap_;
109 
112 
113  // additional configuration and helpers
114  std::unique_ptr<ElectronHcalHelper> hcalHelperCone_;
115  std::unique_ptr<ElectronHcalHelper> hcalHelperBc_;
117 
120 };
121 
124 
126  : caloGeomToken_(esConsumes()), topologyToken_(esConsumes()), photonEnergyCorrector_(config, consumesCollector()) {
127  // use configuration file to setup input/output collection names
128 
129  photonCoreProducer_ = consumes<reco::PhotonCoreCollection>(config.getParameter<edm::InputTag>("photonCoreProducer"));
130  barrelEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("barrelEcalHits"));
131  endcapEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("endcapEcalHits"));
132  vertexProducer_ = consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("primaryVertexProducer"));
133  hbheRecHits_ = consumes<HBHERecHitCollection>(config.getParameter<edm::InputTag>("hbheRecHits"));
134  hOverEConeSize_ = config.getParameter<double>("hOverEConeSize");
135  highEt_ = config.getParameter<double>("highEt");
136  // R9 value to decide converted/unconverted
137  minR9Barrel_ = config.getParameter<double>("minR9Barrel");
138  minR9Endcap_ = config.getParameter<double>("minR9Endcap");
139  usePrimaryVertex_ = config.getParameter<bool>("usePrimaryVertex");
140  runMIPTagger_ = config.getParameter<bool>("runMIPTagger");
141  runMVABasedHaloTagger_ = config.getParameter<bool>("runMVABasedHaloTagger");
142 
143  candidateP4type_ = config.getParameter<std::string>("candidateP4type");
144 
145  edm::ParameterSet posCalcParameters = config.getParameter<edm::ParameterSet>("posCalcParameters");
147 
148  //Retrieve HCAL PF thresholds - from config or from DB
149  cutsFromDB_ = config.getParameter<bool>("usePFThresholdsFromDB");
150  if (cutsFromDB_) {
151  hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd>(edm::ESInputTag("", "withTopo"));
152  }
153 
154  //AA
155  //Flags and Severities to be excluded from photon calculations
156  const std::vector<std::string> flagnamesEB =
157  config.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
158 
159  const std::vector<std::string> flagnamesEE =
160  config.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
161 
162  flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
163 
164  flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
165 
166  const std::vector<std::string> severitynamesEB =
167  config.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEB");
168 
169  severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
170 
171  const std::vector<std::string> severitynamesEE =
172  config.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEE");
173 
174  severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
175 
176  ElectronHcalHelper::Configuration cfgCone, cfgBc;
178  if (cfgCone.hOverEConeSize > 0) {
179  cfgCone.onlyBehindCluster = false;
180  cfgCone.checkHcalStatus = false;
181 
182  cfgCone.hbheRecHits = hbheRecHits_;
183 
184  cfgCone.eThresHB = config.getParameter<EgammaHcalIsolation::arrayHB>("recHitEThresholdHB");
185  cfgCone.maxSeverityHB = config.getParameter<int>("maxHcalRecHitSeverity");
186  cfgCone.eThresHE = config.getParameter<EgammaHcalIsolation::arrayHE>("recHitEThresholdHE");
187  cfgCone.maxSeverityHE = cfgCone.maxSeverityHB;
188  }
189 
190  cfgBc.hOverEConeSize = 0.;
191  cfgBc.onlyBehindCluster = true;
192  cfgBc.checkHcalStatus = false;
193 
194  cfgBc.hbheRecHits = hbheRecHits_;
195 
196  cfgBc.eThresHB = config.getParameter<EgammaHcalIsolation::arrayHB>("recHitEThresholdHB");
197  cfgBc.maxSeverityHB = config.getParameter<int>("maxHcalRecHitSeverity");
198  cfgBc.eThresHE = config.getParameter<EgammaHcalIsolation::arrayHE>("recHitEThresholdHE");
199  cfgBc.maxSeverityHE = cfgBc.maxSeverityHB;
200 
201  hcalHelperCone_ = std::make_unique<ElectronHcalHelper>(cfgCone, consumesCollector());
202  hcalHelperBc_ = std::make_unique<ElectronHcalHelper>(cfgBc, consumesCollector());
203 
204  hcalRun2EffDepth_ = config.getParameter<bool>("hcalRun2EffDepth");
205 
206  //AA
207 
208  //
209 
210  // Parameters for the position calculation:
211  // std::map<std::string,double> providedParameters;
212  // providedParameters.insert(std::make_pair("LogWeighted",config.getParameter<bool>("posCalc_logweight")));
213  //providedParameters.insert(std::make_pair("T0_barl",config.getParameter<double>("posCalc_t0_barl")));
214  //providedParameters.insert(std::make_pair("T0_endc",config.getParameter<double>("posCalc_t0_endc")));
215  //providedParameters.insert(std::make_pair("T0_endcPresh",config.getParameter<double>("posCalc_t0_endcPresh")));
216  //providedParameters.insert(std::make_pair("W0",config.getParameter<double>("posCalc_w0")));
217  //providedParameters.insert(std::make_pair("X0",config.getParameter<double>("posCalc_x0")));
218  //posCalculator_ = PositionCalc(providedParameters);
219  // cut values for pre-selection
220  preselCutValuesBarrel_.push_back(config.getParameter<double>("minSCEtBarrel"));
221  preselCutValuesBarrel_.push_back(config.getParameter<double>("maxHoverEBarrel"));
222  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
223  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
224  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalRecHitSumEtOffsetBarrel"));
225  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalRecHitSumEtSlopeBarrel"));
226  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackSolidConeBarrel"));
227  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackHollowConeBarrel"));
228  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumSolidConeBarrel"));
229  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumHollowConeBarrel"));
230  preselCutValuesBarrel_.push_back(config.getParameter<double>("sigmaIetaIetaCutBarrel"));
231  //
232  preselCutValuesEndcap_.push_back(config.getParameter<double>("minSCEtEndcap"));
233  preselCutValuesEndcap_.push_back(config.getParameter<double>("maxHoverEEndcap"));
234  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
235  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
236  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalRecHitSumEtOffsetEndcap"));
237  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalRecHitSumEtSlopeEndcap"));
238  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackSolidConeEndcap"));
239  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackHollowConeEndcap"));
240  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumSolidConeEndcap"));
241  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumHollowConeEndcap"));
242  preselCutValuesEndcap_.push_back(config.getParameter<double>("sigmaIetaIetaCutEndcap"));
243  //
244 
245  edm::ParameterSet isolationSumsCalculatorSet = config.getParameter<edm::ParameterSet>("isolationSumsCalculatorSet");
248 
249  edm::ParameterSet mipVariableSet = config.getParameter<edm::ParameterSet>("mipVariableSet");
250  photonMIPHaloTagger_.setup(mipVariableSet, consumesCollector());
251 
252  // Register the product
253  produces<reco::PhotonCollection>(PhotonCollection_);
254 }
255 
256 void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEventSetup) {
257  HcalPFCuts const* hcalCuts = nullptr;
258  if (cutsFromDB_) {
259  hcalCuts = &theEventSetup.getData(hcalCutsToken_);
260  }
261  using namespace edm;
262  // nEvt_++;
263 
265  auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
266 
267  // Get the PhotonCore collection
268  bool validPhotonCoreHandle = true;
269  Handle<reco::PhotonCoreCollection> photonCoreHandle;
270  theEvent.getByToken(photonCoreProducer_, photonCoreHandle);
271  if (!photonCoreHandle.isValid()) {
272  edm::LogError("PhotonProducer") << "Error! Can't get the photonCoreProducer";
273  validPhotonCoreHandle = false;
274  }
275 
276  // Get EcalRecHits
277  bool validEcalRecHits = true;
278  Handle<EcalRecHitCollection> barrelHitHandle;
280  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
281  if (!barrelHitHandle.isValid()) {
282  edm::LogError("PhotonProducer") << "Error! Can't get the barrelEcalHits";
283  validEcalRecHits = false;
284  }
285  if (validEcalRecHits)
286  barrelRecHits = *(barrelHitHandle.product());
287 
288  Handle<EcalRecHitCollection> endcapHitHandle;
289  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
291  if (!endcapHitHandle.isValid()) {
292  edm::LogError("PhotonProducer") << "Error! Can't get the endcapEcalHits";
293  validEcalRecHits = false;
294  }
295  if (validEcalRecHits)
296  endcapRecHits = *(endcapHitHandle.product());
297 
298  const CaloTopology* topology = &theEventSetup.getData(topologyToken_);
299 
300  // prepare access to hcal data
301  hcalHelperCone_->beginEvent(theEvent, theEventSetup);
302  hcalHelperBc_->beginEvent(theEvent, theEventSetup);
303 
304  // Get the primary event vertex
305  Handle<reco::VertexCollection> vertexHandle;
307  bool validVertex = true;
308  if (usePrimaryVertex_) {
309  theEvent.getByToken(vertexProducer_, vertexHandle);
310  if (!vertexHandle.isValid()) {
311  edm::LogWarning("PhotonProducer") << "Error! Can't get the product primary Vertex Collection "
312  << "\n";
313  validVertex = false;
314  }
315  if (validVertex)
316  vertexCollection = *(vertexHandle.product());
317  }
318 
319  int iSC = 0; // index in photon collection
320  // Loop over barrel and endcap SC collections and fill the photon collection
321  if (validPhotonCoreHandle)
322  fillPhotonCollection(theEvent,
323  theEventSetup,
324  photonCoreHandle,
325  topology,
326  hcalCuts,
327  &barrelRecHits,
328  &endcapRecHits,
330  *hcalHelperBc_,
333  iSC);
334 
335  // put the product in the event
336  edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
337  outputPhotonCollection_p->assign(outputPhotonCollection.begin(), outputPhotonCollection.end());
338 
339  // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest
340  if (hcalRun2EffDepth_) {
341  for (auto& pho : *outputPhotonCollection_p)
342  pho.hcalToRun2EffDepth();
343  }
344 
345  theEvent.put(std::move(outputPhotonCollection_p), PhotonCollection_);
346 }
347 
349  edm::EventSetup const& es,
350  const edm::Handle<reco::PhotonCoreCollection>& photonCoreHandle,
351  const CaloTopology* topology,
352  const HcalPFCuts* hcalCuts,
353  const EcalRecHitCollection* ecalBarrelHits,
354  const EcalRecHitCollection* ecalEndcapHits,
355  ElectronHcalHelper const& hcalHelperCone,
356  ElectronHcalHelper const& hcalHelperBc,
359  int& iSC) {
360  // get the geometry from the event setup:
362  const CaloSubdetectorGeometry* subDetGeometry = nullptr;
363  const CaloSubdetectorGeometry* geometryES = geometry->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
364  const EcalRecHitCollection* hits = nullptr;
365  std::vector<double> preselCutValues;
366  float minR9 = 0;
367 
369 
370  std::vector<int> flags_, severitiesexcl_;
371 
372  for (unsigned int lSC = 0; lSC < photonCoreHandle->size(); lSC++) {
373  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
374  reco::SuperClusterRef scRef = coreRef->superCluster();
375  iSC++;
376 
377  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
378  subDetGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, subdet);
379 
380  if (subdet == EcalBarrel) {
381  preselCutValues = preselCutValuesBarrel_;
383  hits = ecalBarrelHits;
384  flags_ = flagsexclEB_;
385  severitiesexcl_ = severitiesexclEB_;
386  } else if (subdet == EcalEndcap) {
387  preselCutValues = preselCutValuesEndcap_;
389  hits = ecalEndcapHits;
390  flags_ = flagsexclEE_;
391  severitiesexcl_ = severitiesexclEE_;
392  } else {
393  edm::LogWarning("") << "PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
394  }
395  if (hits == nullptr)
396  continue;
397 
398  // SC energy preselection
399  if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0])
400  continue;
401 
402  // recalculate position of seed BasicCluster taking shower depth for unconverted photon
403  math::XYZPoint unconvPos =
404  posCalculator_.Calculate_Location(scRef->seed()->hitsAndFractions(), hits, subDetGeometry, geometryES);
405 
406  float maxXtal = EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
407  //AA
408  //Change these to consider severity level of hits
409  float e1x5 = EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
410  float e2x5 = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
411  float e3x3 = EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
412  float e5x5 = EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
413  const auto& cov = EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
414  const auto& locCov = EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
415 
416  float sigmaEtaEta = sqrt(cov[0]);
417  float sigmaIetaIeta = sqrt(locCov[0]);
418  float r9 = e3x3 / (scRef->rawEnergy());
419 
420  float full5x5_maxXtal = noZS::EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
421  //AA
422  //Change these to consider severity level of hits
423  float full5x5_e1x5 = noZS::EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
424  float full5x5_e2x5 = noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
425  float full5x5_e3x3 = noZS::EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
426  float full5x5_e5x5 = noZS::EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
427  const auto& full5x5_cov = noZS::EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
428  const auto& full5x5_locCov = noZS::EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
429 
430  float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]);
431  float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]);
432 
433  // compute position of ECAL shower
434  math::XYZPoint caloPosition;
435  if (r9 > minR9) {
436  caloPosition = unconvPos;
437  } else {
438  caloPosition = scRef->position();
439  }
440 
442  double photonEnergy = 1.;
443  math::XYZPoint vtx(0., 0., 0.);
444  if (!vertexCollection.empty())
445  vtx = vertexCollection.begin()->position();
446  // compute momentum vector of photon from primary vertex and cluster position
447  math::XYZVector direction = caloPosition - vtx;
448  math::XYZVector momentum = direction.unit();
449 
450  // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
451  math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy);
452  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
453 
454  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
455  reco::Photon::FiducialFlags fiducialFlags;
456  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
457  photonIsolationCalculator_.calculate(&newCandidate, evt, es, fiducialFlags, isolVarR04, isolVarR03, hcalCuts);
458  newCandidate.setFiducialVolumeFlags(fiducialFlags);
459  newCandidate.setIsolationVariables(isolVarR04, isolVarR03);
460 
462  reco::Photon::ShowerShape showerShape;
463  showerShape.e1x5 = e1x5;
464  showerShape.e2x5 = e2x5;
465  showerShape.e3x3 = e3x3;
466  showerShape.e5x5 = e5x5;
467  showerShape.maxEnergyXtal = maxXtal;
468  showerShape.sigmaEtaEta = sigmaEtaEta;
469  showerShape.sigmaIetaIeta = sigmaIetaIeta;
470  for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) {
471  showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1, hcalCuts) / scRef->energy();
472  showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1, hcalCuts) / scRef->energy();
473  }
474  showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef);
475  showerShape.pre7DepthHcal = false;
476  newCandidate.setShowerShapeVariables(showerShape);
477 
479  reco::Photon::ShowerShape full5x5_showerShape;
480  full5x5_showerShape.e1x5 = full5x5_e1x5;
481  full5x5_showerShape.e2x5 = full5x5_e2x5;
482  full5x5_showerShape.e3x3 = full5x5_e3x3;
483  full5x5_showerShape.e5x5 = full5x5_e5x5;
484  full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal;
485  full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta;
486  full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta;
487  for (uint id = 0; id < full5x5_showerShape.hcalOverEcal.size(); ++id) {
488  full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1, hcalCuts) / full5x5_e5x5;
489  full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1, hcalCuts) / full5x5_e5x5;
490  }
491  full5x5_showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef);
492  full5x5_showerShape.pre7DepthHcal = false;
493  newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape);
494 
497  // Photon candidate takes by default (set in photons_cfi.py) a 4-momentum derived from the ecal photon-specific corrections.
498  photonEnergyCorrector_.calculate(evt, newCandidate, subdet, vertexCollection, es);
499  if (candidateP4type_ == "fromEcalEnergy") {
500  newCandidate.setP4(newCandidate.p4(reco::Photon::ecal_photons));
501  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
502  } else if (candidateP4type_ == "fromRegression") {
503  newCandidate.setP4(newCandidate.p4(reco::Photon::regression1));
504  newCandidate.setCandidateP4type(reco::Photon::regression1);
505  }
506 
507  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
509  if (subdet == EcalBarrel && runMIPTagger_) {
510  photonMIPHaloTagger_.MIPcalculate(&newCandidate, evt, es, mipVar);
511  newCandidate.setMIPVariables(mipVar);
512  }
513 
515  bool isLooseEM = true;
516  if (newCandidate.pt() < highEt_) {
517  if (newCandidate.hadronicOverEm() >= preselCutValues[1])
518  isLooseEM = false;
519  if (newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2] + preselCutValues[3] * newCandidate.pt())
520  isLooseEM = false;
521  if (newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4] + preselCutValues[5] * newCandidate.pt())
522  isLooseEM = false;
523  if (newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]))
524  isLooseEM = false;
525  if (newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]))
526  isLooseEM = false;
527  if (newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8])
528  isLooseEM = false;
529  if (newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9])
530  isLooseEM = false;
531  if (newCandidate.sigmaIetaIeta() > preselCutValues[10])
532  isLooseEM = false;
533  }
534 
535  if (isLooseEM)
536  outputPhotonCollection.push_back(newCandidate);
537  }
538 }
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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 HcalPFCuts *hcalCuts) const
std::vector< double > preselCutValuesEndcap_
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: Photon.h:159
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
void MIPcalculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::MIPVariables &mipId)
T const * product() const
Definition: Handle.h:70
std::unique_ptr< ElectronHcalHelper > hcalHelperCone_
edm::EDGetTokenT< HBHERecHitCollection > hbheRecHits_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
PositionCalc posCalculator_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
Definition: config.py:1
std::array< float, 7 > hcalOverEcalBc
Definition: Photon.h:158
PhotonEnergyCorrector photonEnergyCorrector_
Log< level::Error, false > LogError
bool runMVABasedHaloTagger_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducer_
PhotonMIPHaloTagger photonMIPHaloTagger_
double hOverEConeSize_
static std::array< float, 3 > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
PhotonIsolationCalculator photonIsolationCalculator_
static std::array< float, 3 > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=EgammaLocalCovParamDefaults::kRelEnCut, const EcalPFRecHitThresholds *thresholds=nullptr, float multEB=0.0, float multEE=0.0)
std::unique_ptr< ElectronHcalHelper > hcalHelperBc_
std::vector< int > flagsexclEB_
T sqrt(T t)
Definition: SSEVec.h:23
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)
std::vector< int > flagsexclEE_
std::string candidateP4type_
std::vector< int > severitiesexclEE_
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
Definition: PositionCalc.h:65
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void init(const edm::EventSetup &theEventSetup)
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const HcalPFCuts *hcalCuts, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, ElectronHcalHelper const &hcalHelperCone, ElectronHcalHelper const &hcalHelperBc, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC)
std::vector< int > severitiesexclEB_
std::string PhotonCollection_
Log< level::Info, false > LogInfo
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
void calculate(edm::Event &evt, reco::Photon &, int subdet, const reco::VertexCollection &vtxcol, const edm::EventSetup &iSetup)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::array< float, 7 > hcalOverEcal
Definition: Photon.h:156
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< double > preselCutValuesBarrel_
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_
auto hcalTowersBehindClusters(const reco::SuperCluster &sc) const
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
PhotonProducer(const edm::ParameterSet &ps)
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
std::unique_ptr< PhotonMVABasedHaloTagger > photonMVABasedHaloTagger_
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Log< level::Warning, false > LogWarning
double hcalESum(const reco::SuperCluster &, int depth, const HcalPFCuts *hcalCuts) const
std::array< double, 4 > arrayHB
void produce(edm::Event &evt, const edm::EventSetup &es) override
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
def move(src, dest)
Definition: eostools.py:511
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
std::array< double, 7 > arrayHE