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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
###### Universal configuration template for tracker alignment
#
# Usage:
#
# Make a copy of this file and insert Startgeometry, Alignables and
# Pedesettings directly into it.
#
# Specify the path to this config-Template in the alignment_setup.ini
#
# The scripts mps_alisetup.py and mps_setup.py set the Variables at the top (setup*).
#
# Collection specifies the type of Tracks. Currently these are supported:
# - ALCARECOTkAlMinBias -> Minimum Bias
# - ALCARECOTkAlCosmicsCTF0T -> Cosmics, either at 0T or 3.8T
# - ALCARECOTkAlMuonIsolated -> Isolated Muon
# - ALCARECOTkAlZMuMu -> Z decay to two Muons
# - ALCARECOTkAlUpsilonMuMu -> Upsilon decay to two Muons
# - generalTracks -> general tracks treated like Minimum Bias
# - ALCARECOTkAlCosmicsInCollisions -> Cosmics taken during collisions
#
# Globaltag specifies the detector conditions.
# Parts of the Globaltag are overwritten in Startgeometry.
#
# monitorFile and binaryFile are automatically set by mps_setup.
# e.g. millePedeMonitor004.root and milleBinary004.dat
#
# AlgoMode specifies mode of AlignmentProducer.algoConfig -> mille or pede
# mille is default. Pede mode is automatically set when merge config is created by MPS
#
# CosmicsDecoMode and CosmicsZeroTesla are only relevant if collection
# is ALCARECOTkAlCosmicsCTF0T
#
# If primaryWidth is bigger than 0.0 it overwrites
# process.AlignmentProducer.algoConfig.TrajectoryFactory.ParticleProperties.PrimaryWidth = ...
# if primaryWidth<=0.0 it has no effect at all.
################################################################################
# Variables edited by mps_alisetup.py. Used in functions below.
# You can change them manually as well.
# ------------------------------------------------------------------------------
setupGlobaltag = "placeholder_globaltag"
setupCollection = "placeholder_collection"
setupCosmicsDecoMode = False
setupCosmicsZeroTesla = False
setupRecoGeometry = "placeholder_recogeometry"
setupPrimaryWidth = -1.0
setupJson = "placeholder_json"
setupRunStartGeometry = -1
import FWCore.ParameterSet.Config as cms
if not setupRecoGeometry: # empty string defaults to DB
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process("Alignment", Run3)
else:
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
# need to remove "Extended from the setupRecoGeometry because of defaultPhase2ConditionsEra interface"
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(setupRecoGeometry.replace("Extended", ""))
process = cms.Process("Alignment",_PH2_ERA)
################################################################################
# Variables edited by MPS (mps_setup and mps_merge). Be careful.
# ------------------------------------------------------------------------------
# Default is "mille". Gets changed to "pede" by mps_merge.
setupAlgoMode = "mille"
# MPS looks specifically for the string "ISN" so don't change this.
setupMonitorFile = "millePedeMonitorISN.root"
setupBinaryFile = "milleBinaryISN.dat"
# Input files. Edited by mps_splice.py
readFiles = cms.untracked.vstring()
################################################################################
################################################################################
# General setup
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry)
################################################################################
# setup alignment producer
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer
confAliProducer.setConfiguration(process,
collection = setupCollection,
mode = setupAlgoMode,
monitorFile = setupMonitorFile,
binaryFile = setupBinaryFile,
primaryWidth = setupPrimaryWidth,
cosmicsZeroTesla = setupCosmicsZeroTesla)
################################################################################
# Overwrite some conditions in global tag
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter
##########################
## insert Startgeometry ##
##########################
# # You can use tagwriter.setCondition() to overwrite conditions in globaltag
# #
# # Examples (ideal phase-1 tracker-alignment conditions):
# tagwriter.setCondition(process,
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "TrackerAlignmentRcd",
# tag = "TrackerAlignment_Upgrade2017_design_v4")
# tagwriter.setCondition(process,
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "TrackerSurfaceDeformationRcd",
# tag = "TrackerSurfaceDeformations_zero")
# tagwriter.setCondition(process,
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "TrackerAlignmentErrorExtendedRcd",
# tag = "TrackerAlignmentErrorsExtended_Upgrade2017_design_v0")
# tagwriter.setCondition(process,
# connect = "frontier://FrontierProd/CMS_CONDITIONS",
# record = "SiPixelLorentzAngleRcd",
# label = "fromAlignment",
# tag = "SiPixelLorentzAngle_fromAlignment_phase1_mc_v1")
#######################
## insert Alignables ##
#######################
# # to run a high-level alignment on real data (including TOB centering; use
# # pixel-barrel centering for MC) of the whole tracker you can use the
# # following configuration:
#
# process.AlignmentProducer.ParameterBuilder.parameterTypes = [
# "SelectorRigid,RigidBody",
# ]
#
# # Define the high-level structure alignables
# process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
# alignParams = cms.vstring(
# "TrackerP1PXBHalfBarrel,111111",
# "TrackerP1PXECHalfCylinder,111111",
# "TrackerTIBHalfBarrel,111111",
# "TrackerTOBHalfBarrel,rrrrrr",
# "TrackerTIDEndcap,111111",
# "TrackerTECEndcap,111111",
# )
# )
# # to run a module-level alignment on real data (including TOB centering; use
# # pixel-barrel centering for MC) of the whole tracker (including surface
# # deformations) you can use the following configuration (read comments on
# # multi-IOV alignment below):
#
# process.AlignmentProducer.ParameterBuilder.parameterTypes = [
# "SelectorRigid,RigidBody",
# "SelectorBowed,BowedSurface",
# "SelectorTwoBowed,TwoBowedSurfaces",
# ]
#
# # Define the high-level structure alignables
# process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
# alignParams = cms.vstring(
# "TrackerP1PXBHalfBarrel,111111",
# "TrackerP1PXECHalfCylinder,111111",
# "TrackerTIBHalfBarrel,111111",
# "TrackerTOBHalfBarrel,rrrrrr",
# "TrackerTIDEndcap,111111",
# "TrackerTECEndcap,111111",
# )
# )
#
# # Define the module-level alignables (for single modules)
# process.AlignmentProducer.ParameterBuilder.SelectorBowed = cms.PSet(
# alignParams = cms.vstring(
# "TrackerP1PXBModule,111111 111",
# "TrackerP1PXECModule,111111 111",
# "TrackerTIBModuleUnit,101111 111",
# "TrackerTIDModuleUnit,111111 111",
# "TrackerTECModuleUnit,111111 111,tecSingleSens",
# ),
# tecSingleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(1,4))),
# )
#
# process.AlignmentProducer.ParameterBuilder.SelectorTwoBowed = cms.PSet(
# alignParams = cms.vstring(
# "TrackerTOBModuleUnit,101111 111 101111 111",
# "TrackerTECModuleUnit,111111 111 111111 111,tecDoubleSens",
# ),
# tecDoubleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(5,7))),
# )
#
# # IOV definition
# # - defaults to single-IOV starting at "1", if omitted
# # - alignables have to match high-level structures above
# # -> except for 'rrrrrr' alignables
# process.AlignmentProducer.RunRangeSelection = [
# cms.PSet(
# RunRanges = cms.vstring(
# "290550",
# "300000",
# ),
# selector = cms.vstring(
# "TrackerP1PXBHalfBarrel,111111",
# "TrackerP1PXECHalfCylinder,111111",
# "TrackerTIBHalfBarrel,111111",
# "TrackerTIDEndcap,111111",
# "TrackerTECEndcap,111111",
# )
# )
# ] # end of process.AlignmentProducer.RunRangeSelection
# # To run simultaneous calibrations of the pixel Lorentz angle you need to
# # include the corresponding config fragment and configure the granularity and
# # IOVs (must be consistent with input LA/template/alignment IOVs) for it.
# # Note: There are different version of the LA record available in the global
# # tag. Depending on the TTRHBuilder, one has to set a label to configure
# # which of them is to be used. The default TTRHBuilder uses pixel
# # templates which ignores the unlabelled LA record and uses only the one
# # labelled "fromAlignment". This is also the default value in the
# # integrated LA calibration. If you are using the generic CPE instead of
# # the template CPE you have to use the following setting:
# #
# # siPixelLA.lorentzAngleLabel = ""
#
# from Alignment.CommonAlignmentAlgorithm.SiPixelLorentzAngleCalibration_cff \
# import SiPixelLorentzAngleCalibration as siPixelLA
# siPixelLA.LorentzAngleModuleGroups.Granularity = cms.VPSet()
# siPixelLA.LorentzAngleModuleGroups.RunRange = cms.vuint32(290550,
# 295000,
# 298100)
#
# siPixelLA.LorentzAngleModuleGroups.Granularity.extend([
# cms.PSet(
# levels = cms.PSet(
# alignParams = cms.vstring(
# 'TrackerP1PXBModule,,RINGLAYER'
# ),
# RINGLAYER = cms.PSet(
# pxbDetId = cms.PSet(
# moduleRanges = cms.vint32(ring, ring),
# layerRanges = cms.vint32(layer, layer)
# )
# )
# )
# )
# for ring in xrange(1,9) # [1,8]
# for layer in xrange(1,5) # [1,4]
# ])
# siPixelLA.LorentzAngleModuleGroups.Granularity.append(
# cms.PSet(
# levels = cms.PSet(
# alignParams = cms.vstring('TrackerP1PXECModule,,posz'),
# posz = cms.PSet(zRanges = cms.vdouble(-9999.0, 9999.0))
# )
# )
# )
#
# process.AlignmentProducer.calibrations.append(siPixelLA)
#########################
## insert Pedesettings ##
#########################
# # reasonable pede settings are already defined in
# # 'confAliProducer.setConfiguration' above
# #
# # if you want to obtain alignment errors, use the following setting:
# # process.AlignmentProducer.algoConfig.pedeSteerer.method = "inversion 3 0.8"
# #
# # a list of possible options is documented here:
# # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
# #
# # if you need to request a larger stack size for individual threads when
# # running pede, you can do this with this setting:
# # process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede"
# #
# # you can change or drop pede options as follows:
#
# import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
# helper.set_pede_option(process, "entries 50 10 2")
# helper.set_pede_option(process, "compress", drop = True)
#################
## add filters ##
#################
# # please add any EDFilter here that should run before processing the event,
# # e.g. add the following lines to ensure that only 3.8T events are selected
#
# import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
# process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi")
# process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T)
# helper.add_filter(process, process.magneticFieldFilter)
################################################################################
# Mille-procedure
# ------------------------------------------------------------------------------
if setupAlgoMode == "mille":
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille
mille.setup(process,
input_files = readFiles,
collection = setupCollection,
json_file = setupJson,
cosmics_zero_tesla = setupCosmicsZeroTesla,
cosmics_deco_mode = setupCosmicsDecoMode)
################################################################################
# Pede-procedure
# ------------------------------------------------------------------------------
else:
# placeholers get replaced by mps_merge.py, which is called in mps_setup.pl
merge_binary_files = ['placeholder_binaryList']
merge_tree_files = ['placeholder_treeList']
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede
pede.setup(process,
binary_files = merge_binary_files,
tree_files = merge_tree_files,
run_start_geometry = setupRunStartGeometry)
|