New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding HBHE rechits to miniAOD #23540
Merged
cmsbuild
merged 2 commits into
cms-sw:master
from
Sam-Harper:HCALRecHitsMiniAOD_1020pre5
Jun 22, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should better return here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done