-
Notifications
You must be signed in to change notification settings - Fork 2
/
conditions.py
208 lines (155 loc) · 6.4 KB
/
conditions.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
from Configuration.AlCa.GlobalTag import GlobalTag
from CondCore.CondDB.CondDB_cfi import *
#----------------------------------------------------------------------------------------------------
lhcInfoDefined = False
def UseLHCInfoLocal(process):
global lhcInfoDefined
lhcInfoDefined = True
def UseLHCInfoGT(process):
global lhcInfoDefined
lhcInfoDefined = True
# these are not defined in local environment by default
#del process.ctppsRPLHCInfoCorrectionsDataESSourceXML
#del process.esPreferLocalLHCInfo
def UseLHCInfoFile(process, connection, tag):
global lhcInfoDefined
lhcInfoDefined = True
del process.ctppsRPLHCInfoCorrectionsDataESSourceXML
del process.esPreferLocalLHCInfo
process.ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ""
process.ctppsProtons.lhcInfoLabel = ""
process.CondDBALHCInfo = CondDB.clone( connect = connection )
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
CondDBLHCInfo,
DumpStat = cms.untracked.bool(False),
toGet = cms.VPSet(cms.PSet(
record = cms.string('LHCInfoRcd'),
tag = cms.string(tag)
)),
)
#----------------------------------------------------------------------------------------------------
alignmentDefined = False
def UseAlignmentLocal(process):
global alignmentDefined
alignmentDefined = True
if not hasattr(process, 'esPreferLocalAlignment'):
raise ValueError("local alignment chosen, but process.esPreferLocalAlignment not defined")
def UseAlignmentGT(process):
global alignmentDefined
alignmentDefined = True
if hasattr(process, 'esPreferLocalAlignment'):
del process.ctppsRPAlignmentCorrectionsDataESSourceXML
del process.esPreferLocalAlignment
def UseAlignmentFile(process, connection, tag):
global alignmentDefined
alignmentDefined = True
if hasattr(process, 'esPreferLocalAlignment'):
del process.ctppsRPAlignmentCorrectionsDataESSourceXML
del process.esPreferLocalAlignment
process.CondDBAlignment = CondDB.clone( connect = connection )
process.PoolDBESSourceAlignment = cms.ESSource("PoolDBESSource",
process.CondDBAlignment,
#timetype = cms.untracked.string('runnumber'),
toGet = cms.VPSet(cms.PSet(
record = cms.string('RPRealAlignmentRecord'),
tag = cms.string(tag)
))
)
process.esPreferDBFileAlignment = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceAlignment")
def UseAlignmentDB(process, connection, tag):
global alignmentDefined
alignmentDefined = True
if hasattr(process, 'esPreferLocalAlignment'):
del process.ctppsRPAlignmentCorrectionsDataESSourceXML
del process.esPreferLocalAlignment
process.CondDBAlignment = CondDB.clone( connect = connection )
process.PoolDBESSourceAlignment = cms.ESSource("PoolDBESSource",
process.CondDBAlignment,
#timetype = cms.untracked.string('runnumber'),
toGet = cms.VPSet(cms.PSet(
record = cms.string('RPRealAlignmentRecord'),
tag = cms.string(tag)
))
)
process.esPreferDBFileAlignment = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceAlignment")
#----------------------------------------------------------------------------------------------------
opticsDefined = False
def UseOpticsLocal(process):
global opticsDefined
opticsDefined = True
if not hasattr(process, 'esPreferLocalOptics'):
raise ValueError("local optics chosen, but process.esPreferLocalOptics not defined")
def UseOpticsGT(process):
global opticsDefined
opticsDefined = True
if hasattr(process, 'esPreferLocalOptics'):
del process.ctppsOpticalFunctionsESSource
del process.esPreferLocalOptics
def UseOpticsFile(process, connection, tag):
global opticsDefined
opticsDefined = True
if hasattr(process, 'esPreferLocalOptics'):
del process.ctppsOpticalFunctionsESSource
del process.esPreferLocalOptics
process.CondDBOptics = CondDB.clone( connect = connection )
process.PoolDBESSourceOptics = cms.ESSource("PoolDBESSource",
process.CondDBOptics,
DumpStat = cms.untracked.bool(False),
toGet = cms.VPSet(cms.PSet(
record = cms.string("CTPPSOpticsRcd"),
tag = cms.string(tag)
)),
)
process.esPreferDBFileOptics = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceOptics")
def UseOpticsDB(process, connection, tag):
global opticsDefined
opticsDefined = True
if hasattr(process, 'esPreferLocalOptics'):
del process.ctppsOpticalFunctionsESSource
del process.esPreferLocalOptics
process.CondDBOptics = CondDB.clone( connect = connection )
process.PoolDBESSourceOptics = cms.ESSource("PoolDBESSource",
process.CondDBOptics,
DumpStat = cms.untracked.bool(False),
toGet = cms.VPSet(cms.PSet(
record = cms.string('CTPPSOpticsRcd'),
tag = cms.string(tag)
)),
)
process.esPreferDBFileOptics = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceOptics")
#----------------------------------------------------------------------------------------------------
associationCutsDefined = False
def UseAssociationCutsGT(process):
global associationCutsDefined
associationCutsDefined = True
if hasattr(process, 'esPreferLocalAssociationCuts'):
del process.ppsAssociationCutsESSource
del process.esPreferLocalAssociationCuts
def UseAssociationCutsDB(process, connection, tag):
global associationCutsDefined
associationCutsDefined = True
if hasattr(process, 'esPreferLocalAssociationCuts'):
del process.ppsAssociationCutsESSource
del process.esPreferLocalAssociationCuts
process.CondDBAssociationCuts = CondDB.clone( connect = connection )
process.PoolDBESSourceAssociationCuts = cms.ESSource("PoolDBESSource",
process.CondDBAssociationCuts,
DumpStat = cms.untracked.bool(False),
toGet = cms.VPSet(cms.PSet(
record = cms.string('PPSAssociationCutsRcd'),
tag = cms.string(tag)
)),
)
process.esPreferDBFileAssociationCuts = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceAssociationCuts")
#----------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------
def CheckConditions():
# check choices
if not lhcInfoDefined:
raise ValueError("LHCInfo not defined")
if not alignmentDefined:
raise ValueError("alignment not defined")
if not opticsDefined:
raise ValueError("optics not defined")
if not associationCutsDefined:
raise ValueError("association cuts not defined")