Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:25

0001 ###############################################################################
0002 # Usage example:
0003 #   cmsRun g4OverlapCheck2026DDD_cfg.py geometry=D102 tol=0.01
0004 #
0005 ###############################################################################
0006 import FWCore.ParameterSet.Config as cms
0007 import FWCore.ParameterSet.VarParsing as VarParsing
0008 
0009 ####################################################################
0010 ### SETUP OPTIONS
0011 options = VarParsing.VarParsing('standard')
0012 options.register('geometry',
0013                  "",
0014                  VarParsing.VarParsing.multiplicity.singleton,
0015                  VarParsing.VarParsing.varType.string,
0016                  "Geometry name: e.g. D102"
0017 )
0018 options.register('tol',
0019                  0.01,
0020                  VarParsing.VarParsing.multiplicity.singleton,
0021                  VarParsing.VarParsing.varType.float,
0022                  "Overlap tolerance [mm]: 0.01, 0.1, 1.0"
0023 )
0024 options.register('full',
0025                  False,
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.bool,
0028                  "Check full CMS detector instead of just Tracker"
0029 )
0030 
0031 ### get and parse the command line arguments
0032 options.parseArguments()
0033 
0034 ####################################################################
0035 # Use the options
0036 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0037 process = cms.Process('OverlapCheck',Phase2C17I13M9)
0038 
0039 baseName = "GeometryExtended2026" + options.geometry
0040 geomFile = "Configuration.Geometry." + baseName + "_cff"
0041 
0042 print("Base file Name:     ", baseName)
0043 print("Geometry file Name: ", geomFile)
0044 
0045 process.load(geomFile)
0046 process.load('FWCore.MessageService.MessageLogger_cfi')
0047 
0048 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0049 process = checkOverlap(process)
0050 
0051 # enable Geant4 overlap check 
0052 process.g4SimHits.CheckGeometry = True
0053 
0054 # Geant4 geometry check 
0055 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0056 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0057 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0058 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0059 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0060 # tells if NodeName is G4Region or G4PhysicalVolume
0061 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
0062 # list of name to be checked 
0063 if options.full:
0064     print('Checking the whole CMS detector')
0065     process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('OCMS')
0066 else:
0067     print('Checking only Tracker volume')
0068     process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('Tracker')
0069 # enable dump gdml file 
0070 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(False)
0071 # if defined a G4PhysicsVolume info is printed
0072 process.g4SimHits.G4CheckOverlap.PVname     = ''
0073 # if defined a list of daughter volumes is printed
0074 process.g4SimHits.G4CheckOverlap.LVname     = ''
0075 
0076 # extra output files, created if a name is not empty
0077 process.g4SimHits.FileNameField   = ''
0078 process.g4SimHits.FileNameGDML    = ''
0079 process.g4SimHits.FileNameRegions = ''
0080 #