}
//___________________________________________________________________________________
-Double_t AliTRDCalDet::GetMean(AliTRDCalDet* outlierDet)
+Double_t AliTRDCalDet::GetMean(AliTRDCalDet * const outlierDet) const
{
//
// Calculate the mean
if (!outlierDet) return TMath::Mean(kNdet,fData);
Double_t *ddata = new Double_t[kNdet];
- Int_t NPoints = 0;
+ Int_t nPoints = 0;
for (Int_t i=0;i<kNdet;i++) {
if (!(outlierDet->GetValue(i))) {
- ddata[NPoints]= fData[NPoints];
- NPoints++;
+ ddata[nPoints]= fData[nPoints];
+ nPoints++;
}
}
- Double_t mean = TMath::Mean(NPoints,ddata);
+ Double_t mean = TMath::Mean(nPoints,ddata);
delete [] ddata;
return mean;
}
//_______________________________________________________________________________________
-Double_t AliTRDCalDet::GetMedian(AliTRDCalDet* outlierDet)
+Double_t AliTRDCalDet::GetMedian(AliTRDCalDet * const outlierDet) const
{
//
// Calculate the median
if (!outlierDet) return (Double_t) TMath::Median(kNdet,fData);
Double_t *ddata = new Double_t[kNdet];
- Int_t NPoints = 0;
+ Int_t nPoints = 0;
for (Int_t i=0;i<kNdet;i++) {
if (!(outlierDet->GetValue(i))) {
- ddata[NPoints]= fData[NPoints];
- NPoints++;
+ ddata[nPoints]= fData[nPoints];
+ nPoints++;
}
}
- Double_t mean = TMath::Median(NPoints,ddata);
+ Double_t mean = TMath::Median(nPoints,ddata);
delete [] ddata;
return mean;
}
//____________________________________________________________________________________________
-Double_t AliTRDCalDet::GetRMS(AliTRDCalDet* outlierDet)
+Double_t AliTRDCalDet::GetRMS(AliTRDCalDet * const outlierDet) const
{
//
// Calculate the RMS
if (!outlierDet) return TMath::RMS(kNdet,fData);
Double_t *ddata = new Double_t[kNdet];
- Int_t NPoints = 0;
+ Int_t nPoints = 0;
for (Int_t i=0;i<kNdet;i++) {
if (!(outlierDet->GetValue(i))) {
- ddata[NPoints]= fData[NPoints];
- NPoints++;
+ ddata[nPoints]= fData[nPoints];
+ nPoints++;
}
}
- Double_t mean = TMath::RMS(NPoints,ddata);
+ Double_t mean = TMath::RMS(nPoints,ddata);
delete [] ddata;
return mean;
}
+//____________________________________________________________________________________________
+Double_t AliTRDCalDet::GetRMSRobust(Double_t robust) const
+{
+ //
+ // Calculate the robust RMS
+ //
+
+ // 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::RMS(nPoints,ddata);
+ delete [] ddata;
+ delete [] index;
+ return mean;
+}
+
//______________________________________________________________________________________________
-Double_t AliTRDCalDet::GetLTM(Double_t *sigma, Double_t fraction, AliTRDCalDet* outlierDet)
+Double_t AliTRDCalDet::GetLTM(Double_t *sigma
+ , Double_t fraction
+ , AliTRDCalDet * const outlierDet)
{
//
// Calculate LTM mean and sigma
Double_t *ddata = new Double_t[kNdet];
Double_t mean=0, lsigma=0;
- UInt_t NPoints = 0;
+ UInt_t nPoints = 0;
for (Int_t i=0;i<kNdet;i++) {
if (!outlierDet || !(outlierDet->GetValue(i))) {
- ddata[NPoints]= fData[NPoints];
- NPoints++;
+ ddata[nPoints]= fData[nPoints];
+ nPoints++;
}
}
- Int_t hh = TMath::Min(TMath::Nint(fraction *NPoints), Int_t(NPoints));
- AliMathBase::EvaluateUni(NPoints,ddata, mean, lsigma, hh);
+ Int_t hh = TMath::Min(TMath::Nint(fraction *nPoints), Int_t(nPoints));
+ AliMathBase::EvaluateUni(nPoints,ddata, mean, lsigma, hh);
if (sigma) *sigma=lsigma;
delete [] ddata;
return mean;
}
}
char name[1000];
- sprintf(name,"%s CalDet 1Distribution",GetTitle());
+ snprintf(name,1000,"%s CalDet 1Distribution",GetTitle());
TH1F * his = new TH1F(name,name,100, min,max);
for (Int_t idet=0; idet<kNdet; idet++){
his->Fill(GetValue(idet));
}
char name[1000];
- sprintf(name,"%s CalDet as function of det",GetTitle());
+ snprintf(name,1000,"%s CalDet as function of det",GetTitle());
TH1F * his = new TH1F(name,name,kNdet, 0, kNdet);
for(Int_t det = 0; det< kNdet; det++){
his->Fill(det+0.5,GetValue(det));
Double_t posglobal[3] = {0.0,0.0,0.0};
char name[1000];
- sprintf(name,"%s CalDet 2D ch %d",GetTitle(),ch);
+ snprintf(name,1000,"%s CalDet 2D ch %d",GetTitle(),ch);
TH2F * his = new TH2F(name, name, 400,-400.0,400.0,400,-400.0,400.0);
// Where we begin
Double_t col0 = padPlane0->GetCol0();
char name[1000];
- sprintf(name,"%s CalDet 2D sm %d and pl %d",GetTitle(),sm,pl);
+ snprintf(name,1000,"%s CalDet 2D sm %d and pl %d",GetTitle(),sm,pl);
TH2F * his = new TH2F( name, name, 5, -TMath::Abs(row0), TMath::Abs(row0)
, 4,-2*TMath::Abs(col0),2*TMath::Abs(col0));
}
}
}
+
+