CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonProducer Class Reference
Inheritance diagram for PhotonProducer:
edm::stream::EDProducer<>

Public Member Functions

 PhotonProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

void fillPhotonCollection (edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, CaloTowerCollection const &hcalTowers, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC, const EcalSeverityLevelAlgo *sevLv)
 

Private Attributes

edm::EDGetTokenT< EcalRecHitCollectionbarrelEcalHits_
 
std::string candidateP4type_
 
edm::EDGetTokenT< EcalRecHitCollectionendcapEcalHits_
 
std::vector< int > flagsexclEB_
 
std::vector< int > flagsexclEE_
 
edm::EDGetTokenT< CaloTowerCollectionhcalTowers_
 
double highEt_
 
double hOverEConeSize_
 
double maxHOverE_
 
double minR9Barrel_
 
double minR9Endcap_
 
double minSCEt_
 
std::string PhotonCollection_
 
edm::EDGetTokenT< reco::PhotonCoreCollectionphotonCoreProducer_
 
PhotonEnergyCorrector photonEnergyCorrector_
 
PhotonIsolationCalculator photonIsolationCalculator_
 
PhotonMIPHaloTagger photonMIPHaloTagger_
 
PositionCalc posCalculator_
 
std::vector< double > preselCutValuesBarrel_
 
std::vector< double > preselCutValuesEndcap_
 
bool runMIPTagger_
 
std::vector< int > severitiesexclEB_
 
std::vector< int > severitiesexclEE_
 
bool usePrimaryVertex_
 
bool validConversions_
 
bool validPixelSeeds_
 
edm::EDGetTokenT< reco::VertexCollectionvertexProducer_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 46 of file PhotonProducer.cc.

Constructor & Destructor Documentation

◆ PhotonProducer()

PhotonProducer::PhotonProducer ( const edm::ParameterSet ps)

Definition at line 111 of file PhotonProducer.cc.

111  : photonEnergyCorrector_(config, consumesCollector()) {
112  // use onfiguration file to setup input/output collection names
113 
114  photonCoreProducer_ = consumes<reco::PhotonCoreCollection>(config.getParameter<edm::InputTag>("photonCoreProducer"));
115  barrelEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("barrelEcalHits"));
116  endcapEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("endcapEcalHits"));
117  vertexProducer_ = consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("primaryVertexProducer"));
118  hcalTowers_ = consumes<CaloTowerCollection>(config.getParameter<edm::InputTag>("hcalTowers"));
119  hOverEConeSize_ = config.getParameter<double>("hOverEConeSize");
120  highEt_ = config.getParameter<double>("highEt");
121  // R9 value to decide converted/unconverted
122  minR9Barrel_ = config.getParameter<double>("minR9Barrel");
123  minR9Endcap_ = config.getParameter<double>("minR9Endcap");
124  usePrimaryVertex_ = config.getParameter<bool>("usePrimaryVertex");
125  runMIPTagger_ = config.getParameter<bool>("runMIPTagger");
126 
127  candidateP4type_ = config.getParameter<std::string>("candidateP4type");
128 
129  edm::ParameterSet posCalcParameters = config.getParameter<edm::ParameterSet>("posCalcParameters");
131 
132  //AA
133  //Flags and Severities to be excluded from photon calculations
134  const std::vector<std::string> flagnamesEB =
135  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
136 
137  const std::vector<std::string> flagnamesEE =
138  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
139 
140  flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
141 
142  flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
143 
144  const std::vector<std::string> severitynamesEB =
145  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
146 
147  severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
148 
149  const std::vector<std::string> severitynamesEE =
150  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
151 
152  severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
153 
154  //AA
155 
156  //
157 
158  // Parameters for the position calculation:
159  // std::map<std::string,double> providedParameters;
160  // providedParameters.insert(std::make_pair("LogWeighted",config.getParameter<bool>("posCalc_logweight")));
161  //providedParameters.insert(std::make_pair("T0_barl",config.getParameter<double>("posCalc_t0_barl")));
162  //providedParameters.insert(std::make_pair("T0_endc",config.getParameter<double>("posCalc_t0_endc")));
163  //providedParameters.insert(std::make_pair("T0_endcPresh",config.getParameter<double>("posCalc_t0_endcPresh")));
164  //providedParameters.insert(std::make_pair("W0",config.getParameter<double>("posCalc_w0")));
165  //providedParameters.insert(std::make_pair("X0",config.getParameter<double>("posCalc_x0")));
166  //posCalculator_ = PositionCalc(providedParameters);
167  // cut values for pre-selection
168  preselCutValuesBarrel_.push_back(config.getParameter<double>("minSCEtBarrel"));
169  preselCutValuesBarrel_.push_back(config.getParameter<double>("maxHoverEBarrel"));
170  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
171  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
172  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
173  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
174  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackSolidConeBarrel"));
175  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackHollowConeBarrel"));
176  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumSolidConeBarrel"));
177  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumHollowConeBarrel"));
178  preselCutValuesBarrel_.push_back(config.getParameter<double>("sigmaIetaIetaCutBarrel"));
179  //
180  preselCutValuesEndcap_.push_back(config.getParameter<double>("minSCEtEndcap"));
181  preselCutValuesEndcap_.push_back(config.getParameter<double>("maxHoverEEndcap"));
182  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
183  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
184  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
185  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
186  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackSolidConeEndcap"));
187  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackHollowConeEndcap"));
188  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumSolidConeEndcap"));
189  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumHollowConeEndcap"));
190  preselCutValuesEndcap_.push_back(config.getParameter<double>("sigmaIetaIetaCutEndcap"));
191  //
192 
193  edm::ParameterSet isolationSumsCalculatorSet = config.getParameter<edm::ParameterSet>("isolationSumsCalculatorSet");
196 
197  edm::ParameterSet mipVariableSet = config.getParameter<edm::ParameterSet>("mipVariableSet");
198  photonMIPHaloTagger_.setup(mipVariableSet, consumesCollector());
199 
200  // Register the product
201  produces<reco::PhotonCollection>(PhotonCollection_);
202 }

