Skip to content
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

[10_2_X] Syncing Egamma ID code with 10_4_X #25313

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion DQMOffline/Trigger/python/HLTEGTnPMonitor_cfi.py
Expand Up @@ -989,7 +989,7 @@
setupVIDSelection(egmGsfElectronIDsForDQM,item)


from RecoEgamma.PhotonIdentification.PhotonIDValueMapProducer_cfi import photonIDValueMapProducer
from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import photonIDValueMapProducer
from RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi import egmPhotonIDs
egmPhotonIDsForDQM = egmPhotonIDs.clone()
egmPhotonIDsForDQM.physicsObjectsIDs = cms.VPSet()
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/photons_cff.py
Expand Up @@ -11,7 +11,7 @@

from PhysicsTools.SelectorUtils.tools.vid_id_tools import setupVIDSelection
from RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi import *
from RecoEgamma.PhotonIdentification.PhotonIDValueMapProducer_cfi import *
from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import *
from RecoEgamma.PhotonIdentification.PhotonMVAValueMapProducer_cfi import *
from RecoEgamma.PhotonIdentification.PhotonRegressionValueMapProducer_cfi import *
from RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff import *
Expand Down
2 changes: 2 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Expand Up @@ -318,8 +318,10 @@ def miniAOD_customizeCommon(process):
#VID Photon IDs
process.patPhotons.addPhotonID = cms.bool(True)
photon_ids = ['RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff',
'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V2_cff',
'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1_cff',
'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff',
'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V2_cff',
'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff',
'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff']
switchOnVIDPhotonIdProducer(process,DataFormat.AOD, task)
Expand Down
4 changes: 1 addition & 3 deletions RecoEgamma/EgammaTools/BuildFile.xml
Expand Up @@ -7,15 +7,13 @@
<use name="RecoLocalCalo/HGCalRecAlgos"/>
<use name="clhep"/>
<use name="root"/>
<use name="PhysicsTools/MVAComputer"/>
<use name="PhysicsTools/MVATrainer"/>
<use name="roottmva"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/EgammaObjects"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="CondCore/DBOutputService"/>
<use name="DataFormats/ParticleFlowReco"/>
<use name="CommonTools/Utils"/>
<use name="roottmva"/>
<export>
<lib name="1"/>
</export>
50 changes: 36 additions & 14 deletions RecoEgamma/EgammaTools/interface/AnyMVAEstimatorRun2Base.h
Expand Up @@ -12,46 +12,68 @@ class AnyMVAEstimatorRun2Base {

public:
// Constructor, destructor
AnyMVAEstimatorRun2Base(const edm::ParameterSet& conf) : conf_(conf) {}
AnyMVAEstimatorRun2Base(const edm::ParameterSet& conf)
: tag_ (conf.getParameter<std::string>("mvaTag"))
, nCategories_ (conf.getParameter<int>("nCategories"))
, debug_ (conf.getUntrackedParameter<bool>("debug", false))
{}

AnyMVAEstimatorRun2Base(const::std::string& mvaName,
const::std::string& mvaTag,
int nCategories,
bool debug)
: name_ (mvaName)
, tag_ (mvaTag)
, nCategories_ (nCategories)
, debug_ (debug)
{}
virtual ~AnyMVAEstimatorRun2Base(){};

// Functions that must be provided in derived classes
// These function should work on electrons or photons
// of the reco or pat type

virtual float mvaValue( const edm::Ptr<reco::Candidate>& particle, const edm::EventBase&) const = 0;
virtual float mvaValue( const reco::Candidate* candidate, std::vector<float> const& auxVariables, int &iCategory) const = 0;
float mvaValue( const reco::Candidate* candidate, std::vector<float> const& auxVariables) const {
int iCategory;
return mvaValue(candidate, auxVariables, iCategory);
};

// A specific implementation of MVA is expected to have one or more categories
// defined with respect to eta, pt, etc.
// This function determines the category for a given particle.
virtual int findCategory( const edm::Ptr<reco::Candidate>& particle) const = 0;
virtual int getNCategories() const = 0;
// The name is a unique name associated with a particular MVA implementation,
// it is found as a const data member in a derived class.
virtual const std::string& getName() const = 0;
// This function determines the category for a given candidate.
virtual int findCategory( const reco::Candidate* candidate) const = 0;
int getNCategories() const { return nCategories_; }
const std::string& getName() const { return name_; }
// An extra variable string set during construction that can be used
// to distinguish different instances of the estimator configured with
// different weight files. The tag can be used to construct names of ValueMaps, etc.
virtual const std::string& getTag() const = 0;
const std::string& getTag() const { return tag_; }

bool isDebug() const { return debug_; }
//
// Extra event content - if needed.
//
// Some MVA implementation may require direct access to event content.
// Implement these methods only if needed in the derived classes (use "override"
// for certainty).

// This method needs to be used only once after this MVA estimator is constructed
virtual void setConsumes(edm::ConsumesCollector &&cc) const {};

private:

//
// Data members
//
// Configuration
const edm::ParameterSet conf_;
const std::string name_;

// MVA tag. This is an additional string variable to distinguish
// instances of the estimator of this class configured with different
// weight files.
const std::string tag_;

// The number of categories and number of variables per category
const int nCategories_;

const bool debug_;
};

