CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PhotonIDValueMapProducer Class Reference
Inheritance diagram for PhotonIDValueMapProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PhotonIDValueMapProducer (const edm::ParameterSet &)
 
 ~PhotonIDValueMapProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

float computeWorstPFChargedIsolation (const reco::Photon &photon, const std::vector< edm::Ptr< reco::Candidate >> &pfCands, const reco::VertexCollection &vertices, const reco::Vertex &pv, unsigned char options, bool isAOD) const
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const edm::EDGetTokenT< EcalRecHitCollectionebRecHits_
 
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
const edm::EDGetTokenT< EcalRecHitCollectioneeRecHits_
 
const edm::EDGetTokenT< EcalRecHitCollectionesRecHits_
 
const bool isAOD_
 
const edm::EDGetToken particleBasedIsolationToken_
 
const edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandsToken_
 
const edm::EDGetTokenT< edm::View< reco::Photon > > src_
 
const bool usesES_
 
const edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 82 of file PhotonIDValueMapProducer.cc.

Constructor & Destructor Documentation

◆ PhotonIDValueMapProducer()

PhotonIDValueMapProducer::PhotonIDValueMapProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 161 of file PhotonIDValueMapProducer.cc.

References edm::EDConsumerBase::consumesCollector().

162  : usesES_(!cfg.getParameter<edm::InputTag>("esReducedRecHitCollection").label().empty()),
163  src_(consumes(cfg.getParameter<edm::InputTag>("src"))),
164  ebRecHits_(consumes(cfg.getParameter<edm::InputTag>("ebReducedRecHitCollection"))),
165  eeRecHits_(consumes(cfg.getParameter<edm::InputTag>("eeReducedRecHitCollection"))),
166  esRecHits_(consumes(cfg.getParameter<edm::InputTag>("esReducedRecHitCollection"))),
167  vtxToken_(consumes(cfg.getParameter<edm::InputTag>("vertices"))),
168  pfCandsToken_(consumes(cfg.getParameter<edm::InputTag>("pfCandidates"))),
169  particleBasedIsolationToken_(mayConsume<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
170  cfg.getParameter<edm::InputTag>("particleBasedIsolation")) /* ...only for AOD... */),
172  isAOD_(cfg.getParameter<bool>("isAOD")) {
173  // Declare producibles
174  for (int i = 0; i < nVars_; ++i)
176 }
std::string const & label() const
Definition: InputTag.h:36
const std::string names[nVars_]
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHits_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHits_
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
const edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandsToken_
const edm::EDGetTokenT< EcalRecHitCollection > esRecHits_
constexpr int nVars_
const edm::EDGetToken particleBasedIsolationToken_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::View< reco::Photon > > src_

◆ ~PhotonIDValueMapProducer()

PhotonIDValueMapProducer::~PhotonIDValueMapProducer ( )
inlineoverride

Definition at line 85 of file PhotonIDValueMapProducer.cc.

85 {}

Member Function Documentation

◆ computeWorstPFChargedIsolation()

float PhotonIDValueMapProducer::computeWorstPFChargedIsolation ( const reco::Photon photon,
const std::vector< edm::Ptr< reco::Candidate >> &  pfCands,
const reco::VertexCollection vertices,
const reco::Vertex pv,
unsigned char  options,
bool  isAOD 
) const
private

Definition at line 369 of file PhotonIDValueMapProducer.cc.

References coneSizeDR2, HLTMuonOfflineAnalyzer_cfi::deltaR2, DR_VETO, dRveto2Barrel, dRveto2Endcap, PVValHelper::dxy, dxyMax, PVValHelper::dz, dzMax, reco::PFCandidate::h, HLTEGTnPMonitor_cfi::isAOD, SiStripPI::max, displacedMuons_cfi::photon, PT_MIN_THRESH, ptMin, MetAnalyzer::pv(), PV_CONSTRAINT, AlignmentTracksFromVertexSelector_cfi::vertices, and extraflags_cff::vtx.

Referenced by produce().

