11#include <top/reconstruction_cpp/TOPTrack.h>
12#include <top/reconstruction_cpp/InverseRaytracer.h>
13#include <top/reconstruction_cpp/FastRaytracer.h>
14#include <top/reconstruction_cpp/YScanner.h>
15#include <top/reconstruction_cpp/SignalPDF.h>
16#include <top/reconstruction_cpp/BackgroundPDF.h>
17#include <top/reconstruction_cpp/DeltaRayPDF.h>
18#include <top/geometry/TOPGeometryPar.h>
94 Pull(
int pix,
double t,
double t0,
double tts0,
double sig,
double phi,
double w):
94 Pull(
int pix,
double t,
double t0,
double tts0,
double sig,
double phi,
double w): {
…}
208 photons += other->getExpectedSignalPhotons() + other->getExpectedDeltaPhotons();
232 ps += signalPDF.getIntegral(minTime, maxTime);
259 photons += other->getExpectedSignalPhotons(minTime, maxTime) + other->getExpectedDeltaPhotons(minTime, maxTime);
284 double getPDFValue(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const
284 double getPDFValue(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const {
…}
311 LogL
getLogL(
double t0,
double minTime,
double maxTime,
double sigt = 0)
const;
344 const std::vector<LogL>&
getPixelLogLs(
double t0,
double minTime,
double maxTime,
double sigt = 0)
const;
350 const std::vector<Pull>&
getPulls()
const;
379 if (not pdfOther)
return;
417 int solve(
double xD,
double zD,
int,
double,
double,
417 int solve(
double xD,
double zD,
int,
double,
double, {
…}
444 int solve(
double xD,
double zD,
int Nxm,
double xmMin,
double xmMax,
448 return inverseRaytracer->solveReflected(xD, zD, Nxm, xmMin, xmMax, assumedEmission, cer, step);
444 int solve(
double xD,
double zD,
int Nxm,
double xmMin,
double xmMax, {
…}
463 void setSignalPDF(T& t,
unsigned col,
double xD,
double zD,
int Nxm = 0,
double xmMin = 0,
double xmMax = 0);
508 bool detectionPositionX(
double xM,
int Nxm, std::vector<double>& xDs,
double& minLen);
575 bool rangeOfX(
double z,
double& xmi,
double& xma);
610 bool prismRaytrace(
const PrismSolution& sol,
double dL = 0,
double dFic = 0,
double de = 0);
627 PrismSolution
prismSolution(
const ROOT::Math::XYZPoint& rD,
double L);
637 double pdfValueSignal(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const;
647 double pdfValueSignalDelta(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const;
657 double pdfValue(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const;
720 unsigned k = pixelID - 1;
743 for (
const auto* other :
m_pdfOtherTracks) f += other->pdfValueSignalDelta(pixelID, time, timeErr, sigt);
752 if (not
m_fastRaytracer->getPropagationStatus())
return std::numeric_limits<double>::quiet_NaN();
759 return std::min(1 /
m_beta / refind, 1.0);
765 if (cer.cosThc == 0 and cer.sinThc == 0) {
785 if (i0 < 0 or not m_inverseRaytracer->getStatus())
return;
787 for (
unsigned i = 0; i < 2; i++) {
790 const auto& sol = solutions[i0];
800 int i_dx = t.solve(xD + dx, zD, Nxm, xmMin, xmMax,
m_track.getEmissionPoint(),
cerenkovAngle(), dx);
801 if (i_dx < 0)
return;
805 B2DEBUG(20,
"TOP::PDFConstructor::setSignalPDF: failed to find the same Nym (dx)");
809 i_dx = t.solve(xD + dx, zD, Nxm, xmMin, xmMax,
m_track.getEmissionPoint(),
cerenkovAngle(), dx);
810 if (i_dx < 0)
return;
816 for (
unsigned i = 0; i < 2; i++) {
819 const auto& sol = solutions[i0];
820 const auto& sol_dx = solutions[i_dx];
830 if (not ok)
continue;
843 B2DEBUG(20,
"TOP::PDFConstructor::setSignalPDF: failed to determine derivatives: "
845 <<
LogVar(
"impact local z",
m_track.getEmissionPoint().position.Z())
849 <<
LogVar(
"peak type", t.type));
Provides a type-safe way to pass members of the chargedStableSet set.
static const double speedOfLight
[cm/ns]
Parametrization of background PDF in pixels of single module.
Parametrization of delta-ray PDF in pixels of single module.
Fast photon propagation in quartz optics.
Utility for solving inverse ray-tracing problem.
double m_cosTotal
cosine of total reflection angle
void setSignalPDF_prism()
Sets signal PDF for track crossing prism.
void setSignalPDF()
Sets signal PDF.
double m_bkgRate
estimated background hit rate
LogL getLogL(double t0, double sigt=0) const
Returns extended log likelihood for PDF shifted in time.
double getPDFValue(int pixelID, double time, double timeErr, double sigt=0) const
Returns PDF value.
double m_beta
particle hypothesis beta
const BackgroundPDF * getBackgroundPDF() const
Returns background PDF.
const InverseRaytracer::CerenkovAngle & cerenkovAngle(double dE=0)
Returns cosine and sine of cerenkov angle.
int getNCalls_setPDF(SignalPDF::EPeakType type) const
Returns number of calls of template function setSignalPDF<T> for a given peak type.
bool detectionPositionX(double xM, int Nxm, std::vector< double > &xDs, double &minLen)
Calculates unfolded detection position from known reflection position on the mirror and emission poin...
void switchOnDeltaRayPDF() const
Include delta-ray PDF in log likelihood calculation (this is default)
const YScanner * m_yScanner
PDF expander in y.
std::vector< SignalPDF > m_signalPDFs
parameterized signal PDF in pixels (index = pixelID - 1)
void setSignalPDF_reflected()
Sets signal PDF for reflected photons.
double getBkgRate() const
Returns estimated background hit rate.
LogL getBackgroundLogL() const
Returns extended log likelihood for background hypothesis using default time window.
double pdfValueSignal(int pixelID, double time, double timeErr, double sigt=0) const
Returns the value of signal PDF normalized to the number of expected photons.
void switchOffDeltaRayPDF() const
Exclude delta-ray PDF in log likelihood calculation.
PrismSolution prismSolution(const PixelPositions::PixelData &pixel, unsigned k, int nx)
General solution of inverse raytracing in prism: iterative procedure calling basic solution.
std::map< SignalPDF::EPeakType, int > m_ncallsSetPDF
number of calls to setSignalPDF<T>
LogL getLogL() const
Returns extended log likelihood (using the default time window)
const std::vector< TOPTrack::SelectedHit > & getSelectedHits() const
Returns selected photon hits belonging to this slot.
double m_maxTime
time window upper edge
const InverseRaytracer * m_inverseRaytracer
inverse ray-tracer
double m_minTime
time window lower edge
double getExpectedDeltaPhotons() const
Returns the expected number of delta-ray photons within the default time window.
double getExpectedBkgPhotons(double minTime, double maxTime) const
Returns the expected number of background photons within a given time window.
bool isValid() const
Checks the object status.
const std::vector< SignalPDF > & getSignalPDF() const
Returns signal PDF.
EStoreOption m_storeOption
signal PDF storing option
double m_Fic
temporary storage for Cerenkov azimuthal angle
double getExpectedSignalPhotons() const
Returns the expected number of signal photons within the default time window.
double getExpectedSignalPhotons(double minTime, double maxTime) const
Returns the expected number of signal photons within a given time window.
double derivativeOfReflectedX(double x, double xe, double ze, double zd) const
Returns the derivative of reflected position at given x.
bool setDerivatives(YScanner::Derivatives &D, double dL, double de, double dFic)
Sets the derivatives (numerically) using forward ray-tracing.
double getExpectedDeltaPhotons(double minTime, double maxTime) const
Returns the expected number of delta-ray photons within a given time window.
double m_groupIndex
group refractive index at mean photon energy
int getNCalls_expandPDF(SignalPDF::EPeakType type) const
Returns number of calls of function expandSignalPDF for a given peak type.
std::vector< const PDFConstructor * > m_pdfOtherTracks
most probable PDF's of other tracks in the module
double m_bkgPhotons
expected number of uniform background photons
const std::vector< LogL > & getPixelLogLs(double t0, double sigt=0) const
Returns extended log likelihoods in pixels for PDF shifted in time.
double propagationLosses(double E, double propLen, int nx, int ny, SignalPDF::EPeakType type) const
Returns photon propagation losses (bulk absorption, surface reflectivity, mirror reflectivity)
int getModuleID() const
Returns slot ID.
double m_deltaPhotons
expected number of delta-ray photons
const std::vector< Pull > & getPulls() const
Returns photon pulls w.r.t PDF peaks.
double getCosCerenkovAngle(double E) const
Returns cosine of Cerenkov angle at given photon energy.
double getCosTotal() const
Returns cosine of total reflection angle.
double m_signalPhotons
expected number of signal photons
std::map< SignalPDF::EPeakType, int > m_ncallsExpandPDF
number of calls to expandSignalPDF
void appendPulls(const TOPTrack::SelectedHit &hit) const
Appends pulls of a photon hit.
double getExpectedPhotons() const
Returns the expected number of all photons within the default time window.
bool m_valid
cross-check flag, true if track is valid and all the pointers above are valid
DeltaRayPDF m_deltaRayPDF
delta-ray PDF
double deltaXD(double dFic, const InverseRaytracer::Solution &sol, double xD)
Returns the difference in xD between ray-traced solution rotated by dFic and input argument.
bool doRaytracingCorrections(const InverseRaytracer::Solution &sol, double dFic_dx, double xD)
Corrects the solution of inverse ray-tracing with fast ray-tracing.
bool raytrace(const FastRaytracer &rayTracer, double dL=0, double de=0, double dFic=0)
Forward ray-tracing (called by setDerivatives)
std::vector< Pull > m_pulls
photon pulls w.r.t PDF peaks
const FastRaytracer * m_fastRaytracer
fast ray-tracer
double findReflectionExtreme(double xE, double zE, double zD, int Nxm, double A, const RaytracerBase::Mirror &mirror) const
Finds the position on the mirror of the extreme reflection.
const Const::ChargedStable & getHypothesis() const
Returns particle hypothesis.
EStoreOption
Options for storing signal PDF parameters.
@ c_Reduced
only PDF peak data
@ c_Full
also extra information and derivatives
const std::map< double, YScanner::Derivatives > & getDerivatives() const
Returns a collection of derivatives for debugging purposes.
const TOPTrack & m_track
temporary reference to track at TOP
std::vector< LogL > m_pixelLLs
pixel log likelihoods (index = pixelID - 1)
void appendPDFOther(const PDFConstructor *pdfOther)
Append most probable PDF of other track in this module.
EPDFOption m_PDFOption
signal PDF construction option
const BackgroundPDF * m_backgroundPDF
background PDF
bool m_deltaPDFOn
include/exclude delta-ray PDF in likelihood calculation
EPDFOption
Signal PDF construction options.
@ c_Optimal
y dependent only where necessary
@ c_Fine
y dependent everywhere
@ c_Rough
no dependence on y
std::map< double, InverseRaytracer::CerenkovAngle > m_cerenkovAngles
sine and cosine of Cerenkov angles
double pdfValue(int pixelID, double time, double timeErr, double sigt=0) const
Returns the value of PDF normalized to the number of expected photons.
void expandSignalPDF(unsigned col, const YScanner::Derivatives &D, SignalPDF::EPeakType type)
Expands signal PDF in y (y-scan)
std::vector< FastRaytracer > m_rayTracers
copies of fast ray-tracer used to compute derivatives
const Const::ChargedStable m_hypothesis
particle hypothesis
double getExpectedBkgPhotons() const
Returns the expected number of background photons within the default time window.
bool prismRaytrace(const PrismSolution &sol, double dL=0, double dFic=0, double de=0)
Do forward raytracing of inverse raytracing solution in prism.
void clearPDFOther()
Clear the container of PDF's of other tracks.
double m_groupIndexDerivative
derivative (dn_g/dE) of group refractive index at mean photon energy
double pdfValueSignalDelta(int pixelID, double time, double timeErr, double sigt=0) const
Returns the value of signal + deltaRay PDF normalized to the number of expected photons.
void switchDeltaRayPDF(bool deltaPDFOn) const
Include or exclude delta-ray PDF in log likelihood calculation.
const DeltaRayPDF & getDeltaRayPDF() const
Returns delta-ray PDF.
void initializePixelLogLs(double minTime, double maxTime) const
Initializes pixel log likelihoods.
bool rangeOfX(double z, double &xmi, double &xma)
Estimates range of unfolded x coordinate of the hits on given plane perpendicular to z-axis.
std::vector< TOPTrack::SelectedHit > m_selectedHits
selected photon hits
void setSignalPDF_direct()
Sets signal PDF for direct photons.
double getExpectedPhotons(double minTime, double maxTime) const
Returns the expected number of all photons within a given time window.
std::set< int > m_zeroPixels
collection of pixelID's with zero pdfValue
std::map< double, YScanner::Derivatives > m_derivatives
a map of xD and derivatives
double m_f0
temporary value of signal PDF
double m_dFic
temporary storage for dFic used in last call to deltaXD
double m_tof
time-of-flight from IP to average photon emission position
PDFConstructor(const TOPTrack &track, const Const::ChargedStable &hypothesis, EPDFOption PDFOption=c_Optimal, EStoreOption storeOption=c_Reduced, double overrideMass=0)
Class constructor.
EPeakType
Enumerator for single PDF peak types.
@ c_Reflected
reflected photon
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
double getPhaseIndex(double energy) const
Returns phase refractive index of quartz at given photon energy.
Reconstructed track at TOP.
Utility for expanding the PDF in y direction.
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.
Sine and cosine of Cerenkov angle.
Solution of inverse ray-tracing.
Structure that enables defining a template function: direct photons.
const SignalPDF::EPeakType type
PDF peak type.
int solve(double xD, double zD, int, double, double, const TOPTrack::AssumedEmission &assumedEmission, const InverseRaytracer::CerenkovAngle &cer, double step=0) const
Solve inverse ray-tracing for direct photon.
const InverseRaytracer * inverseRaytracer
inverse ray-tracer
Structure that enables defining a template function: reflected photons.
const SignalPDF::EPeakType type
PDF peak type.
int solve(double xD, double zD, int Nxm, double xmMin, double xmMax, const TOPTrack::AssumedEmission &assumedEmission, const InverseRaytracer::CerenkovAngle &cer, double step=0) const
Solve inverse ray-tracing for reflected photon.
const InverseRaytracer * inverseRaytracer
inverse ray-tracer
Useful data type for returning the results of log likelihood calculation.
double expPhotons
expected number of photons
double effectiveSignalYield
effective number of signal photons in data
LogL(double phot)
Constructor.
unsigned numPhotons
detected number of photons
double logL
extended log likelihood
Solution of inverse raytracing in prism.
double L
emission position distance along particle trajectory
double cosFic
cosine of azimuthal Cerenkov angle
double sinFic
sine of azimuthal Cerenkov angle
double len
propagation length
double sigma
peak overall sigma (signal) or 0 (background)
double peakT0
PDF peak time (signal) or minimal PDF peak time in pixel (background)
double ttsT0
TTS gaussian peak time (signal) or 0 (background)
Pull(int pix, double t, double t0, double tts0, double sig, double phi, double w)
Constructor.
double phiCer
azimuthal Cerenkov angle (signal) or 0 (background)
position and size of a pixel
spherical mirror data in module local frame.
assumed photon emission point in local frame
selected photon hit from TOPDigits
static double dFic_d(const InverseRaytracer::Solution &sol0, const InverseRaytracer::Solution &sol1)
Calculates the derivative of Cerenkov azimuthal angle.