Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23540 from Sam-Harper/HCALRecHitsMiniAOD_1020pre5
Adding HBHE rechits to miniAOD
- Loading branch information
Showing
10 changed files
with
226 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
RecoEgamma/EgammaIsolationAlgos/interface/EGHcalRecHitSelector.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#ifndef RecoEgamam_EgammaIsolationAlgos_EGHcalRecHitSelector_h | ||
#define RecoEgamam_EgammaIsolationAlgos_EGHcalRecHitSelector_h | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
||
#include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" | ||
#include "Geometry/Records/interface/CaloGeometryRecord.h" | ||
|
||
#include "DataFormats/EgammaReco/interface/SuperCluster.h" | ||
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" | ||
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" | ||
|
||
class EGHcalRecHitSelector { | ||
public: | ||
explicit EGHcalRecHitSelector(const edm::ParameterSet& config); | ||
~EGHcalRecHitSelector(){} | ||
|
||
template<typename CollType> | ||
void addDetIds(const reco::SuperCluster& superClus,const HBHERecHitCollection& recHits, | ||
CollType& detIdsToStore)const; | ||
|
||
void setup(const edm::EventSetup& iSetup){iSetup.get<CaloGeometryRecord>().get(towerMap_);} | ||
|
||
static edm::ParameterSetDescription makePSetDescription(); | ||
|
||
private: | ||
static int calDIPhi(int iPhi1,int iPhi2); | ||
static int calDIEta(int iEta1,int iEta2); | ||
float getMinEnergyHCAL_(HcalDetId id)const; | ||
|
||
int maxDIEta_; | ||
int maxDIPhi_; | ||
float minEnergyHB_; | ||
float minEnergyHEDepth1_; | ||
float minEnergyHEDefault_; | ||
|
||
edm::ESHandle<CaloTowerConstituentsMap> towerMap_; | ||
|
||
}; | ||
|
||
template <typename CollType> | ||
void EGHcalRecHitSelector:: | ||
addDetIds(const reco::SuperCluster& superClus,const HBHERecHitCollection& recHits, | ||
CollType& detIdsToStore)const | ||
{ | ||
DetId seedId = superClus.seed()->seed(); | ||
if(seedId.det() != DetId::Ecal && seedId.det() != DetId::Forward) { | ||
edm::LogError("EgammaIsoHcalDetIdCollectionProducerError") << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong"; | ||
return; | ||
} | ||
//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 | ||
|
||
if( seedId.det() == DetId::Forward ) return; | ||
|
||
CaloTowerDetId towerId(towerMap_->towerOf(seedId)); | ||
int seedHcalIEta = towerId.ieta(); | ||
int seedHcalIPhi = towerId.iphi(); | ||
|
||
for(auto& recHit : recHits){ | ||
int dIEtaAbs = std::abs(calDIEta(seedHcalIEta,recHit.id().ieta())); | ||
int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi,recHit.id().iphi())); | ||
|
||
if(dIEtaAbs<=maxDIEta_ && dIPhiAbs<=maxDIPhi_ && recHit.energy()>getMinEnergyHCAL_(recHit.id())) detIdsToStore.insert(detIdsToStore.end(),recHit.id().rawId()); | ||
} | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
RecoEgamma/EgammaIsolationAlgos/python/interestingEgammaIsoHCALDetIdModule_cff.py
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
RecoEgamma/EgammaIsolationAlgos/src/EGHcalRecHitSelector.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "RecoEgamma/EgammaIsolationAlgos/interface/EGHcalRecHitSelector.h" | ||
|
||
#include<limits> | ||
|
||
EGHcalRecHitSelector::EGHcalRecHitSelector(const edm::ParameterSet& config): | ||
maxDIEta_(config.getParameter<int>("maxDIEta")), | ||
maxDIPhi_(config.getParameter<int>("maxDIPhi")), | ||
minEnergyHB_(config.getParameter<double>("minEnergyHB")), | ||
minEnergyHEDepth1_(config.getParameter<double>("minEnergyHEDepth1")), | ||
minEnergyHEDefault_(config.getParameter<double>("minEnergyHEDefault")) | ||
{ | ||
|
||
} | ||
|
||
edm::ParameterSetDescription EGHcalRecHitSelector::makePSetDescription() | ||
{ | ||
edm::ParameterSetDescription desc; | ||
desc.add<int>("maxDIEta",5); | ||
desc.add<int>("maxDIPhi",5); | ||
desc.add<double>("minEnergyHB",0.8); | ||
desc.add<double>("minEnergyHEDepth1",0.1); | ||
desc.add<double>("minEnergyHEDefault",0.2); | ||
return desc; | ||
} | ||
|
||
int EGHcalRecHitSelector::calDIEta(int iEta1,int iEta2) | ||
{ | ||
int dEta = iEta1-iEta2; | ||
if(iEta1*iEta2<0) {//-ve to +ve transistion and no crystal at zero | ||
if(dEta<0) dEta++; | ||
else dEta--; | ||
} | ||
return dEta; | ||
} | ||
|
||
|
||
int EGHcalRecHitSelector::calDIPhi(int iPhi1,int iPhi2) | ||
{ | ||
int dPhi = iPhi1-iPhi2; | ||
if(dPhi>72/2) dPhi-=72; | ||
else if(dPhi<-72/2) dPhi+=72; | ||
return dPhi; | ||
} | ||
|
||
float EGHcalRecHitSelector::getMinEnergyHCAL_(HcalDetId id)const | ||
{ | ||
if(id.subdetId()==HcalBarrel) return minEnergyHB_; | ||
else if(id.subdetId()==HcalEndcap){ | ||
if(id.depth()==1) return minEnergyHEDepth1_; | ||
else return minEnergyHEDefault_; | ||
}else return std::numeric_limits<float>::max(); | ||
|
||
} |
Oops, something went wrong.