Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:56

0001 #include "RecoEgamma/EgammaIsolationAlgos/interface/EGHcalRecHitSelector.h"
0002 
0003 #include <limits>
0004 
0005 EGHcalRecHitSelector::EGHcalRecHitSelector(const edm::ParameterSet& config, edm::ConsumesCollector cc)
0006     : maxDIEta_(config.getParameter<int>("maxDIEta")),
0007       maxDIPhi_(config.getParameter<int>("maxDIPhi")),
0008       minEnergyHB_(config.getParameter<double>("minEnergyHB")),
0009       minEnergyHEDepth1_(config.getParameter<double>("minEnergyHEDepth1")),
0010       minEnergyHEDefault_(config.getParameter<double>("minEnergyHEDefault")),
0011       towerMapToken_(cc.esConsumes<CaloTowerConstituentsMap, CaloGeometryRecord, edm::Transition::BeginRun>()) {}
0012 
0013 edm::ParameterSetDescription EGHcalRecHitSelector::makePSetDescription() {
0014   edm::ParameterSetDescription desc;
0015   desc.add<int>("maxDIEta", 5);
0016   desc.add<int>("maxDIPhi", 5);
0017   desc.add<double>("minEnergyHB", 0.8);
0018   desc.add<double>("minEnergyHEDepth1", 0.1);
0019   desc.add<double>("minEnergyHEDefault", 0.2);
0020   return desc;
0021 }
0022 
0023 int EGHcalRecHitSelector::calDIEta(int iEta1, int iEta2) {
0024   int dEta = iEta1 - iEta2;
0025   if (iEta1 * iEta2 < 0) {  //-ve to +ve transistion and no crystal at zero
0026     if (dEta < 0)
0027       dEta++;
0028     else
0029       dEta--;
0030   }
0031   return dEta;
0032 }
0033 
0034 int EGHcalRecHitSelector::calDIPhi(int iPhi1, int iPhi2) {
0035   int dPhi = iPhi1 - iPhi2;
0036   if (dPhi > 72 / 2)
0037     dPhi -= 72;
0038   else if (dPhi < -72 / 2)
0039     dPhi += 72;
0040   return dPhi;
0041 }
0042 
0043 float EGHcalRecHitSelector::getMinEnergyHCAL_(HcalDetId id) const {
0044   if (id.subdetId() == HcalBarrel)
0045     return minEnergyHB_;
0046   else if (id.subdetId() == HcalEndcap) {
0047     if (id.depth() == 1)
0048       return minEnergyHEDepth1_;
0049     else
0050       return minEnergyHEDefault_;
0051   } else
0052     return std::numeric_limits<float>::max();
0053 }