CMS 3D CMS Logo

BuildIsoConfigs.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 """
4 BuildIsoMvacs.py
5 
6 Author: Evan K. Friis, UC Davis friis@physics.ucdavis.edu
7 
8 Usage: Prepare copies of all MVA configuration files (*.mvac) with the isolation inputs removed.
9  New copies will be titled *Iso.xml
10 """
11 import os
12 import glob
13 import string
14 
15 filesToConvert = glob.glob("./*.mvac")
16 
17 for aFile in filesToConvert:
18  xmlFileName = string.replace(aFile, ".mvac", "Iso.xml")
19  if os.path.exists(xmlFileName):
20  os.system("cp %s %s.bak" % (xmlFileName, xmlFileName))
21  os.remove(xmlFileName)
22 
23  print "Building %s..." % xmlFileName
24  os.system("cat Preamble.xml.fragment > %s" % xmlFileName)
25  os.system("cat Inputs.xml.fragment >> %s" % xmlFileName)
26  os.system("cat Helpers.xml.fragment >> %s" % xmlFileName)
27  os.system("cat %s | grep -v Outlier >> %s" % (aFile, xmlFileName))
28  os.system("cat Finale.xml.fragment >> %s" % xmlFileName)