Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-15 04:21:44

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun dumpHGCalPassive_cfg.py geometry=V18 type=DDD
0004 #
0005 #   Options for geometry V18, V19
0006 #               type     DDD, DD4hep
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                  "V18",
0018                   VarParsing.VarParsing.multiplicity.singleton,
0019                   VarParsing.VarParsing.varType.string,
0020                   "type of operations: V18, V19")
0021 options.register('type',
0022                  "DDD",
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.string,
0025                   "type of operations: DDD, DD4hep")
0026 
0027 ### get and parse the command line arguments
0028 options.parseArguments()
0029 
0030 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0031 process = cms.Process('GeomDump',Phase2C17I13M9)
0032 fileName = "hgcalPassive" + options.geometry + options.type + ".root"
0033 if (options.type == "DD4hep"):
0034     geomFile = "Geometry/HGCalCommonData/data/dd4hep/testHGCalPassive" + options.geometry + ".xml"
0035     process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer",
0036                                                 confGeomXMLFiles = cms.FileInPath(geomFile),
0037     appendToDataLabel = cms.string('DDHGCal'))
0038 else:
0039     geomFile = "Geometry.HGCalCommonData.testHGCalPassive" + options.geometry + "XML_cfi"
0040     process.load(geomFile)
0041 
0042 print("Geometry file: ", geomFile)
0043 print("Output file:   ", fileName)
0044 
0045 process.load('FWCore.MessageService.MessageLogger_cfi')
0046 
0047 if 'MessageLogger' in process.__dict__:
0048     process.MessageLogger.G4cerr=dict()
0049     process.MessageLogger.G4cout=dict()
0050     process.MessageLogger.HGCalGeom=dict()
0051 #   process.MessageLogger.SimG4CoreGeometry=dict()
0052 #   process.MessageLogger.TGeoMgrFromDdd=dict()
0053     
0054 process.source = cms.Source("EmptySource")
0055 
0056 process.maxEvents = cms.untracked.PSet(
0057     input = cms.untracked.int32(1)
0058 )
0059 
0060 if (options.type == "DD4hep"):
0061     process.dump = cms.EDAnalyzer("DDTestDumpFile",
0062                                   outputFileName = cms.untracked.string(fileName),
0063                                   DDDetector = cms.ESInputTag('','DDHGCal'))
0064 else:
0065     process.add_(cms.ESProducer("TGeoMgrFromDdd",
0066                                 verbose = cms.untracked.bool(False),
0067                                 level   = cms.untracked.int32(14)))
0068     process.dump = cms.EDAnalyzer("DumpSimGeometry",
0069                                   outputFileName = cms.untracked.string(fileName))
0070 
0071 process.p = cms.Path(process.dump)