File indexing completed on 2024-11-25 02:29:25
0001 import shlex, shutil, getpass
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004
0005 process = cms.Process("ProcessOne")
0006
0007 options = VarParsing.VarParsing("analysis")
0008 options.register ('firstRun',
0009 325170,
0010 VarParsing.VarParsing.multiplicity.singleton,
0011 VarParsing.VarParsing.varType.int,
0012 "first run to be processed")
0013 options.register ('nLSToProcessPerRun',
0014 2000,
0015 VarParsing.VarParsing.multiplicity.singleton,
0016 VarParsing.VarParsing.varType.int,
0017 "number of lumisections to process per run")
0018 options.register ('nRunsToProcess',
0019 1,
0020 VarParsing.VarParsing.multiplicity.singleton,
0021 VarParsing.VarParsing.varType.int,
0022 "total number of Runs to process")
0023 options.register ('inputLumiFile',
0024 '/eos/cms/store/group/comm_luminosity/LumiProducerFromBrilcalc/LumiData_2018_20200401.csv',
0025 VarParsing.VarParsing.multiplicity.singleton,
0026 VarParsing.VarParsing.varType.string,
0027 "input luminosity file")
0028
0029 options.parseArguments()
0030
0031
0032
0033
0034 process.load('FWCore.MessageService.MessageLogger_cfi')
0035 process.MessageLogger.cerr.enable = False
0036 process.MessageLogger.SiPixelQualityPlotter =dict()
0037 process.MessageLogger.cout = cms.untracked.PSet(
0038 enable = cms.untracked.bool(True),
0039 threshold = cms.untracked.string("INFO"),
0040 default = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0041 FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0042 reportEvery = cms.untracked.int32(1000)
0043 ),
0044 SiPixelQualityPlotter = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0045 enableStatistics = cms.untracked.bool(True)
0046 )
0047
0048
0049
0050
0051 process.source = cms.Source("EmptySource",
0052 firstRun = cms.untracked.uint32(options.firstRun),
0053 numberEventsInRun = cms.untracked.uint32(options.nLSToProcessPerRun),
0054 firstLuminosityBlock = cms.untracked.uint32(84),
0055 numberEventsInLuminosityBlock = cms.untracked.uint32(1),
0056 )
0057
0058 maxEventsToProcess = (options.nRunsToProcess*options.nLSToProcessPerRun) + 1
0059 maxRunsToProcess = (options.firstRun+options.nRunsToProcess)-1
0060 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(maxEventsToProcess))
0061
0062
0063
0064
0065
0066 print("===============================================")
0067 print(" First run to be processed: ",options.firstRun)
0068 print(" Last run to be processed: ",maxRunsToProcess)
0069 print(" n. LS process per Run: ",options.nLSToProcessPerRun)
0070 print(" Total LS to process: ",maxEventsToProcess)
0071 print(" Using Luminosity file: ",options.inputLumiFile)
0072 print("===============================================")
0073
0074
0075
0076
0077 process.load("Configuration.Geometry.GeometryExtended2017_cff")
0078 process.load("Geometry.TrackerGeometryBuilder.trackerParameters_cfi")
0079 process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP")
0080
0081
0082
0083
0084 process.load("CondCore.CondDB.CondDB_cfi")
0085
0086
0087 process.CondDB.connect = "frontier://FrontierProd/CMS_CONDITIONS"
0088 process.dbInput = cms.ESSource("PoolDBESSource",
0089 process.CondDB,
0090 toGet = cms.VPSet(cms.PSet(record = cms.string("SiPixelQualityFromDbRcd"),
0091
0092 tag = cms.string("SiPixelQuality_byPCL_prompt_v2")
0093
0094 )
0095 )
0096 )
0097
0098
0099
0100 chosenTag=process.dbInput.toGet[0].tag.value()
0101 try:
0102 shutil.move("SummaryBarrel_"+chosenTag+".png", "SummaryBarrel_"+chosenTag+"_old.png")
0103 shutil.move("SummaryForward_"+chosenTag+".png", "SummaryForward_"+chosenTag+"_old.png")
0104 except:
0105 print("No old files to be moved")
0106
0107
0108
0109
0110 process.ReadInDB = cms.EDAnalyzer("SiPixelQualityPlotter",
0111 analyzedTag = cms.string(chosenTag),
0112 maxRun = cms.untracked.uint32(maxRunsToProcess),
0113 lumiInputTag = cms.untracked.InputTag("LumiInfo", "brilcalc")
0114 )
0115
0116
0117
0118
0119 process.LumiInfo = cms.EDProducer('LumiProducerFromBrilcalc',
0120 lumiFile = cms.string(options.inputLumiFile),
0121 throwIfNotFound = cms.bool(False),
0122 doBunchByBunch = cms.bool(False))
0123
0124
0125
0126
0127 process.p = cms.Path(process.LumiInfo*process.ReadInDB)