/* * ProfilerPlaneData.hh * * Created on: Oct 5, 2015 * Author: Hovanes Egiyan */ #ifndef PROFILERPLANEDATA_HH_ #define PROFILERPLANEDATA_HH_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "MutexedClass.hh" #include "ProfilerPVs.hh" #include "ProfilerPlaneSlice.hh" class ProfilerPlaneData: virtual public MutexedClass { protected: // The FIFO depth for the Struck scalers const static unsigned ppdNFIFO; // Number of fibers in a plane const static unsigned ppdChanNumber; // Number of time slices for fitting the data const static unsigned ppdNumberOfSlices; // Name for this data std::string ppdName; // x-axis std::vector ppdAxis; // vector of current values, the first key is the FIFO element, the last key is the fiber number std::vector > ppdValues; // accumulated values, the first key is the FIFO element, the last key is the fiber number std::vector > ppdAccumValues; // vector of summed over FIFO values std::vector ppdSummedValues; // vector of the summed of the FIFO values accumulated over many snapshots std::vector ppdAccumSummedValues; // Sum of all counts double ppdTotalRate; // flag indicating if the axis is reversed bool ppdAxisIsReversed; // smoothing flag bool ppdSmoothing; // Fiber width bool ppdAccumulating; // center position double ppdFiberWidth; // Pointers to the time slice objects double ppdCenterPosition; // Vector containing the slices. The size could be ppdNumberOfSlices (for fitting), // or could be ppdNFIFO for simulating. std::vector ppdSlices; // Slice that ha full FIFO depth integrated over ProfilerPlaneSlice* ppdIntegratedSlice; // Vector of efficiencies for individual fibers std::vector ppdEffcCorr; // Vector for disabling flag for individual fibers std::vector ppdDisableFlags; private: ProfilerPlaneData() { std::cout << " Entering bad " << __FUNCTION__ << std::endl; std::cout << "Default ProfilerPlaneData::ProfilerPlaneData has been called, exiting. " << std::endl; exit( 1 ); } public: ProfilerPlaneData( bool axisReversed ); ProfilerPlaneData( const ProfilerPlaneData& p ); virtual ~ProfilerPlaneData(); virtual ProfilerPlaneData& operator =( const ProfilerPlaneData& p ); virtual void defineAxis(); virtual unsigned modifyNumberOfSlices( const unsigned nSlices ); virtual void createSlices() = 0; inline virtual unsigned getNFIFO() const { return ppdNFIFO; } inline virtual unsigned getChanNumber() const { return ppdChanNumber; } inline virtual unsigned getNumberOfSlices() const { return ppdNumberOfSlices; } inline virtual void setSmoothOption( const short option ) { setSmoothing( option >= 1 ); } inline virtual void setAccumulateOption( const short option ) { setAccumulating( option >= 1 ); } virtual void getValues( double* valueArrayPtr ); virtual void getAxis( double* axisArayPtr ); virtual void getSummedSlices( double* summedArrayPtr ) ; virtual void resetScalers( const short reset ); inline const virtual std::vector& getAccumSummedValues() const { return ppdAccumSummedValues; } inline const virtual std::vector& setAccumSummedValues( const std::vector& val ) { MtxLock objLock( mcMutex ); return (this->ppdAccumSummedValues = val); } inline const virtual ProfilerPlaneSlice* getIntegratedSlice() const { return ppdIntegratedSlice; } inline const virtual ProfilerPlaneSlice* setIntegratedSlice( ProfilerPlaneSlice* slice ) { MtxLock objLock( mcMutex ); return (this->ppdIntegratedSlice = slice); } inline const virtual std::vector& getSummedValues() const { return ppdSummedValues; } inline const virtual std::vector& setSummedValues( const std::vector& val ) { MtxLock objLock( mcMutex ); return (this->ppdSummedValues = val); } inline const virtual std::vector& getSlices() const { return ppdSlices; } inline const virtual std::vector& setSlices( const std::vector ppdSlices ) { MtxLock objLock( mcMutex ); return (this->ppdSlices = ppdSlices); } inline const virtual std::vector >& getAccumValues() const { return ppdAccumValues; } inline const virtual std::vector >& setAccumValues( const std::vector > accumValues ) { MtxLock objLock( mcMutex ); return (this->ppdAccumValues = accumValues); } inline virtual double getTotalRate() const { return ppdTotalRate; } inline virtual bool isAccumulating() const { return ppdAccumulating; } inline virtual bool setAccumulating( const bool accumulating ) { MtxLock objLock( mcMutex ); return (this->ppdAccumulating = accumulating); } inline virtual bool isSmoothing() { return ppdSmoothing; } inline virtual bool setSmoothing( const bool smoothing ) { MtxLock objLock( mcMutex ); return (this->ppdSmoothing = smoothing); } inline const virtual std::vector& getAxis() const { return ppdAxis; } inline const virtual std::vector& setAxis( const std::vector& axisVec ) { MtxLock objLock( mcMutex ); ppdAxis = axisVec; return ppdAxis; } inline const virtual std::vector >& getValues() const { return ppdValues; } inline const virtual std::vector >& setValues( const std::vector >& valueVec ) { MtxLock objLock( mcMutex ); ppdValues = valueVec; return ppdValues; } inline virtual double getCenterPosition() const { return ppdCenterPosition; } inline virtual double setCenterPosition( const double pos ) { MtxLock objLock( mcMutex ); return (ppdCenterPosition = pos); } inline virtual double getFiberWidth() const { return ppdFiberWidth; } inline virtual double setFiberWidth( const double width ) { return (ppdFiberWidth = width); } inline virtual bool isAxisReversed() const { return ppdAxisIsReversed; } inline virtual bool setAxisReversed( const bool axisIsReversed ) { MtxLock objLock( mcMutex ); return (this->ppdAxisIsReversed = axisIsReversed); } inline virtual std::string getName() const { return ppdName; } inline virtual std::string setName( const std::string name ) { MtxLock objLock( mcMutex ); return (this->ppdName = name); } inline const virtual std::vector& getEffcCorr() const { return ppdEffcCorr; } inline const virtual std::vector& setEffcCorr( const std::vector& efc ) { return ( ppdEffcCorr = efc ); } inline const virtual std::vector& getDisableFlags() const { return ppdDisableFlags; } inline const virtual std::vector& setDisbleFlags( const std::vector& flag ) { return ( ppdDisableFlags = flag ); } inline virtual bool fiberIsDisabled( const unsigned iFiber ) const { if( iFiber >= 0 && iFiber < ppdDisableFlags.size() ) return ppdDisableFlags[iFiber]; else return false; } inline virtual bool fiberIsEnabled( const unsigned iFiber ) const { if( iFiber >= 0 && iFiber < ppdDisableFlags.size() ) return !ppdDisableFlags[iFiber]; else return false; } }; #endif /* PROFILERPLANEDATA_HH_ */