CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dumpSimGeometry_cfg.py
Go to the documentation of this file.
2 import sys
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 from FWCore.Utilities.Enumerate import Enumerate
5 
6 varType = Enumerate ("Run1 2015 2019 PhaseIPixel Phase1_R34F16 Phase2Tk 2023Muon SLHC DB SLHCDB")
7 
8 def help():
9  print "Usage: cmsRun dumpSimGeometry_cfg.py tag=TAG "
10  print " tag=tagname"
11  print " indentify geometry condition database tag"
12  print " ", varType.keys()
13  print ""
14  print " out=outputFileName"
15  print " default is cmsSimGeom<tag>.root"
16  print
17  exit(1);
18 
19 def simGeoLoad(score):
20  print "Loading configuration for tag ", options.tag ,"...\n"
21  if score == "Run1":
22  process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
23 
24  elif score == "2015":
25  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_cfi")
26 
27  elif score == "2019":
28  process.load('Configuration.Geometry.GeometryExtended2019Reco_cff')
29 
30  elif score == "PhaseIPixel":
31  process.load('Geometry.CMSCommonData.GeometryExtendedPhaseIPixel_cfi')
32 
33  elif score == "Phase1_R34F16":
34  process.load('Geometry.CMSCommonData.Phase1_R34F16_cmsSimIdealGeometryXML_cff')
35 
36  elif score == "Phase2Tk":
37  process.load('Geometry.CMSCommonData.cmsExtendedGeometryPhase2TkBEXML_cfi')
38 
39  elif score == "2023Muon":
40  process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')
41 
42 
43  elif score == "SLHC":
44  process.load('SLHCUpgradeSimulations.Geometry.Phase1_R30F12_HCal_cmsSimIdealGeometryXML_cff')
45 
46  elif score == "DB":
47  process.load("Configuration.StandardSequences.GeometryDB_cff")
48  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
49  from Configuration.AlCa.autoCond import autoCond
50  process.GlobalTag.globaltag = autoCond['mc']
51 
52  elif score == "SLHCDB":
53  process.load("Configuration.StandardSequences.GeometryDB_cff")
54  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
55  process.GlobalTag.globaltag = 'DESIGN42_V17::All'
56  process.XMLFromDBSource.label=''
57 
58  process.GlobalTag.toGet = cms.VPSet(
59  cms.PSet(record = cms.string("GeometryFileRcd"),
60  tag = cms.string("XMLFILE_Geometry_428SLHCYV0_Phase1_R30F12_HCal_Ideal_mc"),
61  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")
62  )
63  )
64 
65  else:
66  help()
67 
68 
69 
71 
72 defaultTag=str(2015);
73 defaultLevel=14;
74 defaultOutputFileName="cmsSimGeom.root"
75 
76 options.register ('tag',
77  defaultTag, # default value
78  VarParsing.VarParsing.multiplicity.singleton,
79  VarParsing.VarParsing.varType.string,
80  "info about geometry database conditions")
81 options.register ('out',
82  defaultOutputFileName, # default value
83  VarParsing.VarParsing.multiplicity.singleton,
84  VarParsing.VarParsing.varType.string,
85  "Output file name")
86 
87 
88 options.parseArguments()
89 
90 
91 if (options.out == defaultOutputFileName ):
92  options.out = "cmsSimGeom-" + str(options.tag) + ".root"
93 
94 process = cms.Process("SIMDUMP")
95 simGeoLoad(options.tag)
96 
97 process.source = cms.Source("EmptySource")
98 
99 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
100 
101 process.add_(cms.ESProducer("TGeoMgrFromDdd",
102  verbose = cms.untracked.bool(False),
103  level = cms.untracked.int32(defaultLevel)
104 ))
105 
106 process.dump = cms.EDAnalyzer("DumpSimGeometry",
107  tag = cms.untracked.string(options.tag),
108  outputFileName = cms.untracked.string(options.out))
109 
110 process.p = cms.Path(process.dump)