src.detector module#

Toy detector model: photon transport to a forward EM calorimeter.

  • Geometry: plane at z = z_cal, circular active area of radius R.

  • Escape: exponential survival in target with lambda = (9/7) X0 (pair production).

  • Measurement: smear (x,y) on calorimeter and smear energy. Possibly include additional material-dependent smearing terms based on photon path length in target.

  • Selection: energy threshold on measured energy, cluster separation.

  • Reconstruction: eta, phi from (x_meas, y_meas, z_cal - z_vtx).

L-dependence via:

  • path length in material before exiting target

  • vertex depth z_vtx which affects geometry and separation at the calorimeter plane.

  • smearing via material-dependent terms based on path length.

src.detector.intersect_calo_plane(photon_p4, z_vtx_cm, z_cal_cm)[source]#

Intersect photon trajectory with a plane z = z_cal.

Parameters:
  • photon_p4 (ROOT.TLorentzVector) – Photon 4-vector in LAB.

  • z_vtx_cm (float) – Production vertex z (cm).

  • z_cal_cm (float) – Calorimeter plane position z (cm).

Returns:

  • ok (bool) – True if the photon goes forward and intersects the plane.

  • x_cm, y_cm (float) – Intersection coordinates on the plane (cm).

src.detector.passes_calo_aperture(x_cm, y_cm, R_cm)[source]#

Circular active area cut.

Parameters:
  • x_cm (float) – Impact point on calo plane.

  • y_cm (float) – Impact point on calo plane.

  • R_cm (float) – Active radius.

Returns:

ok (bool) – True if inside active area.

src.detector.photon_exit_length_cm(photon_p4, z_vtx_cm, L_cm, R_tgt_cm)[source]#

Geometric path length (cm) a photon must travel to exit the target.

Verify both forward and lateral exit.

Parameters:
  • photon_p4 (ROOT.TLorentzVector) – Photon 4-vector in LAB.

  • z_vtx_cm (float) – Production depth inside target.

  • L_cm (float) – Target thickness.

  • R_tgt_cm (float) – Target radius (cm).

Returns:

path_length (float) – Photon path length in cm.

src.detector.photon_escape_prob(photon_p4, z_vtx_cm, L_cm, R_tgt_cm)[source]#

Survival probability for a photon to exit the target.

Parameters:
  • photon_p4 (ROOT.TLorentzVector) – Photon 4-vector in LAB.

  • z_vtx_cm (float) – Production depth inside target.

  • L_cm (float) – Target thickness.

  • R_tgt_cm (float) – Target radius (cm).

Returns:

p_esc (float) – Escape probability in [0,1].

src.detector.smear_energy(rng, E_GeV, a=0.12, b=0.02, c=0.0, path_length=None)[source]#

Implement simple calorimeter energy resolution model.

The relative energy resolution is given by the quadratic sum of three terms: stochastic, constant, and noise. If path_length is provided, an additional material-dependent smearing term is added to the constant term based on the photon path length in the target.

Parameters:
  • rng (np.random.Generator) – Random number generator.

  • E_GeV (float) – Expected photon energy.

  • a (float) – Resolution parameters.

  • b (float) – Resolution parameters.

  • c (float) – Resolution parameters.

  • path_length (float or None) – Photon path length. If None, no extra smearing.

Returns:

E_meas (float) – Smeared energy (GeV), clipped to be >= 0.

src.detector.smear_position(rng, x_cm, y_cm, sigma_xy_cm=0.2, path_length=None)[source]#

Gaussian smearing of the shower centroid on calo plane.

If path_length is provided, an additional material-dependent smearing term is added to the constant term based on the photon path length in the target.

Parameters:
  • rng (np.random.Generator) – Random number generator.

  • x_cm (float) – Impact point on calo plane.

  • y_cm (float) – Impact point on calo plane.

  • sigma_xy_cm (float) – Position resolution (cm).

  • path_length (float or None) – Photon path length. If None, no extra smearing.

Returns:

x_meas, y_meas (float) – Measured hit coordinates.

src.detector.eta_phi_from_hit(x_cm, y_cm, z_vtx_cm, z_cal_cm)[source]#

Reconstruct direction (eta, phi) from measured hit position.

Parameters:
  • x_cm (float) – Measured hit coordinates.

  • y_cm (float) – Measured hit coordinates.

  • z_vtx_cm (float) – Production vertex z (cm).

  • z_cal_cm (float) – Calorimeter plane position z (cm).

Returns:

eta, phi (float) – Reconstructed direction in (eta, phi) space.

src.detector.deltaR(eta1, phi1, eta2, phi2)[source]#

Compute cluster separation in (eta, phi) space.

Parameters:
  • eta1 (float) – Direction from cluster 1.

  • phi1 (float) – Direction from cluster 1.

  • eta2 (float) – Direction from cluster 2.

  • phi2 (float) – Direction from cluster 2.

Returns:

dR (float) – Delta R separation between the two clusters.

src.detector.detect_two_photons(rng, g1_lab, g2_lab, z_vtx_cm, L_cm, z_cal_cm=1000.0, R_calo_cm=100.0, R_tgt_cm=10.0, E_thr_GeV=0.1, deltaR_min=0.02, sigma_xy_cm=0.2, res_a=0.12, res_b=0.01, en_material_smearing=True, xy_material_smearing=True)[source]#

Full detection chain for two photons.

Steps (per photon):

  • escape in target (stochastic)

  • intersect plane and aperture cut

  • smear energy and position

  • apply energy threshold on measured energy

Finally:

  • reconstruct eta/phi from smeared (x,y)

  • apply cluster separation deltaR > deltaR_min

Parameters:
  • rng (np.random.Generator) – Random number generator.

  • g1_lab (ROOT.TLorentzVector) – Photon 4-vectors in LAB.

  • g2_lab (ROOT.TLorentzVector) – Photon 4-vectors in LAB.

  • z_vtx_cm (float) – Production vertex z (cm).

  • L_cm (float) – Target thickness (cm).

  • z_cal_cm (float) – Calorimeter plane position z (cm).

  • R_calo_cm (float) – Calorimeter active radius (cm).

  • R_tgt_cm (float) – Target radius (cm).

  • E_thr_GeV (float) – Energy threshold on MEASURED energy (GeV).

  • deltaR_min (float) – Minimum separation between the two clusters.

  • sigma_xy_cm (float) – Position resolution (cm).

  • res_a (float) – Energy resolution parameters.

  • res_b (float) – Energy resolution parameters.

  • en_material_smearing (bool) – If True include material-dependent smearing in energy.

  • xy_material_smearing (bool) – If True include material-dependent smearing in position.

Returns:

  • ok (bool) – True if the event is reconstructed as two resolved photons.

  • out (dict) – If ok, contains measured kinematics for both photons and deltaR.