In [1]:
import ROOT
%jsroot on

import os
import glob

import uproot
import numpy as np
import matplotlib.pyplot as plt
Welcome to JupyROOT 6.18/00
In [2]:
def format_num(n):
    if n > 1e7: return f'{n/1e6:.0f}M'
    if n > 1e6: return f'{n/1e6:.1f}M'
    if n > 1e4: return f'{n/1e3:.0f}k'
    if n > 1e3: return f'{n/1e3:.1f}k'
    else: return f'{n}'
    
# format_num(12345678)

Plans for next week

  1. compare phi distribution with MC
    total and 1 uniform and 1 non-uniform runs - how well are they reproduced
  2. QA for 244456 (and 244453)
    • check triggers settings - it should not be the case as the pT spectra does not differ
    • check global event properties: event multiplicities, event vertex distr.
    • check RCT & logbook
  3. rather small stats of pp@5.02TeV -- what with the reference for PbPb?
    check approaches in PbPb@5.02TeV papers

Compare $\phi$ distribution with MC

LHC15n only

In [10]:
f = ROOT.TFile('../../HF-jets/ana_results/iter2/LHC15n/AnalysisResults.root')
t = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')
In [11]:
# ROOT.gROOT.Reset()
c1 = ROOT.TCanvas( 'c1', 'Example', 200, 10, 700, 500 )
c1.Draw()
h_jet_phi = ROOT.TH1D('h_jet_phi', 'h_jet_phi', 100, 0, 6.283)
h_jet_phi.GetXaxis().SetTitle('jet phi')
t.Draw('Jet_Phi >> h_jet_phi', '', 'e1x0')
# h_jet_phi.DrawCopy()
Out[11]:
45535223
In [12]:
ROOT.gROOT.Reset()
c1_2 = ROOT.TCanvas( 'c1_2', '', 200, 10, 700, 500 )
c1_2.Draw()
h_track_phi = ROOT.TH1D('h_track_phi', 'h_track_phi', 100, 0, 6.283)
h_track_phi.GetXaxis().SetTitle('track phi')
t.Draw('Jet_Track_Phi >> h_track_phi', '', 'e1x0')
# h_phi.GetYaxis().SetRangeUser(6000,8000)
# c1.Draw()
Out[12]:
64203559

Is phi oscillations amplitude dependend on $p_T$ ???

In [17]:
nbins = 90

f = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC16h3/ptbin15/AnalysisResults.root')
t = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_udsgJets')


c1 = ROOT.TCanvas( 'c1', 'Example', 900, 500 )
c1.Draw()

h1 = ROOT.TH1D('h1', 'h1', nbins, 0, 6.283)
h2 = ROOT.TH1D('h2', 'h2', nbins, 0, 6.283)
h3 = ROOT.TH1D('h3', 'h3', nbins, 0, 6.283)
h1.SetLineColor(ROOT.kBlue)
h2.SetLineColor(ROOT.kRed)
h3.SetLineColor(ROOT.kBlack)
t.Draw(f'Jet_Track_Phi >> h1', 'Jet_Track_Pt < 1', 'goff')
t.Draw(f'Jet_Track_Phi >> h2', 'Jet_Track_Pt > 1 & Jet_Track_Pt < 3', 'goff')
t.Draw(f'Jet_Track_Phi >> h3', 'Jet_Track_Pt > 3', 'goff')

print(f'N entries: {format_num(h1.GetEntries())}, {format_num(h2.GetEntries())}, {format_num(h3.GetEntries())}')
h1.SetTitle('pT < 1')
h2.SetTitle('1 < pT < 3')
h3.SetTitle('pT > 3')

h1.Scale(1/h1.Integral())
h2.Scale(1/h2.Integral())
h3.Scale(1/h3.Integral())

h3.Draw('le')
h2.Draw('le,same')
h1.Draw('le,same')


