- fTf1->SetParameter(1, 0.2);
- // fTf1->SetParameter(2, 2);
- // fTf1->SetParameter(2, 3);
-
- // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1);
-
- Short_t tmpStatus = graph->Fit(fTf1, "Q0RW");
-
- // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1);
-
+ fTf1->SetParameter(1, tmax - fTau);
+ // set rather loose parameter limits
+ fTf1->SetParLimits(0, 0.5*maxf*fkEulerSquared, 2*maxf*fkEulerSquared );
+ fTf1->SetParLimits(1, tmax - fTau - 4, tmax - fTau + 4);
+
+ if (fFixTau) {
+ fTf1->FixParameter(2, fTau);
+ }
+ else {
+ fTf1->ReleaseParameter(2); // allow par. to vary
+ fTf1->SetParameter(2, fTau);
+ }
+
+ Short_t tmpStatus = 0;
+ try {
+ tmpStatus = graph->Fit(fTf1, "Q0RW");
+ }
+ catch (const std::exception & e) {
+ AliError( Form("TGraph Fit exception %s", e.what()) );
+ return AliCaloFitResults( maxamp, ped, Ret::kNoFit, maxf, timebinOffset,
+ timebinOffset, Ret::kDummy, Ret::kDummy, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
+ }
+