Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:39:41

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 
0005 
0006 ################################################################################
0007 # command line options
0008 options = VarParsing.VarParsing()
0009 options.register('input',
0010                  default = "ideal",
0011                  mytype = VarParsing.VarParsing.varType.string,
0012                  info = "input format")
0013 options.register('inputFile',
0014                  default = None,
0015                  mytype = VarParsing.VarParsing.varType.string,
0016                  info = "input file name")
0017 options.register('output',
0018                  default = "none",
0019                  mytype = VarParsing.VarParsing.varType.string,
0020                  info = "output format")
0021 options.register('outputFile',
0022                  default = None,
0023                  mytype = VarParsing.VarParsing.varType.string,
0024                  info = "output file name")
0025 options.parseArguments()
0026 
0027 ################################################################################
0028 # setting up the process
0029 process = cms.Process("CONVERT")
0030 process.load("Configuration.StandardSequences.MagneticField_cff")
0031 process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi")
0032 process.load('Configuration.Geometry.GeometryExtended2021_cff')
0033 process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
0034 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0035 process.load("Alignment.MuonAlignment.muonGeometryDBConverter_cfi")
0036 
0037 ################################################################################
0038 # parameters to configure:
0039 from Configuration.AlCa.GlobalTag import GlobalTag
0040 process.GlobalTag = GlobalTag(process.GlobalTag, "auto:phase1_2022_design")
0041 process.muonGeometryDBConverter.input = options.input
0042 process.muonGeometryDBConverter.output = options.output
0043 
0044 
0045 import Geometry.DTGeometryBuilder.dtGeometryDB_cfi
0046 import Geometry.CSCGeometryBuilder.cscGeometryDB_cfi
0047 import Geometry.GEMGeometryBuilder.gemGeometryDB_cfi
0048 process.DTGeometryIdeal = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone()
0049 process.DTGeometryIdeal.appendToDataLabel = 'idealGeometry'
0050 process.DTGeometryIdeal.applyAlignment = cms.bool(False)
0051 process.CSCGeometryIdeal = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone()
0052 process.CSCGeometryIdeal.appendToDataLabel = 'idealGeometry'
0053 process.CSCGeometryIdeal.applyAlignment = cms.bool(False)
0054 process.GEMGeometryIdeal = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone()
0055 process.GEMGeometryIdeal.appendToDataLabel = 'idealGeometry'
0056 process.GEMGeometryIdeal.applyAlignment = cms.bool(False)
0057 
0058 process.DTGeometryIdealForInputXML = Geometry.DTGeometryBuilder.dtGeometryDB_cfi.DTGeometryESModule.clone()
0059 process.DTGeometryIdealForInputXML.appendToDataLabel = 'idealForInputXML'
0060 process.DTGeometryIdealForInputXML.applyAlignment = cms.bool(False)
0061 process.CSCGeometryIdealForInputXML = Geometry.CSCGeometryBuilder.cscGeometryDB_cfi.CSCGeometryESModule.clone()
0062 process.CSCGeometryIdealForInputXML.appendToDataLabel = 'idealForInputXML'
0063 process.CSCGeometryIdealForInputXML.applyAlignment = cms.bool(False)
0064 process.GEMGeometryIdealForInputXML = Geometry.GEMGeometryBuilder.gemGeometryDB_cfi.GEMGeometryESModule.clone()
0065 process.GEMGeometryIdealForInputXML.appendToDataLabel = 'idealForInputXML'
0066 process.GEMGeometryIdealForInputXML.applyAlignment = cms.bool(False)
0067 
0068 
0069 if options.input == "db":
0070     process.GlobalTag.toGet.extend(
0071         [cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0072                   record = cms.string("DTAlignmentRcd"),
0073                   tag = cms.string("DTAlignmentRcd")),
0074          cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0075                   record = cms.string("DTAlignmentErrorExtendedRcd"),
0076                   tag = cms.string("DTAlignmentErrorExtendedRcd")),
0077          cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0078                   record = cms.string("CSCAlignmentRcd"),
0079                   tag = cms.string("CSCAlignmentRcd")),
0080          cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0081                   record = cms.string("CSCAlignmentErrorExtendedRcd"),
0082                   tag = cms.string("CSCAlignmentErrorExtendedRcd")),
0083          cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0084                   record = cms.string("GEMAlignmentRcd"),
0085                   tag = cms.string("GEMAlignmentRcd")),
0086          cms.PSet(connect = cms.string("sqlite_file:"+options.inputFile),
0087                   record = cms.string("GEMAlignmentErrorExtendedRcd"),
0088                   tag = cms.string("GEMAlignmentErrorExtendedRcd"))
0089         ])
0090 elif options.input == "xml":
0091     process.muonGeometryDBConverter.fileName = options.inputFile
0092 
0093 if options.output == "db":
0094     from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
0095     process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0096         CondDBSetup,
0097         toPut = cms.VPSet(cms.PSet(
0098             record = cms.string('DTAlignmentRcd'),
0099             tag = cms.string('DTAlignmentRcd')
0100         ),
0101             cms.PSet(
0102                 record = cms.string('DTAlignmentErrorExtendedRcd'),
0103                 tag = cms.string('DTAlignmentErrorExtendedRcd')
0104             ),
0105             cms.PSet(
0106                 record = cms.string('CSCAlignmentRcd'),
0107                 tag = cms.string('CSCAlignmentRcd')
0108             ),
0109             cms.PSet(
0110                 record = cms.string('CSCAlignmentErrorExtendedRcd'),
0111                 tag = cms.string('CSCAlignmentErrorExtendedRcd')
0112             ),
0113             cms.PSet(
0114                 record = cms.string('GEMAlignmentRcd'),
0115                 tag = cms.string('GEMAlignmentRcd')
0116             ),
0117             cms.PSet(
0118                 record = cms.string('GEMAlignmentErrorExtendedRcd'),
0119                 tag = cms.string('GEMAlignmentErrorExtendedRcd')
0120             )),
0121     
0122         connect = cms.string('sqlite_file:'+options.outputFile)
0123     )
0124 elif options.output == "xml":
0125     process.muonGeometryDBConverter.outputXML.fileName = options.outputFile
0126     process.muonGeometryDBConverter.outputXML.suppressDTSuperLayers = True
0127     process.muonGeometryDBConverter.outputXML.suppressDTLayers = True
0128     process.muonGeometryDBConverter.outputXML.suppressCSCLayers = True
0129 
0130 
0131 ################################################################################
0132 
0133 usedGlobalTag = process.GlobalTag.globaltag.value()
0134 print("Using Global Tag:", usedGlobalTag)
0135 
0136 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0137 process.source = cms.Source("EmptySource")
0138 process.p = cms.Path(process.muonGeometryDBConverter)