References barrelEcalHits_, candidateP4type_, endcapEcalHits_, flagsexclEB_, flagsexclEE_, hcalTowers_, highEt_, hOverEConeSize_, gedPhotons_cfi::isolationSumsCalculatorSet, minR9Barrel_, minR9Endcap_, gedPhotons_cfi::mipVariableSet, PhotonCollection_, photonCoreProducer_, photonIsolationCalculator_, photonMIPHaloTagger_, MonitorAlCaEcalPi0_cfi::posCalcParameters, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, runMIPTagger_, PhotonMIPHaloTagger::setup(), PhotonIsolationCalculator::setup(), severitiesexclEB_, severitiesexclEE_, AlCaHLTBitMon_QueryRunRegistry::string, usePrimaryVertex_, and vertexProducer_.

Member Function Documentation

◆ fillPhotonCollection()

void PhotonProducer::fillPhotonCollection ( edm::Event evt,
edm::EventSetup const &  es,
const edm::Handle< reco::PhotonCoreCollection > &  photonCoreHandle,
const CaloTopology topology,
const EcalRecHitCollection ecalBarrelHits,
const EcalRecHitCollection ecalEndcapHits,
CaloTowerCollection const &  hcalTowers,
reco::VertexCollection pvVertices,
reco::PhotonCollection outputCollection,
int &  iSC,
const EcalSeverityLevelAlgo sevLv 
)
private

fill shower shape block

fill full5x5 shower shape block

get ecal photon specific corrected energy plus values from regressions and store them in the Photon

Pre-selection loose isolation cuts

Definition at line 291 of file PhotonProducer.cc.

