/////////////////////////////////////////////////////////////////////// // // Simple chi squared method // // Author: J Amey // Author: Matt Mottram < m.mottram@qmul.ac.uk> -- contact person // // REVISION HISTORY: // - 08/2012 : J Amey - New file // - 10/09/2013 : K Majumdar - Adding in ability to do asymmetric // errors and errors in Spherical coordinates // - 2014-03-29 : P G Jones - Updated lifetime, added BeginOfRun method // - 2014-12-09 : P G Jones - Allow chained PMTSelectors // - 2015-02-24 : R Stainforth - Fixed typo in the assignment of // negative errors // - 2015-06-21 : R Stainforth - Add option to seed by SOC object. // Rename class 'SOCPositionTimeChiSquared' // from 'PositionTimeChiSquared'. // - 2015-07-09 : R Stainforth - Add bucket time calculation to the // computation of the time transit. // - 2015-09-21 : R Stainforth - Added option to override the value // of 'fPhotonEnergy' at macro level. // // Requires Seeding, optimising and a selector // /////////////////////////////////////////////////////////////////////// #ifndef __RAT_Method_SOCPositionTimeChiSquared_ #define __RAT_Method_SOCPositionTimeChiSquared_ #include #include #include #include #include #include #include #include namespace RAT { namespace DS { class FitResult; } namespace Methods { class SOCPositionTimeChiSquared : public SeededMethod, public OptimisedMethod, public SelectorMethod { public: // Returns the name of the method virtual std::string GetName() const { return SOCPositionTimeChiSquared::Name(); } // Returns the name of the simplechisquared method static std::string Name() { return std::string( "socPositionTimeChiSquared" ); } // Initialises the TruncatedChiSquared method (requires no init string) void Initialise( const std::string& ); // Init string, no required // Load from the database and setup void BeginOfRun( DS::Run& run ); void EndOfRun( DS::Run& ) { } // Set a double paramter // // param is a parameter name // value is the value of the parameter void SetD( const std::string& param, const double value ); // Sets the seed to the default void DefaultSeed(); // Seed using a SOC object void SeedBySOC( DS::SOC& soc ); // Invokes the method's algorithm virtual DS::FitResult GetBestFit(); // Called by the optimiser to get the starting/seed params to optimise virtual std::vector GetParams() const; // Called by the optimiser to get the starting/seed errors to optimise virtual std::vector GetPositiveErrors() const; virtual std::vector GetNegativeErrors() const; // Converts the vector of params into the fFitResult virtual void SetParams( const std::vector& params ); // Converts the vector of errors into the fFitResult virtual void SetPositiveErrors( const std::vector& errors ); virtual void SetNegativeErrors( const std::vector& errors ); // Called by the optimiser to invoke the method algorithm, optimiser will pass current parameters virtual double operator()( const std::vector& params ); protected: double fAVRadius; // Radius of the acrylic vessel, method will check fit is within this. double fPhotonEnergy; // Assumed energy of the photon when calculating the transit time bool fPhotonEnergyOverride; // Boolean flag to determine whether the user has set the wavelength in the macro or if it will be read off of the SOC file by 'SeedBySOC' DU::TimeResidualCalculator fTRCalc; // Time residual calculator for a given run }; } //::Methods } //::RAT #endif