CMS 3D CMS Logo

universalConfigTemplate.py
Go to the documentation of this file.
1 
36 
37 
38 import FWCore.ParameterSet.Config as cms
39 process = cms.Process("Alignment")
40 
41 
45 setupGlobaltag = "placeholder_globaltag"
46 setupCollection = "placeholder_collection"
47 setupCosmicsDecoMode = False
48 setupCosmicsZeroTesla = False
49 setupPrimaryWidth = -1.0
50 setupJson = "placeholder_json"
51 setupRunStartGeometry = -1
52 
53 
57 setupAlgoMode = "mille"
58 
59 # MPS looks specifically for the string "ISN" so don't change this.
60 setupMonitorFile = "millePedeMonitorISN.root"
61 setupBinaryFile = "milleBinaryISN.dat"
62 
63 # Input files. Edited by mps_splice.py
64 readFiles = cms.untracked.vstring()
65 
66 
67 
68 
71 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
72 generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
73 
74 
75 
78 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer
79 
80 confAliProducer.setConfiguration(process,
81  collection = setupCollection,
82  mode = setupAlgoMode,
83  monitorFile = setupMonitorFile,
84  binaryFile = setupBinaryFile,
85  primaryWidth = setupPrimaryWidth,
86  cosmicsZeroTesla = setupCosmicsZeroTesla)
87 
88 
89 
92 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter
93 
94 
97 
98 # # You can use tagwriter.setCondition() to overwrite conditions in globaltag
99 # #
100 # # Examples (ideal phase-1 tracker-alignment conditions):
101 # tagwriter.setCondition(process,
102 # connect = "frontier://FrontierProd/CMS_CONDITIONS",
103 # record = "TrackerAlignmentRcd",
104 # tag = "TrackerAlignment_Upgrade2017_design_v4")
105 # tagwriter.setCondition(process,
106 # connect = "frontier://FrontierProd/CMS_CONDITIONS",
107 # record = "TrackerSurfaceDeformationRcd",
108 # tag = "TrackerSurfaceDeformations_zero")
109 # tagwriter.setCondition(process,
110 # connect = "frontier://FrontierProd/CMS_CONDITIONS",
111 # record = "TrackerAlignmentErrorExtendedRcd",
112 # tag = "TrackerAlignmentErrorsExtended_Upgrade2017_design_v0")
113 # tagwriter.setCondition(process,
114 # connect = "frontier://FrontierProd/CMS_CONDITIONS",
115 # record = "SiPixelLorentzAngleRcd",
116 # label = "fromAlignment",
117 # tag = "SiPixelLorentzAngle_fromAlignment_phase1_mc_v1")
118 
119 
120 
123 
124 # # to run a high-level alignment on real data (including TOB centering; use
125 # # pixel-barrel centering for MC) of the whole tracker you can use the
126 # # following configuration:
127 #
128 # process.AlignmentProducer.ParameterBuilder.parameterTypes = [
129 # "SelectorRigid,RigidBody",
130 # ]
131 #
132 # # Define the high-level structure alignables
133 # process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
134 # alignParams = cms.vstring(
135 # "TrackerP1PXBHalfBarrel,111111",
136 # "TrackerP1PXECHalfCylinder,111111",
137 # "TrackerTIBHalfBarrel,111111",
138 # "TrackerTOBHalfBarrel,rrrrrr",
139 # "TrackerTIDEndcap,111111",
140 # "TrackerTECEndcap,111111",
141 # )
142 # )
143 
144 
145 # # to run a module-level alignment on real data (including TOB centering; use
146 # # pixel-barrel centering for MC) of the whole tracker (including surface
147 # # deformations) you can use the following configuration (read comments on
148 # # multi-IOV alignment below):
149 #
150 # process.AlignmentProducer.ParameterBuilder.parameterTypes = [
151 # "SelectorRigid,RigidBody",
152 # "SelectorBowed,BowedSurface",
153 # "SelectorTwoBowed,TwoBowedSurfaces",
154 # ]
155 #
156 # # Define the high-level structure alignables
157 # process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
158 # alignParams = cms.vstring(
159 # "TrackerP1PXBHalfBarrel,111111",
160 # "TrackerP1PXECHalfCylinder,111111",
161 # "TrackerTIBHalfBarrel,111111",
162 # "TrackerTOBHalfBarrel,rrrrrr",
163 # "TrackerTIDEndcap,111111",
164 # "TrackerTECEndcap,111111",
165 # )
166 # )
167 #
168 # # Define the module-level alignables (for single modules)
169 # process.AlignmentProducer.ParameterBuilder.SelectorBowed = cms.PSet(
170 # alignParams = cms.vstring(
171 # "TrackerP1PXBModule,111111 111",
172 # "TrackerP1PXECModule,111111 111",
173 # "TrackerTIBModuleUnit,101111 111",
174 # "TrackerTIDModuleUnit,111111 111",
175 # "TrackerTECModuleUnit,111111 111,tecSingleSens",
176 # ),
177 # tecSingleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(1,4))),
178 # )
179 #
180 # process.AlignmentProducer.ParameterBuilder.SelectorTwoBowed = cms.PSet(
181 # alignParams = cms.vstring(
182 # "TrackerTOBModuleUnit,101111 111 101111 111",
183 # "TrackerTECModuleUnit,111111 111 111111 111,tecDoubleSens",
184 # ),
185 # tecDoubleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(5,7))),
186 # )
187 #
188 # # IOV definition
189 # # - defaults to single-IOV starting at "1", if omitted
190 # # - alignables have to match high-level structures above
191 # # -> except for 'rrrrrr' alignables
192 # process.AlignmentProducer.RunRangeSelection = [
193 # cms.PSet(
194 # RunRanges = cms.vstring(
195 # "290550",
196 # "300000",
197 # ),
198 # selector = cms.vstring(
199 # "TrackerP1PXBHalfBarrel,111111",
200 # "TrackerP1PXECHalfCylinder,111111",
201 # "TrackerTIBHalfBarrel,111111",
202 # "TrackerTIDEndcap,111111",
203 # "TrackerTECEndcap,111111",
204 # )
205 # )
206 # ] # end of process.AlignmentProducer.RunRangeSelection
207 
208 # # To run simultaneous calibrations of the pixel Lorentz angle you need to
209 # # include the corresponding config fragment and configure the granularity and
210 # # IOVs (must be consistent with input LA/template/alignment IOVs) for it.
211 # # Note: There are different version of the LA record available in the global
212 # # tag. Depending on the TTRHBuilder, one has to set a label to configure
213 # # which of them is to be used. The default TTRHBuilder uses pixel
214 # # templates which ignores the unlabelled LA record and uses only the one
215 # # labelled "fromAlignment". This is also the default value in the
216 # # integrated LA calibration. If you are using the generic CPE instead of
217 # # the template CPE you have to use the following setting:
218 # #
219 # # siPixelLA.lorentzAngleLabel = ""
220 #
221 # from Alignment.CommonAlignmentAlgorithm.SiPixelLorentzAngleCalibration_cff \
222 # import SiPixelLorentzAngleCalibration as siPixelLA
223 # siPixelLA.LorentzAngleModuleGroups.Granularity = cms.VPSet()
224 # siPixelLA.LorentzAngleModuleGroups.RunRange = cms.vuint32(290550,
225 # 295000,
226 # 298100)
227 #
228 # siPixelLA.LorentzAngleModuleGroups.Granularity.extend([
229 # cms.PSet(
230 # levels = cms.PSet(
231 # alignParams = cms.vstring(
232 # 'TrackerP1PXBModule,,RINGLAYER'
233 # ),
234 # RINGLAYER = cms.PSet(
235 # pxbDetId = cms.PSet(
236 # moduleRanges = cms.vint32(ring, ring),
237 # layerRanges = cms.vint32(layer, layer)
238 # )
239 # )
240 # )
241 # )
242 # for ring in xrange(1,9) # [1,8]
243 # for layer in xrange(1,5) # [1,4]
244 # ])
245 # siPixelLA.LorentzAngleModuleGroups.Granularity.append(
246 # cms.PSet(
247 # levels = cms.PSet(
248 # alignParams = cms.vstring('TrackerP1PXECModule,,posz'),
249 # posz = cms.PSet(zRanges = cms.vdouble(-9999.0, 9999.0))
250 # )
251 # )
252 # )
253 #
254 # process.AlignmentProducer.calibrations.append(siPixelLA)
255 
256 
257 
260 
261 # # reasonable pede settings are already defined in
262 # # 'confAliProducer.setConfiguration' above
263 # #
264 # # if you want to obtain alignment errors, use the following setting:
265 # # process.AlignmentProducer.algoConfig.pedeSteerer.method = "inversion 3 0.8"
266 # #
267 # # a list of possible options is documented here:
268 # # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
269 # #
270 # # if you need to request a larger stack size for individual threads when
271 # # running pede, you can do this with this setting:
272 # # process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede"
273 # #
274 # # you can change or drop pede options as follows:
275 #
276 # import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
277 # helper.set_pede_option(process, "entries 50 10 2")
278 # helper.set_pede_option(process, "compress", drop = True)
279 
280 
281 
284 
285 # # please add any EDFilter here that should run before processing the event,
286 # # e.g. add the following lines to ensure that only 3.8T events are selected
287 #
288 # import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
289 # process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi")
290 # process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T)
291 # helper.add_filter(process, process.magneticFieldFilter)
292 
293 
294 
295 
298 if setupAlgoMode == "mille":
299  import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille
300  mille.setup(process,
301  input_files = readFiles,
302  collection = setupCollection,
303  json_file = setupJson,
304  cosmics_zero_tesla = setupCosmicsZeroTesla,
305  cosmics_deco_mode = setupCosmicsDecoMode)
306 
307 
310 else:
311  # placeholers get replaced by mps_merge.py, which is called in mps_setup.pl
312  merge_binary_files = ['placeholder_binaryList']
313  merge_tree_files = ['placeholder_treeList']
314 
315  import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede
316  pede.setup(process,
317  binary_files = merge_binary_files,
318  tree_files = merge_tree_files,
319  run_start_geometry = setupRunStartGeometry)