}
// 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]);
- */
+
+ // 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) {
(TMath::Abs(val - meanWP) > 0.0001) &&
(TMath::Abs(val - meanSMWP[(Int_t)(det / (6*5) )]) > 0.0001) )
) {
- sum+=val;
- ndet++;
+ if(val <= 50.) { // get rid of exb alternative mean values
+ sum+=val;
+ ndet++;
+ }
}
det++;
}
// 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) )
- ) {
- sum+=val;
- ndet++;
- }
- det++;
- }
-
- delete []meanSM;
- delete []meanSMWP;
-
- return (sum!=0.0 ? sum/ndet : -1);
+ Int_t calib = 0;
+ return CalcMean(wghtPads, calib);
}
//_____________________________________________________________________________
Double_t AliTRDCalDet::CalcRMS(Bool_t wghtPads, Int_t &calib)
det++;
}
- Double_t mean;
+ Double_t mean=0.0;
if(!wghtPads) mean= meanALL;
if(wghtPads) mean= meanWP;
(TMath::Abs(val - meanWP) > 0.0001) &&
(TMath::Abs(val - meanSMWP[(Int_t)(det / (6*5) )]) > 0.0001) )
) {
- sum+=(val-mean)*(val-mean);
- ndet++;
+ if(val <= 50.) { // get rid of exb alternative mean values
+ sum+=(val-mean)*(val-mean);
+ ndet++;
+ }
}
det++;
}
// 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 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];
meanSM[iSM]+=val/30.;
meanWP+=val*(pads/padsALL);
meanSMWP[iSM]+=val*(pads/(padsALL/18.));
+
det++;
}
-
- Double_t mean;
- 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) )
- ) {
- sum+=(val-mean)*(val-mean);
- ndet++;
- }
- det++;
- }
-
+
+ Double_t mean=0.0;
+ if(!wghtPads) mean= meanSM[sector];
+ if(wghtPads) mean= meanSMWP[sector];
+
delete []meanSM;
delete []meanSMWP;
-
- return (sum!=0.0 ? TMath::Sqrt(sum/ndet) : -1);
+
+ return mean;
}