ATLAS Offline Software
Functions
CaloCellHelpers.h File Reference
#include <cmath>
#include "CaloEvent/CaloCell.h"
#include "CaloGeoHelpers/CaloPhiRange.h"
Include dependency graph for CaloCellHelpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double phiMean (double a, double b)
 
bool crossedPhi (const CaloCell &cell, double phi_entrance, double phi_exit)
 Return true if the cell crossed was crossed by the track in phi. More...
 
double getPathLengthInEta (const CaloCell &cell, double eta_entrance, double eta_exit)
 Return the % of path length crossed by the track inside a cell in eta. More...
 
double getPathLengthInZ (double zMin, double zMax, double z_entrance, double z_exit)
 Return the % of path length crossed by the track inside a cell in Z. More...
 
double getPathLengthInZ (const CaloCell &cell, double z_entrance, double z_exit)
 Return the % of path length crossed by the track inside a cell in Z. More...
 
double pathInsideCell (const CaloCell &cell, const Amg::Vector3D &entry, const Amg::Vector3D &exit)
 Return the % of the path crossed inside the cell, given the parameters for the extrapolation at entrance and exit of the layer. More...
 

Function Documentation

◆ crossedPhi()

bool crossedPhi ( const CaloCell cell,
double  phi_entrance,
double  phi_exit 
)
inline

Return true if the cell crossed was crossed by the track in phi.

Definition at line 16 of file CaloCellHelpers.h.

16  {
17  double mean_phi = phiMean(phi_entrance, phi_exit);
18  double dphi = fabs(CaloPhiRange::diff(phi_entrance, phi_exit));
19  double phi_min = mean_phi - dphi, phi_max = mean_phi + dphi;
20 
21  return (CaloPhiRange::diff(cell.phi() + cell.caloDDE()->dphi() / 2., phi_min) > 0 &&
22  CaloPhiRange::diff(phi_max, cell.phi() - cell.caloDDE()->dphi() / 2.) > 0);
23 }

◆ getPathLengthInEta()

double getPathLengthInEta ( const CaloCell cell,
double  eta_entrance,
double  eta_exit 
)
inline

Return the % of path length crossed by the track inside a cell in eta.

Definition at line 26 of file CaloCellHelpers.h.

26  {
27  double etaMin = cell.eta() - 0.5 * cell.caloDDE()->deta();
28  double etaMax = cell.eta() + 0.5 * cell.caloDDE()->deta();
29  if (fabs(eta_entrance - eta_exit) < 1e-6) // to avoid FPE
30  return eta_entrance > etaMin && eta_entrance < etaMax;
31 
32  double etaMinTrack = std::min(eta_entrance, eta_exit);
33  double etaMaxTrack = std::max(eta_entrance, eta_exit);
34  return (std::min(etaMax, etaMaxTrack) - std::max(etaMin, etaMinTrack)) / (etaMaxTrack - etaMinTrack);
35 }

◆ getPathLengthInZ() [1/2]

double getPathLengthInZ ( const CaloCell cell,
double  z_entrance,
double  z_exit 
)
inline

Return the % of path length crossed by the track inside a cell in Z.

Definition at line 48 of file CaloCellHelpers.h.

48  {
49  return getPathLengthInZ(cell.z() - 0.5 * cell.caloDDE()->dz(), cell.z() + 0.5 * cell.caloDDE()->dz(), z_entrance, z_exit);
50 }

◆ getPathLengthInZ() [2/2]

double getPathLengthInZ ( double  zMin,
double  zMax,
double  z_entrance,
double  z_exit 
)
inline

Return the % of path length crossed by the track inside a cell in Z.

Definition at line 38 of file CaloCellHelpers.h.

38  {
39  if (fabs(z_entrance - z_exit) < 1e-6) // to avoid FPE
40  return z_entrance > zMin && z_entrance < zMax;
41 
42  double zMinTrack = std::min(z_entrance, z_exit);
43  double zMaxTrack = std::max(z_entrance, z_exit);
44  return (std::min(zMax, zMaxTrack) - std::max(zMin, zMinTrack)) / (zMaxTrack - zMinTrack);
45 }

◆ pathInsideCell()

double pathInsideCell ( const CaloCell cell,
const Amg::Vector3D entry,
const Amg::Vector3D exit 
)
inline

Return the % of the path crossed inside the cell, given the parameters for the extrapolation at entrance and exit of the layer.

Definition at line 84 of file CaloCellHelpers.h.

84  {
85  if (!crossedPhi(cell, entry.phi(), exit.phi())) return 0;
86  double pathCrossed = 0;
87  if (cell.caloDDE()->getSubCalo() != CaloCell_ID::TILE)
88  pathCrossed = getPathLengthInEta(cell, entry.eta(), exit.eta());
89  else if (cell.caloDDE()->getSampling() == CaloCell_ID::TileBar1) // ladder shape cells, divide the problem in 2
90  pathCrossed = 0; // getPathLengthInZTileBar1(cell, entry.z(), exit.z());
91  else
92  pathCrossed = getPathLengthInZ(cell, entry.z(), exit.z());
93  if (pathCrossed <= 0) return 0;
94  return pathCrossed;
95 }

◆ phiMean()

double phiMean ( double  a,
double  b 
)
inline

Definition at line 13 of file CaloCellHelpers.h.

13 { return 0.5 * (a + b) + (a * b < 0) * M_PI; }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
crossedPhi
bool crossedPhi(const CaloCell &cell, double phi_entrance, double phi_exit)
Return true if the cell crossed was crossed by the track in phi.
Definition: CaloCellHelpers.h:16
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
getPathLengthInEta
double getPathLengthInEta(const CaloCell &cell, double eta_entrance, double eta_exit)
Return the % of path length crossed by the track inside a cell in eta.
Definition: CaloCellHelpers.h:26
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
phiMean
double phiMean(double a, double b)
Definition: CaloCellHelpers.h:13
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
getPathLengthInZ
double getPathLengthInZ(double zMin, double zMax, double z_entrance, double z_exit)
Return the % of path length crossed by the track inside a cell in Z.
Definition: CaloCellHelpers.h:38
calibdata.exit
exit
Definition: calibdata.py:236
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
CaloPhiRange::diff
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
Definition: CaloPhiRange.cxx:22