15#ifndef PATHLENGTUTILS_H
16#define PATHLENGTUTILS_H
23#include "CaloGeoHelpers/CaloSampling.h"
44 double phiMean(
double a,
double b)
const;
47 double getPathLengthInZ(
double zMin,
double zMax,
double z_entrance,
double z_exit)
const;
56 double mean_phi =
phiMean(phi_entrance, phi_exit);
58 double phi_min = mean_phi - dphi, phi_max = mean_phi + dphi;
66 double etaMin = cell.eta() - 0.5 * cell.caloDDE()->deta();
67 double etaMax = cell.eta() + 0.5 * cell.caloDDE()->deta();
68 if (fabs(eta_entrance - eta_exit) < 1e-6)
69 return eta_entrance > etaMin && eta_entrance < etaMax;
71 double etaMinTrack = std::min(eta_entrance, eta_exit);
72 double etaMaxTrack = std::max(eta_entrance, eta_exit);
73 return (std::min(etaMax, etaMaxTrack) - std::max(etaMin, etaMinTrack)) / (etaMaxTrack - etaMinTrack);
78 if (fabs(z_entrance - z_exit) < 1e-6)
79 return z_entrance > zMin && z_entrance < zMax;
81 double zMinTrack = std::min(z_entrance, z_exit);
82 double zMaxTrack = std::max(z_entrance, z_exit);
83 return (std::min(zMax, zMaxTrack) - std::max(zMin, zMinTrack)) / (zMaxTrack - zMinTrack);
88 return getPathLengthInZ(cell.z() - 0.5 * cell.caloDDE()->dz(), cell.z() + 0.5 * cell.caloDDE()->dz(), z_entrance, z_exit);
CaloPhiRange class declaration.
#define AmgMatrix(rows, cols)
Data object for each calorimeter readout cell.
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
double pathInsideCell(const CaloCell &cell, const CaloExtensionHelpers::EntryExitLayerMap &entryExitLayerMap) const
Return the length(mm) of the path crossed inside the cell, given the parameters for the extrapolation...
double getPathLengthInZ(double zMin, double zMax, double z_entrance, double z_exit) const
Return the % of path length crossed by the track inside a cell in Z.
static double getPathLengthInTile(const CaloCell &cell, const Amg::Vector3D &entry, const Amg::Vector3D &exit)
double phiMean(double a, double b) const
~PathLengthUtils()=default
bool crossedPhi(const CaloCell &cell, double phi_entrance, double phi_exit) const
Return true if the cell crossed was crossed by the track in phi.
static CaloSampling::CaloSample tileEntrance(CaloSampling::CaloSample sample)
double getPathLengthInEta(const CaloCell &cell, double eta_entrance, double eta_exit) const
Return the % of path length crossed by the track inside a cell in eta.
static CaloSampling::CaloSample tileExit(CaloSampling::CaloSample sample)
static double get3DPathLength(const CaloCell &cell, const Amg::Vector3D &entry, const Amg::Vector3D &exit, double drFix, double dzFix)
static bool crossingMatrix(const AmgMatrix(3, 3)&Matrix, const Amg::Vector3D &entry, Amg::Vector3D &path)
Eigen::Matrix< double, 3, 1 > Vector3D
std::map< CaloSampling::CaloSample, std::pair< Amg::Vector3D, Amg::Vector3D > > EntryExitLayerMap