11#include <top/reconstruction_cpp/RaytracerBase.h>
12#include <top/reconstruction_cpp/InverseRaytracer.h>
13#include <top/reconstruction_cpp/PixelPositions.h>
14#include <top/reconstruction_cpp/PixelMasks.h>
15#include <top/reconstruction_cpp/PixelEfficiencies.h>
16#include <top/reconstruction_cpp/EnergyMask.h>
139 void set(
double X0,
double Step);
151 double getX(
int i)
const;
175 double getY(
int i)
const;
234 explicit YScanner(
int moduleID,
unsigned N = 64);
258 void prepare(
double momentum,
double beta,
double length)
const;
276 void expand(
unsigned col,
double yB,
double dydz,
const Derivatives& D,
int Ny,
bool doScan)
const;
447 double halfSize = win.evenReflection ? size / 2 : -size / 2;
448 const double ypix[2] = {yc - halfSize, yc + halfSize};
449 double yproj[2][2] = {{0}};
452 for (
int i = 0; i < 2; ++i) {
454 double z = ypix[i] * win.sz + win.z0;
455 double y = ypix[i] * win.sy + win.y0;
457 yproj[0][i] = y + dy;
458 yproj[1][i] = y - dy;
462 for (
int i = 0; i < 2; ++i) {
463 yproj[i][0] = std::max(yproj[i][0], -Bh);
464 yproj[i][1] = std::min(yproj[i][1], Bh);
465 proj[i].yc = (yproj[i][0] + yproj[i][1]) / 2;
466 proj[i].Dy = yproj[i][1] - yproj[i][0];
487 void scan(
unsigned col,
double yB,
double dydz,
const Derivatives& D,
int j1,
int j2)
const;
496 void merge(
unsigned col,
double dydz,
int j1,
int j2)
const;
517 mutable std::vector<double>
535 mutable std::map<int, Table>
547 friend class TOPRecoManager;
563 return (sol1.
yB - sol0.
yB) / sol1.
step;
608 if (k >=
entries.size())
return 0;
614 if (
sum == 0)
return;
A mask for energy masking.
Pixel relative efficiencies of a single module.
Pixel masks of a single module.
Pixel positions and dimensions in module local frame.
RaytracerBase(int moduleID, EGeometry geometry=c_Unified, EOptics optics=c_SemiLinear)
Constructor.
double m_cosTotal
cosine of total reflection angle
void prepare(double momentum, double beta, double length) const
Prepare for the PDF expansion in y for a given track mass hypothesis.
Table m_energyDistribution
photon energy distribution
double getMeanEnergyBeta1() const
Returns mean photon energy for beta = 1.
static unsigned s_maxTabulatedPower
maximal power of the surface reflectivity that is tabulated
PixelEfficiencies m_pixelEfficiencies
pixel relative efficiencies
double m_beta
particle beta
bool m_scanDone
true if scan performed, false if reflections just merged
Table m_efficiency
nominal photon detection efficiencies (PDE)
double getRMSEnergyBeta1() const
Returns r.m.s of photon energy for beta = 1.
double m_meanE
mean photon energy
double getSigmaScattering() const
Returns r.m.s of multiple scattering angle in quartz converted to photon energy.
PixelMasks & pixelMasks()
Returns non-const pixel masks.
double getTrackLengthInQuartz() const
Returns particle trajectory length inside quartz.
static int s_maxReflections
maximal number of reflections to perform scan
double m_rmsE
r.m.s of photon energy
std::vector< double > m_surfaceReflectivities
bar surface reflectivity to the power of the index; filled on demand, never cleared
bool m_aboveThreshold
true if beta is above the Cerenkov threshold
void projectPixel(double yc, double size, int k, double dydz, PixelProjection proj[2]) const
Calculates projections of a pixel to prism entrance window (going down-stream the photon).
const std::map< int, Table > & getQuasyEnergyDistributions() const
Returns photon energy distributions convoluted with multiple scattering and surface roughness.
void merge(unsigned col, double dydz, int j1, int j2) const
Performs expansion by merging all reflections.
double getNumPhotonsPerLen() const
Returns number of photons per Cerenkov azimuthal angle per track length.
const PixelPositions & getPixelPositions() const
Returns pixel positions and their sizes.
void scan(unsigned col, double yB, double dydz, const Derivatives &D, int j1, int j2) const
Performs expansion w/ the scan over reflections.
double tabulateSurfaceReflectivity(unsigned n) const
Extends the table of surface reflectivity powers up to n and returns the value.
double m_meanE0
mean photon energy for beta = 1
double m_momentum
particle momentum magnitude
const PixelMasks & getPixelMasks() const
Returns pixel masks.
Table * m_quasyEnergyDistribution
a pointer to the element in m_quasyEnergyDistributions
double getCosTotal() const
Returns cosine of total reflection angle.
PixelMasks m_pixelMasks
pixel masks
void setQuasyEnergyDistribution(double sigma) const
Sets photon energy distribution convoluted with a normalized Gaussian.
void integrate(const EnergyMask *energyMask, double Ecp, Result &result) const
Integrates quasy energy distribution multiplied with energy mask.
void expand(unsigned col, double yB, double dydz, const Derivatives &D, int Ny, bool doScan) const
Performs the PDF expansion in y for a given pixel column using scan or merge methods.
YScanner(int moduleID, unsigned N=64)
Class constructor.
std::map< int, Table > m_quasyEnergyDistributions
photon energy distributions convoluted with Gaussian of different widths
PixelEfficiencies & pixelEfficiencies()
Returns non-const pixel relative efficiencies.
std::vector< WindowProjection > m_windowProjections
pixel projection constants of unfolded prism exit windows
double getSurfaceReflectivity(unsigned n) const
Returns the reflectivity of the bar surface raised to the given power.
double getSigmaAlpha() const
Returns surface roughness parameter in units of photon energy.
const Table & getEnergyDistribution() const
Returns photon energy distribution.
double setEnergyDistribution(double beta) const
Sets photon energy distribution and mean photon energy according to nominal PDE and particle beta.
static void setScanLimits(int maxReflections)
Sets parameters for selection between expand methods.
const Table & getEfficiencies() const
Returns nominal photon detection efficiencies (PDE)
double m_length
length of particle trajectory inside quartz
double getNumPhotons() const
Returns number of photons per Cerenkov azimuthal angle.
double getMeanEnergy() const
Returns mean photon energy.
double m_rmsE0
r.m.s of photon energy for beta = 1
bool isAboveThreshold() const
Returns above Cerenkov threshold flag which is set in the prepare method.
std::vector< Result > m_results
results of PDF expansion in y
double m_prismZR
z of the prism-bar joint (copy of m_prism.zR)
const PixelEfficiencies & getPixelEfficiencies() const
Returns pixel relative efficiencies.
bool isScanDone() const
Checks which expansion method was used.
const std::vector< Result > & getResults() const
Returns the results of PDF expansion in y.
PixelPositions m_pixelPositions
positions and sizes of pixels
void clear() const
Clear mutable variables.
double m_numPhotons
number of photons per Cerenkov azimuthal angle per track length
double m_halfBarThickness
half thickness of the bar at prism entrance
double m_sigmaAlpha
surface roughness parameter in photon energy units
double getRMSEnergy() const
Returns r.m.s of photon energy.
double getBeta() const
Returns particle beta.
double getMomentum() const
Returns particle momentum.
long lround(double x)
Rounds to the nearest integer, halfway cases away from zero.
Abstract base class for different kinds of events.
Solution of inverse ray-tracing.
double yB
unfolded coordinate y of photon at Bar exit plane
double step
step for numerical derivative calculation
double cosFic
cosine of azimuthal Cerenkov angle
double sinFic
sine of azimuthal Cerenkov angle
double len
propagation length to detector plane
static double dyB_d(const InverseRaytracer::Solution &sol0, const InverseRaytracer::Solution &sol1)
Calculates the derivative of unfolded y coordinate at prism entrance.
static double dLen_d(const InverseRaytracer::Solution &sol0, const InverseRaytracer::Solution &sol1)
Calculates the derivative of propagation length.
double dFic_de
Cerenkov azimuthal angle over photon energy.
double dLen_de
propagation length over photon energy
Derivatives()
Default constructor.
double dFic_dx
Cerenkov azimuthal angle over photon detection coordinate x.
double dFic_dL
Cerenkov azimuthal angle over running parameter of particle trajectory.
double dLen_dL
propagation length over running parameter of particle trajectory
double dyB_de
unfolded y coordinate at prism entrance over photon energy
double dLen_dx
propagation length over photon detection coordinate x
double dyB_dL
unfolded y coordinate at prism entrance over running parameter of particle trajectory
double dyB_dx
unfolded y coordinate at prism entrance over photon detection coordinate x
static double dFic_d(const InverseRaytracer::Solution &sol0, const InverseRaytracer::Solution &sol1)
Calculates the derivative of Cerenkov azimuthal angle.
Down-stream projection of a pixel to prism entrance window w/ a clip on bar exit thickness.
double yc
center in y of clipped pixel projection
bool operator<(const PixelProjection &other) const
operator "less than" needed for sorting
const EnergyMask * mask
the corresponding energy mask
double Dy
size in y of clipped pixel projection
double e0
mean photon energy of the peak
double sum
peak area proportional to number of photons
double sigsq
width of the peak squared, in photon energy units
void set()
Sets the mean and width-squared from the accumulated values.
Result(int ID)
Constructor with pixel ID.
int pixelID
pixel ID (1-based)
TableEntry(double Y, double X, double Xsq)
Constructor.
A table of equidistant entries.
Table()
Default constructor.
double getY(int i) const
Returns y for a given index.
int getIndex(double x) const
Returns index.
std::vector< TableEntry > entries
table entries
double getXmax() const
Returns x of the last entry.
double getX(int i) const
Returns x for a given index.
void clear()
Clear the content entirely.
double getXmin() const
Returns x of the first entry.
double x0
x of first entry
void set(double X0, double Step)
Sets the first x and the step, and clears the entries.
Geometry-only quantities needed to project a pixel to a given unfolded prism exit window.
double sz
window surface direction in z
double z0
z of the window origin, displaced to the prism entrance plane
bool evenReflection
true if the window has the same orientation as the true one
double sy
window surface direction in y
double y0
y of the window origin, displaced to the prism entrance plane