/* * FCALLEDPulser.hh * * Definition of the class for FCAL pulser channels, originally * written to handle the FCAL LED pulser based on V1495 pulser * board with Ben Raydo's firmware. * This is an abstract class, cannot instantiated by itself. * Subclasses need to be derived and virtual methods need to be * defined. * * Created on: Aug 26, 2015 * Author: Hovanes Egiyan */ #ifndef __FCALLEDPULSER_HH__ #define __FCALLEDPULSER_HH__ #include #include "VPulser.hh" // Inherits from base class VPulser. class FCALLEDPulser: public VPulser { protected: // Units in which the pulser width PV is specified static double flpPulseWidthUnit; // Units in which the pulser period PV is specified static double flpPulsePeriodUnit; FCALLEDPulser() { return; } public: FCALLEDPulser(const std::string id) : VPulser(id) {return;} virtual ~FCALLEDPulser() {return;} static double getPulseWidthUnit() {return flpPulseWidthUnit;} static double getPulsePeriodUnit() {return flpPulsePeriodUnit;} static double setPulseWidthUnit( const double w ) {return (flpPulseWidthUnit=w);} static double setPulsePeriodUnit( const double p ) {return (flpPulsePeriodUnit=p);} // Get vector specifying which pulser board channels are included in this pulsers. // Currently virtual method, needs to be implemented by derived classes. virtual std::vector& getChannelVector() = 0; // Virtual method returning the action range mask that defines // in which pulser board channel range this pulser is allowed to make changes // by switching. virtual unsigned getRangeMask() = 0; // Mask defining which pulser board channels are being turned on and off by this pulser. virtual unsigned getChannelMask() = 0; // Return the averaged over the channels value for a PV with pvLabel. template T getAverageValue( const std::string pvLabel ); // Set all channels in the ChannelVector to a value and verify the readback. template void setAllChannels( const std::string pvLabel, const std::string rbLabel, const T value ) ; virtual void switchState(const short state ); // Switch state virtual void setWidth( const unsigned width ); // Set width virtual void setFrequency( const double freq ); // set frequency virtual void setNPulses( const unsigned n ); // Set number of pulses virtual void setDelay( const unsigned d){return;}// Set delay. Virtual virtual short getStatus(); // get status for this pulses virtual unsigned getWidth(); // get pulse width for this pulser virtual double getFrequency(); // get frequency for this pulser virtual unsigned getNPulses(); // get the number of pulses to pulse virtual unsigned getDelay(){return 0;} // get delay. }; #endif /* _FCALLEDPULSER_HH__ */