CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PhotonProducer Class Reference

#include <PhotonProducer.h>

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 35 of file PhotonProducer.h.

Constructor & Destructor Documentation

◆ PhotonProducer()

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

Definition at line 33 of file PhotonProducer.cc.

33  : photonEnergyCorrector_(config, consumesCollector()) {
34  // use onfiguration file to setup input/output collection names
35 
36  photonCoreProducer_ = consumes<reco::PhotonCoreCollection>(config.getParameter<edm::InputTag>("photonCoreProducer"));
37  barrelEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("barrelEcalHits"));
38  endcapEcalHits_ = consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("endcapEcalHits"));
39  vertexProducer_ = consumes<reco::VertexCollection>(config.getParameter<edm::InputTag>("primaryVertexProducer"));
40  hcalTowers_ = consumes<CaloTowerCollection>(config.getParameter<edm::InputTag>("hcalTowers"));
41  hOverEConeSize_ = config.getParameter<double>("hOverEConeSize");
42  highEt_ = config.getParameter<double>("highEt");
43  // R9 value to decide converted/unconverted
44  minR9Barrel_ = config.getParameter<double>("minR9Barrel");
45  minR9Endcap_ = config.getParameter<double>("minR9Endcap");
46  usePrimaryVertex_ = config.getParameter<bool>("usePrimaryVertex");
47  runMIPTagger_ = config.getParameter<bool>("runMIPTagger");
48 
49  candidateP4type_ = config.getParameter<std::string>("candidateP4type");
50 
51  edm::ParameterSet posCalcParameters = config.getParameter<edm::ParameterSet>("posCalcParameters");
53 
54  //AA
55  //Flags and Severities to be excluded from photon calculations
56  const std::vector<std::string> flagnamesEB =
57  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
58 
59  const std::vector<std::string> flagnamesEE =
60  config.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
61 
62  flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
63 
64  flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
65 
66  const std::vector<std::string> severitynamesEB =
67  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
68 
69  severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
70 
71  const std::vector<std::string> severitynamesEE =
72  config.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
73 
74  severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
75 
76  //AA
77 
78  //
79 
80  // Parameters for the position calculation:
81  // std::map<std::string,double> providedParameters;
82  // providedParameters.insert(std::make_pair("LogWeighted",config.getParameter<bool>("posCalc_logweight")));
83  //providedParameters.insert(std::make_pair("T0_barl",config.getParameter<double>("posCalc_t0_barl")));
84  //providedParameters.insert(std::make_pair("T0_endc",config.getParameter<double>("posCalc_t0_endc")));
85  //providedParameters.insert(std::make_pair("T0_endcPresh",config.getParameter<double>("posCalc_t0_endcPresh")));
86  //providedParameters.insert(std::make_pair("W0",config.getParameter<double>("posCalc_w0")));
87  //providedParameters.insert(std::make_pair("X0",config.getParameter<double>("posCalc_x0")));
88  //posCalculator_ = PositionCalc(providedParameters);
89  // cut values for pre-selection
90  preselCutValuesBarrel_.push_back(config.getParameter<double>("minSCEtBarrel"));
91  preselCutValuesBarrel_.push_back(config.getParameter<double>("maxHoverEBarrel"));
92  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetBarrel"));
93  preselCutValuesBarrel_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeBarrel"));
94  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalTowerSumEtOffsetBarrel"));
95  preselCutValuesBarrel_.push_back(config.getParameter<double>("hcalTowerSumEtSlopeBarrel"));
96  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackSolidConeBarrel"));
97  preselCutValuesBarrel_.push_back(config.getParameter<double>("nTrackHollowConeBarrel"));
98  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumSolidConeBarrel"));
99  preselCutValuesBarrel_.push_back(config.getParameter<double>("trackPtSumHollowConeBarrel"));
100  preselCutValuesBarrel_.push_back(config.getParameter<double>("sigmaIetaIetaCutBarrel"));
101  //
102  preselCutValuesEndcap_.push_back(config.getParameter<double>("minSCEtEndcap"));
103  preselCutValuesEndcap_.push_back(config.getParameter<double>("maxHoverEEndcap"));
104  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtOffsetEndcap"));
105  preselCutValuesEndcap_.push_back(config.getParameter<double>("ecalRecHitSumEtSlopeEndcap"));
106  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalTowerSumEtOffsetEndcap"));
107  preselCutValuesEndcap_.push_back(config.getParameter<double>("hcalTowerSumEtSlopeEndcap"));
108  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackSolidConeEndcap"));
109  preselCutValuesEndcap_.push_back(config.getParameter<double>("nTrackHollowConeEndcap"));
110  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumSolidConeEndcap"));
111  preselCutValuesEndcap_.push_back(config.getParameter<double>("trackPtSumHollowConeEndcap"));
112  preselCutValuesEndcap_.push_back(config.getParameter<double>("sigmaIetaIetaCutEndcap"));
113  //
114 
115  edm::ParameterSet isolationSumsCalculatorSet = config.getParameter<edm::ParameterSet>("isolationSumsCalculatorSet");
118 
119  edm::ParameterSet mipVariableSet = config.getParameter<edm::ParameterSet>("mipVariableSet");
120  photonMIPHaloTagger_.setup(mipVariableSet, consumesCollector());
121 
122  // Register the product
123  produces<reco::PhotonCollection>(PhotonCollection_);
124 }

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_, PhotonIsolationCalculator::setup(), PhotonMIPHaloTagger::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 213 of file PhotonProducer.cc.

