hits_file = '' events_in = 0 not_fid = 0 for n in range(start,start+numb): hits_file = '/data_extra/paolafer/data/r{0}/hits/hits_{0}_trigger2_v0.9.9_20180921_krth1300.{1:04d}.h5'.format(run_number, n) if not os.path.isfile(hits_file): print('{0} not existing'.format(hits_file)) continue print('Analyzing {0}'.format(hits_file)) lost_energy = {} rhits = load_hits(hits_file) good_hits = load_hits_skipping_NN(hits_file) merge_NN_hits(rhits, good_hits, lost_energy) hits_evt = {} raw_energy = {} bad_event = {} for ee, hc in good_hits.items(): bad_evt = False hc_corr = [] hX = [hh.X for hh in hc.hits] hY = [hh.Y for hh in hc.hits] hZ = [hh.Z for hh in hc.hits] hE = [hh.E for hh in hc.hits]
# Add the energy. hadd_etot = sum([ha.E for ha in h_add]) for ha in h_add: ha.energy += h1.E*(ha.E/hadd_etot) # Check the sum of the energy. #e1 = sum([hh.E for hh in hc_all.hits]) #e2 = sum([hh.E for hh in hc.hits]) #if(abs(e1 - e2) > 0.001): # print("ERROR") ######################################################################################################### ## HITS if(os.path.isfile(hits_file)): hits_all = load_hits(hits_file) hits = load_hits_skipping_NN(hits_file) # Modifies the list of non-NN hits. merge_NN_hits(hits_all,hits) else: print("ERROR: hits not found.") exit() # Open the Pytables file to contain the hits information. h5f = tables.open_file(evt_file+'_hits.h5', "w", filters=tables.Filters(complib="blosc", complevel=9)) group_Reco = h5f.create_group(h5f.root, "Reco") Reco_table = h5f.create_table(group_Reco, "Reco", Reco, "Reco", tables.Filters(0)) fvox = h5py.File(evt_file+'_voxels.h5')
def TlMC_hits(ICDATADIR): hits_file_name = "dst_NEXT_v1_00_05_Tl_ACTIVE_100_0_7bar_DST_10.h5" hits_file_name = os.path.join(ICDATADIR, hits_file_name) hits = load_hits(hits_file_name) return hits