301  {
302  // get the geometry from the event setup:
303  edm::ESHandle<CaloGeometry> caloGeomHandle;
304  es.get<CaloGeometryRecord>().get(caloGeomHandle);
305 
306  const CaloGeometry* geometry = caloGeomHandle.product();
307  const CaloSubdetectorGeometry* subDetGeometry = nullptr;
308  const CaloSubdetectorGeometry* geometryES = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
309  const EcalRecHitCollection* hits = nullptr;
310  std::vector<double> preselCutValues;
311  float minR9 = 0;
312 
314 
315  std::vector<int> flags_, severitiesexcl_;
316 
317  for (unsigned int lSC = 0; lSC < photonCoreHandle->size(); lSC++) {
318  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
319  reco::SuperClusterRef scRef = coreRef->superCluster();
320  iSC++;
321 
322  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
323  subDetGeometry = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, subdet);
324 
325  if (subdet == EcalBarrel) {
326  preselCutValues = preselCutValuesBarrel_;
328  hits = ecalBarrelHits;
329  flags_ = flagsexclEB_;
330  severitiesexcl_ = severitiesexclEB_;
331  } else if (subdet == EcalEndcap) {
332  preselCutValues = preselCutValuesEndcap_;
334  hits = ecalEndcapHits;
335  flags_ = flagsexclEE_;
336  severitiesexcl_ = severitiesexclEE_;
337  } else {
338  edm::LogWarning("") << "PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
339  }
340  if (hits == nullptr)
341  continue;
342 
343  // SC energy preselection
344  if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0])
345  continue;
346  // calculate HoE
347 
348  EgammaTowerIsolation towerIso1(hOverEConeSize_, 0., 0., 1, &hcalTowers);
349  EgammaTowerIsolation towerIso2(hOverEConeSize_, 0., 0., 2, &hcalTowers);
350  double HoE1 = towerIso1.getTowerESum(&(*scRef)) / scRef->energy();
351  double HoE2 = towerIso2.getTowerESum(&(*scRef)) / scRef->energy();
352 
354  es.get<CaloGeometryRecord>().get(ctmaph);
355 
356  auto towersBehindCluster = egamma::towersOf(*scRef, *ctmaph);
357  float hcalDepth1OverEcalBc = egamma::depth1HcalESum(towersBehindCluster, hcalTowers) / scRef->energy();
358  float hcalDepth2OverEcalBc = egamma::depth2HcalESum(towersBehindCluster, hcalTowers) / scRef->energy();
359 
360  // recalculate position of seed BasicCluster taking shower depth for unconverted photon
361  math::XYZPoint unconvPos =
362  posCalculator_.Calculate_Location(scRef->seed()->hitsAndFractions(), hits, subDetGeometry, geometryES);
363 
364  float maxXtal = EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
365  //AA
366  //Change these to consider severity level of hits
367  float e1x5 = EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
368  float e2x5 = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
369  float e3x3 = EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
370  float e5x5 = EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
371  const auto& cov = EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
372  const auto& locCov = EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
373 
374  float sigmaEtaEta = sqrt(cov[0]);
375  float sigmaIetaIeta = sqrt(locCov[0]);
376  float r9 = e3x3 / (scRef->rawEnergy());
377 
378  float full5x5_maxXtal = noZS::EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
379  //AA
380  //Change these to consider severity level of hits
381  float full5x5_e1x5 = noZS::EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
382  float full5x5_e2x5 = noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
383  float full5x5_e3x3 = noZS::EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
384  float full5x5_e5x5 = noZS::EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
385  const auto& full5x5_cov = noZS::EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
386  const auto& full5x5_locCov = noZS::EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
387 
388  float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]);
389  float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]);
390 
391  // compute position of ECAL shower
392  math::XYZPoint caloPosition;
393  if (r9 > minR9) {
394  caloPosition = unconvPos;
395  } else {
396  caloPosition = scRef->position();
397  }
398 
400  double photonEnergy = 1.;
401  math::XYZPoint vtx(0., 0., 0.);
402  if (!vertexCollection.empty())
403  vtx = vertexCollection.begin()->position();
404  // compute momentum vector of photon from primary vertex and cluster position
405  math::XYZVector direction = caloPosition - vtx;
406  math::XYZVector momentum = direction.unit();
407 
408  // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
409  math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy);
410  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
411 
412  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
413  reco::Photon::FiducialFlags fiducialFlags;
414  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
415  photonIsolationCalculator_.calculate(&newCandidate, evt, es, fiducialFlags, isolVarR04, isolVarR03);
416  newCandidate.setFiducialVolumeFlags(fiducialFlags);
417  newCandidate.setIsolationVariables(isolVarR04, isolVarR03);
418 
420  reco::Photon::ShowerShape showerShape;
421  showerShape.e1x5 = e1x5;
422  showerShape.e2x5 = e2x5;
423  showerShape.e3x3 = e3x3;
424  showerShape.e5x5 = e5x5;
425  showerShape.maxEnergyXtal = maxXtal;
426  showerShape.sigmaEtaEta = sigmaEtaEta;
427  showerShape.sigmaIetaIeta = sigmaIetaIeta;
428  showerShape.hcalDepth1OverEcal = HoE1;
429  showerShape.hcalDepth2OverEcal = HoE2;
430  showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc;
431  showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc;
432  showerShape.hcalTowersBehindClusters = towersBehindCluster;
433  newCandidate.setShowerShapeVariables(showerShape);
434 
436  reco::Photon::ShowerShape full5x5_showerShape;
437  full5x5_showerShape.e1x5 = full5x5_e1x5;
438  full5x5_showerShape.e2x5 = full5x5_e2x5;
439  full5x5_showerShape.e3x3 = full5x5_e3x3;
440  full5x5_showerShape.e5x5 = full5x5_e5x5;
441  full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal;
442  full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta;
443  full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta;
444  newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape);
445 
448  // Photon candidate takes by default (set in photons_cfi.py) a 4-momentum derived from the ecal photon-specific corrections.
449  photonEnergyCorrector_.calculate(evt, newCandidate, subdet, vertexCollection, es);
450  if (candidateP4type_ == "fromEcalEnergy") {
451  newCandidate.setP4(newCandidate.p4(reco::Photon::ecal_photons));
452  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
453  } else if (candidateP4type_ == "fromRegression") {
454  newCandidate.setP4(newCandidate.p4(reco::Photon::regression1));
455  newCandidate.setCandidateP4type(reco::Photon::regression1);
456  }
457 
458  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
460  if (subdet == EcalBarrel && runMIPTagger_) {
461  photonMIPHaloTagger_.MIPcalculate(&newCandidate, evt, es, mipVar);
462  newCandidate.setMIPVariables(mipVar);
463  }
464 
466  bool isLooseEM = true;
467  if (newCandidate.pt() < highEt_) {
468  if (newCandidate.hadronicOverEm() >= preselCutValues[1])
469  isLooseEM = false;
470  if (newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2] + preselCutValues[3] * newCandidate.pt())
471  isLooseEM = false;
472  if (newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4] + preselCutValues[5] * newCandidate.pt())
473  isLooseEM = false;
474  if (newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]))
475  isLooseEM = false;
476  if (newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]))
477  isLooseEM = false;
478  if (newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8])
479  isLooseEM = false;
480  if (newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9])
481  isLooseEM = false;
482  if (newCandidate.sigmaIetaIeta() > preselCutValues[10])
483  isLooseEM = false;
484  }
485 
486  if (isLooseEM)
487  outputPhotonCollection.push_back(newCandidate);
488  }
489 }

