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>
92 Pull(
int pix,
double t,
double t0,
double tts0,
double sig,
double phi,
double w):
217 double getPDFValue(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const;
241 LogL
getLogL(
double t0,
double minTime,
double maxTime,
double sigt = 0)
const;
260 const std::vector<LogL>&
getPixelLogLs(
double t0,
double minTime,
double maxTime,
double sigt = 0)
const;
266 const std::vector<Pull>&
getPulls()
const;
310 int solve(
double xD,
double zD,
int,
double,
double,
337 int solve(
double xD,
double zD,
int Nxm,
double xmMin,
double xmMax,
356 void setSignalPDF(T& t,
unsigned col,
double xD,
double zD,
int Nxm = 0,
double xmMin = 0,
double xmMax = 0);
401 bool detectionPositionX(
double xM,
int Nxm, std::vector<double>& xDs,
double& minLen);
448 bool rangeOfX(
double z,
double& xmi,
double& xma);
483 bool prismRaytrace(
const PrismSolution& sol,
double dL = 0,
double dFic = 0,
double de = 0);
510 double pdfValue(
int pixelID,
double time,
double timeErr,
double sigt = 0)
const;
575 unsigned k = pixelID - 1;
602 return std::min(1 /
m_beta / refind, 1.0);
608 if (cer.cosThc == 0 and cer.sinThc == 0) {
627 if (i0 < 0 or not m_inverseRaytracer->getStatus())
return;
629 for (
unsigned i = 0; i < 2; i++) {
632 const auto& sol = solutions[i0];
643 if (i_dx < 0)
return;
647 B2DEBUG(20,
"TOP::PDFConstructor::setSignalPDF: failed to find the same Nym (dx)");
652 if (i_dx < 0)
return;
660 if (i_dL < 0)
return;
664 B2DEBUG(20,
"TOP::PDFConstructor::setSignalPDF: failed to find the same Nym (dL)");
669 if (i_dL < 0)
return;
677 if (i_de < 0)
return;
681 B2DEBUG(20,
"TOP::PDFConstructor::setSignalPDF: failed to find the same Nym (de)");
686 if (i_de < 0)
return;
692 for (
unsigned i = 0; i < 2; i++) {
695 const auto& sol = solutions[i0];
696 const auto& sol_dx = solutions[i_dx];
697 const auto& sol_de = solutions[i_de];
698 const auto& sol_dL = solutions[i_dL];
702 if (not ok)
continue;
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.
double getPDFValue(int pixelID) const
Returns PDF value for given pixel.
Parametrization of delta-ray PDF in pixels of single module.
double getPDFValue(int pixelID, double time) const
Returns PDF value at given time and pixel.
Fast photon propagation in quartz optics.
double getPropagationLen() const
Returns total propagation length since initial position.
void propagate(const PhotonState &photon, bool averaging=false) const
Propagate photon to photo-detector plane.
bool getPropagationStatus() const
Returns propagation status.
double getXD() const
Returns unfolded position in x at virtual Detector plane.
Utility for solving inverse ray-tracing problem.
int solveReflected(double xD, double zD, int Nxm, double xmMin, double xmMax, const TOPTrack::AssumedEmission &assumedEmission, const CerenkovAngle &cer, double step=0) const
Solve inverse ray-tracing for reflected photon.
PhotonState getReconstructedPhoton(const Solution &sol, double DFic=0) const
Returns reconstructed photon at emission for a given solution of inverse raytracing.
bool getStatus() const
Returns status.
bool isNymDifferent() const
Checks if Nym differs between solutions front and back in at least one of the vectors.
int solveDirect(double xD, double zD, const TOPTrack::AssumedEmission &assumedEmission, const CerenkovAngle &cer, double step=0) const
Solve inverse ray-tracing for direct photon.
std::vector< Solution > & getSolutions(unsigned i) const
Returns the solutions of inverse ray-tracing.
void clear() const
Clear the solutions to prepare for the new round.
PDF construction and log likelihood determination for a given track and particle hypothesis.
double m_cosTotal
cosine of total reflection angle
void setSignalPDF_prism()
Sets signal PDF for track crossing prism.
double expectedPhotons(double minTime, double maxTime) const
Returns the expected number of photons within given time window.
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.
const Const::ChargedStable & getHypothesis() const
Returns particle hypothesis.
double getPDFValue(int pixelID, double time, double timeErr, double sigt=0) const
Returns PDF value.
double m_beta
particle hypothesis beta
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.
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)
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.
bool isValid() const
Checks the object status.
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 derivativeOfReflectedX(double x, double xe, double ze, double zd) const
Returns the derivative of reflected position at given x.
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.
double m_bkgPhotons
expected number of 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 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.
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 std::vector< SignalPDF > & getSignalPDF() const
Returns signal PDF.
const BackgroundPDF * getBackgroundPDF() const
Returns background PDF.
EStoreOption
Options for storing signal PDF parameters.
@ c_Reduced
only PDF peak data
@ c_Full
also extra information
const TOPTrack & m_track
temporary reference to track at TOP
std::vector< LogL > m_pixelLLs
pixel log likelihoods (index = pixelID - 1)
EPDFOption m_PDFOption
signal PDF construction option
const BackgroundPDF * m_backgroundPDF
background PDF
bool m_deltaPDFOn
include/exclude delta-ray PDF in likelihood calculation
const std::vector< TOPTrack::SelectedHit > & getSelectedHits() const
Returns selected photon hits belonging to this slot.
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)
const Const::ChargedStable m_hypothesis
particle hypothesis
double getExpectedBkgPhotons() const
Returns the expected number of background photons within the default time window.
const DeltaRayPDF & getDeltaRayPDF() const
Returns delta-ray PDF.
bool prismRaytrace(const PrismSolution &sol, double dL=0, double dFic=0, double de=0)
Do forward raytracing of inverse raytracing solution in prism.
double m_groupIndexDerivative
derivative (dn_g/dE) of group refractive index at mean photon energy
void switchDeltaRayPDF(bool deltaPDFOn) const
Include or exclude delta-ray PDF in log likelihood calculation.
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 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.
const TOPTrack::AssumedEmission & getEmissionPoint(double dL=0) const
Returns assumed photon emission position and track direction.
Utility for expanding the PDF in y direction.
double getMeanEnergy() const
Returns mean photon energy.
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
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
Data type for storing photon pull w.r.t PDF peak.
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