195 double ampMaxAlphaBeta = 0;
196 double tMaxAlphaBeta = 5;
197 double tMaxErrorAlphaBeta = 999;
198 double tMaxRatio = 5;
199 double tMaxErrorRatio = 999;
218 NullChi2 = (sumAA - sumA*sumA/sum1)/sum0;
230 double alphabeta = amplitudeFitParameters[0]*amplitudeFitParameters[1];
231 double alpha = amplitudeFitParameters[0];
232 double beta = amplitudeFitParameters[1];
257 double totalError =
sqrt(err1 + err2*err2 +err3*err3);
263 && Rtmp<
exp(
double(
j-
i)/beta)-0.001
265 Ratio currentRatio = {
i, (
j-
i), Rtmp, totalError };
266 ratios_.push_back(currentRatio);
281 for(
unsigned int i = 0;
i <
ratios_.size();
i++){
287 if(Rmin<0.001) Rmin=0.001;
290 double RLimit =
exp(stepOverBeta)-0.001;
291 if( Rmax > RLimit ) Rmax = RLimit;
293 double time1 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmin))/alpha)-1.0);
294 double time2 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmax))/alpha)-1.0);
297 double tmax = 0.5 * (time1 + time2);
298 double tmaxerr = 0.5 *
sqrt( (time1 - time2)*(time1 - time2) );
303 for(
unsigned int it = 0; it <
amplitudes_.size(); it++){
305 double offset = (double(it) -
tmax)/alphabeta;
306 double term1 = 1.0 +
offset;
308 double f =
exp( alpha*(
log(1.0+offset) - offset) );
317 chi2 = sumAA - sumAf*sumAf/sumff;
324 if(chi2 > 0 && tmaxerr > 0 && tmax > 0){
335 double chi2min = 1.0e+9;
336 double timeMinimum = 5;
337 double errorMinimum = 999;
348 double chi2Limit = chi2min + 1.0;
354 time_wgt += inverseSigmaSquared;
355 time_max +=
timesAB_[
i].value*inverseSigmaSquared;
359 tMaxAlphaBeta = time_max/time_wgt;
360 tMaxErrorAlphaBeta = 1.0/
sqrt(time_wgt);
366 double err2 = amplitudeErrors_[
i]*amplitudeErrors_[
i];
367 double offset = (double(
i) - tMaxAlphaBeta)/alphabeta;
368 double term1 = 1.0 +
offset;
370 double f =
exp( alpha*(
log(1.0+offset) - offset) );
377 ampMaxAlphaBeta = sumAf/sumff;
378 double chi2AlphaBeta = (sumAA - sumAf*sumAf/sumff)/sum0;
379 if(chi2AlphaBeta > NullChi2){
410 for (
unsigned int i = 0;
i <
ratios_.size();
i++) {
414 &&
ratios_[
i].value <= timeFitLimits.second
417 double time_max_i =
ratios_[
i].index;
421 double u = timeFitParameters[timeFitParameters.size() - 1];
422 for (
int k = timeFitParameters.size() - 2;
k >= 0;
k--) {
423 u = u *
ratios_[
i].value + timeFitParameters[
k];
428 (timeFitParameters.size() -
429 1) * timeFitParameters[timeFitParameters.size() - 1];
430 for (
int k = timeFitParameters.size() - 2;
k >= 1;
k--) {
431 du = du *
ratios_[
i].value +
k * timeFitParameters[
k];
436 double errorsquared =
438 if (errorsquared > 0) {
440 time_max += (time_max_i - u) / errorsquared;
441 time_wgt += 1.0 / errorsquared;
443 {
ratios_[
i].index, 1, (time_max_i - u),
444 sqrt(errorsquared),0,1 };
445 times_.push_back(currentTmax);
454 tMaxRatio = time_max/time_wgt;
455 tMaxErrorRatio = 1.0/
sqrt(time_wgt);
CalculatedRecHit calculatedRechit_
Exp< T >::type exp(const T &t)
std::vector< double > amplitudeErrors_
unsigned int offset(bool)
static const double tmax[3]
std::vector< double > amplitudes_
Log< T >::type log(const T &t)
std::vector< Ratio > ratios_
std::vector< Tmax > times_
const double Rmax[kNumberCalorimeter]
std::vector< Tmax > timesAB_
const double Rmin[kNumberCalorimeter]