|
| 1 | +############################################################################### |
| 2 | +# Way to use this: |
| 3 | +# cmsRun g4OverlapCheckPassive_cfg.py geometry=V18 tol=0.01 |
| 4 | +# |
| 5 | +# Options for geometry V18, V19, V19c |
| 6 | +# |
| 7 | +############################################################################### |
| 8 | +import FWCore.ParameterSet.Config as cms |
| 9 | +import os, sys, importlib, re |
| 10 | +import FWCore.ParameterSet.VarParsing as VarParsing |
| 11 | + |
| 12 | +#################################################################### |
| 13 | +### SETUP OPTIONS |
| 14 | +options = VarParsing.VarParsing('standard') |
| 15 | +options.register('geometry', |
| 16 | + "V19", |
| 17 | + VarParsing.VarParsing.multiplicity.singleton, |
| 18 | + VarParsing.VarParsing.varType.string, |
| 19 | + "type of operations: V18, V19, V19c") |
| 20 | +options.register('tol', |
| 21 | + 0.01, |
| 22 | + VarParsing.VarParsing.multiplicity.singleton, |
| 23 | + VarParsing.VarParsing.varType.float, |
| 24 | + "Tolerance for checking overlaps: 0.0, 0.01, 0.1, 1.0") |
| 25 | + |
| 26 | +### get and parse the command line arguments |
| 27 | +options.parseArguments() |
| 28 | +print(options) |
| 29 | + |
| 30 | +from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 |
| 31 | +process = cms.Process('OverlapCheck',Phase2C17I13M9) |
| 32 | +#from Configuration.Eras.Modifier_hgcaltb_cff import hgcaltb |
| 33 | +#process = cms.Process('OverlapCheck',Phase2C17I13M9,hgcaltb) |
| 34 | + |
| 35 | +#################################################################### |
| 36 | +# Use the options |
| 37 | + |
| 38 | +geomFile = "Geometry.HGCalCommonData.testHGCalPassive" + options.geometry + "XML_cfi" |
| 39 | +outFile = "hgcal" + options.geometry + str(options.tol) |
| 40 | + |
| 41 | +print("Geometry file: ", geomFile) |
| 42 | +print("Output file: ", outFile) |
| 43 | + |
| 44 | +process.load('FWCore.MessageService.MessageLogger_cfi') |
| 45 | +process.load(geomFile) |
| 46 | +#process.load('Geometry.HGCalCommonData.hgcalParametersInitialization_cfi') |
| 47 | +#process.load('Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi') |
| 48 | + |
| 49 | +if hasattr(process,'MessageLogger'): |
| 50 | +# process.MessageLogger.SimG4CoreGeometry=dict() |
| 51 | +# process.MessageLogger.SimG4CoreApplication=dict() |
| 52 | + process.MessageLogger.HGCalGeom=dict() |
| 53 | + |
| 54 | +from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import * |
| 55 | +process = checkOverlap(process) |
| 56 | + |
| 57 | +# enable Geant4 overlap check |
| 58 | +process.g4SimHits.CheckGeometry = True |
| 59 | +process.g4SimHits.OnlySDs = ["NONE"] |
| 60 | +process.g4SimHits.CaloHits = [] |
| 61 | +process.g4SimHits.TrackHits = [] |
| 62 | + |
| 63 | +# Geant4 geometry check |
| 64 | +process.g4SimHits.G4CheckOverlap.OutputBaseName = outFile |
| 65 | +process.g4SimHits.G4CheckOverlap.OverlapFlag = True |
| 66 | +process.g4SimHits.G4CheckOverlap.Tolerance = options.tol |
| 67 | +process.g4SimHits.G4CheckOverlap.Resolution = 10000 |
| 68 | +process.g4SimHits.G4CheckOverlap.Depth = -1 |
| 69 | +# tells if NodeName is G4Region or G4PhysicalVolume |
| 70 | +process.g4SimHits.G4CheckOverlap.RegionFlag = False |
| 71 | +# list of names |
| 72 | +process.g4SimHits.G4CheckOverlap.NodeNames = ['OCMS'] |
| 73 | +# enable dump gdml file |
| 74 | +process.g4SimHits.G4CheckOverlap.gdmlFlag = False |
| 75 | +# if defined a G4PhysicsVolume info is printed |
| 76 | +process.g4SimHits.G4CheckOverlap.PVname = '' |
| 77 | +# if defined a list of daughter volumes is printed |
| 78 | +process.g4SimHits.G4CheckOverlap.LVname = '' |
| 79 | + |
| 80 | +# extra output files, created if a name is not empty |
| 81 | +process.g4SimHits.FileNameField = '' |
| 82 | +process.g4SimHits.FileNameGDML = '' |
| 83 | +process.g4SimHits.FileNameRegions = '' |
| 84 | +# |
0 commit comments