Exemple #1
0
import ROOT
from ROOT import TFile, TTree, TH1F, TCanvas
from ROOTClassDefs import Tree
from ROOTDefs import prepare_event, set_po_tree_parameters

c1 = TCanvas('c1', 'Graph Draw Options', 200, 10, 600, 400)

f_old = ROOT.TFile('../dataFiles/output_MB80_formatted.root')
t_old = Tree(f_old.Get('mytree'))

f_new = ROOT.TFile('../dataFiles/back_xAOD_formatted_abr.root')
t_new = Tree(f_new.Get('mytree'))
set_po_tree_parameters(t_new)

f_sig = ROOT.TFile('../dataFiles/ztt_Output_formatted.root')
t_sig = Tree(f_sig.Get('mytree'))
set_po_tree_parameters(t_sig)

print 'Old entries: ', t_old.entries
print 'New entries: ', t_new.entries
print 'Sig entries: ', t_sig.entries

bins = 120
min_bin = -1
max_bin = 2

old_seed_histo = TH1F('hist', 'Old Background Seed Supercell Energy', 200, 0,
                      5)
new_seed_histo = TH1F('hist', 'New Background Seed Supercell Energy', 200, 0,
                      5)
sig_seed_histo = TH1F('hist', 'Signal Seed Supercell Energy', 200, 0, 5)
Exemple #2
0
import ROOT
from ROOT import TGraph, TCanvas, TFile, TLegend, TH1F, kRed, kBlue, kGreen
from ROOTDefs import prepare_event, set_po_tree_parameters
from ROOTPlotDefs import reco_et_tree_histogram
from ROOTClassDefs import Tree


c1 = TCanvas('c1', 'Graph Draw Options', 200, 10, 600, 400)

new_f = TFile('../dataFiles/back_xAOD_formatted.root')
new_t = Tree(new_f.Get('mytree'))
set_po_tree_parameters(new_t)

new_05_f = TFile('../dataFiles/back_xAOD_formatted_0.5L2.root')
new_05_t = Tree(new_05_f.Get('mytree'))
set_po_tree_parameters(new_05_t)

old_f = TFile('../dataFiles/output_MB80_formatted.root')
old_t = Tree(old_f.Get('mytree'))

sig_f = TFile('../dataFiles/ztt_Output_formatted.root')
sig_t = Tree(sig_f.Get('mytree'))
set_po_tree_parameters(sig_t)

print 'New entries'
print new_t.entries
print 'Old entries'
print old_t.entries

new_had_histo = TH1F('histo', 'New Hadronic Energy', 100, 0, 20)
new_05_had_histo = TH1F('histo', 'New 0.5 GeV Hadronic Energy', 100, 0, 20)
Exemple #3
0
from ROCCurveDefs import et_roc_curve
from ROOT import TGraph, TCanvas, TFile, TLine, TH1F, THStack, TGraph2D, TLegend, kRed, kBlue, kGreen, kMagenta, kOrange, kTRUE
import numpy as np
import os
import math

ROOT.gROOT.SetBatch(kTRUE)

c1 = TCanvas("c1", "Graph Draw Options", 200, 10, 600, 400)

# Load signal and background samples
fsig_path = os.path.join(os.path.expanduser('~'), 'NewTauSamples', 'dataFiles',
                         'sig_ntuple.root')
fsig = ROOT.TFile(fsig_path)
tsig = Tree(fsig.Get("mytree"))
set_po_tree_parameters(tsig)

fback_path = os.path.join(os.path.expanduser('~'), 'NewTauSamples',
                          'dataFiles', 'back_ntuple_abr.root')
fback = ROOT.TFile(fback_path)
tback = Tree(fback.Get("mytree"))
set_po_tree_parameters(tback)

old_fsig_path = os.path.join(os.path.expanduser('~'), 'NewTauSamples',
                             'dataFiles', 'ztt_Output_formatted.root')
old_fsig = ROOT.TFile(old_fsig_path)
old_tsig = Tree(old_fsig.Get('mytree'))
set_po_tree_parameters(old_tsig)

old_fback_path = os.path.join(os.path.expanduser('~'), 'NewTauSamples',
                              'dataFiles', 'output_MB80_formatted.root')
