Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-16 02:43:16

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheckCalo_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104,
0006 #                        22026D108, 026D109, 2026D110, 2026D111, 2026D112, 
0007 #                        2026D113, 2026D114, 2026D115
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('geometry',
0018                  "2021",
0019                   VarParsing.VarParsing.multiplicity.singleton,
0020                   VarParsing.VarParsing.varType.string,
0021                   "geometry of operations: 2016, 2017, 2021, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110, 2026D111, 2026D112, 2026D113, 2026D114, 2026D115")
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 )
0028 
0029 ### get and parse the command line arguments
0030 options.parseArguments()
0031 
0032 print(options)
0033 
0034 ####################################################################
0035 # Use the options
0036 
0037 if (options.geometry == "2026D102"):
0038     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0039     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0040     process.load('Configuration.Geometry.GeometryExtended2026D102Reco_cff')
0041     baseName = 'Hcal2026D102'
0042 elif (options.geometry == "2026D103"):
0043     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0044     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0045     process.load('Configuration.Geometry.GeometryExtended2026D103Reco_cff')
0046     baseName = 'Hcal2026D103'
0047 elif (options.geometry == "2026D104"):
0048     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0049     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0050     process.load('Configuration.Geometry.GeometryExtended2026D104Reco_cff')
0051     baseName = 'Hcal2026D104'
0052 elif (options.geometry == "2026D108"):
0053     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0054     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0055     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0056     baseName = 'Hcal2026D108'
0057 elif (options.geometry == "2026D109"):
0058     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0059     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0060     process.load('Configuration.Geometry.GeometryExtended2026D109Reco_cff')
0061     baseName = 'Hcal2026D109'
0062 elif (options.geometry == "2026D110"):
0063     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0064     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0065     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0066     baseName = 'Hcal2026D110'
0067 elif (options.geometry == "2026D111"):
0068     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0069     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0070     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0071     baseName = 'Hcal2026D111'
0072 elif (options.geometry == "2026D112"):
0073     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0074     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0075     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0076     baseName = 'Hcal2026D112'
0077 elif (options.geometry == "2026D113"):
0078     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0079     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0080     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0081     baseName = 'Hcal2026D113'
0082 elif (options.geometry == "2026D114"):
0083     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0084     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0085     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0086     baseName = 'Hcal2026D114'
0087 elif (options.geometry == "2026D115"):
0088     from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0089     process = cms.Process('G4PrintGeometry',Phase2C20I13M9)
0090     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0091     baseName = 'Hcal2026D115'
0092 elif (options.geometry == "2016"):
0093     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0094     process = cms.Process('G4PrintGeometry',Run2_2016)
0095     process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0096     baseName = 'Hcal2016'
0097 elif (options.geometry == "2017"):
0098     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0099     process = cms.Process('G4PrintGeometry',Run2_2017)
0100     process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
0101     baseName = 'Hcal2017'
0102 else:
0103     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0104     process = cms.Process('G4PrintGeometry',Run3_DDD)
0105     process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0106     baseName = 'Hcal2021'
0107 
0108 print("Base file Name: ", baseName)
0109 
0110 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0111 process = checkOverlap(process)
0112 
0113 # enable Geant4 overlap check 
0114 process.g4SimHits.CheckGeometry = True
0115 
0116 # Geant4 geometry check 
0117 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0118 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0119 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0120 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0121 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0122 # tells if NodeName is G4Region or G4PhysicalVolume
0123 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(True)
0124 # list of names
0125 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('HcalRegion')
0126 # enable dump gdml file 
0127 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(True)
0128 # if defined a G4PhysicsVolume info is printed
0129 process.g4SimHits.G4CheckOverlap.PVname     = ''
0130 # if defined a list of daughter volumes is printed
0131 process.g4SimHits.G4CheckOverlap.LVname     = 'HCAL'
0132 
0133 # extra output files, created if a name is not empty
0134 process.g4SimHits.FileNameField   = ''
0135 process.g4SimHits.FileNameGDML    = ''
0136 process.g4SimHits.FileNameRegions = ''
0137 #