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::stream::EDProducer<>

Public Member Functions

 EgammaHLTBcHcalIsolationProducersRegional (const edm::ParameterSet &)
 
 EgammaHLTBcHcalIsolationProducersRegional (EgammaHLTBcHcalIsolationProducersRegional const &)=delete
 
EgammaHLTBcHcalIsolationProducersRegionaloperator= (EgammaHLTBcHcalIsolationProducersRegional const &)=delete
 
void produce (edm::Event &, const edm::EventSetup &) final
 
 ~EgammaHLTBcHcalIsolationProducersRegional () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const std::vector< double > absEtaLowEdges_
 
const edm::EDGetTokenT< CaloTowerCollectioncaloTowerProducer_
 
const int depth_
 
const bool doEtSum_
 
const bool doRhoCorrection_
 
const std::vector< double > effectiveAreas_
 
const double etMin_
 
ElectronHcalHelperhcalHelper_
 
const double innerCone_
 
const double outerCone_
 
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::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

Definition at line 49 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Constructor & Destructor Documentation

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

Definition at line 83 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References absEtaLowEdges_, caloTowerProducer_, doRhoCorrection_, effectiveAreas_, etMin_, Exception, hcalHelper_, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEPtMin, outerCone_, and ElectronHcalHelper::Configuration::useTowers.