References PhotonIsolationCalculator::calculate(), PhotonEnergyCorrector::calculate(), PositionCalc::Calculate_Location(), candidateP4type_, EcalClusterToolsT< noZS >::covariances(), egamma::depth1HcalESum(), egamma::depth2HcalESum(), EgHLTOffHistBins_cfi::e1x5, EcalClusterToolsT< noZS >::e1x5(), reco::Photon::ShowerShape::e1x5, EgHLTOffHistBins_cfi::e2x5, reco::Photon::ShowerShape::e2x5, EcalClusterToolsT< noZS >::e2x5Max(), EcalClusterToolsT< noZS >::e3x3(), reco::Photon::ShowerShape::e3x3, EcalClusterToolsT< noZS >::e5x5(), reco::Photon::ShowerShape::e5x5, DetId::Ecal, reco::Photon::ecal_photons, EcalBarrel, EcalEndcap, EcalPreshower, cosmicPhotonAnalyzer_cfi::eMax, EcalClusterToolsT< noZS >::eMax(), flagsexclEB_, flagsexclEE_, HLT_FULL_cff::full5x5_sigmaIetaIeta, relativeConstraints::geometry, edm::EventSetup::get(), get, CaloGeometry::getSubdetectorGeometry(), EgammaTowerIsolation::getTowerESum(), reco::Photon::ShowerShape::hcalDepth1OverEcal, reco::Photon::ShowerShape::hcalDepth1OverEcalBc, reco::Photon::ShowerShape::hcalDepth2OverEcal, reco::Photon::ShowerShape::hcalDepth2OverEcalBc, conversions_cfi::hcalTowers, reco::Photon::ShowerShape::hcalTowersBehindClusters, highEt_, hfClusterShapes_cfi::hits, hOverEConeSize_, PhotonEnergyCorrector::init(), createfilelist::int, EcalClusterToolsT< noZS >::localCovariances(), reco::Photon::ShowerShape::maxEnergyXtal, EgHLTOffEleSelection_cfi::minR9, minR9Barrel_, minR9Endcap_, PhotonMIPHaloTagger::MIPcalculate(), gedPhotons_cfi::outputPhotonCollection, p4, MaterialEffects_cfi::photonEnergy, photonEnergyCorrector_, photonIsolationCalculator_, photonMIPHaloTagger_, posCalculator_, preselCutValuesBarrel_, preselCutValuesEndcap_, edm::ESHandle< T >::product(), electrons_cff::r9, reco::Photon::regression1, runMIPTagger_, severitiesexclEB_, severitiesexclEE_, electronIdCutBasedExt_cfi::sigmaEtaEta, reco::Photon::ShowerShape::sigmaEtaEta, reco::Photon::ShowerShape::sigmaIetaIeta, mathSSE::sqrt(), egamma::towersOf(), spclusmultinvestigator_cfi::vertexCollection, and extraflags_cff::vtx.

