CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dumpRecoGeometry_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 2017 2019 PhaseIPixel 2023Muon SLHC SLHCDB")
7 
8 def help():
9  print "Usage: cmsRun dumpFWRecoGeometry_cfg.py tag=TAG "
10  print " tag=tagname"
11  print " indentify geometry condition database tag"
12  print " ", varType.keys()
13  print ""
14  print " tgeo=bool"
15  print " dump in TGeo format to borwse it geomtery viewer"
16  print " import this will in Fireworks with option --sim-geom-file"
17  print ""
18  print ""
19  exit(1);
20 
21 def recoGeoLoad(score):
22  print "Loading configuration for tag ", options.tag ,"...\n"
23  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
24 
25  if score == "Run1":
26  from Configuration.AlCa.autoCond import autoCond
27  process.GlobalTag.globaltag = autoCond['mc']
28  process.load("Configuration.StandardSequences.GeometryDB_cff")
29  process.load("Configuration.StandardSequences.Reconstruction_cff")
30 
31  elif score == "2015":
32  from Configuration.AlCa.autoCond import autoCond
33  process.GlobalTag.globaltag = autoCond['mc']
34  process.load("Configuration.Geometry.GeometryExtended2015Reco_cff");
35 
36  elif score == "2017":
37  from Configuration.AlCa.GlobalTag import GlobalTag
38  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgrade2017', '')
39  process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
40  # Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
41  from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2017
42  # process = cust_2017(process)
43 
44  elif score == "2019":
45  from Configuration.AlCa.GlobalTag import GlobalTag
46  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgrade2019', '')
47  process.load('Configuration.Geometry.GeometryExtended2019Reco_cff')
48 
49  elif score == "PhaseIPixel":
50  from Configuration.AlCa.GlobalTag import GlobalTag
51  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:mc', '')
52  process.load('Configuration.Geometry.GeometryExtendedPhaseIPixelReco_cff')
53 
54  elif score == "2023Muon":
55  from Configuration.AlCa.GlobalTag import GlobalTag
56  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')
57  process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')
58  # Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
59  from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2023Muon
60  #call to customisation function cust_2023Muon imported from SLHCUpgradeSimulations.Configuration.combinedCustoms
61  # process = cust_2023Muon(process)
62 
63  elif score == "SLHCDB": # orig dumpFWRecoSLHCGeometry_cfg.py
64  process.GlobalTag.globaltag = 'DESIGN42_V17::All'
65  process.load("Configuration.StandardSequences.GeometryDB_cff")
66  process.load("Configuration.StandardSequences.Reconstruction_cff")
67 
68  process.GlobalTag.toGet = cms.VPSet(
69  cms.PSet(record = cms.string("GeometryFileRcd"),
70  tag = cms.string("XMLFILE_Geometry_428SLHCYV0_Phase1_R30F12_HCal_Ideal_mc"),
71  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")
72  ),
73  cms.PSet(record = cms.string('IdealGeometryRecord'),
74  tag = cms.string('TKRECO_Geometry_428SLHCYV0'),
75  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")),
76  cms.PSet(record = cms.string('PGeometricDetExtraRcd'),
77  tag = cms.string('TKExtra_Geometry_428SLHCYV0'),
78  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")),
79  )
80 
81  elif score == varType.valueForKey("SLHC"): # orig dumpFWRecoGeometrySLHC_cfg.py
82  from Configuration.AlCa.autoCond import autoCond
83  process.GlobalTag.globaltag = autoCond['mc']
84  process.load("Configuration.Geometry.GeometrySLHCSimIdeal_cff")
85  process.load("Configuration.Geometry.GeometrySLHCReco_cff")
86  process.load("Configuration.StandardSequences.Reconstruction_cff")
87  process.trackerSLHCGeometry.applyAlignment = False
88 
89  else:
90  help()
91 
92 
93 
94 
96 
97 
98 defaultOutputFileName="cmsRecoGeom.root"
99 
100 options.register ('tag',
101  "2015", # default value
102  VarParsing.VarParsing.multiplicity.singleton,
103  VarParsing.VarParsing.varType.string,
104  "tag info about geometry database conditions")
105 
106 
107 options.register ('tgeo',
108  False, # default value
109  VarParsing.VarParsing.multiplicity.singleton,
110  VarParsing.VarParsing.varType.bool,
111  "write geometry in TGeo format")
112 
113 
114 options.register ('out',
115  defaultOutputFileName, # default value
116  VarParsing.VarParsing.multiplicity.singleton,
117  VarParsing.VarParsing.varType.string,
118  "Output file name")
119 
120 options.parseArguments()
121 
122 
123 
124 
125 process = cms.Process("DUMP")
126 process.add_(cms.Service("InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(False)))
127 process.source = cms.Source("EmptySource")
128 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
129 
130 
131 recoGeoLoad(options.tag)
132 
133 if ( options.tgeo == True):
134  if (options.out == defaultOutputFileName ):
135  options.out = "cmsTGeoRecoGeom-" + str(options.tag) + ".root"
136  process.add_(cms.ESProducer("FWTGeoRecoGeometryESProducer"))
137  process.dump = cms.EDAnalyzer("DumpFWTGeoRecoGeometry",
138  tagInfo = cms.untracked.string(options.tag),
139  outputFileName = cms.untracked.string(options.out)
140  )
141 else:
142  if (options.out == defaultOutputFileName ):
143  options.out = "cmsRecoGeom-" + str(options.tag) + ".root"
144  process.add_(cms.ESProducer("FWRecoGeometryESProducer"))
145  process.dump = cms.EDAnalyzer("DumpFWRecoGeometry",
146  level = cms.untracked.int32(1),
147  tagInfo = cms.untracked.string(options.tag),
148  outputFileName = cms.untracked.string(options.out)
149  )
150 
151 print "Dumping geometry in " , options.out, "\n";
152 process.p = cms.Path(process.dump)