223  {
224  // get the geometry from the event setup:
225  edm::ESHandle<CaloGeometry> caloGeomHandle;
226  es.get<CaloGeometryRecord>().get(caloGeomHandle);
227 
228  const CaloGeometry* geometry = caloGeomHandle.product();
229  const CaloSubdetectorGeometry* subDetGeometry = nullptr;
230  const CaloSubdetectorGeometry* geometryES = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
231  const EcalRecHitCollection* hits = nullptr;
232  std::vector<double> preselCutValues;
233  float minR9 = 0;
234 
236 
237  std::vector<int> flags_, severitiesexcl_;
238 
239  for (unsigned int lSC = 0; lSC < photonCoreHandle->size(); lSC++) {
240  reco::PhotonCoreRef coreRef(reco::PhotonCoreRef(photonCoreHandle, lSC));
241  reco::SuperClusterRef scRef = coreRef->superCluster();
242  iSC++;
243 
244  int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
245  subDetGeometry = caloGeomHandle->getSubdetectorGeometry(DetId::Ecal, subdet);
246 
247  if (subdet == EcalBarrel) {
248  preselCutValues = preselCutValuesBarrel_;
250  hits = ecalBarrelHits;
251  flags_ = flagsexclEB_;
252  severitiesexcl_ = severitiesexclEB_;
253  } else if (subdet == EcalEndcap) {
254  preselCutValues = preselCutValuesEndcap_;
256  hits = ecalEndcapHits;
257  flags_ = flagsexclEE_;
258  severitiesexcl_ = severitiesexclEE_;
259  } else {
260  edm::LogWarning("") << "PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
261  }
262  if (hits == nullptr)
263  continue;
264 
265  // SC energy preselection
266  if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0])
267  continue;
268  // calculate HoE
269 
270  EgammaTowerIsolation towerIso1(hOverEConeSize_, 0., 0., 1, &hcalTowers);
271  EgammaTowerIsolation towerIso2(hOverEConeSize_, 0., 0., 2, &hcalTowers);
272  double HoE1 = towerIso1.getTowerESum(&(*scRef)) / scRef->energy();
273  double HoE2 = towerIso2.getTowerESum(&(*scRef)) / scRef->energy();
274 
276  es.get<CaloGeometryRecord>().get(ctmaph);
277 
278  auto towersBehindCluster = egamma::towersOf(*scRef, *ctmaph);
279  float hcalDepth1OverEcalBc = egamma::depth1HcalESum(towersBehindCluster, hcalTowers) / scRef->energy();
280  float hcalDepth2OverEcalBc = egamma::depth2HcalESum(towersBehindCluster, hcalTowers) / scRef->energy();
281 
282  // recalculate position of seed BasicCluster taking shower depth for unconverted photon
283  math::XYZPoint unconvPos =
284  posCalculator_.Calculate_Location(scRef->seed()->hitsAndFractions(), hits, subDetGeometry, geometryES);
285 
286  float maxXtal = EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
287  //AA
288  //Change these to consider severity level of hits
289  float e1x5 = EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
290  float e2x5 = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
291  float e3x3 = EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
292  float e5x5 = EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
293  std::vector<float> cov = EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
294  std::vector<float> locCov = EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
295 
296  float sigmaEtaEta = sqrt(cov[0]);
297  float sigmaIetaIeta = sqrt(locCov[0]);
298  float r9 = e3x3 / (scRef->rawEnergy());
299 
300  float full5x5_maxXtal = noZS::EcalClusterTools::eMax(*(scRef->seed()), &(*hits));
301  //AA
302  //Change these to consider severity level of hits
303  float full5x5_e1x5 = noZS::EcalClusterTools::e1x5(*(scRef->seed()), &(*hits), &(*topology));
304  float full5x5_e2x5 = noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology));
305  float full5x5_e3x3 = noZS::EcalClusterTools::e3x3(*(scRef->seed()), &(*hits), &(*topology));
306  float full5x5_e5x5 = noZS::EcalClusterTools::e5x5(*(scRef->seed()), &(*hits), &(*topology));
307  std::vector<float> full5x5_cov =
308  noZS::EcalClusterTools::covariances(*(scRef->seed()), &(*hits), &(*topology), geometry);
309  std::vector<float> full5x5_locCov =
310  noZS::EcalClusterTools::localCovariances(*(scRef->seed()), &(*hits), &(*topology));
311 
312  float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]);
313  float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]);
314 
315  // compute position of ECAL shower
316  math::XYZPoint caloPosition;
317  if (r9 > minR9) {
318  caloPosition = unconvPos;
319  } else {
320  caloPosition = scRef->position();
321  }
322 
324  double photonEnergy = 1.;
325  math::XYZPoint vtx(0., 0., 0.);
326  if (!vertexCollection.empty())
327  vtx = vertexCollection.begin()->position();
328  // compute momentum vector of photon from primary vertex and cluster position
329  math::XYZVector direction = caloPosition - vtx;
330  math::XYZVector momentum = direction.unit();
331 
332  // Create dummy candidate with unit momentum and zero energy to allow setting of all variables. The energy is set for last.
333  math::XYZTLorentzVectorD p4(momentum.x(), momentum.y(), momentum.z(), photonEnergy);
334  reco::Photon newCandidate(p4, caloPosition, coreRef, vtx);
335 
336  // Calculate fiducial flags and isolation variable. Blocked are filled from the isolationCalculator
337  reco::Photon::FiducialFlags fiducialFlags;
338  reco::Photon::IsolationVariables isolVarR03, isolVarR04;
339  photonIsolationCalculator_.calculate(&newCandidate, evt, es, fiducialFlags, isolVarR04, isolVarR03);
340  newCandidate.setFiducialVolumeFlags(fiducialFlags);
341  newCandidate.setIsolationVariables(isolVarR04, isolVarR03);
342 
344  reco::Photon::ShowerShape showerShape;
345  showerShape.e1x5 = e1x5;
346  showerShape.e2x5 = e2x5;
347  showerShape.e3x3 = e3x3;
348  showerShape.e5x5 = e5x5;
349  showerShape.maxEnergyXtal = maxXtal;
350  showerShape.sigmaEtaEta = sigmaEtaEta;
351  showerShape.sigmaIetaIeta = sigmaIetaIeta;
352  showerShape.hcalDepth1OverEcal = HoE1;
353  showerShape.hcalDepth2OverEcal = HoE2;
354  showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc;
355  showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc;
356  showerShape.hcalTowersBehindClusters = towersBehindCluster;
357  newCandidate.setShowerShapeVariables(showerShape);
358 
360  reco::Photon::ShowerShape full5x5_showerShape;
361  full5x5_showerShape.e1x5 = full5x5_e1x5;
362  full5x5_showerShape.e2x5 = full5x5_e2x5;
363  full5x5_showerShape.e3x3 = full5x5_e3x3;
364  full5x5_showerShape.e5x5 = full5x5_e5x5;
365  full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal;
366  full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta;
367  full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta;
368  newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape);
369 
372  // Photon candidate takes by default (set in photons_cfi.py) a 4-momentum derived from the ecal photon-specific corrections.
373  photonEnergyCorrector_.calculate(evt, newCandidate, subdet, vertexCollection, es);
374  if (candidateP4type_ == "fromEcalEnergy") {
375  newCandidate.setP4(newCandidate.p4(reco::Photon::ecal_photons));
376  newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
377  } else if (candidateP4type_ == "fromRegression") {
378  newCandidate.setP4(newCandidate.p4(reco::Photon::regression1));
379  newCandidate.setCandidateP4type(reco::Photon::regression1);
380  }
381 
382  // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger
384  if (subdet == EcalBarrel && runMIPTagger_) {
385  photonMIPHaloTagger_.MIPcalculate(&newCandidate, evt, es, mipVar);
386  newCandidate.setMIPVariables(mipVar);
387  }
388 
390  bool isLooseEM = true;
391  if (newCandidate.pt() < highEt_) {
392  if (newCandidate.hadronicOverEm() >= preselCutValues[1])
393  isLooseEM = false;
394  if (newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2] + preselCutValues[3] * newCandidate.pt())
395  isLooseEM = false;
396  if (newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4] + preselCutValues[5] * newCandidate.pt())
397  isLooseEM = false;
398  if (newCandidate.nTrkSolidConeDR04() > int(preselCutValues[6]))
399  isLooseEM = false;
400  if (newCandidate.nTrkHollowConeDR04() > int(preselCutValues[7]))
401  isLooseEM = false;
402  if (newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8])
403  isLooseEM = false;
404  if (newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9])
405  isLooseEM = false;
406  if (newCandidate.sigmaIetaIeta() > preselCutValues[10])
407  isLooseEM = false;
408  }
409 
410  if (isLooseEM)
411  outputPhotonCollection.push_back(newCandidate);
412  }
413 }

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, 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 126 of file PhotonProducer.cc.

