def pipe_ana_a_asic(cc, rms_rootpath, fpga_rootpath, asic_rootpath, APAno = 4, \ rmsrunno = "run01rms", fpgarunno = "run01fpg", asicrunno = "run01asi", wibno=0, fembno=0, asicno=0, gain="250", tp="05" ,\ jumbo_flag=False , apa= "ProtoDUNE" ): femb_pos_np = femb_position(APAno) wibfemb = "WIB" + format(wibno, '02d') + "_" + "FEMB" + format( fembno, '1d') apainfo = None for femb_pos in femb_pos_np: if femb_pos[1] == wibfemb: apainfo = femb_pos break feset_info = [gain, tp] apa_map = APA_MAP() apa_map.APA = apa All_sort, X_sort, V_sort, U_sort = apa_map.apa_femb_mapping() rmsdata = read_rawdata_fast(rms_rootpath, rmsrunno, wibno, fembno, 16 * asicno, gain, tp, jumbo_flag) fpg_cali_flg = False if (os.path.exists(fpga_rootpath + fpgarunno)): fpg_cali_flg = True fpgadata = read_rawdata_fast(fpga_rootpath, fpgarunno, wibno, fembno, 16 * asicno, gain, tp, jumbo_flag) asi_cali_flg = False if (os.path.exists(asic_rootpath + asicrunno)): asi_cali_flg = True asicdata = read_rawdata_fast(asic_rootpath, asicrunno, wibno, fembno, 16 * asicno, gain, tp, jumbo_flag) asic_results = [] for chni in range(16): chnno = chni + 16 * asicno wireinfo = None for onewire in All_sort: if (int(onewire[1]) == chnno): wireinfo = onewire break chn_noise_paras = noise_a_chn_fast(rmsdata, chnno, fft_en=False) rms = chn_noise_paras[1] ped = chn_noise_paras[2] hfrms = chn_noise_paras[7] hfped = chn_noise_paras[8] sfrms = chn_noise_paras[13] sfped = chn_noise_paras[14] unstk_ratio = chn_noise_paras[15] if (fpg_cali_flg): chn_fpga_paras = cali_a_chn(fpgadata, chnno) fpg_encperlsb, fpg_chninl, fpg_areaperlsb, fpg_areachninl = cali_linear_calc( chn_fpga_paras) else: fpg_encperlsb, fpg_chninl, fpg_areaperlsb, fpg_areachninl = [ -1, -1, -1, -1 ] if (asi_cali_flg): chn_asic_paras = cali_a_chn(asicdata, chnno) asi_encperlsb, asi_chninl, asi_areaperlsb, asi_areachninl = cali_linear_calc( chn_asic_paras) else: asi_encperlsb, asi_chninl, asi_areaperlsb, asi_areachninl = [ -1, -1, -1, -1 ] asic_results.append([apainfo, wireinfo, feset_info, wibno, fembno, chnno, rms ,ped ,hfrms ,hfped ,sfrms ,sfped ,unstk_ratio, \ fpg_cali_flg, fpg_encperlsb, fpg_chninl, asi_cali_flg, asi_encperlsb, asi_chninl, fpg_areaperlsb, fpg_areachninl, asi_areaperlsb,asi_areachninl, ]) toqueue = asic_results cc.send(toqueue) cc.close()