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
}
}
}
+//_____________________________________________________________________________
+Double_t AliTRDCalDet::CalcMean(Bool_t wghtPads, Int_t &calib)
+{
+ // Calculate the mean value after rejection of the chambers not calibrated
+ // wghPads = kTRUE weighted with the number of pads in case of a AliTRDCalPad created (t0)
+ // calib = number of used chambers for the mean calculation
+
+ Int_t iSM;
+ Double_t sum = 0.0;
+ Int_t ndet = 0;
+ Double_t meanALL = 0.0;
+ Double_t meanWP = 0.0;
+ Double_t pads=0.0;
+ Double_t padsALL=(144*16*24+144*12*6)*18;
+ Double_t *meanSM = new Double_t[18];
+ Double_t *meanSMWP = new Double_t[18];
+
+ for (Int_t i = 0; i < 18; i++) {
+ meanSM[i]=0.0;
+ meanSMWP[i]=0.0;
+ }
+
+ Int_t det = 0;
+ while(det < 540) {
+ Float_t val= fData[det];
+ iSM = (Int_t)(det / (6*5));
+ pads=(((Int_t) (det % (6 * 5)) / 6) == 2) ? 144*12 : 144*16;
+ meanALL+=val/540.;
+ meanSM[iSM]+=val/30.;
+ meanWP+=val*(pads/padsALL);
+ meanSMWP[iSM]+=val*(pads/(padsALL/18.));
+
+ /*
+ printf(" det %d val %.3f meanALL %.5f meanWP %.5f meanSM[%d] %.5f meanSMWP[%d] %.5f \n",
+ det,
+ val,
+ meanALL,
+ meanWP,
+ iSM,
+ meanSM[iSM],
+ iSM,
+ meanSMWP[iSM]);
+ */
+
+ det++;
+ }
+
+ // debug
+
+ // printf(" ALL %.5f \n",meanALL);
+// printf(" WP %.5f \n",meanWP);
+// for(Int_t i=0; i<18; i++) printf(" SM %02d %.5f \n",i,meanSM[i]);
+// for(Int_t i=0; i<18; i++) printf(" SM %02d %.5f \n",i,meanSMWP[i]);
+//
+
+ det=0;
+ while(det < 540) {
+ Float_t val= fData[det];
+ if (( (!wghtPads) &&
+ (TMath::Abs(val - meanALL) > 0.0001) &&
+ (TMath::Abs(val - meanSM[(Int_t)(det / (6*5))]) > 0.0001) ) ||
+ ( (wghtPads) &&
+ (TMath::Abs(val - meanWP) > 0.0001) &&
+ (TMath::Abs(val - meanSMWP[(Int_t)(det / (6*5) )]) > 0.0001) )
+ ) {
+ if(val <= 50.) { // get rid of exb alternative mean values
+ sum+=val;
+ ndet++;
+ }
+ }
+ det++;
+ }
+
+ delete []meanSM;
+ delete []meanSMWP;
+
+ calib=ndet;
+ return (sum!=0.0 ? sum/ndet : -1);
+}
+//_____________________________________________________________________________
+Double_t AliTRDCalDet::CalcMean(Bool_t wghtPads)
+{
+ // Calculate the mean value after rejection of the chambers not calibrated
+ // wghPads = kTRUE weighted with the number of pads in case of a AliTRDCalPad created (t0)
+ // calib = number of used chambers for the mean calculation
+
+ Int_t calib = 0;
+ return CalcMean(wghtPads, calib);
+}
+//_____________________________________________________________________________
+Double_t AliTRDCalDet::CalcRMS(Bool_t wghtPads, Int_t &calib)
+{
+ // Calculate the RMS value after rejection of the chambers not calibrated
+ // wghPads = kTRUE weighted with the number of pads in case of a AliTRDCalPad created (t0)
+ // calib = number of used chambers for the mean calculation
+
+ Int_t iSM;
+ Double_t sum = 0.0;
+ Int_t ndet = 0;
+ Double_t meanALL = 0.0;
+ Double_t meanWP = 0.0;
+ Double_t pads=0.0;
+ Double_t padsALL=(144*16*24+144*12*6)*18;
+ Double_t *meanSM = new Double_t[18];
+ Double_t *meanSMWP = new Double_t[18];
+
+ for (Int_t i = 0; i < 18; i++) {
+ meanSM[i]=0.0;
+ meanSMWP[i]=0.0;
+ }
+
+ Int_t det = 0;
+ while(det < 540) {
+ Float_t val= fData[det];
+ iSM = (Int_t)(det / (6*5));
+ pads=(((Int_t) (det % (6 * 5)) / 6) == 2) ? 144*12 : 144*16;
+ meanALL+=val/540.;
+ meanSM[iSM]+=val/30.;
+ meanWP+=val*(pads/padsALL);
+ meanSMWP[iSM]+=val*(pads/(padsALL/18.));
+ det++;
+ }
+
+ Double_t mean=0.0;
+ if(!wghtPads) mean= meanALL;
+ if(wghtPads) mean= meanWP;
+
+ det=0;
+ while(det < 540) {
+ Float_t val= fData[det];
+ if (( (!wghtPads) &&
+ (TMath::Abs(val - meanALL) > 0.0001) &&
+ (TMath::Abs(val - meanSM[(Int_t)(det / (6*5))]) > 0.0001) ) ||
+ ( (wghtPads) &&
+ (TMath::Abs(val - meanWP) > 0.0001) &&
+ (TMath::Abs(val - meanSMWP[(Int_t)(det / (6*5) )]) > 0.0001) )
+ ) {
+ if(val <= 50.) { // get rid of exb alternative mean values
+ sum+=(val-mean)*(val-mean);
+ ndet++;
+ }
+ }
+ det++;
+ }
+
+ delete []meanSM;
+ delete []meanSMWP;
+
+ calib=ndet;
+ return (sum!=0.0 ? TMath::Sqrt(sum/ndet) : -1);
+}
+//_____________________________________________________________________________
+Double_t AliTRDCalDet::CalcRMS(Bool_t wghtPads)
+{
+ // Calculate the RMS value after rejection of the chambers not calibrated
+ // wghPads = kTRUE weighted with the number of pads in case of a AliTRDCalPad created (t0)
+ // calib = number of used chambers for the mean calculation
+
+ Int_t calib = 0;
+ return CalcRMS(wghtPads, calib);
+}
+//_____________________________________________________________________________
+Double_t AliTRDCalDet::GetMeanSM(Bool_t wghtPads, Int_t sector) const
+{
+ // Calculate the mean value for given sector
+ // wghPads = kTRUE weighted with the number of pads in case of a AliTRDCalPad created (t0)
+
+ Int_t iSM;
+ Double_t meanALL = 0.0;
+ Double_t meanWP = 0.0;
+ Double_t pads=0.0;
+ Double_t padsALL=(144*16*24+144*12*6)*18;
+ Double_t *meanSM = new Double_t[18];
+ Double_t *meanSMWP = new Double_t[18];
+
+ for (Int_t i = 0; i < 18; i++) {
+ meanSM[i]=0.0;
+ meanSMWP[i]=0.0;
+ }
+
+ Int_t det = 0;
+ while(det < 540) {
+ Float_t val= fData[det];
+ iSM = (Int_t)(det / (6*5));
+ pads=(((Int_t) (det % (6 * 5)) / 6) == 2) ? 144*12 : 144*16;
+ meanALL+=val/540.;
+ meanSM[iSM]+=val/30.;
+ meanWP+=val*(pads/padsALL);
+ meanSMWP[iSM]+=val*(pads/(padsALL/18.));
+
+ det++;
+ }
+
+ Double_t mean=0.0;
+ if(!wghtPads) mean= meanSM[sector];
+ if(wghtPads) mean= meanSMWP[sector];
+
+ delete []meanSM;
+ delete []meanSMWP;
+
+ return mean;
+}