c1.GetPad(0).BuildLegend(0.55, 0.775, 0.78, 0.935)
N entries: 8.8M, 13M, 21M
Out[17]:
<ROOT.TLegend object ("TPave") at 0x1e5fb9e0>
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c1

whole LHC15n vs MC (LHC16h3)

No cut

In [18]:
nbins = 90
cut = ''

f_data = ROOT.TFile('../../HF-jets/ana_results/iter2/LHC15n/AnalysisResults.root')
t_data = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')


c1 = ROOT.TCanvas( 'c1', 'Example', 900, 500 )
c1.Draw()
h_track_phi = ROOT.TH1D('h_data', 'h_data', nbins, 0, 6.283)
h_track_phi.SetTitle('data LHC15n')
h_track_phi.GetXaxis().SetTitle('track phi')
h_track_phi.SetLineColor(2)
h_track_phi.SetLineWidth(4)

t_data.Draw('Jet_Track_Phi >> h_data', cut, 'e,goff')
h_track_phi.Scale(1./h_track_phi.Integral())
h_track_phi.SetMinimum(1/nbins*0.8)
h_track_phi.SetMaximum(1/nbins*1.2)
h_track_phi.Draw('le')



ROOT.gStyle.SetPalette(55)
for i,ptbin in enumerate([ '10', '15']):
    f_mc = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC16h3/ptbin{ptbin}/AnalysisResults.root')
    t_mc = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_udsgJets')
    h_track_phi_mc = ROOT.TH1D(f'h_mc_ptbin{ptbin}', f'h_mc_ptbin{ptbin}', nbins, 0, 6.283)
    h_track_phi_mc.SetLineColor(ROOT.gStyle.GetColorPalette(i*150))
    h_track_phi_mc.SetLineWidth(2)
    t_mc.Draw(f'Jet_Track_Phi >> h_mc_ptbin{ptbin}', cut, 'e,goff')
    h_track_phi_mc.Scale(1./h_track_phi_mc.Integral())
    h_track_phi_mc.DrawCopy('le,same')

    
c1.GetPad(0).BuildLegend(0.55, 0.775, 0.78, 0.935)
Out[18]:
<ROOT.TLegend object ("TPave") at 0x145758c0>
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c1

Low pT

In [19]:
nbins = 90
cut = 'Jet_Track_Pt < 1'

f_data = ROOT.TFile('../../HF-jets/ana_results/iter2/LHC15n/AnalysisResults.root')
t_data = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')


c1 = ROOT.TCanvas( 'c1', 'Example', 900, 500 )
c1.Draw()
h_track_phi = ROOT.TH1D('h_data', 'h_data', nbins, 0, 6.283)
h_track_phi.SetTitle('data LHC15n')
h_track_phi.GetXaxis().SetTitle('track phi')
h_track_phi.SetLineColor(2)
h_track_phi.SetLineWidth(4)

t_data.Draw('Jet_Track_Phi >> h_data', cut, 'e,goff')
h_track_phi.Scale(1./h_track_phi.Integral())
h_track_phi.SetMinimum(1/nbins*0.8)
h_track_phi.SetMaximum(1/nbins*1.2)
h_track_phi.Draw('le')



ROOT.gStyle.SetPalette(55)
for i,ptbin in enumerate([ '10', '15']):
    f_mc = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC16h3/ptbin{ptbin}/AnalysisResults.root')
    t_mc = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_udsgJets')
    h_track_phi_mc = ROOT.TH1D(f'h_mc_ptbin{ptbin}', f'h_mc_ptbin{ptbin}', nbins, 0, 6.283)
    h_track_phi_mc.SetLineColor(ROOT.gStyle.GetColorPalette(i*150))
    h_track_phi_mc.SetLineWidth(2)
    t_mc.Draw(f'Jet_Track_Phi >> h_mc_ptbin{ptbin}', cut, 'e,goff')
    h_track_phi_mc.Scale(1./h_track_phi_mc.Integral())
    h_track_phi_mc.DrawCopy('le,same')

    
