Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 process = cms.Process("Alignment")
0005 
0006 options = VarParsing.VarParsing()
0007 options.register ('algoMode',
0008                   "mille", # default value
0009                   VarParsing.VarParsing.multiplicity.singleton,
0010                   VarParsing.VarParsing.varType.string,
0011                   "algo mode")
0012 
0013 options.register ('useLapack',
0014                   False, # default value
0015                   VarParsing.VarParsing.multiplicity.singleton,
0016                   VarParsing.VarParsing.varType.bool,
0017                   "use lapack?")
0018 options.parseArguments()
0019 
0020 ################################################################################
0021 # Variables edited by mps_alisetup.py. Used in functions below.
0022 # You can change them manually as well.
0023 # ------------------------------------------------------------------------------
0024 setupGlobaltag = "140X_dataRun3_ForTkAlReReco_v1"
0025 setupCollection = "ALCARECOTkAlZMuMu"
0026 setupCosmicsDecoMode  = False
0027 setupCosmicsZeroTesla = False
0028 setupPrimaryWidth     = -1.0
0029 setupJson = ""
0030 setupRunStartGeometry = 362350
0031 
0032 ################################################################################
0033 # Variables edited by MPS (mps_setup and mps_merge). Be careful.
0034 # ------------------------------------------------------------------------------
0035 # Default is "mille". Gets changed to "pede" by mps_merge.
0036 setupAlgoMode         = options.algoMode
0037 
0038 # MPS looks specifically for the string "101" so don't change this.
0039 setupMonitorFile      = "millePedeMonitor101.root"
0040 setupBinaryFile       = "milleBinary101.dat"
0041 
0042 # Input files. Edited by mps_splice.py
0043 readFiles = cms.untracked.vstring()
0044 readFiles.extend([
0045     '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/362/00000/d6641b44-f4e4-4054-b5b0-f038e567c61e.root',
0046     '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/433/00000/1f93221e-23ce-4731-906a-48c9fe405515.root',
0047     '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/435/00000/df6e27d1-5367-4192-83ed-2be9303d7837.root',
0048     '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/7ce5bac8-0b29-40f3-a63b-fd0813d5678d.root',
0049     '/store/data/Run2022G/Muon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/362/437/00000/ea6b065d-1912-491e-9cce-732eaf6fa038.root'])
0050 ################################################################################
0051 
0052 ################################################################################
0053 # General setup
0054 # ------------------------------------------------------------------------------
0055 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
0056 generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
0057 
0058 ################################################################################
0059 # setup alignment producer
0060 # ------------------------------------------------------------------------------
0061 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer
0062 
0063 confAliProducer.setConfiguration(process,
0064     collection   = setupCollection,
0065     mode         = setupAlgoMode,
0066     monitorFile  = setupMonitorFile,
0067     binaryFile   = setupBinaryFile,
0068     primaryWidth = setupPrimaryWidth,
0069     cosmicsZeroTesla = setupCosmicsZeroTesla)
0070 
0071 ################################################################################
0072 # Overwrite some conditions in global tag
0073 # ------------------------------------------------------------------------------
0074 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter
0075 
0076 #######################
0077 ## insert Alignables ##
0078 #######################
0079 
0080 # # to run a high-level alignment on real data (including TOB centering; use
0081 # # pixel-barrel centering for MC) of the whole tracker you can use the
0082 # # following configuration:
0083 #
0084 process.AlignmentProducer.ParameterBuilder.parameterTypes = [
0085      "SelectorRigid,RigidBody",
0086      #"SelectorBowed,BowedSurface", 
0087      #"SelectorTwoBowed,TwoBowedSurfaces",
0088      ]
0089 
0090 # # Define the high-level structure alignables
0091 process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
0092      alignParams = cms.vstring(
0093          "TrackerP1PXBLadder,111111",
0094          "TrackerP1PXECPanel,111111",
0095          "TrackerTIBHalfBarrel,111111",
0096          "TrackerTOBHalfBarrel,rrrrrr",
0097          "TrackerTIDEndcap,111111",
0098          "TrackerTECEndcap,111111",
0099      )
0100 )
0101 
0102 process.AlignmentProducer.RunRangeSelection = [
0103     cms.PSet(
0104         RunRanges = cms.vstring(
0105             "362350",
0106             "362440",
0107             "362446",
0108             "362617",
0109             "362632",
0110             "362640",
0111             "362641",
0112             "362645",
0113             "362663",
0114             "362670",
0115             "362679",
0116             "362683",
0117             "362697",
0118             "362711",
0119             "362744"
0120         ),
0121         selector = cms.vstring(
0122             "TrackerP1PXBLadder,111111",
0123             "TrackerP1PXECPanel,111111"
0124         )
0125     ),
0126     
0127     cms.PSet(
0128         RunRanges = cms.vstring(
0129             "362350",
0130             "362520"
0131         ),
0132         selector = cms.vstring(
0133             "TrackerTIBHalfBarrel,111111",
0134             "TrackerTIDEndcap,111111",
0135             "TrackerTECEndcap,111111"
0136         )
0137     )
0138 ] # end of process.AlignmentProducer.RunRangeSelection
0139 
0140 #########################
0141 ## insert Pedesettings ##
0142 #########################
0143 
0144 # # reasonable pede settings are already defined in
0145 # # 'confAliProducer.setConfiguration' above
0146 # #
0147 
0148 if(options.algoMode == "pede"):
0149     if(options.useLapack):
0150         # LAPACK
0151         print("I am going to run fullLAPACK 3 0.8")
0152         process.AlignmentProducer.algoConfig.pedeSteerer.method = "fullLAPACK 3 0.8"
0153         process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; MKL_THREADING_LAYER=GNU; export OMP_NUM_THREADS=10; export MKL_NUM_THREADS=10; \
0154         export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/cvmfs/projects.cern.ch/intelsw/oneAPI/linux/x86_64/2022/mkl/2022.1.0/lib/intel64;"
0155     else:
0156         # MINRES
0157         print("I am going to run sparseMINRES 6 0.8")
0158         process.AlignmentProducer.algoConfig.pedeSteerer.method = "sparseMINRES 6 0.8"
0159         process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede"
0160 else:
0161     pass
0162         
0163 # # if you want to obtain alignment errors, use the following setting:
0164 # #
0165 # # a list of possible options is documented here:
0166 # # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
0167 # #
0168 # # if you need to request a larger stack size for individual threads when
0169 # # running pede, you can do this with this setting:
0170 # #
0171 # # you can change or drop pede options as follows:
0172 #
0173 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
0174 helper.set_pede_option(process, "threads 10")
0175 helper.set_pede_option(process, "entries 100 10 2")
0176 helper.set_pede_option(process, "skipemptycons")
0177 helper.set_pede_option(process, "countrecords")
0178 
0179 #################
0180 ## add filters ##
0181 #################
0182 
0183 # # please add any EDFilter here that should run before processing the event,
0184 # # e.g. add the following lines to ensure that only 3.8T events are selected
0185 #
0186 # import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
0187 # process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi")
0188 # process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T)
0189 # helper.add_filter(process, process.magneticFieldFilter)
0190 
0191 ################################################################################
0192 # Mille-procedure
0193 # ------------------------------------------------------------------------------
0194 if setupAlgoMode == "mille":
0195     import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille
0196     mille.setup(process,
0197                 input_files        = readFiles,
0198                 collection         = setupCollection,
0199                 json_file          = setupJson,
0200                 cosmics_zero_tesla = setupCosmicsZeroTesla,
0201                 cosmics_deco_mode  = setupCosmicsDecoMode)
0202 
0203 ################################################################################
0204 # Pede-procedure
0205 # ------------------------------------------------------------------------------
0206 else:
0207     # placeholers get replaced by mps_merge.py, which is called in mps_setup.pl
0208     merge_binary_files = ['placeholder_binaryList']
0209     merge_tree_files   = ['placeholder_treeList']
0210 
0211     import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede
0212     pede.setup(process,
0213                binary_files = merge_binary_files,
0214                tree_files = merge_tree_files,
0215                run_start_geometry = setupRunStartGeometry)