Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:10

0001 from RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_tools import *
0002 
0003 mvaVariablesFile        = "RecoEgamma/PhotonIdentification/data/PhotonMVAEstimatorRun2VariablesSpring15ValMaps.txt"
0004 
0005 #
0006 # In this file we define the locations of the MVA weights, cuts on the MVA values
0007 # for specific working points, and configure those cuts in VID
0008 #
0009 
0010 #
0011 # The following MVA is derived for Spring15 MC samples for non-triggering photons.
0012 # See more documentation in this presentation:
0013 #    https://indico.cern.ch/event/369237/contribution/2/attachments/1128009/1611753/egamma-July17-2015.pdf
0014 #    this also contains a minor update from email exchanges (thus move to V2)
0015 #    Specific docs for V2 are in this final presentation:
0016 #    https://indico.cern.ch/event/369241/contribution/1/attachments/1140148/1632879/egamma-Aug14-2015.pdf
0017 
0018 # This MVA implementation class name
0019 mvaSpring15NonTrigClassName = "PhotonMVAEstimator"
0020 # The tag is an extra string attached to the names of the products
0021 # such as ValueMaps that needs to distinguish cases when the same MVA estimator
0022 # class is used with different tuning/weights
0023 mvaTag = "Run2Spring15NonTrig50nsV2"
0024 
0025 # There are 2 categories in this MVA. They have to be configured in this strict order
0026 # (cuts and weight files order):
0027 #   0    barrel photons
0028 #   1    endcap photons
0029 
0030 mvaSpring15NonTrigWeightFiles_V2 = cms.vstring(
0031     path.join(weightFileBaseDir, "Spring15/50ns_EB_V2.weights.xml.gz"),
0032     path.join(weightFileBaseDir, "Spring15/50ns_EE_V2.weights.xml.gz"),
0033     )
0034 
0035 # The locatoins of value maps with the actual MVA values and categories
0036 # for all particles.
0037 # The names for the maps are "<module name>:<MVA class name>Values"
0038 # and "<module name>:<MVA class name>Categories"
0039 mvaProducerModuleLabel = "photonMVAValueMapProducer"
0040 mvaValueMapName        = mvaProducerModuleLabel + ":" + mvaSpring15NonTrigClassName + mvaTag + "Values"
0041 mvaCategoriesMapName   = mvaProducerModuleLabel + ":" + mvaSpring15NonTrigClassName + mvaTag + "Categories"
0042 
0043 # The working point for this MVA that is expected to have about 90% signal
0044 # efficiency in each category for photons with pt>30 GeV (somewhat lower
0045 # for lower pt photons).
0046 idName = "mvaPhoID-Spring15-50ns-nonTrig-V2-wp90"
0047 MVA_WP90 = PhoMVA_2Categories_WP(
0048     idName = idName,
0049     mvaValueMapName = mvaValueMapName,           # map with MVA values for all particles
0050     mvaCategoriesMapName = mvaCategoriesMapName, # map with category index for all particles
0051     cutCategory0 = 0.29538, # EB
0052     cutCategory1 = 0.45837  # EE
0053     )
0054 
0055 #
0056 # Finally, set up VID configuration for all cuts
0057 #
0058 
0059 # Create the PSet that will be fed to the MVA value map producer
0060 mvaPhoID_Spring15_50ns_nonTrig_V2_producer_config = cms.PSet(
0061     mvaName            = cms.string(mvaSpring15NonTrigClassName),
0062     mvaTag             = cms.string(mvaTag),
0063     weightFileNames    = mvaSpring15NonTrigWeightFiles_V2,
0064     variableDefinition  = cms.string(mvaVariablesFile),
0065     # Category parameters
0066     nCategories         = cms.int32(2),
0067     categoryCuts        = category_cuts
0068     )
0069 # Create the VPset's for VID cuts
0070 mvaPhoID_Spring15_50ns_nonTrig_V2_wp90 = configureVIDMVAPhoID_V1( MVA_WP90 )
0071 
0072 # The MD5 sum numbers below reflect the exact set of cut variables
0073 # and values above. If anything changes, one has to
0074 # 1) comment out the lines below about the registry,
0075 # 2) run "calculateMD5 <this file name> <one of the VID config names just above>
0076 # 3) update the MD5 sum strings below and uncomment the lines again.
0077 #
0078 
0079 central_id_registry.register( mvaPhoID_Spring15_50ns_nonTrig_V2_wp90.idName,
0080                               '541536b38c6a01f2ceded658477ff570')
0081 
0082 mvaPhoID_Spring15_50ns_nonTrig_V2_wp90.isPOGApproved = cms.untracked.bool(True)