QOptimumTrigger.hh
00001 #ifndef _Q_OPTIMUM_TRIGGER_HH_
00002 #define _Q_OPTIMUM_TRIGGER_HH_
00003
00011 #include "OptimumFilter.hh"
00012 #include "QVector.hh"
00013 #include <vector>
00014
00015 class QOptimumTrigger {
00016 public:
00017 QOptimumTrigger();
00018 void SetExactConvolution(const bool econv) { fExactConvolution = econv; }
00019 void SetVetoMode(const bool vetomode) { fVetoMode = vetomode; }
00020 void SetChannel(const int chan) { fChannel = chan; }
00021 QError SetFilters(const QVector& idealPulse, const QVector& noisePS);
00022 QError Init();
00023 QError Trigger(const QVector& input, QVector& triggerPos, QVector& triggerAmpl);
00024 void DumpOnFile(const std::string& filename) const ;
00025 QVector GetFilteredSamples() const { return fFilteredSamples; }
00026 void Print(ostream& o) const;
00027
00028 struct VetoInterval {
00029 int start;
00030 int end;
00031 };
00032 bool WindowHasVeto() const { return fVetoWindow; }
00033 const QVector& GetVetoedSamples() const { return fVetoedSamples; }
00034 double GetVetoRejection() const {return fTotCounter > 0 ? double(fVetoCounter)/fTotCounter : 0;}
00035 private:
00036 QError Filter(const QVector& input, QVector& output, bool isIdeal = false);
00037 void Veto(const QVector& input);
00038 void ResAndFWHM();
00039
00040 OptimumFilter fOF;
00041 bool fExactConvolution;
00042 int fChannel;
00043 double fConv;
00044
00045 Cuore::QVector fIdealPulse;
00046 Cuore::QVector fInputIdealPulse;
00047 Cuore::QVector fNoisePS;
00048 Cuore::QVector fIdealPulsePS;
00049 Cuore::QVector fFilteredIdealPulse;
00050 Cuore::QVector fKernel;
00051 Cuore::QVectorC fH;
00052
00053 Cuore::QVector fFilteredSamples;
00054
00055 double fThreshold;
00056 int fFWHM;
00057 double fResolution;
00058
00059 bool fVetoMode;
00060 double fVetoThresRatio;
00061 int fVetoStart;
00062 int fVetoEnd;
00063
00064 bool fVetoWindow;
00065 int fVetoCounter;
00066 int fTotCounter;
00067
00068 Cuore::QVector fVetoedSamples;
00069
00070 };
00071
00072 #endif