forked from MatiXOfficial/pps-alignment-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
write_config_reference_cfg.py
79 lines (68 loc) · 2.69 KB
/
write_config_reference_cfg.py
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
from process_configuration import configuration_dict as cdict
########## Configuration ##########
output_conditions = 'sqlite_file:alignment_config_reference.db' # Output database.
run_number = 1 # beginning of the IOV
db_tag = 'PPSAlignmentConfiguration_reference_v1_express' # Database tag.
produce_logs = False # if set to True, a file with logs will be produced.
product_instance_label = 'reference' # ES product label (empty for physics fill)
reference_dataset_path = cdict['reference_dataset'] # Path for a ROOT file with reference plots
###################################
import FWCore.ParameterSet.Config as cms
process = cms.Process("writePPSAlignmentConfiguration")
# Message Logger
if produce_logs:
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('write_config',
'cout'
),
write_config = cms.untracked.PSet(
threshold = cms.untracked.string('INFO')
),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING')
)
)
else:
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('cout'),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING')
)
)
# Load CondDB service
process.load("CondCore.CondDB.CondDB_cfi")
# output database (in this case local sqlite file)
process.CondDB.connect = output_conditions
# A data source must always be defined. We don't need it, so here's a dummy one.
process.source = cms.Source("EmptyIOVSource",
timetype = cms.string('runnumber'),
firstValue = cms.uint64(run_number),
lastValue = cms.uint64(run_number),
interval = cms.uint64(1)
)
# Output service
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDB,
timetype = cms.untracked.string('runnumber'),
toPut = cms.VPSet(cms.PSet(
record = cms.string('PPSAlignmentConfigurationRcd'),
tag = cms.string(db_tag)
))
)
# ESSource
from config_reference import ppsAlignmentConfigESSource
ppsAlignmentConfigESSource.matching = cms.PSet(
reference_dataset = cms.string(reference_dataset_path)
)
process.ppsAlignmentConfigESSource = ppsAlignmentConfigESSource
# DB object maker
process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfiguration",
record = cms.string('PPSAlignmentConfigurationRcd'),
loggingOn = cms.untracked.bool(True),
SinceAppendMode = cms.bool(True),
Source = cms.PSet(
IOVRun = cms.untracked.uint32(1)
),
label = cms.string(product_instance_label) # product label
)
process.path = cms.Path(process.config_writer)