// At each iteration, an inverse response matrix is calculated, given //
// the measured spectrum, the a priori (guessed) spectrum, //
// the efficiency spectrum and the response matrix. //
-// For each iteration, the unfolded spectrum is calculated using //
+// //
+// Then at each iteration, the unfolded spectrum is calculated using //
// the inverse response : the goal is to get an unfolded spectrum //
// similar (according to some criterion) to the a priori one. //
// If the difference is too big, another iteration is performed : //
// If no argument is passed to this function, then the second option //
// is used. //
// //
+// IMPORTANT: //
+//----------- //
+// With this approach, the efficiency map must be calculated //
+// with *simulated* values only, otherwise the method won't work. //
+// //
+// ex: efficiency(bin_pt) = number_rec(bin_pt) / number_sim(bin_pt) //
+// //
+// the pt bin "bin_pt" must always be the same in both the efficiency //
+// numerator and denominator. //
+// This is why the efficiency map has to be created by a method //
+// from which both reconstructed and simulated values are accessible //
+// simultaneously. //
+// //
+// //
//---------------------------------------------------------------------//
// Author : renaud.vernet@cern.ch //
//---------------------------------------------------------------------//
// clean the measured estimate spectrum
- for (Long_t i=0; i<fMeasuredEstimate->GetNbins(); i++) {
- fMeasuredEstimate->GetBinContent(i,fCoordinatesN_M);
- fMeasuredEstimate->SetBinContent(fCoordinatesN_M,0.);
- fMeasuredEstimate->SetBinError (fCoordinatesN_M,0.);
- }
-
+ fMeasuredEstimate->Reset();
+
THnSparse* priorTimesEff = (THnSparse*) fPrior->Clone();
priorTimesEff->Multiply(fEfficiency);
CreateInvResponse();
CreateUnfolded();
chi2 = GetChi2();
- AliDebug(1,Form("Chi2 at iteration %d is %e",iIterBayes,chi2));
+ AliDebug(0,Form("Chi2 at iteration %d is %e",iIterBayes,chi2));
if (fMaxChi2>0. && chi2<fMaxChi2) {
break;
}
// clear the unfolded spectrum
- for (Long_t i=0; i<fUnfolded->GetNbins(); i++) {
- fUnfolded->GetBinContent(i,fCoordinatesN_T);
- fUnfolded->SetBinContent(fCoordinatesN_T,0.);
- fUnfolded->SetBinError (fCoordinatesN_T,0.);
- }
+ fUnfolded->Reset();
for (Long_t iBin=0; iBin<fInverseResponse->GetNbins(); iBin++) {
Double_t invResponseValue = fInverseResponse->GetBinContent(iBin,fCoordinates2N);
Double_t chi2 = 0. ;
for (Long_t iBin=0; iBin<fPrior->GetNbins(); iBin++) {
- Double_t priorValue = fPrior->GetBinContent(iBin);
-// chi2 += (priorValue>0. ? TMath::Power(fUnfolded->GetBinContent(iBin) - priorValue,2) / priorValue : 0.) ;
- chi2 += (fUnfolded->GetBinError(iBin)>0. ? TMath::Power((fUnfolded->GetBinContent(iBin) - priorValue)/fUnfolded->GetBinError(iBin),2) / priorValue : 0.) ;
+ Double_t priorValue = fPrior->GetBinContent(iBin,fCoordinatesN_T);
+ Double_t error_unf = fUnfolded->GetBinError(fCoordinatesN_T);
+ chi2 += (error_unf > 0. ? TMath::Power((fUnfolded->GetBinContent(fCoordinatesN_T) - priorValue)/error_unf,2) / priorValue : 0.) ;
}
return chi2;
}