Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-13 02:58:31

0001 ###############################################################################
0002 # Way to use this:  
0003 #   cmsRun g4OverlapCheckDD4hep_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2016, 2017, 2018, 2021, 2023, 2024, 2025
0006 #
0007 ###############################################################################
0008 import FWCore.ParameterSet.Config as cms
0009 import FWCore.ParameterSet.VarParsing as VarParsing
0010 
0011 options = VarParsing.VarParsing('standard')
0012 options.register('geometry',
0013                  "2021",
0014                   VarParsing.VarParsing.multiplicity.singleton,
0015                   VarParsing.VarParsing.varType.string,
0016                   "geometry of operations: 2016, 2017, 2018, 2021, 2023, 2024, 2025")
0017 options.register('tol',
0018                  0.01,
0019                  VarParsing.VarParsing.multiplicity.singleton,
0020                  VarParsing.VarParsing.varType.float,
0021                  "Tolerance for checking overlaps: 0.0, 0.01, 0.1, 1.0"
0022 )
0023 options.parseArguments()
0024 print(options)
0025 
0026 baseName = "cmsDD4hep" + options.geometry
0027 geomName = "Configuration.Geometry.GeometryDD4hepExtended" + options.geometry + "Reco_cff"
0028 
0029 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0030 if (options.geometry == "2016"):
0031     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0032     process = cms.Process('G4PrintGeometry',Run2_2016,dd4hep)
0033 elif (options.geometry == "2017"):
0034     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0035     process = cms.Process('G4PrintGeometry',Run2_2017,dd4hep)
0036 elif (options.geometry == "2018"):
0037     from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
0038     process = cms.Process('G4PrintGeometry',Run2_2018,dd4hep)
0039 else:
0040     from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
0041     process = cms.Process('G4PrintGeometry',Run3_dd4hep)
0042 
0043 print("Base file Name: ", baseName)
0044 print("Geom file Name: ", geomName)
0045 
0046 process.load('FWCore.MessageService.MessageLogger_cfi')
0047 process.load(geomName)
0048 
0049 #if hasattr(process,'MessageLogger'):
0050 #    process.MessageLogger.HCalGeom=dict()
0051 
0052 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0053 process = checkOverlap(process)
0054 
0055 # enable Geant4 overlap check 
0056 process.g4SimHits.CheckGeometry = True
0057 
0058 # Geant4 geometry check 
0059 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0060 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0061 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0062 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0063 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0064 # tells if NodeName is G4Region or G4PhysicalVolume
0065 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
0066 # list of names
0067 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('cms:OCMS_1')
0068 # process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('DefaultRegionForTheWorld')
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 #