sign = ['ss'] jets = [0, 1, 2, 3] processtype=['gg'] threshold=['ept30'] outputdir = 'plots/%s/ControlFakeTau/%s/' % (jobid, channel) if not os.path.exists(outputdir): os.makedirs(outputdir) def remove_name_entry(dictionary): return dict( [ i for i in dictionary.iteritems() if i[0] != 'name'] ) plotter = BasePlotter(channel,files, lumifiles, outputdir) EWKDiboson = views.StyleView( views.SumView( *[ plotter.get_view(regex) for regex in \ filter(lambda x : x.startswith('WW') or x.startswith('WZ') or x.startswith('ZZ') or x.startswith('WG'), mc_samples )] ), **remove_name_entry(data_styles['WW*'#,'WZ*', 'WG*', 'ZZ*' ]) ) Wplus = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : x.startswith('Wplus'), mc_samples )]), **remove_name_entry(data_styles['Wplus*Jets*'])) DYLL = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : x.endswith('skimmedLL'), mc_samples )]), **remove_name_entry(data_styles['Z*jets*LL'])) DYTT = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : x.endswith('jets_M50_skimmedTT'), mc_samples )]), **remove_name_entry(data_styles['Z*jets*TT'])) TT = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : x.startswith('TT') , mc_samples)]), **remove_name_entry(data_styles['TTJets*'])) singleT = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : x.startswith('T_') or x.startswith('Tbar_'), mc_samples)]), **remove_name_entry(data_styles['T*_t*'])) SMH = views.StyleView(views.SumView( *[ plotter.get_view(regex) for regex in filter(lambda x : 'HToTauTau' in x , mc_samples)]), **remove_name_entry(data_styles['GluGluToHToTauTau*']))
from BasePlotter import BasePlotter from rootpy.io import root_open import rootpy.plotting.views as views from ROOT import TProfile import binning from pdb import set_trace from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('input', help='input root file') parser.add_argument('out', help='output dir') args = parser.parse_args() tfile = root_open(args.input) plotter = BasePlotter( args.out, defaults={'save':{'pdf' : False}}, ) b_plots = views.StyleView( views.TitleView(views.SubdirectoryView(tfile, 'B'), 'B'), linewidth=2, linecolor='#2aa198', legendstyle='l', drawstyle='hist' ) c_plots = views.StyleView( views.TitleView(views.SubdirectoryView(tfile, 'C'), 'C'), linewidth=2, linecolor='#0055ff', legendstyle='l', drawstyle='hist',
def __init__(self, outputDir): BasePlotter.__init__(self, outputDir)
def initPlotting(self, filePatterns, measurementResult): BasePlotter.initPlotting(self, filePatterns, measurementResult) self._createWriters() self._writeHeader()
def terminate(self): BasePlotter.terminate(self)
period = '8TeV' sqrts = 7 if '7TeV' in jobid else 8 def remove_name_entry(dictionary): return dict([i for i in dictionary.iteritems() if i[0] != 'name']) sign = ['os'] jets = [0, 1, 2, 3] outputdir = 'plots/%s/EEAnalyzerMVA/%s/' % (jobid, channel) if not os.path.exists(outputdir): os.makedirs(outputdir) plotter = BasePlotter(files, lumifiles, outputdir) EWKDiboson = views.StyleView( views.SumView( *[ plotter.get_view(regex) for regex in \ filter(lambda x : x.startswith('WW') or x.startswith('WZ') or x.startswith('ZZ') or x.startswith('WG'), mc_samples )] ), **remove_name_entry(data_styles['WW*'#,'WZ*', 'WG*', 'ZZ*' ]) ) Wplus = views.StyleView( views.SumView(*[ plotter.get_view(regex) for regex in filter(lambda x: x.startswith('Wplus'), mc_samples)
def initPlotting(self, filePatterns, measurementResult): BasePlotter.initPlotting(self, filePatterns, measurementResult) if len(filePatterns) != 2: raise Exception( 'DiffSampleDiagramPlotter needs exactly two file pattern')
channel = 'et' import rootpy.plotting.views as views ROOT.gROOT.SetStyle("Plain") ROOT.gROOT.SetBatch(True) ROOT.gStyle.SetOptStat(0) print "\nPlotting %s for %s\n" % (channel, jobid) #check if blind blind = 'blind' not in os.environ or os.environ['blind'] == 'YES' blind_region=[100, 150] if blind else None embedded = True plotter = BasePlotter(blind_region,use_embedded=embedded) if not args.no_plots: signs = ['os','ss'] jets = ['0','1','2'] processtype = ['gg'] threshold = ['ept30'] histo_info = [ ('tPt', 'p_{T}(#tau) (GeV)', 1), ('tEta', '#eta(#tau)', 1), ('tPhi', '#phi(#tau)', 1), ('ePt', 'p_{T}(e) (GeV)', 1), ('eEta', '#eta(e)', 1), ('ePhi', '#phi(e)', 1), ('e_t_DPhi', 'e#tau #Delta#phi', 1),
def initPlotting(self, filePatterns, measurementResult): BasePlotter.initPlotting(self, filePatterns, measurementResult)
from rootpy.io import root_open import rootpy.plotting.views as views from ROOT import TProfile import binning from pdb import set_trace from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('input', help='input root file') parser.add_argument('out', help='output dir') args = parser.parse_args() tfile = root_open(args.input) plotter = BasePlotter( args.out, defaults={'save': { 'pdf': False }}, ) b_plots = views.StyleView(views.TitleView(views.SubdirectoryView(tfile, 'B'), 'B'), linewidth=2, linecolor='#2aa198', legendstyle='l', drawstyle='hist') c_plots = views.StyleView( views.TitleView(views.SubdirectoryView(tfile, 'C'), 'C'), linewidth=2, linecolor='#0055ff', legendstyle='l', drawstyle='hist',
channel = 'et' import rootpy.plotting.views as views ROOT.gROOT.SetStyle("Plain") ROOT.gROOT.SetBatch(True) ROOT.gStyle.SetOptStat(0) print "\nPlotting %s for %s\n" % (channel, jobid) #check if blind blind = 'blind' not in os.environ or os.environ['blind'] == 'YES' blind_region=[100, 150] if blind else None embedded = False plotter = BasePlotter(blind_region,use_embedded=embedded) cuts= [ ['selected', 'tPt30', 'tPt35', 'tPt40', 'tPt45','tPt50','tPt60','tPt70','tPt80','tPt90', 'ePt30', 'ePt35', 'ePt40', 'ePt45','ePt50','ePt60','ePt70','ePt80','ePt90', 'dphi0.50','dphi1.00','dphi1.50','dphi2.20','dphi2.40','dphi2.70', 'dphi3.00', 'tMtToPfMet5','tMtToPfMet10','tMtToPfMet20','tMtToPfMet30','tMtToPfMet35','tMtToPfMet40', 'tMtToPfMet50', 'tMtToPfMet60', 'tMtToPfMet70' , 'tMtToPfMet80', 'tMtToPfMet90' ], ['selected', 'tPt30', 'tPt35', 'tPt40', 'tPt45','tPt50','tPt60','tPt70','tPt80','tPt90', 'ePt30', 'ePt35', 'ePt40', 'ePt45', 'ePt50','ePt60','ePt70','ePt80','ePt90', 'tMtToPfMet5','tMtToPfMet10','tMtToPfMet20','tMtToPfMet30','tMtToPfMet35','tMtToPfMet40' , 'tMtToPfMet50', 'tMtToPfMet60', 'tMtToPfMet70' , 'tMtToPfMet80', 'tMtToPfMet90'], ['selected', 'tPt30', 'tPt35', 'tPt40', 'tPt45','tPt50','tPt60','tPt70','tPt80','tPt90', 'ePt30', 'ePt35', 'ePt40', 'ePt45', 'ePt50','ePt60','ePt70','ePt80','ePt90', 'tMtToPfMet5','tMtToPfMet10','tMtToPfMet20','tMtToPfMet30','tMtToPfMet35','tMtToPfMet40', 'tMtToPfMet50', 'tMtToPfMet60', 'tMtToPfMet70', 'tMtToPfMet80', 'tMtToPfMet90', 'vbf_mass200', 'vbf_mass300', 'vbf_mass400', 'vbf_mass450', 'vbf_mass500', 'vbf_mass550', 'vbf_mass600', 'vbf_mass700', 'vbf_mass800', 'vbf_mass900', 'vbf_deta2.0','vbf_deta2.5','vbf_deta3.0','vbf_deta3.5', 'vbf_deta4.0' ]