Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:43

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 process = cms.Process("READ")
0005 
0006 options = VarParsing.VarParsing()
0007 options.register('inputTag',
0008                  "myTagName", # default value
0009                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0010                  VarParsing.VarParsing.varType.string, # string, int, or float
0011                  "output tag name")
0012 options.register('inputRecord',
0013                  "BeamSpotOnlineLegacyObjectsRcd", # default value
0014                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0015                  VarParsing.VarParsing.varType.string, # string, int, or float
0016                  "type of record")
0017 options.register('startRun',
0018                  306171, # default value
0019                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0020                  VarParsing.VarParsing.varType.int, # string, int, or float
0021                  "location of the input data")
0022 options.register('startLumi',
0023                  497, # default value
0024                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0025                  VarParsing.VarParsing.varType.int, # string, int, or float
0026                  "IOV Start Lumi")
0027 options.register('maxLSToRead',
0028                  10, ## default value for unit test
0029                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0030                  VarParsing.VarParsing.varType.int, # string, int, or float
0031                  "total number of LumiSections to read in input")
0032 options.parseArguments()
0033 
0034 process.load("FWCore.MessageService.MessageLogger_cfi")
0035 process.MessageLogger.cerr.FwkReport.reportEvery = 100000 # do not clog output with IO
0036 
0037 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxLSToRead))   # large number of events is needed since we probe 5000LS for run (see below)
0038 
0039 ####################################################################
0040 # Empty source 
0041 ####################################################################
0042 process.source = cms.Source("EmptySource",
0043                             firstRun = cms.untracked.uint32(options.startRun),                  # Run in ../data/BeamFitResults_Run306171.txt
0044                             firstLuminosityBlock = cms.untracked.uint32(options.startLumi),         # Lumi in ../data/BeamFitResults_Run306171.txt
0045                             numberEventsInLuminosityBlock = cms.untracked.uint32(1),  # probe one event per LS
0046                             numberEventsInRun = cms.untracked.uint32(5000),           # a number of events > the number of LS possible in a real run (5000 s ~ 32 h)
0047                             )
0048 
0049 ####################################################################
0050 # Connect to conditions DB
0051 ####################################################################
0052 process.load("Configuration.StandardSequences.GeometryDB_cff") # for the topolgy
0053 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0054 from Configuration.AlCa.GlobalTag import GlobalTag
0055 process.GlobalTag = GlobalTag(process.GlobalTag, "132X_dataRun3_HLT_v2")
0056 process.GlobalTag.toGet =  cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"),             # record
0057                                               tag = cms.string("TrackerAlignment_PCL_byRun_v0_hlt"),  # choose your favourite tag
0058                                               label = cms.untracked.string("reference")),             # refence label
0059                                      cms.PSet(record = cms.string("TrackerAlignmentRcd"),                  # record
0060                                               tag = cms.string("TrackerAlignment_collisions23_forHLT_v9"), # choose your favourite tag
0061                                               label = cms.untracked.string("target")))                     # target label
0062 
0063 #process.GlobalTag.DumpStat = cms.untracked.bool(True)
0064 
0065 myTagName = options.inputTag
0066 
0067 print("isForHLT: ",(options.inputRecord ==  "BeamSpotOnlineHLTObjectsRcd"))
0068 print("max LS to Read: ",options.maxLSToRead)
0069 
0070 #################################
0071 # Produce a SQLITE FILE
0072 #################################
0073 from CondCore.CondDB.CondDB_cfi import *
0074 CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % myTagName)) # choose an output name
0075 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0076                                           CondDBBeamSpotObjects,
0077                                           timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber')
0078                                           toPut = cms.VPSet(cms.PSet(record = cms.string(options.inputRecord), # BeamSpotOnline record
0079                                                                      tag = cms.string(myTagName))),             # choose your favourite tag
0080                                           loadBlobStreamer = cms.untracked.bool(False)
0081                                           )
0082 
0083 ####################################################################
0084 # Load and configure analyzer
0085 ####################################################################
0086 process.beamspotonlineshifter = cms.EDAnalyzer("BeamSpotOnlineShifter",
0087                                                isHLT = cms.bool((options.inputRecord ==  "BeamSpotOnlineHLTObjectsRcd")),
0088                                                xShift =  cms.double(+0.000141),
0089                                                yShift =  cms.double(+0.000826),
0090                                                zShift =  cms.double(+0.000277))
0091                                    
0092 # Put module in path:
0093 process.p = cms.Path(process.beamspotonlineshifter)