Referenced by produce().

◆ produce()

void PhotonProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 204 of file PhotonProducer.cc.

204  {
205  using namespace edm;
206  // nEvt_++;
207 
209  auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
210 
211  // Get the PhotonCore collection
212  bool validPhotonCoreHandle = true;
213  Handle<reco::PhotonCoreCollection> photonCoreHandle;
214  theEvent.getByToken(photonCoreProducer_, photonCoreHandle);
215  if (!photonCoreHandle.isValid()) {
216  edm::LogError("PhotonProducer") << "Error! Can't get the photonCoreProducer";
217  validPhotonCoreHandle = false;
218  }
219 
220  // Get EcalRecHits
221  bool validEcalRecHits = true;
222  Handle<EcalRecHitCollection> barrelHitHandle;
224  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
225  if (!barrelHitHandle.isValid()) {
226  edm::LogError("PhotonProducer") << "Error! Can't get the barrelEcalHits";
227  validEcalRecHits = false;
228  }
229  if (validEcalRecHits)
230  barrelRecHits = *(barrelHitHandle.product());
231 
232  Handle<EcalRecHitCollection> endcapHitHandle;
233  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
235  if (!endcapHitHandle.isValid()) {
236  edm::LogError("PhotonProducer") << "Error! Can't get the endcapEcalHits";
237  validEcalRecHits = false;
238  }
239  if (validEcalRecHits)
240  endcapRecHits = *(endcapHitHandle.product());
241 
242  //AA
243  //Get the severity level object
245  theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
246  //
247 
248  // get Hcal towers collection
249  auto const& hcalTowers = theEvent.get(hcalTowers_);
250 
251  edm::ESHandle<CaloTopology> pTopology;
252  theEventSetup.get<CaloTopologyRecord>().get(pTopology);
253  const CaloTopology* topology = pTopology.product();
254 
255  // Get the primary event vertex
256  Handle<reco::VertexCollection> vertexHandle;
258  bool validVertex = true;
259  if (usePrimaryVertex_) {
260  theEvent.getByToken(vertexProducer_, vertexHandle);
261  if (!vertexHandle.isValid()) {
262  edm::LogWarning("PhotonProducer") << "Error! Can't get the product primary Vertex Collection "
263  << "\n";
264  validVertex = false;
265  }
266  if (validVertex)
267  vertexCollection = *(vertexHandle.product());
268  }
269 
270  int iSC = 0; // index in photon collection
271  // Loop over barrel and endcap SC collections and fill the photon collection
272  if (validPhotonCoreHandle)
273  fillPhotonCollection(theEvent,
274  theEventSetup,
275  photonCoreHandle,
276  topology,
277  &barrelRecHits,
278  &endcapRecHits,
279  hcalTowers,
282  iSC,
283  sevLv.product());
284 
285  // put the product in the event
286  edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
287  outputPhotonCollection_p->assign(outputPhotonCollection.begin(), outputPhotonCollection.end());
288  theEvent.put(std::move(outputPhotonCollection_p), PhotonCollection_);
289 }

References barrelEcalHits_, HLT_FULL_cff::barrelRecHits, endcapEcalHits_, HLT_FULL_cff::endcapRecHits, fillPhotonCollection(), edm::EventSetup::get(), edm::Event::get(), get, edm::Event::getByToken(), conversions_cfi::hcalTowers, hcalTowers_, edm::HandleBase::isValid(), eostools::move(), gedPhotons_cfi::outputPhotonCollection, PhotonCollection_, photonCoreProducer_, edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), usePrimaryVertex_, spclusmultinvestigator_cfi::vertexCollection, and vertexProducer_.

