Skip to content

Commit

Permalink
bugfix by Raphaelle
Browse files Browse the repository at this point in the history
See ALIROOT-6776
  • Loading branch information
cblume authored and dberzano committed Jul 11, 2016
1 parent b7e1e6c commit 0929ca8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions TRD/TRDbase/AliTRDCalDet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,42 @@ Double_t AliTRDCalDet::GetRMSRobust(Double_t robust) const
delete [] index;
return mean;
}
//____________________________________________________________________________________________
Double_t AliTRDCalDet::GetMeanRobust(Double_t robust) const
{
//
// Calculate the robust mean
//

// sorted
Int_t *index = new Int_t[kNdet];
TMath::Sort((Int_t)kNdet,fData,index);

// reject
Double_t reject = (Int_t) (kNdet*(1-robust)/2.0);
if(reject <= 0.0) reject = 0.0;
if(reject >= kNdet) reject = 0.0;
//printf("Rejecter %f\n",reject);

Double_t *ddata = new Double_t[kNdet];
Int_t nPoints = 0;
for (Int_t i=0;i<kNdet;i++) {
Bool_t rej = kFALSE;
for(Int_t k = 0; k < reject; k++){
if(i==index[k]) rej = kTRUE;
if(i==index[kNdet-(k+1)]) rej = kTRUE;
}
if(!rej){
ddata[nPoints]= fData[i];
nPoints++;
}
}
//printf("Number of points %d\n",nPoints);
Double_t mean = TMath::Mean(nPoints,ddata);
delete [] ddata;
delete [] index;
return mean;
}

//______________________________________________________________________________________________
Double_t AliTRDCalDet::GetLTM(Double_t *sigma
Expand Down
1 change: 1 addition & 0 deletions TRD/TRDbase/AliTRDCalDet.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AliTRDCalDet : public TNamed {

// statistic
Double_t GetMean(AliTRDCalDet * const outlierDet=0) const;
Double_t GetMeanRobust(Double_t robust=0.92) const;
Double_t GetRMS(AliTRDCalDet * const outlierDet=0) const;
Double_t GetRMSRobust(Double_t robust=0.92) const;
Double_t GetMedian(AliTRDCalDet * const outlierDet=0) const;
Expand Down
3 changes: 2 additions & 1 deletion TRD/TRDbase/AliTRDCalibraFit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ Bool_t AliTRDCalibraFit::AnalyseLinearFitters(AliTRDCalibraVdriftLinearFit *cali
fStatisticMean += entriesCurrent;

// Check the fit
if((-(param[1])) <= 0.000001) {
if((-(param[1])) <= 0.01) {
NotEnoughStatisticLinearFitter();
continue;
}
Expand All @@ -1255,6 +1255,7 @@ Bool_t AliTRDCalibraFit::AnalyseLinearFitters(AliTRDCalibraVdriftLinearFit *cali
fCurrentCoef[0] = -param[1];
// here the database must be the one of the reconstruction for the lorentz angle....
fCurrentCoef2[0] = (param[0]+fCurrentCoef[1]*fCurrentCoef2[1])/fCurrentCoef[0];
//printf("fCurrentCoef2[0] %f, param[0] %f, fCurrentCoef[1]*fCurrentCoef2[1] %f,fCurrentCoef[0] %f\n",fCurrentCoef2[0],param[0],fCurrentCoef[1]*fCurrentCoef2[1],fCurrentCoef[0]);
fCurrentCoefE = error[1];
fCurrentCoefE2 = error[0];
if((TMath::Abs(fCurrentCoef2[0]) > 0.0000001) && (TMath::Abs(param[0]) > 0.0000001)){
Expand Down

0 comments on commit 0929ca8

Please sign in to comment.