126  {
127  using namespace edm;
128  // nEvt_++;
129 
131  auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
132 
133  // Get the PhotonCore collection
134  bool validPhotonCoreHandle = true;
135  Handle<reco::PhotonCoreCollection> photonCoreHandle;
136  theEvent.getByToken(photonCoreProducer_, photonCoreHandle);
137  if (!photonCoreHandle.isValid()) {
138  edm::LogError("PhotonProducer") << "Error! Can't get the photonCoreProducer";
139  validPhotonCoreHandle = false;
140  }
141 
142  // Get EcalRecHits
143  bool validEcalRecHits = true;
144  Handle<EcalRecHitCollection> barrelHitHandle;
146  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
147  if (!barrelHitHandle.isValid()) {
148  edm::LogError("PhotonProducer") << "Error! Can't get the barrelEcalHits";
149  validEcalRecHits = false;
150  }
151  if (validEcalRecHits)
152  barrelRecHits = *(barrelHitHandle.product());
153 
154  Handle<EcalRecHitCollection> endcapHitHandle;
155  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
157  if (!endcapHitHandle.isValid()) {
158  edm::LogError("PhotonProducer") << "Error! Can't get the endcapEcalHits";
159  validEcalRecHits = false;
160  }
161  if (validEcalRecHits)
162  endcapRecHits = *(endcapHitHandle.product());
163 
164  //AA
165  //Get the severity level object
167  theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
168  //
169 
170  // get Hcal towers collection
171  auto const& hcalTowers = theEvent.get(hcalTowers_);
172 
173  edm::ESHandle<CaloTopology> pTopology;
174  theEventSetup.get<CaloTopologyRecord>().get(pTopology);
175  const CaloTopology* topology = pTopology.product();
176 
177  // Get the primary event vertex
178  Handle<reco::VertexCollection> vertexHandle;
180  bool validVertex = true;
181  if (usePrimaryVertex_) {
182  theEvent.getByToken(vertexProducer_, vertexHandle);
183  if (!vertexHandle.isValid()) {
184  edm::LogWarning("PhotonProducer") << "Error! Can't get the product primary Vertex Collection "
185  << "\n";
186  validVertex = false;
187  }
188  if (validVertex)
189  vertexCollection = *(vertexHandle.product());
190  }
191 
192  int iSC = 0; // index in photon collection
193  // Loop over barrel and endcap SC collections and fill the photon collection
194  if (validPhotonCoreHandle)
195  fillPhotonCollection(theEvent,
196  theEventSetup,
197  photonCoreHandle,
198  topology,
199  &barrelRecHits,
200  &endcapRecHits,
201  hcalTowers,
204  iSC,
205  sevLv.product());
206 
207  // put the product in the event
208  edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n";
209  outputPhotonCollection_p->assign(outputPhotonCollection.begin(), outputPhotonCollection.end());
210  theEvent.put(std::move(outputPhotonCollection_p), PhotonCollection_);
211 }

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(), ecaldqm::topology(), usePrimaryVertex_, spclusmultinvestigator_cfi::vertexCollection, and vertexProducer_.

