CMS 3D CMS Logo

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

Public Member Functions

 HLTHGCalLayerClusterIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTHGCalLayerClusterIsolationProducer () override=default
 
- 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 Types

typedef std::vector< T1 > T1Collection
 
typedef edm::AssociationMap< edm::OneToValue< std::vector< T1 >, float > > T1IsolationMap
 
typedef edm::Ref< T1CollectionT1Ref
 

Private Attributes

const bool doRhoCorrection_
 
const double drMax_
 
const double drVetoEM_
 
const double drVetoHad_
 
const std::vector< double > effectiveAreas_
 
const edm::EDGetTokenT< reco::CaloClusterCollectionlayerClusterProducer_
 
const double minEnergyEM_
 
const double minEnergyHad_
 
const double minEtEM_
 
const double minEtHad_
 
edm::EDGetTokenT< T1CollectionrecoCandidateProducer_
 
const double rhoMax_
 
const edm::EDGetTokenT< double > rhoProducer_
 
const double rhoScale_
 
const bool useEt_
 

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

template<typename T1>
class HLTHGCalLayerClusterIsolationProducer< T1 >

Definition at line 38 of file HLTHGCalLayerClusterIsolationProducer.cc.

Member Typedef Documentation

◆ T1Collection

template<typename T1 >
typedef std::vector<T1> HLTHGCalLayerClusterIsolationProducer< T1 >::T1Collection
private

Definition at line 39 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ T1IsolationMap

template<typename T1 >
typedef edm::AssociationMap<edm::OneToValue<std::vector<T1>, float> > HLTHGCalLayerClusterIsolationProducer< T1 >::T1IsolationMap
private

Definition at line 41 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ T1Ref

template<typename T1 >
typedef edm::Ref<T1Collection> HLTHGCalLayerClusterIsolationProducer< T1 >::T1Ref
private

Definition at line 40 of file HLTHGCalLayerClusterIsolationProducer.cc.

Constructor & Destructor Documentation

◆ HLTHGCalLayerClusterIsolationProducer()

template<typename T1 >
HLTHGCalLayerClusterIsolationProducer< T1 >::HLTHGCalLayerClusterIsolationProducer ( const edm::ParameterSet config)
explicit

Definition at line 70 of file HLTHGCalLayerClusterIsolationProducer.cc.

References HLTHGCalLayerClusterIsolationProducer< T1 >::doRhoCorrection_, HLTHGCalLayerClusterIsolationProducer< T1 >::effectiveAreas_, HLTHGCalLayerClusterIsolationProducer< T1 >::recoCandidateProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

72  consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusterProducer"))),
73  rhoProducer_(consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"))),
74  drMax_(config.getParameter<double>("drMax")),
75  drVetoEM_(config.getParameter<double>("drVetoEM")),
76  drVetoHad_(config.getParameter<double>("drVetoHad")),
77  minEnergyEM_(config.getParameter<double>("minEnergyEM")),
78  minEnergyHad_(config.getParameter<double>("minEnergyHad")),
79  minEtEM_(config.getParameter<double>("minEtEM")),
80  minEtHad_(config.getParameter<double>("minEtHad")),
81  useEt_(config.getParameter<bool>("useEt")),
82  doRhoCorrection_(config.getParameter<bool>("doRhoCorrection")),
83  rhoMax_(config.getParameter<double>("rhoMax")),
84  rhoScale_(config.getParameter<double>("rhoScale")),
85  effectiveAreas_(config.getParameter<std::vector<double>>("effectiveAreas")) {
86  if (doRhoCorrection_) {
87  if (effectiveAreas_.size() != 2)
88  throw cms::Exception("IncompatibleVects")
89  << "effectiveAreas should have two elements for em and had components. \n";
90  }
91 
92  std::string recoCandidateProducerName = "recoCandidateProducer";
95  recoCandidateProducerName = "recoEcalCandidateProducer";
96 
97  recoCandidateProducer_ = consumes<T1Collection>(config.getParameter<edm::InputTag>(recoCandidateProducerName));
98  produces<T1IsolationMap>();
99  produces<T1IsolationMap>("em");
100  produces<T1IsolationMap>("had");
101 }
Definition: config.py:1
const edm::EDGetTokenT< reco::CaloClusterCollection > layerClusterProducer_

◆ ~HLTHGCalLayerClusterIsolationProducer()

template<typename T1 >
HLTHGCalLayerClusterIsolationProducer< T1 >::~HLTHGCalLayerClusterIsolationProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<typename T1 >
void HLTHGCalLayerClusterIsolationProducer< T1 >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 104 of file HLTHGCalLayerClusterIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), defaultModuleLabel(), submitPVResolutionJobs::desc, HLT_2022v14_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