// define the factory for this base class
Expand Down
26 changes: 13 additions & 13 deletions RecoEgamma/EgammaTools/interface/ConversionTools.h
Expand Up @@ -48,30 +48,30 @@ class ConversionTools


static bool hasMatchedConversion(const reco::GsfElectron &ele,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);

static bool hasMatchedConversion(const reco::TrackRef &trk,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);

static bool hasMatchedConversion(const reco::SuperCluster &sc,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, float dRMax = 0.1, float dEtaMax = 999., float dPhiMax = 999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, float dRMax = 0.1, float dEtaMax = 999., float dPhiMax = 999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);


static reco::ConversionRef matchedConversion(const reco::GsfElectron &ele,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);
static reco::Conversion const* matchedConversion(const reco::GsfElectron &ele,
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);

static reco::ConversionRef matchedConversion(const reco::TrackRef &trk,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);
static reco::Conversion const* matchedConversion(const reco::TrackRef &trk,
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);

static reco::ConversionRef matchedConversion(const reco::SuperCluster &sc,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, float dRMax = 0.1, float dEtaMax = 999., float dPhiMax = 999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);
static reco::Conversion const* matchedConversion(const reco::SuperCluster &sc,
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, float dRMax = 0.1, float dEtaMax = 999., float dPhiMax = 999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1);

static bool hasMatchedPromptElectron(const reco::SuperClusterRef &sc, const edm::Handle<reco::GsfElectronCollection> &eleCol,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);
static bool hasMatchedPromptElectron(const reco::SuperClusterRef &sc, const reco::GsfElectronCollection &eleCol,
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);


static reco::GsfElectronRef matchedPromptElectron(const reco::SuperClusterRef &sc, const edm::Handle<reco::GsfElectronCollection> &eleCol,
const edm::Handle<reco::ConversionCollection> &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);
static reco::GsfElectron const* matchedPromptElectron(const reco::SuperClusterRef &sc, const reco::GsfElectronCollection &eleCol,
const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0);

};
#endif
1 change: 0 additions & 1 deletion RecoEgamma/EgammaTools/interface/EffectiveAreas.h
Expand Up @@ -10,7 +10,6 @@ class EffectiveAreas {
public:
// Constructor, destructor
EffectiveAreas(const std::string& filename);
~EffectiveAreas();

// Accessors
const float getEffectiveArea(float eta) const;
Expand Down
30 changes: 0 additions & 30 deletions RecoEgamma/EgammaTools/interface/MVAObjectCache.h

This file was deleted.