1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as opts
import sys
options = opts.VarParsing ('standard')
options.register('MagField',
None,
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.float,
'Magnetic field value in Tesla')
options.register('Year',
None,
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.string,
'Current year for versioning')
options.register('Version',
None,
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.string,
'Template DB object version')
options.register('Append',
None,
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.string,
'Any additional string to add to the filename, i.e. "bugfix", etc.')
options.register('GlobalTag',
'auto:run3_data',
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.string,
'Global tag for this run')
options.register('readFromGT',
False,
opts.VarParsing.multiplicity.singleton,
opts.VarParsing.varType.bool,
'read template from Global Tag')
options.parseArguments()
from Configuration.StandardSequences.Eras import eras
process = cms.Process("SiPixelTemplateDBReaderTest",eras.Run3)
#Load the correct Magnetic Field
magfieldstrsplit = str(options.MagField).split('.')
MagFieldString = magfieldstrsplit[0]
if len(magfieldstrsplit)>1 :
MagFieldString+=magfieldstrsplit[1]
process.load("Configuration.StandardSequences.MagneticField_"+MagFieldString+"T_cff")
if(not options.readFromGT):
MagFieldValue = 10.*options.MagField #code needs it in deciTesla
print('\nMagField = %f deciTesla \n'%(MagFieldValue))
version = options.Version
print('\nVersion = %s \n'%(version))
template_base = 'SiPixelTemplateDBObject_'+MagFieldString+'T_'+options.Year+'_v'+version
print("Testing sqlite file: "+template_base+".db")
print(" tag: "+template_base)
process.load("CondCore.CondDB.CondDB_cfi")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '')
#Change to True if you would like a more detailed error output
wantDetailedOutput = False
#Change to True if you would like to output the full template database object
wantFullOutput = False
process.source = cms.Source("EmptySource",
firstRun = cms.untracked.uint32(386863)
)
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
# (optionally) load the template
if not options.readFromGT:
process.TemplateDBSource = cms.ESSource("PoolDBESSource",
DBParameters = cms.PSet(
messageLevel = cms.untracked.int32(0),
authenticationPath = cms.untracked.string('')),
toGet = cms.VPSet(cms.PSet(
record = cms.string('SiPixelTemplateDBObjectRcd'),
tag = cms.string(template_base))),
connect = cms.string('sqlite_file:'+template_base+'.db'))
process.prefer_TemplateDBSource = cms.ESPrefer("PoolDBESSource","TemplateDBSource")
else:
process.load("CalibTracker.SiPixelESProducers.SiPixelTemplateDBObjectESProducer_cfi")
process.reader = cms.EDAnalyzer("SiPixelTemplateDBObjectReader",
siPixelTemplateCalibrationLocation = cms.string("CalibTracker/SiPixelESProducers"),
wantDetailedTemplateDBErrorOutput = cms.bool(wantDetailedOutput),
wantFullTemplateDBOutput = cms.bool(wantFullOutput),
TestGlobalTag = cms.bool(options.readFromGT)
)
process.myprint = cms.OutputModule("AsciiOutputModule")
process.p = cms.Path(process.reader)
|