Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-11-04 00:02:36

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheckCalo_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2016, 2017, 2021, 2026D88, 2026D92, 2026D93, 2026D99,
0006 #                        2026D103
0007 #
0008 ###############################################################################
0009 import FWCore.ParameterSet.Config as cms
0010 import os, sys, importlib, re
0011 import FWCore.ParameterSet.VarParsing as VarParsing
0012 
0013 ####################################################################
0014 ### SETUP OPTIONS
0015 options = VarParsing.VarParsing('standard')
0016 options.register('geometry',
0017                  "2021",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "geometry of operations: 2016, 2017, 2021, 2026D88, 2026D92, 2026D93, 2026D99, 2026D103")
0021 options.register('tol',
0022                  0.1,
0023                  VarParsing.VarParsing.multiplicity.singleton,
0024                  VarParsing.VarParsing.varType.float,
0025                  "Tolerance for checking overlaps: 0.0, 0.01, 0.1, 1.0"
0026 )
0027 
0028 ### get and parse the command line arguments
0029 options.parseArguments()
0030 
0031 print(options)
0032 
0033 ####################################################################
0034 # Use the options
0035 
0036 if (options.geometry == "2026D88"):
0037     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0038     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0039     process.load('Configuration.Geometry.GeometryExtended2026D88Reco_cff')
0040     baseName = 'Hcal2026D88'
0041 elif (options.geometry == "2026D92"):
0042     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0043     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0044     process.load('Configuration.Geometry.GeometryExtended2026D92Reco_cff')
0045     baseName = 'Hcal2026D92'
0046 elif (options.geometry == "2026D93"):
0047     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0048     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0049     process.load('Configuration.Geometry.GeometryExtended2026D93Reco_cff')
0050     baseName = 'Hcal2026D93'
0051 elif (options.geometry == "2026D99"):
0052     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0053     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0054     process.load('Configuration.Geometry.GeometryExtended2026D99Reco_cff')
0055     baseName = 'Hcal2026D99'
0056 elif (options.geometry == "2026D103"):
0057     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0058     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0059     process.load('Configuration.Geometry.GeometryExtended2026D103Reco_cff')
0060     baseName = 'Hcal2026D103'
0061 elif (options.geometry == "2016"):
0062     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0063     process = cms.Process('G4PrintGeometry',Run2_2016)
0064     process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0065     baseName = 'Hcal2016'
0066 elif (options.geometry == "2017"):
0067     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0068     process = cms.Process('G4PrintGeometry',Run2_2017)
0069     process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
0070     baseName = 'Hcal2017'
0071 else:
0072     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0073     process = cms.Process('G4PrintGeometry',Run3_DDD)
0074     process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0075     baseName = 'Hcal2021'
0076 
0077 print("Base file Name: ", baseName)
0078 
0079 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0080 process = checkOverlap(process)
0081 
0082 # enable Geant4 overlap check 
0083 process.g4SimHits.CheckGeometry = True
0084 
0085 # Geant4 geometry check 
0086 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0087 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0088 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0089 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0090 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0091 # tells if NodeName is G4Region or G4PhysicalVolume
0092 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(True)
0093 # list of names
0094 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('HcalRegion')
0095 # enable dump gdml file 
0096 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(True)
0097 # if defined a G4PhysicsVolume info is printed
0098 process.g4SimHits.G4CheckOverlap.PVname     = ''
0099 # if defined a list of daughter volumes is printed
0100 process.g4SimHits.G4CheckOverlap.LVname     = 'HCAL'
0101 
0102 # extra output files, created if a name is not empty
0103 process.g4SimHits.FileNameField   = ''
0104 process.g4SimHits.FileNameGDML    = ''
0105 process.g4SimHits.FileNameRegions = ''
0106 #