374  {
375  float worstIsolation = 0.0;
376 
377  const float dRveto2 = photon.isEB() ? dRveto2Barrel : dRveto2Endcap;
378 
379  std::vector<CachingPtrCandidate> chargedCands;
380  chargedCands.reserve(pfCands.size());
381  for (auto const& aCand : pfCands) {
382  // require that PFCandidate is a charged hadron
383  reco::PFCandidate::ParticleType thisCandidateType = getCandidatePdgId(&*aCand, isAOD);
384  if (thisCandidateType != reco::PFCandidate::h)
385  continue;
386 
387  if ((options & PT_MIN_THRESH) && aCand.get()->pt() < ptMin)
388  continue;
389 
390  chargedCands.emplace_back(&*aCand, isAOD);
391  }
392 
393  // Calculate isolation sum separately for each vertex
394  for (unsigned int ivtx = 0; ivtx < vertices.size(); ++ivtx) {
395  // Shift the photon according to the vertex
396  const reco::VertexRef vtx(&vertices, ivtx);
397  math::XYZVector phoWrtVtx(photon.superCluster()->x() - vtx->x(),
398  photon.superCluster()->y() - vtx->y(),
399  photon.superCluster()->z() - vtx->z());
400 
401  const float phoWrtVtxPhi = phoWrtVtx.phi();
402  const float phoWrtVtxEta = phoWrtVtx.eta();
403 
404  float sum = 0;
405  // Loop over the PFCandidates
406  for (auto const& aCCand : chargedCands) {
407  auto iCand = aCCand.candidate;
408 
409  float dR2 = deltaR2(phoWrtVtxEta, phoWrtVtxPhi, iCand->eta(), iCand->phi());
410  if (dR2 > coneSizeDR2 || (options & DR_VETO && dR2 < dRveto2))
411  continue;
412 
413  float dxy = -999;
414  float dz = -999;
415  if (options & PV_CONSTRAINT)
416  getImpactParameters(aCCand, pv, dxy, dz);
417  else
418  getImpactParameters(aCCand, *vtx, dxy, dz);
419 
420  if (fabs(dxy) > dxyMax || fabs(dz) > dzMax)
421  continue;
422 
423  sum += iCand->pt();
424  }
425 
426  worstIsolation = std::max(sum, worstIsolation);
427  }
428 
429  return worstIsolation;
430 }
const unsigned char DR_VETO
ParticleType
particle types
Definition: PFCandidate.h:44
const unsigned char PV_CONSTRAINT
constexpr float ptMin
constexpr float dRveto2Endcap
constexpr float coneSizeDR2
constexpr float dzMax
const unsigned char PT_MIN_THRESH
constexpr float dxyMax
def pv(vc)
Definition: MetAnalyzer.py:7
constexpr float dRveto2Barrel
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31

◆ fillDescriptions()

void PhotonIDValueMapProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 353 of file PhotonIDValueMapProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v12_cff::InputTag.