c1.GetPad(0).BuildLegend(0.55, 0.775, 0.78, 0.935)
Out[19]:
<ROOT.TLegend object ("TPave") at 0x217eae90>
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c1

Per run

No cut

In [20]:
nbins = 90
cut = ''

for run in [r[3:] for r in os.listdir('../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/') if r.startswith('000')]:
    print(f'run = {run}')
    f_data = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000{run}/AnalysisResults.root')
    t_data = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')

    # ROOT.gROOT.Reset()
    c1 = ROOT.TCanvas( 'c1'+run, 'c1'+run, 900, 500 )
    c1.Draw()
    h_track_phi = ROOT.TH1D('h_data', 'h_data', nbins, 0, 6.283)
    h_track_phi.GetXaxis().SetTitle(f'track phi')
    h_track_phi.SetTitle(f'track phi {run}')
    h_track_phi.SetLineColor(2)
    h_track_phi.SetLineWidth(3)

    t_data.Draw('Jet_Track_Phi >> h_data', cut, 'e,goff')
    n = h_track_phi.GetEntries()
    print(f'\t N entries = {format_num(n)} \t err ~ {np.sqrt(n/nbins)/(n/nbins)*100:.1f}%')    
    h_track_phi.Scale(nbins/h_track_phi.Integral())
    h_track_phi.SetMinimum(nbins/nbins*0.91)
    h_track_phi.SetMaximum(nbins/nbins*1.09)
    h_track_phi.DrawCopy('le')


    ROOT.gStyle.SetPalette(55)
    for i,ptbin in enumerate([ '10', '15']):
        try:
            f_mc = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC16h3/ptbin{ptbin}/myOutputDir/{run}/AnalysisResults.root')
            t_mc = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_udsgJets')
            h_track_phi_mc = ROOT.TH1D(f'h_mc_ptbin{ptbin}', f'h_mc_ptbin{ptbin}', nbins, 0, 6.283)
            h_track_phi_mc.SetLineColor(ROOT.gStyle.GetColorPalette(i*200))
            h_track_phi.SetLineWidth(2)
            t_mc.Draw(f'Jet_Track_Phi >> h_mc_ptbin{ptbin}', cut, 'e,goff')
        except: 
            f_mc.Close()
            continue
        n = float(h_track_phi_mc.GetEntries())
        print(f'\t N entries ({ptbin}) = {format_num(n)} \t err ~ {np.sqrt(n/nbins)/(n/nbins)*100:.1f}%')
        h_track_phi_mc.Scale(nbins/h_track_phi_mc.Integral())
        opt='le,same'
        h_track_phi_mc.DrawCopy(opt)
        f_mc.Close()
    c1.GetPad(0).BuildLegend(0.55, 0.775, 0.78, 0.935)
    f_data.Close()
run = 244340
	 N entries = 982k 	 err ~ 1.0%
	 N entries (10) = 863k 	 err ~ 1.0%
	 N entries (15) = 3.5M 	 err ~ 0.5%
run = 244351
	 N entries = 5.8M 	 err ~ 0.4%
	 N entries (10) = 719k 	 err ~ 1.1%
	 N entries (15) = 2.9M 	 err ~ 0.6%
run = 244355
	 N entries = 932k 	 err ~ 1.0%
	 N entries (10) = 252k 	 err ~ 1.9%
	 N entries (15) = 1.0M 	 err ~ 0.9%
run = 244359
	 N entries = 1.4M 	 err ~ 0.8%
	 N entries (10) = 116k 	 err ~ 2.8%
run = 244364
	 N entries = 638k 	 err ~ 1.2%
	 N entries (10) = 472k 	 err ~ 1.4%
	 N entries (15) = 1.9M 	 err ~ 0.7%
run = 244377
	 N entries = 2.5M 	 err ~ 0.6%
	 N entries (10) = 370k 	 err ~ 1.6%
	 N entries (15) = 1.5M 	 err ~ 0.8%
