Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-07 06:12:25

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