104  {
105  std::string recoCandidateProducerName = "recoCandidateProducer";
108  recoCandidateProducerName = "recoEcalCandidateProducer";
109 
111  desc.add<edm::InputTag>(recoCandidateProducerName, edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
112  desc.add<edm::InputTag>("layerClusterProducer", edm::InputTag("hltParticleFlowClusterECAL"));
113  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
114  desc.add<bool>("doRhoCorrection", false);
115  desc.add<bool>("useEt", false);
116  desc.add<double>("rhoMax", 9.9999999E7);
117  desc.add<double>("rhoScale", 1.0);
118  desc.add<double>("drMax", 0.3);
119  desc.add<double>("drVetoEM", 0.0);
120  desc.add<double>("drVetoHad", 0.0);
121  desc.add<double>("minEnergyEM", 0.0);
122  desc.add<double>("minEnergyHad", 0.0);
123  desc.add<double>("minEtEM", 0.0);
124  desc.add<double>("minEtHad", 0.0);
125  desc.add<std::vector<double>>("effectiveAreas", {0.0, 0.0}); // for em and had components
127 }
std::string defaultModuleLabel()
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

template<typename T1 >
void HLTHGCalLayerClusterIsolationProducer< T1 >::produce ( edm::Event iEvent,
const edm::EventSetup  
)
override

Definition at line 130 of file HLTHGCalLayerClusterIsolationProducer.cc.

References HGCalClusterTools::emEnergyInCone(), HGCalClusterTools::ENERGY, HGCalClusterTools::ET, HGCalClusterTools::hadEnergyInCone(), iEvent, edm::AssociationMap< Tag >::insert(), hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, SiStripPI::min, edm::Handle< T >::product(), and ZElectronSkim_cff::rho.

130  {
131  edm::Handle<double> rhoHandle;
132  double rho = 0.0;
133  if (doRhoCorrection_) {
134  iEvent.getByToken(rhoProducer_, rhoHandle);
135  rho = *(rhoHandle.product());
136  }
137 
138  rho = std::min(rho, rhoMax_);
139  rho = rho * rhoScale_;
140 
141  edm::Handle<T1Collection> recoCandHandle;
143 
144  iEvent.getByToken(recoCandidateProducer_, recoCandHandle);
145  iEvent.getByToken(layerClusterProducer_, clusterHandle);
146 
147  const std::vector<reco::CaloCluster> layerClusters = *(clusterHandle.product());
148 
149  T1IsolationMap recoCandMap(recoCandHandle);
150  T1IsolationMap recoCandMapEm(recoCandHandle);
151  T1IsolationMap recoCandMapHad(recoCandHandle);
152 
153  for (unsigned int iReco = 0; iReco < recoCandHandle->size(); iReco++) {
154  T1Ref candRef(recoCandHandle, iReco);
155 
156  float sumEm =
157  HGCalClusterTools::emEnergyInCone(candRef->eta(),
158  candRef->phi(),
160  drVetoEM_,
161  drMax_,
162  minEtEM_,
163  minEnergyEM_,
165 
166  float sumHad =
167  HGCalClusterTools::hadEnergyInCone(candRef->eta(),
168  candRef->phi(),
170  drVetoHad_,
171  drMax_,
172  minEtHad_,
175 
176  if (doRhoCorrection_) {
177  sumEm = sumEm - rho * effectiveAreas_.at(0);
178  sumHad = sumHad - rho * effectiveAreas_.at(1);
179  }
180 
181  float sum = sumEm + sumHad;
182 
183  recoCandMap.insert(candRef, sum);
184  recoCandMapEm.insert(candRef, sumEm);
185  recoCandMapHad.insert(candRef, sumHad);
186  }
187 
188  iEvent.put(std::make_unique<T1IsolationMap>(recoCandMap));
189  iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapEm), "em");
190  iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapHad), "had");
191 }
T const * product() const
Definition: Handle.h:70
static float emEnergyInCone(const float eta, const float phi, const std::vector< reco::CaloCluster > &layerClusters, const float minDR, const float maxDR, const float minEt, const float minEnergy, const HGCalClusterTools::EType &eType=EType::ENERGY)
int iEvent
Definition: GenABIO.cc:224
edm::AssociationMap< edm::OneToValue< std::vector< T1 >, float > > T1IsolationMap
const edm::EDGetTokenT< reco::CaloClusterCollection > layerClusterProducer_
static float hadEnergyInCone(const float eta, const float phi, const std::vector< reco::CaloCluster > &layerClusters, const float minDR, const float maxDR, const float minEt, const float minEnergy, const HGCalClusterTools::EType &eType=EType::ENERGY)

Member Data Documentation

◆ doRhoCorrection_

template<typename T1 >
const bool HLTHGCalLayerClusterIsolationProducer< T1 >::doRhoCorrection_
private

◆ drMax_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::drMax_
private

Definition at line 55 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ drVetoEM_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::drVetoEM_
private

Definition at line 56 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ drVetoHad_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::drVetoHad_
private

Definition at line 57 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ effectiveAreas_

template<typename T1 >
const std::vector<double> HLTHGCalLayerClusterIsolationProducer< T1 >::effectiveAreas_
private

◆ layerClusterProducer_

template<typename T1 >
const edm::EDGetTokenT<reco::CaloClusterCollection> HLTHGCalLayerClusterIsolationProducer< T1 >::layerClusterProducer_
private

Definition at line 52 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ minEnergyEM_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::minEnergyEM_
private

Definition at line 58 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ minEnergyHad_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::minEnergyHad_
private

Definition at line 59 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ minEtEM_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::minEtEM_
private

Definition at line 60 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ minEtHad_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::minEtHad_
private

Definition at line 61 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ recoCandidateProducer_

template<typename T1 >
edm::EDGetTokenT<T1Collection> HLTHGCalLayerClusterIsolationProducer< T1 >::recoCandidateProducer_
private

◆ rhoMax_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::rhoMax_
private

Definition at line 64 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ rhoProducer_

template<typename T1 >
const edm::EDGetTokenT<double> HLTHGCalLayerClusterIsolationProducer< T1 >::rhoProducer_
private

Definition at line 53 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ rhoScale_

template<typename T1 >
const double HLTHGCalLayerClusterIsolationProducer< T1 >::rhoScale_
private

Definition at line 65 of file HLTHGCalLayerClusterIsolationProducer.cc.

◆ useEt_

template<typename T1 >
const bool HLTHGCalLayerClusterIsolationProducer< T1 >::useEt_
private

Definition at line 62 of file HLTHGCalLayerClusterIsolationProducer.cc.