CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
ElectronHcalHelper Class Reference

#include <ElectronHcalHelper.h>

Classes

struct  Configuration
 

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &)
 
 ElectronHcalHelper (const Configuration &cfg, edm::ConsumesCollector &&cc)
 
bool hasActiveHcal (const reco::SuperCluster &sc) const
 
double hcalESum (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
 
double hcalESumDepth1 (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
 
auto hcalESumDepth1BehindClusters (const std::vector< CaloTowerDetId > &towers) const
 
double hcalESumDepth2 (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
 
auto hcalESumDepth2BehindClusters (const std::vector< CaloTowerDetId > &towers) const
 
auto hcalTowersBehindClusters (const reco::SuperCluster &sc) const
 
double hOverEConeSize () const
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
const Configuration cfg_
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdhcalChannelQualityToken_
 
std::unique_ptr< EgammaHcalIsolationhcalIso_ = nullptr
 
const HcalChannelQualityhcalQuality_ = nullptr
 
const HcalTopologyhcalTopology_ = nullptr
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhcalTopologyToken_
 
std::unique_ptr< EgammaTowerIsolationtowerIso1_ = nullptr
 
std::unique_ptr< EgammaTowerIsolationtowerIso2_ = nullptr
 
const CaloTowerConstituentsMaptowerMap_ = nullptr
 
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecordtowerMapToken_
 
const CaloTowerCollectiontowersFromCollection_ = nullptr
 

Detailed Description

Definition at line 23 of file ElectronHcalHelper.h.

Constructor & Destructor Documentation

◆ ElectronHcalHelper()

ElectronHcalHelper::ElectronHcalHelper ( const Configuration cfg,
edm::ConsumesCollector &&  cc 
)

Definition at line 9 of file ElectronHcalHelper.cc.

9  : cfg_(cfg) {
10  if (cfg_.hOverEConeSize == 0) {
11  return;
12  }
13 
14  if (cfg_.useTowers) {
15  hcalChannelQualityToken_ = cc.esConsumes(edm::ESInputTag("", "withTopo"));
16  hcalTopologyToken_ = cc.esConsumes();
17  towerMapToken_ = cc.esConsumes();
18  } else {
19  caloGeometryToken_ = cc.esConsumes();
20  }
21 }

References caloGeometryToken_, cfg_, hcalChannelQualityToken_, hcalTopologyToken_, ElectronHcalHelper::Configuration::hOverEConeSize, towerMapToken_, and ElectronHcalHelper::Configuration::useTowers.

Member Function Documentation

◆ beginEvent()

void ElectronHcalHelper::beginEvent ( const edm::Event evt,
const edm::EventSetup eventSetup 
)

Definition at line 23 of file ElectronHcalHelper.cc.

23  {
24  if (cfg_.hOverEConeSize == 0) {
25  return;
26  }
27 
28  if (cfg_.useTowers) {
30 
31  towerMap_ = &eventSetup.getData(towerMapToken_);
34 
35  towerIso1_ =
36  std::make_unique<EgammaTowerIsolation>(cfg_.hOverEConeSize, 0., cfg_.hOverEPtMin, 1, towersFromCollection_);
37  towerIso2_ =
38  std::make_unique<EgammaTowerIsolation>(cfg_.hOverEConeSize, 0., cfg_.hOverEPtMin, 2, towersFromCollection_);
39  } else {
40  hcalIso_ = std::make_unique<EgammaHcalIsolation>(cfg_.hOverEConeSize,
41  0.,
44  0.,
45  0.,
46  eventSetup.getHandle(caloGeometryToken_),
47  evt.get(cfg_.hcalRecHits));
48  }
49 }

References caloGeometryToken_, cfg_, edm::Event::get(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), hcalChannelQualityToken_, hcalIso_, hcalQuality_, ElectronHcalHelper::Configuration::hcalRecHits, hcalTopology_, hcalTopologyToken_, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEHBMinE, ElectronHcalHelper::Configuration::hOverEHFMinE, ElectronHcalHelper::Configuration::hOverEPtMin, towerIso1_, towerIso2_, towerMap_, towerMapToken_, towersFromCollection_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::completeElectrons().

◆ hasActiveHcal()

bool ElectronHcalHelper::hasActiveHcal ( const reco::SuperCluster sc) const

◆ hcalESum()

double ElectronHcalHelper::hcalESum ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = nullptr 
) const

Definition at line 51 of file ElectronHcalHelper.cc.

51  {
52  if (cfg_.hOverEConeSize == 0) {
53  return 0;
54  }
55  if (cfg_.useTowers) {
56  return (hcalESumDepth1(sc, excludeTowers) + hcalESumDepth2(sc, excludeTowers));
57  } else {
58  return hcalIso_->getHcalESum(&sc);
59  }
60 }

References cfg_, hcalESumDepth1(), hcalESumDepth2(), hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, and ElectronHcalHelper::Configuration::useTowers.

◆ hcalESumDepth1()

double ElectronHcalHelper::hcalESumDepth1 ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = nullptr 
) const

Definition at line 62 of file ElectronHcalHelper.cc.

63  {
64  if (cfg_.hOverEConeSize == 0) {
65  return 0;
66  }
67  if (cfg_.useTowers) {
68  return towerIso1_->getTowerESum(&sc, excludeTowers);
69  } else {
70  return hcalIso_->getHcalESumDepth1(&sc);
71  }
72 }

References cfg_, hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, towerIso1_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::calculateShowerShape(), and hcalESum().

◆ hcalESumDepth1BehindClusters()

auto ElectronHcalHelper::hcalESumDepth1BehindClusters ( const std::vector< CaloTowerDetId > &  towers) const
inline

◆ hcalESumDepth2()

double ElectronHcalHelper::hcalESumDepth2 ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = nullptr 
) const

