args = parser.parse_args()
file_list = args.infile

in_dir = './'
if (args.directory):
    in_dir = args.directory
in_dir = os.path.expanduser(in_dir)

suffix = '_calib.root'
if (args.suffix):
    suffix = args.suffix

fgeoFile = 'geo_standard.root'
if (args.geometry):
    fgeoFile = args.geometry
fgeoFile = os.path.expanduser(fgeoFile)

#
list_cluster = batch.get_list(file_list, suffix, in_dir)
list_elist = batch.get_list(file_list, '_EntryList.root', in_dir)

for fcluster, felist in zip(list_cluster, list_elist):
    command = [
        exec_bin, macro, fcluster, '2.6', felist, 'fwd', 'elist_fwdhit', '33',
        '5', '0.3', '0.9', '3', '2', fgeoFile, 'true'
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #2
0
import argparse
import os
import subprocess
import batch

vmc_dir = os.environ['VMCWORKDIR']
macro = os.path.join(vmc_dir, 'macro/koala/ana_tasks/export_koala.C')
exec_bin = os.path.join(vmc_dir, 'build/bin/koa_execute')

# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("-d",
                    "--directory",
                    default="./",
                    help="directory where files are located")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, '_TriggerSumCount.root', in_dir)

# invoking the command
for fin in list_input:
    command = [exec_bin, macro, fin]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #3
0
parser.add_argument("--time_high", default='700')
parser.add_argument("--elist_dir",
                    help="directory where elist file is located")
parser.add_argument("--elist_suffix", help="suffix of the elist filename")
parser.add_argument("--elist_dirname",
                    help="directory name of ROOT folder containing elist")
parser.add_argument("--elist_name", help="name of the elist")

args = parser.parse_args()

file_list = args.infile
in_dir = os.path.expanduser(args.directory)
fwd_dir = os.path.expanduser(args.fwddir)

# add rec each file in the list
list_files = batch.get_list(file_list, args.suffix, in_dir)
list_fwd = batch.get_list(file_list, "_FwdHit.root", fwd_dir)

if (args.elist_dir):
    elist_dir = os.path.expanduser(args.elist_dir)
    list_elist = batch.get_list(file_list, args.elist_suffix, elist_dir)
    for fin, ffwd, felist in zip(list_files, list_fwd, list_elist):
        command = [
            exec_bin, macro, fin, 'koalasim', args.branch, ffwd, args.amp_nbin,
            args.amp_low, args.amp_high, args.time_nbin, args.time_low,
            args.time_high, felist, args.elist_dirname, args.elist_name
        ]
        print(command)
        process = subprocess.Popen(command)
        process.wait()
else:
Beispiel #4
0
outfile = args.outfile

in_dir = './'
if (args.input):
    in_dir = args.input
in_dir = os.path.expanduser(in_dir)

out_dir = in_dir
if (args.output):
    out_dir = args.output
out_dir = os.path.expanduser(out_dir)

################## real job ########################################

# 1. fill the adc and tdc histograms
list_decoded = batch.get_list(file_list, '.root', in_dir)
for fin in list_decoded:
    command = [exec_bin, macro_fillHistogram, fin, out_dir]
    print(command)
    process = subprocess.Popen(command)
    process.wait()

for fin in list_decoded:
    command = [exec_bin, macro_fillAmpVsTime, fin, out_dir]
    print(command)
    process = subprocess.Popen(command)
    process.wait()

# 2. fit the adc and tdc spectrum
list_result = batch.get_list(file_list, '_result.root', out_dir)
for fin in list_result:
                    default="930",
                    help="higher limit of the time spectrum of fwd1")
parser.add_argument("--fwd2_low",
                    default="915",
                    help="lower limit of the time spectrum of fwd2")
parser.add_argument("--fwd2_high",
                    default="930",
                    help="higher limit of the time spectrum of fwd2")
parser.add_argument("--window_low",
                    default="-10",
                    help="lower limit of the time windown")
parser.add_argument("--window_high",
                    default="10",
                    help="higher limit of the time window")

args = parser.parse_args()
in_dir = os.path.expanduser(args.directory)

#
list_file = batch.get_list(args.infile, args.suffix, in_dir)

