Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:31

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as opts
0003 import sys
0004 
0005 options = opts.VarParsing ('standard')
0006 
0007 options.register('MagField',
0008                  None,
0009                  opts.VarParsing.multiplicity.singleton,
0010                  opts.VarParsing.varType.float,
0011                  'Magnetic field value in Tesla')
0012 options.register('Year',
0013                  None,
0014                  opts.VarParsing.multiplicity.singleton,
0015                  opts.VarParsing.varType.string,
0016                  'Current year for versioning')
0017 options.register('Version',
0018                  None,
0019                  opts.VarParsing.multiplicity.singleton,
0020                  opts.VarParsing.varType.string,
0021                  'Template DB object version')
0022 options.register('Append',
0023                  None,
0024                  opts.VarParsing.multiplicity.singleton,
0025                  opts.VarParsing.varType.string,
0026                  'Any additional string to add to the filename, i.e. "bugfix", etc.')
0027 options.register('GlobalTag',
0028                  'auto:run2_data',
0029                  opts.VarParsing.multiplicity.singleton,
0030                  opts.VarParsing.varType.string,
0031                  'Global tag for this run')
0032 
0033 testGlobalTag = False
0034 options.parseArguments()
0035 
0036 MagFieldValue = 10.*options.MagField #code needs it in deciTesla
0037 print '\nMagField = %f deciTesla \n'%(MagFieldValue)
0038 version = options.Version
0039 print'\nVersion = %s \n'%(version)
0040 magfieldstrsplit = str(options.MagField).split('.')
0041 MagFieldString = magfieldstrsplit[0]
0042 if len(magfieldstrsplit)>1 :
0043     MagFieldString+=magfieldstrsplit[1]
0044 
0045 template_base = 'SiPixelTemplateDBObject_'+MagFieldString+'T_'+options.Year+'_v'+version
0046 print "Testing sqlite file: "+template_base+".db"
0047 print "                tag: "+template_base
0048 
0049 
0050 from Configuration.StandardSequences.Eras import eras
0051 
0052 process = cms.Process("SiPixelTemplateDBReaderTest",eras.Run2_25ns)
0053 process.load("CondCore.CondDB.CondDB_cfi")
0054 process.load("FWCore.MessageService.MessageLogger_cfi")
0055 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0056 from Configuration.AlCa.GlobalTag import GlobalTag
0057 process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '')
0058 
0059 #Load the correct Magnetic Field
0060 process.load("Configuration.StandardSequences.MagneticField_"+MagFieldString+"T_cff")
0061 
0062 #Change to True if you would like a more detailed error output
0063 wantDetailedOutput = False
0064 #Change to True if you would like to output the full template database object
0065 wantFullOutput = False
0066 
0067 process.source = cms.Source("EmptySource")
0068 
0069 process.maxEvents = cms.untracked.PSet(
0070     input = cms.untracked.int32(1)
0071     )
0072 
0073 if not testGlobalTag:
0074     process.TemplateDBSource = cms.ESSource("PoolDBESSource",
0075                                        DBParameters = cms.PSet(
0076                                            messageLevel = cms.untracked.int32(0),
0077                                            authenticationPath = cms.untracked.string('')),
0078                                        toGet = cms.VPSet(cms.PSet(
0079                                            record = cms.string('SiPixelTemplateDBObjectRcd'),
0080                                            tag = cms.string(template_base))),
0081                                        connect = cms.string('sqlite_file:'+template_base+'.db'))
0082     process.prefer_TemplateDBSource = cms.ESPrefer("PoolDBESSource","TemplateDBSource")
0083 
0084 
0085 
0086 process.reader = cms.EDAnalyzer("SiPixelTemplateDBObjectReader",
0087                               siPixelTemplateCalibrationLocation = cms.string(
0088                              "CalibTracker/SiPixelESProducers"),
0089                               wantDetailedTemplateDBErrorOutput = cms.bool(wantDetailedOutput),
0090                               wantFullTemplateDBOutput = cms.bool(wantFullOutput),
0091                               TestGlobalTag = cms.bool(testGlobalTag)
0092                               )
0093 
0094 process.myprint = cms.OutputModule("AsciiOutputModule")
0095 
0096 process.p = cms.Path(process.reader)
0097 
0098 
0099 
0100 
0101 
0102