diff --git a/__main__.py b/__main__.py index f220c4f06e7f68f385114e1970bc40abf7ba71c7..c428ce797b848c0d03d0e2551d45b67679dc45b6 100755 --- a/__main__.py +++ b/__main__.py @@ -34,7 +34,7 @@ parser_draw.add_argument('label', help='LABEL to identify root files') parser_elec = subparsers.add_parser('elec', help='electronic readout') parser_elec.add_argument('label', help='LABEL to identify electronics operations') parser_elec.add_argument('name', help='LABEL to identify electronics files') -parser_elec.add_argument('-tct', help='signal from TCT', action="store_true") +parser_elec.add_argument('-tct', help='signal from TCT') parser_field = subparsers.add_parser('field', help='calculate field/weight field and iv/cv') parser_field.add_argument('label', help='LABEL to identify operation') diff --git a/current/cal_current.py b/current/cal_current.py index ee5236d2baa674142b7d05c4f7ca5c8dea0c0147..a95770618e8af03cfd383c32017f63a74b4dd4bd 100644 --- a/current/cal_current.py +++ b/current/cal_current.py @@ -294,11 +294,9 @@ class CalCurrent: def save_current(self, my_d, key=None): + path = output(__file__, my_d.det_name) if key==None: - path = output(__file__, my_d.det_name) key = "" - else: - path = output(__file__, my_d.det_name, key) time = array('d', [999.]) current = array('d', [999.]) diff --git a/elec/__init__.py b/elec/__init__.py index 85f43c8e77604bae0bb4a8d3694b188881358513..15a61ca4bfec31af007f6668fedcdf4e9121a67a 100644 --- a/elec/__init__.py +++ b/elec/__init__.py @@ -5,7 +5,7 @@ from util.output import output def main(kwargs): label = kwargs['label'] # Operation label or detector name name = kwargs['name'] - is_tct = kwargs['tct'] + tct = kwargs['tct'] os.makedirs('output/elec/{}'.format(name), exist_ok=True) if label == 'trans': @@ -20,10 +20,12 @@ def main(kwargs): else: from . import ngspice_set_input from . import ngspice_set_tmp_cir - input_p = ngspice_set_input.set_input(label, is_tct) + if tct == None: + tct = '' + input_p = ngspice_set_input.set_input(label, tct) input_c=','.join(input_p) ngspice_set_tmp_cir.ngspice_set_tmp_cir(input_c, label, name) subprocess.run(['ngspice -b output/elec/{}/{}_tmp.cir'.format(label, name)], shell=True) file_path = output(__file__, label) from . import ngspice_get_fig - ngspice_get_fig.main(name, file_path) + ngspice_get_fig.main(name, file_path, tct) diff --git a/elec/ngspice_get_fig.py b/elec/ngspice_get_fig.py index 32abce1e81135bd18f3dfdf9fdc7b23ec69b6470..0b8c8f28075758edf682df6f4a178102ea31181f 100644 --- a/elec/ngspice_get_fig.py +++ b/elec/ngspice_get_fig.py @@ -24,8 +24,8 @@ def read_file(file_path,file_name): return time,volt -def main(elec_name, file_path): - fig_name = os.path.join(file_path, elec_name+'.pdf') +def main(elec_name, file_path, key=None): + fig_name = os.path.join(file_path, elec_name+key+'.pdf') time,volt = [],[] time,volt = read_file(file_path, elec_name+'.raw') diff --git a/elec/ngspice_set_input.py b/elec/ngspice_set_input.py index 493357c8399d0b0afb578670e98e5d4ccad8a48f..4be753e246802bd6feabbd4a4643db4d1e335cce 100644 --- a/elec/ngspice_set_input.py +++ b/elec/ngspice_set_input.py @@ -13,10 +13,7 @@ def set_input(det_name, is_tct=False, key=None): if key == None: key = "" path = "output/current/{}".format(det_name) - if is_tct: - myFile = ROOT.TFile(os.path.join(path, "sim-current-TCT"+str(key))+".root") - else: - myFile = ROOT.TFile(os.path.join(path, "sim-current"+str(key))+".root") + myFile = ROOT.TFile(os.path.join(path, "sim-current"+str(key))+".root") myt = myFile.tree for entry in myt: diff --git a/elec/readout.py b/elec/readout.py index edd218cf66ba64422be5c1cc0764940c95ce16ee..1b19191f2d1e48b7a31854037ff490d6d1fee0bd 100644 --- a/elec/readout.py +++ b/elec/readout.py @@ -212,9 +212,9 @@ class Amplifier: volt = array('d', [999.]) time = array('d', [999.]) if self.read_ele_num==1: - fout = ROOT.TFile(os.path.join(path, "sim-current") + str(key) + ".root", "RECREATE") + fout = ROOT.TFile(os.path.join(path, "amplified-current") + str(key) + ".root", "RECREATE") else: - fout = ROOT.TFile(os.path.join(path, "sim-current") + str(key)+"No_"+str(j)+".root", "RECREATE") + fout = ROOT.TFile(os.path.join(path, "amplified-current") + str(key)+"No_"+str(j)+".root", "RECREATE") t_out = ROOT.TTree("tree", "signal") t_out.Branch("volt", volt, "volt/D") t_out.Branch("time", time, "time/D") diff --git a/tct/tct_signal.py b/tct/tct_signal.py index bf9569d7e1fb822a45917395decae6a8cde2b179..6ecf8e6c11bf69e51c270ae85dbd13200ec8982c 100644 --- a/tct/tct_signal.py +++ b/tct/tct_signal.py @@ -68,7 +68,7 @@ def main(kwargs): my_current = ccrt.CalCurrentLaser(my_d, my_f, my_l) if 'ngspice' in amplifier: - my_current.save_current(my_d) + my_current.save_current(my_d, my_l.model) else: path = output(__file__, my_d.det_name, my_l.model) ele_current = rdo.Amplifier(my_current.sum_cu, amplifier)