1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
4 import FWCore.ParameterSet.VarParsing
as VarParsing
5 from FWCore.Utilities.Enumerate
import Enumerate
8 varType = Enumerate (
"Run1 2015 2017 2021 2026 MaPSA")
12 print(
"Usage: cmsRun dumpFWRecoGeometry_cfg.py tag=TAG ")
14 print(
" identify geometry condition database tag")
15 print(
" ", varType.keys())
17 print(
" version=versionNumber")
18 print(
" scenario version from 2026 dictionary")
21 print(
" dump in TGeo format to browse in geometry viewer")
22 print(
" import this in Fireworks with option --sim-geom-file")
24 print(
" tracker=bool")
25 print(
" include Tracker subdetectors")
28 print(
" include Muon subdetectors")
31 print(
" include Calo subdetectors")
34 print(
" include Timing subdetectors")
41 print(
"Please, specify 2026 scenario version\n")
42 print(sorted([x[1]
for x
in detectorVersionDict.items()]))
47 print(
"Loading configuration for tag ", options.tag ,
"...\n")
50 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
51 from Configuration.AlCa.autoCond
import autoCond
52 process.GlobalTag.globaltag = autoCond[
'run1_mc']
53 process.load(
"Configuration.StandardSequences.GeometryDB_cff")
56 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
57 from Configuration.AlCa.autoCond
import autoCond
58 process.GlobalTag.globaltag = autoCond[
'run2_mc']
59 process.load(
"Configuration.StandardSequences.GeometryDB_cff")
62 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
63 from Configuration.AlCa.autoCond
import autoCond
64 process.GlobalTag.globaltag = autoCond[
'upgrade2017']
65 process.load(
'Configuration.Geometry.GeometryExtended2017Reco_cff')
68 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
69 from Configuration.AlCa.autoCond
import autoCond
70 process.GlobalTag.globaltag = autoCond[
'upgrade2021']
72 process.load(
'Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
73 process.load(
'Configuration.Geometry.GeometryExtended2021Reco_cff')
75 process.DTGeometryESModule.applyAlignment = cms.bool(
False)
76 process.CSCGeometryESModule.applyAlignment = cms.bool(
False)
80 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
83 from Configuration.AlCa.autoCond
import autoCond
86 version_key =
'2026' + options.version
87 print(f
"Constructed version key: {version_key}")
90 if version_key
in properties[2026]:
92 global_tag_key = properties[2026][version_key][
'GT']
93 print(f
"Global tag key from properties: {global_tag_key}")
96 if global_tag_key.replace(
"auto:",
"")
in autoCond:
98 from Configuration.AlCa.GlobalTag
import GlobalTag
99 process.GlobalTag =
GlobalTag(process.GlobalTag, global_tag_key,
'')
101 raise KeyError(f
"Global tag key '{global_tag_key}' not found in autoCond.")
103 raise KeyError(f
"Version key '{version_key}' not found in properties[2026].")
104 process.load(
'Configuration.Geometry.GeometryExtended2026'+options.version+
'Reco_cff')
105 process.trackerGeometry.applyAlignment = cms.bool(
False)
107 elif score ==
"MaPSA":
108 process.load(
'Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff')
109 process.load(
'Geometry.TrackerCommonData.mapsaGeometryXML_cfi')
110 process.load(
'Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi')
111 process.load(
'Geometry.TrackerNumberingBuilder.trackerTopology_cfi')
112 process.load(
'Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
113 process.load(
'Geometry.TrackerGeometryBuilder.trackerGeometry_cfi')
114 process.trackerGeometry.applyAlignment = cms.bool(
False)
115 process.load(
'RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi')
117 process.load(
'Geometry.CommonTopologies.bareGlobalTrackingGeometry_cfi')
119 elif score ==
"HGCTB160":
120 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
121 from Configuration.AlCa.autoCond
import autoCond
122 process.GlobalTag.globaltag = autoCond[
'mc']
123 process.load(
'Geometry.HGCalTBCommonData.hgcalTBParametersInitialization_cfi')
124 process.load(
'Geometry.HGCalTBCommonData.hgcalTBNumberingInitialization_cfi')
125 process.load(
'Geometry.CaloEventSetup.HGCalTBTopology_cfi')
126 process.load(
'Geometry.HGCalGeometry.HGCalTBGeometryESProducer_cfi')
127 process.load(
'Geometry.CaloEventSetup.CaloTopology_cfi')
128 process.load(
'Geometry.CaloEventSetup.CaloGeometryBuilder_cfi')
129 process.CaloGeometryBuilder = cms.ESProducer(
130 "CaloGeometryBuilder",
131 SelectedCalos = cms.vstring(
"HGCalEESensitive")
133 process.load(
"SimG4CMS.HGCalTestBeam.HGCalTB160XML_cfi")
141 defaultOutputFileName=
"cmsRecoGeom.root" 143 options.register (
'tag',
145 VarParsing.VarParsing.multiplicity.singleton,
146 VarParsing.VarParsing.varType.string,
147 "tag info about geometry database conditions")
149 options.register (
'version',
151 VarParsing.VarParsing.multiplicity.singleton,
152 VarParsing.VarParsing.varType.string,
153 "info about 2026 geometry scenario version")
155 options.register (
'tgeo',
157 VarParsing.VarParsing.multiplicity.singleton,
158 VarParsing.VarParsing.varType.bool,
159 "write geometry in TGeo format")
161 options.register (
'tracker',
163 VarParsing.VarParsing.multiplicity.singleton,
164 VarParsing.VarParsing.varType.bool,
165 "write Tracker geometry")
167 options.register (
'muon',
169 VarParsing.VarParsing.multiplicity.singleton,
170 VarParsing.VarParsing.varType.bool,
171 "write Muon geometry")
173 options.register (
'calo',
175 VarParsing.VarParsing.multiplicity.singleton,
176 VarParsing.VarParsing.varType.bool,
177 "write Calo geometry")
179 options.register (
'timing',
181 VarParsing.VarParsing.multiplicity.singleton,
182 VarParsing.VarParsing.varType.bool,
183 "write Timing geometry")
185 options.register (
'out',
186 defaultOutputFileName,
187 VarParsing.VarParsing.multiplicity.singleton,
188 VarParsing.VarParsing.varType.string,
191 options.parseArguments()
195 if options.tag ==
"2026" or options.tag ==
"MaPSA":
197 version_key = options.tag + options.version
198 elif options.tag ==
"2017" or options.tag ==
"2021":
200 version_key = options.tag
205 if(prop_key
and version_key):
206 print(f
"Constructed version key: {version_key}")
207 era_key = properties[prop_key][
str(version_key)][
'Era']
208 print(f
"Constructed era key: {era_key}")
209 from Configuration.StandardSequences.Eras
import eras
210 era = getattr(eras, era_key)
211 process = cms.Process(
"DUMP",era)
213 process = cms.Process(
"DUMP")
214 process.add_(cms.Service(
"InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(
False)))
215 process.source = cms.Source(
"EmptySource")
216 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
221 if ( options.tgeo ==
True):
222 if (options.out == defaultOutputFileName ):
223 options.out =
"cmsTGeoRecoGeom-" +
str(options.tag) +
".root" 224 process.add_(cms.ESProducer(
"FWTGeoRecoGeometryESProducer",
225 Tracker = cms.untracked.bool(options.tracker),
226 Muon = cms.untracked.bool(options.muon),
227 Calo = cms.untracked.bool(options.calo),
228 Timing = cms.untracked.bool(options.timing)))
229 process.dump = cms.EDAnalyzer(
"DumpFWTGeoRecoGeometry",
230 tagInfo = cms.untracked.string(options.tag),
231 outputFileName = cms.untracked.string(options.out)
234 if (options.out == defaultOutputFileName ):
235 options.out =
"cmsRecoGeom-" +
str(options.tag) +
".root" 236 process.add_(cms.ESProducer(
"FWRecoGeometryESProducer",
237 Tracker = cms.untracked.bool(options.tracker),
238 Muon = cms.untracked.bool(options.muon),
239 Calo = cms.untracked.bool(options.calo),
240 Timing = cms.untracked.bool(options.timing)))
241 process.dump = cms.EDAnalyzer(
"DumpFWRecoGeometry",
242 level = cms.untracked.int32(1),
243 tagInfo = cms.untracked.string(options.tag),
244 outputFileName = cms.untracked.string(options.out)
247 print(
"Dumping geometry in " , options.out,
"\n");
248 process.p = cms.Path(process.dump)
def recoGeoLoad(score, properties)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
DQM-only workflow on AOD input: for HLT.
if(threadIdxLocalY==0 &&threadIdxLocalX==0)