219 double ampMaxAlphaBeta = 0;
220 double tMaxAlphaBeta = 5;
221 double tMaxErrorAlphaBeta = 999;
222 double tMaxRatio = 5;
223 double tMaxErrorRatio = 999;
242 NullChi2 = (sumAA - sumA*sumA/sum1)/sum0;
254 double alphabeta = amplitudeFitParameters[0]*amplitudeFitParameters[1];
255 double alpha = amplitudeFitParameters[0];
256 double beta = amplitudeFitParameters[1];
281 double totalError =
sqrt(err1 + err2*err2 +err3*err3);
287 && Rtmp<
exp(
double(
j-
i)/beta)-0.001
289 Ratio currentRatio = {
i, (
j-
i), Rtmp, totalError };
290 ratios_.push_back(currentRatio);
305 for(
unsigned int i = 0;
i <
ratios_.size();
i++){
311 if(Rmin<0.001) Rmin=0.001;
314 double RLimit =
exp(stepOverBeta)-0.001;
315 if( Rmax > RLimit ) Rmax = RLimit;
317 double time1 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmin))/alpha)-1.0);
318 double time2 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmax))/alpha)-1.0);
321 double tmax = 0.5 * (time1 + time2);
322 double tmaxerr = 0.5 *
sqrt( (time1 - time2)*(time1 - time2) );
327 for(
unsigned int it = 0; it <
amplitudes_.size(); it++){
329 double offset = (double(it) -
tmax)/alphabeta;
330 double term1 = 1.0 +
offset;
332 double f =
exp( alpha*(
log(1.0+offset) - offset) );
341 chi2 = sumAA - sumAf*sumAf/sumff;
348 if(chi2 > 0 && tmaxerr > 0 && tmax > 0){
359 double chi2min = 1.0e+9;
372 double chi2Limit = chi2min + 1.0;
378 time_wgt += inverseSigmaSquared;
379 time_max +=
timesAB_[
i].value*inverseSigmaSquared;
383 tMaxAlphaBeta = time_max/time_wgt;
384 tMaxErrorAlphaBeta = 1.0/
sqrt(time_wgt);
390 double err2 = amplitudeErrors_[
i]*amplitudeErrors_[
i];
391 double offset = (double(
i) - tMaxAlphaBeta)/alphabeta;
392 double term1 = 1.0 +
offset;
394 double f =
exp( alpha*(
log(1.0+offset) - offset) );
401 ampMaxAlphaBeta = sumAf/sumff;
402 double chi2AlphaBeta = (sumAA - sumAf*sumAf/sumff)/sum0;
403 if(chi2AlphaBeta > NullChi2){
434 for (
unsigned int i = 0;
i <
ratios_.size();
i++) {
438 &&
ratios_[
i].value <= timeFitLimits.second
441 double time_max_i =
ratios_[
i].index;
445 double u = timeFitParameters[timeFitParameters.size() - 1];
446 for (
int k = timeFitParameters.size() - 2;
k >= 0;
k--) {
447 u = u *
ratios_[
i].value + timeFitParameters[
k];
452 (timeFitParameters.size() -
453 1) * timeFitParameters[timeFitParameters.size() - 1];
454 for (
int k = timeFitParameters.size() - 2;
k >= 1;
k--) {
455 du = du *
ratios_[
i].value +
k * timeFitParameters[
k];
460 double errorsquared =
462 if (errorsquared > 0) {
464 time_max += (time_max_i - u) / errorsquared;
465 time_wgt += 1.0 / errorsquared;
467 {
ratios_[
i].index, 1, (time_max_i - u),
468 sqrt(errorsquared),0,1 };
469 times_.push_back(currentTmax);
478 tMaxRatio = time_max/time_wgt;
479 tMaxErrorRatio = 1.0/
sqrt(time_wgt);
CalculatedRecHit calculatedRechit_
std::vector< double > amplitudeErrors_
unsigned int offset(bool)
static const double tmax[3]
std::vector< double > amplitudes_
std::vector< Ratio > ratios_
std::vector< Tmax > times_
const double Rmax[kNumberCalorimeter]
std::vector< Tmax > timesAB_
const double Rmin[kNumberCalorimeter]