//////////////////////////////////////////////////////////////////// /// \class RAT::DropoutFitter /// /// \brief Given a histogram of CAEN baselines performs a fit to extract /// values related to the amount of dropout /// /// \author Eric Marzec /// /// \details Meant to be used with the DropoutEvaluator class. /// This performs a fit using simulated annealing to extract /// the frequency of dropout. Must be supplied with a histogram /// of CAEN values from the DropoutEvaluator. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_DropoutFitter__ #define __RAT_DropoutFitter__ #include #include #include namespace RAT { class DropoutFitter: public OptimisedComponent { public: DropoutFitter(); virtual ~DropoutFitter(); std::vector GetParams() const; void SetParams(const std::vector & params); void SetParam(const int& iparam, const double& value); std::vector GetPositiveErrors() const; std::vector GetNegativeErrors() const; void SetError(const int& iparam, const double& value); void SetFOM(const std::string& fomName, const double fom); void SetTemperature(const int & temp); void SetIterations(const int & iterations); void PerformFit(); double Chi2(const std::vector& y, const std::vector& yp); double LogLikelihood(const std::vector& y, const std::vector& yp); double operator() (const std::vector & params); std::vector DropoutModel(const std::vector &x, const double&rate, const double& pos, const double& separation, const double& sigma); std::map fFoms; std::vector xax; // x-axis to be used in fit std::vector yvals; // Y values to be fitted to std::vector fParams; // Fit parameters std::vector fErrors; // Fit errors double fNormalization; // Normalization factor for yvalues protected: Optimisers::Optimiser *fOptimiser; unsigned int fTemperature; // Temperature to be given to simulated annealing algorithm unsigned int fIterations; // Number of iterations (per temperature) for simulated annealing unsigned int fSampleCount; // Counter to make sure optimizer is doing its job double Prior(const double& rate, const double& pos, const double& sep, const double& sigma); double ClipProbability(const double &mu, const double& sigma); }; } #endif