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 
9 
12 
16 
18 public:
21 
22  template<typename CollType>
23  void addDetIds(const reco::SuperCluster& superClus,const HBHERecHitCollection& recHits,
24  CollType& detIdsToStore)const;
25 
26  void setup(const edm::EventSetup& iSetup){iSetup.get<CaloGeometryRecord>().get(towerMap_);}
27 
29 
30 private:
31  static int calDIPhi(int iPhi1,int iPhi2);
32  static int calDIEta(int iEta1,int iEta2);
33  float getMinEnergyHCAL_(HcalDetId id)const;
34 
35  int maxDIEta_;
36  int maxDIPhi_;
37  float minEnergyHB_;
40 
42 
43 };
44 
45 template <typename CollType>
47 addDetIds(const reco::SuperCluster& superClus,const HBHERecHitCollection& recHits,
48  CollType& detIdsToStore)const
49 {
50  DetId seedId = superClus.seed()->seed();
51  if(seedId.det() != DetId::Ecal && seedId.det() != DetId::Forward) {
52  edm::LogError("EgammaIsoHcalDetIdCollectionProducerError") << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong";
53  return;
54  }
55  //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
56 
57  if( seedId.det() == DetId::Forward ) return;
58 
60  int seedHcalIEta = towerId.ieta();
61  int seedHcalIPhi = towerId.iphi();
62 
63  for(auto& recHit : recHits){
64  int dIEtaAbs = std::abs(calDIEta(seedHcalIEta,recHit.id().ieta()));
65  int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi,recHit.id().iphi()));
66 
67  if(dIEtaAbs<=maxDIEta_ && dIPhiAbs<=maxDIPhi_ && recHit.energy()>getMinEnergyHCAL_(recHit.id())) detIdsToStore.insert(detIdsToStore.end(),recHit.id().rawId());
68  }
69 }
70 
71 
72 #endif
static int calDIPhi(int iPhi1, int iPhi2)
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
void setup(const edm::EventSetup &iSetup)
Definition: config.py:1
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
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:18
EGHcalRecHitSelector(const edm::ParameterSet &config)
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
l1t::HGCalTowerID towerId
Definition: classes.h:34
T get() const
Definition: EventSetup.h:63
float getMinEnergyHCAL_(HcalDetId id) const
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39