Member Data Documentation

◆ barrelEcalHits_

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

Definition at line 57 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ candidateP4type_

std::string PhotonProducer::candidateP4type_
private

Definition at line 94 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ endcapEcalHits_

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

Definition at line 58 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ flagsexclEB_

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

Definition at line 65 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ flagsexclEE_

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

Definition at line 66 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ hcalTowers_

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

Definition at line 59 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ highEt_

double PhotonProducer::highEt_
private

Definition at line 73 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ hOverEConeSize_

double PhotonProducer::hOverEConeSize_
private

Definition at line 70 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ maxHOverE_

double PhotonProducer::maxHOverE_
private

Definition at line 71 of file PhotonProducer.h.

◆ minR9Barrel_

double PhotonProducer::minR9Barrel_
private

Definition at line 74 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ minR9Endcap_

double PhotonProducer::minR9Endcap_
private

Definition at line 75 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ minSCEt_

double PhotonProducer::minSCEt_
private

Definition at line 72 of file PhotonProducer.h.

◆ PhotonCollection_

std::string PhotonProducer::PhotonCollection_
private

Definition at line 55 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ photonCoreProducer_

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

Definition at line 56 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ photonEnergyCorrector_

PhotonEnergyCorrector PhotonProducer::photonEnergyCorrector_
private

