CMS 3D CMS Logo

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

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
 EgammaIsoHcalDetIdCollectionProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::EDGetTokenT< reco::GsfElectronCollectionelesToken_
 
EGHcalRecHitSelector hcalHitSelector_
 
std::string interestingDetIdCollection_
 
float minEleEt_
 
float minPhoEt_
 
float minSCEt_
 
const edm::EDGetTokenT< reco::PhotonCollectionphosToken_
 
const edm::EDGetTokenT< HBHERecHitCollectionrecHitsToken_
 
const edm::EDGetTokenT< reco::SuperClusterCollectionsuperClustersToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Original author: Sam Harper (RAL)

Make a collection of detids to be kept tipically in a AOD rechit collection Modified from the ECAL version "InterestingDetIdCollectionProducer" to be HCAL

Definition at line 30 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Constructor & Destructor Documentation

◆ EgammaIsoHcalDetIdCollectionProducer()

EgammaIsoHcalDetIdCollectionProducer::EgammaIsoHcalDetIdCollectionProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 57 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References edm::ParameterSet::getParameter().

58  : recHitsToken_{consumes(iConfig.getParameter<edm::InputTag>("recHitsLabel"))},
59  superClustersToken_{consumes(iConfig.getParameter<edm::InputTag>("superClustersLabel"))},
60  elesToken_{consumes(iConfig.getParameter<edm::InputTag>("elesLabel"))},
61  phosToken_{consumes(iConfig.getParameter<edm::InputTag>("phosLabel"))},
62  hcalHitSelector_(iConfig.getParameter<edm::ParameterSet>("hitSelection"), consumesCollector()) {
63  minSCEt_ = iConfig.getParameter<double>("minSCEt");
64  minEleEt_ = iConfig.getParameter<double>("minEleEt");
65  minPhoEt_ = iConfig.getParameter<double>("minPhoEt");
66 
67  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
68 
69  //register your products
70  produces<DetIdCollection>(interestingDetIdCollection_);
71 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
const edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
const edm::EDGetTokenT< reco::PhotonCollection > phosToken_
const edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_

Member Function Documentation

◆ beginRun()

void EgammaIsoHcalDetIdCollectionProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
final

Definition at line 87 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References hcalHitSelector_, and EGHcalRecHitSelector::setup().

87  {
88  hcalHitSelector_.setup(iSetup);
89 }
void setup(const edm::EventSetup &iSetup)

◆ fillDescriptions()

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

Definition at line 73 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, EGHcalRecHitSelector::makePSetDescription(), and AlCaHLTBitMon_QueryRunRegistry::string.

73  {
75  desc.add<edm::InputTag>("recHitsLabel", edm::InputTag("hbhereco"));
76  desc.add<edm::InputTag>("elesLabel", edm::InputTag("gedGsfElectrons"));
77  desc.add<edm::InputTag>("phosLabel", edm::InputTag("gedPhotons"));
78  desc.add<edm::InputTag>("superClustersLabel", edm::InputTag("particleFlowEGamma"));
79  desc.add<double>("minSCEt", 20);
80  desc.add<double>("minEleEt", 20);
81  desc.add<double>("minPhoEt", 20);
82  desc.add<std::string>("interestingDetIdCollection", "");
84  descriptions.add(("interestingGedEgammaIsoHCALDetId"), desc);
85 }
static edm::ParameterSetDescription makePSetDescription()
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void EgammaIsoHcalDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 92 of file EgammaIsoHcalDetIdCollectionProducer.cc.

References EGHcalRecHitSelector::addDetIds(), hltEgammaEleL1TrkIsoL1Seeded_cfi::eles, elesToken_, hcalHitSelector_, iEvent, interestingDetIdCollection_, minEleEt_, minPhoEt_, minSCEt_, eostools::move(), phosToken_, FastTrackerRecHitMaskProducer_cfi::recHits, recHitsToken_, funct::sin(), jetUpdater_cfi::sort, HLT_2023v11_cff::superClusters, superClustersToken_, and tier0::unique().

92  {
93  auto superClusters = iEvent.getHandle(superClustersToken_);
94  auto eles = iEvent.getHandle(elesToken_);
95  auto phos = iEvent.getHandle(phosToken_);
96  auto recHits = iEvent.getHandle(recHitsToken_);
97 
98  std::vector<DetId> indexToStore;
99  indexToStore.reserve(100);
100 
101  if (eles.isValid() && recHits.isValid()) {
102  for (auto& ele : *eles) {
103  float scEt = ele.superCluster()->energy() * std::sin(ele.superCluster()->position().theta());
104  if (scEt > minEleEt_ || ele.et() > minEleEt_) {
105  hcalHitSelector_.addDetIds(*ele.superCluster(), *recHits, indexToStore);
106  }
107  }
108  }
109  if (phos.isValid() && recHits.isValid()) {
110  for (auto& pho : *phos) {
111  float scEt = pho.superCluster()->energy() * std::sin(pho.superCluster()->position().theta());
112  if (scEt > minPhoEt_ || pho.et() > minPhoEt_) {
113  hcalHitSelector_.addDetIds(*pho.superCluster(), *recHits, indexToStore);
114  }
115  }
116  }
117  if (superClusters.isValid() && recHits.isValid()) {
118  for (auto& sc : *superClusters) {
119  float scEt = sc.energy() * std::sin(sc.position().theta());
120  if (scEt > minSCEt_) {
121  hcalHitSelector_.addDetIds(sc, *recHits, indexToStore);
122  }
123  }
124  }
125 
126  //unify the vector
127  std::sort(indexToStore.begin(), indexToStore.end());
128  std::unique(indexToStore.begin(), indexToStore.end());
129 
130  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
131 
132  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
133 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int iEvent
Definition: GenABIO.cc:224
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
def unique(seq, keepstr=True)
Definition: tier0.py:24
const edm::EDGetTokenT< reco::GsfElectronCollection > elesToken_
const edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
const edm::EDGetTokenT< reco::PhotonCollection > phosToken_
const edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ elesToken_

const edm::EDGetTokenT<reco::GsfElectronCollection> EgammaIsoHcalDetIdCollectionProducer::elesToken_
private

Definition at line 42 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ hcalHitSelector_

EGHcalRecHitSelector EgammaIsoHcalDetIdCollectionProducer::hcalHitSelector_
private

Definition at line 51 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by beginRun(), and produce().

◆ interestingDetIdCollection_

std::string EgammaIsoHcalDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 45 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ minEleEt_

float EgammaIsoHcalDetIdCollectionProducer::minEleEt_
private

Definition at line 48 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ minPhoEt_

float EgammaIsoHcalDetIdCollectionProducer::minPhoEt_
private

Definition at line 49 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ minSCEt_

float EgammaIsoHcalDetIdCollectionProducer::minSCEt_
private

Definition at line 47 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ phosToken_

const edm::EDGetTokenT<reco::PhotonCollection> EgammaIsoHcalDetIdCollectionProducer::phosToken_
private

Definition at line 43 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ recHitsToken_

const edm::EDGetTokenT<HBHERecHitCollection> EgammaIsoHcalDetIdCollectionProducer::recHitsToken_
private

Definition at line 40 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().

◆ superClustersToken_

const edm::EDGetTokenT<reco::SuperClusterCollection> EgammaIsoHcalDetIdCollectionProducer::superClustersToken_
private

Definition at line 41 of file EgammaIsoHcalDetIdCollectionProducer.cc.

Referenced by produce().