Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 from __future__ import absolute_import
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 
0005 def setup(process, input_files, collection,
0006           json_file = "",
0007           cosmics_zero_tesla = False,
0008           cosmics_deco_mode = True,
0009           TTRHBuilder = None):
0010     """Mille-specific setup.
0011 
0012     Arguments:
0013     - `process`: cms.Process object
0014     - `input_files`: input file list -> cms.untracked.vstring()
0015     - `collection`: track collection to be used
0016     - `cosmics_zero_tesla`: triggers the corresponding track selection
0017     - `cosmics_deco_mode`: triggers the corresponding track selection
0018     - `TTRHBuilder`: TransientTrackingRecHitBuilder used in the track selection
0019                      and refitting sequence;
0020                      defaults to the default of the above-mentioned sequence
0021     """
0022 
0023     # no database output in the mille step:
0024     # --------------------------------------------------------------------------
0025     process.AlignmentProducer.saveToDB = False
0026     process.AlignmentProducer.saveApeToDB = False
0027     process.AlignmentProducer.saveDeformationsToDB = False
0028 
0029 
0030     # align calibrations to general settings
0031     # --------------------------------------------------------------------------
0032     for calib in process.AlignmentProducer.calibrations:
0033         calib.saveToDB       = process.AlignmentProducer.saveToDB
0034         calib.treeFile       = process.AlignmentProducer.algoConfig.treeFile
0035         calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles
0036 
0037 
0038     # Track selection and refitting
0039     # --------------------------------------------------------------------------
0040     import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
0041     kwargs = {"cosmicsDecoMode": cosmics_deco_mode,
0042               "cosmicsZeroTesla": cosmics_zero_tesla}
0043     if TTRHBuilder is not None: kwargs["TTRHBuilder"] = TTRHBuilder
0044     process.TrackRefittingSequence \
0045         = trackRefitter.getSequence(process, collection, **kwargs)
0046 
0047 
0048     # Ensure the correct APV mode for cosmics
0049     # --------------------------------------------------------------------------
0050     if collection in ("ALCARECOTkAlCosmicsCTF0T",
0051                       "ALCARECOTkAlCosmicsInCollisions"):
0052         process.load("Alignment.CommonAlignment.apvModeFilter_cfi")
0053         process.apvModeFilter.apvMode = "deco" if cosmics_deco_mode else "peak"
0054         from . import helper
0055         helper.add_filter(process, process.apvModeFilter)
0056 
0057 
0058     # Configure the input data
0059     # --------------------------------------------------------------------------
0060     process.source = cms.Source("PoolSource", fileNames  = input_files)
0061 
0062     # Set Luminosity-Blockrange from json-file if given
0063     if (json_file != "") and (json_file != "placeholder_json"):
0064         import FWCore.PythonUtilities.LumiList as LumiList
0065         lumi_list = LumiList.LumiList(filename = json_file).getVLuminosityBlockRange()
0066         process.source.lumisToProcess = lumi_list
0067 
0068 
0069     # The executed path
0070     # --------------------------------------------------------------------------
0071     process.p = cms.Path(process.TrackRefittingSequence*
0072                          process.AlignmentProducer)
0073     if hasattr(process, "mps_filters"): process.p.insert(0, process.mps_filters)