//////////////////////////////////////////////////////////////////// /// \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 using std::vector; using std::map; namespace RAT { class DropoutFitter: public OptimisedComponent { public: DropoutFitter(); virtual ~DropoutFitter(); vector GetParams() const; void SetParams(const vector & params); void SetParam(const int& iparam, const double& value); vector GetPositiveErrors() const; 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 vector& y, const vector& yp); double LogLikelihood(const vector& y, const vector& yp); double operator() (const vector & params); vector DropoutModel(const vector &x, const double&rate, const double& pos, const double& separation, const double& sigma); map fFoms; vector xax; // x-axis to be used in fit vector yvals; // Y values to be fitted to vector fParams; // Fit parameters 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