CMS 3D CMS Logo

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