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 2019 2023 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 2023 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 2023 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")
52 process.GlobalTag.globaltag = autoCond[
'run1_mc']
53 process.load(
"Configuration.StandardSequences.GeometryDB_cff")
56 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
58 process.GlobalTag.globaltag = autoCond[
'run2_mc']
59 process.load(
"Configuration.StandardSequences.GeometryDB_cff")
62 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
64 process.GlobalTag.globaltag = autoCond[
'upgrade2017']
65 process.load(
'Configuration.Geometry.GeometryExtended2017Reco_cff')
68 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
70 process.GlobalTag.globaltag = autoCond[
'upgrade2019']
72 process.load(
'Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
73 process.load(
'Configuration.Geometry.GeometryExtended2019Reco_cff')
75 process.DTGeometryESModule.applyAlignment = cms.bool(
False)
76 process.CSCGeometryESModule.applyAlignment = cms.bool(
False)
80 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
82 process.GlobalTag.globaltag = autoCond[
'run2_mc']
83 process.load(
'Configuration.Geometry.GeometryExtended2023'+options.version+
'Reco_cff')
85 elif score ==
"MaPSA":
86 process.load(
'Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff')
87 process.load(
'Geometry.TrackerCommonData.mapsaGeometryXML_cfi')
88 process.load(
'Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi')
89 process.load(
'Geometry.TrackerNumberingBuilder.trackerTopology_cfi')
90 process.load(
'Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
91 process.load(
'Geometry.TrackerGeometryBuilder.trackerGeometry_cfi')
92 process.trackerGeometry.applyAlignment = cms.bool(
False)
93 process.load(
'RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi')
95 process.load(
'Geometry.CommonDetUnit.bareGlobalTrackingGeometry_cfi')
97 elif score ==
"HGCTB160":
98 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
100 process.GlobalTag.globaltag = autoCond[
'mc']
101 process.load(
'Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi')
102 process.load(
'Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi')
103 process.load(
'Geometry.CaloEventSetup.HGCalV6Topology_cfi')
104 process.load(
'Geometry.HGCalGeometry.HGCalV6GeometryESProducer_cfi')
105 process.load(
'Geometry.CaloEventSetup.CaloTopology_cfi')
106 process.load(
'Geometry.CaloEventSetup.CaloGeometryBuilder_cfi')
107 process.CaloGeometryBuilder = cms.ESProducer(
108 "CaloGeometryBuilder",
109 SelectedCalos = cms.vstring(
"HGCalEESensitive")
111 process.load(
"SimG4CMS.HGCalTestBeam.HGCalTB160XML_cfi")
122 defaultOutputFileName=
"cmsRecoGeom.root" 124 options.register (
'tag',
126 VarParsing.VarParsing.multiplicity.singleton,
127 VarParsing.VarParsing.varType.string,
128 "tag info about geometry database conditions")
130 options.register (
'version',
132 VarParsing.VarParsing.multiplicity.singleton,
133 VarParsing.VarParsing.varType.string,
134 "info about 2023 geometry scenario version")
136 options.register (
'tgeo',
138 VarParsing.VarParsing.multiplicity.singleton,
139 VarParsing.VarParsing.varType.bool,
140 "write geometry in TGeo format")
142 options.register (
'tracker',
144 VarParsing.VarParsing.multiplicity.singleton,
145 VarParsing.VarParsing.varType.bool,
146 "write Tracker geometry")
148 options.register (
'muon',
150 VarParsing.VarParsing.multiplicity.singleton,
151 VarParsing.VarParsing.varType.bool,
152 "write Muon geometry")
154 options.register (
'calo',
156 VarParsing.VarParsing.multiplicity.singleton,
157 VarParsing.VarParsing.varType.bool,
158 "write Calo geometry")
160 options.register (
'timing',
162 VarParsing.VarParsing.multiplicity.singleton,
163 VarParsing.VarParsing.varType.bool,
164 "write Timing geometry")
166 options.register (
'out',
167 defaultOutputFileName,
168 VarParsing.VarParsing.multiplicity.singleton,
169 VarParsing.VarParsing.varType.string,
172 options.parseArguments()
177 process = cms.Process(
"DUMP")
178 process.add_(cms.Service(
"InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(
False)))
179 process.source = cms.Source(
"EmptySource")
180 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
185 if ( options.tgeo ==
True):
186 if (options.out == defaultOutputFileName ):
187 options.out =
"cmsTGeoRecoGeom-" +
str(options.tag) +
".root" 188 process.add_(cms.ESProducer(
"FWTGeoRecoGeometryESProducer",
189 Tracker = cms.untracked.bool(options.tracker),
190 Muon = cms.untracked.bool(options.muon),
191 Calo = cms.untracked.bool(options.calo),
192 Timing = cms.untracked.bool(options.timing)))
193 process.dump = cms.EDAnalyzer(
"DumpFWTGeoRecoGeometry",
194 tagInfo = cms.untracked.string(options.tag),
195 outputFileName = cms.untracked.string(options.out)
198 if (options.out == defaultOutputFileName ):
199 options.out =
"cmsRecoGeom-" +
str(options.tag) +
".root" 200 process.add_(cms.ESProducer(
"FWRecoGeometryESProducer",
201 Tracker = cms.untracked.bool(options.tracker),
202 Muon = cms.untracked.bool(options.muon),
203 Calo = cms.untracked.bool(options.calo),
204 Timing = cms.untracked.bool(options.timing)))
205 process.dump = cms.EDAnalyzer(
"DumpFWRecoGeometry",
206 level = cms.untracked.int32(1),
207 tagInfo = cms.untracked.string(options.tag),
208 outputFileName = cms.untracked.string(options.out)
211 print(
"Dumping geometry in " , options.out,
"\n");
212 process.p = cms.Path(process.dump)
S & print(S &os, JobReport::InputFile const &f)