84  : doEtSum_(config.getParameter<bool>("doEtSum")),
85  etMin_(config.getParameter<double>("etMin")),
86  innerCone_(config.getParameter<double>("innerCone")),
87  outerCone_(config.getParameter<double>("outerCone")),
88  depth_(config.getParameter<int>("depth")),
89  useSingleTower_(config.getParameter<bool>("useSingleTower")),
90  doRhoCorrection_(config.getParameter<bool>("doRhoCorrection")),
91  rhoScale_(config.getParameter<double>("rhoScale")),
92  rhoMax_(config.getParameter<double>("rhoMax")),
93  effectiveAreas_(config.getParameter<std::vector<double> >("effectiveAreas")),
94  absEtaLowEdges_(config.getParameter<std::vector<double> >("absEtaLowEdges")),
96  consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
97  caloTowerProducer_(consumes<CaloTowerCollection>(config.getParameter<edm::InputTag>("caloTowerProducer"))),
98  rhoProducer_(doRhoCorrection_ ? consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"))
100  if (doRhoCorrection_) {
101  if (absEtaLowEdges_.size() != effectiveAreas_.size())
102  throw cms::Exception("IncompatibleVects") << "absEtaLowEdges and effectiveAreas should be of the same size. \n";
103 
104  if (absEtaLowEdges_.at(0) != 0.0)
105  throw cms::Exception("IncompleteCoverage") << "absEtaLowEdges should start from 0. \n";
106 
107  for (unsigned int aIt = 0; aIt < absEtaLowEdges_.size() - 1; aIt++) {
108  if (!(absEtaLowEdges_.at(aIt) < absEtaLowEdges_.at(aIt + 1)))
109  throw cms::Exception("ImproperBinning") << "absEtaLowEdges entries should be in increasing order. \n";
110  }
111  }
112 
114  hcalCfg.hOverEConeSize = outerCone_;
115  hcalCfg.useTowers = true;
116  hcalCfg.hcalTowers = caloTowerProducer_;
117  hcalCfg.hOverEPtMin = etMin_;
118  hcalHelper_ = new ElectronHcalHelper(hcalCfg);
119 
120  produces<reco::RecoEcalCandidateIsolationMap>();
121 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
EgammaHLTBcHcalIsolationProducersRegional::~EgammaHLTBcHcalIsolationProducersRegional ( )
override
EgammaHLTBcHcalIsolationProducersRegional::EgammaHLTBcHcalIsolationProducersRegional ( EgammaHLTBcHcalIsolationProducersRegional const &  )
delete

Member Function Documentation

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

Definition at line 125 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

125  {
127 
128  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
129  desc.add<edm::InputTag>(("caloTowerProducer"), edm::InputTag("hltTowerMakerForAll"));
130  desc.add<edm::InputTag>(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo"));
131  desc.add<bool>(("doRhoCorrection"), false);
132  desc.add<double>(("rhoMax"), 999999.);
133  desc.add<double>(("rhoScale"), 1.0);
134  desc.add<double>(("etMin"), -1.0);
135  desc.add<double>(("innerCone"), 0);
136  desc.add<double>(("outerCone"), 0.15);
137  desc.add<int>(("depth"), -1);
138  desc.add<bool>(("doEtSum"), false);
139  desc.add<bool>(("useSingleTower"), false);
140  desc.add<std::vector<double> >("effectiveAreas", {0.079, 0.25}); // 2016 post-ichep sinEle default
141  desc.add<std::vector<double> >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap
142  descriptions.add(("hltEgammaHLTBcHcalIsolationProducersRegional"), desc);
143 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
EgammaHLTBcHcalIsolationProducersRegional& EgammaHLTBcHcalIsolationProducersRegional::operator= ( EgammaHLTBcHcalIsolationProducersRegional const &  )
delete
void EgammaHLTBcHcalIsolationProducersRegional::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
final

Definition at line 145 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

References funct::abs(), absEtaLowEdges_, caloTowerProducer_, ElectronHcalHelper::checkSetup(), DEFINE_FWK_MODULE, depth_, doEtSum_, doRhoCorrection_, effectiveAreas_, etMin_, edm::Event::getByToken(), EgammaTowerIsolation::getTowerEtSum(), ElectronHcalHelper::hcalESum(), ElectronHcalHelper::hcalESumDepth1BehindClusters(), ElectronHcalHelper::hcalESumDepth2BehindClusters(), hcalHelper_, ElectronHcalHelper::hcalTowersBehindClusters(), innerCone_, edm::AssociationMap< Tag >::insert(), outerCone_, edm::Handle< T >::product(), edm::Event::put(), ElectronHcalHelper::readEvent(), recoEcalCandidateProducer_, rho, rhoMax_, rhoProducer_, rhoScale_, and useSingleTower_.

145  {
146  // Get the HLT filtered objects
148  iEvent.getByToken(recoEcalCandidateProducer_, recoEcalCandHandle);
149 
150  edm::Handle<CaloTowerCollection> caloTowersHandle;
151  iEvent.getByToken(caloTowerProducer_, caloTowersHandle);
152 
153  edm::Handle<double> rhoHandle;
154  double rho = 0.0;
155 
156  if (doRhoCorrection_) {
157  iEvent.getByToken(rhoProducer_, rhoHandle);
158  rho = *(rhoHandle.product());
159  }
160 
161  if (rho > rhoMax_)
162  rho = rhoMax_;
163 
164  rho = rho * rhoScale_;
165 
166  hcalHelper_->checkSetup(iSetup);
167  hcalHelper_->readEvent(iEvent);
168 
169  reco::RecoEcalCandidateIsolationMap isoMap(recoEcalCandHandle);
170 
171  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoEcalCandHandle->size(); iRecoEcalCand++) {
172  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand);
173 
174  float isol = 0;
175 
176  std::vector<CaloTowerDetId> towersBehindCluster;
177 
178  if (useSingleTower_)
179  towersBehindCluster = hcalHelper_->hcalTowersBehindClusters(*(recoEcalCandRef->superCluster()));
180 
181  if (doEtSum_) { //calculate hcal isolation excluding the towers behind the cluster which will be used for H for H/E
182  EgammaTowerIsolation isolAlgo(outerCone_, innerCone_, etMin_, depth_, caloTowersHandle.product());
183  if (useSingleTower_)
184  isol = isolAlgo.getTowerEtSum(
185  &(*recoEcalCandRef), &(towersBehindCluster)); // towersBehindCluster are excluded from the isolation sum
186  else
187  isol = isolAlgo.getTowerEtSum(&(*recoEcalCandRef));
188 
189  } else { //calcuate H for H/E
190  if (useSingleTower_)
191  isol = hcalHelper_->hcalESumDepth1BehindClusters(towersBehindCluster) +
192  hcalHelper_->hcalESumDepth2BehindClusters(towersBehindCluster);
193  else
194  isol = hcalHelper_->hcalESum(*(recoEcalCandRef->superCluster()));
195  }
196 
197  if (doRhoCorrection_) {
198  int iEA = -1;
199  auto scEta = std::abs(recoEcalCandRef->superCluster()->eta());
200  for (int bIt = absEtaLowEdges_.size() - 1; bIt > -1; bIt--) {
201  if (scEta > absEtaLowEdges_.at(bIt)) {
202  iEA = bIt;
203  break;
204  }
205  }
206  isol = isol - rho * effectiveAreas_.at(iEA);
207  }
208 
209  isoMap.insert(recoEcalCandRef, isol);
210  }
211 
212  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(isoMap));
213 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void readEvent(const edm::Event &)
double hcalESum(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
const edm::EDGetTokenT< CaloTowerCollection > caloTowerProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void checkSetup(const edm::EventSetup &)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T const * product() const
Definition: Handle.h:69
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers) const
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc) const
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers) const

Member Data Documentation

const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::absEtaLowEdges_
private
const edm::EDGetTokenT<CaloTowerCollection> EgammaHLTBcHcalIsolationProducersRegional::caloTowerProducer_
private
const int EgammaHLTBcHcalIsolationProducersRegional::depth_
private

Definition at line 67 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::doEtSum_
private

Definition at line 63 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::doRhoCorrection_
private
const std::vector<double> EgammaHLTBcHcalIsolationProducersRegional::effectiveAreas_
private
const double EgammaHLTBcHcalIsolationProducersRegional::etMin_
private
ElectronHcalHelper* EgammaHLTBcHcalIsolationProducersRegional::hcalHelper_
private
const double EgammaHLTBcHcalIsolationProducersRegional::innerCone_
private

Definition at line 65 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

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

Definition at line 76 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

const double EgammaHLTBcHcalIsolationProducersRegional::rhoMax_
private

Definition at line 72 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

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

Definition at line 78 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

const double EgammaHLTBcHcalIsolationProducersRegional::rhoScale_
private

Definition at line 71 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().

const bool EgammaHLTBcHcalIsolationProducersRegional::useSingleTower_
private

Definition at line 68 of file EgammaHLTBcHcalIsolationProducersRegional.cc.

Referenced by produce().