Definition at line 74 of file ElectronHcalHelper.cc.

75  {
76  if (cfg_.hOverEConeSize == 0) {
77  return 0;
78  }
79  if (cfg_.useTowers) {
80  return towerIso2_->getTowerESum(&sc, excludeTowers);
81  } else {
82  return hcalIso_->getHcalESumDepth2(&sc);
83  }
84 }

References cfg_, hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, towerIso2_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::calculateShowerShape(), and hcalESum().

◆ hcalESumDepth2BehindClusters()

auto ElectronHcalHelper::hcalESumDepth2BehindClusters ( const std::vector< CaloTowerDetId > &  towers) const
inline

◆ hcalTowersBehindClusters()

auto ElectronHcalHelper::hcalTowersBehindClusters ( const reco::SuperCluster sc) const
inline

Definition at line 52 of file ElectronHcalHelper.h.

52 { return egamma::towersOf(sc, *towerMap_); }

References towerMap_, and egamma::towersOf().

Referenced by GsfElectronAlgo::calculateShowerShape().

◆ hOverEConeSize()

double ElectronHcalHelper::hOverEConeSize ( ) const
inline

Definition at line 49 of file ElectronHcalHelper.h.

49 { return cfg_.hOverEConeSize; }

References cfg_, and ElectronHcalHelper::Configuration::hOverEConeSize.

Member Data Documentation

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> ElectronHcalHelper::caloGeometryToken_
private

Definition at line 70 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and ElectronHcalHelper().

◆ cfg_

const Configuration ElectronHcalHelper::cfg_
private

◆ hcalChannelQualityToken_

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> ElectronHcalHelper::hcalChannelQualityToken_
private

Definition at line 67 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and ElectronHcalHelper().

◆ hcalIso_

std::unique_ptr<EgammaHcalIsolation> ElectronHcalHelper::hcalIso_ = nullptr
private

Definition at line 73 of file ElectronHcalHelper.h.

Referenced by beginEvent(), hcalESum(), hcalESumDepth1(), and hcalESumDepth2().

◆ hcalQuality_

const HcalChannelQuality* ElectronHcalHelper::hcalQuality_ = nullptr
private

Definition at line 80 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and hasActiveHcal().

◆ hcalTopology_

const HcalTopology* ElectronHcalHelper::hcalTopology_ = nullptr
private

Definition at line 81 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and hasActiveHcal().

◆ hcalTopologyToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> ElectronHcalHelper::hcalTopologyToken_
private

Definition at line 68 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and ElectronHcalHelper().

◆ towerIso1_

std::unique_ptr<EgammaTowerIsolation> ElectronHcalHelper::towerIso1_ = nullptr
private

Definition at line 76 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and hcalESumDepth1().

◆ towerIso2_

