Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:07

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 
0031 options.parseArguments()
0032 
0033 process.load("FWCore.MessageService.MessageLogger_cfi")
0034 process.MessageLogger.cerr.FwkReport.reportEvery = options.lumisPerRun*1000   # do not clog output with I/O
0035 
0036 numberOfRuns = options.lastRun - options.firstRun + 1
0037 print("number of Runs "+str(numberOfRuns))
0038 
0039 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.lumisPerRun*numberOfRuns) ) 
0040 
0041 ####################################################################
0042 # Empty source 
0043 ####################################################################
0044 #import FWCore.PythonUtilities.LumiList as LumiList
0045 #DCSJson='/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/DCSOnly/json_DCSONLY.txt'
0046 
0047 process.source = cms.Source("EmptySource",
0048                             firstRun = cms.untracked.uint32(options.firstRun),
0049                             firstLuminosityBlock = cms.untracked.uint32(1),           # probe one LS after the other
0050                             numberEventsInLuminosityBlock = cms.untracked.uint32(1),  # probe one event per LS
0051                             numberEventsInRun = cms.untracked.uint32(options.lumisPerRun),           # a number of events > the number of LS possible in a real run (5000 s ~ 32 h)
0052                             )
0053 
0054 ####################################################################
0055 # Connect to conditions DB
0056 ####################################################################
0057 
0058 # either from Global Tag
0059 from Configuration.AlCa.GlobalTag import GlobalTag
0060 process.GlobalTag = GlobalTag(process.GlobalTag,"auto:run2_data")
0061 
0062 tkAligns = {"prompt":"TrackerAlignment_PCL_byRun_v2_express","EOY":"TrackerAlignment_v24_offline","rereco":"TrackerAlignment_v29_offline"}
0063 
0064 for label in tkAligns.keys() :
0065 
0066    process.GlobalTag.toGet.append(
0067      cms.PSet(
0068        record = cms.string("TrackerAlignmentRcd"),
0069        label = cms.untracked.string(label),
0070        tag = cms.string(tkAligns[label]),
0071        connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
0072      )
0073    )
0074 
0075 
0076 beamSpots = {"prompt":"BeamSpotObjects_PCL_byLumi_v0_prompt","rereco":"BeamSpotObjects_2016_2017_2018UL_SpecialRuns_LumiBased_v1"}
0077 
0078 for label in beamSpots.keys() :
0079 
0080     process.GlobalTag.toGet.append(
0081       cms.PSet(
0082         record = cms.string("BeamSpotObjectsRcd"),
0083         label = cms.untracked.string(label),
0084         tag = cms.string(beamSpots[label]),
0085         connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
0086       )
0087     )
0088 
0089 # ...or specify database connection and tag:  
0090 #from CondCore.CondDB.CondDB_cfi import *
0091 #CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'))
0092 #process.dbInput = cms.ESSource("PoolDBESSource",
0093 #                               CondDBBeamSpotObjects,
0094 #                               toGet = cms.VPSet(cms.PSet(record = cms.string('BeamSpotObjectsRcd'),
0095 #                                                          tag = cms.string('BeamSpotObjects_PCL_byLumi_v0_prompt') #choose your own favourite
0096 #                                                          )
0097 #                                                 )
0098 #                               )
0099 
0100 ####################################################################
0101 # Load and configure analyzer
0102 ####################################################################
0103 bcLabels_ = cms.untracked.vstring("")
0104 bsLabels_ = cms.untracked.vstring("")
0105 
0106 for label in tkAligns.keys() :
0107     bcLabels_.append(label)
0108 
0109 for label in beamSpots.keys() :
0110     bsLabels_.append(label)
0111 
0112 process.PixelBaryCentreAnalyzer = cms.EDAnalyzer("PixelBaryCentreAnalyzer",
0113                     usePixelQuality = cms.untracked.bool(False),
0114                     tkAlignLabels = bcLabels_,
0115                     beamSpotLabels = bsLabels_
0116                   )
0117 
0118 process.PixelBaryCentreAnalyzerWithPixelQuality = cms.EDAnalyzer("PixelBaryCentreAnalyzer",
0119                     usePixelQuality = cms.untracked.bool(True),
0120                     tkAlignLabels = bcLabels_,
0121                     beamSpotLabels = bsLabels_
0122                   )
0123 
0124 
0125 
0126 ####################################################################
0127 # Output file
0128 ####################################################################
0129 process.TFileService = cms.Service("TFileService",
0130                                    fileName=cms.string("PixelBaryCentre_2017.root")
0131                                    ) 
0132 
0133 # Put module in path:
0134 process.p = cms.Path(process.PixelBaryCentreAnalyzer*process.PixelBaryCentreAnalyzerWithPixelQuality)