CMS 3D CMS Logo

MilleSetup.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 
4 def setup(process, input_files, collection,
5  json_file = "",
6  cosmics_zero_tesla = False,
7  cosmics_deco_mode = True,
8  TTRHBuilder = None):
9  """Mille-specific setup.
10 
11  Arguments:
12  - `process`: cms.Process object
13  - `input_files`: input file list -> cms.untracked.vstring()
14  - `collection`: track collection to be used
15  - `cosmics_zero_tesla`: triggers the corresponding track selection
16  - `cosmics_deco_mode`: triggers the corresponding track selection
17  - `TTRHBuilder`: TransientTrackingRecHitBuilder used in the track selection
18  and refitting sequence;
19  defaults to the default of the above-mentioned sequence
20  """
21 
22  # no database output in the mille step:
23  # --------------------------------------------------------------------------
24  process.AlignmentProducer.saveToDB = False
25  process.AlignmentProducer.saveApeToDB = False
26  process.AlignmentProducer.saveDeformationsToDB = False
27 
28 
29  # align calibrations to general settings
30  # --------------------------------------------------------------------------
31  for calib in process.AlignmentProducer.calibrations:
32  calib.saveToDB = process.AlignmentProducer.saveToDB
33  calib.treeFile = process.AlignmentProducer.algoConfig.treeFile
34  calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles
35 
36 
37  # Track selection and refitting
38  # --------------------------------------------------------------------------
39  import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
40  kwargs = {"cosmicsDecoMode": cosmics_deco_mode,
41  "cosmicsZeroTesla": cosmics_zero_tesla}
42  if TTRHBuilder is not None: kwargs["TTRHBuilder"] = TTRHBuilder
43  process.TrackRefittingSequence \
44  = trackRefitter.getSequence(process, collection, **kwargs)
45 
46 
47  # Ensure the correct APV mode for cosmics
48  # --------------------------------------------------------------------------
49  if collection in ("ALCARECOTkAlCosmicsCTF0T",
50  "ALCARECOTkAlCosmicsInCollisions"):
51  process.load("Alignment.CommonAlignment.apvModeFilter_cfi")
52  process.apvModeFilter.apvMode = "deco" if cosmics_deco_mode else "peak"
53  import helper
54  helper.add_filter(process, process.apvModeFilter)
55 
56 
57  # Configure the input data
58  # --------------------------------------------------------------------------
59  process.source = cms.Source("PoolSource", fileNames = input_files)
60 
61  # Set Luminosity-Blockrange from json-file if given
62  if (json_file != "") and (json_file != "placeholder_json"):
63  import FWCore.PythonUtilities.LumiList as LumiList
64  lumi_list = LumiList.LumiList(filename = json_file).getVLuminosityBlockRange()
65  process.source.lumisToProcess = lumi_list
66 
67 
68  # The executed path
69  # --------------------------------------------------------------------------
70  process.p = cms.Path(process.TrackRefittingSequence*
71  process.AlignmentProducer)
72  if hasattr(process, "mps_filters"): process.p.insert(0, process.mps_filters)
def add_filter(process, ed_filter)
Definition: helper.py:47
def setup(process, input_files, collection, json_file="", cosmics_zero_tesla=False, cosmics_deco_mode=True, TTRHBuilder=None)
Definition: MilleSetup.py:8