File indexing completed on 2023-03-17 13:02:36
0001
0002
0003 from __future__ import print_function
0004 from FWCore.ParameterSet.pfnInPath import pfnInPath
0005 import FWCore.ParameterSet.Config as cms
0006 import sys
0007 import os
0008 import re
0009
0010 if os.getenv('LOCAL_TOP_DIR') == None:
0011 print("The environment variable LOCAL_TOP_DIR must be set to run this script")
0012 print("Usually setting it equal to the value of CMSSW_BASE will do what you want")
0013 print("In the context of a unit test this variable is always set automatically")
0014 sys.exit(1)
0015
0016
0017 process = cms.Process("TEST")
0018 cfiFile = 'Geometry/CMSCommonData/cmsIdealGeometryXML_cfi'
0019 if len(sys.argv) > 1:
0020 cfiFile = sys.argv[1]
0021 process.load(cfiFile)
0022 xmlFiles = process.es_sources['XMLIdealGeometryESSource'].geomXMLFiles.value()
0023
0024 def callDOMCount(schemaPath, xmlPath):
0025 xmlFilename = os.path.basename(xmlPath)
0026 xmlFile = open(xmlPath, 'r')
0027 tmpXMLFile = open(xmlFilename, 'w')
0028
0029
0030
0031
0032
0033
0034
0035 for line in xmlFile.readlines():
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 line = line.replace("../DetectorDescription/Schema/DDLSchema.xsd",schemaPath)
0041 tmpXMLFile.write(line)
0042 tmpXMLFile.close()
0043 xmlFile.close()
0044
0045
0046 command = 'DOMCount -v=always -n -s -f %s' % (xmlFilename)
0047 os.system ( command )
0048
0049
0050 os.system ("rm %s" % (xmlFilename))
0051
0052
0053 schema = pfnInPath("DetectorDescription/Schema/DDLSchema.xsd").replace('file:','')
0054 print("schema file is:")
0055 print(schema)
0056 sys.stdout.flush()
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
0084