CMS 3D CMS Logo

ElectronHcalHelper.cc
Go to the documentation of this file.
6 
7 using namespace reco;
8 
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 }
22 
23 void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup& eventSetup) {
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 }
50 
51 double ElectronHcalHelper::hcalESum(const SuperCluster& sc, const std::vector<CaloTowerDetId>* excludeTowers) const {
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 }
61 
63  const std::vector<CaloTowerDetId>* excludeTowers) const {
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 }
73 
75  const std::vector<CaloTowerDetId>* excludeTowers) const {
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 }
85 
89  } else {
90  return true;
91  }
92 }
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
MessageLogger.h
ElectronHcalHelper::hcalESumDepth1
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:62
reco::SuperCluster
Definition: SuperCluster.h:18
ElectronHcalHelper::towerIso2_
std::unique_ptr< EgammaTowerIsolation > towerIso2_
Definition: ElectronHcalHelper.h:77
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
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::hasActiveHcal
bool hasActiveHcal(const reco::SuperCluster &sc) const
Definition: ElectronHcalHelper.cc:86
ElectronHcalHelper::ElectronHcalHelper
ElectronHcalHelper(const Configuration &cfg, edm::ConsumesCollector &&cc)
Definition: ElectronHcalHelper.cc:9
ElectronHcalHelper::Configuration::hcalRecHits
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHits
Definition: ElectronHcalHelper.h:37
ElectronHcalHelper::Configuration
Definition: ElectronHcalHelper.h:25
CaloGeometryRecord.h
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
ElectronHcalHelper::beginEvent
void beginEvent(const edm::Event &, const edm::EventSetup &)
Definition: ElectronHcalHelper.cc:23
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
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:127
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
ElectronHcalHelper.h
ElectronHcalHelper::hcalESum
double hcalESum(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:51
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
ConsumesCollector.h
ElectronHcalHelper::towerIso1_
std::unique_ptr< EgammaTowerIsolation > towerIso1_
Definition: ElectronHcalHelper.h:76
edm::Event
Definition: Event.h:73
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:342
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
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