run = 244416
	 N entries = 1.1M 	 err ~ 0.9%
	 N entries (10) = 228k 	 err ~ 2.0%
	 N entries (15) = 904k 	 err ~ 1.0%
run = 244421
	 N entries = 343k 	 err ~ 1.6%
	 N entries (10) = 62k 	 err ~ 3.8%
	 N entries (15) = 255k 	 err ~ 1.9%
run = 244453
	 N entries = 2.3M 	 err ~ 0.6%
	 N entries (15) = 1.4M 	 err ~ 0.8%
run = 244456
	 N entries = 1.5M 	 err ~ 0.8%
	 N entries (10) = 227k 	 err ~ 2.0%
	 N entries (15) = 895k 	 err ~ 1.0%
run = 244480
	 N entries = 4.4M 	 err ~ 0.5%
	 N entries (10) = 647k 	 err ~ 1.2%
	 N entries (15) = 2.6M 	 err ~ 0.6%
run = 244481
	 N entries = 775k 	 err ~ 1.1%
	 N entries (10) = 111k 	 err ~ 2.8%
	 N entries (15) = 456k 	 err ~ 1.4%
run = 244482
	 N entries = 1.6M 	 err ~ 0.7%
	 N entries (10) = 531k 	 err ~ 1.3%
	 N entries (15) = 2.1M 	 err ~ 0.6%
run = 244483
	 N entries = 488k 	 err ~ 1.4%
	 N entries (15) = 300k 	 err ~ 1.7%
run = 244484
	 N entries = 10M 	 err ~ 0.3%
	 N entries (10) = 1.6M 	 err ~ 0.7%
	 N entries (15) = 4.9M 	 err ~ 0.4%
run = 244531
	 N entries = 5.8M 	 err ~ 0.4%
	 N entries (10) = 897k 	 err ~ 1.0%
	 N entries (15) = 3.6M 	 err ~ 0.5%
run = 244540
	 N entries = 10M 	 err ~ 0.3%
	 N entries (10) = 1.6M 	 err ~ 0.8%
	 N entries (15) = 6.4M 	 err ~ 0.4%
run = 244542
	 N entries = 4.3M 	 err ~ 0.5%
	 N entries (10) = 694k 	 err ~ 1.1%
	 N entries (15) = 2.8M 	 err ~ 0.6%
run = 244617
	 N entries = 252k 	 err ~ 1.9%
	 N entries (10) = 41k 	 err ~ 4.7%
	 N entries (15) = 164k 	 err ~ 2.3%
run = 244618
	 N entries = 66k 	 err ~ 3.7%
	 N entries (10) = 10k 	 err ~ 9.4%
	 N entries (15) = 40k 	 err ~ 4.7%
run = 244619
	 N entries = 2.7M 	 err ~ 0.6%
	 N entries (15) = 1.7M 	 err ~ 0.7%
run = 244626
	 N entries = 2.6M 	 err ~ 0.6%
	 N entries (10) = 392k 	 err ~ 1.5%
	 N entries (15) = 1.6M 	 err ~ 0.8%
run = 244627
	 N entries = 2.0M 	 err ~ 0.7%
	 N entries (10) = 289k 	 err ~ 1.8%
	 N entries (15) = 1.2M 	 err ~ 0.9%
run = 244628
	 N entries = 1.1M 	 err ~ 0.9%
	 N entries (10) = 157k 	 err ~ 2.4%
	 N entries (15) = 627k 	 err ~ 1.2%
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin15/myOutputDir/244359/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244453/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244483/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244619/AnalysisResults.root not a ROOT file
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c1244628

Low pT

In [21]:
nbins = 90
cut = 'Jet_Track_Pt < 1'


