Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:19

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("READ")
0004 
0005 # import of standard configurations
0006 process.load('Configuration.StandardSequences.Services_cff')
0007 process.load('Configuration.EventContent.EventContent_cff')
0008 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0009 process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
0010 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0011 
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 
0014 options = VarParsing.VarParsing()
0015 options.register('lumisPerRun',
0016                 1,
0017                 VarParsing.VarParsing.multiplicity.singleton,
0018                 VarParsing.VarParsing.varType.int,
0019                 "the number of lumis to be processed per-run.")
0020 options.register('firstRun',
0021                 290550,
0022                 VarParsing.VarParsing.multiplicity.singleton,
0023                 VarParsing.VarParsing.varType.int,
0024                 "the first run number be processed")
0025 options.register('lastRun',
0026                 325175,
0027                 VarParsing.VarParsing.multiplicity.singleton,
0028                 VarParsing.VarParsing.varType.int,
0029                 "the run number to stop")
0030 options.register('unitTest',
0031                  False, # default value
0032                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0033                  VarParsing.VarParsing.varType.bool, # string, int, or float
0034                  "is it a unit test?")
0035 
0036 options.parseArguments()
0037 
0038 process.load("FWCore.MessageService.MessageLogger_cfi")
0039 process.MessageLogger.cerr.FwkReport.reportEvery = options.lumisPerRun*1000   # do not clog output with I/O
0040 
0041 if options.unitTest:
0042     numberOfRuns = 10
0043 else:
0044     numberOfRuns = options.lastRun - options.firstRun + 1
0045 print("number of Runs "+str(numberOfRuns))
0046 
0047 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.lumisPerRun*numberOfRuns) ) 
0048 
0049 ####################################################################
0050 # Empty source 
0051 ####################################################################
0052 #import FWCore.PythonUtilities.LumiList as LumiList
0053 #DCSJson='/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/DCSOnly/json_DCSONLY.txt'
0054 
0055 process.source = cms.Source("EmptySource",
0056                             firstRun = cms.untracked.uint32(options.firstRun),
0057                             firstLuminosityBlock = cms.untracked.uint32(1),           # probe one LS after the other
0058                             numberEventsInLuminosityBlock = cms.untracked.uint32(1),  # probe one event per LS
0059                             numberEventsInRun = cms.untracked.uint32(options.lumisPerRun),           # a number of events > the number of LS possible in a real run (5000 s ~ 32 h)
0060                             )
0061 
0062 ####################################################################
0063 # Connect to conditions DB
0064 ####################################################################
0065 
0066 # either from Global Tag
0067 from Configuration.AlCa.GlobalTag import GlobalTag
0068 process.GlobalTag = GlobalTag(process.GlobalTag,"auto:run2_data")
0069 
0070 tkAligns = {"prompt":"TrackerAlignment_PCL_byRun_v2_express","EOY":"TrackerAlignment_v24_offline","rereco":"TrackerAlignment_v29_offline"}
0071 
0072 for label in tkAligns.keys() :
0073 
0074    process.GlobalTag.toGet.append(
0075      cms.PSet(
0076        record = cms.string("TrackerAlignmentRcd"),
0077        label = cms.untracked.string(label),
0078        tag = cms.string(tkAligns[label]),
0079        connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
0080      )
0081    )
0082 
0083 
0084 beamSpots = {"prompt":"BeamSpotObjects_PCL_byLumi_v0_prompt","rereco":"BeamSpotObjects_2016_2017_2018UL_SpecialRuns_LumiBased_v1"}
0085 
0086 for label in beamSpots.keys() :
0087 
0088     process.GlobalTag.toGet.append(
0089       cms.PSet(
0090         record = cms.string("BeamSpotObjectsRcd"),
0091         label = cms.untracked.string(label),
0092         tag = cms.string(beamSpots[label]),
0093         connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
0094       )
0095     )
0096 
0097 # ...or specify database connection and tag:  
0098 #from CondCore.CondDB.CondDB_cfi import *
0099 #CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'))
0100 #process.dbInput = cms.ESSource("PoolDBESSource",
0101 #                               CondDBBeamSpotObjects,
0102 #                               toGet = cms.VPSet(cms.PSet(record = cms.string('BeamSpotObjectsRcd'),
0103 #                                                          tag = cms.string('BeamSpotObjects_PCL_byLumi_v0_prompt') #choose your own favourite
0104 #                                                          )
0105 #                                                 )
0106 #                               )
0107 
0108 ####################################################################
0109 # Load and configure analyzer
0110 ####################################################################
0111 bcLabels_ = [] # cms.untracked.vstring("")
0112 bsLabels_ = [] # cms.untracked.vstring("")
0113 
0114 for label in tkAligns.keys() :
0115     bcLabels_.append(label)
0116 
0117 for label in beamSpots.keys() :
0118     bsLabels_.append(label)
0119 
0120 from Alignment.OfflineValidation.pixelBaryCentreAnalyzer_cfi import pixelBaryCentreAnalyzer as _pixelBaryCentreAnalyzer
0121 
0122 process.PixelBaryCentreAnalyzer = _pixelBaryCentreAnalyzer.clone(
0123     usePixelQuality = False,
0124     tkAlignLabels = bcLabels_,
0125     beamSpotLabels = bsLabels_
0126 )
0127 
0128 process.PixelBaryCentreAnalyzerWithPixelQuality = _pixelBaryCentreAnalyzer.clone(
0129     usePixelQuality = True,
0130     tkAlignLabels = bcLabels_,
0131     beamSpotLabels = bsLabels_
0132 )
0133 
0134 ####################################################################
0135 # Output file
0136 ####################################################################
0137 process.TFileService = cms.Service("TFileService",
0138                                    fileName=cms.string("PixelBaryCentre_2017.root")
0139                                    ) 
0140 
0141 # Put module in path:
0142 process.p = cms.Path(process.PixelBaryCentreAnalyzer*process.PixelBaryCentreAnalyzerWithPixelQuality)