Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 ###### Universal configuration template for tracker alignment
0002 #
0003 #  Usage:
0004 #
0005 #    Make a copy of this file and insert Startgeometry, Alignables and
0006 #    Pedesettings directly into it.
0007 #
0008 #    Specify the path to this config-Template in the alignment_setup.ini
0009 #
0010 #    The scripts mps_alisetup.py and mps_setup.py set the Variables at the top (setup*).
0011 #
0012 #        Collection specifies the type of Tracks. Currently these are supported:
0013 #          - ALCARECOTkAlMinBias       -> Minimum Bias
0014 #          - ALCARECOTkAlCosmicsCTF0T  -> Cosmics, either at 0T or 3.8T
0015 #          - ALCARECOTkAlMuonIsolated  -> Isolated Muon
0016 #          - ALCARECOTkAlZMuMu         -> Z decay to two Muons
0017 #          - ALCARECOTkAlUpsilonMuMu   -> Upsilon decay to two Muons
0018 #          - generalTracks             -> general tracks treated like Minimum Bias
0019 #          - ALCARECOTkAlCosmicsInCollisions -> Cosmics taken during collisions
0020 #
0021 #        Globaltag specifies the detector conditions.
0022 #        Parts of the Globaltag are overwritten in Startgeometry.
0023 #
0024 #        monitorFile and binaryFile are automatically set by mps_setup.
0025 #        e.g. millePedeMonitor004.root and milleBinary004.dat
0026 #
0027 #        AlgoMode specifies mode of AlignmentProducer.algoConfig -> mille or pede
0028 #        mille is default. Pede mode is automatically set when merge config is created by MPS
0029 #
0030 #        CosmicsDecoMode and CosmicsZeroTesla are only relevant if collection
0031 #        is ALCARECOTkAlCosmicsCTF0T
0032 #
0033 #        If primaryWidth is bigger than 0.0 it overwrites
0034 #        process.AlignmentProducer.algoConfig.TrajectoryFactory.ParticleProperties.PrimaryWidth = ...
0035 #        if primaryWidth<=0.0 it has no effect at all.
0036 
0037 
0038 import FWCore.ParameterSet.Config as cms
0039 process = cms.Process("Alignment")
0040 
0041 ################################################################################
0042 # Variables edited by mps_alisetup.py. Used in functions below.
0043 # You can change them manually as well.
0044 # ------------------------------------------------------------------------------
0045 setupGlobaltag        = "placeholder_globaltag"
0046 setupCollection       = "placeholder_collection"
0047 setupCosmicsDecoMode  = False
0048 setupCosmicsZeroTesla = False
0049 setupPrimaryWidth     = -1.0
0050 setupJson             = "placeholder_json"
0051 setupRunStartGeometry = -1
0052 
0053 ################################################################################
0054 # Variables edited by MPS (mps_setup and mps_merge). Be careful.
0055 # ------------------------------------------------------------------------------
0056 # Default is "mille". Gets changed to "pede" by mps_merge.
0057 setupAlgoMode         = "mille"
0058 
0059 # MPS looks specifically for the string "ISN" so don't change this.
0060 setupMonitorFile      = "millePedeMonitorISN.root"
0061 setupBinaryFile       = "milleBinaryISN.dat"
0062 
0063 # Input files. Edited by mps_splice.py
0064 readFiles = cms.untracked.vstring()
0065 ################################################################################
0066 
0067 
0068 ################################################################################
0069 # General setup
0070 # ------------------------------------------------------------------------------
0071 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
0072 generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
0073 
0074 
0075 ################################################################################
0076 # setup alignment producer
0077 # ------------------------------------------------------------------------------
0078 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer
0079 
0080 confAliProducer.setConfiguration(process,
0081     collection   = setupCollection,
0082     mode         = setupAlgoMode,
0083     monitorFile  = setupMonitorFile,
0084     binaryFile   = setupBinaryFile,
0085     primaryWidth = setupPrimaryWidth,
0086     cosmicsZeroTesla = setupCosmicsZeroTesla)
0087 
0088 
0089 ################################################################################
0090 # Overwrite some conditions in global tag
0091 # ------------------------------------------------------------------------------
0092 import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter
0093 
0094 ##########################
0095 ## insert Startgeometry ##
0096 ##########################
0097 
0098 # # You can use tagwriter.setCondition() to overwrite conditions in globaltag
0099 # #
0100 # # Examples (ideal phase-1 tracker-alignment conditions):
0101 # tagwriter.setCondition(process,
0102 #       connect = "frontier://FrontierProd/CMS_CONDITIONS",
0103 #       record = "TrackerAlignmentRcd",
0104 #       tag = "TrackerAlignment_Upgrade2017_design_v4")
0105 # tagwriter.setCondition(process,
0106 #       connect = "frontier://FrontierProd/CMS_CONDITIONS",
0107 #       record = "TrackerSurfaceDeformationRcd",
0108 #       tag = "TrackerSurfaceDeformations_zero")
0109 # tagwriter.setCondition(process,
0110 #       connect = "frontier://FrontierProd/CMS_CONDITIONS",
0111 #       record = "TrackerAlignmentErrorExtendedRcd",
0112 #       tag = "TrackerAlignmentErrorsExtended_Upgrade2017_design_v0")
0113 # tagwriter.setCondition(process,
0114 #       connect = "frontier://FrontierProd/CMS_CONDITIONS",
0115 #       record = "SiPixelLorentzAngleRcd",
0116 #       label = "fromAlignment",
0117 #       tag = "SiPixelLorentzAngle_fromAlignment_phase1_mc_v1")
0118 
0119 
0120 #######################
0121 ## insert Alignables ##
0122 #######################
0123 
0124 # # to run a high-level alignment on real data (including TOB centering; use
0125 # # pixel-barrel centering for MC) of the whole tracker you can use the
0126 # # following configuration:
0127 #
0128 # process.AlignmentProducer.ParameterBuilder.parameterTypes = [
0129 #     "SelectorRigid,RigidBody",
0130 #     ]
0131 #
0132 # # Define the high-level structure alignables
0133 # process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
0134 #     alignParams = cms.vstring(
0135 #         "TrackerP1PXBHalfBarrel,111111",
0136 #         "TrackerP1PXECHalfCylinder,111111",
0137 #         "TrackerTIBHalfBarrel,111111",
0138 #         "TrackerTOBHalfBarrel,rrrrrr",
0139 #         "TrackerTIDEndcap,111111",
0140 #         "TrackerTECEndcap,111111",
0141 #     )
0142 # )
0143 
0144 
0145 # # to run a module-level alignment on real data (including TOB centering; use
0146 # # pixel-barrel centering for MC) of the whole tracker (including surface
0147 # # deformations) you can use the following configuration (read comments on
0148 # # multi-IOV alignment below):
0149 #
0150 # process.AlignmentProducer.ParameterBuilder.parameterTypes = [
0151 #     "SelectorRigid,RigidBody",
0152 #     "SelectorBowed,BowedSurface",
0153 #     "SelectorTwoBowed,TwoBowedSurfaces",
0154 # ]
0155 #
0156 # # Define the high-level structure alignables
0157 # process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet(
0158 #     alignParams = cms.vstring(
0159 #         "TrackerP1PXBHalfBarrel,111111",
0160 #         "TrackerP1PXECHalfCylinder,111111",
0161 #         "TrackerTIBHalfBarrel,111111",
0162 #         "TrackerTOBHalfBarrel,rrrrrr",
0163 #         "TrackerTIDEndcap,111111",
0164 #         "TrackerTECEndcap,111111",
0165 #     )
0166 # )
0167 #
0168 # # Define the module-level alignables (for single modules)
0169 # process.AlignmentProducer.ParameterBuilder.SelectorBowed = cms.PSet(
0170 #     alignParams = cms.vstring(
0171 #         "TrackerP1PXBModule,111111 111",
0172 #         "TrackerP1PXECModule,111111 111",
0173 #         "TrackerTIBModuleUnit,101111 111",
0174 #         "TrackerTIDModuleUnit,111111 111",
0175 #         "TrackerTECModuleUnit,111111 111,tecSingleSens",
0176 #     ),
0177 #     tecSingleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(1,4))),
0178 # )
0179 #
0180 # process.AlignmentProducer.ParameterBuilder.SelectorTwoBowed = cms.PSet(
0181 #     alignParams = cms.vstring(
0182 #         "TrackerTOBModuleUnit,101111 111 101111 111",
0183 #         "TrackerTECModuleUnit,111111 111 111111 111,tecDoubleSens",
0184 #     ),
0185 #     tecDoubleSens = cms.PSet(tecDetId = cms.PSet(ringRanges = cms.vint32(5,7))),
0186 # )
0187 #
0188 # # IOV definition
0189 # #  - defaults to single-IOV starting at "1", if omitted
0190 # #  - alignables have to match high-level structures above
0191 # #    -> except for 'rrrrrr' alignables
0192 # process.AlignmentProducer.RunRangeSelection = [
0193 #     cms.PSet(
0194 #         RunRanges = cms.vstring(
0195 #             "290550",
0196 #             "300000",
0197 #         ),
0198 #         selector = cms.vstring(
0199 #             "TrackerP1PXBHalfBarrel,111111",
0200 #             "TrackerP1PXECHalfCylinder,111111",
0201 #             "TrackerTIBHalfBarrel,111111",
0202 #             "TrackerTIDEndcap,111111",
0203 #             "TrackerTECEndcap,111111",
0204 #         )
0205 #     )
0206 # ] # end of process.AlignmentProducer.RunRangeSelection
0207 
0208 # # To run simultaneous calibrations of the pixel Lorentz angle you need to
0209 # # include the corresponding config fragment and configure the granularity and
0210 # # IOVs (must be consistent with input LA/template/alignment IOVs) for it.
0211 # # Note: There are different version of the LA record available in the global
0212 # #       tag. Depending on the TTRHBuilder, one has to set a label to configure
0213 # #       which of them is to be used. The default TTRHBuilder uses pixel
0214 # #       templates which ignores the unlabelled LA record and uses only the one
0215 # #       labelled "fromAlignment". This is also the default value in the
0216 # #       integrated LA calibration. If you are using the generic CPE instead of
0217 # #       the template CPE you have to use the following setting:
0218 # #
0219 # #       siPixelLA.lorentzAngleLabel = ""
0220 #
0221 # from Alignment.CommonAlignmentAlgorithm.SiPixelLorentzAngleCalibration_cff \
0222 #     import SiPixelLorentzAngleCalibration as siPixelLA
0223 # siPixelLA.LorentzAngleModuleGroups.Granularity = cms.VPSet()
0224 # siPixelLA.LorentzAngleModuleGroups.RunRange = cms.vuint32(290550,
0225 #                                                           295000,
0226 #                                                           298100)
0227 #
0228 # siPixelLA.LorentzAngleModuleGroups.Granularity.extend([
0229 #     cms.PSet(
0230 #         levels = cms.PSet(
0231 #             alignParams = cms.vstring(
0232 #                 'TrackerP1PXBModule,,RINGLAYER'
0233 #             ),
0234 #             RINGLAYER = cms.PSet(
0235 #                 pxbDetId  = cms.PSet(
0236 #                     moduleRanges = cms.vint32(ring, ring),
0237 #                     layerRanges = cms.vint32(layer, layer)
0238 #                 )
0239 #             )
0240 #         )
0241 #     )
0242 #     for ring in xrange(1,9) # [1,8]
0243 #     for layer in xrange(1,5) # [1,4]
0244 # ])
0245 # siPixelLA.LorentzAngleModuleGroups.Granularity.append(
0246 #     cms.PSet(
0247 #         levels = cms.PSet(
0248 #             alignParams = cms.vstring('TrackerP1PXECModule,,posz'),
0249 #             posz = cms.PSet(zRanges = cms.vdouble(-9999.0, 9999.0))
0250 #         )
0251 #     )
0252 # )
0253 #
0254 # process.AlignmentProducer.calibrations.append(siPixelLA)
0255 
0256 
0257 #########################
0258 ## insert Pedesettings ##
0259 #########################
0260 
0261 # # reasonable pede settings are already defined in
0262 # # 'confAliProducer.setConfiguration' above
0263 # #
0264 # # if you want to obtain alignment errors, use the following setting:
0265 # # process.AlignmentProducer.algoConfig.pedeSteerer.method = "inversion 3 0.8"
0266 # #
0267 # # a list of possible options is documented here:
0268 # # http://www.desy.de/~kleinwrt/MP2/doc/html/option_page.html#sec-cmd
0269 # #
0270 # # if you need to request a larger stack size for individual threads when
0271 # # running pede, you can do this with this setting: 
0272 # # process.AlignmentProducer.algoConfig.pedeSteerer.pedeCommand = "export OMP_STACKSIZE=20M; pede"
0273 # #
0274 # # you can change or drop pede options as follows:
0275 #
0276 # import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
0277 # helper.set_pede_option(process, "entries 50 10 2")
0278 # helper.set_pede_option(process, "compress", drop = True)
0279 
0280 
0281 #################
0282 ## add filters ##
0283 #################
0284 
0285 # # please add any EDFilter here that should run before processing the event,
0286 # # e.g. add the following lines to ensure that only 3.8T events are selected
0287 #
0288 # import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper
0289 # process.load("Alignment.CommonAlignment.magneticFieldFilter_cfi")
0290 # process.magneticFieldFilter.magneticField = 38 # in units of kGauss (=0.1T)
0291 # helper.add_filter(process, process.magneticFieldFilter)
0292 
0293 
0294 
0295 ################################################################################
0296 # Mille-procedure
0297 # ------------------------------------------------------------------------------
0298 if setupAlgoMode == "mille":
0299     import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille
0300     mille.setup(process,
0301                 input_files        = readFiles,
0302                 collection         = setupCollection,
0303                 json_file          = setupJson,
0304                 cosmics_zero_tesla = setupCosmicsZeroTesla,
0305                 cosmics_deco_mode  = setupCosmicsDecoMode)
0306 
0307 ################################################################################
0308 # Pede-procedure
0309 # ------------------------------------------------------------------------------
0310 else:
0311     # placeholers get replaced by mps_merge.py, which is called in mps_setup.pl
0312     merge_binary_files = ['placeholder_binaryList']
0313     merge_tree_files   = ['placeholder_treeList']
0314 
0315     import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede
0316     pede.setup(process,
0317                binary_files = merge_binary_files,
0318                tree_files = merge_tree_files,
0319                run_start_geometry = setupRunStartGeometry)