std::unique_ptr<EgammaTowerIsolation> ElectronHcalHelper::towerIso2_ = nullptr
private

Definition at line 77 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and hcalESumDepth2().

◆ towerMap_

const CaloTowerConstituentsMap* ElectronHcalHelper::towerMap_ = nullptr
private

Definition at line 79 of file ElectronHcalHelper.h.

Referenced by beginEvent(), hasActiveHcal(), and hcalTowersBehindClusters().

◆ towerMapToken_

edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> ElectronHcalHelper::towerMapToken_
private

Definition at line 69 of file ElectronHcalHelper.h.

Referenced by beginEvent(), and ElectronHcalHelper().

◆ towersFromCollection_

const CaloTowerCollection* ElectronHcalHelper::towersFromCollection_ = nullptr
private
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36362
ElectronHcalHelper::caloGeometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: ElectronHcalHelper.h:70
ElectronHcalHelper::cfg_
const Configuration cfg_
Definition: ElectronHcalHelper.h:65
edm::ESInputTag
Definition: ESInputTag.h:87
ElectronHcalHelper::hcalESumDepth1
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:62
ElectronHcalHelper::towerIso2_
std::unique_ptr< EgammaTowerIsolation > towerIso2_
Definition: ElectronHcalHelper.h:77
egamma::depth2HcalESum
double depth2HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
Definition: EgammaHadTower.cc:83
ElectronHcalHelper::Configuration::hOverEHFMinE
double hOverEHFMinE
Definition: ElectronHcalHelper.h:39
cc
ElectronHcalHelper::hcalTopology_
const HcalTopology * hcalTopology_
Definition: ElectronHcalHelper.h:81
ElectronHcalHelper::hcalIso_
std::unique_ptr< EgammaHcalIsolation > hcalIso_
Definition: ElectronHcalHelper.h:73
ElectronHcalHelper::towersFromCollection_
const CaloTowerCollection * towersFromCollection_
Definition: ElectronHcalHelper.h:78
ElectronHcalHelper::Configuration::hcalTowers
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
Definition: ElectronHcalHelper.h:33
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:27
ElectronHcalHelper::Configuration::hcalRecHits
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHits
Definition: ElectronHcalHelper.h:37
egamma::towersOf
std::vector< CaloTowerDetId > towersOf(reco::SuperCluster const &sc, CaloTowerConstituentsMap const &towerMap, HoeMode mode=HoeMode::SingleTower)
Definition: EgammaHadTower.cc:25
ElectronHcalHelper::Configuration::hOverEHBMinE
double hOverEHBMinE
Definition: ElectronHcalHelper.h:38
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
ElectronHcalHelper::hcalTopologyToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalTopologyToken_
Definition: ElectronHcalHelper.h:68
ElectronHcalHelper::hcalQuality_
const HcalChannelQuality * hcalQuality_
Definition: ElectronHcalHelper.h:80
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
looper.cfg
cfg
Definition: looper.py:297
ElectronHcalHelper::Configuration::hOverEPtMin
double hOverEPtMin
Definition: ElectronHcalHelper.h:34
ElectronHcalHelper::Configuration::checkHcalStatus
bool checkHcalStatus
Definition: ElectronHcalHelper.h:30
egamma::depth1HcalESum
double depth1HcalESum(std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
Definition: EgammaHadTower.cc:73
ElectronHcalHelper::Configuration::useTowers
bool useTowers
Definition: ElectronHcalHelper.h:30
ElectronHcalHelper::towerMap_
const CaloTowerConstituentsMap * towerMap_
Definition: ElectronHcalHelper.h:79
egamma::hasActiveHcal
bool hasActiveHcal(std::vector< CaloTowerDetId > const &towers, CaloTowerConstituentsMap const &towerMap, HcalChannelQuality const &hcalQuality, HcalTopology const &hcalTopology)
Definition: EgammaHadTower.cc:93
ElectronHcalHelper::towerIso1_
std::unique_ptr< EgammaTowerIsolation > towerIso1_
Definition: ElectronHcalHelper.h:76
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:338
ElectronHcalHelper::hcalESumDepth2
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:74
ElectronHcalHelper::towerMapToken_
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
Definition: ElectronHcalHelper.h:69
ElectronHcalHelper::hcalChannelQualityToken_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
Definition: ElectronHcalHelper.h:67