Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:09

0001 import FWCore.ParameterSet.Config as cms
0002 import copy 
0003 
0004 process = cms.Process("ProcessOne")
0005 
0006 ##
0007 ## MessageLogger
0008 ##
0009 process.load('FWCore.MessageService.MessageLogger_cfi')   
0010 process.MessageLogger.cerr.enable = False
0011 process.MessageLogger.AlignPCLThresholdsWriter=dict()  
0012 process.MessageLogger.AlignPCLThresholds=dict()  
0013 process.MessageLogger.cout = cms.untracked.PSet(
0014     enable    = cms.untracked.bool(True),
0015     enableStatistics = cms.untracked.bool(True),
0016     threshold = cms.untracked.string("INFO"),
0017     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0018     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0019                                    reportEvery = cms.untracked.int32(1000)
0020                                    ),                                                      
0021     AlignPCLThresholdsWriter = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0022     AlignPCLThresholds       = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0023     AlignPCLThresholdsHG     = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0024     )
0025 
0026 ##
0027 ## Var Parsing
0028 ##
0029 import FWCore.ParameterSet.VarParsing as VarParsing
0030 options = VarParsing.VarParsing()
0031 options.register('writeLGpayload',
0032                 False,
0033                 VarParsing.VarParsing.multiplicity.singleton,
0034                 VarParsing.VarParsing.varType.bool,
0035                 "Write old payload type used for LG thresholds")
0036 options.parseArguments()
0037 
0038 ##
0039 ## Empty source
0040 ##
0041 process.source = cms.Source("EmptyIOVSource",
0042                             timetype = cms.string('runnumber'),
0043                             firstValue = cms.uint64(1),
0044                             lastValue = cms.uint64(1),
0045                             interval = cms.uint64(1)
0046                             )
0047 ##
0048 ## Database output service
0049 ##
0050 process.load("CondCore.CondDB.CondDB_cfi")
0051 
0052 ##
0053 ## Output database (in this case local sqlite file)
0054 ##
0055 process.CondDB.connect = 'sqlite_file:mythresholds_%s.db' % ("LG" if(options.writeLGpayload) else "HG")
0056 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0057                                           process.CondDB,
0058                                           timetype = cms.untracked.string('runnumber'),
0059                                           toPut = cms.VPSet(cms.PSet(record = cms.string('FooRcd'),
0060                                                                      tag = cms.string('PCLThresholds_express_v0')
0061                                                                      )
0062                                                             )
0063                                           )
0064 
0065 ##
0066 ## Impot the thresholds configuration
0067 ##
0068 import CondFormats.PCLConfig.Thresholds_cff as Thresholds
0069 import CondFormats.PCLConfig.ThresholdsHG_cff as ThresholdsHG
0070 
0071 ##
0072 ## Example on how to add to the default extra degrees of freedom
0073 ##
0074 AddSurfaceThresholds = copy.deepcopy(Thresholds.default)
0075 AddSurfaceThresholdsHG = copy.deepcopy(ThresholdsHG.default)
0076 
0077 BPixSurface= cms.VPSet(
0078     cms.PSet(alignableId       = cms.string("TPBModule"),
0079              DOF               = cms.string("Surface1"),
0080              cut               = cms.double(0.1),
0081              sigCut            = cms.double(0.1),
0082              maxMoveCut        = cms.double(0.1),
0083              maxErrorCut       = cms.double(10.0)
0084              )
0085     )
0086 
0087 DefaultPlusSurface = AddSurfaceThresholds+BPixSurface
0088 #print DefaultPlusSurface.dumpPython()
0089 
0090 [MODULE_NAME, THRS_NAME] = ["AlignPCLThresholdsLGWriter",AddSurfaceThresholds] if(options.writeLGpayload) else ["AlignPCLThresholdsHGWriter",AddSurfaceThresholdsHG]
0091 print("Writing payload with",MODULE_NAME)
0092 
0093 from CondFormats.PCLConfig.alignPCLThresholdsHGWriter_cfi import alignPCLThresholdsHGWriter
0094 from CondFormats.PCLConfig.alignPCLThresholdsLGWriter_cfi import alignPCLThresholdsLGWriter
0095 
0096 if(options.writeLGpayload):
0097     process.WriteInDB = alignPCLThresholdsLGWriter.clone(
0098         record = 'FooRcd',
0099         ### minimum number of records found in pede output
0100         minNRecords = 25000,
0101         #thresholds  = cms.VPSet()         # empty object
0102         #thresholds = DefaultPlusSurface   # add extra deegree of freedom
0103         thresholds =  THRS_NAME
0104     )
0105 else:
0106     process.WriteInDB = alignPCLThresholdsHGWriter.clone(
0107         record = 'FooRcd',
0108         ### minimum number of records found in pede output
0109         minNRecords = 25000,
0110         thresholds =  THRS_NAME
0111     )
0112 
0113 process.p = cms.Path(process.WriteInDB)