test
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.
1 import FWCore.ParameterSet.Config as cms
2 import sys
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 from FWCore.Utilities.Enumerate import Enumerate
5 
6 varType = Enumerate ("Run1 Ideal2015 Ideal2015dev 2015 2015dev 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 == "2015dev":
28  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015devXML_cfi")
29 
30  elif score == "Ideal2015":
31  process.load("Geometry.CMSCommonData.cmsIdealGeometry2015XML_cfi")
32 
33  elif score == "Ideal2015dev":
34  process.load("Geometry.CMSCommonData.cmsIdealGeometry2015devXML_cfi")
35 
36  elif score == "RPC4RE11":
37  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_RPC4RE11_cfi")
38 
39  elif score == "2017":
40  process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
41 
42  elif score == "2019":
43  process.load('Configuration.Geometry.GeometryExtended2019Reco_cff')
44 
45  elif score == "PhaseIPixel":
46  process.load('Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi')
47 
48 
49  elif score == "2023Muon":
50  process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')
51 
52  elif score == "2023":
53  process.load('Configuration.Geometry.GeometryExtended2023Reco_cff')
54 
55  elif score == "DB":
56  process.load("Configuration.StandardSequences.GeometryDB_cff")
57  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
58  from Configuration.AlCa.autoCond import autoCond
59  process.GlobalTag.globaltag = autoCond['mc']
60 
61  elif score == "SLHCDB":
62  process.load("Configuration.StandardSequences.GeometryDB_cff")
63  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
64  process.GlobalTag.globaltag = 'DESIGN42_V17::All'
65  process.XMLFromDBSource.label=''
66 
67  process.GlobalTag.toGet = cms.VPSet(
68  cms.PSet(record = cms.string("GeometryFileRcd"),
69  tag = cms.string("XMLFILE_Geometry_428SLHCYV0_Phase1_R30F12_HCal_Ideal_mc"),
70  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")
71  )
72  )
73 
74  else:
75  help()
76 
77 
78 
80 
81 defaultTag=str(2015);
82 defaultLevel=14;
83 defaultOutputFileName="cmsSimGeom.root"
84 
85 options.register ('tag',
86  defaultTag, # default value
87  VarParsing.VarParsing.multiplicity.singleton,
88  VarParsing.VarParsing.varType.string,
89  "info about geometry database conditions")
90 options.register ('out',
91  defaultOutputFileName, # default value
92  VarParsing.VarParsing.multiplicity.singleton,
93  VarParsing.VarParsing.varType.string,
94  "Output file name")
95 
96 
97 options.parseArguments()
98 
99 
100 if (options.out == defaultOutputFileName ):
101  options.out = "cmsSimGeom-" + str(options.tag) + ".root"
102 
103 process = cms.Process("SIMDUMP")
104 simGeoLoad(options.tag)
105 
106 process.source = cms.Source("EmptySource")
107 
108 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
109 
110 process.add_(cms.ESProducer("TGeoMgrFromDdd",
111  verbose = cms.untracked.bool(False),
112  level = cms.untracked.int32(defaultLevel)
113 ))
114 
115 process.dump = cms.EDAnalyzer("DumpSimGeometry",
116  tag = cms.untracked.string(options.tag),
117  outputFileName = cms.untracked.string(options.out))
118 
119 process.p = cms.Path(process.dump)