-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
EGM ID Update 80X #12740
Merged
Merged
EGM ID Update 80X #12740
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cd9e37d
Fixed erroneous comments
ikrav 0f7ed6a
Allow zero effective areas
ikrav 46f4117
Effective areas for the 25ns cut-based photon ID
ikrav 37f1d6e
The new 25ns cut-based photon ID implementation
ikrav 8f10609
update photon unit tests
lgray 28bb2aa
update miniaod to 25ns Spring15 photon ID
lgray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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: 15 additions & 0 deletions
15
...entification/data/Spring15/effAreaPhotons_cone03_pfChargedHadrons_25ns_NULLcorrection.txt
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,15 @@ | ||
# This file contains Effective Area constants for | ||
# computing pile-up corrections for the charged hadron isolation | ||
# for a photon object. | ||
# | ||
# ALL CONSTANTS ARE ZEROED because it was determined that it is best | ||
# not to correct the charged isolation for pile-up this time. | ||
# | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.0 | ||
1.0000 1.4790 0.0 | ||
1.4790 2.0000 0.0 | ||
2.0000 2.2000 0.0 | ||
2.2000 2.3000 0.0 | ||
2.3000 2.4000 0.0 | ||
2.4000 5.0000 0.0 |
2 changes: 1 addition & 1 deletion
2
...Egamma/PhotonIdentification/data/Spring15/effAreaPhotons_cone03_pfChargedHadrons_50ns.txt
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
14 changes: 14 additions & 0 deletions
14
...entification/data/Spring15/effAreaPhotons_cone03_pfNeutralHadrons_25ns_90percentBased.txt
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,14 @@ | ||
# This file contains Effective Area constants for | ||
# computing pile-up corrections for the neutral hadron isolation | ||
# for a photon object. | ||
# | ||
# The effective areas are derived based on the 90% contour method. | ||
# | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.0599 | ||
1.0000 1.4790 0.0819 | ||
1.4790 2.0000 0.0696 | ||
2.0000 2.2000 0.0360 | ||
2.2000 2.3000 0.0360 | ||
2.3000 2.4000 0.0462 | ||
2.4000 5.0000 0.0656 |
2 changes: 1 addition & 1 deletion
2
...Egamma/PhotonIdentification/data/Spring15/effAreaPhotons_cone03_pfNeutralHadrons_50ns.txt
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
14 changes: 14 additions & 0 deletions
14
...hotonIdentification/data/Spring15/effAreaPhotons_cone03_pfPhotons_25ns_90percentBased.txt
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,14 @@ | ||
# This file contains Effective Area constants for | ||
# computing pile-up corrections for the photons isolation | ||
# for a photon object. | ||
# | ||
# The constants are based on 90% contours of isolation. | ||
# | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.1271 | ||
1.0000 1.4790 0.1101 | ||
1.4790 2.0000 0.0756 | ||
2.0000 2.2000 0.1175 | ||
2.2000 2.3000 0.1498 | ||
2.3000 2.4000 0.1857 | ||
2.4000 5.0000 0.2183 |
175 changes: 175 additions & 0 deletions
175
RecoEgamma/PhotonIdentification/plugins/cuts/PhoAnyPFIsoWithEAAndQuadScalingCut.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,175 @@ | ||
#include "PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h" | ||
#include "DataFormats/EgammaCandidates/interface/Photon.h" | ||
#include "RecoEgamma/EgammaTools/interface/EffectiveAreas.h" | ||
|
||
|
||
class PhoAnyPFIsoWithEAAndQuadScalingCut : public CutApplicatorWithEventContentBase { | ||
public: | ||
PhoAnyPFIsoWithEAAndQuadScalingCut(const edm::ParameterSet& c); | ||
|
||
result_type operator()(const reco::PhotonPtr&) const override final; | ||
|
||
void setConsumes(edm::ConsumesCollector&) override final; | ||
void getEventContent(const edm::EventBase&) override final; | ||
|
||
double value(const reco::CandidatePtr& cand) const override final; | ||
|
||
CandidateType candidateType() const override final { | ||
return PHOTON; | ||
} | ||
|
||
private: | ||
// Cut values | ||
float _C1_EB; | ||
float _C2_EB; | ||
float _C3_EB; | ||
float _C1_EE; | ||
float _C2_EE; | ||
float _C3_EE; | ||
// Configuration | ||
float _barrelCutOff; | ||
bool _useRelativeIso; | ||
// Effective area constants | ||
EffectiveAreas _effectiveAreas; | ||
// The isolations computed upstream | ||
edm::Handle<edm::ValueMap<float> > _anyPFIsoMap; | ||
// The rho | ||
edm::Handle< double > _rhoHandle; | ||
|
||
constexpr static char anyPFIsoWithEA_[] = "anyPFIsoWithEA"; | ||
constexpr static char rhoString_ [] = "rho"; | ||
}; | ||
|
||
constexpr char PhoAnyPFIsoWithEAAndQuadScalingCut::anyPFIsoWithEA_[]; | ||
constexpr char PhoAnyPFIsoWithEAAndQuadScalingCut::rhoString_[]; | ||
|
||
DEFINE_EDM_PLUGIN(CutApplicatorFactory, | ||
PhoAnyPFIsoWithEAAndQuadScalingCut, | ||
"PhoAnyPFIsoWithEAAndQuadScalingCut"); | ||
|
||
PhoAnyPFIsoWithEAAndQuadScalingCut::PhoAnyPFIsoWithEAAndQuadScalingCut(const edm::ParameterSet& c) : | ||
CutApplicatorWithEventContentBase(c), | ||
_C1_EB(c.getParameter<double>("C1_EB")), | ||
_C2_EB(c.getParameter<double>("C2_EB")), | ||
_C3_EB(c.getParameter<double>("C3_EB")), | ||
_C1_EE(c.getParameter<double>("C1_EE")), | ||
_C2_EE(c.getParameter<double>("C2_EE")), | ||
_C3_EE(c.getParameter<double>("C3_EE")), | ||
_barrelCutOff(c.getParameter<double>("barrelCutOff")), | ||
_useRelativeIso(c.getParameter<bool>("useRelativeIso")), | ||
_effectiveAreas( (c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath()) | ||
{ | ||
|
||
edm::InputTag maptag = c.getParameter<edm::InputTag>("anyPFIsoMap"); | ||
contentTags_.emplace(anyPFIsoWithEA_,maptag); | ||
|
||
edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho"); | ||
contentTags_.emplace(rhoString_,rhoTag); | ||
|
||
} | ||
|
||
void PhoAnyPFIsoWithEAAndQuadScalingCut::setConsumes(edm::ConsumesCollector& cc) { | ||
auto anyPFIsoWithEA = | ||
cc.consumes<edm::ValueMap<float> >(contentTags_[anyPFIsoWithEA_]); | ||
contentTokens_.emplace(anyPFIsoWithEA_,anyPFIsoWithEA); | ||
|
||
auto rho = cc.consumes<double>(contentTags_[rhoString_]); | ||
contentTokens_.emplace(rhoString_, rho); | ||
} | ||
|
||
void PhoAnyPFIsoWithEAAndQuadScalingCut::getEventContent(const edm::EventBase& ev) { | ||
ev.getByLabel(contentTags_[anyPFIsoWithEA_],_anyPFIsoMap); | ||
ev.getByLabel(contentTags_[rhoString_],_rhoHandle); | ||
} | ||
|
||
CutApplicatorBase::result_type | ||
PhoAnyPFIsoWithEAAndQuadScalingCut:: | ||
operator()(const reco::PhotonPtr& cand) const{ | ||
|
||
// in case we are by-value | ||
const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance(); | ||
edm::Ptr<pat::Photon> pat(cand); | ||
float anyisoval = -1.0; | ||
if( _anyPFIsoMap.isValid() && _anyPFIsoMap->contains( cand.id() ) ) { | ||
anyisoval = (*_anyPFIsoMap)[cand]; | ||
} else if ( _anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 && | ||
cand.id() == edm::ProductID() ) { | ||
// in case we have spoofed a ptr | ||
//note this must be a 1:1 valuemap (only one product input) | ||
anyisoval = _anyPFIsoMap->begin()[cand.key()]; | ||
} else if ( _anyPFIsoMap.isValid() ){ // throw an exception | ||
anyisoval = (*_anyPFIsoMap)[cand]; | ||
} | ||
|
||
// Figure out the cut value | ||
// The value is generally pt-dependent: C1 + pt * C2 | ||
const float pt = cand->pt(); | ||
|
||
// In this version of the isolation cut we apply | ||
// exponential pt scaling to the barrel isolation cut, | ||
// and linear pt scaling to the endcap isolation cut. | ||
double absEta = std::abs(cand->superCluster()->eta()); | ||
const float isolationCutValue = | ||
( absEta < _barrelCutOff ? | ||
_C1_EB + pt*_C2_EB + pt*pt*_C3_EB | ||
: _C1_EE + pt*_C2_EE + pt*pt*_C3_EE ); | ||
|
||
// Retrieve the variable value for this particle | ||
float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name); | ||
|
||
// Apply pile-up correction | ||
double eA = _effectiveAreas.getEffectiveArea( absEta ); | ||
double rho = *_rhoHandle; | ||
float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA); | ||
|
||
// Divide by pT if the relative isolation is requested | ||
if( _useRelativeIso ) | ||
anyPFIsoWithEA /= pt; | ||
|
||
// Apply the cut and return the result | ||
return anyPFIsoWithEA < isolationCutValue; | ||
} | ||
|
||
double PhoAnyPFIsoWithEAAndQuadScalingCut:: | ||
value(const reco::CandidatePtr& cand) const { | ||
reco::PhotonPtr pho(cand); | ||
|
||
// in case we are by-value | ||
const std::string& inst_name = contentTags_.find(anyPFIsoWithEA_)->second.instance(); | ||
edm::Ptr<pat::Photon> pat(cand); | ||
float anyisoval = -1.0; | ||
if( _anyPFIsoMap.isValid() && _anyPFIsoMap->contains( cand.id() ) ) { | ||
anyisoval = (*_anyPFIsoMap)[cand]; | ||
} else if ( _anyPFIsoMap.isValid() && _anyPFIsoMap->idSize() == 1 && | ||
cand.id() == edm::ProductID() ) { | ||
// in case we have spoofed a ptr | ||
//note this must be a 1:1 valuemap (only one product input) | ||
anyisoval = _anyPFIsoMap->begin()[cand.key()]; | ||
} else if ( _anyPFIsoMap.isValid() ){ // throw an exception | ||
anyisoval = (*_anyPFIsoMap)[cand]; | ||
} | ||
|
||
// Figure out the cut value | ||
// The value is generally pt-dependent: C1 + pt * C2 | ||
const float pt = pho->pt(); | ||
|
||
// In this version of the isolation cut we apply | ||
// exponential pt scaling to the barrel isolation cut, | ||
// and linear pt scaling to the endcap isolation cut. | ||
double absEta = std::abs(pho->superCluster()->eta()); | ||
|
||
// Retrieve the variable value for this particle | ||
float anyPFIso = _anyPFIsoMap.isValid() ? anyisoval : pat->userFloat(inst_name); | ||
|
||
// Apply pile-up correction | ||
double eA = _effectiveAreas.getEffectiveArea( absEta ); | ||
double rho = *_rhoHandle; | ||
float anyPFIsoWithEA = std::max(0.0, anyPFIso - rho * eA); | ||
|
||
// Divide by pT if the relative isolation is requested | ||
if( _useRelativeIso ) | ||
anyPFIsoWithEA /= pt; | ||
|
||
// Apply the cut and return the result | ||
return anyPFIsoWithEA; | ||
} |
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.
Would it be better to use
getByToken()
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.
This is necessary for the classes to operate in (py)FWLite and full CMSSW.
The consumes interface does not exist in
edm::EventBase
.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.
An explanatory comment to that effect would be helpful 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.
You cannot call consumes in FWLite and thus getbytoken cannot work. Likewise the accessor's are not available in
edm::EventBase
and cannot be used in this function.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.
@Dr15Jones - can we can this behavior?
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.
@davidlange6 Are you asking if we can get rid of this behavior? That is you want us to invent a new mechanism in FWLite to allow equivalent
consumes
behavior?