for run in [r[3:] for r in os.listdir('../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/') if r.startswith('000')]:
    print(f'run = {run}')
    f_data = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000{run}/AnalysisResults.root')
    t_data = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')

    # ROOT.gROOT.Reset()
    c1 = ROOT.TCanvas( 'c1'+run, 'c1'+run, 900, 500 )
    c1.Draw()
    h_track_phi = ROOT.TH1D('h_data', 'h_data', nbins, 0, 6.283)
    h_track_phi.GetXaxis().SetTitle(f'track phi')
    h_track_phi.SetTitle(f'track phi {run}')
    h_track_phi.SetLineColor(2)
    h_track_phi.SetLineWidth(3)

    t_data.Draw('Jet_Track_Phi >> h_data', cut, 'e,goff')
    n = h_track_phi.GetEntries()
    print(f'\t N entries = {format_num(n)} \t err ~ {np.sqrt(n/nbins)/(n/nbins)*100:.1f}%')    
    h_track_phi.Scale(nbins/h_track_phi.Integral())
    h_track_phi.SetMinimum(nbins/nbins*0.91)
    h_track_phi.SetMaximum(nbins/nbins*1.09)
    h_track_phi.DrawCopy('le')


    ROOT.gStyle.SetPalette(55)
    for i,ptbin in enumerate([ '10', '15']):
        try:
            f_mc = ROOT.TFile(f'../../HF-jets/ana_results/iter2/LHC16h3/ptbin{ptbin}/myOutputDir/{run}/AnalysisResults.root')
            t_mc = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_udsgJets')
            h_track_phi_mc = ROOT.TH1D(f'h_mc_ptbin{ptbin}', f'h_mc_ptbin{ptbin}', nbins, 0, 6.283)
            h_track_phi_mc.SetLineColor(ROOT.gStyle.GetColorPalette(i*200))
            h_track_phi.SetLineWidth(2)
            t_mc.Draw(f'Jet_Track_Phi >> h_mc_ptbin{ptbin}', cut, 'e,goff')
        except: 
            f_mc.Close()
            continue
        n = float(h_track_phi_mc.GetEntries())
        print(f'\t N entries ({ptbin}) = {format_num(n)} \t err ~ {np.sqrt(n/nbins)/(n/nbins)*100:.1f}%')
        h_track_phi_mc.Scale(nbins/h_track_phi_mc.Integral())
        opt='le,same'
        h_track_phi_mc.DrawCopy(opt)
        f_mc.Close()
    c1.GetPad(0).BuildLegend(0.55, 0.775, 0.78, 0.935)
    f_data.Close()
run = 244340
	 N entries = 817k 	 err ~ 1.0%
	 N entries (10) = 212k 	 err ~ 2.1%
	 N entries (15) = 717k 	 err ~ 1.1%
run = 244351
	 N entries = 4.8M 	 err ~ 0.4%
	 N entries (10) = 178k 	 err ~ 2.2%
	 N entries (15) = 596k 	 err ~ 1.2%
run = 244355
	 N entries = 774k 	 err ~ 1.1%
	 N entries (10) = 62k 	 err ~ 3.8%
	 N entries (15) = 210k 	 err ~ 2.1%
run = 244359
	 N entries = 1.1M 	 err ~ 0.9%
	 N entries (10) = 28k 	 err ~ 5.6%
run = 244364
	 N entries = 530k 	 err ~ 1.3%
	 N entries (10) = 117k 	 err ~ 2.8%
	 N entries (15) = 386k 	 err ~ 1.5%
run = 244377
	 N entries = 2.1M 	 err ~ 0.7%
	 N entries (10) = 91k 	 err ~ 3.1%
	 N entries (15) = 308k 	 err ~ 1.7%
run = 244416
	 N entries = 889k 	 err ~ 1.0%
	 N entries (10) = 56k 	 err ~ 4.0%
	 N entries (15) = 186k 	 err ~ 2.2%
run = 244421
	 N entries = 286k 	 err ~ 1.8%
	 N entries (10) = 15k 	 err ~ 7.7%
	 N entries (15) = 52k 	 err ~ 4.2%
