/* * jlabFADC250Board.hh * * Created on: June 16, 2014 * Author: * * This class provides interface that EPICS support will use to monitor * and control the JLAB discriminator boards. * All methods, including accesssors, need to be thread-safe since they * may be executing simultaneously on multiple threads. */ #ifndef _jlabFADC250Board_HH_ #define _jlabFADC250Board_HH_ #include #include #include #include #include #include "jlabBoard.hh" #include "jlabROCSharedMemoryWrapper.hh" using namespace std; class jlabFADC250Board : public jlabBoard { public: // Constructor. Create FADC250 board object specified by base address // Create all channel objects on that board and fill the channel vector. // Throws an exception if fails to create the object. jlabFADC250Board(uint32_t locSlotNumber, jlabROCSharedMemoryWrapper* locROCSharedMemoryWrapper); // Destructor. Destroys this board. virtual ~jlabFADC250Board(); // Return boards type FADC250_v2 or whatever virtual string GetType(); // Return the 32-bit status word for this board virtual uint32_t GetStatus(); // Return the number of channels this board is serving static uint32_t GetNumberOfChannels(); // Start reading the scaler data for this board from VME bus virtual void StartScalers( const string scalerType = "" ); // Stop reading the scaler data for this board from VME bus virtual void StopScalers( const string scalerType = "" ); // Return scaler values for particular channel for this board, in Hz or raw // Time is in seconds // Scalar Type: Readout1, Readout2, Trigger1, Trigger2 virtual vector GetScalers(uint32_t locChannel, string locScalarType, vector& locTimes, bool locOutputInHzFlag = true); virtual double GetScaler(uint32_t locChannel, string locScalarType, bool locOutputInHzFlag = true); // Return clock counts for this board virtual vector GetClockCounts(void); // Get a vector of thresholds for a particular type of thresholds virtual vector GetThresholds( const string threshType ); // Get the values of threshold for a single channel of a particular threshold type virtual double GetThreshold( const unsigned chanNumb, const string threshType ); // Set thresholds for particular type of thresholds for all channels virtual void SetThresholds( const double threshold, const string threshType = "" ); // Set thresholds for particular type of threshold for a single channel virtual void SetThreshold(uint32_t locChannelNumber, const double threshold, const string threshType ); // Return the histogram for energy spectrum for a particular channel vector GetSpectrum( const unsigned chanNumb ); void Set_Data(F250_Scalers locInputScalars); protected: // Prevent copying boards jlabFADC250Board(const jlabFADC250Board& board); jlabFADC250Board& operator=(const jlabFADC250Board& board); static const unsigned dNumChannels = 16; // Only access the below within a lock! // Time is in seconds, and frequency is in Hz // vector: For when data is collected over a period of time (each index one point in time) vector dScalarCountTimer_Readout1; vector dScalarRateTimer_Readout1; vector dScalarCountTimer_Readout2; vector dScalarRateTimer_Readout2; vector dScalarCountTimer_Trigger1; vector dScalarRateTimer_Trigger1; vector dScalarCountTimer_Trigger2; vector dScalarRateTimer_Trigger2; // The keys are the channel number map > dScalarCountMap_Readout1; map > dScalarRateMap_Readout1; map > dScalarCountMap_Readout2; map > dScalarRateMap_Readout2; map > dScalarCountMap_Trigger1; map > dScalarRateMap_Trigger1; map > dScalarCountMap_Trigger2; map > dScalarRateMap_Trigger2; }; // DEFINE ME inline jlabFADC250Board::jlabFADC250Board(uint32_t locSlotNumber, jlabROCSharedMemoryWrapper* locROCSharedMemoryWrapper) : jlabBoard(locSlotNumber, locROCSharedMemoryWrapper) {} // DEFINE ME inline jlabFADC250Board::~jlabFADC250Board(void) {} inline string jlabFADC250Board::GetType() { return "FADC250"; } // DEFINE ME inline uint32_t jlabFADC250Board::GetStatus() { return 0; } // DEFINE ME inline uint32_t jlabFADC250Board::GetNumberOfChannels() { return dNumChannels; } inline void jlabFADC250Board::StartScalers(const string scalerType) { // DEFINE ME return; } inline void jlabFADC250Board::StopScalers(const string scalerType) { // DEFINE ME return; } // DEFINE ME inline vector jlabFADC250Board::GetClockCounts(void) { return vector(); } // DEFINE ME inline void jlabFADC250Board::SetThresholds(const double threshold, const string threshType) { return; } // DEFINE ME inline void jlabFADC250Board::SetThreshold(const unsigned chanNumber, const double threshold, const string threshType) { return; } // DEFINE ME inline vector jlabFADC250Board::GetThresholds(const string threshType) { return vector(); } // DEFINE ME inline double jlabFADC250Board::GetThreshold(const unsigned chanNumb, const string threshType) { return 0.0; } // DEFINE ME inline vector jlabFADC250Board::GetSpectrum(const unsigned chanNumb) { return vector(); } #endif /* _jlabFADC250Board_HH_ */