CMS 3D CMS Logo

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

Public Member Functions

 EgammaHLTBcHcalIsolationProducersRegional (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const final
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 Attributes

const std::vector< double > absEtaLowEdges_
 
const edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecordcaloTowerConstituentsMapToken_
 
const edm::EDGetTokenT< CaloTowerCollectioncaloTowerProducer_
 
const int depth_
 
const bool doEtSum_
 
const bool doRhoCorrection_
 
const std::vector< double > effectiveAreas_
 
const double etMin_
 
const double innerCone_
 
const double outerCone_
 
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMapputToken_
 
const edm::EDGetTokenT< reco::RecoEcalCandidateCollectionrecoEcalCandidateProducer_
 
const double rhoMax_
 
const edm::EDGetTokenT< double > rhoProducer_
 
const double rhoScale_
 
const bool useSingleTower_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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 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 24 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Constructor & Destructor Documentation

◆ EgammaHLTBcHcalIsolationProducersRegional()

EgammaHLTBcHcalIsolationProducersRegional::EgammaHLTBcHcalIsolationProducersRegional ( const edm::ParameterSet config)
explicit

Definition at line 55 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References edm::EDConsumerBase::esConsumes().

56  : doEtSum_(config.getParameter<bool>("doEtSum")),
57  etMin_(config.getParameter<double>("etMin")),
58  innerCone_(config.getParameter<double>("innerCone")),
59  outerCone_(config.getParameter<double>("outerCone")),
60  depth_(config.getParameter<int>("depth")),
61  useSingleTower_(config.getParameter<bool>("useSingleTower")),
62  doRhoCorrection_(config.getParameter<bool>("doRhoCorrection")),
63  rhoScale_(config.getParameter<double>("rhoScale")),
64  rhoMax_(config.getParameter<double>("rhoMax")),
65  effectiveAreas_(config.getParameter<std::vector<double> >("effectiveAreas")),
66  absEtaLowEdges_(config.getParameter<std::vector<double> >("absEtaLowEdges")),
67  recoEcalCandidateProducer_(consumes(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
68  caloTowerProducer_(consumes(config.getParameter<edm::InputTag>("caloTowerProducer"))),
69  rhoProducer_(doRhoCorrection_ ? consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"))
72  putToken_{produces<reco::RecoEcalCandidateIsolationMap>()} {
73  if (doRhoCorrection_) {
74  if (absEtaLowEdges_.size() != effectiveAreas_.size()) {
75  throw cms::Exception("IncompatibleVects") << "absEtaLowEdges and effectiveAreas should be of the same size. \n";
76  }
77 
78  if (absEtaLowEdges_.at(0) != 0.0) {
79  throw cms::Exception("IncompleteCoverage") << "absEtaLowEdges should start from 0. \n";
80  }
81 
82  for (unsigned int aIt = 0; aIt < absEtaLowEdges_.size() - 1; aIt++) {
83  if (!(absEtaLowEdges_.at(aIt) < absEtaLowEdges_.at(aIt + 1))) {
84  throw cms::Exception("ImproperBinning") << "absEtaLowEdges entries should be in increasing order. \n";
85  }
86  }
87  }
88 }
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDPutTokenT< reco::RecoEcalCandidateIsolationMap > putToken_
const edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > caloTowerConstituentsMapToken_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 90 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

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

90  {
92 
93  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
94  desc.add<edm::InputTag>(("caloTowerProducer"), edm::InputTag("hltTowerMakerForAll"));
95  desc.add<edm::InputTag>(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo"));
96  desc.add<bool>(("doRhoCorrection"), false);
97  desc.add<double>(("rhoMax"), 999999.);
98  desc.add<double>(("rhoScale"), 1.0);
99  desc.add<double>(("etMin"), -1.0);
100  desc.add<double>(("innerCone"), 0);
101  desc.add<double>(("outerCone"), 0.15);
102  desc.add<int>(("depth"), -1);
103  desc.add<bool>(("doEtSum"), false);
104  desc.add<bool>(("useSingleTower"), false);
105  desc.add<std::vector<double> >("effectiveAreas", {0.079, 0.25}); // 2016 post-ichep sinEle default
106  desc.add<std::vector<double> >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap
107  descriptions.add(("hltEgammaHLTBcHcalIsolationProducersRegional"), desc);
108 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void EgammaHLTBcHcalIsolationProducersRegional::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
finalvirtual

Implements edm::global::EDProducerBase.

Definition at line 110 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References funct::abs(), absEtaLowEdges_, caloTowerConstituentsMapToken_, caloTowerProducer_, eleHcalExtractorBlocks_cff::caloTowers, egamma::depth1HcalESum(), egamma::depth2HcalESum(), depth_, doEtSum_, doRhoCorrection_, effectiveAreas_, etMin_, edm::Ref< C, T, F >::get(), edm::EventSetup::getData(), EgammaTowerIsolation::getTowerESum(), EgammaTowerIsolation::getTowerEtSum(), iEvent, innerCone_, edm::AssociationMap< Tag >::insert(), outerCone_, putToken_, recoEcalCandidateProducer_, rho, rhoMax_, rhoProducer_, rhoScale_, egamma::towersOf(), and useSingleTower_.

112  {
113  // Get the HLT filtered objects
114  auto recoEcalCandHandle = iEvent.getHandle(recoEcalCandidateProducer_);
115 
116  double rho = 0.0;
117 
118  if (doRhoCorrection_) {
119  rho = iEvent.get(rhoProducer_);
120  if (rho > rhoMax_) {
121  rho = rhoMax_;
122  }
123  rho = rho * rhoScale_;
124  }
125 
126  auto const &caloTowers = iEvent.get(caloTowerProducer_);
127  auto const &ctmaph = iSetup.getData(caloTowerConstituentsMapToken_);
128 
129  const EgammaTowerIsolation towerIso1(outerCone_, 0., etMin_, 1, &caloTowers);
130  const EgammaTowerIsolation towerIso2(outerCone_, 0., etMin_, 2, &caloTowers);
131 
132  reco::RecoEcalCandidateIsolationMap isoMap(recoEcalCandHandle);
133 
134  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); iRecoEcalCand++) {
135  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand);
136 
137  float isol = 0;
138 
139  auto towersBehindCluster =
140  useSingleTower_ ? egamma::towersOf(*(recoEcalCandRef->superCluster()), ctmaph) : std::vector<CaloTowerDetId>{};
141 
142  if (doEtSum_) { //calculate hcal isolation excluding the towers behind the cluster which will be used for H for H/E
143  const EgammaTowerIsolation isolAlgo(outerCone_, innerCone_, etMin_, depth_, &caloTowers);
144  if (useSingleTower_) {
145  // towersBehindCluster are excluded from the isolation sum
146  isol = isolAlgo.getTowerEtSum(recoEcalCandRef.get(), &towersBehindCluster);
147  } else {
148  isol = isolAlgo.getTowerEtSum(recoEcalCandRef.get());
149  }
150 
151  } else { //calcuate H for H/E
152  if (useSingleTower_)
153  isol = egamma::depth1HcalESum(towersBehindCluster, caloTowers) +
154  egamma::depth2HcalESum(towersBehindCluster, caloTowers);
155  else {
156  auto const &sc = recoEcalCandRef->superCluster().get();
157  isol = towerIso1.getTowerESum(sc) + towerIso2.getTowerESum(sc);
158  }
159  }
160 
161  if (doRhoCorrection_) {
162  int iEA = -1;
163  auto scEta = std::abs(recoEcalCandRef->superCluster()->eta());
164  for (int bIt = absEtaLowEdges_.size() - 1; bIt > -1; bIt--) {
165  if (scEta > absEtaLowEdges_.at(bIt)) {
166  iEA = bIt;
167  break;
168  }
169  }
170  isol = isol - rho * effectiveAreas_.at(iEA);
171  }
172 
173  isoMap.insert(recoEcalCandRef, isol);
174  }
175 
176  iEvent.emplace(putToken_, isoMap);
177 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double depth2HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
const edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > caloTowerConstituentsMapToken_
double depth1HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
std::vector< CaloTowerDetId > towersOf(reco::SuperCluster const &sc, CaloTowerConstituentsMap const &towerMap, HoeMode mode=HoeMode::SingleTower)

Member Data Documentation

◆ absEtaLowEdges_

const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::absEtaLowEdges_
private

Definition at line 44 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ caloTowerConstituentsMapToken_

const edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> EgammaHLTBcHcalIsolationProducersRegional::caloTowerConstituentsMapToken_
private

Definition at line 50 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ caloTowerProducer_

const edm::EDGetTokenT<CaloTowerCollection> EgammaHLTBcHcalIsolationProducersRegional::caloTowerProducer_
private

Definition at line 47 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ depth_

const int EgammaHLTBcHcalIsolationProducersRegional::depth_
private

Definition at line 37 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ doEtSum_

const bool EgammaHLTBcHcalIsolationProducersRegional::doEtSum_
private

Definition at line 33 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ doRhoCorrection_

const bool EgammaHLTBcHcalIsolationProducersRegional::doRhoCorrection_
private

Definition at line 40 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ effectiveAreas_

const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::effectiveAreas_
private

Definition at line 43 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ etMin_

const double EgammaHLTBcHcalIsolationProducersRegional::etMin_
private

Definition at line 34 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ innerCone_

const double EgammaHLTBcHcalIsolationProducersRegional::innerCone_
private

Definition at line 35 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ outerCone_

const double EgammaHLTBcHcalIsolationProducersRegional::outerCone_
private

Definition at line 36 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ putToken_

const edm::EDPutTokenT<reco::RecoEcalCandidateIsolationMap> EgammaHLTBcHcalIsolationProducersRegional::putToken_
private

Definition at line 52 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ recoEcalCandidateProducer_

const edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTBcHcalIsolationProducersRegional::recoEcalCandidateProducer_
private

Definition at line 46 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ rhoMax_

const double EgammaHLTBcHcalIsolationProducersRegional::rhoMax_
private

Definition at line 42 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ rhoProducer_

const edm::EDGetTokenT<double> EgammaHLTBcHcalIsolationProducersRegional::rhoProducer_
private

Definition at line 48 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ rhoScale_

const double EgammaHLTBcHcalIsolationProducersRegional::rhoScale_
private

Definition at line 41 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

◆ useSingleTower_

const bool EgammaHLTBcHcalIsolationProducersRegional::useSingleTower_
private

Definition at line 38 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().