/* * ProfilerPlaneSlice.hh * * This class keeps the information about the beam profile in a time bin, * and allows us to fit the distributions to obtain the values for the * beam position, width, amplitude and background at a give instance. * The size of the time bin is defined by the ProfilerPlaneData and is not * known to this class. * * Created on: Oct 14, 2015 * Author: Hovanes Egiyan */ #ifndef PROFILERPLANESLICE_HH_ #define PROFILERPLANESLICE_HH_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "MtxLock.hh" #include "MutexedClass.hh" class ProfilerPlaneSlice: public virtual MutexedClass { protected: std::string ppsName; std::vector ppsAxis; std::vector ppsValues; double ppsAmpl; double ppsMean; double ppsWidth; double ppsSignal; double ppsBkg; double ppsBkgSlope; double ppsAmplErr; double ppsMeanErr; double ppsWidthErr; double ppsSignalErr; double ppsBkgErr; double ppsBkgSlopeErr; double ppsSum; ProfilerPlaneSlice() { return; } public: ProfilerPlaneSlice( const std::string name, const std::vector& xAxis, const std::vector& yAxis ); ProfilerPlaneSlice( const ProfilerPlaneSlice& p ); virtual ~ProfilerPlaneSlice(); ProfilerPlaneSlice& operator=( const ProfilerPlaneSlice& p ); // Fit function to be define by classes inheriting from this class virtual bool fitWithCauchy() { return false; } // Calculate the sum over counts over the fiber number. inline double SumOverFibers() { this->ppsSum = accumulate( ppsValues.begin(), ppsValues.end(), 0.0 ); return this->ppsSum; } // Clone this object and return the pointer inline virtual ProfilerPlaneSlice* cloneSlice() { return new ProfilerPlaneSlice( *this ); } // Below are getters and setters inline std::vector getAxis() const { return ppsAxis; } inline const std::vector& setAxis( const std::vector& axis ) { return (this->ppsAxis = axis); } inline std::string getName() const { return ppsName; } inline std::string setName( const std::string name ) { return (this->ppsName = name); } inline const std::vector& getValues() const { return ppsValues; } inline const std::vector& setValues( const std::vector& instValues ) { return (this->ppsValues = instValues); } inline double getAmplitude() const { return ppsAmpl; } inline double setAmpl( const double amplitude ) { return (this->ppsAmpl = amplitude); } inline double getBkg() const { return ppsBkg; } inline double setBkgLevel( const double bkgLevel ) { return (this->ppsBkg = bkgLevel); } inline double getMean() const { return ppsMean; } inline double setMean( const double mean ) { return (this->ppsMean = mean); } inline double getSignal() const { return ppsSignal; } inline double setSignal( const double signal ) { return (this->ppsSignal = signal); } inline double getWidth() const { return ppsWidth; } inline double setWidth( const double width ) { return (this->ppsWidth = width); } inline double getBkgSlope() const { return ppsBkgSlope; } inline double setBkgSlope( const double slope ) { return (this->ppsBkgSlope = slope); } inline double getSum() const { return ppsSum; } inline double setSum( const double sum ) { return (this->ppsSum = sum); } inline double getAmplitudeErr() const { return ppsAmplErr; } inline double setAmplErr( const double err ) { return (this->ppsAmplErr = err); } inline double getBkgErr() const { return ppsBkgErr; } inline double setBkgLevelErr( const double err ) { return (this->ppsBkgErr = err); } inline double getMeanErr() const { return ppsMeanErr; } inline double setMeanErr( const double err ) { return (this->ppsMeanErr = err); } inline double getSignalErr() const { return ppsSignalErr; } inline double setSignalErr( const double err ) { return (this->ppsSignalErr = err); } inline double getWidthErr() const { return ppsWidthErr; } inline double setWidthErr( const double err ) { return (this->ppsWidthErr = err); } }; #endif /* PROFILERPLANESLICE_HH_ */