CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EGHcalRecHitSelector.h
Go to the documentation of this file.
1 #ifndef RecoEgamam_EgammaIsolationAlgos_EGHcalRecHitSelector_h
2 #define RecoEgamam_EgammaIsolationAlgos_EGHcalRecHitSelector_h
3 
11 
14 
18 
20 public:
23 
24  template <typename CollType>
25  void addDetIds(const reco::SuperCluster& superClus,
27  CollType& detIdsToStore) const;
28 
29  void setup(const edm::EventSetup& iSetup) { towerMap_ = iSetup.getHandle(towerMapToken_); }
30 
32 
33 private:
34  static int calDIPhi(int iPhi1, int iPhi2);
35  static int calDIEta(int iEta1, int iEta2);
36  float getMinEnergyHCAL_(HcalDetId id) const;
37 
38  int maxDIEta_;
39  int maxDIPhi_;
40  float minEnergyHB_;
43 
46 };
47 
48 template <typename CollType>
51  CollType& detIdsToStore) const {
52  DetId seedId = superClus.seed()->seed();
53  if (seedId.det() != DetId::Ecal && seedId.det() != DetId::Forward) {
54  edm::LogError("EgammaIsoHcalDetIdCollectionProducerError")
55  << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong";
56  return;
57  }
58  //so we are using CaloTowers to get the iEta/iPhi of the HCAL rec hit behind the seed cluster, this might go funny on tower 28 but shouldnt matter there
59 
60  if (seedId.det() == DetId::Forward)
61  return;
62 
63  CaloTowerDetId towerId(towerMap_->towerOf(seedId));
64  int seedHcalIEta = towerId.ieta();
65  int seedHcalIPhi = towerId.iphi();
66 
67  for (auto& recHit : recHits) {
68  int dIEtaAbs = std::abs(calDIEta(seedHcalIEta, recHit.id().ieta()));
69  int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi, recHit.id().iphi()));
70 
71  if (dIEtaAbs <= maxDIEta_ && dIPhiAbs <= maxDIPhi_ && recHit.energy() > getMinEnergyHCAL_(recHit.id()))
72  detIdsToStore.insert(detIdsToStore.end(), recHit.id().rawId());
73  }
74 }
75 
76 #endif
static int calDIPhi(int iPhi1, int iPhi2)
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
void setup(const edm::EventSetup &iSetup)
EGHcalRecHitSelector(const edm::ParameterSet &config, edm::ConsumesCollector)
Log< level::Error, false > LogError
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
static int calDIEta(int iEta1, int iEta2)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static edm::ParameterSetDescription makePSetDescription()
Definition: DetId.h:17
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
tuple config
parse the configuration file
float getMinEnergyHCAL_(HcalDetId id) const
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46