/* * ProfilerDetector.hh * * Base class for a profiler detector. * * * Created on: Sep 29, 2015 * Author: Hovanes Egiyan */ #ifndef PROFILERDETECTOR_HH_ #define PROFILERDETECTOR_HH_ #include "seqCom.h" #include #include #include #include #include #include #include #include "MtxLock.hh" #include "MutexedClass.hh" #include "ProfilerPVs.hh" //#include "ProfilerPlaneData.hh" #include "ProfilerPlaneV.hh" #include "ProfilerPlaneSimulator.hh" class ProfilerDetector : virtual public MutexedClass { protected: // Detector name std::string pdName; // Map of the planes in this detector std::map pdPlaneMap; // Map of plane simulators std::map pdSimMap; // PVs that belong to the whole detector, can have only one instance per detector instance. ProfilerPVs* pdPV ; // Flag to show if the PVs are ready to be processed bool pdReadyToProcess; private: // Hide these constructor so that they are never used ProfilerDetector() { std::cout << " Entering default " << __FUNCTION__ << std::endl; return; } ProfilerDetector( const ProfilerDetector& det ) {return;} ProfilerDetector& operator=( const ProfilerDetector& det ) {return *this;} // One should think about this before using this method // This should not be needed. inline ProfilerPVs* setPVs( ProfilerPVs* pv ) {MtxLock objLock(mcMutex);return (pdPV = pv); } public: // Main constructor, the only one that can be used ProfilerDetector( const std::string detName ); virtual ~ProfilerDetector() ; virtual inline std::string getName() const { return pdName; } virtual inline std::string setName(const std::string name ) { return pdName = name; } virtual inline std::map getPlaneMap() {MtxLock objLock(mcMutex); return pdPlaneMap; } virtual inline std::map getSimulatorMap() {MtxLock objLock( mcMutex); return pdSimMap;} virtual std::map > getFlags( const std::string planeID); virtual void setFlags( const std::string planeID, const std::map >& f ); virtual inline ProfilerPVs* getPVs() {MtxLock objLock(mcMutex);return pdPV;} // check if pulser with pulserID exists within this detector. virtual bool planeExists( const std::string planeID ) const ; // Check if the PVs for this detector have been assigned and connected virtual bool inline isReady() const {return pdReadyToProcess;} // Add board-related PVs to the PV map for the board virtual int addPVs() = 0; // Assign the SSID and the addresses of the PV arrays declared in the SNL code. virtual void usePVs( SS_ID ssID, ProfilerPVs::pvStruct& pvStruct ) ; // Connect and set monitor for the PVs needed for this detector virtual void assignPVs() ; // Method to register the flag for synchronization with a new sequencer ID. virtual void registerFlag( const std::string planeID, const SS_ID ssID, const EV_ID flagID, const std::string flagName ); virtual bool isSimulation( const std::string plane ); virtual void setSmoothOption( const std::string plane, const short option ); virtual void setAccumulateOption( const std::string plane, const short option ); virtual void resetScalers( const std::string plane, const short reset ); virtual void fitWithCauchy( const std::string plane ); virtual void getMean( const std::string planeID, double* meanArrayPtr ); virtual void getWidth( const std::string planeID, double* widthArrayPtr ); virtual void getAmplitude( const std::string planeID, double* amplArrayPtr ); virtual void getSignal( const std::string planeID, double* sigArrayPtr ); virtual void getBkg( const std::string planeID, double* bkgArrayPtr ); virtual void getSum( const std::string planeID, double* sumArrayPtr ); virtual double getTotalRate( const std::string planeID ); virtual double getSummedMean( const std::string planeID ); virtual double getSummedWidth( const std::string planeID ); virtual double getSummedAmplitude( const std::string planeID ); virtual double getSummedSignal( const std::string planeID ); virtual double getSummedBkg( const std::string planeID ); virtual double getSummedMeanErr( const std::string planeID ); virtual double getSummedWidthErr( const std::string planeID ); virtual double getSummedAmplitudeErr( const std::string planeID ); virtual double getSummedSignalErr( const std::string planeID ); virtual double getSummedBkgErr( const std::string planeID ); virtual void getAxis( const std::string planeID, double* axisArrayPtr ); virtual void getValues( const std::string planeID, double* valueArrayPtr ); }; #endif /* PROFILERDETECTOR_HH_ */