Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-30 04:10:44

0001 ###############################################################################
0002 # Way to use this:  
0003 #   cmsRun g4OverlapCheckDD4hep_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2017, 2018, 2021, 2023, 2024
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: 2017, 2018, 2021, 2023, 2024")
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 == "2017"):
0031     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0032     process = cms.Process('G4PrintGeometry',Run2_2017,dd4hep)
0033 elif (options.geometry == "2018"):
0034     from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
0035     process = cms.Process('G4PrintGeometry',Run2_2018,dd4hep)
0036 else:
0037     from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
0038     process = cms.Process('G4PrintGeometry',Run3_dd4hep)
0039 
0040 print("Base file Name: ", baseName)
0041 print("Geom file Name: ", geomName)
0042 
0043 process.load('FWCore.MessageService.MessageLogger_cfi')
0044 process.load(geomName)
0045 
0046 #if hasattr(process,'MessageLogger'):
0047 #    process.MessageLogger.HCalGeom=dict()
0048 
0049 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0050 process = checkOverlap(process)
0051 
0052 # enable Geant4 overlap check 
0053 process.g4SimHits.CheckGeometry = True
0054 
0055 # Geant4 geometry check 
0056 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0057 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0058 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0059 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0060 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0061 # tells if NodeName is G4Region or G4PhysicalVolume
0062 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
0063 # list of names
0064 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('cms:OCMS_1')
0065 # process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('DefaultRegionForTheWorld')
0066 # enable dump gdml file 
0067 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(False)
0068 # if defined a G4PhysicsVolume info is printed
0069 process.g4SimHits.G4CheckOverlap.PVname     = ''
0070 # if defined a list of daughter volumes is printed
0071 process.g4SimHits.G4CheckOverlap.LVname     = ''
0072 
0073 # extra output files, created if a name is not empty
0074 process.g4SimHits.FileNameField   = ''
0075 process.g4SimHits.FileNameGDML    = ''
0076 process.g4SimHits.FileNameRegions = ''
0077 #