Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:26

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import sys, os
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 from FWCore.Utilities.Enumerate import Enumerate
0006 from Configuration.Geometry.dict2026Geometry import detectorVersionDict
0007 
0008 varType = Enumerate ("Run1 2015 2017 2021 2026 MaPSA")
0009 defaultVersion=str();
0010 
0011 def help():
0012    print("Usage: cmsRun dumpFWRecoGeometry_cfg.py  tag=TAG ")
0013    print("   tag=tagname")
0014    print("       identify geometry condition database tag")
0015    print("      ", varType.keys())
0016    print("")
0017    print("   version=versionNumber")
0018    print("       scenario version from 2026 dictionary")
0019    print("")
0020    print("   tgeo=bool")
0021    print("       dump in TGeo format to browse in geometry viewer")
0022    print("       import this in Fireworks with option --sim-geom-file")
0023    print("")
0024    print("   tracker=bool")
0025    print("       include Tracker subdetectors")
0026    print("")
0027    print("   muon=bool")
0028    print("       include Muon subdetectors")
0029    print("")
0030    print("   calo=bool")
0031    print("       include Calo subdetectors")
0032    print("")
0033    print("   timing=bool")
0034    print("       include Timing subdetectors")
0035    print("")
0036    print("")
0037    os._exit(1);
0038 
0039 def versionCheck(ver):
0040    if ver == "":
0041       print("Please, specify 2026 scenario version\n")
0042       print(sorted([x[1] for x in detectorVersionDict.items()]))
0043       print("")
0044       help()
0045 
0046 def recoGeoLoad(score):
0047     print("Loading configuration for tag ", options.tag ,"...\n")
0048 
0049     if score == "Run1":
0050        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0051        from Configuration.AlCa.autoCond import autoCond
0052        process.GlobalTag.globaltag = autoCond['run1_mc']
0053        process.load("Configuration.StandardSequences.GeometryDB_cff")
0054        
0055     elif score == "2015":
0056        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0057        from Configuration.AlCa.autoCond import autoCond
0058        process.GlobalTag.globaltag = autoCond['run2_mc']
0059        process.load("Configuration.StandardSequences.GeometryDB_cff")
0060        
0061     elif score == "2017":
0062        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0063        from Configuration.AlCa.autoCond import autoCond
0064        process.GlobalTag.globaltag = autoCond['upgrade2017']
0065        process.load('Configuration.Geometry.GeometryExtended2017Reco_cff')
0066        
0067     elif  score == "2021":
0068        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0069        from Configuration.AlCa.autoCond import autoCond
0070        process.GlobalTag.globaltag = autoCond['upgrade2021']
0071        ## NOTE: There is no PTrackerParameters Rcd in this GT yet
0072        process.load('Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
0073        process.load('Configuration.Geometry.GeometryExtended2021Reco_cff')
0074        ## NOTE: There are no Muon alignement records in the GT yet
0075        process.DTGeometryESModule.applyAlignment = cms.bool(False)
0076        process.CSCGeometryESModule.applyAlignment = cms.bool(False)
0077        
0078     elif "2026" in score:
0079        versionCheck(options.version)
0080        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0081        from Configuration.AlCa.autoCond import autoCond
0082        process.GlobalTag.globaltag = autoCond['run2_mc']
0083        process.load('Configuration.Geometry.GeometryExtended2026'+options.version+'Reco_cff')
0084        
0085     elif score == "MaPSA":
0086        process.load('Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff')
0087        process.load('Geometry.TrackerCommonData.mapsaGeometryXML_cfi')
0088        process.load('Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi')
0089        process.load('Geometry.TrackerNumberingBuilder.trackerTopology_cfi')
0090        process.load('Geometry.TrackerGeometryBuilder.trackerParameters_cfi')
0091        process.load('Geometry.TrackerGeometryBuilder.trackerGeometry_cfi')
0092        process.trackerGeometry.applyAlignment = cms.bool(False)
0093        process.load('RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi')
0094 
0095        process.load('Geometry.CommonTopologies.bareGlobalTrackingGeometry_cfi')
0096        
0097     elif score == "HGCTB160": ## hgcal testbeam
0098        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") 
0099        from Configuration.AlCa.autoCond import autoCond
0100        process.GlobalTag.globaltag = autoCond['mc']
0101        process.load('Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi')
0102        process.load('Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi')
0103        process.load('Geometry.CaloEventSetup.HGCalV6Topology_cfi')
0104        process.load('Geometry.HGCalGeometry.HGCalV6GeometryESProducer_cfi')
0105        process.load('Geometry.CaloEventSetup.CaloTopology_cfi')
0106        process.load('Geometry.CaloEventSetup.CaloGeometryBuilder_cfi')
0107        process.CaloGeometryBuilder = cms.ESProducer(
0108           "CaloGeometryBuilder",
0109           SelectedCalos = cms.vstring("HGCalEESensitive")
0110        )
0111        process.load("SimG4CMS.HGCalTestBeam.HGCalTB160XML_cfi")
0112        
0113     else:
0114       help()
0115 
0116 
0117 
0118 
0119 options = VarParsing.VarParsing ()
0120 
0121 
0122 defaultOutputFileName="cmsRecoGeom.root"
0123 
0124 options.register ('tag',
0125                   "2017", # default value
0126                   VarParsing.VarParsing.multiplicity.singleton,
0127                   VarParsing.VarParsing.varType.string,
0128                   "tag info about geometry database conditions")
0129 
0130 options.register ('version',
0131                   defaultVersion, # default value
0132                   VarParsing.VarParsing.multiplicity.singleton,
0133                   VarParsing.VarParsing.varType.string,
0134                   "info about 2026 geometry scenario version")
0135 
0136 options.register ('tgeo',
0137                   False, # default value
0138                   VarParsing.VarParsing.multiplicity.singleton,
0139                   VarParsing.VarParsing.varType.bool,
0140                   "write geometry in TGeo format")
0141 
0142 options.register ('tracker',
0143                   True, # default value
0144                   VarParsing.VarParsing.multiplicity.singleton,
0145                   VarParsing.VarParsing.varType.bool,
0146                   "write Tracker geometry")
0147 
0148 options.register ('muon',
0149                   True, # default value
0150                   VarParsing.VarParsing.multiplicity.singleton,
0151                   VarParsing.VarParsing.varType.bool,
0152                   "write Muon geometry")
0153 
0154 options.register ('calo',
0155                   True, # default value
0156                   VarParsing.VarParsing.multiplicity.singleton,
0157                   VarParsing.VarParsing.varType.bool,
0158                   "write Calo geometry")
0159 
0160 options.register ('timing',
0161                   False, # default value
0162                   VarParsing.VarParsing.multiplicity.singleton,
0163                   VarParsing.VarParsing.varType.bool,
0164                   "write Timing geometry")
0165 
0166 options.register ('out',
0167                   defaultOutputFileName, # default value
0168                   VarParsing.VarParsing.multiplicity.singleton,
0169                   VarParsing.VarParsing.varType.string,
0170                   "Output file name")
0171 
0172 options.parseArguments()
0173 
0174 
0175 
0176 
0177 process = cms.Process("DUMP")
0178 process.add_(cms.Service("InitRootHandlers", ResetRootErrHandler = cms.untracked.bool(False)))
0179 process.source = cms.Source("EmptySource")
0180 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0181 
0182 
0183 recoGeoLoad(options.tag)
0184 
0185 if ( options.tgeo == True):
0186     if (options.out == defaultOutputFileName ):
0187         options.out = "cmsTGeoRecoGeom-" +  str(options.tag) + ".root"
0188     process.add_(cms.ESProducer("FWTGeoRecoGeometryESProducer",
0189                  Tracker = cms.untracked.bool(options.tracker),
0190                  Muon = cms.untracked.bool(options.muon),
0191                  Calo = cms.untracked.bool(options.calo),
0192                  Timing = cms.untracked.bool(options.timing)))
0193     process.dump = cms.EDAnalyzer("DumpFWTGeoRecoGeometry",
0194                               tagInfo = cms.untracked.string(options.tag),
0195                        outputFileName = cms.untracked.string(options.out)
0196                               )
0197 else:
0198     if (options.out == defaultOutputFileName ):
0199         options.out = "cmsRecoGeom-" +  str(options.tag) + ".root"
0200     process.add_(cms.ESProducer("FWRecoGeometryESProducer",
0201                  Tracker = cms.untracked.bool(options.tracker),
0202                  Muon = cms.untracked.bool(options.muon),
0203                  Calo = cms.untracked.bool(options.calo),
0204                  Timing = cms.untracked.bool(options.timing)))
0205     process.dump = cms.EDAnalyzer("DumpFWRecoGeometry",
0206                               level   = cms.untracked.int32(1),
0207                               tagInfo = cms.untracked.string(options.tag),
0208                        outputFileName = cms.untracked.string(options.out)
0209                               )
0210 
0211 print("Dumping geometry in " , options.out, "\n"); 
0212 process.p = cms.Path(process.dump)
0213 
0214