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