|
| 1 | +import FWCore.ParameterSet.Config as cms |
| 2 | +import FWCore.ParameterSet.VarParsing as VarParsing |
| 3 | + |
| 4 | +process = cms.Process("Alignment") |
| 5 | + |
| 6 | +options = VarParsing.VarParsing() |
| 7 | +options.register ('algoMode', |
| 8 | + "mille", # default value |
| 9 | + VarParsing.VarParsing.multiplicity.singleton, |
| 10 | + VarParsing.VarParsing.varType.string, |
| 11 | + "algo mode") |
| 12 | + |
| 13 | +options.register ('useLapack', |
| 14 | + False, # default value |
| 15 | + VarParsing.VarParsing.multiplicity.singleton, |
| 16 | + VarParsing.VarParsing.varType.bool, |
| 17 | + "use lapack?") |
| 18 | +options.parseArguments() |
| 19 | + |
| 20 | +################################################################################ |
| 21 | +# Variables edited by mps_alisetup.py. Used in functions below. |
| 22 | +# You can change them manually as well. |
| 23 | +# ------------------------------------------------------------------------------ |
| 24 | +setupGlobaltag = "140X_dataRun3_ForTkAlReReco_v1" |
| 25 | +setupCollection = "ALCARECOTkAlZMuMu" |
| 26 | +setupCosmicsDecoMode = False |
| 27 | +setupCosmicsZeroTesla = False |
| 28 | +setupPrimaryWidth = -1.0 |
| 29 | +setupJson = "" |
| 30 | +setupRunStartGeometry = 362350 |
| 31 | + |
| 32 | +################################################################################ |
| 33 | +# Variables edited by MPS (mps_setup and mps_merge). Be careful. |
| 34 | +# ------------------------------------------------------------------------------ |
| 35 | +# Default is "mille". Gets changed to "pede" by mps_merge. |
| 36 | +setupAlgoMode = options.algoMode |
| 37 | + |
| 38 | +# MPS looks specifically for the string "101" so don't change this. |
| 39 | +setupMonitorFile = "millePedeMonitor101.root" |
| 40 | +setupBinaryFile = "milleBinary101.dat" |
| 41 | + |
| 42 | +# Input files. Edited by mps_splice.py |
| 43 | +readFiles = cms.untracked.vstring() |
| 44 | +readFiles.extend([ |
| 45 | + '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/362/00000/d6641b44-f4e4-4054-b5b0-f038e567c61e.root', |
| 46 | + '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/433/00000/1f93221e-23ce-4731-906a-48c9fe405515.root', |
| 47 | + '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/435/00000/df6e27d1-5367-4192-83ed-2be9303d7837.root', |
| 48 | + '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/7ce5bac8-0b29-40f3-a63b-fd0813d5678d.root', |
| 49 | + '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/ea6b065d-1912-491e-9cce-732eaf6fa038.root']) |
| 50 | +################################################################################ |
| 51 | + |
| 52 | +################################################################################ |
| 53 | +# General setup |
| 54 | +# ------------------------------------------------------------------------------ |
| 55 | +import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup |
| 56 | +generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla) |
| 57 | + |
| 58 | +################################################################################ |
| 59 | +# setup alignment producer |
| 60 | +# ------------------------------------------------------------------------------ |
| 61 | +import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer |
| 62 | + |
| 63 | +confAliProducer.setConfiguration(process, |
| 64 | + collection = setupCollection, |
| 65 | + mode = setupAlgoMode, |
| 66 | + monitorFile = setupMonitorFile, |
| 67 | + binaryFile = setupBinaryFile, |
| 68 | + primaryWidth = setupPrimaryWidth, |
| 69 | + cosmicsZeroTesla = setupCosmicsZeroTesla) |
| 70 | + |
| 71 | +################################################################################ |
| 72 | +# Overwrite some conditions in global tag |
| 73 | +# ------------------------------------------------------------------------------ |
| 74 | +import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter |
| 75 | + |
| 76 | +####################### |
| 77 | +## insert Alignables ## |
| 78 | +####################### |
| 79 | + |
| 80 | +# # to run a high-level alignment on real data (including TOB centering; use |
| 81 | +# # pixel-barrel centering for MC) of the whole tracker you can use the |
| 82 | +# # following configuration: |
| 83 | +# |
| 84 | +process.AlignmentProducer.ParameterBuilder.parameterTypes = [ |
| 85 | + "SelectorRigid,RigidBody", |
| 86 | + #"SelectorBowed,BowedSurface", |
| 87 | + #"SelectorTwoBowed,TwoBowedSurfaces", |
| 88 | + ] |
| 89 | + |
| 90 | +# # Define the high-level structure alignables |
| 91 | +process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet( |
| 92 | + alignParams = cms.vstring( |
| 93 | + "TrackerP1PXBLadder,111111", |
| 94 | + "TrackerP1PXECPanel,111111", |
| 95 | + "TrackerTIBHalfBarrel,111111", |
| 96 | + "TrackerTOBHalfBarrel,rrrrrr", |
| 97 | + "TrackerTIDEndcap,111111", |
| 98 | + "TrackerTECEndcap,111111", |
| 99 | + ) |
| 100 | +) |
| 101 | + |
| 102 | +process.AlignmentProducer.RunRangeSelection = [ |
| 103 | + cms.PSet( |
| 104 | + RunRanges = cms.vstring( |
| 105 | + "362350", |
| 106 | + "362440", |
| 107 | + "362446", |
| 108 | + "362617", |
| 109 | + "362632", |
| 110 | + "362640", |
| 111 | + "362641", |
| 112 | + "362645", |
| 113 | + "362663", |
| 114 | + "362670", |
| 115 | + "362679", |
| 116 | + "362683", |
| 117 | + "362697", |
| 118 | + "362711", |
| 119 | + "362744" |
| 120 | + ), |
| 121 | + selector = cms.vstring( |
| 122 | + "TrackerP1PXBLadder,111111", |
| 123 | + "TrackerP1PXECPanel,111111" |
| 124 | + ) |
| 125 | + ), |
| 126 | + |
| 127 | + cms.PSet( |
| 128 | + RunRanges = cms.vstring( |
| 129 | + "362350", |
| 130 | + "362520" |
| 131 | + ), |
| 132 | + selector = cms.vstring( |
| 133 | + "TrackerTIBHalfBarrel,111111", |
| 134 | + "TrackerTIDEndcap,111111", |
| 135 | + "TrackerTECEndcap,111111" |
| 136 | + ) |
| 137 | + ) |
| 138 | +] # end of process.AlignmentProducer.RunRangeSelection |
| 139 | + |
| 140 | +######################### |
| 141 | +## insert Pedesettings ## |
| 142 | +######################### |
| 143 | + |
| 144 | +# # reasonable pede settings are already defined in |
| 145 | +# # 'confAliProducer.setConfiguration' above |
| 146 | +# # |
| 147 | + |
| 148 | +if(options.algoMode == "pede"): |
| 149 | + if(options.useLapack): |
| 150 | + # LAPACK |
| 151 | + print("I am going to run fullLAPACK 3 0.8") |
| 152 | + process.AlignmentProducer.algoConfig.pedeSteerer.method = "fullLAPACK 3 0.8" |
| 153 | + process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; MKL_THREADING_LAYER=GNU; export OMP_NUM_THREADS=10; export MKL_NUM_THREADS=10; \ |
| 154 | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/cvmfs/projects.cern.ch/intelsw/oneAPI/linux/x86_64/2022/mkl/2022.1.0/lib/intel64;" |
| 155 | + else: |
| 156 | + # MINRES |
| 157 | + print("I am going to run sparseMINRES 6 0.8") |
| 158 | + process.AlignmentProducer.algoConfig.pedeSteerer.method = "sparseMINRES 6 0.8" |
| 159 | + process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede" |
| 160 | +else: |
| 161 | + pass |
| 162 | + |
| 163 | +# # if you want to obtain alignment errors, use the following setting: |
| 164 | +# # |
| 165 | +# # a list of possible options is documented here: |
| 166 | +# # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd |
| 167 | +# # |
| 168 | +# # if you need to request a larger stack size for individual threads when |
| 169 | +# # running pede, you can do this with this setting: |
| 170 | +# # |
| 171 | +# # you can change or drop pede options as follows: |
| 172 | +# |
| 173 | +import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper |
| 174 | +helper.set_pede_option(process, "threads 10") |
| 175 | +helper.set_pede_option(process, "entries 100 10 2") |
| 176 | +helper.set_pede_option(process, "skipemptycons") |
| 177 | +helper.set_pede_option(process, "countrecords") |
| 178 | + |
| 179 | +################# |
| 180 | +## add filters ## |
| 181 | +################# |
| 182 | + |
| 183 | +# # please add any EDFilter here that should run before processing the event, |
| 184 | +# # e.g. add the following lines to ensure that only 3.8T events are selected |
| 185 | +# |
| 186 | +# import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper |
| 187 | +# process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi") |
| 188 | +# process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T) |
| 189 | +# helper.add_filter(process, process.magneticFieldFilter) |
| 190 | + |
| 191 | +################################################################################ |
| 192 | +# Mille-procedure |
| 193 | +# ------------------------------------------------------------------------------ |
| 194 | +if setupAlgoMode == "mille": |
| 195 | + import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille |
| 196 | + mille.setup(process, |
| 197 | + input_files = readFiles, |
| 198 | + collection = setupCollection, |
| 199 | + json_file = setupJson, |
| 200 | + cosmics_zero_tesla = setupCosmicsZeroTesla, |
| 201 | + cosmics_deco_mode = setupCosmicsDecoMode) |
| 202 | + |
| 203 | +################################################################################ |
| 204 | +# Pede-procedure |
| 205 | +# ------------------------------------------------------------------------------ |
| 206 | +else: |
| 207 | + # placeholers get replaced by mps_merge.py, which is called in mps_setup.pl |
| 208 | + merge_binary_files = ['placeholder_binaryList'] |
| 209 | + merge_tree_files = ['placeholder_treeList'] |
| 210 | + |
| 211 | + import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede |
| 212 | + pede.setup(process, |
| 213 | + binary_files = merge_binary_files, |
| 214 | + tree_files = merge_tree_files, |
| 215 | + run_start_geometry = setupRunStartGeometry) |
0 commit comments