//////////////////////////////////////////////////////////////////////// /// \class RAT::Classifiers::BiPoLikelihoodDiff /// /// \brief: Classifies post-reconstruction as In-Window BiPo-Coincidence /// /// \author name: Krish Majumdar /// /// REVISION HISTORY: /// 29/11/2013 : Krish Majumdar - New file /// 30/01/2014 : Krish Majumdar - added parameters to plot the distributions /// 13/02/2014 : Krish Majumdar - changes as requested for Pull Request /// 20/03/2014 : Krish Majumdar - changed classifier to be an Optimised Classifier /// 24/04/2015 : Matt Mottram - updated initialisation to dynamically load material /// 30/04/2015 : Matt Mottram - added failover to default material PDF /// 09/02/2015 : Matt Mottram - update default material /// 01/09/2020 : Logan Lebanowski - Properly account for partial fill /// /// \details Uses the Log-Likelihood Difference from comparing Time Residual /// distributions to classify events as either pileup 212/214BiPo /// coincidence events or not. The classifier returns the difference /// between the Log-Likelihood values of 130Te and BiPo distributions. /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_Classifiers_BiPoLikelihoodDiff_ #define __RAT_Classifiers_BiPoLikelihoodDiff_ #include #include #include #include #include class G4PhysicsOrderedFreeVector; namespace RAT { namespace DS { class FitResult; } namespace Classifiers { class BiPoLikelihoodDiff : public SeededClassifier, public OptimisedClassifier { public: virtual std::string GetName() const { return BiPoLikelihoodDiff::Name(); } static std::string Name() { return std::string("BiPoLikelihoodDiff"); } void Initialise(const std::string&); void BeginOfRun(DS::Run& run); void EndOfRun(DS::Run&); void DefaultSeed(); void SetSeed(const DS::FitResult& seed); virtual std::vector GetParams() const; virtual std::vector GetPositiveErrors() const; virtual std::vector GetNegativeErrors() const; virtual void SetParams(const std::vector& params); virtual void SetPositiveErrors(const std::vector& errors); virtual void SetNegativeErrors(const std::vector& errors); virtual DS::ClassifierResult GetClassification(); /// Calculate the log-likelihood value of an event being a BiPo pileup, using the event's Time Residual PDF and the given value of deltaTime and Bi/Po Time Residual PDFs /// /// @param[in] params A vector of starting values for the optimisation of deltaTime: [starting value, minimum value, maximum value] /// @returns The log-likelihood value from comparing the event time residuals PDF to that of Bi and Po events combined for a SINGLE value of deltaTime virtual double operator() (const std::vector& params); /// Calculate the log-likelihood value of an event being a 130Te NDBD, using the event's Time Residual PDF and the 130Te Time Residual PDF /// /// @returns The log-likelihood value from comparing the event time residuals PDF to that of 130Te events double logLikelihoodTe(); private: std::string fIndex; ///< The required database index std::vector fTimes; ///< A vector of time residual values to be used to create the time residual PDFs std::vector fProbabilityTe; ///< A vector of probability values for Te events (1 for each time residual value in fTimes), to be used to create the Te time residual PDF std::vector fProbabilityBi; ///< A vector of probability values for Bismuth Beta events (1 for each time residual value in fTimes), to be used to create the Bismuth Beta time residual PDF std::vector fProbabilityPo; ///< A vector of probability values for Polonium Alpha events (1 for each time residual value in fTimes), to be used to create the Polonium Alpha time residual PDF G4PhysicsOrderedFreeVector* fBasePDFTe; ///< The time residuals PDF for Te events G4PhysicsOrderedFreeVector* fBasePDFBi; ///< The time residuals PDF for Bismuth Beta decay events (either 212 or 214) G4PhysicsOrderedFreeVector* fBasePDFPo; ///< The time residuals PDF for Polonium Alpha decay events (either 212 or 214) int fMeanPoAlphaNhits; ///< The mean Nhits of a Polonium Alpha decay (either 212 or 214) double fTriggerWindowStart; ///< The time (in ns) of the start of the trigger window with respect to the event's time double fTriggerWindowEnd; ///< The time (in ns) of the end of the trigger window with respect to the event's time DU::Point3D fEventPosition; ///< The fitted event position, used for calculating the event's time residuals double fEventTime; ///< The fitted event time, used for calculating the event's time residuals std::vector fTimeResiduals; ///< A vector of time residuals offset by the 10th earliest time residual (is filled within the GetClassification function) double fNHitsWithinWindow; ///< The number of hit PMTs that have a raw time residual in the time window between fTriggerWindowStart and fTriggerWindowEnd (is calculated within the GetClassification function) std::vector fParams; std::vector fPositiveErrors; std::vector fNegativeErrors; DU::TimeResidualCalculator fTRCalc; ///< Time residual calculator for a given run size_t fPSUPSystemId; // coordinate system id for Point3D }; } //::Classifier } //::RAT #endif