for fin in list_file:
    command = [
        exec_bin, macro, fin, 'koalasim', 'KoaFwdDigi', args.fwd1_low,
        args.fwd1_high, args.fwd2_low, args.fwd2_high, args.window_low,
        args.window_high
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #6
0
                    "--suffix",
                    default=".root",
                    help="suffix of the digi file")
parser.add_argument("--fwd1_amp_trigger",
                    default="780",
                    help="fwd1 amplitude trigger")
parser.add_argument("--fwd2_amp_trigger",
                    default="790",
                    help="fwd2 amplitude trigger")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, args.suffix, in_dir)
list_elist = batch.get_list(args.infile, "_EntryList.root", in_dir)

# open the output file
out_filename = os.path.join(in_dir, args.output)
fout = open(out_filename, 'w')

# invoking the command
for fin, felist in zip(list_input, list_elist):
    command = [
        exec_bin, macro, fin, felist, args.fwd1_amp_trigger,
        args.fwd2_amp_trigger
    ]
    print(command)
    # process = subprocess.Popen(command)
    # process.wait()
Beispiel #7
0
                    help="the output file containing selection efficiency")
parser.add_argument("-d",
                    "--directory",
                    default="./",
                    help="directory where files are located")
parser.add_argument("-s",
                    "--suffix",
                    default=".root",
                    help="suffix of the input file")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, args.suffix, in_dir)
list_rate = batch.get_list(args.infile, "_Rate_Selected.root", in_dir)
list_elist = batch.get_list(args.infile, "_EntryList.root", in_dir)

# open the output file
out_filename = os.path.join(in_dir, args.output)
fout = open(out_filename, 'w')

# invoking the command
for fin, frate, felist in zip(list_input, list_rate, list_elist):
    command = [exec_bin, macro, fin, frate, felist]
    print(command)
    # process = subprocess.Popen(command)
    # process.wait()
    with subprocess.Popen(command,
                          stdout=subprocess.PIPE,
                    help="suffix of the input file")
parser.add_argument("--fwd2_thresh_mip",
                    default="1040",
                    help="suffix of the input file")
parser.add_argument("--fwd1_thresh_daq",
                    default="780",
                    help="suffix of the input file")
parser.add_argument("--fwd2_thresh_daq",
                    default="790",
                    help="suffix of the input file")

args = parser.parse_args()

#
file_list = args.infile
list_fcluster = batch.get_list(file_list, args.suffix, args.directory)
list_fdigi = batch.get_list(file_list, ".root", args.digi_dir)

# open the output file
out_filename = os.path.join(args.directory, args.output)
fout = open(out_filename, 'w')

for fcluster, fdigi in zip(list_fcluster, list_fdigi):
    command = [
        exec_bin, macro, fcluster, args.branch, fdigi, args.p0, args.p1,
        args.p2, args.window, args.fwd1_thresh_mip, args.fwd2_thresh_mip,
        args.fwd1_thresh_daq, args.fwd2_thresh_daq
    ]
    print(command)
    with subprocess.Popen(command,
                          stdout=subprocess.PIPE,
Beispiel #9
0
# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("-d",
                    "--directory",
                    default="./",
                    help="directory where files are located")
parser.add_argument("-s",
                    "--suffix",
                    default="_EmsRawEvent.root",
                    help="suffix of the input file")
parser.add_argument("-w",
                    "--window",
                    default="2",
                    help="Half size of the event window")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, args.suffix, in_dir)
list_output = batch.get_list(args.infile, "_Rate.root", in_dir)

# invoking the command
for fin, fout in zip(list_input, list_output):
    command = [exec_bin, macro, fin, fout, args.window]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #10
0
import os
import subprocess
import batch

vmc_dir = os.environ['VMCWORKDIR']
macro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/unpack.C')
exec_bin = os.path.join(vmc_dir, 'build/bin/koa_execute')

# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("-d",
                    "--directory",
                    help="directory where files are located")

args = parser.parse_args()
file_list = args.infile

in_dir = './'
if (args.directory):
    in_dir = args.directory
in_dir = os.path.expanduser(in_dir)

# add rec each file in the list
list_decoded = batch.get_list(file_list, '.cl', in_dir)
for fin in list_decoded:
    command = [exec_bin, macro, fin]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #11
0
exec_bin = os.path.join(vmc_dir, 'build/bin/koa_execute')

# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("-d",
                    "--directory",
                    default="./",
                    help="directory where files are located")
