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 g4OverlapCheckEcal_cfg.py geometry=2021 tol=0.1
0004 #
0005 #   Options for geometry 2016, 2017, 2021, 2026D102, 2026D103, 2026D104,
0006 #                        2026D108, 2026D109, 2026D110
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, 2026D102, 2026D103, 2026D104, 2026D108, 2026D109, 2026D110")
0021 options.register('tol',
0022                  0.01,
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 == "2026D102"):
0037     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0038     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0039     process.load('Configuration.Geometry.GeometryExtended2026D102Reco_cff')
0040     baseName = 'Hcal2026D102'
0041 elif (options.geometry == "2026D103"):
0042     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0043     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0044     process.load('Configuration.Geometry.GeometryExtended2026D103Reco_cff')
0045     baseName = 'Hcal2026D103'
0046 elif (options.geometry == "2026D104"):
0047     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0048     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0049     process.load('Configuration.Geometry.GeometryExtended2026D104Reco_cff')
0050     baseName = 'Hcal2026D104'
0051 elif (options.geometry == "2026D108"):
0052     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0053     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0054     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0055     baseName = 'Hcal2026D108'
0056 elif (options.geometry == "2026D109"):
0057     from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
0058     process = cms.Process('G4PrintGeometry',Phase2C22I13M9)
0059     process.load('Configuration.Geometry.GeometryExtended2026D109Reco_cff')
0060     baseName = 'Hcal2026D109'
0061 elif (options.geometry == "2026D110"):
0062     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0063     process = cms.Process('G4PrintGeometry',Phase2C17I13M9)
0064     process.load('Configuration.Geometry.GeometryExtended2026D108Reco_cff')
0065     baseName = 'Hcal2026D110'
0066 elif (options.geometry == "2016"):
0067     from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0068     process = cms.Process('G4PrintGeometry',Run2_2016)
0069     process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0070     baseName = 'Ecal2016'
0071 elif (options.geometry == "2017"):
0072     from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
0073     process = cms.Process('G4PrintGeometry',Run2_2017)
0074     process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
0075     baseName = 'Ecal2017'
0076 else:
0077     from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD
0078     process = cms.Process('G4PrintGeometry',Run3_DDD)
0079     process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0080     baseName = 'Ecal2021'
0081 
0082 print("Base file Name: ", baseName)
0083 
0084 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0085 process = checkOverlap(process)
0086 
0087 # enable Geant4 overlap check 
0088 process.g4SimHits.CheckGeometry = True
0089 
0090 # Geant4 geometry check 
0091 process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string(baseName)
0092 process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
0093 process.g4SimHits.G4CheckOverlap.Tolerance  = cms.double(options.tol)
0094 process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
0095 process.g4SimHits.G4CheckOverlap.Depth      = cms.int32(-1)
0096 # tells if NodeName is G4Region or G4PhysicalVolume
0097 process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(True)
0098 # list of names
0099 process.g4SimHits.G4CheckOverlap.NodeNames  = cms.vstring('EcalRegion')
0100 # enable dump gdml file 
0101 process.g4SimHits.G4CheckOverlap.gdmlFlag   = cms.bool(False)
0102 # if defined a G4PhysicsVolume info is printed
0103 process.g4SimHits.G4CheckOverlap.PVname     = ''
0104 # if defined a list of daughter volumes is printed
0105 process.g4SimHits.G4CheckOverlap.LVname     = 'ECAL'
0106 
0107 # extra output files, created if a name is not empty
0108 process.g4SimHits.FileNameField   = ''
0109 process.g4SimHits.FileNameGDML    = ''
0110 process.g4SimHits.FileNameRegions = ''
0111