24 : m_deltas(deltas), m_run(
run), m_event(
event),
25 m_adcMax(adcMax), m_time(time)
54 TVectorD vect(
lwb(),
upb() + 1);
63 if (!r1.hasSameRange(r2)) {
64 cout <<
"WARNING : residuals have different ranges, this may crash the sorting..." << endl;
74 const double epsilon = 1
E-5;
81 if (
m_sampling == r1.upb() + 1)
return r1.time() < r2.time() - epsilon;
82 cout <<
"WARNING : comparison on an unknown sample, this may crash the sorting..." << endl;
89 if (
size() == 0)
return false;
90 medians.ResizeTo(
lwb(),
upb() + 1);
91 widths.ResizeTo (
lwb(),
upb() + 1);
93 double halfSigmaQuantile = TMath::Prob(1,1)/2;
94 double medianQuantile = 0.5;
96 std::vector<Residual> sortedResiduals =
m_residuals;
98 for (
short i =
lwb();
i <=
upb() + 1;
i++) {
128 std::sort(sortedResiduals.begin(), sortedResiduals.end(),
ResidualCompare(
i));
129 Residual& medianRes = sortedResiduals[(
unsigned int)(sortedResiduals.size()*medianQuantile)];
130 Residual& loHalfSigmaRes = sortedResiduals[(
unsigned int)(sortedResiduals.size()*halfSigmaQuantile)];
131 Residual& hiHalfSigmaRes = sortedResiduals[(
unsigned int)(sortedResiduals.size()*(1 - halfSigmaQuantile))];
133 double loHalfSigma = (
i <
upb() + 1 ? loHalfSigmaRes.scaledDelta(
i) : loHalfSigmaRes.time());
134 double hiHalfSigma = (
i <
upb() + 1 ? hiHalfSigmaRes.scaledDelta(
i) : hiHalfSigmaRes.time());
146 TVectorD medians, widths;
151 if (!original->
medianVars(medians, widths)) {
delete original;
return nullptr;}
155 if (!
medianVars(medians, widths))
return nullptr;
161 if (nMax > 0 && truncated->
size() == nMax)
break;
169 if (nWidthsTime > 0 && TMath::Abs(
residual.
time() - medians[
upb() + 1]) > nWidthsTime*widths[
upb() + 1])
continue;
178 TH1D*
h =
new TH1D(
name,
"",
nBins, xMin, xMax);
187 if (
size() == 0)
return nullptr;
199 for (
unsigned int i = 0;
i <
size();
i++)
229 if (
index == -1)
return true;
244 TVectorD xip(
lwb(),
upb());
247 if (
size() > 2) cout <<
"WARNING: variance of t < 1E-6, returning correction without derivative term. (V = " <<
denom <<
", N = " <<
size() <<
")" << endl;
251 TVectorD xip = TVectorD(
regresser()->covarianceMatrix()[
upb() + 1]).GetSub(
lwb(),
upb(),
"I");
254 TVectorD xipErrVect = TVectorD(
regresser()->covarianceMatrixErrors()[
upb() + 1]).GetSub(
lwb(),
upb(),
"I");
255 xipErrVect *= 1/
denom;
257 for (
int k1 =
lwb(); k1 <=
upb(); k1++) xipErr(k1, k1) = TMath::Power(xipErrVect(k1), 2);
265 if (!
weigh())
return 1;
266 return TMath::Power(
residual.adcMax(), 2);
295 for (
unsigned int i = 0;
i <
size();
i++)
306 for (
unsigned int i = 0;
i < 100000;
i++) {
309 for (
unsigned short j = 0; j < 5; j++)
d(j) =
r.Gaus(0, 1);
319 if (!truncated)
return false;
321 TH1D*
h = truncated->
histogram(0,
"h", 100, -5, 5);