parser.add_argument(
    "--trigger_threshfile",
    default="cluster_seed_threshold.txt",
    help="File containing the trigger thresholds for each ADC channel")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, '.root', in_dir)
list_param = batch.get_list(args.infile, '_param.root', in_dir)

# invoking the command
for fin, fparam in zip(list_input, list_param):
    command = [
        exec_bin, macro, fin, fparam, '_Trigger.root', args.trigger_threshfile
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #12
0
parser.add_argument(
    "--elist_suffix",
    help="suffix of the file containing the event list, empty if not used")
parser.add_argument("--elist_dir",
                    default="/",
                    help="directory containing the event list")
parser.add_argument("--elist_name",
                    default="ems_rate_elist",
                    help="name of the event list")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)

# add rec each file in the list
list_input = batch.get_list(args.infile, args.suffix, in_dir)

if args.elist_suffix:
    list_elist = batch.get_list(args.infile, args.elist_suffix, in_dir)
    for fin, felist in zip(list_input, list_elist):
        command = [
            exec_bin, macro, fin, felist, args.elist_dir, args.elist_name
        ]
        print(command)
        process = subprocess.Popen(command)
        process.wait()
else:
    for fin in list_input:
        command = [exec_bin, macro, fin]
        print(command)
        process = subprocess.Popen(command)
Beispiel #13
0
exec_bin = os.path.join(vmc_dir, 'build/bin/koa_execute')

# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("-d",
                    "--directory",
                    help="directory where files are located")
parser.add_argument("-s", "--suffix", help="suffix of the input file")

args = parser.parse_args()
file_list = args.infile

in_dir = './'
if (args.directory):
    in_dir = args.directory
in_dir = os.path.expanduser(in_dir)

suffix = '.root'
if (args.suffix):
    suffix = args.suffix

#
list_file = batch.get_list(file_list, suffix, in_dir)

for fin in list_file:
    command = [exec_bin, macro, fin, 'koalasim']
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #14
0
parser.add_argument("-d",
                    "--directory",
                    default="digi",
                    help="directory where files are located")
parser.add_argument("-s",
                    "--suffix",
                    default=".root",
                    help="suffix of the input file")
parser.add_argument("--cluster_dir",
                    default="calib",
                    help="directory containing the cluster file")
parser.add_argument("--cluster_suffix",
                    default="_calib.root",
                    help="suffix of the cluster file")
parser.add_argument("--cluster_branch",
                    default="KoaRecCluster_ThresholdFilter",
                    help="name of the cluster branch")

args = parser.parse_args()
file_list = args.infile

#
list_file = batch.get_list(file_list, args.suffix, args.directory)
list_cluster = batch.get_list(file_list, args.cluster_suffix, args.cluster_dir)

for fin, fcluster in zip(list_file, list_cluster):
    command = [exec_bin, macro, fin, fcluster, args.cluster_branch]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)
para_dir = os.path.expanduser(args.para_dir)

thresh_file = ""
if args.thresh_file != "":
    thresh_file = os.path.expanduser(args.thresh_file)

if args.mode == 'absolute':
    macro = os.path.join(
        vmc_dir,
        'macro/koala/rec_tasks/run_cluster_purification_AbsoluteMode.C')
elif args.mode == 'percentage':
    macro = os.path.join(
        vmc_dir,
        'macro/koala/rec_tasks/run_cluster_purification_PercentageMode.C')

# add rec each file in the list
list_input = batch.get_list(args.infile, args.suffix, in_dir)
list_para = batch.get_list(args.infile, "_param.root", para_dir)

# invoking the command
for fin, fpara in zip(list_input, list_para):
    command = [
        exec_bin, macro, fin, fpara, args.branch, args.threshold, thresh_file
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
                    default="_calib_ThresholdFilter_smear.root")
parser.add_argument("--cluster_br", default="KoaRecCluster_Smear")
parser.add_argument("--cluster_nr",
                    default="-1",
                    help="Threshold of number of clusters")

args = parser.parse_args()
file_list = args.infile

in_dir = './'
if (args.directory):
    in_dir = args.directory
in_dir = os.path.expanduser(in_dir)

suffix = '.root'
if (args.suffix):
    suffix = args.suffix

#
list_file = batch.get_list(file_list, suffix, in_dir)
list_fcluster = batch.get_list(file_list, args.cluster_suffix,
                               args.cluster_dir)

