Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:37

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