Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-05-09 22:37:45

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheckDD4hep_cfg.py type=V17 tol=0.01 resol=10000
0004 #
0005 #   Options for type  V17, V19
0006 #               tol   1.0, 0.1, 0.01, 0.0
0007 #               resol 10000, 100000, 1000000
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('type',
0018                  "V17",
0019                   VarParsing.VarParsing.multiplicity.singleton,
0020                   VarParsing.VarParsing.varType.string,
0021                   "type of operations: V17, V19")
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 options.register('resol',
0028                  10000,
0029                  VarParsing.VarParsing.multiplicity.singleton,
0030                  VarParsing.VarParsing.varType.float,
0031                  "Resolution for checking overlaps: 10000, 100000, 1000000")
0032 
0033 ### get and parse the command line arguments
0034 options.parseArguments()
0035 print(options)
0036 
0037 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0038 from Configuration.Eras.Modifier_phase2_hgcalOnly_cff import phase2_hgcalOnly
0039 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0040 
0041 process = cms.Process("OverlapCheck",Phase2C17I13M9,dd4hep)
0042 
0043 ####################################################################
0044 # Use the options
0045 geomFile = "Geometry.HGCalCommonData.testHGCalDD4hep" + options.type + "Reco_cff"
0046 outFile = "hgcal" + options.type + str(options.tol)
0047 resoluton = int(options.resol)
0048 
0049 print("Geometry file: ", geomFile)
0050 print("Output file:   ", outFile)
0051 print("Resolution:    ", resoluton)
0052 
0053 process.load('FWCore.MessageService.MessageLogger_cfi')
0054 process.load(geomFile)
0055 
0056 if hasattr(process,'MessageLogger'):
0057 #    process.MessageLogger.SimG4CoreGeometry=dict()
0058     process.MessageLogger.HGCalGeom=dict()
0059     process.MessageLogger.EcalGeom=dict()
0060 
0061 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0062 process = checkOverlap(process)
0063 
0064 # enable Geant4 overlap check 
0065 process.g4SimHits.CheckGeometry = True
0066 
0067 # Geant4 geometry check 
0068 process.g4SimHits.G4CheckOverlap.OutputBaseName = outFile
0069 process.g4SimHits.G4CheckOverlap.OverlapFlag = True
0070 process.g4SimHits.G4CheckOverlap.Tolerance  = options.tol
0071 process.g4SimHits.G4CheckOverlap.Resolution = int(options.resol)
0072 process.g4SimHits.G4CheckOverlap.Depth      = -1
0073 # tells if NodeName is G4Region or G4PhysicalVolume
0074 process.g4SimHits.G4CheckOverlap.RegionFlag = False
0075 # list of names
0076 process.g4SimHits.G4CheckOverlap.NodeNames  = ['cms:OCMS_1']
0077 # enable dump gdml file 
0078 process.g4SimHits.G4CheckOverlap.gdmlFlag   = False
0079 # if defined a G4PhysicsVolume info is printed
0080 process.g4SimHits.G4CheckOverlap.PVname     = ''
0081 # if defined a list of daughter volumes is printed
0082 process.g4SimHits.G4CheckOverlap.LVname     = ''
0083 
0084 # extra output files, created if a name is not empty
0085 process.g4SimHits.FileNameField   = ''
0086 process.g4SimHits.FileNameGDML    = ''
0087 process.g4SimHits.FileNameRegions = ''
0088 #