QMuonDataWriter.hh

00001 #ifndef __QMUONDATAWRITER_HH_
00002 #define __QMUONDATAWRITER_HH_
00003 
00004 #include <sys/times.h>
00005 #include <stdlib.h>
00006 #include <stdio.h>
00007 #include <fcntl.h>
00008 #include <unistd.h>
00009 #include <iostream>
00010 #include <errno.h>
00011 #include <string>
00012 #include "QMuonBuffer.hh"
00013 
00014 #ifdef __STRUCK_HARDWARE__
00015 extern "C"{
00016 #include <sis3100_vme_calls.h>
00017 #include <sis1100_var.h>
00018 }
00019 
00020 #endif
00021 
00022 #define QDCADDR 0xF0F0000
00023 
00024 #define TDCADDR 0x0000
00025 
00026 
00027 //twice the number of events per partial file written
00028 #define NEVENTSREAD 2000
00029 
00030 using namespace std;
00031 
00032 
00033 
00034 
00035 class QMuonDataWriter{
00036         public:
00037                 QMuonDataWriter();
00038                 ~QMuonDataWriter();
00039                 int GetDatum();
00040                 int GetFakeDatum();
00041                 void DumpMemory();
00042                 void InitBoards();
00043 
00044         private: 
00045                 bool AreThereDataQDC();
00046                 bool AreThereDataTDC();
00047                 int ReadEventSingleWord(event_t&,const clock_t&);
00048         //      bool ShmCanBeWritten();
00049                 void ReadQDC();
00050                 void ReadTDC();
00051                 bool CheckQDCBufferFull();
00052                 bool CheckTDCBufferFull();
00053                 void ReadQDCSimu();
00054                 void ReadTDCSimu();
00055                 void DumpDatum(struct event_t &); 
00056                 void DataResetQDC();
00057                 void DataResetTDC();
00058                 void SetParameters();
00059                 void SoftwareResetTDC();
00060                 void SoftwareResetQDC();
00061 
00062                 shmbuffer_t *p_buffer;  
00063                 int fCrate;
00064                 int fCurrentEventQDC;
00065                 int fCurrentEventTDC;
00066                 int fPreviousEventQDC;
00067                 int fPreviousEventTDC;
00068                 int fPreviousDiff;
00069                 int fCurrentDiff;
00070                 int fCnt;
00071                 int fOutputBufferAddr;
00072                 int fStatusRegister1Addr;
00073                 int fBitSet2RegisterAddr;
00074                 int fBitSet1RegisterAddr;
00075                 long fClktck;
00076                 int fBegin;
00077                 clock_t fStartTime;
00078                 int fFakeEventCounterQDC;
00079                 int fFakeEventCounterTDC;
00080                 int fEventSize;
00081                 u_int32_t fReadBuffer[READSIZE];
00082                 int fShmhandle;
00083 
00084 };
00085 
00086 #endif

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