Member Data Documentation

◆ barrelEcalHits_

edm::EDGetTokenT<EcalRecHitCollection> PhotonProducer::barrelEcalHits_
private

Definition at line 68 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ candidateP4type_

std::string PhotonProducer::candidateP4type_
private

Definition at line 105 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ endcapEcalHits_

edm::EDGetTokenT<EcalRecHitCollection> PhotonProducer::endcapEcalHits_
private

Definition at line 69 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ flagsexclEB_

std::vector<int> PhotonProducer::flagsexclEB_
private

Definition at line 76 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ flagsexclEE_

std::vector<int> PhotonProducer::flagsexclEE_
private

Definition at line 77 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ hcalTowers_

edm::EDGetTokenT<CaloTowerCollection> PhotonProducer::hcalTowers_
private

Definition at line 70 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ highEt_

double PhotonProducer::highEt_
private

Definition at line 84 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ hOverEConeSize_

double PhotonProducer::hOverEConeSize_
private

Definition at line 81 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ maxHOverE_

double PhotonProducer::maxHOverE_
private

Definition at line 82 of file PhotonProducer.cc.

◆ minR9Barrel_

double PhotonProducer::minR9Barrel_
private

Definition at line 85 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ minR9Endcap_

double PhotonProducer::minR9Endcap_
private

Definition at line 86 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ minSCEt_

double PhotonProducer::minSCEt_
private

Definition at line 83 of file PhotonProducer.cc.

◆ PhotonCollection_

std::string PhotonProducer::PhotonCollection_
private

Definition at line 66 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ photonCoreProducer_

edm::EDGetTokenT<reco::PhotonCoreCollection> PhotonProducer::photonCoreProducer_
private

Definition at line 67 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ photonEnergyCorrector_

PhotonEnergyCorrector PhotonProducer::photonEnergyCorrector_
private

Definition at line 104 of file PhotonProducer.cc.

Referenced by fillPhotonCollection().

◆ photonIsolationCalculator_

PhotonIsolationCalculator PhotonProducer::photonIsolationCalculator_
private

Definition at line 96 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ photonMIPHaloTagger_

PhotonMIPHaloTagger PhotonProducer::photonMIPHaloTagger_
private

Definition at line 99 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ posCalculator_

PositionCalc PhotonProducer::posCalculator_
private

Definition at line 93 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ preselCutValuesBarrel_

std::vector<double> PhotonProducer::preselCutValuesBarrel_
private

Definition at line 101 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ preselCutValuesEndcap_

std::vector<double> PhotonProducer::preselCutValuesEndcap_
private

Definition at line 102 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ runMIPTagger_

bool PhotonProducer::runMIPTagger_
private

Definition at line 87 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ severitiesexclEB_

std::vector<int> PhotonProducer::severitiesexclEB_
private

Definition at line 78 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ severitiesexclEE_

std::vector<int> PhotonProducer::severitiesexclEE_
private

Definition at line 79 of file PhotonProducer.cc.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ usePrimaryVertex_

bool PhotonProducer::usePrimaryVertex_
private

Definition at line 91 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

◆ validConversions_

bool PhotonProducer::validConversions_
private

Definition at line 89 of file PhotonProducer.cc.

◆ validPixelSeeds_

bool PhotonProducer::validPixelSeeds_
private

Definition at line 95 of file PhotonProducer.cc.

◆ vertexProducer_

edm::EDGetTokenT<reco::VertexCollection> PhotonProducer::vertexProducer_
private

Definition at line 71 of file PhotonProducer.cc.

Referenced by PhotonProducer(), and produce().

