Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-11 03:00:06

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheck_cfg.py type=V17 tol=0.01 resol=10000
0004 #
0005 #   Options for type  V16, V17, V17n, V17ng, V18, V18n, V18ng, V18ngr, V18O,
0006 #                     V19, V19n, V19ng, V19ngr, V19X, Wafer, WaferFR, WaferPR,
0007 #                     V17Only
0008 #               tol   1.0, 0.1, 0.01, 0.0
0009 #               resol 10000, 100000, 1000000
0010 #
0011 ###############################################################################
0012 import FWCore.ParameterSet.Config as cms
0013 import os, sys, importlib, re
0014 import FWCore.ParameterSet.VarParsing as VarParsing
0015 
0016 ####################################################################
0017 ### SETUP OPTIONS
0018 options = VarParsing.VarParsing('standard')
0019 options.register('type',
0020                  "V17",
0021                   VarParsing.VarParsing.multiplicity.singleton,
0022                   VarParsing.VarParsing.varType.string,
0023                   "type of operations: V16, V17, V17n, V7ng, V17Only, V18, V18n, V18ng, V18ngr, V18O, V19, V19n, V19ng, V19ngr, V19X, Wafer, WaferFR, WaferPR")
0024 options.register('tol',
0025                  0.01,
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.float,
0028                  "Tolerance for checking overlaps: 0.0, 0.01, 0.1, 1.0")
0029 options.register('resol',
0030                  10000,
0031                  VarParsing.VarParsing.multiplicity.singleton,
0032                  VarParsing.VarParsing.varType.float,
0033                  "Resolution for checking overlaps: 10000, 100000, 1000000")
0034 
0035 ### get and parse the command line arguments
0036 options.parseArguments()
0037 print(options)
0038 
0039 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0040 from Configuration.Eras.Modifier_phase2_hgcalOnly_cff import phase2_hgcalOnly
0041 
0042 if (options.type == "V18O"):
0043     process = cms.Process("OverlapCheck",Phase2C17I13M9,phase2_hgcalOnly)
0044 elif (options.type == "V17Only"):
0045     process = cms.Process("OverlapCheck",Phase2C17I13M9,phase2_hgcalOnly)
0046 else:
0047     process = cms.Process("OverlapCheck",Phase2C17I13M9)
0048 
0049 ####################################################################
0050 # Use the options
0051 geomFile = "Geometry.HGCalCommonData.testHGCal" + options.type + "XML_cfi"
0052 outFile = "hgcal" + options.type + str(options.tol)
0053 resoluton = int(options.resol)
0054 
0055 print("Geometry file: ", geomFile)
0056 print("Output file:   ", outFile)
0057 print("Resolution:    ", resoluton)
0058 
0059 process.load('FWCore.MessageService.MessageLogger_cfi')
0060 process.load(geomFile)
0061 process.load('Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff')
0062 process.load('SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff')
0063 process.load('Geometry.EcalCommonData.ecalSimulationParameters_cff')
0064 process.load('Geometry.HcalCommonData.hcalDDDSimConstants_cff')
0065 process.load('Geometry.HGCalCommonData.hgcalParametersInitialization_cfi')
0066 process.load('Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi')
0067 process.load('Geometry.MuonNumbering.muonGeometryConstants_cff')
0068 process.load('Geometry.MuonNumbering.muonOffsetESProducer_cff')
0069 process.load('Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff')
0070 
0071 if hasattr(process,'MessageLogger'):
0072 #    process.MessageLogger.SimG4CoreGeometry=dict()
0073     process.MessageLogger.HGCalGeom=dict()
0074     process.MessageLogger.EcalGeom=dict()
0075 
0076 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0077 process = checkOverlap(process)
0078 
0079 # enable Geant4 overlap check 
0080 process.g4SimHits.CheckGeometry = True
0081 
0082 # Geant4 geometry check 
0083 process.g4SimHits.G4CheckOverlap.OutputBaseName = outFile
0084 process.g4SimHits.G4CheckOverlap.OverlapFlag = True
0085 process.g4SimHits.G4CheckOverlap.Tolerance  = options.tol
0086 process.g4SimHits.G4CheckOverlap.Resolution = int(options.resol)
0087 process.g4SimHits.G4CheckOverlap.Depth      = -1
0088 # tells if NodeName is G4Region or G4PhysicalVolume
0089 process.g4SimHits.G4CheckOverlap.RegionFlag = False
0090 # list of names
0091 process.g4SimHits.G4CheckOverlap.NodeNames  = ['OCMS']
0092 # enable dump gdml file 
0093 process.g4SimHits.G4CheckOverlap.gdmlFlag   = False
0094 # if defined a G4PhysicsVolume info is printed
0095 process.g4SimHits.G4CheckOverlap.PVname     = ''
0096 # if defined a list of daughter volumes is printed
0097 process.g4SimHits.G4CheckOverlap.LVname     = ''
0098 
0099 # extra output files, created if a name is not empty
0100 process.g4SimHits.FileNameField   = ''
0101 process.g4SimHits.FileNameGDML    = ''
0102 process.g4SimHits.FileNameRegions = ''
0103 #