Exemplo n.º 1
0
#!/usr/bin/env python

from sys import argv
import argparse

parser = argparse.ArgumentParser(description='plot stuff')
parser.add_argument('--outdir', metavar='outdir', type=str)
parser.add_argument('--label', metavar='label', type=str)
args = parser.parse_args()
argv = []

import ROOT as root
from PandaCore.Tools.Load import Load

Load('Tools', 'EventSyncher')
Load('Drawers', 'CanvasDrawer')

es = root.EventSyncher()

if args.label == 'MET':
    f1 = '/mnt/hadoop/scratch/bmaier/panda/v7/flat/MET.root'
    f2 = '/mnt/hadoop/scratch/bmaier/panda/v9/flat/MET.root'
else:
    f1 = '/mnt/hadoop/scratch/bmaier/panda/v7/flat/TTbar_CUETP8M2T4.root'
    f2 = '/mnt/hadoop/scratch/bmaier/panda/v9/flat/TTbar.root'
es.preselection = '(( metFilter==1 ) && ( (( nFatjet==1 && fj1Pt>250 && fabs(fj1Eta)<2.4 ) && ( pfUWmag>250 && dphipfUW>0.5 && nLoosePhoton==0 && nTau==0 && nLooseLep==1 && looseLep1IsTight==1 && abs(looseLep1PdgId)==13 )) ))'

