Commit 2e0167bf authored by Jolie Roiseux's avatar Jolie Roiseux
Browse files

Merge branch 'feature/ds_match_filter' into 'develop'

Feature/ds match filter

See merge request !58
parents 80b2aa84 6bc8c660
Pipeline #53747 passed with stages
in 5 minutes and 54 seconds
......@@ -20,7 +20,7 @@ obj/pulse_analysis/Exp2Gaus1.o obj/pulse_analysis/Exp2Gaus2.o obj/pulse_analysis
obj/pulse_analysis/PulseAnalysisProcessor.o obj/StepRunManager.o obj/baseline_processing/BaselineProcessor.o \
obj/filtering/TirangleFilter.o obj/filtering/ExpFilter.o obj/filtering/MeanFilter.o obj/filtering/MatchedFilter.o \
obj/filtering/ConvolutionFilterStrategy.o obj/filtering/FilterProcessor.o obj/baseline_processing/MostProbBaselineStrategy.o \
obj/event_analysis/LOLXEventProcessor.o obj/filtering/ExpMatchFilter.o obj/event_analysis/EventEfficiency.o
obj/event_analysis/LOLXEventProcessor.o obj/filtering/ExpMatchFilter.o obj/filtering/Exp2GausMatchedFilter.o obj/event_analysis/EventEfficiency.o
all: lib bin/vanwftk bin/EventViewer
......
#include "Exp2GausMatchedFilter.h"
#include "../WaveformStatistic.h"
Exp2GausMatchedFilterStrategy::Exp2GausMatchedFilterStrategy(Json::Value cfg)
: MatchedFilterStrategy::MatchedFilterStrategy(cfg) {
this->createWaveletKernal(cfg);
}
void Exp2GausMatchedFilterStrategy::createWaveletFunction(Json::Value cfg) {
double riseTimeSigma = cfg["RiseTimeSigma"].asDouble();
double fallTimeTau = cfg["FallTimeTau"].asDouble();
double time2Frac = cfg["Time2Frac"].asDouble();
double fallTime2Tau = cfg["FallTime2Tau"].asDouble();
this->wavelet = new TF1("wavelet", FuncExpGausMulti, 0, 30000, 8);
this->wavelet->ReleaseParameter(0);
this->wavelet->FixParameter(0, 0);
this->wavelet->FixParameter(1, riseTimeSigma);
this->wavelet->FixParameter(2, fallTimeTau);
this->wavelet->FixParameter(3, time2Frac);
this->wavelet->FixParameter(4, fallTime2Tau);
this->wavelet->FixParameter(5, 1);
this->wavelet->FixParameter(6, 1.0);
this->wavelet->FixParameter(7, 1.0);
}
\ No newline at end of file
#include "MatchedFilter.h"
class Exp2GausMatchedFilterStrategy : public MatchedFilterStrategy {
public:
Exp2GausMatchedFilterStrategy(Json::Value cfg);
void createWaveletFunction(Json::Value cfg) override;
};
\ No newline at end of file
#include "FilterProcessor.h"
#include "Exp2GausMatchedFilter.h"
#include "ExpFilter.h"
#include "ExpMatchFilter.h"
#include "MeanFilter.h"
......@@ -17,6 +18,8 @@ FilterProcessor::FilterProcessor(std::vector<ChannelConfig> channelConfigs) {
fs = new MeanFilter(channelCfg.vars);
} else if (name == "ExpMatch") {
fs = new ExpMatchFilterStrategy(channelCfg.vars);
} else if (name == "Exp2GausMatch") {
fs = new Exp2GausMatchedFilterStrategy(channelCfg.vars);
} else if (name == "NA") {
fs = nullptr;
} else {
......
......@@ -13,9 +13,9 @@ void Exp2Gaus2::setFitParemeters(TF1 *fit, Pulse &p, Json::Value cfg) {
fit->FixParameter(0, p.baseline);
fit->ReleaseParameter(1);
fit->SetParameter(1, riseTimeSigma);
fit->FixParameter(1, riseTimeSigma);
fit->ReleaseParameter(2);
fit->SetParameter(2, fallTimeTau);
fit->FixParameter(2, fallTimeTau);
if (time2Frac != 0.) {
......
......@@ -9,9 +9,10 @@
*/
void ExpRise::setFitParemeters(TF1 *fit, Pulse &p, Json::Value cfg) {
double riseTimeSigma = cfg["RiseTimeSigma"].asDouble();
double fallTimeTau = cfg["FallTimeTau"].asInt();
double fallTimeTau = cfg["FallTimeTau"].asDouble();
double time2Frac = cfg["Time2Frac"].asDouble();
double fallTime2Tau = cfg["FallTime2Tau"].asInt();
double fallTime2Tau = cfg["FallTime2Tau"].asDouble();
int isFloating = cfg["isFloating"].asInt();
fit->ReleaseParameter(0);
fit->SetParameter(0, p.baseline);
......
......@@ -26,6 +26,8 @@ std::vector<Pulse> PFSProminence::findPulses(Waveform &wf, Json::Value cfg) {
double noise = cfg["Noise"].asDouble();
int polarity = cfg["Polarity"].asInt();
double promienese = cfg["Promienese"].asDouble();
int waveformStart = cfg["WaveformStart"].asInt();
int waveformEnd = cfg["WaveformEnd"].asDouble();
double baselineMu = wf.getWaveformBaseline().mu;
if (!baselineMu) {
......@@ -33,14 +35,14 @@ std::vector<Pulse> PFSProminence::findPulses(Waveform &wf, Json::Value cfg) {
return pulses;
}
int numBins = wf.GetNbinsX();
int numBins = wf.GetNbinsX() - waveformEnd;
double binWidth = wf.GetBinWidth(1);
int binRiseTime = round(riseTimeSigma * riseTimeSigmaCoefficient / binWidth);
int binFallTime =
round((fallTimeTau * fallTimeTauCoefficient + fallTime2Tau) / binWidth);
for (int bin = binRiseTime + 1; bin <= numBins; bin++) {
for (int bin = binRiseTime + 1 + waveformStart; bin <= numBins; bin++) {
double binAmp = wf.GetBinContent(bin);
if (polarity * (binAmp - baselineMu) <= (noise * promienese)) {
......
......@@ -9,7 +9,7 @@
},
"ChannelConfigs": [
{
"FilterStrategy": "Mean",
"FilterStrategy": "Exp2GausMatch",
"PulseFindingStrategy": "PFSProminence",
"PulseAnalysisStrategy": "AdditiveChi2RefitExp2Gaus1",
"BaselineStrategy": "MostProbable",
......@@ -17,17 +17,18 @@
"EventProcessor": "Efficiency",
"Variables": {
"__Comment0__": "Pulse Shape",
"Noise": 8,
"__CommentNoise__": " Noise before filtering was around: 20",
"RiseTimeSigma": 3.2,
"FallTimeTau": 853,
"FallTime2Tau": 28,
"WindowStart": 17500,
"WindowEnd": 20000,
"Noise": 21,
"RiseTimeSigma": 1.12,
"FallTimeTau": 700,
"FallTime2Tau": 11.45,
"Polarity": -1,
"Time2Frac": 0.622,
"Time2Frac": 0.55,
"KernalSize": 301,
"RiseTimeSigmaCoefficient": 3,
"FallTimeTauCoefficient": 3,
"FallTimeTauCoefficient": 5,
"FallTime2TauCoefficient": 1,
"__Comment1__": "Baseline Extraction",
"WaveformAmplitudeBinning": 1,
......@@ -35,11 +36,14 @@
"MinAmplitude": 0,
"RMSCutNoiseCoefficient": 25,
"__Comment2__": "Pulse Finding",
"WaveformStart": 151,
"WaveformEnd": 151,
"isFloating": 1,
"NumBins": 0,
"Promienese": 3.0,
"PulseBaselineCalcBeginOffset": 15,
"PulseBaselineCalcEndOffset": 5,
"PulseBaselineDifferenceCutCoefficient": 4,
"PulseBaselineCalcBeginOffset": 25,
"PulseBaselineCalcEndOffset": 15,
"PulseBaselineDifferenceCutCoefficient": 10,
"PulseChargeCutCoefficient": 3,
"PulseChargeCalcOffset": 2,
"PulseStartCalcOffset": 2,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment