File indexing completed on 2022-12-09 23:46:49
0001 import FWCore.ParameterSet.Config as cms
0002
0003
0004
0005
0006
0007
0008 mvaClassName = "ElectronMVAEstimatorRun2"
0009
0010
0011
0012
0013
0014 mvaProducerModuleLabel = "electronMVAValueMapProducer"
0015
0016
0017 mvaVariablesFile = "RecoEgamma/ElectronIdentification/data/ElectronMVAEstimatorRun2Variables.txt"
0018 mvaVariablesFileRun3 = "RecoEgamma/ElectronIdentification/data/ElectronIDVariablesRun3.txt"
0019
0020
0021
0022
0023
0024 EleMVA_3CategoriesCuts = [
0025 "abs(superCluster.eta) < 0.800",
0026 "abs(superCluster.eta) >= 0.800 && abs(superCluster.eta) < 1.479",
0027 "abs(superCluster.eta) >= 1.479"
0028 ]
0029
0030 EleMVA_6CategoriesCuts = [
0031 "pt < 10. && abs(superCluster.eta) < 0.800",
0032 "pt < 10. && abs(superCluster.eta) >= 0.800 && abs(superCluster.eta) < 1.479",
0033 "pt < 10. && abs(superCluster.eta) >= 1.479",
0034 "pt >= 10. && abs(superCluster.eta) < 0.800",
0035 "pt >= 10. && abs(superCluster.eta) >= 0.800 && abs(superCluster.eta) < 1.479",
0036 "pt >= 10. && abs(superCluster.eta) >= 1.479",
0037 ]
0038
0039
0040
0041
0042
0043 class EleMVA_WP:
0044 """
0045 This is a container class to hold MVA cut values for a n-category MVA
0046 as well as the names of the value maps that contain the MVA values computed
0047 for all particles in a producer upstream.
0048
0049 IMPORTANT: the cuts need to be given in alphabetical order, which must
0050 be the order in which they are used by the cut class.
0051 """
0052 def __init__(self,
0053 idName,
0054 mvaTag,
0055 **cuts
0056 ):
0057 self.idName = idName
0058
0059 self.mvaValueMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Values"
0060
0061 self.mvaCategoriesMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Categories"
0062 self.cuts = cuts
0063
0064 def getCutStrings(self):
0065 keylist = sorted(self.cuts.keys())
0066 return [self.cuts[key] for key in keylist]
0067
0068 class EleMVARaw_WP:
0069 """
0070 This is a container class to hold MVA cut values for a n-category MVA
0071 as well as the names of the value maps that contain the MVA values computed
0072 for all particles in a producer upstream.
0073
0074 IMPORTANT: the cuts need to be given in alphabetical order, which must
0075 be the order in which they are used by the cut class.
0076 """
0077 def __init__(self,
0078 idName,
0079 mvaTag,
0080 **cuts
0081 ):
0082 self.idName = idName
0083
0084 self.mvaValueMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "RawValues"
0085
0086 self.mvaCategoriesMapName = mvaProducerModuleLabel + ":" + mvaClassName + mvaTag + "Categories"
0087 self.cuts = cuts
0088
0089 def getCutStrings(self):
0090 keylist = sorted(self.cuts.keys())
0091 return [self.cuts[key] for key in keylist]
0092
0093
0094
0095
0096
0097 def configureVIDMVAEleID(mvaWP, cutName="GsfEleMVACut"):
0098 """
0099 This function configures the full cms.PSet for a VID ID and returns it.
0100 The inputs: an object of the class EleMVA_WP or similar
0101 that contains all necessary parameters for this MVA.
0102 """
0103 pSet = cms.PSet(
0104
0105 idName = cms.string( mvaWP.idName ),
0106 cutFlow = cms.VPSet(
0107 cms.PSet( cutName = cms.string(cutName),
0108 mvaCuts = cms.vstring( mvaWP.getCutStrings() ),
0109 mvaValueMapName = cms.InputTag( mvaWP.mvaValueMapName ),
0110 mvaCategoriesMapName = cms.InputTag( mvaWP.mvaCategoriesMapName ),
0111 needsAdditionalProducts = cms.bool(True),
0112 isIgnored = cms.bool(False)
0113 )
0114 )
0115 )
0116
0117 return pSet