CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PedeSetup.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
3 
4 
5 def setup(process, binary_files, tree_files, run_start_geometry):
6  """Pede-specific setup.
7 
8  Arguments:
9  - `process`: cms.Process object
10  - `binary_files`: list of binary files to be read by pede
11  - `tree_files`: list of ROOT files created in the mille step
12  - `run_start_geometry`: run ID to pick the start geometry
13  """
14 
15  # write alignments, APEs, and surface deformations to DB by default
16  # --------------------------------------------------------------------------
17  process.AlignmentProducer.saveToDB = True
18  process.AlignmentProducer.saveApeToDB = True
19  process.AlignmentProducer.saveDeformationsToDB = True
20 
21  # setup database output module
22  # --------------------------------------------------------------------------
23  from CondCore.CondDB.CondDB_cfi import CondDB
24  process.PoolDBOutputService = cms.Service("PoolDBOutputService",
25  CondDB.clone(connect = "sqlite_file:alignments_MP.db"),
26  timetype = cms.untracked.string("runnumber"),
27  toPut = cms.VPSet(
28  cms.PSet(
29  record = cms.string("TrackerAlignmentRcd"),
30  tag = cms.string("Alignments")),
31  cms.PSet(
32  record = cms.string("TrackerAlignmentErrorExtendedRcd"),
33  tag = cms.string("AlignmentErrorsExtended")),
34  cms.PSet(
35  record = cms.string("TrackerSurfaceDeformationRcd"),
36  tag = cms.string("Deformations")),
37  cms.PSet(
38  record = cms.string("SiStripLorentzAngleRcd_peak"),
39  tag = cms.string("SiStripLorentzAngle_peak")),
40  cms.PSet(
41  record = cms.string("SiStripLorentzAngleRcd_deco"),
42  tag = cms.string("SiStripLorentzAngle_deco")),
43  cms.PSet(
44  record = cms.string("SiPixelLorentzAngleRcd"),
45  tag = cms.string("SiPixelLorentzAngle")),
46  cms.PSet(
47  record = cms.string("SiStripBackPlaneCorrectionRcd"),
48  tag = cms.string("SiStripBackPlaneCorrection"))
49  )
50  )
51 
52 
53  # Reconfigure parts of the algorithm configuration
54  # --------------------------------------------------------------------------
55  process.AlignmentProducer.algoConfig.mergeBinaryFiles = binary_files
56  process.AlignmentProducer.algoConfig.mergeTreeFiles = tree_files
57 
58 
59  # align calibrations to general settings
60  # --------------------------------------------------------------------------
61  for calib in process.AlignmentProducer.calibrations:
62  calib.saveToDB = process.AlignmentProducer.saveToDB
63  calib.treeFile = process.AlignmentProducer.algoConfig.treeFile
64  calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles
65 
66 
67  # Configure the empty source to include all needed runs
68  # --------------------------------------------------------------------------
69  iovs = mps_tools.make_unique_runranges(process.AlignmentProducer)
70  number_of_events = iovs[-1] - iovs[0] + 1
71 
72  process.maxEvents = cms.untracked.PSet(
73  input = cms.untracked.int32(number_of_events))
74  process.source = cms.Source(
75  "EmptySource",
76  firstRun = cms.untracked.uint32(run_start_geometry),
77  numberEventsInRun = cms.untracked.uint32(1))
78 
79  # Define the executed path
80  # --------------------------------------------------------------------------
81  process.p = cms.Path(process.AlignmentProducer)
def setup
Definition: PedeSetup.py:5