Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:38:21

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 process = cms.Process("Test")
0005 
0006 options = VarParsing.VarParsing("analysis")
0007 
0008 options.register ('isUnitTest',
0009                   False,
0010                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0011                   VarParsing.VarParsing.varType.bool,            # string, int, or float
0012                   "GlobalTag")
0013 
0014 options.register ('runNumber',
0015                   359334,
0016                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0017                   VarParsing.VarParsing.varType.int,            # string, int, or float
0018                   "run number")
0019 
0020 options.register ('FEDsToAdd',
0021                   [],
0022                   VarParsing.VarParsing.multiplicity.list,  # singleton or list
0023                   VarParsing.VarParsing.varType.int,        # string, int, or float
0024                   "list of FEDs to Add")
0025 
0026 options.register ('FEDsToRemove',
0027                   [],
0028                   VarParsing.VarParsing.multiplicity.list,  # singleton or list
0029                   VarParsing.VarParsing.varType.int,        # string, int, or float
0030                   "list of FEDs to Remove")
0031 
0032 options.register ('DetIdsToAdd',
0033                   [],
0034                   VarParsing.VarParsing.multiplicity.list,  # singleton or list
0035                   VarParsing.VarParsing.varType.int,        # string, int, or float
0036                   "list of DetIds to Add")
0037 
0038 options.register ('DetIdsToRemove',
0039                   [],
0040                   VarParsing.VarParsing.multiplicity.list,  # singleton or list
0041                   VarParsing.VarParsing.varType.int,        # string, int, or float
0042                   "list of DetIds to Remove")
0043 
0044 
0045 options.register ('inputConnection',
0046                   "frontier://FrontierProd/CMS_CONDITIONS",
0047                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0048                   VarParsing.VarParsing.varType.string,            # string, int, or float
0049                   "input DB connection")
0050 
0051 options.register ('inputTag',
0052                   "SiStripBadChannel_Ideal_31X_v2",
0053                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0054                   VarParsing.VarParsing.varType.string,            # string, int, or float
0055                   "input DB tag")
0056 
0057 options.register ('outputTag',
0058                   "output",
0059                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0060                   VarParsing.VarParsing.varType.string,            # string, int, or float
0061                   "output DB tag")
0062 
0063 
0064 options.parseArguments()
0065 
0066 process.maxEvents = cms.untracked.PSet(
0067     input = cms.untracked.int32(1)
0068 )
0069 
0070 process.source = cms.Source("EmptySource",
0071                             firstRun = cms.untracked.uint32(options.runNumber),
0072                             numberEventsInRun = cms.untracked.uint32(1),
0073                             )
0074 
0075 process.MessageLogger = cms.Service("MessageLogger",
0076     cout = cms.untracked.PSet(
0077         threshold = cms.untracked.string('WARNING') if options.isUnitTest else cms.untracked.string('INFO')
0078     ),
0079     destinations = cms.untracked.vstring('cout')
0080 )
0081 
0082 ##
0083 ## Database services
0084 ##
0085 process.load("CondCore.CondDB.CondDB_cfi")
0086 
0087 ##
0088 ## Neeeded for the cabling
0089 ##
0090 process.CondDB.connect='frontier://FrontierProd/CMS_CONDITIONS'
0091 process.CablingESSource = cms.ESSource('PoolDBESSource',
0092                                        process.CondDB,
0093                                        BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0094                                        toGet = cms.VPSet( cms.PSet(record = cms.string('SiStripFedCablingRcd'),
0095                                                                    tag    = cms.string('SiStripFedCabling_GR10_v1_hlt')   # real data cabling map
0096                                                                    #tag     = cms.string('SiStripFedCabling_Ideal_31X_v2')  # ideal cabling map
0097                                                                )))
0098 
0099 process.load("Configuration.Geometry.GeometryExtended2017_cff")
0100 process.load("Geometry.TrackerGeometryBuilder.trackerParameters_cfi")
0101 process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")
0102 process.load("CalibTracker.SiStripESProducers.SiStripConnectivity_cfi")
0103 
0104 ##
0105 ## Input bad components
0106 ##
0107 process.PoolDBESSource = cms.ESSource("PoolDBESSource",
0108                                       BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0109                                       DBParameters = cms.PSet(
0110                                           messageLevel = cms.untracked.int32(2),
0111                                           authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
0112                                       ),
0113                                       timetype = cms.string('runnumber'),
0114                                       toGet = cms.VPSet(cms.PSet(
0115                                           record = cms.string('SiStripBadStripRcd'),
0116                                           tag = cms.string(options.inputTag)
0117                                       )),
0118                                       connect = cms.string(options.inputConnection)
0119                                       )
0120 
0121 ##
0122 ## Output database (in this case local sqlite file)
0123 ##
0124 process.CondDB.connect = 'sqlite_file:outputDB.db'
0125 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0126                                           process.CondDB,
0127                                           timetype = cms.untracked.string('runnumber'),
0128                                           toPut = cms.VPSet(cms.PSet(record = cms.string('SiStripBadStripRcd'),
0129                                                                      tag = cms.string(options.outputTag)
0130                                                                      )
0131                                                             )
0132                                           )
0133 
0134 process.prod = cms.EDAnalyzer("SiStripBadChannelPatcher",
0135                               printDebug = cms.bool(True) if options.isUnitTest else cms.bool(False),
0136                               Record = cms.string("SiStripBadStripRcd"),
0137                               FEDsToExclude = cms.vuint32(options.FEDsToRemove),
0138                               FEDsToInclude = cms.vuint32(options.FEDsToAdd),
0139                               detIdsToExclude = cms.vuint32(options.DetIdsToAdd),
0140                               detIdsToInclude = cms.vuint32(options.DetIdsToRemove))
0141 
0142 process.Timing = cms.Service("Timing")
0143 process.print = cms.OutputModule("AsciiOutputModule")
0144 
0145 process.p = cms.Path(process.prod)
0146 #process.ep = cms.EndPath(process.print)