Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
import FWCore.ParameterSet.Config as cms
import sys
import FWCore.ParameterSet.VarParsing as VarParsing
from FWCore.Utilities.Enumerate import Enumerate

varType = Enumerate ("Run1 Ideal2015 Ideal2015dev 2015 2015dev GEMDev RPC4RE11 2017 2021 2023 2023dev 2023sim 2023Muon MaPSA CRack DB")

def help():
   print("Usage: cmsRun dumpSimGeometry_cfg.py  tag=TAG ")
   print("   tag=tagname")
   print("       indentify geometry condition database tag")
   print("      ", varType.keys())
   print("")
   print("   out=outputFileName")
   print("       default is cmsSimGeom<tag>.root")
   print() 
   exit(1);

def simGeoLoad(score):
    print("Loading configuration for tag ", options.tag ,"...\n")
    if score == "Run1":
       process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")

    elif score == "2015":
       process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_cfi")

    elif score == "2015dev":
       process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015devXML_cfi")

    elif score == "GEMDev":
       process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015MuonGEMDevXML_cfi")
       
    elif score == "Ideal2015":
       process.load("Geometry.CMSCommonData.cmsIdealGeometry2015XML_cfi")

    elif score == "Ideal2015dev":
       process.load("Geometry.CMSCommonData.cmsIdealGeometry2015devXML_cfi")

    elif score == "RPC4RE11":
       process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_RPC4RE11_cfi")

    elif score == "2017":
       process.load('Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi')
       
    elif score == "2021":
       process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
  
    elif score == "2023dev":
       process.load('Geometry.CMSCommonData.cmsExtendedGeometry2023devXML_cfi')

    elif score == "2023sim":
       process.load('Geometry.CMSCommonData.cmsExtendedGeometry2023simXML_cfi')
 
    elif score == "2023Muon":
       process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')

    elif score == "2023":
       process.load('Configuration.Geometry.GeometryExtended2023Reco_cff')

    elif score == "MaPSA":
       process.load('Geometry.TrackerCommonData.mapsaGeometryXML_cfi')

    elif score == "CRack":
       process.load('Geometry.TrackerCommonData.crackGeometryXML_cfi')

    elif score == "DB":
        process.load("Configuration.StandardSequences.GeometryDB_cff")
        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
        from Configuration.AlCa.autoCond import autoCond
        process.GlobalTag.globaltag = autoCond['run2_mc']

    else:
      help()



options = VarParsing.VarParsing ()

defaultTag=str(2015);
defaultLevel=14;
defaultOutputFileName="cmsSimGeom.root"

options.register ('tag',
                  defaultTag, # default value
                  VarParsing.VarParsing.multiplicity.singleton,
                  VarParsing.VarParsing.varType.string,
                  "info about geometry database conditions")
options.register ('out',
                  defaultOutputFileName, # default value
                  VarParsing.VarParsing.multiplicity.singleton,
                  VarParsing.VarParsing.varType.string,
                  "Output file name")


options.parseArguments()


if (options.out == defaultOutputFileName ):
   options.out = "cmsSimGeom-" + str(options.tag) + ".root"

process = cms.Process("SIMDUMP")
simGeoLoad(options.tag)

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

process.add_(cms.ESProducer("TGeoMgrFromDdd",
        verbose = cms.untracked.bool(False),
        level = cms.untracked.int32(defaultLevel)
))

process.dump = cms.EDAnalyzer("DumpSimGeometry", 
               tag = cms.untracked.string(options.tag),
               outputFileName = cms.untracked.string(options.out))

process.p = cms.Path(process.dump)