6 Author: Evan K. Friis, UC Davis friis@physics.ucdavis.edu
8 Usage: Any objects with file type [name].mvac will be turned into [name].xml with the correct format
10 A configuration script to automate changes in available MVA input variables (for the PhysicsTools/MVAComputer framework)
11 across numerous MVA configurations.
13 This is total kludge and will be deprecated when
14 a. I figure out how you use <xi:include... success full (xml sucks)
15 b. Proposed changes to the MVA objects allow classification steering in a single xml file
22 filesToConvert = glob.glob(
"./*.mvac")
24 RemoveNumEventsSpecifiers =
True
26 for aFile
in filesToConvert:
27 xmlFileName = string.replace(aFile,
"mvac",
"xml")
28 if os.path.exists(xmlFileName):
29 os.system(
"cp %s %s.bak" % (xmlFileName, xmlFileName))
30 os.remove(xmlFileName)
32 print "Building %s..." % xmlFileName
33 os.system(
"cat Preamble.xml.fragment > %s" % xmlFileName)
34 os.system(
"cat Inputs.xml.fragment >> %s" % xmlFileName)
35 os.system(
"cat Helpers.xml.fragment >> %s" % xmlFileName)
36 if RemoveNumEventsSpecifiers:
37 os.system(
"cat %s | sed 's|NSigTest=[0-9]*|NSigTest=0|' | sed 's|NBkgTest=[0-9]*|NBkgTest=0|' | sed 's|NSigTrain=[0-9]*|NSigTrain=0|' | sed 's|NBkgTrain=[0-9]*|NBkgTrain=0|' >> %s" % (aFile, xmlFileName))
39 os.system(
"cat %s >> %s" % (aFile, xmlFileName))
40 os.system(
"cat Finale.xml.fragment >> %s" % xmlFileName)