run = 244453
	 N entries = 1.9M 	 err ~ 0.7%
	 N entries (15) = 288k 	 err ~ 1.8%
run = 244456
	 N entries = 1.3M 	 err ~ 0.8%
	 N entries (10) = 56k 	 err ~ 4.0%
	 N entries (15) = 184k 	 err ~ 2.2%
run = 244480
	 N entries = 3.7M 	 err ~ 0.5%
	 N entries (10) = 160k 	 err ~ 2.4%
	 N entries (15) = 525k 	 err ~ 1.3%
run = 244481
	 N entries = 644k 	 err ~ 1.2%
	 N entries (10) = 28k 	 err ~ 5.7%
	 N entries (15) = 94k 	 err ~ 3.1%
run = 244482
	 N entries = 1.4M 	 err ~ 0.8%
	 N entries (10) = 132k 	 err ~ 2.6%
	 N entries (15) = 441k 	 err ~ 1.4%
run = 244483
	 N entries = 405k 	 err ~ 1.5%
	 N entries (15) = 62k 	 err ~ 3.8%
run = 244484
	 N entries = 8.7M 	 err ~ 0.3%
	 N entries (10) = 397k 	 err ~ 1.5%
	 N entries (15) = 1.0M 	 err ~ 0.9%
run = 244531
	 N entries = 4.8M 	 err ~ 0.4%
	 N entries (10) = 222k 	 err ~ 2.0%
	 N entries (15) = 735k 	 err ~ 1.1%
run = 244540
	 N entries = 8.4M 	 err ~ 0.3%
	 N entries (10) = 386k 	 err ~ 1.5%
	 N entries (15) = 1.3M 	 err ~ 0.8%
run = 244542
	 N entries = 3.6M 	 err ~ 0.5%
	 N entries (10) = 172k 	 err ~ 2.3%
	 N entries (15) = 573k 	 err ~ 1.3%
run = 244617
	 N entries = 209k 	 err ~ 2.1%
	 N entries (10) = 10k 	 err ~ 9.4%
	 N entries (15) = 34k 	 err ~ 5.2%
run = 244618
	 N entries = 55k 	 err ~ 4.1%
	 N entries (10) = 2.6k 	 err ~ 18.6%
	 N entries (15) = 8.4k 	 err ~ 10.4%
run = 244619
	 N entries = 2.3M 	 err ~ 0.6%
	 N entries (15) = 343k 	 err ~ 1.6%
run = 244626
	 N entries = 2.2M 	 err ~ 0.6%
	 N entries (10) = 97k 	 err ~ 3.0%
	 N entries (15) = 326k 	 err ~ 1.7%
run = 244627
	 N entries = 1.6M 	 err ~ 0.7%
	 N entries (10) = 71k 	 err ~ 3.5%
	 N entries (15) = 239k 	 err ~ 1.9%
run = 244628
	 N entries = 873k 	 err ~ 1.0%
	 N entries (10) = 38k 	 err ~ 4.8%
	 N entries (15) = 128k 	 err ~ 2.6%
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin15/myOutputDir/244359/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244453/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244483/AnalysisResults.root not a ROOT file
Error in <TFile::Init>: ../../HF-jets/ana_results/iter2/LHC16h3/ptbin10/myOutputDir/244619/AnalysisResults.root not a ROOT file
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c1244628

QA for 244456 and 244453 (Ad 2)

Event properties

In [3]:
%jsroot off
In [4]:
data_files = glob.glob('../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/*/AnalysisResults.root')

for i,run_file in [f for f in enumerate(data_files)]:
#     ROOT.gROOT.Reset()
    print(f'{run_file}, {i+1}/{len(data_files)}')
    run = run_file.split('/')[-2]
    f_run = ROOT.TFile(run_file)
    f_run.Close() 
    # kernel sometimes crashes...
#     continue
    f_run = ROOT.TFile(run_file)

