179 RESTDebug <<
"TRestRawSignalFittingProcess::ProcessEvent. Event ID : " <<
fRawSignalEvent->GetID()
182 Double_t SigmaMean = 0;
184 Double_t RatioSigmaMaxPeakMean = 0;
185 vector<Double_t> RatioSigmaMaxPeak(
fRawSignalEvent->GetNumberOfSignals());
186 Double_t ChiSquareMean = 0;
189 map<int, Double_t> baselineFit;
190 map<int, Double_t> amplitudeFit;
191 map<int, Double_t> shapingTimeFit;
192 map<int, Double_t> peakPositionFit;
195 amplitudeFit.clear();
196 shapingTimeFit.clear();
197 peakPositionFit.clear();
205 TF1* f =
new TF1(
"fit",
206 "[0]+[1]*TMath::Exp(-3. * (x-[3])/[2]) * "
207 "(x-[3])/[2] * (x-[3])/[2] * (x-[3])/[2] * "
208 "sin((x-[3])/[2])/(1+TMath::Exp(-10000*(x-[3])))",
210 f->SetParameters(0, 2000, 70, 80);
219 f->SetParNames(
"Baseline",
"Amplitude",
"ShapingTime",
"PeakPosition");
223 TH1D* h =
new TH1D(
"histo",
"Signal to histo", nBins, 0, nBins);
225 for (
int i = 0; i < nBins; i++) {
230 h->Fit(f,
"NWW",
"", 0, 511);
233 for (
int j = MaxPeakBin - 145; j < MaxPeakBin + 165; j++) {
234 sigma += (singleSignal->
GetRawData(j) - f->Eval(j)) * (singleSignal->
GetRawData(j) - f->Eval(j));
236 Sigma[s] = TMath::Sqrt(sigma / (145 + 165));
237 RatioSigmaMaxPeak[s] = Sigma[s] / singleSignal->
GetRawData(MaxPeakBin);
238 RatioSigmaMaxPeakMean += RatioSigmaMaxPeak[s];
239 SigmaMean += Sigma[s];
240 ChiSquare[s] = f->GetChisquare();
241 ChiSquareMean += ChiSquare[s];
243 baselineFit[singleSignal->
GetID()] = f->GetParameter(0);
244 amplitudeFit[singleSignal->
GetID()] = f->GetParameter(1);
245 shapingTimeFit[singleSignal->
GetID()] = f->GetParameter(2);
246 peakPositionFit[singleSignal->
GetID()] = f->GetParameter(3);
248 fShaping = f->GetParameter(2);
249 fStartPosition = f->GetParameter(3);
250 fBaseline = f->GetParameter(0);
251 fAmplitude = f->GetParameter(1);
267 Double_t sigmaMeanStdDev = 0;
269 sigmaMeanStdDev += (Sigma[k] - SigmaMean) * (Sigma[k] - SigmaMean);
271 Double_t SigmaMeanStdDev = TMath::Sqrt(sigmaMeanStdDev /
fRawSignalEvent->GetNumberOfSignals());
279 RatioSigmaMaxPeakMean = RatioSigmaMaxPeakMean /
fRawSignalEvent->GetNumberOfSignals();
282 RESTDebug <<
"SigmaMean: " << SigmaMean <<
RESTendl;
283 RESTDebug <<
"SigmaMeanStdDev: " << SigmaMeanStdDev <<
RESTendl;
284 RESTDebug <<
"ChiSquareMean: " << ChiSquareMean <<
RESTendl;
285 RESTDebug <<
"RatioSigmaMaxPeakMean: " << RatioSigmaMaxPeakMean <<
RESTendl;
287 RESTDebug <<
"Standard deviation of signal number " << k <<
": " << Sigma[k] <<
RESTendl;
288 RESTDebug <<
"Chi square of fit signal number " << k <<
": " << ChiSquare[k] <<
RESTendl;
289 RESTDebug <<
"Sandard deviation divided by amplitude of signal number " << k <<
": "
290 << RatioSigmaMaxPeak[k] <<
RESTendl;
309 sgnl->InitializePointsOverThreshold(TVector2(fPointThreshold,
311 fNPointsOverThreshold);
317 if (ApplyCut())
return nullptr;