00001 00045 #ifndef _M_AVERAGEPULSES_H_ 00046 #define _M_AVERAGEPULSES_H_ 00047 00048 #include <vector> 00049 #include <string> 00050 #include "QModule.hh" 00051 #include "QCuore.hh" 00052 #include "QVector.hh" 00053 00054 00055 class MAveragePulses : public QModule { 00056 00057 public: 00058 MAveragePulses(QSequence* s); 00059 00060 virtual ~MAveragePulses(); 00061 00062 // Init method is called before event loop 00063 virtual void Init(); 00064 00065 // Do method is called for each event, getting the event as argument 00066 virtual QEvent* Do( QEvent* ev); 00067 00068 // Done method is called after event loop 00069 virtual void Done(); 00070 00071 void DumpEventList(int nrun); 00072 00073 private: 00074 class ChannelData { 00075 public: 00076 QVector fAvgPulse; 00077 size_t fNumPulses; 00078 double fAlignPos; 00079 QVector fPeakPositions; 00080 }; 00081 00083 bool fProcessedFirstEvent; 00084 00086 bool fSubtractBaseline; 00087 00089 bool fNumBaselinePoints; 00090 00092 bool fAlignmentOn; 00093 00095 bool fFractionalShift; 00096 00098 std::string fOutputFile; 00099 00101 bool fWriteListOfEvents; 00102 00104 int fMaxShift; 00105 00107 bool fUseOFDelay; 00108 00110 std::map<int, ChannelData> fChannelData; 00111 00113 time_t fBeginValidity; 00114 time_t fEndValidity; 00115 00116 // create QVectors to store the numbers of the selected events and the corresponding channel numbers 00117 00118 QVector selectedEvents; 00119 QVector eventChannel; 00120 int currentRun; 00121 }; 00122 00123 #endif