#     continue
    t_run = ROOT.gROOT.FindObject('JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_allJets')
    
    
    c = ROOT.TCanvas( 'c_'+run, 'c_'+run, 200, 10, 950, 400 )
    c.Draw()
    pad1 = ROOT.TPad("pad1"+run, "pad1"+run, 0, 0, 0.5, 1)
#     pad1.SetGridx()
    pad1.Draw()
    # Lower ratio plot is pad2
    c.cd()  # returns to main canvas before defining pad2
    pad2 = ROOT.TPad("pad2"+run, "pad2"+run, 0.5, 0, 1, 1)
#     pad2.SetBottomMargin(0.2)
#     pad2.SetGridx()
    pad2.Draw()
    
    cut = 'Jet_Pt > 5'
    pad1.cd()
    h_2d = ROOT.TH2D('h_2d', 'h_2d', 100, 0.29, 0.38, 100, 0.02, 0.13)
    h_2d.SetTitle(run)
    h_2d.GetXaxis().SetTitle('vertex X')
    h_2d.GetYaxis().SetTitle('vertex Y')
    
    t_run.Draw('Event_Vertex_X:Event_Vertex_Y >> h_2d', cut, 'goff')
    h_2d.DrawCopy('colz')

#     c2 = ROOT.TCanvas( 'c_2_'+run, 'c_2_'+run, 200, 10, 700, 500 )
#     c2.Draw()
    pad2.cd()
    pad2.SetLogy(1)
#     h_jet_pt = ROOT.TH1D('h_jet_pt', 'h_jet_pt', 100, 0, 100)
#     h_jet_pt.SetTitle(run)
#     h_jet_pt.GetXaxis().SetTitle('jet pt')
#     t_run.Draw('Jet_Pt >> h_jet_pt', cut, 'goff')
#     h_jet_pt.DrawCopy()
    h1 = ROOT.TH1D('h1', 'h1', 100, 0, 100)
    h1.SetTitle(run)
    h1.GetXaxis().SetTitle('event multiplicity')
    t_run.Draw('Event_Multiplicity >> h1', cut, 'goff')
    h1.DrawCopy()

    
    print('done')
    f_run.Close()
    
#     canvases.append(c)
#     canvases.append(c2)
    
# ROOT.gROOT.GetListOfCanvases().Draw()
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244340/AnalysisResults.root, 1/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244351/AnalysisResults.root, 2/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244355/AnalysisResults.root, 3/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244359/AnalysisResults.root, 4/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244364/AnalysisResults.root, 5/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244377/AnalysisResults.root, 6/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244416/AnalysisResults.root, 7/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244421/AnalysisResults.root, 8/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244453/AnalysisResults.root, 9/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244456/AnalysisResults.root, 10/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244480/AnalysisResults.root, 11/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244481/AnalysisResults.root, 12/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244482/AnalysisResults.root, 13/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244483/AnalysisResults.root, 14/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244484/AnalysisResults.root, 15/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244531/AnalysisResults.root, 16/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244540/AnalysisResults.root, 17/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244542/AnalysisResults.root, 18/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244617/AnalysisResults.root, 19/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244618/AnalysisResults.root, 20/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244619/AnalysisResults.root, 21/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244626/AnalysisResults.root, 22/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244627/AnalysisResults.root, 23/24
done
../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/000244628/AnalysisResults.root, 24/24
done
Warning in <TClass::Init>: no dictionary for class AliEmcalList is available

Position of 244456 on the distirbution

