Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-07 06:13:05

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheckMuon_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2016, 2017, 2021, Run4D102, Run4D103, Run4D104,
0006 #                        Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, 
0007 #                        Run4D113, Run4D114, Run4D115, Run4D116
0008 #
0009 ###############################################################################
0010 import FWCore.ParameterSet.Config as cms
0011 import os, sys, importlib, re
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 
0014 ####################################################################
0015 ### SETUP OPTIONS
0016 options = VarParsing.VarParsing('standard')
0017 options.register('geometry',
0018                  "2021",
0019                   VarParsing.VarParsing.multiplicity.singleton,
0020                   VarParsing.VarParsing.varType.string,
0021                   "geometry of operations: 2016, 2017, 2021, Run4D102, Run4D103, Run4D104, Run4D108, Run4D109, Run4D110, Run4D111, Run4D112, Run4D113, Run4D114, Run4D115, Run4D116")
0022 options.register('tol',
0023                  0.01,
0024                  VarParsing.VarParsing.multiplicity.singleton,
0025                  VarParsing.VarParsing.varType.float,
0026                  "Tolerance for checking overlaps: 0.0, 0.01, 0.1, 1.0"
0027 )
0028 
0029 ### get and parse the command line arguments
0030 options.parseArguments()
0031 
0032 print(options)
0033 
0034 ####################################################################
0035 # Use the options
0036 
0037 if (options.geometry == "Run4D102"):
0038     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0039     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0040     process.load('Configuration.Geometry.GeometryExtendedRun4D102Reco_cff')
0041     baseName = 'MuonRun4D102'
0042 elif (options.geometry == "Run4D103"):
0043     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0044     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0045     process.load('Configuration.Geometry.GeometryExtendedRun4D103Reco_cff')
0046     baseName = 'MuonRun4D103'
0047 elif (options.geometry == "Run4D104"):
0048     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0049     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0050     process.load('Configuration.Geometry.GeometryExtendedRun4D104Reco_cff')
0051     baseName = 'MuonRun4D104'
0052 elif (options.geometry == "Run4D108"):
0053     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0054     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0055     process.load('Configuration.Geometry.GeometryExtendedRun4D108Reco_cff')
0056     baseName = 'MuonRun4D108'
0057 elif (options.geometry == "Run4D109"):
0058     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0059     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0060     process.load('Configuration.Geometry.GeometryExtendedRun4D109Reco_cff')
0061     baseName = 'MuonRun4D109'
0062 elif (options.geometry == "Run4D110"):
0063     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0064     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0065     process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff')
0066     baseName = 'MuonRun4D110'
0067 elif (options.geometry == "Run4D111"):
0068     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0069     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0070     process.load('Configuration.Geometry.GeometryExtendedRun4D111Reco_cff')
0071     baseName = 'MuonRun4D111'
0072 elif (options.geometry == "Run4D112"):
0073     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0074     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0075     process.load('Configuration.Geometry.GeometryExtendedRun4D112Reco_cff')
0076     baseName = 'MuonRun4D112'
0077 elif (options.geometry == "Run4D113"):
0078     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0079     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0080     process.load('Configuration.Geometry.GeometryExtendedRun4D113Reco_cff')
0081     baseName = 'MuonRun4D113'
0082 elif (options.geometry == "Run4D114"):
0083     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0084     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0085     process.load('Configuration.Geometry.GeometryExtendedRun4D114Reco_cff')
0086     baseName = 'MuonRun4D114'
0087 elif (options.geometry == "Run4D115"):
0088     from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0089     process = cms.Process('G4PrintGeometry',Phase2C20I13M9)
0090     process.load('Configuration.Geometry.GeometryExtendedRun4D115Reco_cff')
0091     baseName = 'MuonRun4D115'
0092 elif (options.geometry == "Run4D116"):
0093     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0094     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0095     process.load('Configuration.Geometry.GeometryExtendedRun4D116Reco_cff')
0096     baseName = 'MuonRun4D116'
0097 elif (options.geometry == "2016"):
0098     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0099     process = cms.Process('G4PrintGeometry',Run2_2016)
0100     process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0101     baseName = 'Muon2016'
0102 elif (options.geometry == "2017"):
0103     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0104     process = cms.Process('G4PrintGeometry',Run2_2017)
0105     process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
0106     baseName = 'Muon2017'
0107 else:
0108     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0109     process = cms.Process('G4PrintGeometry',Run3_DDD)
0110     process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0111     baseName = 'Muon2021'
0112 
0113 print("Base file Name: ", baseName)
0114 
0115 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0116 process = checkOverlap(process)
0117 
0118 # enable Geant4 overlap check 
0119 process.g4SimHits.CheckGeometry = True
0120 
0121 # Geant4 geometry check 
0122 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0123 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0124 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0125 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0126 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0127 # tells if NodeName is G4Region or G4PhysicalVolume
0128 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
0129 # list of names
0130 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('OCMS')
0131 # enable dump gdml file 
0132 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(False)
0133 # if defined a G4PhysicsVolume info is printed
0134 process.g4SimHits.G4CheckOverlap.PVname     = ''
0135 # if defined a list of daughter volumes is printed
0136 process.g4SimHits.G4CheckOverlap.LVname     = ''
0137 
0138 # extra output files, created if a name is not empty
0139 process.g4SimHits.FileNameField   = ''
0140 process.g4SimHits.FileNameGDML    = ''
0141 process.g4SimHits.FileNameRegions = ''