--- UserCode/OSUT3Analysis/Configuration/scripts/makeCutFlows.py 2013/03/05 20:16:16 1.9 +++ UserCode/OSUT3Analysis/Configuration/scripts/makeCutFlows.py 2013/03/12 21:10:44 1.12 @@ -3,20 +3,20 @@ import sys import os import fileinput from array import * -from optparse import OptionParser +import argparse from OSUT3Analysis.Configuration.configurationOptions import * from OSUT3Analysis.Configuration.processingUtilities import * -parser = OptionParser() +parser = argparse.ArgumentParser() parser = set_commandline_arguments(parser) -(options, args) = parser.parse_args() +arguments = parser.parse_args() -if options.localConfig: +if arguments.localConfig: sys.path.append(os.getcwd()) - exec("from " + options.localConfig.rstrip('.py') + " import *") + exec("from " + arguments.localConfig.rstrip('.py') + " import *") -condor_dir = set_condor_output_dir(options) +condor_dir = set_condor_output_dir(arguments) from ROOT import TFile, gROOT, gStyle, gDirectory, TKey @@ -27,7 +27,8 @@ texfile = condor_dir + "/cutFlow.tex" replacements = { ">":"$>$", "<":"$<$", - "eta ":"$\\eta$ ", + " eta ":" $\\eta$ ", + " abs(eta) ":" $|\\eta|$ ", "#":"Num", "\\rightarrow":"{\\rightarrow}", @@ -36,40 +37,31 @@ replacements = { "BCtoE QCD":"BCtoE$ $QCD", - "Pt ":"pt ", - "PT ":"pt ", - "pT ":"pt ", - "pt ":"$p_{T}$ ", - - "Ht ":"HT ", - "ht ":"HT ", - "hT ":"HT ", - "HT ":"$H_{T}$ ", - "tig$H_{T}$ ":"tight ", + " pt ":" $p_{T}$ ", + " ht ":"$H_{T}$ ", - "D0":"d0", "d0":"$d_{0}$", - "MET ":"Met ", - "MEt ":"Met ", - "met ":"Met ", - "Met ":"$\\not\\!\\!{E}_{T}$ ", - - "MHT ":"Mht ", - "MHt ":"Mht ", - "mht ":"Mht ", - "Mht ":"$\\not\\!\\!{H}_{T}$ ", + " MET ":" Met ", + " MEt ":" Met ", + " met ":" Met ", + " Met ":"$\\not\\!\\!{E}_{T}$ ", + + " MHT ":" Mht ", + " MHt ":" Mht ", + " mht ":" Mht ", + " Mht ":"$\\not\\!\\!{H}_{T}$ ", "M_Z" : "$M_{Z}$", "M_mumu" : "$M_{\\mu\\mu}$", "M_ee" : "$M_{ee}$", "M_ll" : "$M_{ll}$", - "|" : "$|$" } secondary_replacements = { "$$<$":"$<" + } @@ -118,6 +110,7 @@ for dataset in processed_datasets: os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", 1.0)) for channel in channels: # loop over final states, which each have their own directory + formatted_channel = channel.replace("_"," ") cutFlowArgs = "" selectionArgs = "" minusOneArgs = "" @@ -146,19 +139,19 @@ for channel in channels: # loop over fin if not firstChannel: fout.write ("\\pagebreak\n\n") firstChannel = False - fout.write ("\\section*{" + channel + " channel}\n\n") + fout.write ("\\section*{" + formatted_channel + " channel}\n\n") fout.write ("\\subsection*{Cut flow}\n\n") fout.close () - os.system("cutFlowTable -l %g %s >> %s" % (intLumi,cutFlowArgs,texfile)) + os.system("cutFlowTable -l %g -m %s >> %s" % (intLumi,cutFlowArgs,texfile)) fout = open (texfile, "a") fout.write ("\\pagebreak\n\n") - fout.write ("\\section*{" + channel + " channel}\n\n") + fout.write ("\\section*{" + formatted_channel + " channel}\n\n") fout.write ("\\subsection*{Individual selection}\n\n") fout.close () os.system("cutFlowTable -l %g %s >> %s" % (intLumi,selectionArgs,texfile)) fout = open (texfile, "a") fout.write ("\\pagebreak\n\n") - fout.write ("\\section*{" + channel + " channel}\n\n") + fout.write ("\\section*{" + formatted_channel + " channel}\n\n") fout.write ("\\subsection*{Minus one}\n\n") fout.close () os.system("cutFlowTable -l %g %s >> %s" % (intLumi,minusOneArgs,texfile))