In [3]:
def read_branch(datafiles, jet_type, var, entrystop=None, entrystart=None, verbose=False, apply_func=None, cache=None):
    
    if hasattr(datafiles, '__iter__') and type(datafiles) != str:
        # multiple datafiles
        vals = np.array([])
        for f in datafiles:
            if verbose: print(f)
            kwargs = dict(datafiles=f, jet_type=jet_type, var=var, entrystop=entrystop, entrystart=entrystart, verbose=verbose, apply_func=apply_func, cache=cache)
            v = read_branch(**kwargs)
            vals = np.hstack([vals, v])
        return vals
            
    # single datafile
    froot = uproot.open(datafiles)
    if any(['JetPY' in str(k) for k in froot.keys()]):
        tree_name_core = 'JetTree_AliAnalysisTaskJetExtractor_JetPY_AKTChargedR040_tracks_pT0150_E_scheme_'
    else: 
        tree_name_core = 'JetTree_AliAnalysisTaskJetExtractor_Jet_AKTChargedR040_tracks_pT0150_E_scheme_'
        
    if apply_func:
        v0 = froot[tree_name_core+jet_type].array(var, flatten=False, entrystop=entrystop, entrystart=entrystart, cache=cache)
        vals = [apply_func(arr) if len(arr) else 0 for arr in v0]
    else:
        vals = froot[tree_name_core+jet_type].array(var, flatten=True  , entrystop=entrystop, entrystart=entrystart, cache=cache)

    return vals
In [9]:
data_files = glob.glob('../../HF-jets/ana_results/iter2/LHC15n/myOutputDir/*/AnalysisResults.root')
for var in ['Event_Vertex_X', 'Event_Vertex_Y', 'Event_Multiplicity', 
#             'Event_BackgroundDensity', 'Event_BackgroundDensityMass',
            'Jet_Pt', 
            'Jet_Phi', 'Jet_Eta', 
            'Jet_Area', 
            'Jet_NumTracks',
            'Jet_NumSecVertices',]:
    
    print(var)
    means, stds = [], []
    for f in data_files:
        vals = read_branch(f, 'allJets', var)
        mean, std = np.mean(vals), np.std(vals)
        means.append(mean)
        stds.append(std)
#         print(f'{f.split("000")[1][:6]}: {mean:.4f}, {std:.4f}')
        
        if '244456' in f: mean244456, std244456 = mean, std
        if '244453' in f: mean244453, std244453 = mean, std
        
    fig,axes = plt.subplots(ncols=2, figsize=(10,5))
    axes[0].hist(means, bins=15, histtype='step', linewidth=2)
    axes[1].hist(stds, bins=15, histtype='step', linewidth=2)
    axes[0].set_title('mean')
    axes[1].set_title('std')
    fig.suptitle(var)
    
    xlim, ylim = axes[0].get_xlim(), axes[0].get_ylim()
    deltax, deltay = xlim[1] - xlim[0] , ylim[1] - ylim[0]
#     axes[0].set_xlim(xlim[0]-0.2*deltax, xlim[1]+0.2*deltax)
    axes[0].arrow(mean244456, ylim[1], 0, -0.4*deltay, width=0.02*deltax, head_width=0.05*deltax, head_length=0.05*deltay, color='red')
    axes[0].arrow(mean244453, ylim[1], 0, -0.4*deltay, width=0.015*deltax, head_width=0.04*deltax, head_length=0.05*deltay, color='orange')
              
    xlim, ylim = axes[1].get_xlim(), axes[1].get_ylim()
    deltax, deltay = xlim[1] - xlim[0] , ylim[1] - ylim[0]
#     axes[1].set_xlim(xlim[0]-0.2*deltax, xlim[1]+0.2*deltax)
    axes[1].arrow(std244456, ylim[1], 0, -0.4*deltay, width=0.02*deltax, head_width=0.05*deltax, head_length=0.05*deltay, color='red')
    axes[1].arrow(std244453, ylim[1], 0, -0.4*deltay, width=0.015*deltax, head_width=0.04*deltax, head_length=0.05*deltay, color='orange')
              
Event_Vertex_X
Event_Vertex_Y
Event_Multiplicity
Jet_Pt
Jet_Phi
Jet_Eta
Jet_Area
Jet_NumTracks
Jet_NumSecVertices
In [ ]: