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 
00044   // read data and copy into given buffer
00045   virtual int GetData();
00046 
00047   // register a channel
00048   virtual void RegisterChannel(int lg, int n, bool SaveFile);
00049    
00051    virtual void RegisterDigitalChannel(int lg, bool SaveFile);
00052 
00053   // returns board base address 
00054   inline unsigned long Base() const { return m_base; }
00055 
00056   // return number of registered channels
00057   inline int NumRegChannels() const {return fNumRegChannels;}
00058                 
00059   // return number of physical channels
00060   inline int NumChannels() const {return fNumChannels;}
00061         
00062   // return logical channel for channel with physical number n
00063   inline int Lg(int n) {return fLgChan[n];} 
00064 
00065   // return a reference to the QCrateReceiverBuffer of a given physical channel
00066   inline QCrateReceiverBuffer& GetBuffer(int ch)
00067    { return *(fPhysActiveShm[ch]); }
00068 
00069   // dump for debug
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    // set clock source
00083    virtual bool SetClockSource(QClockSource_t source) {return true; }
00084 
00085    const std::map<int, int>& GetPhysChannelMap() const { return fPhysChan; }
00086 
00087 protected:
00088   // pointer to parent crate
00089   QCrate *p_Crate;
00090                 
00091   // base address of this board
00092   unsigned long m_base;
00093 
00094    int fNumRegChannels; 
00095    bool fDigChannel;    
00096    int fDigChanLg;      
00098   // number of physical channels
00099   const int fNumChannels;
00100    
00101    // associate logical channels with physical channels within the board
00102    // Two separate maps are needed for digital and analog channels because
00103    // digital and analog physical channel id can be the same
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

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1