File indexing completed on 2024-12-01 23:40:23
0001
0002
0003 from FWCore.ParameterSet.pfnInPath import pfnInPath
0004 import FWCore.ParameterSet.Config as cms
0005 import sys
0006 import os
0007 import re
0008
0009 if os.getenv('LOCAL_TOP_DIR') == None:
0010 print("The environment variable LOCAL_TOP_DIR must be set to run this script")
0011 print("Usually setting it equal to the value of CMSSW_BASE will do what you want")
0012 print("In the context of a unit test this variable is always set automatically")
0013 sys.exit(1)
0014
0015
0016 process = cms.Process("TEST")
0017 cfiFile = 'Geometry/CMSCommonData/cmsIdealGeometryXML_cfi'
0018 if len(sys.argv) > 1:
0019 cfiFile = sys.argv[1]
0020 process.load(cfiFile)
0021 xmlFiles = process.es_sources['XMLIdealGeometryESSource'].geomXMLFiles.value()
0022
0023 def callDOMCount(schemaPath, xmlPath):
0024 xmlFilename = os.path.basename(xmlPath)
0025 xmlFile = open(xmlPath, 'r')
0026 tmpXMLFile = open(xmlFilename, 'w')
0027
0028
0029
0030
0031
0032
0033
0034 for line in xmlFile.readlines():
0035 line = line.replace("../../../../../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0036 line = line.replace("../../../../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0037 line = line.replace("../../../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0038 line = line.replace("../../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0039 line = line.replace("../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0040 tmpXMLFile.write(line)
0041 tmpXMLFile.close()
0042 xmlFile.close()
0043
0044
0045 command = 'DOMCount -v=always -n -s -f %s' % (xmlFilename)
0046 os.system ( command )
0047
0048
0049 os.system ("rm %s" % (xmlFilename))
0050
0051
0052 schema = pfnInPath("DetectorDescription/Schema/DDLSchema.xsd").replace('file:','')
0053 print("schema file is:")
0054 print(schema)
0055 sys.stdout.flush()
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083