QDigitizer.hh

00001 /*
00002  * APOLLO: A complete DAQ and Online Data Analysis Framework for Cuore 
00003  * $Id: QDigitizer.hh 398 2006-11-10 18:17:03Z didomiz $
00004  * M.P. created 16/4/4
00005  * 
00006  * Class QDigitizer: base class for waveform digitizers used in Cuore
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   // empty ctor
00036   QDigitizer();
00037 
00038   // ctor
00039   QDigitizer(QCrate* c, int slot, unsigned long base, int nch, std::string n);
00040                 
00041   // dtor
00042   virtual ~QDigitizer();
00043 
00048   virtual int GetData();
00049 
00055   virtual void RegisterChannel(int lg, int physChan, bool SaveFile);
00056    
00058    virtual void RegisterDigitalChannel(int lg, bool SaveFile);
00059 
00060   // returns board base address 
00061   inline unsigned long Base() const { return m_base; }
00062 
00063   // return number of registered channels
00064   inline int NumRegChannels() const {return fNumRegChannels;}
00065                 
00066   // return number of physical channels
00067   inline int NumChannels() const {return fNumChannels;}
00068         
00069   // return logical channel for channel with physical number n
00070   inline int Lg(int n) {return fLgChan[n];} 
00071 
00072   // return a reference to the QCrateReceiverBuffer of a given physical channel
00073   inline QCrateReceiverBuffer& GetBuffer(int ch)
00074    { return *(fPhysActiveShm[ch]); }
00075 
00076   // dump for debug
00077   virtual void Dump() const;
00078 
00079   virtual void SetStatusReady() {}
00080 
00081   virtual void SetStatusRunning(bool) {}
00082 
00083   virtual bool WaitForStartSignal(const char* const) { return true; }
00084   
00085    virtual void GetStartSignal(char*) {}
00086 
00087    virtual bool SetMuLineStatus(bool status) { return false; }
00088 
00089    // set clock source
00090    virtual bool SetClockSource(QClockSource_t source) {return true; }
00091 
00092    const std::map<int, int>& GetPhysChannelMap() const { return fPhysChan; }
00093 
00094 protected:
00095   // pointer to parent crate
00096   QCrate *p_Crate;
00097                 
00098   // base address of this board
00099   unsigned long m_base;
00100 
00101    int fNumRegChannels; 
00102    bool fDigChannel;    
00103    int fDigChanLg;      
00105   // number of physical channels
00106   const int fNumChannels;
00107    
00108    // associate logical channels with physical channels within the board
00109    // Two separate maps are needed for digital and analog channels because
00110    // digital and analog physical channel id can be the same
00111    std::map<int,int> fLgChan;    
00112    std::map<int,int> fPhysChan;  
00113    std::map<int, QCrateReceiverBuffer*> fPhysActiveShm; 
00115    QCrateReceiverBuffer* fDigChanShm;  
00116 };
00117 
00118 #endif

Generated on Tue Nov 16 10:49:55 2010 for CUORE Software by  doxygen 1.5.6