Changeset 7867 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 08/08/06 17:51:35 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MMath.cc
r7672 r7867 161 161 } 162 162 163 // ------------------------------------------------------------------------ 164 // 165 // Return the median value of the distribution of abs(a[i]-Median) 166 // 167 template <class Size, class Element> 168 Double_t MMath::MedianDevImp(Size n, const Element *a) 169 { 170 // Get median of distribution 171 const Double_t med = TMath::Median(n, a); 172 173 // Allocate space for distribution 174 Double_t *arr = new Double_t[n]; 175 176 // Create the abs(a[i]-med) distribution 177 for (int i=0; i<n; i++) 178 arr[i] = TMath::Abs(a[i]-med); 179 180 // FIXME: GausProb() is a workaround. It should be taken into account in Median! 181 const Double_t rc = TMath::Median(n, arr); 182 183 // delete space 184 delete arr; 185 186 // return result 187 return rc; 188 } 189 190 // ------------------------------------------------------------------------ 191 // 192 // Return the median value of the distribution of abs(a[i]-Median) 193 // 194 Double_t MMath::MedianDev(Long64_t n, const Short_t *a) 195 { 196 return MedianDevImp(n, a); 197 } 198 199 // ------------------------------------------------------------------------ 200 // 201 // Return the median value of the distribution of abs(a[i]-Median) 202 // 203 Double_t MMath::MedianDev(Long64_t n, const Int_t *a) 204 { 205 return MedianDevImp(n, a); 206 } 207 208 // ------------------------------------------------------------------------ 209 // 210 // Return the median value of the distribution of abs(a[i]-Median) 211 // 212 Double_t MMath::MedianDev(Long64_t n, const Float_t *a) 213 { 214 return MedianDevImp(n, a); 215 } 216 217 // ------------------------------------------------------------------------ 218 // 219 // Return the median value of the distribution of abs(a[i]-Median) 220 // 221 Double_t MMath::MedianDev(Long64_t n, const Double_t *a) 222 { 223 return MedianDevImp(n, a); 224 } 225 226 // ------------------------------------------------------------------------ 227 // 228 // Return the median value of the distribution of abs(a[i]-Median) 229 // 230 Double_t MMath::MedianDev(Long64_t n, const Long_t *a) 231 { 232 return MedianDevImp(n, a); 233 } 234 235 // ------------------------------------------------------------------------ 236 // 237 // Return the median value of the distribution of abs(a[i]-Median) 238 // 239 Double_t MMath::MedianDev(Long64_t n, const Long64_t *a) 240 { 241 return MedianDevImp(n, a); 242 } 243 163 244 // -------------------------------------------------------------------------- 164 245 // -
trunk/MagicSoft/Mars/mbase/MMath.h
r7719 r7867 18 18 19 19 Double_t GaussProb(Double_t x, Double_t sigma=1, Double_t mean=0); 20 21 template <class Size, class Element> Double_t MedianDevImp(Size n, const Element *a); 22 Double_t MedianDev(Long64_t n, const Short_t *a); 23 Double_t MedianDev(Long64_t n, const Int_t *a); 24 Double_t MedianDev(Long64_t n, const Float_t *a); 25 Double_t MedianDev(Long64_t n, const Double_t *a); 26 Double_t MedianDev(Long64_t n, const Long_t *a); 27 Double_t MedianDev(Long64_t n, const Long64_t *a); 20 28 21 29 Double_t Significance(Double_t s, Double_t b);
Note:
See TracChangeset
for help on using the changeset viewer.