MQinoRawDataWriter.hh

Go to the documentation of this file.
00001 
00087 #ifndef __QINO_RAW_DATA_WRITER_HH__
00088 #define __QINO_RAW_DATA_WRITER_HH__
00089 
00090 #include "QCuore.hh"
00091 #include "QFileWriter.hh"
00092 
00093 class QApolloCalib;
00094 namespace Cuore {class QVector;}
00095 
00096 class MQinoRawDataWriter : public QFileWriter {
00097 
00098 public:
00099    MQinoRawDataWriter(QSequence *s);
00100 
00101    virtual ~MQinoRawDataWriter();
00102 
00104    virtual void Open(const std::string& fileName);
00105 
00106    // Doit method is called for each event, getting the event as argument
00107    virtual void Dump(const QEvent& ev);
00108 
00109    // Done method is called after event loop
00110    virtual void Close();
00111 
00112 private:
00113 
00114    static const size_t kArraySize = 1023; 
00117    struct QRawQinoEvt_t {
00118       char header[8];
00119       short channel;
00120       unsigned short timeLow;
00121       unsigned short timeHigh;
00122       unsigned short offset;
00123       short data[kArraySize];
00124    };
00125 
00126    QApolloCalib *fCalib;
00127 
00128    std::vector<QRawQinoEvt_t*> fEvents;
00129    time_t fStartTime;
00130    time_t fEndTime;
00131 
00132    std::string fLastFileName; 
00133    int fLastRunNumber; 
00135    bool f18BitInput;          
00137    std::map<short,short>  fChanCount; 
00139    unsigned int fNoHeaterFlag;
00140    unsigned int fOffsetForced;
00141    unsigned int fShortEvents;
00142    unsigned int fSaturatedLow;
00143    unsigned int fSaturatedHi;
00144    
00145    // config file parameters
00146    size_t fEvPoints;   
00147    size_t fPreTrigger; 
00148    bool fDiffOutput;   
00152    void FlushVector();
00153 
00158    void WriteFile();
00159 
00161    void WriteHeader();
00162 
00169    std::string GetTimeString(const time_t& time, const std::string& format);
00170    
00180    QVector Scale(const QVector& data,
00181                  const int      channel,
00182                  const size_t   first,
00183                  const size_t   last);
00184    
00192    void DumpStatistics();
00193 };
00194 
00195 #endif

Generated on Tue Nov 16 10:50:00 2010 for CUORE Software by  doxygen 1.5.6