Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:26

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import sys, os
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 from FWCore.Utilities.Enumerate import Enumerate
0006 from Configuration.Geometry.dict2026Geometry import detectorVersionDict
0007 
0008 varType = Enumerate ("Run1 2015 2015dev 2017 2017Muon 2021 2026")
0009 defaultVersion=str();
0010 
0011 def help():
0012    print("Usage: cmsRun dumpSimGeometry_cfg.py  tag=TAG version=VERSION ")
0013    print("   tag=tagname")
0014    print("       identify geometry scenario ")
0015    print("      ", varType.keys())
0016    print("")
0017    print("   version=versionNumber")
0018    print("       scenario version from 2026 dictionary")
0019    print("")
0020    print("   out=outputFileName")
0021    print("       default is cmsSimGeom<tag><version>.root")
0022    print() 
0023    os._exit(1);
0024 
0025 def versionCheck(ver):
0026    if ver == "":
0027       print("Please, specify 2026 scenario version\n")
0028       print(sorted([x[1] for x in detectorVersionDict.items()]))
0029       print("")
0030       help()
0031 
0032 def simGeoLoad(score):
0033     print("Loading configuration for scenario", options.tag , options.version ,"...\n")
0034     if score == "Run1":
0035        process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
0036 
0037     elif score == "2015":
0038        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_cfi")
0039 
0040     elif score == "2015dev":
0041        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015devXML_cfi")
0042 
0043     elif score == "2017":
0044        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
0045        
0046     elif score == "2017Muon":
0047        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017MuonXML_cfi")
0048 
0049     elif score == "2021":
0050        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2021XML_cfi")
0051 
0052     elif score == "2026":
0053        versionCheck(options.version)
0054        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2026" + options.version + "XML_cfi")
0055  
0056     else:
0057       help()
0058 
0059 options = VarParsing.VarParsing ()
0060 
0061 defaultTag=str(2017);
0062 defaultLevel=14;
0063 defaultOutputFileName="cmsSimGeom-"+ defaultTag +".root"
0064 
0065 options.register ('tag',
0066                   defaultTag, # default value
0067                   VarParsing.VarParsing.multiplicity.singleton,
0068                   VarParsing.VarParsing.varType.string,
0069                   "info about geometry scenario")
0070 options.register ('version',
0071                   defaultVersion, # default value
0072                   VarParsing.VarParsing.multiplicity.singleton,
0073                   VarParsing.VarParsing.varType.string,
0074                   "info about 2026 geometry scenario version")
0075 options.register ('out',
0076                   defaultOutputFileName, # default value
0077                   VarParsing.VarParsing.multiplicity.singleton,
0078                   VarParsing.VarParsing.varType.string,
0079                   "Output file name")
0080 
0081 
0082 options.parseArguments()
0083 
0084 
0085 if (options.out == defaultOutputFileName ):
0086    options.out = "cmsSimGeom-" + str(options.tag) + str(options.version) + ".root"
0087 
0088 process = cms.Process("SIMDUMP")
0089 simGeoLoad(options.tag)
0090 
0091 process.source = cms.Source("EmptySource")
0092 
0093 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0094 
0095 process.add_(cms.ESProducer("TGeoMgrFromDdd",
0096                             verbose = cms.untracked.bool(False),
0097                             level = cms.untracked.int32(defaultLevel)
0098                             ))
0099 
0100 process.dump = cms.EDAnalyzer("DumpSimGeometry", 
0101                               tag = cms.untracked.string(options.tag),
0102                               outputFileName = cms.untracked.string(options.out))
0103 
0104 process.p = cms.Path(process.dump)