EgHLTOffHistBins_cfi.e1x5
e1x5
Definition: EgHLTOffHistBins_cfi.py:22
reco::Photon::ShowerShape::maxEnergyXtal
float maxEnergyXtal
Definition: Photon.h:144
PhotonProducer::minR9Endcap_
double minR9Endcap_
Definition: PhotonProducer.cc:86
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
reco::Photon::ShowerShape::hcalDepth2OverEcalBc
float hcalDepth2OverEcalBc
Definition: Photon.h:148
electrons_cff.r9
r9
Definition: electrons_cff.py:360
PhotonMIPHaloTagger::setup
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
Definition: PhotonMIPHaloTagger.cc:17
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:34
PhotonProducer::hcalTowers_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
Definition: PhotonProducer.cc:70
PhotonProducer::flagsexclEE_
std::vector< int > flagsexclEE_
Definition: PhotonProducer.cc:77
reco::Photon::ShowerShape::sigmaEtaEta
float sigmaEtaEta
Definition: Photon.h:138
edm::Handle::product
T const * product() const
Definition: Handle.h:70
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
reco::Photon::ShowerShape::e1x5
float e1x5
Definition: Photon.h:140
PhotonProducer::photonCoreProducer_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducer_
Definition: PhotonProducer.cc:67
PhotonProducer::fillPhotonCollection
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, CaloTowerCollection const &hcalTowers, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC, const EcalSeverityLevelAlgo *sevLv)
Definition: PhotonProducer.cc:291
PhotonProducer::hOverEConeSize_
double hOverEConeSize_
Definition: PhotonProducer.cc:81
HLT_FULL_cff.endcapRecHits
endcapRecHits
Definition: HLT_FULL_cff.py:14920
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
gedPhotons_cfi.mipVariableSet
mipVariableSet
Definition: gedPhotons_cfi.py:36
math::XYZTLorentzVectorD
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
geometry
Definition: geometry.py:1
HLT_FULL_cff.barrelRecHits
barrelRecHits
Definition: HLT_FULL_cff.py:14923
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
EcalClusterToolsT::eMax
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: EcalClusterTools.h:555
PhotonProducer::runMIPTagger_
bool runMIPTagger_
Definition: PhotonProducer.cc:87
edm::SortedCollection< EcalRecHit >
relativeConstraints.geometry
geometry
Definition: relativeConstraints.py:39
PhotonProducer::minR9Barrel_
double minR9Barrel_
Definition: PhotonProducer.cc:85
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalClusterToolsT::localCovariances
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)
Definition: EcalClusterTools.h:1036
MonitorAlCaEcalPi0_cfi.posCalcParameters
posCalcParameters
Definition: MonitorAlCaEcalPi0_cfi.py:72
egamma::depth2HcalESum
double depth2HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
Definition: EgammaHadTower.cc:83
PhotonProducer::preselCutValuesBarrel_
std::vector< double > preselCutValuesBarrel_
Definition: PhotonProducer.cc:101
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CaloTopology
Definition: CaloTopology.h:19
EcalBarrel
Definition: EcalSubdetector.h:10
edm::Ref< PhotonCoreCollection >
PhotonMIPHaloTagger::MIPcalculate
void MIPcalculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::MIPVariables &mipId)
Definition: PhotonMIPHaloTagger.cc:27
PhotonProducer::photonEnergyCorrector_
PhotonEnergyCorrector photonEnergyCorrector_
Definition: PhotonProducer.cc:104
PhotonProducer::endcapEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: PhotonProducer.cc:69
config
Definition: config.py:1
CaloGeometry
Definition: CaloGeometry.h:21
reco::Photon::ecal_photons
Definition: Photon.h:273
EcalClusterToolsT::e2x5Max
static float e2x5Max(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: EcalClusterTools.h:608
PositionCalc::Calculate_Location
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
Definition: PositionCalc.h:65
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
EcalClusterToolsT::covariances
static std::array< float, 3 > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
Definition: EcalClusterTools.h:962
PhotonProducer::usePrimaryVertex_
bool usePrimaryVertex_
Definition: PhotonProducer.cc:91
edm::ESHandle< CaloGeometry >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
reco::Photon::ShowerShape::hcalDepth1OverEcalBc
float hcalDepth1OverEcalBc
Definition: Photon.h:147
PhotonProducer::candidateP4type_
std::string candidateP4type_
Definition: PhotonProducer.cc:105
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
egamma::towersOf
std::vector< CaloTowerDetId > towersOf(reco::SuperCluster const &sc, CaloTowerConstituentsMap const &towerMap, HoeMode mode=HoeMode::SingleTower)
Definition: EgammaHadTower.cc:25
PhotonProducer::highEt_
double highEt_
Definition: PhotonProducer.cc:84
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::Photon::ShowerShape::hcalDepth2OverEcal
float hcalDepth2OverEcal
Definition: Photon.h:146
PhotonProducer::PhotonCollection_
std::string PhotonCollection_
Definition: PhotonProducer.cc:66
reco::Photon::ShowerShape::sigmaIetaIeta
float sigmaIetaIeta
Definition: Photon.h:139
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
reco::Photon::ShowerShape::e2x5
float e2x5
Definition: Photon.h:141
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
reco::Photon::FiducialFlags
Definition: Photon.h:93
EgammaTowerIsolation
Definition: EgammaTowerIsolation.h:197
PositionCalc
Definition: PositionCalc.h:29
createfilelist.int
int
Definition: createfilelist.py:10
EgHLTOffEleSelection_cfi.minR9
minR9
Definition: EgHLTOffEleSelection_cfi.py:22
p4
double p4[4]
Definition: TauolaWrapper.h:92
PhotonProducer::preselCutValuesEndcap_
std::vector< double > preselCutValuesEndcap_
Definition: PhotonProducer.cc:102
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DetId::Ecal
Definition: DetId.h:27
gedPhotons_cfi.isolationSumsCalculatorSet
isolationSumsCalculatorSet
Definition: gedPhotons_cfi.py:34
get
#define get
reco::Photon::IsolationVariables
Definition: Photon.h:358
conversions_cfi.hcalTowers
hcalTowers
Definition: conversions_cfi.py:21
PhotonProducer::severitiesexclEE_
std::vector< int > severitiesexclEE_
Definition: PhotonProducer.cc:79
PhotonProducer::photonIsolationCalculator_
PhotonIsolationCalculator photonIsolationCalculator_
Definition: PhotonProducer.cc:96
EcalClusterToolsT::e3x3
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: EcalClusterTools.h:519
reco::Photon
Definition: Photon.h:21
EcalPreshower
Definition: EcalSubdetector.h:10
PhotonEnergyCorrector::init
void init(const edm::EventSetup &theEventSetup)
Definition: PhotonEnergyCorrector.cc:60
PhotonProducer::vertexProducer_
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
Definition: PhotonProducer.cc:71
reco::Photon::ShowerShape::hcalTowersBehindClusters
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: Photon.h:149
reco::Photon::ShowerShape
Definition: Photon.h:137
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
gedPhotons_cfi.outputPhotonCollection
outputPhotonCollection
Definition: gedPhotons_cfi.py:30
PhotonEnergyCorrector::calculate
void calculate(edm::Event &evt, reco::Photon &, int subdet, const reco::VertexCollection &vtxcol, const edm::EventSetup &iSetup)
Definition: PhotonEnergyCorrector.cc:80
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
EcalClusterToolsT::e1x5
static float e1x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: EcalClusterTools.h:625
egamma::depth1HcalESum
double depth1HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
Definition: EgammaHadTower.cc:73
HLT_FULL_cff.full5x5_sigmaIetaIeta
full5x5_sigmaIetaIeta
Definition: HLT_FULL_cff.py:13706
reco::Photon::ShowerShape::hcalDepth1OverEcal
float hcalDepth1OverEcal
Definition: Photon.h:145
reco::Photon::regression1
Definition: Photon.h:273
EcalClusterToolsT::e5x5
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: EcalClusterTools.h:539
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
reco::Photon::MIPVariables
Definition: Photon.h:324
reco::Photon::ShowerShape::e3x3
float e3x3
Definition: Photon.h:142
electronIdCutBasedExt_cfi.sigmaEtaEta
sigmaEtaEta
Definition: electronIdCutBasedExt_cfi.py:123
PhotonProducer::posCalculator_
PositionCalc posCalculator_
Definition: PhotonProducer.cc:93
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:170
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
MaterialEffects_cfi.photonEnergy
photonEnergy
Definition: MaterialEffects_cfi.py:26
PhotonProducer::severitiesexclEB_
std::vector< int > severitiesexclEB_
Definition: PhotonProducer.cc:78
EgHLTOffHistBins_cfi.e2x5
e2x5
Definition: EgHLTOffHistBins_cfi.py:21
PhotonProducer::barrelEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
Definition: PhotonProducer.cc:68
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PhotonProducer::photonMIPHaloTagger_
PhotonMIPHaloTagger photonMIPHaloTagger_
Definition: PhotonProducer.cc:99
PhotonProducer::flagsexclEB_
std::vector< int > flagsexclEB_
Definition: PhotonProducer.cc:76
edm::InputTag
Definition: InputTag.h:15
reco::Photon::ShowerShape::e5x5
float e5x5
Definition: Photon.h:143