00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __QDIGITIZER_HH_
00011 #define __QDIGITIZER_HH_
00012
00013 #include <map>
00014 #include <string>
00015
00016 #include "QCuore.hh"
00017 #include "QId.hh"
00018 #include "QNamed.hh"
00019 #include "QCrateReceiverBuffer.hh"
00020
00021 class QCrate;
00022
00023 class QDigitizer : public QId, public QNamed {
00024 public:
00025
00026 enum QClockSource_t
00027 {
00028 External_s,
00029 Board_s,
00030 Crate_s
00031 };
00032
00033
00034
00035
00036 QDigitizer();
00037
00038
00039 QDigitizer(QCrate* c, int slot, unsigned long base, int nch, std::string n);
00040
00041
00042 virtual ~QDigitizer();
00043
00044
00045 virtual int GetData();
00046
00047
00048 virtual void RegisterChannel(int lg, int n, bool SaveFile);
00049
00051 virtual void RegisterDigitalChannel(int lg, bool SaveFile);
00052
00053
00054 inline unsigned long Base() const { return m_base; }
00055
00056
00057 inline int NumRegChannels() const {return fNumRegChannels;}
00058
00059
00060 inline int NumChannels() const {return fNumChannels;}
00061
00062
00063 inline int Lg(int n) {return fLgChan[n];}
00064
00065
00066 inline QCrateReceiverBuffer& GetBuffer(int ch)
00067 { return *(fPhysActiveShm[ch]); }
00068
00069
00070 virtual void Dump() const;
00071
00072 virtual void SetStatusReady() {}
00073
00074 virtual void SetStatusRunning(bool) {}
00075
00076 virtual bool WaitForStartSignal(const char* const) { return true; }
00077
00078 virtual void GetStartSignal(char*) {}
00079
00080 virtual bool SetMuLineStatus(bool status) { return false; }
00081
00082
00083 virtual bool SetClockSource(QClockSource_t source) {return true; }
00084
00085 const std::map<int, int>& GetPhysChannelMap() const { return fPhysChan; }
00086
00087 protected:
00088
00089 QCrate *p_Crate;
00090
00091
00092 unsigned long m_base;
00093
00094 int fNumRegChannels;
00095 bool fDigChannel;
00096 int fDigChanLg;
00098
00099 const int fNumChannels;
00100
00101
00102
00103
00104 std::map<int,int> fLgChan;
00105 std::map<int,int> fPhysChan;
00106 std::map<int, QCrateReceiverBuffer*> fPhysActiveShm;
00108 QCrateReceiverBuffer* fDigChanShm;
00109 };
00110
00111 #endif