Exemple #4
0
import ROOT
from ROOTDefs import set_po_tree_parameters, multi_print, prepare_event
from ROOTClassDefs import Tree

c1 = ROOT.TCanvas("c1", "Graph Draw Options", 200, 10, 600, 400)

file_path = '~/NewTauSamples/dataFiles/sig_ntuple.root'
f = ROOT.TFile(file_path)
t = Tree(f.Get('mytree'))
set_po_tree_parameters(t)

afs_name = '~/NewTauSamples/plots/sanityCheck.pdf'
eos_name = '/eos/user/n/nicholas/NewTauSamples/plots/sanityCheck.pdf'

plot_names = [afs_name, eos_name]

h0 = ROOT.TH1F('hist', 'New Signal True Tau Pt', 100, 0, 100)
h1 = ROOT.TH1F('hist', 'New Signal Seed Et', 100, 0, 20)
h2 = ROOT.TH1F('hist', 'New Signal Eta', 50, -5, 5)

for i in range(t.root_ttree.GetEntries()):
    t.root_ttree.GetEntry(i)
    event = prepare_event(t, i)
    h0.Fill(t.root_ttree.TrueTauPt)
    h1.Fill(event.l2_layer.cell_et[t.root_ttree.SeedEta][t.root_ttree.SeedPhi])
    h2.Fill(t.root_ttree.TOBEta)

h0.Draw('hist')
multi_print(plot_names, c1, '(')

h1.Draw('hist')
Exemple #5
0
if sigOrBack == 1:
    file_path = '~/NewTauSamples/dataFiles/sig_ntuple.root'
    f_out_name = 'sig_layers.root'
elif sigOrBack == 0:
    file_path = '~/NewTauSamples/dataFiles/back_ntuple.root'
    f_out_name = 'back_layers.root'
else:
    print 'Must provide argument'
    exit()

# Get input TFile and Tree
f_in = ROOT.TFile(file_path)
print f_in
t_in = Tree(f_in.Get('mytree'))
print t_in
set_po_tree_parameters(t_in)

# Create TFile
f_out = ROOT.TFile(f_out_name, 'recreate')

# Create description TString and store in TFile
t_string = ROOT.TString("""
                         Production script: {}
                         Production scripts version: 1
                         Events source: {}
                         Source production script: formatFullEvent.py
                         Source production script version: 1
                         
                         Cuts:
                         True Tau Visible Pt > 20 GeV
                         |Eta| < 1.4
Exemple #6
0
from __future__ import print_function
import ROOT
from ROOT import TFile, TTree
from ROOTClassDefs import Tree
from ROOTDefs import prepare_event, set_po_tree_parameters, get_formatted_root_tree
import sys

back_t, back_f = get_formatted_root_tree('~/NewTauSamples/dataFiles/back_ntuple_abr.root')
set_po_tree_parameters(back_t)

sig_t, sig_f = get_formatted_root_tree('~/NewTauSamples/dataFiles/sig_ntuple.root')
set_po_tree_parameters(sig_t)

print('Background entries: ',back_t.entries)
print('Signal entries: ',sig_t.entries)

back_ets = set()
for counter, event in enumerate(back_t):
  back_ets.add(event.had_layer.cell_et[1][1])
  #back_ets.add(event.had_layer.cell_et[1][1])

sig_ets = set()
for counter, event in enumerate(sig_t):
  sig_ets.add(event.had_layer.cell_et[1][1])
  #sig_ets.add(event.had_layer.cell_et[1][1])

#print(sig_ets)
#print(back_ets)

#print(list(sig_ets))
#print(list(back_ets))
Exemple #7
0
from __future__ import print_function
import ROOT
from ROOTClassDefs import Tree
from ROOTDefs import get_formatted_root_tree, set_po_tree_parameters

event_t, event_f = get_formatted_root_tree(
    '~/NewTauSamples/dataFiles/sig_ntuple.root')
set_po_tree_parameters(event_t)

layer_f = ROOT.TFile('~/NewTauSamples/scripts/sig_layers.root')
layer_t = layer_f.Get('mytree')

for event in event_t:
    print(event.had_layer.cell_et)
    print(event.seed_eta)
    break

layer_t.GetEntry(0)
print(layer_t.HadEt)