Skip to content

Commit

Permalink
updated simulation grid
Browse files Browse the repository at this point in the history
  • Loading branch information
chiaratomaiuolo committed Jun 4, 2024
1 parent ab19bea commit 68370c5
Showing 1 changed file with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions scripts/simulate_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,61 @@
"""Simulate a grid of configurations.
"""

import numpy as np


from hexsample import HEXSAMPLE_DATA, logger
from hexsample.pipeline import hxsim, hxrecon
from hexsample.readout import HexagonalReadoutMode


# Number of events to be generated for each configuration.
NUM_EVENTS = 100000
# Detector thickness grid in cm.
THICKNESS = (0.005, 0.01, 0.015, 0.02, 0.025, 0.03, 0.035, 0.04, 0.045, 0.05)
THICKNESS = (0.02, 0.025, 0.03, 0.035)
# Equivalent noise charge grid in e.
NOISE = (0, 10, 20, 25, 30, 35, 40)
NOISE = (20, 30, 40)
# Chip pitch in cm
PITCH = (0.0050, 0.0055, 0.0060)
# Number of neirest neighbors in track clusters
N_NEIGHBORS = np.arange(1,8)
# Zero suppression threshold
THRESHOLD = np.linspace(0,1000,50)
# Zero-suppression threshold, expressed in units of enc.
SIGMA_THRESHOLD = 2.
# Number of neighbors for the clustering.
NUM_NEIGHBORS = 2
# Readout mode
#READOUT_MODE = HexagonalReadoutMode.CIRCULAR


'''
for thickness in THICKNESS:
for noise in NOISE:
# Simulate...
file_name = f'sim_{1.e4 * thickness:.0f}um_{noise:.0f}enc.h5'
file_path = HEXSAMPLE_DATA / file_name
kwargs = dict(outfile=file_path, thickness=thickness, noise=noise)
file_path = hxsim(numevents=NUM_EVENTS, **kwargs)
for pitch in PITCH:
# Simulate...
file_name = f'sim_{1.e4 * thickness:.0f}um_{noise:.0f}enc_{1e4 * pitch:.0f}pitch.h5'
file_path = HEXSAMPLE_DATA / file_name
kwargs = dict(outfile=file_path, thickness=thickness, noise=noise, pitch=pitch)
file_path = hxsim(numevents=NUM_EVENTS, **kwargs)
# ... and reconstruct.
threshold = noise * SIGMA_THRESHOLD
suffix = f'recon_nn{NUM_NEIGHBORS}_thr{threshold:.0f}'
kwargs = dict(zsupthreshold=threshold, nneighbors=NUM_NEIGHBORS, suffix=suffix)
hxrecon(infile=file_path, **kwargs)
'''

# Simulate...
file_name = f'sim_250um_20enc_60pitch.h5'
file_path = HEXSAMPLE_DATA / file_name
kwargs = dict(outfile=file_path, thickness=0.025, noise=20, pitch=0.006)
file_path = hxsim(numevents=NUM_EVENTS, **kwargs)

for thr in THRESHOLD:
for nn in N_NEIGHBORS:
# ... and reconstruct.
threshold = noise * SIGMA_THRESHOLD
suffix = f'recon_nn{NUM_NEIGHBORS}_thr{threshold:.0f}'
kwargs = dict(zsupthreshold=threshold, nneighbors=NUM_NEIGHBORS, suffix=suffix)
#threshold = 20 * SIGMA_THRESHOLD
suffix = f'recon_nn{nn}_thr{thr:.0f}'
kwargs = dict(zsupthreshold=thr, nneighbors=nn, suffix=suffix)
hxrecon(infile=file_path, **kwargs)


0 comments on commit 68370c5

Please sign in to comment.