Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:03

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