Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:34

0001 import FWCore.ParameterSet.Config as cms
0002 import Alignment.MillePedeAlignmentAlgorithm.mpslib.tools as mps_tools
0003 
0004 
0005 def setup(process, binary_files, tree_files, run_start_geometry):
0006     """Pede-specific setup.
0007 
0008     Arguments:
0009     - `process`: cms.Process object
0010     - `binary_files`: list of binary files to be read by pede
0011     - `tree_files`: list of ROOT files created in the mille step
0012     - `run_start_geometry`: run ID to pick the start geometry
0013     """
0014 
0015     # write alignments, APEs, and surface deformations to DB by default
0016     # --------------------------------------------------------------------------
0017     process.AlignmentProducer.saveToDB = True
0018     process.AlignmentProducer.saveApeToDB = True
0019     process.AlignmentProducer.saveDeformationsToDB = True
0020 
0021     # setup database output module
0022     # --------------------------------------------------------------------------
0023     from CondCore.CondDB.CondDB_cfi import CondDB
0024     process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0025         CondDB.clone(connect = "sqlite_file:alignments_MP.db"),
0026         timetype = cms.untracked.string("runnumber"),
0027         toPut = cms.VPSet(
0028             cms.PSet(
0029                 record = cms.string("TrackerAlignmentRcd"),
0030                 tag = cms.string("Alignments")),
0031             cms.PSet(
0032                 record = cms.string("TrackerAlignmentErrorExtendedRcd"),
0033                 tag = cms.string("AlignmentErrorsExtended")),
0034             cms.PSet(
0035                 record = cms.string("TrackerSurfaceDeformationRcd"),
0036                 tag = cms.string("Deformations")),
0037             cms.PSet(
0038                 record = cms.string("SiStripLorentzAngleRcd_peak"),
0039                 tag = cms.string("SiStripLorentzAngle_peak")),
0040             cms.PSet(
0041                 record = cms.string("SiStripLorentzAngleRcd_deco"),
0042                 tag = cms.string("SiStripLorentzAngle_deco")),
0043             cms.PSet(
0044                 record = cms.string("SiPixelLorentzAngleRcd"),
0045                 tag = cms.string("SiPixelLorentzAngle")),
0046             cms.PSet(
0047                 record = cms.string("SiStripBackPlaneCorrectionRcd"),
0048                 tag = cms.string("SiStripBackPlaneCorrection"))
0049         )
0050     )
0051 
0052 
0053     # Reconfigure parts of the algorithm configuration
0054     # --------------------------------------------------------------------------
0055     process.AlignmentProducer.algoConfig.mergeBinaryFiles = binary_files
0056     process.AlignmentProducer.algoConfig.mergeTreeFiles   = tree_files
0057 
0058 
0059     # align calibrations to general settings
0060     # --------------------------------------------------------------------------
0061     for calib in process.AlignmentProducer.calibrations:
0062         calib.saveToDB       = process.AlignmentProducer.saveToDB
0063         calib.treeFile       = process.AlignmentProducer.algoConfig.treeFile
0064         calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles
0065 
0066 
0067     # Configure the empty source to include all needed runs
0068     # --------------------------------------------------------------------------
0069     iovs = mps_tools.make_unique_runranges(process.AlignmentProducer)
0070     number_of_events = iovs[-1] - iovs[0] + 1
0071 
0072     process.maxEvents = cms.untracked.PSet(
0073         input = cms.untracked.int32(number_of_events))
0074     process.source = cms.Source(
0075         "EmptySource",
0076         firstRun = cms.untracked.uint32(run_start_geometry),
0077         numberEventsInRun = cms.untracked.uint32(1))
0078 
0079     # Define the executed path
0080     # --------------------------------------------------------------------------
0081     process.p = cms.Path(process.AlignmentProducer)