def __init__(self): Load('TMVABranchAdder') self.ba = root.TMVABranchAdder() self.ba.defaultValue = -1.2 self.ba.presel = 'fjECFN_2_4_20>0' for v in tagcfg.variables: self.ba.AddVariable(v[0], v[2].replace('fj1', 'fj')) for v in tagcfg.formulae: self.ba.AddFormula(v[0], v[2].replace('fj1', 'fj')) for s in tagcfg.spectators: self.ba.AddSpectator(s[0]) self.ba.BookMVA('top_ecf_bdt', _data_dir + '/trainings/top_ecfbdt_v8_BDT.weights.xml')
#!/usr/bin/env python from PandaCore.Utils.load import Load from PandaCore.Utils.logging import logger import ROOT as root import cppyy import sys # this module lets you build a LambdaSelection instance on the fly # look we're doing C++ in python, we even have this: this = sys.modules[__name__] Load('PandaAnalyzer') cppyy.cppdef('#include "PandaAnalysis/Flat/interface/GeneralTree.h"') def build(stage, name, expr, anded=False): left = 'std::function<bool(const GeneralTree* gt)>' middle = '_fsel = [](const GeneralTree* gt) { return ' right = '; };' cppyy.cppdef(left + name + middle + expr + right) f = getattr(cppyy.gbl, name+'_fsel') sel = root.LambdaSel(stage, name, f, anded) setattr(this, name+'Sel', sel) return sel # e.g.: # build(root.Selection.sReco, 'Trigger', '(gt->isData==0) || (gt->trigger!=0)', anded=True) # build(root.Selection.sGen, 'GenBosonPt', 'gt->trueGenBosonPt > 100') # build(root.Selection.sReco, 'FatJet', 'gt->fj1Pt>250') # build(root.Selection.sReco, 'FatJet450', 'gt->fj1Pt>450')
basedir = getenv('PANDA_FLATDIR') + '/' parser = argparse.ArgumentParser(description='plot stuff') parser.add_argument('--proc', metavar='proc', type=str) parser.add_argument('--outdir', metavar='outdir', type=str) args = parser.parse_args() figsdir = args.outdir argv = [] import ROOT as root from PandaCore.Utils.load import Load from PandaCore.Tools.Misc import * from PandaCore.Tools.root_interface import Selector from math import sqrt Load('CanvasDrawer') root.gROOT.SetBatch() root.gStyle.SetNumberContours(999) root.gStyle.SetPalette(root.kCool) SMOOTH = True plot = root.CanvasDrawer() plot.SetTDRStyle() root.gStyle.SetPadRightMargin(0.2) c = root.TCanvas() plot.SetCanvas(c) s = Selector() s_nlo = Selector()
#!/usr/bin/env python '''@package docstring Loads some numerical functions defined in a C++ file ''' from os import getenv from ROOT import gROOT from PandaCore.Utils.load import Load Load('Functions') #gROOT.LoadMacro(getenv('CMSSW_BASE')+'/src/PandaCore/Tools/interface/Functions.h')
#!/usr/bin/env python import ROOT as root import numpy as np from array import array from PandaCore.Tools.Misc import * from PandaCore.Utils.load import Load from PandaCore.Tools.root_interface import read_files, draw_hist from os import getenv, system, path from pprint import pprint from multiprocessing.pool import ThreadPool Load('HistogramDrawer') tree_name = 'events' class Process(): def __init__(self, name, pt, custom_color=root.nProcesses): self.name = name self.process_type = pt if (custom_color == root.nProcesses): self.color = pt else: self.color = custom_color # public config - defaults self.dashed = False self.dotted = False self.use_common_weight = True self.use_common_cut = True self.additional_cut = '1==1'
parser = argparse.ArgumentParser(description='plot stuff') parser.add_argument('--outdir',metavar='outdir',type=str) parser.add_argument('--finor', action='store_true') parser.add_argument('--iso', action='store_true') args = parser.parse_args() figsdir = args.outdir argv=[] import ROOT as root from PandaCore.Utils.load import Load from PandaCore.Tools.Misc import * from PandaCore.Tools.root_interface import Selector from math import sqrt Load('GraphAsymmErrDrawer') root.gROOT.SetBatch() lumi=36000 import PandaAnalysis.VBF.PandaSelection as sel cut = 'fabs(jotEta[{0}])>2.75 && fabs(jotEta[{0}])<3 && filter==1' cut = tAND(cut, '!(fabs(jotEta[{0}]+2.81)<0.4 && fabs(jotPhi[{0}]-2.07)<0.4)') if args.finor: cut = tAND(cut, 'nJotEC==1') sigcut = 'finor[1]!=0' if args.finor else 'jotL1EGBX[{0}]==-1' if args.iso: sigcut = tAND(sigcut, 'jotL1EGIso[{0}]>0') plot = root.GraphAsymmErrDrawer() plot.SetLineWidth(3)
#!/usr/bin/env python from sys import argv from os import getenv, system me = argv[0] cat = argv[1] radius = argv[2] argv = [] from PandaCore.Utils.load import Load import PandaAnalysis.Tagging.TnPSel as sel from PandaCore.Tools.Misc import tAND import ROOT as root Load('Cutter') flatdir = getenv('PANDA_FLATDIR') + '/' outdir = flatdir + 'tnp_' + radius + '/' system('mkdir -p ' + outdir) fins = { 'Data': ['SingleMuon'], '1': ['WJets'], '2': ['Diboson', 'SingleTop', 'TTbar'], '3': ['SingleTop', 'TTbar'] } cuts = { 'Data': '1==1', '1': '1==1', '2': '(fjIsMatched==0||fjGenSize>%s)' % radius, '3': '(fjIsMatched==1&&fjGenSize<%s)' % radius
#!/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('--sample',metavar='sample',type=str) args = parser.parse_args() argv = [] import ROOT as root from PandaCore.Utils.load import Load Load('PandaCoreTools') Load('PandaCoreDrawers') es = root.EventSyncher() es.relative = False f1 = '/home/snarayan/home000/store/panda/v_8026_0_5_slim/%s.root'%args.sample f2 = '/home/snarayan/home000/store/panda/v_8026_0_5_ak8/%s.root'%args.sample es.preselection = 'fj1Pt>400' formulae = [ ('fj1Pt',400,1200,'p_{T}',True), ('fj1MaxCSV',0,1,'Max CA15 subjet CSV',False), ] for f in formulae: es.AddFormula(*f)
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.Utils.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')
from re import sub from sys import argv, exit from os import environ, system, path from array import array sname = argv[0].split('/')[-1] m_V = int(argv[1]) m_DM = int(argv[2]) argv = [] import ROOT as root from PandaCore.Tools.Misc import * from PandaCore.Utils.load import Load from PandaCore.Tools.root_interface import read_tree, draw_hist, rename_dtypes Load('Normalizer') ''' This script does the following things: - Read an input list of T2 files and xrdcp them locally - hadd these files - Remove the input files and only keep the merged one - Normalize the merged file - For each w in [1]+weights, draw the mediator pT distribution with weight (w*normalizedWeight) - Delete the merged file and stageout the file with histograms ''' #CONFIG = 'couplings' # or finer or normal CONFIG = 'normal' list_dir = '/home/bmaier/cms/MonoTop/interpolation/' xsec_path = 'non-resonant'