CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoTauTag/TauTagTools/xml/BuildIsoConfigs.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 """
00004 BuildIsoMvacs.py
00005 
00006 Author: Evan K. Friis, UC Davis friis@physics.ucdavis.edu
00007 
00008 Usage: Prepare copies of all MVA configuration files (*.mvac) with the isolation inputs removed.
00009        New copies will be titled *Iso.xml
00010 """
00011 import os
00012 import glob
00013 import string
00014 
00015 filesToConvert = glob.glob("./*.mvac")
00016 
00017 for aFile in filesToConvert:
00018    xmlFileName = string.replace(aFile, ".mvac", "Iso.xml")
00019    if os.path.exists(xmlFileName):
00020       os.system("cp %s %s.bak" % (xmlFileName, xmlFileName))
00021       os.remove(xmlFileName)
00022 
00023    print "Building %s..." % xmlFileName
00024    os.system("cat Preamble.xml.fragment >  %s" %         xmlFileName)  
00025    os.system("cat Inputs.xml.fragment   >> %s" %         xmlFileName)  
00026    os.system("cat Helpers.xml.fragment  >> %s" %         xmlFileName)  
00027    os.system("cat %s | grep -v Outlier  >> %s" % (aFile, xmlFileName)) 
00028    os.system("cat Finale.xml.fragment   >> %s" %         xmlFileName)