Skip to content

Commit 578e3ec

Browse files
committed
Bars analysis added
1 parent 0efe7a6 commit 578e3ec

File tree

9 files changed

+361
-133
lines changed

9 files changed

+361
-133
lines changed

.ipynb_checkpoints/TimeRes_explorer-checkpoint.ipynb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 12,
5+
"execution_count": 1,
66
"metadata": {},
7-
"outputs": [],
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"Welcome to JupyROOT 6.10/08\n"
13+
]
14+
}
15+
],
816
"source": [
917
"import numpy as np\n",
1018
"from scipy.interpolate import PchipInterpolator\n",
11-
"import matplotlib.pyplot as plt\n",
19+
"import matplotlib.pyplot as plt \n",
1220
"from lib.histo_utilities import create_TH1D\n",
1321
"import ROOT as rt\n",
1422
"from prettytable import PrettyTable"
@@ -27,11 +35,11 @@
2735
},
2836
{
2937
"cell_type": "code",
30-
"execution_count": 3,
38+
"execution_count": 4,
3139
"metadata": {},
3240
"outputs": [],
3341
"source": [
34-
"fname = '../../../www/FNAL_TB_1811/vr2/Run_1694-1733_Analysis_SiPM_Tile_vr2/TimeResolution_ch14.txt'\n",
42+
"fname = '../../../www/FNAL_TB_1811/vr2/Run_1694-1733_Analysis_SiPM_Tile_vr2/TimeResolution_ch14_FullRefScan.txt'\n",
3543
"d = []\n",
3644
"\n",
3745
"with open(fname, 'r') as f:\n",
@@ -45,7 +53,7 @@
4553
},
4654
{
4755
"cell_type": "code",
48-
"execution_count": 4,
56+
"execution_count": 5,
4957
"metadata": {},
5058
"outputs": [
5159
{
@@ -63,7 +71,7 @@
6371
},
6472
{
6573
"cell_type": "code",
66-
"execution_count": 71,
74+
"execution_count": 6,
6775
"metadata": {},
6876
"outputs": [
6977
{
@@ -112,7 +120,7 @@
112120
},
113121
{
114122
"cell_type": "code",
115-
"execution_count": 93,
123+
"execution_count": null,
116124
"metadata": {},
117125
"outputs": [],
118126
"source": [

Analysis_SiPM_Bar.py

Lines changed: 263 additions & 89 deletions
Large diffs are not rendered by default.

Analysis_SiPM_Tile.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def fill_TimeResHisto(k, dt, h2D, out_list, tagin, title_tag, canvas, save_canva
318318
line.SetLineWidth(2)
319319
line.SetLineStyle(10)
320320

321-
selection = '1'
321+
selection = '(amp[{nch}] != 0 && integral[{nch}] != 0)'.format(nch=k)
322322

323323
'''=========================== Amplitude ==========================='''
324324
if 'Amp' in configurations.plots:
@@ -582,10 +582,10 @@ def fill_TimeResHisto(k, dt, h2D, out_list, tagin, title_tag, canvas, save_canva
582582

583583

584584
if 'PosWeight' in configurations.plots:
585-
''' -------------Avg amp-----------'''
586585
h = rt.TH2D('h_amp_aux'+str(k), title, N_bins[0], -width+dx, width+dx, N_bins[1], -width+dy, width+dy)
587586
chain.Project('h_amp_aux'+str(k), var, selection)
588587

588+
''' -------------Avg amp-----------'''
589589
name = 'h_amp_weight_pos_'+str(k)
590590
title = 'Average peak amplitude channel {} in selected event'.format(k)
591591
h_w = rt.TH2D(name, title, N_bins[0], -width+dx, width+dx, N_bins[1], -width+dy, width+dy)
@@ -665,14 +665,49 @@ def fill_TimeResHisto(k, dt, h2D, out_list, tagin, title_tag, canvas, save_canva
665665
chain.Project(name, var, weights)
666666

667667
h_w.Divide(h)
668-
h_w.GetZaxis().SetRangeUser(h_w.GetMaximum()*0.8, h_w.GetMaximum())
668+
arr, pos = rootTH2_to_np(h_w)
669+
arr = arr[arr!=0]
670+
h_w.GetZaxis().SetRangeUser(np.percentile(arr,10), np.percentile(arr,99))
669671
h_w.SetStats(0)
670672
canvas['int_w_pos'][k] = rt.TCanvas('c_int_w_pos_'+str(k), 'c_int_w_pos_'+str(k), 800, 600)
671673
h_w.DrawCopy('colz')
672674
Set_2D_colz_graphics()
673675
canvas['int_w_pos'][k].Update()
674676
canvas['int_w_pos'][k].SaveAs(out_dir + '/PositionXY_int_weight_ch{:02d}.png'.format(k))
675677

678+
''' -------------Avg risetime-----------'''
679+
name = 'h_risetime_weight_pos_'+str(k)
680+
title = 'Average risetime channel {} in selected event'.format(k)
681+
h_w = rt.TH2D(name, title, N_bins[0], -width+dx, width+dx, N_bins[1], -width+dy, width+dy)
682+
h_w.SetXTitle('x [mm]')
683+
h_w.SetYTitle('y [mm]')
684+
h_w.SetZTitle('Average risetime [mV/ns]')
685+
686+
weights = '('+ selection +') * -risetime[' + str(k) + ']'
687+
chain.Project(name, var, weights)
688+
689+
h_w.Divide(h)
690+
arr, pos = rootTH2_to_np(h_w)
691+
arr = arr[arr!=0]
692+
h_w.GetZaxis().SetRangeUser(np.percentile(arr,10), np.percentile(arr,99))
693+
h_w.SetStats(0)
694+
canvas['int_w_pos'][k] = rt.TCanvas('c_risetime_w_pos_'+str(k), 'c_risetime_w_pos_'+str(k), 800, 600)
695+
h_w.DrawCopy('colz')
696+
Set_2D_colz_graphics()
697+
if not conf['SiPM'] == 'None':
698+
x_start, x_stop, y_start, y_stop = conf['SiPM_sel']['limits']
699+
700+
line.SetLineStyle(9)
701+
line.SetLineColor(46)
702+
line.SetLineWidth(2)
703+
line.DrawLine(x_start, y_start, x_stop, y_start)
704+
line.DrawLine(x_start, y_stop, x_stop, y_stop)
705+
line.DrawLine(x_start, y_start, x_start, y_stop)
706+
line.DrawLine(x_stop, y_start, x_stop, y_stop)
707+
708+
canvas['int_w_pos'][k].Update()
709+
canvas['int_w_pos'][k].SaveAs(out_dir + '/PositionXY_risetime_weight_ch{:02d}.png'.format(k))
710+
676711
'''=========================== End Selections ==========================='''
677712
conf['sel'] = selection
678713
# print conf['sel']
@@ -730,7 +765,8 @@ def fill_TimeResHisto(k, dt, h2D, out_list, tagin, title_tag, canvas, save_canva
730765
s2 = '{y} < {y2}-{d} && {y} > {y1}+{d} && {x} < {x2}-{d} && {x} > {x1}+{d}'
731766
s = '!({} && !({}))'.format(s1, s2)
732767
# s = '!({})'.format(s1)
733-
# selection += ' && ' + s.format(x=conf['x_rot'], y = conf['y_rot'], d=0.25, x1=x1, x2=x2, y1=y1, y2=y2)
768+
selection += ' && ' + s.format(x=conf['x_rot'], y = conf['y_rot'], d=0.25, x1=x1, x2=x2, y1=y1, y2=y2)
769+
734770
# selection += ' && ' + configurations.channel[kk]['SiPM_sel']['cut']
735771

736772
if chain.GetEntries(selection) < 5:
@@ -854,7 +890,7 @@ def fill_TimeResHisto(k, dt, h2D, out_list, tagin, title_tag, canvas, save_canva
854890
ResRaw, 'TimeResRaw2D',
855891
'Raw',
856892
canvas,
857-
not 'TimeRes2DAmp' in configurations.plots)
893+
not ('TimeRes2DAmp' in configurations.plots))
858894

859895

860896
if 'TimeRes2DAmp' in configurations.plots:

DQM_SiPM.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,5 +793,8 @@ def create_regression_input(x, y, amp):
793793
os.system('touch '+file)
794794
if not (int(f_aux) in np.loadtxt(file).astype(np.int)):
795795
cmd = 'echo ' + f_aux + ' >> ' + file
796-
print cmd
796+
if aux > 0.3:
797+
print 'Run failed tracks consistency'
798+
else:
799+
print 'Run passed tracks consistency'
797800
os.system(cmd)

TimeRes_explorer.ipynb

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
-->Print: AllTracks Amp Int PosRaw PosSel+ PosWeight TimeResRaw TimeResRaw2D TimeRes2DAmp
2-
-->XYcenter-width: 15 25 10
2+
-->XYcenter-width: 12 21 20 5
3+
-->SpaceBinSize: 1.
34
-->TracksCleaning: CutOnCh9 ntracks==1 chi2<5
4-
-->Var_photek: gaus_mean IL_30 IL_50 IL_60 LP1_30 LP1_50 LP1_60 FL_30 FL_50 FL_60
5+
-->Var_photek: gaus_mean
6+
#-->Var_photek: gaus_mean LP1_50 LP1_60 FL_50
57
-->Var_amp: None
6-
-->Var_time: LP2_10 LP2_20 LP2_30 LP2_40 LP2_50 LP2_60 LP2_50mV LP2_100mV LP2_150mV LP2_200mV LP2_250mV LP2_300mV LP2_350mV LP2_400mV LP2_450mV LP2_500mV LP2_550mV LP2_600mV LP2_650mV LP2_700mV LP1_10 LP1_20 LP1_30 LP1_40 LP1_50 LP1_60 LP1_50mV LP1_100mV LP1_150mV LP1_200mV LP1_250mV LP1_300mV LP1_350mV LP1_400mV LP1_450mV LP1_500mV LP1_550mV LP1_600mV LP1_650mV LP1_700mV IL_10 IL_20 IL_30 IL_40 IL_50 IL_60 IL_50mV IL_100mV IL_150mV IL_200mV IL_250mV IL_300mV IL_350mV IL_400mV IL_450mV IL_500mV IL_550mV IL_600mV IL_650mV IL_700mV FL_10 FL_20 FL_30 FL_40 FL_50 FL_60 FL_50mV FL_100mV FL_150mV FL_200mV FL_250mV FL_300mV FL_350mV FL_400mV FL_450mV FL_500mV FL_550mV FL_600mV FL_650mV FL_700mV
8+
#-->Var_time: LP2_2 LP2_3 LP2_5 LP2_7 LP2_10 LP2_5mV LP2_10mV LP2_20mV LP2_30mV LP2_50mV LP2_100mV LP1_40 LP1_50 LP1_60 LP1_300mV LP1_350mV LP1_400mV LP1_450mV LP1_500mV LP1_550mV LP1_600mV FL_40 FL_50 FL_60 FL_300mV FL_350mV FL_400mV FL_450mV FL_500mV FL_550mV FL_600mV
9+
#-->Var_time: LP1_40 LP1_50 LP1_60 LP1_400mV LP1_500mV LP1_600mV FL_40 FL_50 FL_60 FL_400mV FL_500mV FL_600mV
10+
-->Var_time: LP1_50
711
ch_num idx_time idx_dut idx_ref type cut min max shape
812
9 1 0 -1 photek I 0 200 None
9-
14 1 0 9 timeL A 600 1200 32x5
10-
15 1 0 9 timeR A 600 1200 32x5
11-
18 2 -1 -1 photek I 0 200 None
12-
24 2 0 18 time&amp14 A 200 800 32x5
13-
25 2 0 18 time&amp15 A 200 800 32x5
13+
14 1 0 9 time1L A 600 1200 34x3
14+
15 1 0 9 time1R A 600 1200 34x3
15+
#18 2 -1 -1 photek I 0 200 None
16+
24 2 0 18 amp14 A 200 800 34x3
17+
25 2 0 18 amp15 A 200 800 34x3
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
-->Print: AllTracks Amp Int PosRaw PosSel+ PosWeight TimeResRaw TimeResRaw2D TimeRes2DAmp
22
-->XYcenter-width: 15 25 10
3-
-->SpaceBinSize: 1.
3+
-->SpaceBinSize: 0.5
44
-->TracksCleaning: CutOnCh9 ntracks==1 chi2<5
55
-->Var_photek: gaus_mean
66
#-->Var_photek: gaus_mean LP1_50 LP1_60 FL_50
77
-->Var_amp: None
88
#-->Var_time: LP2_2 LP2_3 LP2_5 LP2_7 LP2_10 LP2_5mV LP2_10mV LP2_20mV LP2_30mV LP2_50mV LP2_100mV LP1_40 LP1_50 LP1_60 LP1_300mV LP1_350mV LP1_400mV LP1_450mV LP1_500mV LP1_550mV LP1_600mV FL_40 FL_50 FL_60 FL_300mV FL_350mV FL_400mV FL_450mV FL_500mV FL_550mV FL_600mV
99
#-->Var_time: LP1_40 LP1_50 LP1_60 LP1_400mV LP1_500mV LP1_600mV FL_40 FL_50 FL_60 FL_400mV FL_500mV FL_600mV
10-
-->Var_time: LP2_3 LP1_50 FL_50
10+
-->Var_time: LP1_50
1111
ch_num idx_time idx_dut idx_ref type cut min max shape SiPM
1212
9 1 0 -1 photek I 0 200 None None
1313
14 1 0 9 time A 600 1200 8x8 None
1414
15 1 0 9 time A 600 1200 11x7 None
15-
18 2 -1 -1 photek I 0 200 None None
16-
24 2 0 18 time&amp14 A 200 800 8x8 3x3
17-
25 2 0 18 time&amp15 A 200 800 11x7 3x3
15+
#18 2 -1 -1 photek I 0 200 None None
16+
24 2 0 18 amp14 A 200 800 8x8 3x3
17+
25 2 0 18 amp15 A 200 800 11x7 3x3

config/FNAL_TB_1811/VME_vr4.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
-->TracksConsistency: RefCh9 List
66
ch_num idx_time idx_dut idx_ref var_ref cut min max shape
77
9 1 0 -1 gaus_mean I 0 200 None
8-
14 1 0 -1 None A 600 1200 32x3
9-
15 1 0 -1 None A 600 1200 32x3
8+
14 1 0 -1 None A 600 1200 34x3
9+
15 1 0 -1 None A 600 1200 34x3
1010
18 2 -1 -1 gaus_mean I 0 200 None
11-
24 2 0 -1 None A 200 800 32x3
12-
25 2 0 -1 None A 200 800 32x3
11+
24 2 0 -1 None A 200 800 34x3
12+
25 2 0 -1 None A 200 800 34x3

lib/cebefo_style.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,8 @@ def cebefo_style():
159159

160160
#gSystem.ProcessEvents();
161161

162-
def Set_2D_colz_graphics():
163-
rt.gPad.SetRightMargin(0.16)
162+
def Set_2D_colz_graphics(pad=None):
163+
if pad == None:
164+
rt.gPad.SetRightMargin(0.16)
165+
else:
166+
pad.SetRightMargin(0.16)

0 commit comments

Comments
 (0)