Fix ClusterFinder NY, NX sequence
This commit is contained in:
+12
-1
@@ -124,6 +124,11 @@ def bookHistograms(energy, suffix='', energyBinWidth=0.1, isMC=False):
|
||||
)
|
||||
histograms['h1_2PhotonClusterPixelEnergy'].SetTitle('2-Photon Cluster Pixel Energy;Energy [keV];Counts')
|
||||
|
||||
histograms['h2_SumFrame'] = TH2D(
|
||||
f'h2_SumFrame{suffix}', f'h2_SumFrame{suffix}', roi_width, roi_x0, roi_x1, roi_height, roi_y0, roi_y1
|
||||
)
|
||||
histograms['h2_SumFrame'].SetTitle('Sum Frame;X [pixel];Y [pixel];Energy Sum [keV]')
|
||||
|
||||
histograms['h2_HitsSumFrame'] = TH2D(
|
||||
f'h2_HitsSumFrame{suffix}', f'h2_HitsSumFrame{suffix}', roi_width, roi_x0, roi_x1, roi_height, roi_y0, roi_y1
|
||||
)
|
||||
@@ -171,11 +176,12 @@ def _processFrames(idxChunk): ### for both single and double photon events, usin
|
||||
Roi = _cfg['Roi']
|
||||
nFramePerFile = os.path.getsize(f'{signalFileNames[0]}') // (NX * NY + 56) // 2
|
||||
_hists = bookHistograms(Energy, f'_{idxChunk}')
|
||||
sumFrame = np.zeros((NY, NX), dtype=np.float64)
|
||||
|
||||
### create a cluster finder
|
||||
nxROI = Roi[1] - Roi[0]
|
||||
nyROI = Roi[3] - Roi[2]
|
||||
CF = aare.VarClusterFinder((nxROI, nyROI), 5) ### arg1: frame size, arg2: threshold
|
||||
CF = aare.VarClusterFinder((nyROI, nxROI), 5) ### arg1: frame size, arg2: threshold
|
||||
CF.set_peripheralThresholdFactor(3)
|
||||
CF.set_noiseMap(_noiseEneFrame)
|
||||
|
||||
@@ -244,6 +250,7 @@ def _processFrames(idxChunk): ### for both single and double photon events, usin
|
||||
|
||||
signalAduFrame = signalAduFrame - _pedestalAduFrame
|
||||
signalEneFrame = convertAduFrameToEnergyFrame(signalAduFrame)
|
||||
sumFrame += signalEneFrame
|
||||
|
||||
CF.find_clusters_X(signalEneFrame[Roi[2]:Roi[3], Roi[0]:Roi[1]])
|
||||
clusters = CF.hits()
|
||||
@@ -323,6 +330,10 @@ def _processFrames(idxChunk): ### for both single and double photon events, usin
|
||||
_hists['h1_PixelEnergy'].Fill(enes[i])
|
||||
_hists['h2_HitsSumFrame'].Fill(xs[i]+Roi[0], ys[i]+Roi[2], enes[i])
|
||||
|
||||
for _x in range(Roi[0], Roi[1]):
|
||||
for _y in range(Roi[2], Roi[3]):
|
||||
signalEneFrame[_x, _y]
|
||||
_hists['h2_SumFrame'].Fill(_x, _y, sumFrame[_y, _x])
|
||||
if 'writeClusters' in _cfg and _cfg['writeClusters'] == True:
|
||||
flush_h5_buffer()
|
||||
h5_1Photon_file.close()
|
||||
|
||||
Reference in New Issue
Block a user