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