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.
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 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.load("SLHCUpgradeSimulations.Configuration.combinedCustoms.cust_2017")
43  # process = cust_2017(process)
44 
45  elif score == "2019":
46  from Configuration.AlCa.GlobalTag import GlobalTag
47  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgrade2019', '')
48  process.load('Configuration.Geometry.GeometryExtended2019Reco_cff')
49  #from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2019
50 
51  elif score == "PhaseIPixel":
52  from Configuration.AlCa.GlobalTag import GlobalTag
53  process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:mc', '')
54  process.load('Configuration.Geometry.GeometryExtendedPhaseIPixelReco_cff')
55 
56  elif score == "2023":
57  from Configuration.AlCa.autoCond import autoCond
58  process.GlobalTag.globaltag = autoCond['mc']
59  #from Configuration.AlCa.GlobalTag import GlobalTag
60  #process.GlobalTag = GlobalTag(process.GlobalTag, 'PH2_1K_FB_V6::All', '')
61  process.load('Configuration.Geometry.GeometryExtended2023Reco_cff')
62  #from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2019
63  #process = cust_2019(process)
64 
65  elif score == "2023Dev":
66  from Configuration.AlCa.autoCond import autoCond
67  process.GlobalTag.globaltag = autoCond['mc']
68  #from Configuration.AlCa.GlobalTag import GlobalTag
69  #process.GlobalTag = GlobalTag(process.GlobalTag, 'PH2_1K_FB_V6::All', '')
70  process.load('Configuration.Geometry.GeometryExtended2023DevReco_cff')
71  #from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2019
72  #process = cust_2019(process)
73 
74  elif score == "2023Muon":
75  from Configuration.AlCa.autoCond import autoCond
76  process.GlobalTag.globaltag = autoCond['mc']
77  #from Configuration.AlCa.GlobalTag import GlobalTag
78  #process.GlobalTag = GlobalTag(process.GlobalTag, 'PH2_1K_FB_V6::All', '')
79  process.load('Configuration.Geometry.GeometryExtended2023MuonReco_cff')
80  # Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
81  #from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2023Muon
82  #call to customisation function cust_2023Muon imported from SLHCUpgradeSimulations.Configuration.combinedCustoms
83  #process = cust_2023Muon(process)
84 
85  elif score == "GEMDev":
86  from Configuration.AlCa.autoCond import autoCond
87  process.GlobalTag.globaltag = autoCond['mc']
88  process.load('Configuration.Geometry.GeometryExtended2015MuonGEMDevReco_cff')
89 
90  elif score == "SLHCDB": # orig dumpFWRecoSLHCGeometry_cfg.py
91  process.GlobalTag.globaltag = 'DESIGN42_V17::All'
92  process.load("Configuration.StandardSequences.GeometryDB_cff")
93  process.load("Configuration.StandardSequences.Reconstruction_cff")
94 
95  process.GlobalTag.toGet = cms.VPSet(
96  cms.PSet(record = cms.string("GeometryFileRcd"),
97  tag = cms.string("XMLFILE_Geometry_428SLHCYV0_Phase1_R30F12_HCal_Ideal_mc"),
98  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")
99  ),
100  cms.PSet(record = cms.string('IdealGeometryRecord'),
101  tag = cms.string('TKRECO_Geometry_428SLHCYV0'),
102  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")),
103  cms.PSet(record = cms.string('PGeometricDetExtraRcd'),
104  tag = cms.string('TKExtra_Geometry_428SLHCYV0'),
105  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_42X_GEOMETRY")),
106  )
107 
108  elif score == varType.valueForKey("SLHC"): # orig dumpFWRecoGeometrySLHC_cfg.py
109  from Configuration.AlCa.autoCond import autoCond
110  process.GlobalTag.globaltag = autoCond['mc']
111  process.load("Configuration.Geometry.GeometrySLHCSimIdeal_cff")
112  process.load("Configuration.Geometry.GeometrySLHCReco_cff")
113  process.load("Configuration.StandardSequences.Reconstruction_cff")
114  process.trackerSLHCGeometry.applyAlignment = False
115 
116  else:
117  help()
118 
119 
120 
121 
123 
124 
125 defaultOutputFileName="cmsRecoGeom.root"
126 
127 options.register ('tag',
128  "2015", # default value
129  VarParsing.VarParsing.multiplicity.singleton,
130  VarParsing.VarParsing.varType.string,
131  "tag info about geometry database conditions")
132 
133 
134 options.register ('tgeo',
135  False, # default value
136  VarParsing.VarParsing.multiplicity.singleton,
137  VarParsing.VarParsing.varType.bool,
138  "write geometry in TGeo format")
139 
140 
141 options.register ('out',
142  defaultOutputFileName, # default value
143  VarParsing.VarParsing.multiplicity.singleton,
144  VarParsing.VarParsing.varType.string,
145  "Output file name")
146 
147 options.parseArguments()
148 
149 
150 
151 
152 process = cms.Process("DUMP")
153 process.add_(cms.Service("InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(False)))
154 process.source = cms.Source("EmptySource")
155 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
156 
157 
158 recoGeoLoad(options.tag)
159 
160 if ( options.tgeo == True):
161  if (options.out == defaultOutputFileName ):
162  options.out = "cmsTGeoRecoGeom-" + str(options.tag) + ".root"
163  process.add_(cms.ESProducer("FWTGeoRecoGeometryESProducer"))
164  process.dump = cms.EDAnalyzer("DumpFWTGeoRecoGeometry",
165  tagInfo = cms.untracked.string(options.tag),
166  outputFileName = cms.untracked.string(options.out)
167  )
168 else:
169  if (options.out == defaultOutputFileName ):
170  options.out = "cmsRecoGeom-" + str(options.tag) + ".root"
171  process.add_(cms.ESProducer("FWRecoGeometryESProducer"))
172  process.dump = cms.EDAnalyzer("DumpFWRecoGeometry",
173  level = cms.untracked.int32(1),
174  tagInfo = cms.untracked.string(options.tag),
175  outputFileName = cms.untracked.string(options.out)
176  )
177 
178 print "Dumping geometry in " , options.out, "\n";
179 process.p = cms.Path(process.dump)