formulae = [
    ('fj1MSD', 0, 300, 'm_{SD}'),
    ('fj1Pt', 250, 500, 'p_{T}'),
    ('fj1RawPt', 250, 500, 'raw p_{T}'),
Exemplo n.º 2
0
from argparse import ArgumentParser

sname = argv[0]
parser = ArgumentParser()
parser.add_argument('--silent', action='store_true')
parser.add_argument('arguments', type=str, nargs='+')
args = parser.parse_args()
arguments = args.arguments
argv = []

import ROOT as root
from PandaCore.Tools.process import *
from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import Load

Load('Normalizer')

pds = {}
for k, v in processes.iteritems():
    if v[1] == 'MC':
        pds[v[0]] = (k, v[2])
    else:
        pds[v[0]] = (k, -1)

VERBOSE = not args.silent

user = environ['USER']
system('mkdir -p /tmp/%s/split' % user)  # tmp dir
system('mkdir -p /tmp/%s/merged' % user)  # tmp dir

inbase = environ['SUBMIT_OUTDIR']
Exemplo n.º 3
0
infile = basedir + '/WJets.root'

parser = argparse.ArgumentParser(description='plot stuff')
parser.add_argument('--outdir', metavar='outdir', type=str, default=None)
parser.add_argument('--cut', metavar='cut', type=str, default=None)
args = parser.parse_args()

figsdir = args.outdir
argv = []

import ROOT as root
from PandaCore.Tools.Load import Load
from PandaCore.Tools.Misc import *
from PandaCore.Tools.root_interface import Selector

Load('HistogramDrawer')

lumi = 35900
import PandaAnalysis.VBF.PandaSelection as sel

base_cut = sel.cuts['signal']
label = 'inc'
if args.cut == 'cnc':
    base_cut = tAND(sel.cnc, sel.cuts['signal'])
    label = 'cnc'
elif args.cut == 'mjj':
    base_cut = tAND(sel.mjj, sel.cuts['signal'])
    label = 'mjj'
weight = sel.weights['signal'] % lumi

plot = root.HistogramDrawer()
Exemplo n.º 4
0
#!/usr/bin/env python

from PandaCore.Tools.Load import Load 
from PandaCore.Tools.Misc import PInfo, PError
import ROOT as root

Load('PandaAnalyzer')

def _dump(a):
    PInfo('PandaAnalysis.Flat.analysis','Summary of analysis %s:'%(a.name))
    print a.monojet
    for k in dir(a):
        if k[0] == '_':
            continue
        if type(getattr(a, k)) != int:
            continue
        PInfo('PandaAnalysis.Flat.analysis','    %20s = %s'%(k, 'True' if getattr(a, k) else 'False'))



def _analysis(name, verbose, **kwargs):
    a = root.Analysis(name)
    for k,v in kwargs.iteritems():
        if not hasattr(a, k):
            PError('PandaAnalysis.Flat.analysis','Could not set property %s'%k)
            return None 
        setattr(a, k, bool(v))
    setattr(a, 'dump', lambda : _dump(a))
    if verbose:
        a.dump()
    return a
Exemplo n.º 5
0
parser.add_argument('--infile', metavar='infile', type=str, default=None)
parser.add_argument('--variable',
                    metavar='variable',
                    type=str,
                    default='barrelHTMiss')
args = parser.parse_args()

figsdir = args.outdir
argv = []

import ROOT as root
from PandaCore.Tools.Load import Load
from PandaCore.Tools.Misc import *
from math import sqrt

Load('GraphAsymmErrDrawer')
root.gROOT.SetBatch()

lumi = 36000
plot = root.GraphAsymmErrDrawer()
plot.SetTDRStyle()
plot.SetLumi(lumi / 1000.)
plot.DrawEmpty(True)
plot.InitLegend(0.55, 0.76, 0.88, 0.9)
#plot.SetAutoRange(False)
root.gStyle.SetOptStat(0)

fin = root.TFile(args.infile)
fout = root.TFile(args.infile.replace('param', 'fit'), 'RECREATE')
#ffit = root.TF1("sigmoidFit", "[2]*pow(1+[3]*TMath::Exp(-[0]*(x-[1])),-1./[4])", 10, 1000)
#ffit.SetParNames("k", "E_{c}","#varepsilon_{obs}","Q","#nu");
import argparse

parser = argparse.ArgumentParser(description='interpolate')
parser.add_argument('--mass', type=str)
parser.add_argument('--mass_reco', type=str, default=None)
args = parser.parse_args()
sname = argv[0].split('/')[-1]
argv = []

from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import Load
from PandaCore.Tools.root_interface import read_tree, draw_hist
import ROOT as root
from math import sqrt

Load('BranchAdder')
ba = root.BranchAdder()
ba.verbose = False
ba.formula = 'genBosonPt'

bins = array('f', [250, 280, 310, 350, 400, 450, 600, 1000])
N = len(bins) - 1
h_base = root.TH1F('hbase', '', N, bins)

systs = [
    'btagUp', 'btagDown', 'mistagUp', 'mistagDown', 'sjbtagUp', 'sjbtagDown',
    'sjmistagUp', 'sjmistagDown'
]

basedir = getenv('PANDA_FITTING')
Exemplo n.º 7
0
parser = argparse.ArgumentParser(description='plot stuff')
parser.add_argument('--outdir',metavar='outdir',type=str)
parser.add_argument('--infile',metavar='infile',type=str,default=None)
args = parser.parse_args()
if not args.infile:
    args.infile = getenv('PANDA_FITTING') + '/fittingForest.root'

argv = []
import ROOT as root
from math import sqrt
from collections import namedtuple 
from array import array
from PandaCore.Tools.Load import Load
from PandaCore.Tools.root_interface import draw_hist, read_tree

Load('PandaCoreTools')
Load('PandaCoreDrawers')

# create some global variables
plot = root.HistogramDrawer()
plot.SetTDRStyle()
plot.InitLegend()
plot.SetLumi(35.8)

f_input = root.TFile(args.infile)
fztow = root.TFile(getenv('PANDA')+'/data/theory_uncs/wtoz_unc.root')
fztoa = root.TFile(getenv('PANDA')+'/data/theory_uncs/atoz_unc.root')
f_input.cd()

recoil_bins = array('f',[250,280,310,350,400,450,600,1000])
hbase = root.TH1D('dummy','',len(recoil_bins)-1,recoil_bins)
Exemplo n.º 8
0
#!/usr/bin/env python

import ROOT as root
import numpy as np
import root_numpy as rnp
import PandaAnalysis.Monotop.TestSelection as sel
from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import Load
'''
Load('Drawers','HistogramDrawer')
class testclass():
    def __init__(self):
        self.plot = root.HistogramDrawer()
        members = [x for x in dir(self.plot) if ('__' not in x)]
        for m in members:
            if callable(getattr(self.plot,m)):
                self.__getPlotMethod(m)
            else:
                self.__getPlotMember(m)
        return
    def __getPlotMethod(self,x):
        method = getattr(self.plot,x)
        setattr(self,x, lambda *args : method(*args))
    def __getPlotMember(self,x):
        member = getattr(self.plot,x)
        setattr(self,x, member)

test = testclass()
print dir(test)
test.SetLumi(10)
'''
Exemplo n.º 9
0
import argparse
from collections import namedtuple
import numpy as np

parser = argparse.ArgumentParser(description='plot stuff')
parser.add_argument('--outdir',metavar='outdir',type=str)
parser.add_argument('--sample',metavar='sample',type=str)
args = parser.parse_args()
argv = []
basedir = getenv('PANDA_FLATDIR')

import root_numpy as rnp
import ROOT as root
from PandaCore.Tools.Load import Load

Load('CanvasDrawer')
plot = root.CanvasDrawer()
plot.SetTDRStyle()
c = root.TCanvas()


if args.sample=='QCD':
	weightname = 'ptweight_qcd'
	fin = root.TFile.Open(basedir+'/QCD_evt8.root')
	cut = None
else:
	weightname = 'ptweight_binned'
	fin = root.TFile.Open(basedir+'/ZpTT.root')
	cut = 'fj1IsMatched==1 && fj1GenSize<1.44'
#fin = root.TFile.Open('/home/snarayan/home000/store/panda/v_8024_4_3//Diboson.root')
#weightname = 'normalizedWeight'