191 RESTDebug <<
"TRestRawSignalConvolutionFittingProcess::ProcessEvent. Event ID : "
194 Double_t SigmaMean = 0;
196 Double_t RatioSigmaMaxPeakMean = 0;
197 vector<Double_t> RatioSigmaMaxPeak(
fRawSignalEvent->GetNumberOfSignals());
198 Double_t ChiSquareMean = 0;
201 map<int, Double_t> amplitudeFit;
202 map<int, Double_t> shapingtimeFit;
203 map<int, Double_t> peakpositionFit;
204 map<int, Double_t> variancegaussFit;
206 amplitudeFit.clear();
207 shapingtimeFit.clear();
208 peakpositionFit.clear();
209 variancegaussFit.clear();
211 int MinBinRange = 25;
212 int MaxBinRange = 45;
220 TF1* f =
new TF1(
"Aget",
221 "[0]*TMath::Exp(-3. * (x-[2])/[1]) * (x-[2])/[1] "
222 "* (x-[2])/[1] * (x-[2])/[1] * "
223 " sin((x-[2])/[1])/(1+TMath::Exp(-10000*(x-[2])))",
225 f->SetParameters(0., 300., 42., 20.);
226 f->SetParNames(
"Amplitude",
"ShapingTime",
"PeakPosition");
229 TF1* g =
new TF1(
"pulse",
"exp(-0.5*((x)/[0])*((x)/[0]))", 0, 511);
230 g->SetParameters(0, 7.);
233 TF1Convolution* conv =
new TF1Convolution(
"Aget",
"pulse", 0, 511,
true);
234 conv->SetRange(0, 511);
235 conv->SetNofPointsFFT(10000);
237 TF1* fit_conv =
new TF1(
"fit", *conv, 0, 511, conv->GetNpar());
238 fit_conv->SetParNames(
"Amplitude",
"ShapingTime",
"PeakPosition",
"VarianceGauss");
242 TH1D* h =
new TH1D(
"histo",
"Signal to histo", nBins, 0, nBins);
244 for (
int i = 0; i < nBins; i++) {
250 fit_conv->SetParameters(singleSignal->
GetData(MaxPeakBin), 25., MaxPeakBin - 25., 8.);
251 fit_conv->FixParameter(0, singleSignal->
GetData(MaxPeakBin));
253 h->Fit(fit_conv,
"LRNQ",
"", MaxPeakBin - MinBinRange, MaxPeakBin + MaxBinRange);
258 for (
int j = MaxPeakBin - MinBinRange; j < MaxPeakBin + MaxBinRange; j++) {
259 sigma += (singleSignal->
GetData(j) - fit_conv->Eval(j)) *
260 (singleSignal->
GetData(j) - fit_conv->Eval(j));
262 Sigma[s] = TMath::Sqrt(sigma / (MinBinRange + MaxBinRange));
263 RatioSigmaMaxPeak[s] = Sigma[s] / singleSignal->
GetData(MaxPeakBin);
264 RatioSigmaMaxPeakMean += RatioSigmaMaxPeak[s];
265 SigmaMean += Sigma[s];
266 ChiSquare[s] = fit_conv->GetChisquare();
267 ChiSquareMean += ChiSquare[s];
269 amplitudeFit[singleSignal->
GetID()] = fit_conv->GetParameter(0);
270 shapingtimeFit[singleSignal->
GetID()] = fit_conv->GetParameter(1);
271 peakpositionFit[singleSignal->
GetID()] = fit_conv->GetParameter(2);
272 variancegaussFit[singleSignal->
GetID()] = fit_conv->GetParameter(3);
288 Double_t sigmaMeanStdDev = 0;
290 sigmaMeanStdDev += (Sigma[k] - SigmaMean) * (Sigma[k] - SigmaMean);
292 Double_t SigmaMeanStdDev = TMath::Sqrt(sigmaMeanStdDev /
fRawSignalEvent->GetNumberOfSignals());
300 RatioSigmaMaxPeakMean = RatioSigmaMaxPeakMean /
fRawSignalEvent->GetNumberOfSignals();
303 RESTDebug <<
"SigmaMean: " << SigmaMean <<
RESTendl;
304 RESTDebug <<
"SigmaMeanStdDev: " << SigmaMeanStdDev <<
RESTendl;
305 RESTDebug <<
"ChiSquareMean: " << ChiSquareMean <<
RESTendl;
306 RESTDebug <<
"RatioSigmaMaxPeakMean: " << RatioSigmaMaxPeakMean <<
RESTendl;
308 RESTDebug <<
"Standard deviation of signal number " << k <<
": " << Sigma[k] <<
RESTendl;
309 RESTDebug <<
"Chi square of fit signal number " << k <<
": " << ChiSquare[k] <<
RESTendl;
310 RESTDebug <<
"Sandard deviation divided by amplitude of signal number " << k <<
": "
311 << RatioSigmaMaxPeak[k] <<
RESTendl;
330 sgnl->InitializePointsOverThreshold(TVector2(fPointThreshold,
332 fNPointsOverThreshold);
338 if (ApplyCut())
return nullptr;