353  {
354  // photonIDValueMapProducer
356  desc.add<edm::InputTag>("particleBasedIsolation", edm::InputTag("particleBasedIsolation", "gedPhotons"));
357  desc.add<edm::InputTag>("src", edm::InputTag("slimmedPhotons", "", "@skipCurrentProcess"));
358  desc.add<edm::InputTag>("esReducedRecHitCollection", edm::InputTag("reducedEgamma", "reducedESRecHits"));
359  desc.add<edm::InputTag>("ebReducedRecHitCollection", edm::InputTag("reducedEgamma", "reducedEBRecHits"));
360  desc.add<edm::InputTag>("eeReducedRecHitCollection", edm::InputTag("reducedEgamma", "reducedEERecHits"));
361  desc.add<edm::InputTag>("pfCandidates", edm::InputTag("packedPFCandidates"));
362  desc.add<edm::InputTag>("vertices", edm::InputTag("offlineSlimmedPrimaryVertices"));
363  desc.add<bool>("isAOD", false);
364  descriptions.add("photonIDValueMapProducer", desc);
365 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void PhotonIDValueMapProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 178 of file PhotonIDValueMapProducer.cc.

References computeWorstPFChargedIsolation(), coneSizeDR2, HLTMuonOfflineAnalyzer_cfi::deltaR2, DR_VETO, PVValHelper::dxy, dxyMax, PVValHelper::dz, dzMax, ebRecHits_, ecalClusterToolsESGetTokens_, eeRecHits_, mps_fire::end, esRecHits_, Exception, f, trigObjTnPSource_cfi::filler, reco::PFCandidate::gamma, EcalClusterLazyToolsBase::ESGetTokens::get(), reco::PFCandidate::h, reco::PFCandidate::h0, mps_fire::i, iEvent, isAOD_, edm::isNotFinite(), eostools::move(), names, nVars_, particleBasedIsolationToken_, packedPFCandidateRefMixer_cfi::pf, pfCandsToken_, PT_MIN_THRESH, MetAnalyzer::pv(), PV_CONSTRAINT, fileCollector::seed, mathSSE::sqrt(), TrackRefitter_38T_cff::src, src_, ctpps_dqm_sourceclient-live_cfg::test, usesES_, AlignmentTracksFromVertexSelector_cfi::vertices, and vtxToken_.

178  {
179  // Get the handles
180  auto src = iEvent.getHandle(src_);
181  auto vertices = iEvent.getHandle(vtxToken_);
182  auto pfCandsHandle = iEvent.getHandle(pfCandsToken_);
183 
185  if (isAOD_) { // this exists only in AOD
186  iEvent.getByToken(particleBasedIsolationToken_, particleBasedIsolationMap);
187  } else if (!src->empty()) {
188  edm::Ptr<pat::Photon> test(src->ptrAt(0));
189  if (test.isNull() || !test.isAvailable()) {
190  throw cms::Exception("InvalidConfiguration")
191  << "DataFormat is detected as miniAOD but cannot cast to pat::Photon!";
192  }
193  }
194 
195  // Configure Lazy Tools, which will compute 5x5 quantities
196  auto const& ecalClusterToolsESData = ecalClusterToolsESGetTokens_.get(iSetup);
197  auto lazyToolnoZS =
199  : noZS::EcalClusterLazyTools(iEvent, ecalClusterToolsESData, ebRecHits_, eeRecHits_);
200 
201  // Get PV
202  if (vertices->empty())
203  return; // skip the event if no PV found
204  const reco::Vertex& pv = vertices->front();
205 
206  std::vector<float> vars[nVars_];
207 
208  std::vector<edm::Ptr<reco::Candidate>> pfCandNoNaN;
209  for (const auto& pf : pfCandsHandle->ptrs()) {
210  if (edm::isNotFinite(pf->pt())) {
211  edm::LogWarning("PhotonIDValueMapProducer") << "PF candidate pT is NaN, skipping, see issue #39110" << std::endl;
212  } else {
213  pfCandNoNaN.push_back(pf);
214  }
215  }
216 
217  // reco::Photon::superCluster() is virtual so we can exploit polymorphism
218  for (auto const& iPho : src->ptrs()) {
219  //
220  // Compute full 5x5 quantities
221  //
222  const auto& seed = *(iPho->superCluster()->seed());
223 
224  // For full5x5_sigmaIetaIeta, for 720 we use: lazy tools for AOD,
225  // and userFloats or lazy tools for miniAOD. From some point in 72X and on, one can
226  // retrieve the full5x5 directly from the object with ->full5x5_sigmaIetaIeta()
227  // for both formats.
228  const auto& vCov = lazyToolnoZS.localCovariances(seed);
229  vars[0].push_back(edm::isNotFinite(vCov[0]) ? 0. : sqrt(vCov[0]));
230  vars[1].push_back(vCov[1]);
231  vars[2].push_back(lazyToolnoZS.e1x3(seed));
232  vars[3].push_back(lazyToolnoZS.e2x2(seed));
233  vars[4].push_back(lazyToolnoZS.e2x5Max(seed));
234  vars[5].push_back(lazyToolnoZS.e5x5(seed));
235  vars[6].push_back(lazyToolnoZS.eseffsirir(*(iPho->superCluster())));
236  vars[7].push_back(vars[2].back() / vars[5].back());
237  vars[8].push_back(vars[3].back() / vars[5].back());
238  vars[9].push_back(vars[4].back() / vars[5].back());
239 
240  //
241  // Compute absolute uncorrected isolations with footprint removal
242  //
243 
244  // First, find photon direction with respect to the good PV
245  math::XYZVector phoWrtVtx(
246  iPho->superCluster()->x() - pv.x(), iPho->superCluster()->y() - pv.y(), iPho->superCluster()->z() - pv.z());
247 
248  // isolation sums
249  float chargedIsoSum = 0.;
250  float neutralHadronIsoSum = 0.;
251  float photonIsoSum = 0.;
252 
253  // Loop over nan-free PF candidates
254  for (auto const& iCand : pfCandNoNaN) {
255  // Here, the type will be a simple reco::Candidate. We cast it
256  // for full PFCandidate or PackedCandidate below as necessary
257 
258  // One would think that we should check that this iCand from the
259  // generic PF collection is not identical to the iPho photon for
260  // which we are computing the isolations. However, it turns out to
261  // be unnecessary. Below, in the function isInFootprint(), we drop
262  // this iCand if it is in the footprint, and this always removes
263  // the iCand if it matches the iPho. The explicit check at this
264  // point is not totally trivial because of non-triviality of
265  // implementation of this check for miniAOD (PackedCandidates of
266  // the PF collection do not contain the supercluser link, so can't
267  // use that).
268  //
269  // if( isAOD_ ) {
270  // if( ((const edm::Ptr<reco::PFCandidate>)iCand)->superClusterRef() == iPho->superCluster() )
271  // continue;
272  // }
273 
274  // Check if this candidate is within the isolation cone
275  float dR2 = deltaR2(phoWrtVtx.Eta(), phoWrtVtx.Phi(), iCand->eta(), iCand->phi());
276  if (dR2 > coneSizeDR2)
277  continue;
278 
279  // Check if this candidate is not in the footprint
280  if (isAOD_) {
281  if (isInFootprint((*particleBasedIsolationMap)[iPho], iCand))
282  continue;
283  } else {
285  if (isInFootprint(patPhotonPtr->associatedPackedPFCandidates(), iCand))
286  continue;
287  }
288 
289  // Find candidate type
290  reco::PFCandidate::ParticleType thisCandidateType = getCandidatePdgId(&*iCand, isAOD_);
291 
292  // Increment the appropriate isolation sum
293  if (thisCandidateType == reco::PFCandidate::h) {
294  // for charged hadrons, additionally check consistency
295  // with the PV
296  float dxy = -999;
297  float dz = -999;
298 
299  getImpactParameters(CachingPtrCandidate(&*iCand, isAOD_), pv, dxy, dz);
300 
301  if (fabs(dxy) > dxyMax || fabs(dz) > dzMax)
302  continue;
303 
304  // The candidate is eligible, increment the isolaiton
305  chargedIsoSum += iCand->pt();
306  }
307 
308  if (thisCandidateType == reco::PFCandidate::h0)
309  neutralHadronIsoSum += iCand->pt();
310 
311  if (thisCandidateType == reco::PFCandidate::gamma)
312  photonIsoSum += iCand->pt();
313  }
314 
315  vars[10].push_back(chargedIsoSum);
316  vars[11].push_back(neutralHadronIsoSum);
317  vars[12].push_back(photonIsoSum);
318 
319  // Worst isolation computed with no vetos or ptMin cut, as in Run 1 Hgg code.
320  unsigned char options = 0;
321  vars[13].push_back(computeWorstPFChargedIsolation(*iPho, pfCandNoNaN, *vertices, pv, options, isAOD_));
322 
323  // Worst isolation computed with cone vetos and a ptMin cut, as in Run 2 Hgg code.
325  vars[14].push_back(computeWorstPFChargedIsolation(*iPho, pfCandNoNaN, *vertices, pv, options, isAOD_));
326 
327  // Like before, but adding primary vertex constraint
329  vars[15].push_back(computeWorstPFChargedIsolation(*iPho, pfCandNoNaN, *vertices, pv, options, isAOD_));
330 
331  // PFCluster Isolations
332  vars[16].push_back(iPho->trkSumPtSolidConeDR04());
333  if (isAOD_) {
334  vars[17].push_back(0.f);
335  vars[18].push_back(0.f);
336  } else {
338  vars[17].push_back(patPhotonPtr->hcalPFClusterIso());
339  vars[18].push_back(patPhotonPtr->ecalPFClusterIso());
340  }
341  }
342 
343  // write the value maps
344  for (int i = 0; i < nVars_; ++i) {
345  auto valMap = std::make_unique<edm::ValueMap<float>>();
346  typename edm::ValueMap<float>::Filler filler(*valMap);
347  filler.insert(src, vars[i].begin(), vars[i].end());
348  filler.fill();
349  iEvent.put(std::move(valMap), names[i]);
350  }
351 }
const unsigned char DR_VETO
ParticleType
particle types
Definition: PFCandidate.h:44
const unsigned char PV_CONSTRAINT
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
constexpr float coneSizeDR2
EcalClusterLazyToolsT< noZS::EcalClusterTools > EcalClusterLazyTools
const std::string names[nVars_]
constexpr float dzMax
const unsigned char PT_MIN_THRESH
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHits_
ESData get(edm::EventSetup const &eventSetup) const
float computeWorstPFChargedIsolation(const reco::Photon &photon, const std::vector< edm::Ptr< reco::Candidate >> &pfCands, const reco::VertexCollection &vertices, const reco::Vertex &pv, unsigned char options, bool isAOD) const
int iEvent
Definition: GenABIO.cc:224
constexpr float dxyMax
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
T sqrt(T t)
Definition: SSEVec.h:19
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHits_
def pv(vc)
Definition: MetAnalyzer.py:7
double f[11][100]
const edm::EDGetTokenT< reco::VertexCollection > vtxToken_
const edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandsToken_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const edm::EDGetTokenT< EcalRecHitCollection > esRecHits_
edm::Ptr< pat::Photon > patPhotonPtr
constexpr int nVars_
const edm::EDGetToken particleBasedIsolationToken_
vars
Definition: DeepTauId.cc:30
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< edm::View< reco::Photon > > src_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ ebRecHits_

const edm::EDGetTokenT<EcalRecHitCollection> PhotonIDValueMapProducer::ebRecHits_
private

Definition at line 110 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens PhotonIDValueMapProducer::ecalClusterToolsESGetTokens_
private

Definition at line 117 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ eeRecHits_

const edm::EDGetTokenT<EcalRecHitCollection> PhotonIDValueMapProducer::eeRecHits_
private

Definition at line 111 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ esRecHits_

const edm::EDGetTokenT<EcalRecHitCollection> PhotonIDValueMapProducer::esRecHits_
private

Definition at line 112 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ isAOD_

const bool PhotonIDValueMapProducer::isAOD_
private

Definition at line 119 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ particleBasedIsolationToken_

const edm::EDGetToken PhotonIDValueMapProducer::particleBasedIsolationToken_
private

Definition at line 115 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ pfCandsToken_

const edm::EDGetTokenT<edm::View<reco::Candidate> > PhotonIDValueMapProducer::pfCandsToken_
private

Definition at line 114 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ src_

const edm::EDGetTokenT<edm::View<reco::Photon> > PhotonIDValueMapProducer::src_
private

Definition at line 109 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ usesES_

const bool PhotonIDValueMapProducer::usesES_
private

Definition at line 106 of file PhotonIDValueMapProducer.cc.

Referenced by produce().

◆ vtxToken_

const edm::EDGetTokenT<reco::VertexCollection> PhotonIDValueMapProducer::vtxToken_
private

Definition at line 113 of file PhotonIDValueMapProducer.cc.

Referenced by produce().