Update 2-ph sample size to 6; optimize MC logics
This commit is contained in:
@@ -12,7 +12,7 @@ def generate_sample(input_tuple):
|
|||||||
### generate samples with given number of photons, energy, sample size, and noise level
|
### generate samples with given number of photons, energy, sample size, and noise level
|
||||||
'''
|
'''
|
||||||
input file contains single photon clusters (3x3)
|
input file contains single photon clusters (3x3)
|
||||||
assemble them into multi-photon pile-up clusters (e.g. 7x7 for 2 photons, 9x9 for 3 photons)
|
assemble them into multi-photon pile-up clusters (e.g. 6x6 for 2 photons, 9x9 for 3 photons)
|
||||||
'''
|
'''
|
||||||
output_path = conf.output_folder
|
output_path = conf.output_folder
|
||||||
all_samples, all_labels = None, None
|
all_samples, all_labels = None, None
|
||||||
@@ -49,7 +49,9 @@ def generate_sample(input_tuple):
|
|||||||
_sample = all_samples[_idx]
|
_sample = all_samples[_idx]
|
||||||
_label = all_labels[_idx].copy() ### copy the label to avoid modifying the original label in all_labels
|
_label = all_labels[_idx].copy() ### copy the label to avoid modifying the original label in all_labels
|
||||||
|
|
||||||
_ref_x, _ref_y = np.random.randint(conf.sample_size, conf.sample_size*2-2), np.random.randint(conf.sample_size, conf.sample_size*2-2) ### random reference point of the lower-left photon in the sample, make sure the 3x3 cluster can fit in the sample
|
_ref_x, _ref_y = np.random.randint(0, sample.shape[1]-3), np.random.randint(0, sample.shape[0]-3) ### random reference point of the lower-left photon in the sample, make sure the 3x3 cluster can fit in the sample
|
||||||
|
if _ == 0:
|
||||||
|
_ref_x, _ref_y = sample.shape[1]//2-1, sample.shape[0]//2-1 ### for the first photon, place it in the center of the sample, to reduce the phase space
|
||||||
sample[_ref_y:_ref_y+3, _ref_x:_ref_x+3] += _sample ### add the 3x3 cluster to the sample
|
sample[_ref_y:_ref_y+3, _ref_x:_ref_x+3] += _sample ### add the 3x3 cluster to the sample
|
||||||
_label[0] += _ref_x
|
_label[0] += _ref_x
|
||||||
_label[1] += _ref_y
|
_label[1] += _ref_y
|
||||||
|
|||||||
+1
-4
@@ -13,7 +13,7 @@ _pedestalAduFrame = None ### global pedestalAduFrame
|
|||||||
_noiseEneFrame = None ### global noiseEneFrame
|
_noiseEneFrame = None ### global noiseEneFrame
|
||||||
nChunks = 16
|
nChunks = 16
|
||||||
clusterSize3Photon = 9
|
clusterSize3Photon = 9
|
||||||
clusterSize2Photon = 7
|
clusterSize2Photon = 6
|
||||||
clusterSize1Photon = 3
|
clusterSize1Photon = 3
|
||||||
|
|
||||||
def init(cfg):
|
def init(cfg):
|
||||||
@@ -410,9 +410,6 @@ def _processFrames(idxChunk): ### for both single and double photon events, usin
|
|||||||
cluster_2Photon += signalEneFrame[int(ref_y):int(ref_y)+clusterSize2Photon, int(ref_x):int(ref_x)+clusterSize2Photon]
|
cluster_2Photon += signalEneFrame[int(ref_y):int(ref_y)+clusterSize2Photon, int(ref_x):int(ref_x)+clusterSize2Photon]
|
||||||
|
|
||||||
_hists['h1_2PhotonClusterEnergy'].Fill(np.sum(cluster_2Photon))
|
_hists['h1_2PhotonClusterEnergy'].Fill(np.sum(cluster_2Photon))
|
||||||
for i in range(clusterSize2Photon):
|
|
||||||
for j in range(clusterSize2Photon):
|
|
||||||
_hists['h2_2PhotonSumSample'].Fill(i, j, cluster_2Photon[i, j])
|
|
||||||
if 'writeClusters' in _cfg and _cfg['writeClusters'] == True:
|
if 'writeClusters' in _cfg and _cfg['writeClusters'] == True:
|
||||||
cluster_2Photon_list.append(cluster_2Photon)
|
cluster_2Photon_list.append(cluster_2Photon)
|
||||||
refpoint_2Photon_list.append([int(ref_x)+Roi[0], int(ref_y)+Roi[2]])
|
refpoint_2Photon_list.append([int(ref_x)+Roi[0], int(ref_y)+Roi[2]])
|
||||||
|
|||||||
Reference in New Issue
Block a user