Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-04 02:55:17

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 
0005 process = cms.Process("Demo")
0006 
0007 ##
0008 ## prepare options
0009 ##
0010 options = VarParsing.VarParsing("analysis")
0011 
0012 options.register ('globalTag',
0013                   "103X_dataRun2_HLT_relval_v8",VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0014                   VarParsing.VarParsing.varType.string,          # string, int, or float
0015                   "GlobalTag")
0016 
0017 options.register ('forHLT',
0018                   True,VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0019                   VarParsing.VarParsing.varType.bool,          # string, int, or float
0020                   "is for SiPixelGainCalibrationForHLT")
0021 
0022 options.register ('firstRun',
0023                   1,VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0024                   VarParsing.VarParsing.varType.int,          # string, int, or float
0025                   "first run to be processed")
0026 
0027 options.parseArguments()
0028 
0029 ##
0030 ## MessageLogger
0031 ##
0032 process.load('FWCore.MessageService.MessageLogger_cfi')   
0033 process.MessageLogger.cerr.enable = False
0034 process.MessageLogger.SiPixelGainCalibScaler=dict()  
0035 process.MessageLogger.cout = cms.untracked.PSet(
0036     enable    = cms.untracked.bool(True),
0037     enableStatistics = cms.untracked.bool(True),
0038     threshold = cms.untracked.string("INFO"),
0039     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0040     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0041                                    reportEvery = cms.untracked.int32(100000)
0042                                    ),                                                      
0043     SiPixelGainCalibScaler = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0044     )
0045 
0046 process.load("Configuration.Geometry.GeometryRecoDB_cff") # Ideal geometry and interface 
0047 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0048 from Configuration.AlCa.GlobalTag import GlobalTag
0049 process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '')
0050 
0051 ### Dirty trick to avoid geometry mismatches
0052 process.trackerGeometryDB.applyAlignment = False
0053 
0054 ##
0055 ## Selects the output record
0056 ##
0057 MyRecord=""
0058 if options.forHLT:
0059     MyRecord="SiPixelGainCalibrationForHLTRcd"
0060 else:
0061     MyRecord="SiPixelGainCalibrationOfflineRcd"
0062 
0063 ##
0064 ## Printing options
0065 ##
0066 print("Using Global Tag:", process.GlobalTag.globaltag._value)
0067 print("first run to be processed:",options.firstRun)
0068 print("is for HLT? ","yes" if options.forHLT else "no!")
0069 print("outputing on record: ",MyRecord)
0070 
0071 ##
0072 ## Empty Source
0073 ##
0074 print("running over",options.maxEvents, "events")
0075 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents))
0076 
0077 ####################################################################
0078 # Empty source 
0079 ####################################################################
0080 process.source = cms.Source("EmptySource",
0081                             firstRun = cms.untracked.uint32(options.firstRun),
0082                             numberEventsInRun = cms.untracked.uint32(1),           # a number of events in single run 
0083                             )
0084 
0085 ####################################################################
0086 # Analysis Module
0087 ####################################################################
0088 process.demo = cms.EDAnalyzer('SiPixelGainCalibScaler',
0089                               isForHLT = cms.bool(options.forHLT),
0090                               record = cms.string(MyRecord),
0091                               parameters = cms.VPSet(
0092                                   cms.PSet(
0093                                       conversionFactor = cms.double(65.),
0094                                       conversionFactorL1 = cms.double(65.),
0095                                       offset = cms.double(-414.),
0096                                       offsetL1 = cms.double(-414.),
0097                                       phase = cms.uint32(0)
0098                                   ),
0099                                   cms.PSet(
0100                                       conversionFactor = cms.double(47.),
0101                                       conversionFactorL1 = cms.double(50.),
0102                                       offset = cms.double(-60.),
0103                                       offsetL1 = cms.double(-670.),
0104                                       phase = cms.uint32(1)
0105                                   )
0106                               )
0107                           )
0108 ##
0109 ## Database output service
0110 ##
0111 process.load("CondCore.CondDB.CondDB_cfi")
0112 
0113 ##
0114 ## Output database (in this case local sqlite file)
0115 ##
0116 process.CondDB.connect = 'sqlite_file:TEST_modifiedGains_'+process.GlobalTag.globaltag._value+("_HLTGain" if options.forHLT else "_offlineGain")+".db"
0117 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0118                                           process.CondDB,
0119                                           timetype = cms.untracked.string('runnumber'),
0120                                           toPut = cms.VPSet(cms.PSet(record = cms.string(MyRecord),
0121                                                                      tag = cms.string('scaledGains')
0122                                                                      )
0123                                                             )
0124                                           )
0125 
0126 process.p = cms.Path(process.demo)