Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • build_cleanup
  • main
  • v1_obsoleted
  • mark_original_version
4 results

Target

Select target project
  • cherenkov/fadc_decoder
  • zwzhao/fadc_decoder
2 results
Select Git revision
  • master
  • patch-1
  • mark_original_version
3 results
Show changes
Commits on Source (33)
Showing
with 1064 additions and 1732 deletions
#!/bin/python3
import os
import argparse
import fnmatch
from collections import OrderedDict
ANALYZE_BIN = 'build/src/analyze'
# get split number of raw data
def get_split_number(fname):
try:
return int(fname.split('.')[-1])
except:
return -1
# find data
def search_raw_data(dirname, pattern, nmax):
files = []
for f in os.listdir(dirname):
if fnmatch.fnmatch(f, pattern):
files.append(os.path.join(dirname, f))
if nmax > 0 and len(files) >= nmax:
break;
return sorted(files, key=get_split_number)
def analysis_pipeline(raw_data, proc_data, modules, layouts, **kwargs):
run = kwargs['run']
# format commands
commands = OrderedDict()
# analyze data
binary = ANALYZE_BIN
arguments = [
'--module=database/modules/{}_module.json'.format(modules.lower()),
'-r {res} -t {thres} -p {npeds} -f {flat}'.format(**kwargs),
]
commands['analyze'] = [
'{} {} {} {}'.format(binary, raw, proc, ' '.join(arguments))
for raw, proc in zip(raw_data, proc_data)
]
# draw raw event samples
binary = 'python3 scripts/draw_events.py'
samples_dir = 'plots/run{}/samples'.format(run)
arguments = [
'--plot-dir={}'.format(samples_dir),
'-r {res} -t {thres} -p {npeds} -f {flat}'.format(**kwargs),
]
commands['draw_samples'] = [
'{} {} {} {}'.format(binary, layout.upper(), proc_data[0], ' '.join(arguments))
for layout in layouts
]
# raw distributions
binary = 'python3 scripts/plot_dist.py'
json_file = 'database/{}_raw_dist.json'.format(modules.lower())
rawdist_dir = 'plots/run{}/raw'.format(run)
arguments = [
'--plot-dir={}'.format(rawdist_dir),
'--root-plots',
]
commands['raw_dist'] = [
'{} {} {} {}'.format(binary, proc_data[0], json_file, ' '.join(arguments))
]
# trigger timing cut
binary = 'python3 scripts/trigger_timing_cuts.py'
tcuts_json = os.path.join('database', 'run{}_timing.json'.format(run))
trg_data = os.path.join('processed_data', 'run{}_trg.root'.format(run))
tcuts_dir = 'plots/run{}/tcuts'.format(run)
arguments= [
'--files={}'.format(','.join(proc_data)),
'--snapshot={}'.format(trg_data),
'--plot-dir={}'.format(tcuts_dir),
'-b',
]
commands['trg_tcuts'] = [
'{} {} {} {}'.format(binary, modules.upper(), tcuts_json, ' '.join(arguments))
]
# signal timing cut
binary = 'python3 scripts/signal_timing_cuts.py'
tcuts_data = os.path.join('processed_data', 'run{}_tcuts.root'.format(run))
arguments= [
'--snapshot={}'.format(tcuts_data),
'--plot-dir={}'.format(tcuts_dir),
'-b',
]
commands['signal_tcuts'] = [
'{} {} {} {} {}'.format(binary, modules.upper(), trg_data, tcuts_json, ' '.join(arguments))
]
# signal sums
binary = 'python scripts/plot_sum.py'
res_dir = 'plots/run{}/results'.format(run)
arguments = [
'--plot-dir={}'.format(res_dir),
]
commands['signal_sum'] = [
'{} {} {} {}'.format(binary, modules.upper(), tcuts_data, ' '.join(arguments))
]
return commands, [res_dir, tcuts_dir, rawdist_dir, samples_dir]
# execute the script
if __name__ == '__main__':
owd = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(script_dir, '..'))
print('working directory is ' + os.getcwd())
signal_types = {
'LAPPD': ['CALORIMETER', 'LAPPD'],
'MAPMT': ['CALORIMETER', 'MAPMT_SUMS', 'MAPMT_QUADS'],
}
# argument parser
parser = argparse.ArgumentParser('analyze and post plots')
parser.add_argument('stype', help='signal type')
parser.add_argument('run', help='run number to analyze')
parser.add_argument('--post', action='store_true', help='make a post to the logbook for the analysis')
parser.add_argument('--raw-dir', dest='raw_dir', default='./raw_data', help='raw data directory')
parser.add_argument('--proc-dir', dest='proc_dir', default='./processed_data', help='processed data directory')
parser.add_argument('-n', '--nsplit', dest='nsplit', type=int, default=-1,
help='maximum number of split evio files')
parser.add_argument('-r', type=int, default=1, dest='res',
help='spectrum resolution for analyzer')
parser.add_argument('-t', type=float, default=10.0, dest='thres',
help='spectrum peak height threshold resolution for analyzer')
parser.add_argument('-p', type=int, default=10, dest='npeds',
help='number of samples to check pedestal')
parser.add_argument('-f', type=float, default=2.0, dest='flat',
help='upper limit of the pedestal error (flatness requirement)')
args = parser.parse_args()
if args.stype not in signal_types:
print('signal type must be in {}'.format(list(signal_types)))
quit()
# recover paths
for attr in ['raw_dir', 'proc_dir']:
setattr(args, attr, os.path.join(owd, getattr(args, attr)))
# search raw data files
raw_data = search_raw_data(args.raw_dir, 'vtpCerenkov{}.dat.*'.format(args.run), args.nsplit)
if not len(raw_data):
print('no data found!')
quit()
# match processed data files
proc_data = [os.path.join(args.proc_dir, 'run{}_{}.root'.format(args.run, i)) for i, _ in enumerate(raw_data)]
commands, plot_dirs = analysis_pipeline(raw_data, proc_data, args.stype, signal_types[args.stype], **vars(args))
steps = [
'analyze',
'draw_samples',
'raw_dist',
'trg_tcuts',
'signal_tcuts',
'signal_sum',
]
for step in steps:
print('STEP - {}'.format(step))
for command in commands[step]:
print(command)
if os.system(command) != 0:
print('Failed at STEP - {}'.format(step))
exit(-1)
# make a post of the results
if args.post:
binary = '/site/ace/certified/apps/bin/logentry'
if not os.path.exists(binary):
print('Cannot find executable for posting logentry, abort posting.')
quit()
body_temp = 'body_temp.txt.tmp'
body = '<pre>\n'\
'{} split data files \n'\
'resolution: -r {res}\n'\
'threshold: -t {thres}\n'\
'pedestal window: -p {npeds}\n'\
'pedestal flatness: -f {flat}\n'\
'</pre>'.format(len(raw_data), **vars(args))
arguments = [
'-t \"Analysis plots: Run {}, Split 0 - {}\"'.format(args.run, len(raw_data) - 1),
'-b {}'.format(body_temp),
'-g \"Analysis\"',
'-l \"SOLID\"',
'--html',
'--noqueue',
# '--nosubmit',
]
# find all plots
for plot_dir in plot_dirs:
for (dirpath, dirnames, filenames) in os.walk(plot_dir):
for fname in filenames:
arguments.append('-a {}'.format(os.path.join(plot_dir, fname)))
os.system('echo \"{}\" > {}'.format(body, body_temp))
command = '{} {}'.format(binary, ' '.join(arguments))
print(command)
os.system(command)
{
"Calorimeter Center": {
"refs": "run{run}_timing.json",
"channels": [
[
"C9_1", "C9_2", "C9_3", "C9_4"
]
],
"plots": [
{
"title": "Calorimeter Center Timing Distribution",
"xlabel": "Sample Timing (ns)",
"ylabel": "Counts / 4 ns",
"normalized": false,
"yscale": "linear",
"hist_range": [64, 0, 256],
"fontsize": 22,
"save": "cal_center_time_comp.png",
"subs": [
{
"path": "processed_data/run{run}_{split}.root",
"func_code": "unpack_time({ch}.peaks, true)",
"color": "royalblue",
"histtype": "stepfilled",
"alpha": 0.7,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 0
},
{
"path": "processed_data/run{run}_{split}.root",
"func_code": "get_maximum_peak({ch}.peaks, time_cut, {cut}).time",
"filter_code": "get_maximum_peak({ch}.peaks, time_cut, {cut}).height > 0",
"color": "indianred",
"histtype": "stepfilled",
"alpha": 1.0,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 10
}
]
}
]
},
"MaPMT Sums": {
"channels": [
[
"Cer11_5", "Cer12_5", "Cer13_5", "Cer14_5",
"Cer21_5", "Cer22_5", "Cer23_5", "Cer24_5",
"Cer31_5", "Cer32_5", "Cer33_5", "Cer34_5",
"Cer41_5", "Cer42_5", "Cer43_5", "Cer44_5"
]
],
"plots": [
{
"title": "MaPMT Sum Peak Height Distribution",
"xlabel": "ADC Value",
"ylabel": "Counts / 20 ADC Channel",
"normalized": false,
"yscale": "log",
"hist_range": [110, 0, 2200],
"fontsize": 18,
"save": "sum_peak_height_comp.png",
"subs": [
{
"path": "processed_data/run{run}_tcuts.root",
"func_code": "{ch}_peak.height",
"filter_code": "{ch}_peak.height > 0",
"color": "indianred",
"histtype": "stepfilled",
"alpha": 1.0,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 10
},
{
"path": "processed_data/run{run}_trg.root",
"func_code": "unpack_height({ch}_p.peaks, true)",
"color": "royalblue",
"histtype": "stepfilled",
"alpha": 0.7,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 0
}
]
},
{
"title": "MaPMT Sum Peak Timing Distribution",
"xlabel": "Relative Timing to ECal (ns)",
"ylabel": "Counts / 4 ns",
"normalized": false,
"yscale": "linear",
"hist_range": [80, -160, 160],
"fontsize": 18,
"save": "sum_peak_time_comp.png",
"subs": [
{
"path": "processed_data/run{run}_tcuts.root",
"func_code": "{ch}_peak.time - ecal.time",
"filter_code": "{ch}_peak.height > 0",
"color": "indianred",
"histtype": "stepfilled",
"alpha": 1.0,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 10
},
{
"path": "processed_data/run{run}_trg.root",
"func_code": "unpack_time({ch}_p.peaks, true, ecal.time)",
"color": "royalblue",
"histtype": "stepfilled",
"alpha": 0.7,
"ls": "-",
"lw": 1,
"ec": "black",
"zorder": 0
}
]
}
]
}
}
{
"Calorimeter": {
"plots": [
{
"title": "ECal Number of Peaks (256 ns)",
"func_code": "{ch}.peaks.size()",
"xlabel": "Number of Peaks",
"ylabel": "Normalized Counts",
"hist_range": [10, -0.5, 9.5],
"path": "ecal_npeaks.png",
"filter_code": "{ch}.peaks.size() > 0"
},
{
"title": "ECal Number of Peaks (48 ns)",
"func_code": "count_following_peaks({ch}.peaks, 50) + 1",
"xlabel": "Number of Peaks",
"ylabel": "Normalized Counts",
"hist_range": [10, -0.5, 9.5],
"path": "ecal_npeaks_50ns.png",
"filter_code": "{ch}.peaks.size() > 0"
},
{
"title": "ECal Integral/Peak",
"func_code": "{ch}_mpeak.integral/{ch}_mpeak.height",
"xlabel": "Integral to Peak Ratio",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 20],
"path": "ecal_ratio.png",
"filter_code": "{ch}_mpeak.height > 0"
},
{
"title": "ECal Peak Heights",
"func_code": "unpack_height({ch}.peaks, true, 0., 0.001)",
"xlabel": "ADC Value / 1000",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 1],
"path": "ecal_pheights.png",
"filter_code": "{ch}_mpeak.height > 0"
},
{
"title": "ECal Peak Integrals",
"func_code": "unpack_integral({ch}.peaks, true, 0., 0.001)",
"xlabel": "Integrated ADC Value / 1000",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 3],
"path": "ecal_pintes.png",
"filter_code": "{ch}_mpeak.height > 0"
},
{
"title": "ECal Raw Integrals (256 ns)",
"func_code": "integrate_raw({ch}, 0, 63, 0.001)",
"xlabel": "Integrated ADC Value / 1000",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 3],
"path": "ecal_rawintes_256.png",
"filter_code": "{ch}.raw.size() > 0",
"pad_func": {
"SetLogy": [true]
}
},
{
"title": "ECal Raw Integrals (48 ns)",
"func_code": "integrate_raw({ch}, 10, 23, 0.001)",
"xlabel": "Integrated ADC Value / 1000",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 3],
"path": "ecal_rawintes.png",
"filter_code": "{ch}.raw.size() > 0",
"pad_func": {
"SetLogy": [true]
}
}
]
}
}
......@@ -3,7 +3,7 @@
"plots": [
{
"title": "Calorimeter Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -11,7 +11,7 @@
},
{
"title": "Calorimeter Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 500],
......@@ -23,7 +23,7 @@
"plots": [
{
"title": "Scintillator2 Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -31,7 +31,7 @@
},
{
"title": "Scintillator2 Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 500],
......@@ -43,7 +43,7 @@
"plots": [
{
"title": "LAPPD Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -51,7 +51,7 @@
},
{
"title": "LAPPD Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 100],
......
......@@ -3,7 +3,7 @@
"plots": [
{
"title": "Calorimeter Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -11,7 +11,7 @@
},
{
"title": "Calorimeter Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 500],
......@@ -23,7 +23,7 @@
"plots": [
{
"title": "Scintillator2 Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -31,7 +31,7 @@
},
{
"title": "Scintillator2 Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 500],
......@@ -43,7 +43,7 @@
"plots": [
{
"title": "MaPMT Sum Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -51,7 +51,7 @@
},
{
"title": "MaPMT Sum Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 2000],
......@@ -63,7 +63,7 @@
"plots": [
{
"title": "MaPMT Quad. Peak Time Distribution",
"func_code": "unpack_time({ch}, true)",
"func_code": "unpack_time({ch}.peaks, true)",
"xlabel": "Time (ns)",
"ylabel": "Counts",
"hist_range": [64, 0, 256],
......@@ -71,7 +71,7 @@
},
{
"title": "MaPMT Quad. Peak Height Distribution",
"func_code": "unpack_height({ch}, true)",
"func_code": "unpack_height({ch}.peaks, true)",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 2000],
......
{
"MaPMT Sums": {
"channels": [
[
"Cer11_5", "Cer12_5", "Cer13_5", "Cer14_5",
"Cer21_5", "Cer22_5", "Cer23_5", "Cer24_5",
"Cer31_5", "Cer32_5", "Cer33_5", "Cer34_5",
"Cer41_5", "Cer42_5", "Cer43_5", "Cer44_5"
]
],
"plots": [
{
"title": "MaPMT Sum Peak Time Distribution",
"func_code": "{ch}_peak.time - ecal.time",
"xlabel": "Time Rel. to ECal. (ns)",
"ylabel": "Counts",
"ylabel": "Normalized Counts",
"hist_range": [80, -160, 160],
"path": "sum_peak_time_tcuts.png",
"filter_code": "{ch}_peak.height > 0"
"filter_code": "{ch}_peak.height > 0",
"fontsize": 18,
"normalized": true
},
{
"title": "MaPMT Sum Peak Height Distribution",
"func_code": "{ch}_peak.height",
"xlabel": "ADC Value",
"ylabel": "Counts",
"hist_range": [100, 0, 2000],
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 2200],
"path": "sum_peak_height_tcuts.png",
"filter_code": "{ch}_peak.height > 0"
"filter_code": "{ch}_peak.height > 0",
"fontsize": 18,
"normalized": true
}
]
},
......@@ -28,19 +40,23 @@
"title": "MaPMT Quad. Peak Time Distribution",
"func_code": "{ch}_peak.time - ecal.time",
"xlabel": "Time Rel. to ECal. (ns)",
"ylabel": "Counts",
"ylabel": "Normalized Counts",
"hist_range": [80, -160, 160],
"path": "quad_peak_time_tcuts.png",
"filter_code": "{ch}_peak.height > 0 && {group}_5_peak.height > 0"
"filter_code": "{ch}_peak.height > 0 && {group}_5_peak.height > 0",
"fontsize": 14,
"normalized": true
},
{
"title": "MaPMT Quad. Peak Height Distribution",
"func_code": "{ch}_peak.height",
"xlabel": "ADC Value",
"ylabel": "Counts",
"ylabel": "Normalized Counts",
"hist_range": [100, 0, 2000],
"path": "quad_peak_height_tcuts.png",
"filter_code": "{ch}_peak.height > 0 && {group}_5_peak.height > 0"
"filter_code": "{ch}_peak.height > 0 && {group}_5_peak.height > 0",
"fontsize": 14,
"normalized": true
}
]
}
......
......@@ -12,188 +12,22 @@
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "Cer14_5", "type": "MaPMT" },
{ "id": 1, "name": "Cer13_4", "type": "MaPMT" },
{ "id": 0, "name": "Cer13_1", "type": "MaPMT" },
{ "id": 1, "name": "Cer13_2", "type": "MaPMT" },
{ "id": 2, "name": "Cer13_3", "type": "MaPMT" },
{ "id": 3, "name": "Cer13_2", "type": "MaPMT" },
{ "id": 4, "name": "Cer13_1", "type": "MaPMT" },
{ "id": 5, "name": "Cer13_5", "type": "MaPMT" },
{ "id": 6, "name": "Cer12_4", "type": "MaPMT" },
{ "id": 3, "name": "Cer13_4", "type": "MaPMT" },
{ "id": 4, "name": "Cer13_5", "type": "MaPMT" },
{ "id": 5, "name": "Cer12_1", "type": "MaPMT" },
{ "id": 6, "name": "Cer12_2", "type": "MaPMT" },
{ "id": 7, "name": "Cer12_3", "type": "MaPMT" },
{ "id": 8, "name": "Cer12_2", "type": "MaPMT" },
{ "id": 9, "name": "Cer12_1", "type": "MaPMT" },
{ "id": 10, "name": "Cer12_5", "type": "MaPMT" },
{ "id": 11, "name": "Cer11_4", "type": "MaPMT" },
{ "id": 8, "name": "Cer12_4", "type": "MaPMT" },
{ "id": 9, "name": "Cer12_5", "type": "MaPMT" },
{ "id": 10, "name": "Cer11_1", "type": "MaPMT" },
{ "id": 11, "name": "Cer11_2", "type": "MaPMT" },
{ "id": 12, "name": "Cer11_3", "type": "MaPMT" },
{ "id": 13, "name": "Cer11_2", "type": "MaPMT" },
{ "id": 14, "name": "Cer11_1", "type": "MaPMT" },
{ "id": 15, "name": "Cer11_5", "type": "MaPMT" }
]
},
{
"crate": 1,
"slot": 4,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "Cer33_1", "type": "MaPMT" },
{ "id": 1, "name": "Cer33_5", "type": "MaPMT" },
{ "id": 2, "name": "Cer23_4", "type": "MaPMT" },
{ "id": 3, "name": "Cer23_3", "type": "MaPMT" },
{ "id": 4, "name": "Cer23_2", "type": "MaPMT" },
{ "id": 5, "name": "Cer23_1", "type": "MaPMT" },
{ "id": 6, "name": "Cer23_5", "type": "MaPMT" },
{ "id": 7, "name": "Cer24_4", "type": "MaPMT" },
{ "id": 8, "name": "Cer24_3", "type": "MaPMT" },
{ "id": 9, "name": "Cer24_2", "type": "MaPMT" },
{ "id": 10, "name": "Cer24_1", "type": "MaPMT" },
{ "id": 11, "name": "Cer24_5", "type": "MaPMT" },
{ "id": 12, "name": "Cer14_4", "type": "MaPMT" },
{ "id": 13, "name": "Cer14_3", "type": "MaPMT" },
{ "id": 14, "name": "Cer14_2", "type": "MaPMT" },
{ "id": 15, "name": "Cer14_1", "type": "MaPMT" }
]
},
{
"crate": 1,
"slot": 5,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 1, "name": "Cer43_1", "type": "MaPMT" },
{ "id": 2, "name": "Cer43_5", "type": "MaPMT" },
{ "id": 3, "name": "Cer44_4", "type": "MaPMT" },
{ "id": 4, "name": "Cer44_3", "type": "MaPMT" },
{ "id": 5, "name": "Cer44_2", "type": "MaPMT" },
{ "id": 6, "name": "Cer44_1", "type": "MaPMT" },
{ "id": 7, "name": "Cer44_5", "type": "MaPMT" },
{ "id": 8, "name": "Cer34_4", "type": "MaPMT" },
{ "id": 9, "name": "Cer34_3", "type": "MaPMT" },
{ "id": 10, "name": "Cer34_2", "type": "MaPMT" },
{ "id": 11, "name": "Cer34_1", "type": "MaPMT" },
{ "id": 12, "name": "Cer34_5", "type": "MaPMT" },
{ "id": 13, "name": "Cer33_4", "type": "MaPMT" },
{ "id": 14, "name": "Cer33_3", "type": "MaPMT" },
{ "id": 15, "name": "Cer33_2", "type": "MaPMT" }
]
},
{
"crate": 1,
"slot": 6,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "Cer31_3", "type": "MaPMT" },
{ "id": 1, "name": "Cer31_2", "type": "MaPMT" },
{ "id": 2, "name": "Cer31_1", "type": "MaPMT" },
{ "id": 3, "name": "Cer31_5", "type": "MaPMT" },
{ "id": 4, "name": "Cer41_4", "type": "MaPMT" },
{ "id": 5, "name": "Cer41_3", "type": "MaPMT" },
{ "id": 6, "name": "Cer41_2", "type": "MaPMT" },
{ "id": 7, "name": "Cer41_1", "type": "MaPMT" },
{ "id": 8, "name": "Cer41_5", "type": "MaPMT" },
{ "id": 9, "name": "Cer42_4", "type": "MaPMT" },
{ "id": 10, "name": "Cer42_3", "type": "MaPMT" },
{ "id": 11, "name": "Cer42_2", "type": "MaPMT" },
{ "id": 12, "name": "Cer42_1", "type": "MaPMT" },
{ "id": 13, "name": "Cer42_5", "type": "MaPMT" },
{ "id": 14, "name": "Cer43_3", "type": "MaPMT" },
{ "id": 15, "name": "Cer43_2", "type": "MaPMT" }
]
},
{
"crate": 1,
"slot": 7,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "C7_4", "type": "Calo" },
{ "id": 1, "name": "C7_3", "type": "Calo" },
{ "id": 2, "name": "C7_2", "type": "Calo" },
{ "id": 3, "name": "C7_1", "type": "Calo" },
{ "id": 4, "name": "C6_4", "type": "Calo" },
{ "id": 5, "name": "C6_3", "type": "Calo" },
{ "id": 6, "name": "C6_2", "type": "Calo" },
{ "id": 7, "name": "C6_1", "type": "Calo" },
{ "id": 8, "name": "C5_4", "type": "Calo" },
{ "id": 9, "name": "C5_3", "type": "Calo" },
{ "id": 10, "name": "C5_2", "type": "Calo" },
{ "id": 11, "name": "C5_1", "type": "Calo" },
{ "id": 12, "name": "C4", "type": "Calo" },
{ "id": 13, "name": "C3", "type": "Calo" },
{ "id": 14, "name": "C2", "type": "Calo" },
{ "id": 15, "name": "C1", "type": "Calo" }
]
},
{
"crate": 1,
"slot": 8,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "Cer22_1", "type": "MaPMT" },
{ "id": 1, "name": "Cer22_5", "type": "MaPMT" },
{ "id": 2, "name": "Cer32_4", "type": "MaPMT" },
{ "id": 3, "name": "Cer32_3", "type": "MaPMT" },
{ "id": 4, "name": "Cer32_2", "type": "MaPMT" },
{ "id": 5, "name": "Cer32_1", "type": "MaPMT" },
{ "id": 6, "name": "Cer32_5", "type": "MaPMT" },
{ "id": 7, "name": "Cer31_4", "type": "MaPMT" },
{ "id": 8, "name": "C9_4", "type": "Calo" },
{ "id": 9, "name": "C9_3", "type": "Calo" },
{ "id": 10, "name": "C9_2", "type": "Calo" },
{ "id": 11, "name": "C9_1", "type": "Calo" },
{ "id": 12, "name": "C8_4", "type": "Calo" },
{ "id": 13, "name": "C8_3", "type": "Calo" },
{ "id": 14, "name": "C8_2", "type": "Calo" },
{ "id": 15, "name": "C8_1", "type": "Calo" }
]
},
{
"crate": 1,
"slot": 9,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "Cer43_4", "type": "MaPMT" },
{ "id": 2, "name": "Cer21_4", "type": "MaPMT" },
{ "id": 3, "name": "Cer21_3", "type": "MaPMT" },
{ "id": 4, "name": "Cer21_2", "type": "MaPMT" },
{ "id": 5, "name": "Cer21_1", "type": "MaPMT" },
{ "id": 6, "name": "Cer21_5", "type": "MaPMT" },
{ "id": 7, "name": "Cer22_4", "type": "MaPMT" },
{ "id": 8, "name": "Cer22_3", "type": "MaPMT" },
{ "id": 9, "name": "Cer22_2", "type": "MaPMT" },
{ "id": 10, "name": "S2_11", "type": "Scint" },
{ "id": 11, "name": "S2_10", "type": "Scint" },
{ "id": 12, "name": "S2_9", "type": "Scint" },
{ "id": 13, "name": "S2_8", "type": "Scint" },
{ "id": 14, "name": "S2_7", "type": "Scint" },
{ "id": 15, "name": "S2_6", "type": "Scint" }
]
},
{
"crate": 1,
"slot": 10,
"bank": 3,
"type": "FADC250",
"channels": [
{ "id": 0, "name": "S2_5", "type": "Scint" },
{ "id": 1, "name": "S2_4", "type": "Scint" },
{ "id": 2, "name": "S2_3", "type": "Scint" },
{ "id": 3, "name": "S2_2", "type": "Scint" },
{ "id": 4, "name": "S2_1", "type": "Scint" },
{ "id": 5, "name": "S1_11", "type": "Scint" },
{ "id": 6, "name": "S1_10", "type": "Scint" },
{ "id": 7, "name": "S1_9", "type": "Scint" },
{ "id": 8, "name": "S1_8", "type": "Scint" },
{ "id": 9, "name": "S1_7", "type": "Scint" },
{ "id": 10, "name": "S1_6", "type": "Scint" },
{ "id": 11, "name": "S1_5", "type": "Scint" },
{ "id": 12, "name": "S1_4", "type": "Scint" },
{ "id": 13, "name": "S1_3", "type": "Scint" },
{ "id": 14, "name": "S1_2", "type": "Scint" },
{ "id": 15, "name": "S1_1", "type": "Scint" }
{ "id": 13, "name": "Cer11_4", "type": "MaPMT" },
{ "id": 14, "name": "Cer11_5", "type": "MaPMT" },
{ "id": 15, "name": "ch15", "type": "External"}
]
}
]
......
{
"C4": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C6_1": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C6_4": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C6_2": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C6_3": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C7_1": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C7_4": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C7_2": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C7_3": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C5_1": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C5_4": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C5_2": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C5_3": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C9_1": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C9_2": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C9_4": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C9_3": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C8_2": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C8_3": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C8_1": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C8_4": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C1": {
"cut": [
100.15,
140.15
],
"ref": "0"
},
"C2": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"C3": {
"cut": [
95.95,
135.95
],
"ref": "0"
},
"S2_1": {
"cut": [
-69.8,
-49.8
],
"ref": "ecal.time"
},
"S2_2": {
"cut": [
-69.8,
-49.8
],
"ref": "ecal.time"
},
"S2_3": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"S2_4": {
"cut": [
-77.8,
-57.8
],
"ref": "ecal.time"
},
"S2_5": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"S2_6": {
"cut": [
-77.8,
-57.8
],
"ref": "ecal.time"
},
"S2_7": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"S2_8": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"S2_9": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"S2_10": {
"cut": [
-69.8,
-49.8
],
"ref": "ecal.time"
},
"S2_11": {
"cut": [
-73.8,
-53.8
],
"ref": "ecal.time"
},
"Cer11_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer12_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer13_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer14_5": {
"cut": [
-91.75,
-75.75
],
"ref": "ecal.time"
},
"Cer21_5": {
"cut": [
-67.75,
-51.75
],
"ref": "ecal.time"
},
"Cer22_5": {
"cut": [
-67.75,
-51.75
],
"ref": "ecal.time"
},
"Cer23_5": {
"cut": [
-71.75,
-55.75
],
"ref": "ecal.time"
},
"Cer24_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer31_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer32_5": {
"cut": [
-91.75,
-75.75
],
"ref": "ecal.time"
},
"Cer33_5": {
"cut": [
-91.75,
-75.75
],
"ref": "ecal.time"
},
"Cer34_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer41_5": {
"cut": [
-87.75,
-71.75
],
"ref": "ecal.time"
},
"Cer42_5": {
"cut": [
-91.75,
-75.75
],
"ref": "ecal.time"
},
"Cer43_5": {
"cut": [
-119.75,
-103.75
],
"ref": "ecal.time"
},
"Cer44_5": {
"cut": [
-67.75,
-51.75
],
"ref": "ecal.time"
},
"Cer11_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer11_5_peak.time",
"group": "Cer11"
},
"Cer11_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer11_5_peak.time",
"group": "Cer11"
},
"Cer11_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer11_5_peak.time",
"group": "Cer11"
},
"Cer11_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer11_5_peak.time",
"group": "Cer11"
},
"Cer12_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer12_5_peak.time",
"group": "Cer12"
},
"Cer12_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer12_5_peak.time",
"group": "Cer12"
},
"Cer12_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer12_5_peak.time",
"group": "Cer12"
},
"Cer12_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer12_5_peak.time",
"group": "Cer12"
},
"Cer13_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer13_5_peak.time",
"group": "Cer13"
},
"Cer13_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer13_5_peak.time",
"group": "Cer13"
},
"Cer13_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer13_5_peak.time",
"group": "Cer13"
},
"Cer13_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer13_5_peak.time",
"group": "Cer13"
},
"Cer14_1": {
"cut": [
-8.5,
1.5
],
"ref": "Cer14_5_peak.time",
"group": "Cer14"
},
"Cer14_2": {
"cut": [
-8.5,
1.5
],
"ref": "Cer14_5_peak.time",
"group": "Cer14"
},
"Cer14_3": {
"cut": [
-8.5,
1.5
],
"ref": "Cer14_5_peak.time",
"group": "Cer14"
},
"Cer14_4": {
"cut": [
-8.5,
1.5
],
"ref": "Cer14_5_peak.time",
"group": "Cer14"
},
"Cer21_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer21_5_peak.time",
"group": "Cer21"
},
"Cer21_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer21_5_peak.time",
"group": "Cer21"
},
"Cer21_3": {
"cut": [
-8.5,
1.5
],
"ref": "Cer21_5_peak.time",
"group": "Cer21"
},
"Cer21_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer21_5_peak.time",
"group": "Cer21"
},
"Cer22_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer22_5_peak.time",
"group": "Cer22"
},
"Cer22_2": {
"cut": [
-32.5,
-22.5
],
"ref": "Cer22_5_peak.time",
"group": "Cer22"
},
"Cer22_3": {
"cut": [
-28.5,
-18.5
],
"ref": "Cer22_5_peak.time",
"group": "Cer22"
},
"Cer22_4": {
"cut": [
-28.5,
-18.5
],
"ref": "Cer22_5_peak.time",
"group": "Cer22"
},
"Cer23_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer23_5_peak.time",
"group": "Cer23"
},
"Cer23_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer23_5_peak.time",
"group": "Cer23"
},
"Cer23_3": {
"cut": [
-8.5,
1.5
],
"ref": "Cer23_5_peak.time",
"group": "Cer23"
},
"Cer23_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer23_5_peak.time",
"group": "Cer23"
},
"Cer24_1": {
"cut": [
7.5,
17.5
],
"ref": "Cer24_5_peak.time",
"group": "Cer24"
},
"Cer24_2": {
"cut": [
7.5,
17.5
],
"ref": "Cer24_5_peak.time",
"group": "Cer24"
},
"Cer24_3": {
"cut": [
7.5,
17.5
],
"ref": "Cer24_5_peak.time",
"group": "Cer24"
},
"Cer24_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer24_5_peak.time",
"group": "Cer24"
},
"Cer31_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer31_5_peak.time",
"group": "Cer31"
},
"Cer31_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer31_5_peak.time",
"group": "Cer31"
},
"Cer31_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer31_5_peak.time",
"group": "Cer31"
},
"Cer31_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer31_5_peak.time",
"group": "Cer31"
},
"Cer32_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer32_5_peak.time",
"group": "Cer32"
},
"Cer32_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer32_5_peak.time",
"group": "Cer32"
},
"Cer32_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer32_5_peak.time",
"group": "Cer32"
},
"Cer32_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer32_5_peak.time",
"group": "Cer32"
},
"Cer33_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer33_5_peak.time",
"group": "Cer33"
},
"Cer33_2": {
"cut": [
-8.5,
1.5
],
"ref": "Cer33_5_peak.time",
"group": "Cer33"
},
"Cer33_3": {
"cut": [
-8.5,
1.5
],
"ref": "Cer33_5_peak.time",
"group": "Cer33"
},
"Cer33_4": {
"cut": [
-8.5,
1.5
],
"ref": "Cer33_5_peak.time",
"group": "Cer33"
},
"Cer34_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer34_5_peak.time",
"group": "Cer34"
},
"Cer34_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer34_5_peak.time",
"group": "Cer34"
},
"Cer34_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer34_5_peak.time",
"group": "Cer34"
},
"Cer34_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer34_5_peak.time",
"group": "Cer34"
},
"Cer41_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer41_5_peak.time",
"group": "Cer41"
},
"Cer41_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer41_5_peak.time",
"group": "Cer41"
},
"Cer41_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer41_5_peak.time",
"group": "Cer41"
},
"Cer41_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer41_5_peak.time",
"group": "Cer41"
},
"Cer42_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer42_5_peak.time",
"group": "Cer42"
},
"Cer42_2": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer42_5_peak.time",
"group": "Cer42"
},
"Cer42_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer42_5_peak.time",
"group": "Cer42"
},
"Cer42_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer42_5_peak.time",
"group": "Cer42"
},
"Cer43_1": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer43_5_peak.time",
"group": "Cer43"
},
"Cer43_2": {
"cut": [
-8.5,
1.5
],
"ref": "Cer43_5_peak.time",
"group": "Cer43"
},
"Cer43_3": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer43_5_peak.time",
"group": "Cer43"
},
"Cer43_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer43_5_peak.time",
"group": "Cer43"
},
"Cer44_1": {
"cut": [
-56.5,
-46.5
],
"ref": "Cer44_5_peak.time",
"group": "Cer44"
},
"Cer44_2": {
"cut": [
-56.5,
-46.5
],
"ref": "Cer44_5_peak.time",
"group": "Cer44"
},
"Cer44_3": {
"cut": [
-56.5,
-46.5
],
"ref": "Cer44_5_peak.time",
"group": "Cer44"
},
"Cer44_4": {
"cut": [
-12.5,
-2.5
],
"ref": "Cer44_5_peak.time",
"group": "Cer44"
}
}
\ No newline at end of file
{
"C4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C6_1": {
"cut": [
110.15,
130.15
],
"ref": "0"
},
"C6_4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C6_2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C6_3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C7_1": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C7_4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C7_2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C7_3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C5_1": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C5_4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C5_2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C5_3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C9_1": {
"cut": [
110.15,
130.15
],
"ref": "0"
},
"C9_2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C9_4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C9_3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C8_2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C8_3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C8_1": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C8_4": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C1": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C2": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"C3": {
"cut": [
105.95,
125.95
],
"ref": "0"
},
"LAPPD_E7": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_E2": {
"cut": [
-111.75,
-71.75
],
"ref": "ecal.time"
},
"LAPPD_E8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_E4": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_D4": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_D8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_D2": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_D7": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_F4": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_E5": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_E1": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_E6": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_D6": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_D1": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_D5": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_C4": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_F8": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_F3": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_F7": {
"cut": [
-91.75,
-51.75
],
"ref": "ecal.time"
},
"LAPPD_E3": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_D3": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_C7": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_C3": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_C8": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_F5": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_F1": {
"cut": [
-99.75,
-59.75
],
"ref": "ecal.time"
},
"LAPPD_F6": {
"cut": [
-91.75,
-51.75
],
"ref": "ecal.time"
},
"LAPPD_F2": {
"cut": [
-83.75,
-43.75
],
"ref": "ecal.time"
},
"LAPPD_C2": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_C6": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_C1": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_C5": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G4": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G3": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G7": {
"cut": [
-119.75,
-79.75
],
"ref": "ecal.time"
},
"LAPPD_B7": {
"cut": [
-119.75,
-79.75
],
"ref": "ecal.time"
},
"LAPPD_B3": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_B8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_B4": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G1": {
"cut": [
-95.75,
-55.75
],
"ref": "ecal.time"
},
"LAPPD_G6": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G2": {
"cut": [
-87.75,
-47.75
],
"ref": "ecal.time"
},
"LAPPD_H6": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_A6": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_B2": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_B6": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_B1": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_G5": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_H4": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_H8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_H3": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_A3": {
"cut": [
-119.75,
-79.75
],
"ref": "ecal.time"
},
"LAPPD_A8": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_A4": {
"cut": [
-75.75,
-35.75
],
"ref": "ecal.time"
},
"LAPPD_B5": {
"cut": [
-75.75,
-35.75
],
"ref": "ecal.time"
},
"LAPPD_H2": {
"cut": [
-71.75,
-31.75
],
"ref": "ecal.time"
},
"LAPPD_H7": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_H1": {
"cut": [
-79.75,
-39.75
],
"ref": "ecal.time"
},
"LAPPD_H5": {
"cut": [
-115.75,
-75.75
],
"ref": "ecal.time"
},
"LAPPD_A1": {
"cut": [
-87.75,
-47.75
],
"ref": "ecal.time"
},
"LAPPD_A5": {
"cut": [
-87.75,
-47.75
],
"ref": "ecal.time"
},
"LAPPD_A7": {
"cut": [
-75.75,
-35.75
],
"ref": "ecal.time"
},
"LAPPD_A2": {
"cut": [
-71.75,
-31.75
],
"ref": "ecal.time"
}
}
\ No newline at end of file
{
"Scintillator2": {
"plots": [
{
"title": "Scint Number of Peaks (256 ns)",
"func_code": "{ch}.peaks.size()",
"xlabel": "Number of Peaks",
"ylabel": "Counts",
"hist_range": [10, -0.5, 9.5],
"path": "scint_npeaks.png",
"filter_code": "{ch}.peaks.size() > 0"
},
{
"title": "Scint Number of Peaks (50 ns)",
"func_code": "count_following_peaks({ch}.peaks, 50) + 1",
"xlabel": "Number of Peaks",
"ylabel": "Counts",
"hist_range": [10, -0.5, 9.5],
"path": "scint_npeaks_50ns.png",
"filter_code": "{ch}.peaks.size() > 0"
},
{
"title": "Scint Peak Heights",
"func_code": "unpack_height({ch}.peaks, true, 0., 0.001)",
"xlabel": "ADC Value / 1000",
"ylabel": "Counts",
"hist_range": [100, 0, 1],
"path": "scint_pheights.png",
"filter_code": "{ch}_mpeak.height > 0"
},
{
"title": "Scint Peak Integrals",
"func_code": "unpack_integral({ch}.peaks, true, 0., 0.001)",
"xlabel": "Integrated ADC Value / 1000",
"ylabel": "Counts",
"hist_range": [100, 0, 5],
"path": "scint_pintes.png",
"filter_code": "{ch}_mpeak.height > 0"
}
]
}
}
......@@ -89,9 +89,15 @@ const
}
switch (type) {
// trigger timing, might be multiple timing words
// trigger timing, two timing words - 24 bit each
case TriggerTime:
res.time.push_back(data & 0xFFFFFF);
if (new_type) {
res.time = data & 0xFFFFFF;
} else {
uint64_t time = (res.time << 24);
res.time = time | (data & 0xFFFFFF);
}
// print_word(data);
break;
// window raw data
case WindowRawData:
......
......@@ -38,7 +38,7 @@ class Fadc250Event
{
public:
uint32_t number, mode;
std::vector<uint32_t> time;
uint64_t time;
std::vector<Fadc250Data> channels;
Fadc250Event(uint32_t n = 0, uint32_t nch = 16)
......@@ -50,7 +50,7 @@ public:
void Clear()
{
mode = 0;
time.clear();
time = 0;
for (auto &ch : channels) { ch.Clear(); }
}
};
......
......@@ -14,9 +14,34 @@
#include <vector>
#include <random>
#define EMPTY_SAMPLES 64
namespace fdec {
struct WfRootConfig
{
bool show_tspec = false;
int pm_pos_style = 23;
double pm_pos_size = 1.0;
int pm_neg_style = 22;
double pm_neg_size = 1.0;
int raw_line_style = 2;
int raw_line_width = 1;
int raw_line_color = kRed + 1;
int res_line_style = 1;
int res_line_width = 2;
int res_line_color = kBlue + 1;
int ped_line_color = kBlack;
int ped_line_width = 2;
int ped_line_style = 1;
int ped_shade_color = kBlack;
double ped_shade_alpha = 0.3;
int ped_shade_style = 3000;
double int_shade_alpha = 0.3;
int int_shade_style = 3000;
std::vector<int> int_shade_color = {2};
};
struct LegendEntry
{
TObject *obj;
......@@ -32,8 +57,8 @@ public:
Fadc250Data result;
};
WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t> &samples, bool show_tspec = false,
double shade_alpha = 0.3)
WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t> &samples,
WfRootConfig cfg = WfRootConfig())
{
WfRootGraph res;
......@@ -41,6 +66,7 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
if (samples.empty()) {
auto gr = new TGraph;
gr->SetPoint(0, 0, 0);
gr->SetPoint(1, EMPTY_SAMPLES - 1, 0);
res.mg->Add(gr, "l");
res.objs.push_back(dynamic_cast<TObject*>(gr));
return res;
......@@ -51,9 +77,9 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
for (size_t i = 0; i < samples.size(); ++i) {
wf->SetPoint(i, i, samples[i]);
}
wf->SetLineColor(kRed + 1);
wf->SetLineWidth(1);
wf->SetLineStyle(2);
wf->SetLineColor(cfg.raw_line_color);
wf->SetLineWidth(cfg.raw_line_width);
wf->SetLineStyle(cfg.raw_line_style);
res.mg->Add(wf, "l");
res.objs.push_back(dynamic_cast<TObject*>(wf));
res.entries.emplace_back(LegendEntry{wf, "Raw Samples", "l"});
......@@ -64,8 +90,9 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
for (size_t i = 0; i < buf.size(); ++i) {
wf2->SetPoint(i, i, buf[i]);
}
wf2->SetLineColor(kBlue + 1);
wf2->SetLineWidth(2);
wf2->SetLineColor(cfg.res_line_color);
wf2->SetLineWidth(cfg.res_line_width);
wf2->SetLineStyle(cfg.res_line_style);
res.mg->Add(wf2, "l");
res.objs.push_back(dynamic_cast<TObject*>(wf2));
res.entries.emplace_back(LegendEntry{wf2, Form("Smoothed Samples (res = %zu)", ana.GetResolution()), "l"});
......@@ -77,6 +104,7 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
auto grm_pos = new TGraph();
auto grm_neg = new TGraph();
auto &icolors = cfg.int_shade_color;
for (size_t i = 0; i < peaks.size(); ++i) {
// peak amplitudes
auto peak = peaks[i];
......@@ -89,7 +117,8 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
}
// peak integrals
auto color = i + 2;
auto color = (icolors.size() > i) ? icolors[i]
: *std::max_element(icolors.begin(), icolors.end()) + (i + 1 - icolors.size());
auto nint = peak.right - peak.left + 1;
auto grs = new TGraph(2*nint);
for (size_t i = 0; i < nint; ++i) {
......@@ -97,22 +126,22 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
grs->SetPoint(i, i + peak.left, val);
grs->SetPoint(nint + i, peak.right - i, ped.mean);
}
grs->SetFillColorAlpha(color, shade_alpha);
grs->SetFillStyle(3000);
grs->SetFillColorAlpha(color, cfg.int_shade_alpha);
grs->SetFillStyle(cfg.int_shade_style);
res.mg->Add(grs, "f");
res.objs.push_back(dynamic_cast<TObject*>(grs));
if (i == 0) {
res.entries.emplace_back(LegendEntry{grs, "Peak Integrals", "f"});
}
}
grm_pos->SetMarkerStyle(23);
grm_pos->SetMarkerSize(1.0);
grm_pos->SetMarkerStyle(cfg.pm_pos_style);
grm_pos->SetMarkerSize(cfg.pm_pos_size);
if (grm_pos->GetN()) { res.mg->Add(grm_pos, "p"); }
res.objs.push_back(dynamic_cast<TObject*>(grm_pos));
res.entries.emplace_back(LegendEntry{grm_pos, "Peaks", "p"});
grm_neg->SetMarkerStyle(22);
grm_neg->SetMarkerSize(1.0);
grm_neg->SetMarkerStyle(cfg.pm_neg_style);
grm_neg->SetMarkerSize(cfg.pm_neg_size);
if (grm_neg->GetN()) { res.mg->Add(grm_neg, "p"); }
res.objs.push_back(dynamic_cast<TObject*>(grm_neg));
......@@ -122,16 +151,17 @@ WfRootGraph get_waveform_graph(const Analyzer &ana, const std::vector<uint32_t>
grp->SetPoint(i, i, ped.mean);
grp->SetPointError(i, 0, ped.err);
}
grp->SetFillColorAlpha(kBlack, shade_alpha);
grp->SetFillStyle(3000);
grp->SetLineWidth(2);
grp->SetLineColor(kBlack);
grp->SetFillColorAlpha(cfg.ped_shade_color, cfg.ped_shade_alpha);
grp->SetFillStyle(cfg.ped_shade_style);
grp->SetLineStyle(cfg.ped_line_style);
grp->SetLineWidth(cfg.ped_line_width);
grp->SetLineColor(cfg.ped_line_color);
res.mg->Add(grp, "l3");
res.objs.push_back(dynamic_cast<TObject*>(grp));
res.entries.emplace_back(LegendEntry{grp, "Pedestal", "lf"});
// TSpectrum background
if (show_tspec) {
if (cfg.show_tspec) {
std::vector<double> tped(samples.size());
tped.assign(samples.begin(), samples.end());
TSpectrum s;
......
example usage:
1. plot raw waveform events
python scripts/draw_events.py processed_data/run302.root CALORIMETER --plot-dir plots/run302/samples -n 10
python scripts/draw_events.py CALORIMETER processed_data/run302.root --plot-dir=plots/run302/samples -n 10
2. plot raw distributions
python scripts/plot_dist.py processed_data/run302.root database/mapmt_raw_dist.json --plot-dir=plots/run302/raw --root-plots
3. timing cuts study for triggers (snapshot to save data)
python scripts/trigger_timing_cuts.py processed_data/run302.root database/run302_timing.json --plot-dir=plots/run302/tcuts --snapshot=processed_data/run302_trg.root -b
python scripts/trigger_timing_cuts.py MAPMT database/run302_timing.json --files=processed_data/run302.root --snapshot=processed_data/run302_trg.root --plot-dir=plots/run302/tcuts -b
4. timing cuts study for signals (snapshot to save data)
python scripts/signal_timing_cuts.py processed_data/run302_trg.root database/run302_timing.json --plot-dir=plots/run302/tcuts --snapshot=processed_data/run302_tcuts.root -b
python scripts/signal_timing_cuts.py MAPMT processed_data/run302_trg.root database/run302_timing.json --snapshot=processed_data/run302_tcuts.root --plot-dir=plots/run302/tcuts/ -b
5. plot distributions after timing cuts
python scripts/plot_dist.py processed_data/run302_tcuts.root database/mapmt_tcuts_dist.json --plot-dir=plots/run302/tcuts --root-plots
6. plot signal sums
......@@ -58,8 +58,8 @@ if __name__ == "__main__":
# argument parser
parser = argparse.ArgumentParser('draw events')
parser.add_argument('channels', help='channels layout to plot, supports {}'.format(list(layout)))
parser.add_argument('root_file', help='a root file of waveform data')
parser.add_argument('channels', help='channels to plot, supports {}'.format(list(layout)))
parser.add_argument('-o', '--plot-dir', dest='out_dir', default="./plots", help='output directory')
parser.add_argument('-e', default='', dest='events',
help='list of events to draw, example: 100,200,300')
......@@ -73,10 +73,11 @@ if __name__ == "__main__":
help='number of samples to check pedestal')
parser.add_argument('-f', type=float, default=1.0, dest='flat',
help='upper limit of the pedestal error (flatness requirement)')
parser.add_argument('-l', '--legend', action='store_true', help='add a legend panel')
args = parser.parse_args()
if args.channels not in layout:
print('Unsupported channel layout {}, please choose one of {}'.format(args.channels, list(layout)))
print('Cannot find layout {}, please choose one of {}'.format(args.channels, list(layout)))
exit(-1)
# recover paths
......@@ -115,17 +116,23 @@ if __name__ == "__main__":
flat_chans = [ch for chans in channels for ch in chans]
events = random_select(tree, flat_chans, args.nev)
# plot configuration
conf = ROOT.fdec.WfRootConfig()
conf.pm_pos_size = 2.0
conf.pm_neg_size = 2.0
for iev in events:
tree.GetEntry(iev)
title = '{} Event {}'.format(args.channels, iev)
c = ROOT.TCanvas(title, '', 2560, 1440)
pads = prepare_canvas(c, channels, title, 'Sample Number', 'ADC Value')
playout = channels if not args.legend else channels + [['legend']]
pads = prepare_canvas(c, playout, title, 'Sample Number (4 ns)', 'ADC Value')
grs = []
for chs in channels:
ymin, ymax = 4000, 0
xmax = 0
for ch in chs:
pads[ch].cd()
grs.append(ROOT.fdec.get_waveform_graph(analyzer, getattr(tree, ch).raw))
grs.append(ROOT.fdec.get_waveform_graph(analyzer, getattr(tree, ch).raw, conf))
grs[-1].mg.SetTitle(ch)
grs[-1].mg.Draw('A')
if getattr(tree, ch).raw.size() > 0:
......@@ -133,10 +140,19 @@ if __name__ == "__main__":
new_ymin = grs[-1].mg.GetHistogram().GetMinimum()
ymax = new_ymax if new_ymax > ymax else ymax
ymin = new_ymin if new_ymin < ymin else ymin
grs[-1].mg.GetXaxis().SetRangeUser(0, getattr(tree, ch).raw.size() - 1)
new_xmax = getattr(tree, ch).raw.size()
xmax = new_xmax if new_xmax > xmax else xmax
for j in np.arange(0, len(chs)):
grs[-1 - j].mg.GetYaxis().SetRangeUser(ymin, ymax + (ymax - ymin)*0.1)
grs[-1 - j].mg.GetXaxis().SetRangeUser(0, xmax - 1)
c.Update()
if args.legend:
pads['legend'].cd()
leg = ROOT.TLegend(0., 0., 1, 1)
for entry in grs[0].entries:
leg.AddEntry(entry.obj, entry.label, entry.option);
leg.Draw();
c.SaveAs(os.path.join(args.out_dir, '{}_event_{}.png'.format(args.channels.lower(), iev)))
#!/bin/python3
import argparse
import os
import json
import ROOT
import random
import numpy as np
from ROOT import gROOT, gInterpreter
from plot_utils import prepare_canvas, my_style, nthreads
if __name__ == "__main__":
ROOT.ROOT.EnableImplicitMT(nthreads)
# make sure the relative path for root loading is correct
owd = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(script_dir, '..'))
print('working directory is ' + os.getcwd())
# get layouts
with open(os.path.join(script_dir, '..', 'database', 'channels_layout.json'), 'r') as f:
channels_layout = json.load(f)
# format keys
layout = {key.replace(' ', '_').upper(): channels for key, channels in channels_layout.items()}
# argument parser
parser = argparse.ArgumentParser('draw events')
parser.add_argument('--min', dest='min', default=1, type=int, help='minimum number of hits')
parser.add_argument('--max', dest='max', default=10, type=int, help='maximum number of hits')
parser.add_argument('-o', '--plot-dir', dest='out_dir', default="./plots", help='output directory')
parser.add_argument('-t', type=float, default=0.0, dest='thres', help='peak height threshold to sum')
args = parser.parse_args()
# recover paths
for attr in ['out_dir']:
setattr(args, attr, os.path.join(owd, getattr(args, attr)))
os.makedirs(args.out_dir, exist_ok=True)
# batch mode
gROOT.SetBatch(True)
# root macros
gROOT.Macro('rootlogon.C')
# declare root graph code
func_code = open(os.path.join(script_dir, 'root', 'dataframe_analysis.C')).read()
gInterpreter.Declare(func_code)
# style
my_style.cd()
# root dataframes
runs = [
(
'Low Rate Beam Test',
{'SetLineColor': [30], 'SetFillColorAlpha': [30, 0.8], 'SetFillStyle': [3006]},
['processed_data/run420_0.root',],
'unpack_integral(C2.peaks, true, 0, 1.0)',
'true',
),
(
'High Rate Beam Test',
{'SetLineColor': [38], 'SetFillColorAlpha': [38, 0.8], 'SetFillStyle': [3004]},
['processed_data/run308_0.root',],
'unpack_integral(C2.peaks, true, 0, 1.0)',
'true',
),
(
'Cosmic MIP Signal',
{'SetLineColor': [46], 'SetFillColorAlpha': [46, 0.8], 'SetFillStyle': [3005]},
['processed_data/run233_0.root',],
'unpack_integral(C2.peaks, true, 0, 1.0)',
'true',
),
]
'''
runs = [
(
'Full Data',
{'SetLineColor': [30], 'SetFillColorAlpha': [30, 0.8], 'SetFillStyle': [3006]},
['processed_data/run302_0.root',],
'get_maximum_peak(C2.peaks).integral',
'true'
),
(
'Cher. Cut Data',
{'SetLineColor': [38], 'SetFillColorAlpha': [38, 0.8], 'SetFillStyle': [3004]},
['processed_data/run302_0.root',],
'get_maximum_peak(C2.peaks).integral',
'cher_cut_rough({'
'Cer11_1,Cer11_2,Cer11_3,Cer11_4,'
'Cer12_1,Cer12_2,Cer12_3,Cer12_4,'
'Cer13_1,Cer13_2,Cer13_3,Cer13_4,'
'Cer14_1,Cer14_2,Cer14_3,Cer14_4,'
'Cer21_1,Cer21_2,Cer21_3,Cer21_4,'
'Cer22_1,Cer22_2,Cer22_3,Cer22_4,'
'Cer23_1,Cer23_2,Cer23_3,Cer23_4,'
'Cer24_1,Cer24_2,Cer24_3,Cer24_4,'
'Cer31_1,Cer31_2,Cer31_3,Cer31_4,'
'Cer32_1,Cer32_2,Cer32_3,Cer32_4,'
'Cer33_1,Cer33_2,Cer33_3,Cer33_4,'
'Cer34_1,Cer34_2,Cer34_3,Cer34_4,'
'Cer41_1,Cer41_2,Cer41_3,Cer41_4,'
'Cer42_1,Cer42_2,Cer42_3,Cer42_4,'
'Cer43_1,Cer43_2,Cer43_3,Cer43_4,'
'Cer44_1,Cer44_2,Cer44_3,Cer44_4'
'})'
),
]
'''
'''
runs = [
(
'Low Rate Beam Test',
{'SetLineColor': [30], 'SetFillColorAlpha': [30, 0.8], 'SetFillStyle': [3006]},
['processed_data/run420_0.root',],
'get_maximum_peak(C2.peaks).height',
'get_maximum_peak(C2.peaks).height > 0',
),
(
'High Rate Beam Test',
{'SetLineColor': [46], 'SetFillColorAlpha': [46, 0.8], 'SetFillStyle': [3004]},
['processed_data/run308_0.root',],
'get_maximum_peak(C2.peaks).height',
'get_maximum_peak(C2.peaks).height > 0',
),
]
'''
xlbl, hrange = 'ADC Value', (500, 0, 20000)
c = ROOT.TCanvas('Total Sum', '', 1920, 1280)
pad = prepare_canvas(c, [[0]], 'Signal Sums Total', xlbl, 'Normalized Counts')[0]
channels = ['{}_peak'.format(c) for chs in layout['LAPPD'] for c in chs]
pad.cd()
pad.SetLogy()
hists = []
hs = ROOT.THStack
for i, (name, settings, root_files, func, fc) in enumerate(runs):
chain = ROOT.TChain('EvTree')
for rfile in root_files:
chain.Add(rfile)
rdf = ROOT.RDataFrame(chain)
hist = rdf.Filter(fc).Define('temp', func).Histo1D(ROOT.RDF.TH1DModel(name, '', *hrange), 'temp')
for method, inputs in settings.items():
method_to_call = getattr(hist, method)
method_to_call(*inputs)
chist = hist.DrawNormalized('same')
chist.SetMaximum(1.5)
pad.BuildLegend(0.5, 0.8, 0.9, 0.9)
c.SaveAs(os.path.join(args.out_dir, 'sum_comp.png'))
import os
import argparse
import pandas as pd
import numpy as np
import ROOT
def load_root_macros(arg_macros):
for path in arg_macros.split(','):
path = path.strip()
if os.path.exists(path):
ROOT.gROOT.Macro(path)
else:
print('\"{}\" does not exist, skip loading it.'.format(path))
def max_peak_height(ch):
if not len(ch.peaks):
return 0
return np.max([p.height for p in ch.peaks])
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'file', type=str,
help='path to root file.'
)
parser.add_argument(
'-o', type=str,
default='plots',
dest='outdir',
help='output directory.'
)
parser.add_argument(
'-n', '--num-events', type=int,
default=-1,
help='number of events to process.'
)
parser.add_argument(
'--start-event', type=int,
default=0,
help='start event.'
)
parser.add_argument(
'--signal-cut', type=float,
default=20,
help='cut signal in height.'
)
args = parser.parse_args()
load_root_macros('rootlogon.C')
os.makedirs(args.outdir, exist_ok=True)
f = ROOT.TFile(args.file)
events = f.EvTree
ntotal = events.GetEntries()
nend = min(ntotal, args.num_events) if args.num_events > 0 else ntotal
nbeg = args.start_event
# CerB3 is problematic
channels = [
'CerA0', 'CerA1', 'CerA2', 'CerA3',
'CerB0', 'CerB1', 'CerB2', # 'CerB3',
'CerC0', 'CerC1', 'CerC2', 'CerC3',
'CerD0', 'CerD1', 'CerD2', 'CerD3',
]
data = []
for iev in np.arange(nbeg, nend):
if iev % 100000 == 0:
print('{:d}/{:d}'.format(iev, nend - nbeg))
events.GetEntry(iev)
datum = [max_peak_height(getattr(events, chan)) for chan in channels]
nch = np.sum(np.array(datum) > args.signal_cut)
sigsum = np.sum(datum)
if nch > 0:
datum += [iev, nch, sigsum]
data.append(datum)
df = pd.DataFrame(data=data, columns=channels + ['event', 'nch', 'sig_sum'])
df.to_csv('test.csv')
print(df)
import ROOT
import os
import json
import numpy as np
import pandas as pd
import argparse
from matplotlib import pyplot as plt
from ROOT import gROOT, gSystem, gInterpreter, gStyle, gPad
from plot_utils import prepare_canvas, prepare_figure, my_style, get_hist_contents
# make sure the relative path for root loading is correct
owd = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(script_dir, '..'))
print('working directory is ' + os.getcwd())
# batch mode
gROOT.SetBatch(True)
# rootlogon macro
gROOT.Macro('rootlogon.C')
# the functions that process data are defined in scripts/root/dataframe_analysis.C
func_code = open(os.path.join(script_dir, 'root', 'dataframe_analysis.C')).read()
gInterpreter.Declare(func_code)
# global style
my_style.cd()
bprops = dict(boxstyle='round', facecolor='wheat', alpha=0.2)
# argument parser
parser = argparse.ArgumentParser('plot distributions for raw data')
parser.add_argument('root_file', help='root file output from analyzer')
parser.add_argument('-o', '--plot-dir', dest='out_dir', default='./plots', help='output directory')
parser.add_argument('--layout', dest='layout', default=os.path.join(script_dir, '..', 'database/channels_layout.json'),
help='json data for channels layout')
args = parser.parse_args()
# recover paths
for attr in ['root_file', 'out_dir', 'layout']:
setattr(args, attr, os.path.join(owd, getattr(args, attr)))
os.makedirs(args.out_dir, exist_ok=True)
# root dataframe
rdf = ROOT.RDataFrame('EvTree', args.root_file)
# read json files
with open(args.layout, 'r') as f:
channels_layout = json.load(f)
channels = channels_layout['LAPPD']
c1 = ROOT.TCanvas('c1', '', 2560, 1440)
p1 = prepare_canvas(c1, channels, 'LAPPD Peak Height Distribution', 'ADC Value', 'Counts')
def get_neighbors(channels, i, j):
neighbors = []
ni = [i - 1, i + 1]
nj = [j - 1, j + 1]
for ii in ni:
for jj in nj:
if ii >= 0 and ii < 8 and jj >= 0 and jj < 8:
neighbors.append(channels[0][ii*8 + jj])
return neighbors
hists = []
hrange = (100, 0, 100)
ymax = 0
for i in np.arange(8, dtype=int):
for j in np.arange(8, dtype=int):
ch = channels[0][i*8 +j]
p1[ch].cd()
neighbors = get_neighbors(channels, i, j)
filter_code = '||'.join(['{}_peak.height > 0'.format(n) for n in neighbors])
hists.append(
rdf.Filter('{}_peak.height > 0'.format(ch))\
.Filter(filter_code)
.Histo1D(ROOT.RDF.TH1DModel('h{}'.format(ch), '', *hrange), '{}_peak.height'.format(ch))
)
hists[-1].SetTitle('{}'.format(ch))
hists[-1].SetLineStyle(2)
hists[-1].SetLineWidth(1)
hists[-1].SetLineColor(46)
hists[-1].SetFillColorAlpha(38, 0.7)
hists[-1].SetFillStyle(3000)
hists[-1].Draw('LF')
new_ymax = hists[-1].GetMaximum()
ymax = new_ymax if new_ymax > ymax else ymax
# shared y-axis among sub-groups
for j in np.arange(64, dtype=int):
hists[j].GetYaxis().SetRangeUser(0, ymax*1.1)
c1.SaveAs(os.path.join(args.out_dir, 'lappd_neighbor_cuts.png'))
......@@ -6,8 +6,9 @@ import pandas as pd
import argparse
from matplotlib import pyplot as plt
from ROOT import gROOT, gSystem, gInterpreter, gStyle, gPad
from plot_utils import prepare_canvas, prepare_figure, my_style, get_hist_contents
from plot_utils import prepare_canvas, prepare_figure, my_style, get_hist_contents, nthreads
ROOT.ROOT.EnableImplicitMT(nthreads)
# make sure the relative path for root loading is correct
owd = os.getcwd()
......@@ -26,7 +27,6 @@ gInterpreter.Declare(func_code)
# global style
my_style.cd()
bprops = dict(boxstyle='round', facecolor='wheat', alpha=0.2)
# argument parser
parser = argparse.ArgumentParser('plot distributions for raw data')
......@@ -65,13 +65,15 @@ def get_hist(root_df, fcode, bins, xmin, xmax, filcode):
# plot with root canvas
def root_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path, filter_code='', refs={}):
def root_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path, filter_code='', refs={}, pad_func={},
fontsize=18, normalized=True):
c = ROOT.TCanvas(title, '', 2560, 1440)
pads = prepare_canvas(c, channels, title, xlabel, ylabel)
hists = []
for i, chans in enumerate(channels):
ymax = 0
for j, ch in enumerate(chans):
# df = df.Define('{}_mpeak'.format(ch), 'get_maximum_peak({}.peaks)'.format(ch))
kw = refs.get(ch, {})
pads[ch].cd()
hists.append(
......@@ -83,30 +85,47 @@ def root_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path,
hists[-1].SetLineColor(46)
hists[-1].SetFillColorAlpha(38, 0.7)
hists[-1].SetFillStyle(3000)
hists[-1].Draw('LF')
if normalized:
hists[-1].DrawNormalized('hist & same')
else:
hists[-1].Draw("hist & same")
new_ymax = hists[-1].GetMaximum()
ymax = new_ymax if new_ymax > ymax else ymax
for func, v in pad_func.items():
if func == 'SetLogy':
hists[-1].SetMinimum(1e-5);
to_call = getattr(pads[ch], func)
to_call(*v)
# shared y-axis among sub-groups
for j in np.arange(0, len(chans)):
hists[-1 - j].GetYaxis().SetRangeUser(0, ymax*1.1)
if normalized:
hists[-1 - j].GetYaxis().SetRangeUser(1e-6, 1.0)
else:
hists[-1 - j].SetMaximum(ymax*1.1)
# hists[-1 - j].GetYaxis().SetRangeUser(0.1, ymax*1.1)
c.Update()
c.SaveAs(path)
# plot with matplotlib
def mat_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path, filter_code='', refs={}):
def mat_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path, filter_code='', refs={}, fontsize=18,
normalized=True):
fig = plt.figure(figsize=(16, 9), dpi=160)
axs = prepare_figure(fig, channels, title=title, xlabel=xlabel, ylabel=ylabel)
axs = prepare_figure(fig, channels, title=title, xlabel=xlabel, ylabel=ylabel, fontsize=fontsize)
bprops = dict(boxstyle='round', facecolor='wheat', alpha=0.1)
for i, chans in enumerate(channels):
for j, ch in enumerate(chans):
# df = df.Define('{}_mpeak'.format(ch), 'get_maximum_peak({}.peaks)'.format(ch))
kw = refs.get(ch, {})
ax = axs[ch]
x, y = get_hist_contents(
get_hist(df, func_code.format(ch=ch, **kw), *hist_range, filter_code.format(ch=ch, **kw))
)
ax.bar(x, y, width=np.min(np.diff(x)))
ax.text(0.95, 0.95, ch, transform=ax.transAxes, fontsize=14, bbox=bprops,
wts = y/np.sum(y) if normalized else y
ax.hist(x, bins=np.linspace(*hist_range[1:], hist_range[0] + 1), weights=wts, histtype='stepfilled', ec='k',
color='royalblue', alpha=0.7)
ax.text(0.95, 0.95, ch, transform=ax.transAxes, fontsize=fontsize, bbox=bprops,
verticalalignment='top', horizontalalignment='right')
fig.savefig(path)
......@@ -115,7 +134,7 @@ def mat_plots(df, channels, func_code, title, xlabel, ylabel, hist_range, path,
# generate plots
for group, data in plot_data.items():
# get default layout if no channels provided
channels = data.get('channels', channels_layout[group])
channels = data.get('channels', channels_layout.get(group, {}))
refs = data.get('refs', {})
# path
if isinstance(refs, str):
......
import ROOT
import os
import json
import numpy as np
import pandas as pd
import argparse
from matplotlib import pyplot as plt
from ROOT import gROOT, gSystem, gInterpreter, gStyle, gPad
from plot_utils import prepare_canvas, prepare_figure, my_style, get_hist_contents, nthreads
ROOT.ROOT.EnableImplicitMT(nthreads)
# make sure the relative path for root loading is correct
owd = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(os.path.join(script_dir, '..'))
print('working directory is ' + os.getcwd())
# batch mode
gROOT.SetBatch(True)
# rootlogon macro
gROOT.Macro('rootlogon.C')
# the functions that process data are defined in scripts/root/dataframe_analysis.C
func_code = open(os.path.join(script_dir, 'root', 'dataframe_analysis.C')).read()
gInterpreter.Declare(func_code)
# global style
my_style.cd()
# argument parser
parser = argparse.ArgumentParser()
parser.add_argument('json_command', help='json file of plot commands')
parser.add_argument('-r', dest='run', type=int, help='run number', required=True)
parser.add_argument('-s', dest='split', default=0, type=int, help='split file number')
parser.add_argument('-o', '--plot-dir', dest='out_dir', default='./plots', help='output directory')
parser.add_argument('--layout', dest='layout', default=os.path.join(script_dir, '..', 'database/channels_layout.json'),
help='json data for channels layout')
args = parser.parse_args()
# recover paths
for attr in ['json_command', 'out_dir', 'layout']:
setattr(args, attr, os.path.join(owd, getattr(args, attr)))
os.makedirs(args.out_dir, exist_ok=True)
# read json files
with open(args.json_command) as f:
plot_data = json.load(f)
with open(args.layout, 'r') as f:
channels_layout = json.load(f)
# get histogram from dataframe
def get_hist(root_df, fcode, bins, xmin, xmax, filcode):
df_temp = root_df.Define('my_temp', fcode)
if filcode:
df_temp = df_temp.Filter(filcode)
return df_temp.Histo1D(ROOT.RDF.TH1DModel('my_temp', '', bins, xmin, xmax), 'my_temp')
# plot with matplotlib
def mat_plots(axs, path, func_code, hist_range, filter_code='', refs={}, fontsize=18, normalized=False,
yscale='linear', plot_kw={}, **kwargs):
print(os.path.join(owd, path.format(run=args.run, split=args.split)))
df = ROOT.RDataFrame('EvTree', os.path.join(owd, path.format(run=args.run, split=args.split)))
bprops = dict(boxstyle='round', facecolor='wheat', alpha=0.1)
for ch, ax in axs.items():
# df = df.Define('{}_mpeak'.format(ch), 'get_maximum_peak({}.peaks)'.format(ch))
kw = refs.get(ch, {})
fcode = func_code.format(ch=ch, **kw).replace('[', '').replace(']', '')
filcode = filter_code.format(ch=ch, **kw).replace('[', '').replace(']', '')
x, y = get_hist_contents( get_hist(df, fcode, *hist_range, filcode) )
wts = y/np.sum(y) if normalized else y
ax.set_yscale(yscale)
ax.hist(x, bins=np.linspace(*hist_range[1:], hist_range[0] + 1), weights=wts, **plot_kw)
ax.text(0.95, 0.95, ch, transform=ax.transAxes, fontsize=fontsize, bbox=bprops,
verticalalignment='top', horizontalalignment='right')
# generate plots
for group, data in plot_data.items():
# get default layout if no channels provided
channels = data.get('channels', channels_layout.get(group, {}))
refs = data.get('refs', {})
# path
if isinstance(refs, str):
cmd_dir = os.path.dirname(os.path.realpath(args.json_command))
with open(os.path.join(cmd_dir, refs.format(run=args.run, split=args.split)), 'r') as f:
refs = json.load(f)
for kwargs in data['plots']:
fig = plt.figure(figsize=(16, 9), dpi=160)
axs = prepare_figure(fig, channels, **kwargs)
for sub_kw in kwargs['subs']:
skw = kwargs.copy()
skw.update(sub_kw)
pkw = {k: v for k, v in sub_kw.items() if k not in ['path', 'func_code', 'filter_code']}
mat_plots(axs, refs=refs, plot_kw=pkw, **skw)
fig.savefig(os.path.join(args.out_dir, kwargs['save']))