Definition at line 93 of file PhotonProducer.h.

Referenced by fillPhotonCollection().

◆ photonIsolationCalculator_

PhotonIsolationCalculator PhotonProducer::photonIsolationCalculator_
private

Definition at line 85 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ photonMIPHaloTagger_

PhotonMIPHaloTagger PhotonProducer::photonMIPHaloTagger_
private

Definition at line 88 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ posCalculator_

PositionCalc PhotonProducer::posCalculator_
private

Definition at line 82 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ preselCutValuesBarrel_

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

Definition at line 90 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ preselCutValuesEndcap_

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

Definition at line 91 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ runMIPTagger_

bool PhotonProducer::runMIPTagger_
private

Definition at line 76 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ severitiesexclEB_

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

Definition at line 67 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ severitiesexclEE_

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

Definition at line 68 of file PhotonProducer.h.

Referenced by fillPhotonCollection(), and PhotonProducer().

◆ usePrimaryVertex_

bool PhotonProducer::usePrimaryVertex_
private

Definition at line 80 of file PhotonProducer.h.

Referenced by PhotonProducer(), and produce().

◆ validConversions_

bool PhotonProducer::validConversions_
private

Definition at line 78 of file PhotonProducer.h.

◆ validPixelSeeds_

bool PhotonProducer::validPixelSeeds_
private

Definition at line 84 of file PhotonProducer.h.

◆ vertexProducer_

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

Definition at line 60 of file PhotonProducer.h.

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.h:75
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:387
PhotonMIPHaloTagger::setup
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
Definition: PhotonMIPHaloTagger.cc:47
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:43
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
PhotonProducer::hcalTowers_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers_
Definition: PhotonProducer.h:59
PhotonProducer::flagsexclEE_
std::vector< int > flagsexclEE_
Definition: PhotonProducer.h:66
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.h:56
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:213
PhotonProducer::hOverEConeSize_
double hOverEConeSize_
Definition: PhotonProducer.h:70
HLT_FULL_cff.endcapRecHits
endcapRecHits
Definition: HLT_FULL_cff.py:14981
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
EcalClusterToolsT::covariances
static std::vector< float > covariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
Definition: EcalClusterTools.h:957
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:14984
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:550
PhotonProducer::runMIPTagger_
bool runMIPTagger_
Definition: PhotonProducer.h:76
edm::SortedCollection< EcalRecHit >
PhotonProducer::minR9Barrel_
double minR9Barrel_
Definition: PhotonProducer.h:74
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
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.h:90
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:57
PhotonProducer::photonEnergyCorrector_
PhotonEnergyCorrector photonEnergyCorrector_
Definition: PhotonProducer.h:93
PhotonProducer::endcapEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: PhotonProducer.h:58
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:603
ecaldqm::topology
const CaloTopology * topology(nullptr)
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
PhotonProducer::usePrimaryVertex_
bool usePrimaryVertex_
Definition: PhotonProducer.h:80
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.h:94
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.h:73
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.h:55
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.h:91
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.h:68
PhotonProducer::photonIsolationCalculator_
PhotonIsolationCalculator photonIsolationCalculator_
Definition: PhotonProducer.h:85
EcalClusterToolsT::e3x3
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: EcalClusterTools.h:514
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.h:60
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:620
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:13768
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:534
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.h:82
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:179
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.h:67
EgHLTOffHistBins_cfi.e2x5
e2x5
Definition: EgHLTOffHistBins_cfi.py:21
PhotonProducer::barrelEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
Definition: PhotonProducer.h:57
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PhotonProducer::photonMIPHaloTagger_
PhotonMIPHaloTagger photonMIPHaloTagger_
Definition: PhotonProducer.h:88
PhotonProducer::flagsexclEB_
std::vector< int > flagsexclEB_
Definition: PhotonProducer.h:65
edm::InputTag
Definition: InputTag.h:15
EcalClusterToolsT::localCovariances
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
Definition: EcalClusterTools.h:1034
reco::Photon::ShowerShape::e5x5
float e5x5
Definition: Photon.h:143