CMS 3D CMS Logo

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 
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_
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
void setup(const edm::EventSetup &iSetup)
Definition: config.py:1
EGHcalRecHitSelector(const edm::ParameterSet &config, edm::ConsumesCollector)
Log< level::Error, false > LogError
float getMinEnergyHCAL_(HcalDetId id) const
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
static int calDIEta(int iEta1, int iEta2)
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static edm::ParameterSetDescription makePSetDescription()
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Definition: DetId.h:17
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:79