222 double ampMaxAlphaBeta = 0;
223 double tMaxAlphaBeta = 5;
224 double tMaxErrorAlphaBeta = 999;
225 double tMaxRatio = 5;
226 double tMaxErrorRatio = 999;
245 NullChi2 = (sumAA - sumA*sumA/sum1)/sum0;
257 double alphabeta = amplitudeFitParameters[0]*amplitudeFitParameters[1];
258 double alpha = amplitudeFitParameters[0];
259 double beta = amplitudeFitParameters[1];
284 double totalError =
sqrt(err1 + err2*err2 +err3*err3);
290 && Rtmp<
exp(
double(
j-
i)/beta)-0.001
292 Ratio currentRatio = {
i, (
j-
i), Rtmp, totalError };
293 ratios_.push_back(currentRatio);
308 for(
unsigned int i = 0;
i <
ratios_.size();
i++){
314 if(Rmin<0.001) Rmin=0.001;
317 double RLimit =
exp(stepOverBeta)-0.001;
318 if( Rmax > RLimit ) Rmax = RLimit;
320 double time1 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmin))/alpha)-1.0);
321 double time2 = offset -
ratios_[
i].step/(
exp((stepOverBeta-
log(Rmax))/alpha)-1.0);
324 double tmax = 0.5 * (time1 + time2);
325 double tmaxerr = 0.5 *
sqrt( (time1 - time2)*(time1 - time2) );
330 for(
unsigned int it = 0; it <
amplitudes_.size(); it++){
332 double offset = (double(it) -
tmax)/alphabeta;
333 double term1 = 1.0 +
offset;
335 double f =
exp( alpha*(
log(1.0+offset) - offset) );
344 chi2 = sumAA - sumAf*sumAf/sumff;
351 if(chi2 > 0 && tmaxerr > 0 && tmax > 0){
362 double chi2min = 1.0e+9;
375 double chi2Limit = chi2min + 1.0;
381 time_wgt += inverseSigmaSquared;
382 time_max +=
timesAB_[
i].value*inverseSigmaSquared;
386 tMaxAlphaBeta = time_max/time_wgt;
387 tMaxErrorAlphaBeta = 1.0/
sqrt(time_wgt);
393 double err2 = amplitudeErrors_[
i]*amplitudeErrors_[
i];
394 double offset = (double(
i) - tMaxAlphaBeta)/alphabeta;
395 double term1 = 1.0 +
offset;
397 double f =
exp( alpha*(
log(1.0+offset) - offset) );
404 ampMaxAlphaBeta = sumAf/sumff;
405 double chi2AlphaBeta = (sumAA - sumAf*sumAf/sumff)/sum0;
406 if(chi2AlphaBeta > NullChi2){
437 for (
unsigned int i = 0;
i <
ratios_.size();
i++) {
441 &&
ratios_[
i].value <= timeFitLimits.second
444 double time_max_i =
ratios_[
i].index;
448 double u = timeFitParameters[timeFitParameters.size() - 1];
449 for (
int k = timeFitParameters.size() - 2;
k >= 0;
k--) {
450 u = u *
ratios_[
i].value + timeFitParameters[
k];
455 (timeFitParameters.size() -
456 1) * timeFitParameters[timeFitParameters.size() - 1];
457 for (
int k = timeFitParameters.size() - 2;
k >= 1;
k--) {
458 du = du *
ratios_[
i].value +
k * timeFitParameters[
k];
463 double errorsquared =
465 if (errorsquared > 0) {
467 time_max += (time_max_i - u) / errorsquared;
468 time_wgt += 1.0 / errorsquared;
470 {
ratios_[
i].index, 1, (time_max_i - u),
471 sqrt(errorsquared),0,1 };
472 times_.push_back(currentTmax);
481 tMaxRatio = time_max/time_wgt;
482 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]