Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-05-06 02:07:24

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun g4OverlapCheck_cfg.py type=TB230FEB tol=0.01
0004 #
0005 #   Options for type TB230FEB, TB230Aug, TB230Sep, TB231May
0006 #               tol 1.0, 0.1, 0.01, 0.0
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('type',
0017                  "TB230FEB",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "type of operations: TB230FEB, TB230Aug, TB230Sep, TB231May")
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 ### get and parse the command line arguments
0028 options.parseArguments()
0029 print(options)
0030 
0031 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0032 
0033 process = cms.Process("OverlapCheck",Phase2C17I13M9)
0034 
0035 ####################################################################
0036 # Use the options
0037 geomFile = "Geometry.HGCalTBCommonData.test" + options.type + "XML_cfi"
0038 outFile = "hgcal" + options.type + str(options.tol)
0039 
0040 print("Geometry file: ", geomFile)
0041 print("Output file:   ", outFile)
0042 
0043 process.load('FWCore.MessageService.MessageLogger_cfi')
0044 process.load(geomFile)
0045 if (options.type == "TB231May"):
0046     process.load('Geometry.HGCalCommonData.hgcalEEHEParametersInitialization_cfi')
0047     process.load('Geometry.HGCalCommonData.hgcalEEHENumberingInitialization_cfi')
0048 else:
0049     process.load('Geometry.HGCalCommonData.hgcalEEParametersInitialization_cfi')
0050     process.load('Geometry.HGCalCommonData.hgcalEENumberingInitialization_cfi')
0051     process.load('Geometry.HcalTestBeamData.hcalTB06Parameters_cff')
0052 
0053 if hasattr(process,'MessageLogger'):
0054 #    process.MessageLogger.SimG4CoreGeometry=dict()
0055     process.MessageLogger.HGCalGeom=dict()
0056     process.MessageLogger.DDCompactViewImpl=dict()
0057 
0058 from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
0059 process = checkOverlap(process)
0060 
0061 # enable Geant4 overlap check 
0062 process.g4SimHits.CheckGeometry = True
0063 
0064 # Geant4 geometry check 
0065 process.g4SimHits.G4CheckOverlap.OutputBaseName = outFile
0066 process.g4SimHits.G4CheckOverlap.OverlapFlag = True
0067 process.g4SimHits.G4CheckOverlap.Tolerance  = options.tol
0068 process.g4SimHits.G4CheckOverlap.Resolution = 10000
0069 process.g4SimHits.G4CheckOverlap.Depth      = -1
0070 # tells if NodeName is G4Region or G4PhysicalVolume
0071 process.g4SimHits.G4CheckOverlap.RegionFlag = False
0072 # list of names
0073 process.g4SimHits.G4CheckOverlap.NodeNames  = ['OCMS']
0074 # enable dump gdml file 
0075 process.g4SimHits.G4CheckOverlap.gdmlFlag   = False
0076 # if defined a G4PhysicsVolume info is printed
0077 process.g4SimHits.G4CheckOverlap.PVname     = ''
0078 # if defined a list of daughter volumes is printed
0079 process.g4SimHits.G4CheckOverlap.LVname     = ''
0080 
0081 # extra output files, created if a name is not empty
0082 process.g4SimHits.FileNameField   = ''
0083 process.g4SimHits.FileNameGDML    = ''
0084 process.g4SimHits.FileNameRegions = ''
0085 #
0086 if (options.type == "TB231May"):
0087     process.g4SimHits.OnlySDs = ['HGCalSensitiveDetector'x]
0088 else:
0089     process.g4SimHits.OnlySDs = ['HGCalSensitiveDetector', 'HFNoseSensitiveDetector', 'HGCScintillatorSensitiveDetector', 'HcalTB06BeamDetector']