/* * jlabDiscBoard.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 simultaneousely on multiple threads. */ #ifndef _JLABDISCBOARD_HH_ #define _JLABDISCBOARD_HH_ #include #include #include #include #include #include "jlabBoard.hh" #include "jlabROCSharedMemoryWrapper.hh" using namespace std; class jlabDiscBoard : public jlabBoard { public: // Constructor. Create the discriminator board object specified by the base address. // Create all channel objects on that board and fill the channel vector. // Throws an exception if fails to create the object. jlabDiscBoard(uint32_t locSlotNumber, jlabROCSharedMemoryWrapper* locROCSharedMemoryWrapper); // Destructor. Destroys this board. virtual ~jlabDiscBoard(); // Return boards type JlabDisc_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); // 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 ); // 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 ); virtual unsigned GetUnsigned( unsigned chanNumb, string threshType) { cout << "HERE" << endl; return 7; } virtual unsigned SetUnsigned( unsigned chanNumb, string threshType, unsigned val) { return 5; } void Set_Data(vmeDSC_Scalers locInputScalars); protected: // Prevent copying boards jlabDiscBoard(const jlabDiscBoard& board); jlabDiscBoard& operator=(const jlabDiscBoard& 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; // Thresholds // The keys are the channel number // string: Readout1, Readout2, Trigger1, Trigger2 map > dThresholds; }; inline jlabDiscBoard::jlabDiscBoard(uint32_t locSlotNumber, jlabROCSharedMemoryWrapper* locROCSharedMemoryWrapper) : jlabBoard(locSlotNumber, locROCSharedMemoryWrapper) {} inline jlabDiscBoard::~jlabDiscBoard(void) {} inline string jlabDiscBoard::GetType() { return "Discriminator"; } inline uint32_t jlabDiscBoard::GetStatus() { // DEFINE ME return 0; } inline uint32_t jlabDiscBoard::GetNumberOfChannels() { return dNumChannels; } inline void jlabDiscBoard::StartScalers(const string scalerType) { // DEFINE ME return; } inline void jlabDiscBoard::StopScalers(const string scalerType) { // DEFINE ME return; } inline vector jlabDiscBoard::GetClockCounts(void) { // DEFINE ME return vector(); } inline void jlabDiscBoard::SetThresholds(const double threshold, const string threshType) { // DEFINE ME return; } inline void jlabDiscBoard::SetThreshold(const unsigned chanNumber, const double threshold, const string threshType) { // DEFINE ME return; } #endif /* _JLABDISCBOARD_HH_ */