for fin, fcluster in zip(list_file, list_fcluster):
    command = [
        exec_bin, macro, fin, fcluster, args.cluster_br, args.cluster_nr
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #17
0
                    '--suffix',
                    default='.root',
                    help='suffix of the input file')
parser.add_argument('--hdir',
                    default='rec_adc',
                    help='directory for histograms to be fitted')
parser.add_argument('--hsuffix',
                    default='adc',
                    help='suffix for histogram name')
parser.add_argument('--seed',
                    default='adc_pedestal_20190902_003449.txt',
                    help='pedestal seed file')
parser.add_argument('-o', '--outdir', default='./', help='output directory')

# arguments parsing
args = parser.parse_args()

file_list = args.infile
in_dir = os.path.expanduser(args.directory)
out_dir = os.path.expanduser(args.outdir)

#
list_infile = batch.get_list(file_list, args.suffix, in_dir)
list_outfile = batch.get_list(file_list, '_pedestal_fit.txt', out_dir)

for fin, fout in zip(list_infile, list_outfile):
    command = [exec_bin, macro, fin, args.hdir, args.hsuffix, fout, args.seed]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #18
0
macro = os.path.join(vmc_dir, 'macro/koala/ana_tasks/accumulate_koala_cluster.C')
exec_bin = os.path.join(vmc_dir,'build/bin/koa_execute')

# arguments definitions
parser = argparse.ArgumentParser()
parser.add_argument("infile",help="the file list to be processed")
parser.add_argument("--cluster_dir",
                    help="directory where files are located")
parser.add_argument("--cluster_suffix",
                    help="directory where files are located")
parser.add_argument("--digi_dir",
                    help="directory where files are located")
parser.add_argument("--digi_suffix",
                    help="directory where files are located")

args = parser.parse_args()

cluster_dir = os.path.expanduser(args.cluster_dir)
digi_dir = os.path.expanduser(args.digi_dir)

# add rec each file in the list
list_cluster = batch.get_list(args.infile, args.cluster_suffix, cluster_dir)
list_digi = batch.get_list(args.infile, args.digi_suffix, digi_dir)

# invoking the command
for fcluster,fdigi in zip(list_cluster, list_digi):
    command = [exec_bin, macro, fcluster, fdigi]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
                    help="directory where files are located")
parser.add_argument("-o",
                    "--output",
                    default="./",
                    help="directory where the output files are saved")
parser.add_argument("-s",
                    "--suffix",
                    default="_calib.root",
                    help="suffix of the output")
parser.add_argument("--pedestal", default="adc_pedestal_20190902_003449.txt")
parser.add_argument("--adc", default="adc_calib_energy_huagen.txt")
parser.add_argument("--tdc", default="tdc_calib_shift.txt")
parser.add_argument("--seed", default="cluster_seed_threshold.txt")

args = parser.parse_args()

in_dir = os.path.expanduser(args.directory)
out_dir = os.path.expanduser(args.output)

# add rec each file in the list
list_decoded = batch.get_list(args.infile, '.root', in_dir)
for fin in list_decoded:
    fpara = fin.replace(".root", "_param.root")
    command = [
        exec_bin, macro, fin, fpara, out_dir, args.suffix, args.pedestal,
        args.adc, args.tdc, args.seed
    ]
    print(command)
    process = subprocess.Popen(command)
    process.wait()
Beispiel #20
0
parser.add_argument("infile", help="the file list to be processed")
parser.add_argument("outfile", help="the output summed root file name")
parser.add_argument("-d",
                    "--directory",
                    help="directory where files are located")
parser.add_argument("-s", "--suffix", help="common suffix of the file")

args = parser.parse_args()
file_list = args.infile
outfile = args.outfile

in_dir = './'
if (args.directory):
    in_dir = args.directory
in_dir = os.path.expanduser(in_dir)

suffix = '_result.root'
if (args.suffix):
    suffix = args.suffix

list_decoded = batch.get_list(file_list, suffix, in_dir)
command.append(os.path.join(in_dir, outfile))
#command = [haddbin, os.path.join(in_dir, outfile)]
for fin in list_decoded:
    command.append(fin)

print(command)
process = subprocess.Popen(command)
# wait until process returns, so that mv in next step be meaningful
process.wait()