Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:26

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 class ValidFFTJetLUT:
0004     """
0005     A class which contains the info about a valid combination
0006     of ES record types and ES producer type for FFTJet lookup tables
0007     """
0008     def __init__(self, basename):
0009         self.basename = basename
0010         self.dbTag = "FFT" + basename + "TableDBTag"
0011         self.dbRecord = "FFT" + basename + "ParametersRcd"
0012         self.LUTRecord = "FFT" + basename + "TableRcd"
0013         self.esProducer = "FFT" + basename + "TableESProducer"
0014 
0015 # The following dictionary contains valid combinations of ES record
0016 # types and ES producer type for FFTJet (pileup) lookup tables.
0017 #
0018 # The dictionary keys used here correspond to the types defined in
0019 # CondFormats/JetMETObjects/interface/FFTJetLUTTypes.h
0020 #
0021 # The database ES record types are listed in
0022 # CondFormats/DataRecord/interface/FFTJetCorrectorParametersRcdTypes.h
0023 #
0024 # The jet correction sequence types (which depend on the corresponding
0025 # database ES record types) are listed in
0026 # JetMETCorrections/FFTJetObjects/interface/FFTJetLookupTableRcdTypes.h
0027 #
0028 # The ES producer types are defined in 
0029 # JetMCorrections/FFTJetModules/plugins/FFTJetLookupTableESProducer.cc
0030 #
0031 fftjet_lut_types = {
0032     "EtaFlatteningFactors"   : ValidFFTJetLUT("EtaFlatteningFactors"),
0033     "PileupRhoCalibration"   : ValidFFTJetLUT("PileupRhoCalibration"),
0034     "PileupRhoEtaDependence" : ValidFFTJetLUT("PileupRhoEtaDependence"),
0035     "LUT0"                   : ValidFFTJetLUT("LUT0"),
0036     "LUT1"                   : ValidFFTJetLUT("LUT1"),
0037     "LUT2"                   : ValidFFTJetLUT("LUT2"),
0038     "LUT3"                   : ValidFFTJetLUT("LUT3"),
0039     "LUT4"                   : ValidFFTJetLUT("LUT4"),
0040     "LUT5"                   : ValidFFTJetLUT("LUT5"),
0041     "LUT6"                   : ValidFFTJetLUT("LUT6"),
0042     "LUT7"                   : ValidFFTJetLUT("LUT7"),
0043     "LUT8"                   : ValidFFTJetLUT("LUT8"),
0044     "LUT9"                   : ValidFFTJetLUT("LUT9"),
0045     "LUT10"                  : ValidFFTJetLUT("LUT10"),
0046     "LUT11"                  : ValidFFTJetLUT("LUT11"),
0047     "LUT12"                  : ValidFFTJetLUT("LUT12"),
0048     "LUT13"                  : ValidFFTJetLUT("LUT13"),
0049     "LUT14"                  : ValidFFTJetLUT("LUT14"),
0050     "LUT15"                  : ValidFFTJetLUT("LUT15")
0051 }
0052 
0053 #
0054 # Procedure for configuring the L2-L3 FFTJet ES producer. This
0055 # producer turns the database record into a set of lookup table types.
0056 # The "sequenceTag" argument should be set to one of the keys in the
0057 # "fftjet_lut_types" dictionary.
0058 #
0059 def configure_fftjetlut_esproducer(sequenceTag):
0060     #
0061     # The ES producer name comes from the C++ plugin registration code
0062     esProducer = fftjet_lut_types[sequenceTag].esProducer
0063     config = cms.ESProducer(
0064         esProducer,
0065         tables = cms.VPSet(
0066         cms.PSet(
0067         name = cms.string('.*'),
0068         nameIsRegex = cms.bool(True),
0069         category = cms.string('.*'),
0070         categoryIsRegex = cms.bool(True)
0071             )
0072     ),
0073         isArchiveCompressed = cms.bool(False),
0074         verbose = cms.untracked.bool(False)
0075     )
0076     return (config, esProducer)
0077 
0078 #
0079 # Procedure for configuring the ES source which fetches
0080 # the database record. "process.CondDBCommon" should be
0081 # already defined before calling this procedure.
0082 #
0083 def configure_fftjetlut_pooldbessource(process, sequenceTag):
0084     config = cms.ESSource(
0085         "PoolDBESSource",
0086         process.CondDBCommon,
0087         toGet = cms.VPSet(cms.PSet(
0088             record = cms.string(fftjet_lut_types[sequenceTag].dbRecord),
0089             tag = cms.string(fftjet_lut_types[sequenceTag].dbTag),
0090         ))
0091     )
0092     sourceName = "FFT" + sequenceTag + "DBESSource"
0093     setattr(process, sourceName, config)
0094     return