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 2023D7 2023D10 2023D4 2023D8 MaPSA")
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 " tracker=bool"
19  print " include Tracker subdetectors"
20  print ""
21  print " muon=bool"
22  print " include Muon subdetectors"
23  print ""
24  print " calo=bool"
25  print " include Calo subdetectors"
26  print ""
27  print " timing=bool"
28  print " include Timing subdetectors"
29  print ""
30  print ""
31  exit(1);
32 
33 def recoGeoLoad(score):
34  print "Loading configuration for tag ", options.tag ,"...\n"
35 
36  if score == "Run1":
37  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
38  from Configuration.AlCa.autoCond import autoCond
39  process.GlobalTag.globaltag = autoCond['run1_mc']
40  process.load("Configuration.StandardSequences.GeometryDB_cff")
41 
42  elif score == "2015":
43  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
44  from Configuration.AlCa.autoCond import autoCond
45  process.GlobalTag.globaltag = autoCond['run2_mc']
46  process.load("Configuration.StandardSequences.GeometryDB_cff")
47 
48  elif score == "2017":
49  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
50  from Configuration.AlCa.autoCond import autoCond
51  process.GlobalTag.globaltag = autoCond['upgrade2017']
52  process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
53 
54  elif score == "2019":
55  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
56  from Configuration.AlCa.autoCond import autoCond
57  process.GlobalTag.globaltag = autoCond['upgrade2019']
58  ## NOTE: There is no PTrackerParameters Rcd in this GT yet
59  process.load('Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
60  process.load('Configuration.Geometry.GeometryExtended2019Reco_cff')
61  ## NOTE: There are no Muon alignement records in the GT yet
62  process.DTGeometryESModule.applyAlignment = cms.bool(False)
63  process.CSCGeometryESModule.applyAlignment = cms.bool(False)
64 
65  elif score == "2023D7":
66  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
67  from Configuration.AlCa.autoCond import autoCond
68  process.GlobalTag.globaltag = autoCond['run2_mc']
69  process.load('Configuration.Geometry.GeometryExtended2023D7Reco_cff')
70 
71  elif score == "2023D10":
72  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
73  from Configuration.AlCa.autoCond import autoCond
74  process.GlobalTag.globaltag = autoCond['phase2_realistic']
75  process.load('Configuration.Geometry.GeometryExtended2023D10Reco_cff')
76 
77  elif score == "2023D4":
78  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
79  from Configuration.AlCa.autoCond import autoCond
80  process.GlobalTag.globaltag = autoCond['phase2_realistic']
81  process.load('Configuration.Geometry.GeometryExtended2023D4Reco_cff')
82 
83  elif score == "2023D8":
84  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
85  from Configuration.AlCa.autoCond import autoCond
86  process.GlobalTag.globaltag = autoCond['phase2_realistic']
87  process.load('Configuration.Geometry.GeometryExtended2023D8Reco_cff')
88 
89  elif score == "MaPSA":
90  process.load('Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff')
91  process.load('Geometry.TrackerCommonData.mapsaGeometryXML_cfi')
92  process.load('Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi')
93  process.load('Geometry.TrackerNumberingBuilder.trackerTopology_cfi')
94  process.load('Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
95  process.load('Geometry.TrackerGeometryBuilder.trackerGeometry_cfi')
96  process.trackerGeometry.applyAlignment = cms.bool(False)
97  process.load('RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi')
98 
99  process.load('Geometry.CommonDetUnit.bareGlobalTrackingGeometry_cfi')
100 
101  elif score == "HGCTB160": ## hgcal testbeam
102  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
103  from Configuration.AlCa.autoCond import autoCond
104  process.GlobalTag.globaltag = autoCond['mc']
105  process.load('Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi')
106  process.load('Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi')
107  process.load('Geometry.CaloEventSetup.HGCalV6Topology_cfi')
108  process.load('Geometry.HGCalGeometry.HGCalV6GeometryESProducer_cfi')
109  process.load('Geometry.CaloEventSetup.CaloTopology_cfi')
110  process.load('Geometry.CaloEventSetup.CaloGeometryBuilder_cfi')
111  process.CaloGeometryBuilder = cms.ESProducer(
112  "CaloGeometryBuilder",
113  SelectedCalos = cms.vstring("HGCalEESensitive")
114  )
115  process.load("SimG4CMS.HGCalTestBeam.HGCalTB160XML_cfi")
116 
117  else:
118  help()
119 
120 
121 
122 
124 
125 
126 defaultOutputFileName="cmsRecoGeom.root"
127 
128 options.register ('tag',
129  "2015", # default value
130  VarParsing.VarParsing.multiplicity.singleton,
131  VarParsing.VarParsing.varType.string,
132  "tag info about geometry database conditions")
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 options.register ('tracker',
141  True, # default value
142  VarParsing.VarParsing.multiplicity.singleton,
143  VarParsing.VarParsing.varType.bool,
144  "write Tracker geometry")
145 
146 options.register ('muon',
147  True, # default value
148  VarParsing.VarParsing.multiplicity.singleton,
149  VarParsing.VarParsing.varType.bool,
150  "write Muon geometry")
151 
152 options.register ('calo',
153  True, # default value
154  VarParsing.VarParsing.multiplicity.singleton,
155  VarParsing.VarParsing.varType.bool,
156  "write Calo geometry")
157 
158 options.register ('timing',
159  False, # default value
160  VarParsing.VarParsing.multiplicity.singleton,
161  VarParsing.VarParsing.varType.bool,
162  "write Timing geometry")
163 
164 options.register ('out',
165  defaultOutputFileName, # default value
166  VarParsing.VarParsing.multiplicity.singleton,
167  VarParsing.VarParsing.varType.string,
168  "Output file name")
169 
170 options.parseArguments()
171 
172 
173 
174 
175 process = cms.Process("DUMP")
176 process.add_(cms.Service("InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(False)))
177 process.source = cms.Source("EmptySource")
178 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
179 
180 
181 recoGeoLoad(options.tag)
182 
183 if ( options.tgeo == True):
184  if (options.out == defaultOutputFileName ):
185  options.out = "cmsTGeoRecoGeom-" + str(options.tag) + ".root"
186  process.add_(cms.ESProducer("FWTGeoRecoGeometryESProducer",
187  Tracker = cms.untracked.bool(options.tracker),
188  Muon = cms.untracked.bool(options.muon),
189  Calo = cms.untracked.bool(options.calo),
190  Timing = cms.untracked.bool(options.timing)))
191  process.dump = cms.EDAnalyzer("DumpFWTGeoRecoGeometry",
192  tagInfo = cms.untracked.string(options.tag),
193  outputFileName = cms.untracked.string(options.out)
194  )
195 else:
196  if (options.out == defaultOutputFileName ):
197  options.out = "cmsRecoGeom-" + str(options.tag) + ".root"
198  process.add_(cms.ESProducer("FWRecoGeometryESProducer",
199  Tracker = cms.untracked.bool(options.tracker),
200  Muon = cms.untracked.bool(options.muon),
201  Calo = cms.untracked.bool(options.calo),
202  Timing = cms.untracked.bool(options.timing)))
203  process.dump = cms.EDAnalyzer("DumpFWRecoGeometry",
204  level = cms.untracked.int32(1),
205  tagInfo = cms.untracked.string(options.tag),
206  outputFileName = cms.untracked.string(options.out)
207  )
208 
209 print "Dumping geometry in " , options.out, "\n";
210 process.p = cms.Path(process.dump)
211 
212