CMS 3D CMS Logo

dumpSimGeometry_cfg.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import FWCore.ParameterSet.Config as cms
3 import sys, os
4 import FWCore.ParameterSet.VarParsing as VarParsing
5 from FWCore.Utilities.Enumerate import Enumerate
6 from Configuration.Geometry.dictRun4Geometry import detectorVersionDict
7 
8 varType = Enumerate ("Run1 2015 2015dev 2017 2017Muon 2021 Run4")
9 defaultVersion=str();
10 
11 def help():
12  print("Usage: cmsRun dumpSimGeometry_cfg.py tag=TAG version=VERSION ")
13  print(" tag=tagname")
14  print(" identify geometry scenario ")
15  print(" ", varType.keys())
16  print("")
17  print(" version=versionNumber")
18  print(" scenario version from Run4 dictionary")
19  print("")
20  print(" out=outputFileName")
21  print(" default is cmsSimGeom<tag><version>.root")
22  print()
23  os._exit(1);
24 
25 def versionCheck(ver):
26  if ver == "":
27  print("Please, specify Run4 scenario version\n")
28  print(sorted([x[1] for x in detectorVersionDict.items()]))
29  print("")
30  help()
31 
32 def simGeoLoad(score):
33  print("Loading configuration for scenario", options.tag , options.version ,"...\n")
34  if score == "Run1":
35  process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
36 
37  elif score == "2015":
38  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015XML_cfi")
39 
40  elif score == "2015dev":
41  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2015devXML_cfi")
42 
43  elif score == "2017":
44  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi")
45 
46  elif score == "2017Muon":
47  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2017MuonXML_cfi")
48 
49  elif score == "2021":
50  process.load("Geometry.CMSCommonData.cmsExtendedGeometry2021XML_cfi")
51 
52  elif score == "Run4":
53  versionCheck(options.version)
54  process.load("Geometry.CMSCommonData.cmsExtendedGeometryRun4" + options.version + "XML_cfi")
55 
56  else:
57  help()
58 
60 
61 defaultTag=str(2017);
62 defaultLevel=14;
63 defaultOutputFileName="cmsSimGeom-"+ defaultTag +".root"
64 
65 options.register ('tag',
66  defaultTag, # default value
67  VarParsing.VarParsing.multiplicity.singleton,
68  VarParsing.VarParsing.varType.string,
69  "info about geometry scenario")
70 options.register ('version',
71  defaultVersion, # default value
72  VarParsing.VarParsing.multiplicity.singleton,
73  VarParsing.VarParsing.varType.string,
74  "info about Run4 geometry scenario version")
75 options.register ('out',
76  defaultOutputFileName, # default value
77  VarParsing.VarParsing.multiplicity.singleton,
78  VarParsing.VarParsing.varType.string,
79  "Output file name")
80 
81 
82 options.parseArguments()
83 
84 
85 if (options.out == defaultOutputFileName ):
86  options.out = "cmsSimGeom-" + str(options.tag) + str(options.version) + ".root"
87 
88 process = cms.Process("SIMDUMP")
89 simGeoLoad(options.tag)
90 
91 process.source = cms.Source("EmptySource")
92 
93 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
94 
95 process.add_(cms.ESProducer("TGeoMgrFromDdd",
96  verbose = cms.untracked.bool(False),
97  level = cms.untracked.int32(defaultLevel)
98  ))
99 
100 process.dump = cms.EDAnalyzer("DumpSimGeometry",
101  tag = cms.untracked.string(options.tag),
102  outputFileName = cms.untracked.string(options.out))
103 
104 process.p = cms.Path(process.dump)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)