Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-01 23:40:25

0001 import FWCore.ParameterSet.Config as cms
0002 import sys
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 from FWCore.Utilities.Enumerate import Enumerate
0005 
0006 varType = Enumerate ("Run1 Ideal2015 Ideal2015dev 2015 2015dev GEMDev RPC4RE11 2017 2021 2023 2023dev 2023sim 2023Muon MaPSA CRack DB")
0007 
0008 def help():
0009    print("Usage: cmsRun dumpSimGeometry_cfg.py  tag=TAG ")
0010    print("   tag=tagname")
0011    print("       indentify geometry condition database tag")
0012    print("      ", varType.keys())
0013    print("")
0014    print("   out=outputFileName")
0015    print("       default is cmsSimGeom<tag>.root")
0016    print() 
0017    exit(1);
0018 
0019 def simGeoLoad(score):
0020     print("Loading configuration for tag ", options.tag ,"...\n")
0021     if score == "Run1":
0022        process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
0023 
0024     elif score == "2015":
0025        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_cfi")
0026 
0027     elif score == "2015dev":
0028        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015devXML_cfi")
0029 
0030     elif score == "GEMDev":
0031        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015MuonGEMDevXML_cfi")
0032        
0033     elif score == "Ideal2015":
0034        process.load("Geometry.CMSCommonData.cmsIdealGeometry2015XML_cfi")
0035 
0036     elif score == "Ideal2015dev":
0037        process.load("Geometry.CMSCommonData.cmsIdealGeometry2015devXML_cfi")
0038 
0039     elif score == "RPC4RE11":
0040        process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_RPC4RE11_cfi")
0041 
0042     elif score == "2017":
0043        process.load('Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi')
0044        
0045     elif score == "2021":
0046        process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0047   
0048     elif score == "2023dev":
0049        process.load('Geometry.CMSCommonData.cmsExtendedGeometry2023devXML_cfi')
0050 
0051     elif score == "2023sim":
0052        process.load('Geometry.CMSCommonData.cmsExtendedGeometry2023simXML_cfi')
0053  
0054     elif score == "2023Muon":
0055        process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')
0056 
0057     elif score == "2023":
0058        process.load('Configuration.Geometry.GeometryExtended2023Reco_cff')
0059 
0060     elif score == "MaPSA":
0061        process.load('Geometry.TrackerCommonData.mapsaGeometryXML_cfi')
0062 
0063     elif score == "CRack":
0064        process.load('Geometry.TrackerCommonData.crackGeometryXML_cfi')
0065 
0066     elif score == "DB":
0067         process.load("Configuration.StandardSequences.GeometryDB_cff")
0068         process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0069         from Configuration.AlCa.autoCond import autoCond
0070         process.GlobalTag.globaltag = autoCond['run2_mc']
0071 
0072     else:
0073       help()
0074 
0075 
0076 
0077 options = VarParsing.VarParsing ()
0078 
0079 defaultTag=str(2015);
0080 defaultLevel=14;
0081 defaultOutputFileName="cmsSimGeom.root"
0082 
0083 options.register ('tag',
0084                   defaultTag, # default value
0085                   VarParsing.VarParsing.multiplicity.singleton,
0086                   VarParsing.VarParsing.varType.string,
0087                   "info about geometry database conditions")
0088 options.register ('out',
0089                   defaultOutputFileName, # default value
0090                   VarParsing.VarParsing.multiplicity.singleton,
0091                   VarParsing.VarParsing.varType.string,
0092                   "Output file name")
0093 
0094 
0095 options.parseArguments()
0096 
0097 
0098 if (options.out == defaultOutputFileName ):
0099    options.out = "cmsSimGeom-" + str(options.tag) + ".root"
0100 
0101 process = cms.Process("SIMDUMP")
0102 simGeoLoad(options.tag)
0103 
0104 process.source = cms.Source("EmptySource")
0105 
0106 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0107 
0108 process.add_(cms.ESProducer("TGeoMgrFromDdd",
0109         verbose = cms.untracked.bool(False),
0110         level = cms.untracked.int32(defaultLevel)
0111 ))
0112 
0113 process.dump = cms.EDAnalyzer("DumpSimGeometry", 
0114                tag = cms.untracked.string(options.tag),
0115                outputFileName = cms.untracked.string(options.out))
0116 
0117 process.p = cms.Path(process.dump)