Changeset 7899 for trunk/MagicSoft
- Timestamp:
- 08/21/06 17:53:30 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MMath.cc
r7870 r7899 163 163 // ------------------------------------------------------------------------ 164 164 // 165 // Return the median value of the distribution of abs(a[i]-Median) 165 // Return the "median" (at 68.3%) value of the distribution of 166 // abs(a[i]-Median) 166 167 // 167 168 template <class Size, class Element> 168 Double_t MMath::MedianDevImp(Size n, const Element *a) 169 { 169 Double_t MMath::MedianDevImp(Size n, const Element *a, Double_t &med) 170 { 171 static const Double_t prob = 0.682689477208650697; //MMath::.GaissProb(1.0); 172 170 173 // Sanity check 171 174 if (n <= 0 || !a) … … 173 176 174 177 // Get median of distribution 175 const Double_tmed = TMath::Median(n, a);178 med = TMath::Median(n, a); 176 179 177 180 // Create the abs(a[i]-med) distribution … … 188 191 189 192 // Define where to divide 190 const Int_t div = TMath::Nint(n* MMath::GaussProb(1.0));193 const Int_t div = TMath::Nint(n*prob); 191 194 192 195 // Calculate result … … 203 206 // ------------------------------------------------------------------------ 204 207 // 205 // Return the median value of the distribution of abs(a[i]-Median) 206 // 207 Double_t MMath::MedianDev(Long64_t n, const Short_t *a) 208 { 209 return MedianDevImp(n, a); 210 } 211 212 // ------------------------------------------------------------------------ 213 // 214 // Return the median value of the distribution of abs(a[i]-Median) 215 // 216 Double_t MMath::MedianDev(Long64_t n, const Int_t *a) 217 { 218 return MedianDevImp(n, a); 219 } 220 221 // ------------------------------------------------------------------------ 222 // 223 // Return the median value of the distribution of abs(a[i]-Median) 224 // 225 Double_t MMath::MedianDev(Long64_t n, const Float_t *a) 226 { 227 return MedianDevImp(n, a); 228 } 229 230 // ------------------------------------------------------------------------ 231 // 232 // Return the median value of the distribution of abs(a[i]-Median) 233 // 234 Double_t MMath::MedianDev(Long64_t n, const Double_t *a) 235 { 236 return MedianDevImp(n, a); 237 } 238 239 // ------------------------------------------------------------------------ 240 // 241 // Return the median value of the distribution of abs(a[i]-Median) 242 // 243 Double_t MMath::MedianDev(Long64_t n, const Long_t *a) 244 { 245 return MedianDevImp(n, a); 246 } 247 248 // ------------------------------------------------------------------------ 249 // 250 // Return the median value of the distribution of abs(a[i]-Median) 251 // 252 Double_t MMath::MedianDev(Long64_t n, const Long64_t *a) 253 { 254 return MedianDevImp(n, a); 255 } 208 // Return the "median" (at 68.3%) value of the distribution of 209 // abs(a[i]-Median) 210 // 211 Double_t MMath::MedianDev(Long64_t n, const Short_t *a, Double_t &med) 212 { 213 return MedianDevImp(n, a, med); 214 } 215 216 // ------------------------------------------------------------------------ 217 // 218 // Return the "median" (at 68.3%) value of the distribution of 219 // abs(a[i]-Median) 220 // 221 Double_t MMath::MedianDev(Long64_t n, const Int_t *a, Double_t &med) 222 { 223 return MedianDevImp(n, a, med); 224 } 225 226 // ------------------------------------------------------------------------ 227 // 228 // Return the "median" (at 68.3%) value of the distribution of 229 // abs(a[i]-Median) 230 // 231 Double_t MMath::MedianDev(Long64_t n, const Float_t *a, Double_t &med) 232 { 233 return MedianDevImp(n, a, med); 234 } 235 236 // ------------------------------------------------------------------------ 237 // 238 // Return the "median" (at 68.3%) value of the distribution of 239 // abs(a[i]-Median) 240 // 241 Double_t MMath::MedianDev(Long64_t n, const Double_t *a, Double_t &med) 242 { 243 return MedianDevImp(n, a, med); 244 } 245 246 // ------------------------------------------------------------------------ 247 // 248 // Return the "median" (at 68.3%) value of the distribution of 249 // abs(a[i]-Median) 250 // 251 Double_t MMath::MedianDev(Long64_t n, const Long_t *a, Double_t &med) 252 { 253 return MedianDevImp(n, a, med); 254 } 255 256 // ------------------------------------------------------------------------ 257 // 258 // Return the "median" (at 68.3%) value of the distribution of 259 // abs(a[i]-Median) 260 // 261 Double_t MMath::MedianDev(Long64_t n, const Long64_t *a, Double_t &med) 262 { 263 return MedianDevImp(n, a, med); 264 } 265 266 Double_t MMath::MedianDev(Long64_t n, const Short_t *a) { Double_t med; return MedianDevImp(n, a, med); } 267 Double_t MMath::MedianDev(Long64_t n, const Int_t *a) { Double_t med; return MedianDevImp(n, a, med); } 268 Double_t MMath::MedianDev(Long64_t n, const Float_t *a) { Double_t med; return MedianDevImp(n, a, med); } 269 Double_t MMath::MedianDev(Long64_t n, const Double_t *a) { Double_t med; return MedianDevImp(n, a, med); } 270 Double_t MMath::MedianDev(Long64_t n, const Long_t *a) { Double_t med; return MedianDevImp(n, a, med); } 271 Double_t MMath::MedianDev(Long64_t n, const Long64_t *a) { Double_t med; return MedianDevImp(n, a, med); } 256 272 257 273 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mbase/MMath.h
r7867 r7899 19 19 Double_t GaussProb(Double_t x, Double_t sigma=1, Double_t mean=0); 20 20 21 template <class Size, class Element> Double_t MedianDevImp(Size n, const Element *a); 21 template <class Size, class Element> Double_t MedianDevImp(Size n, const Element *a) { Double_t med; return MedianDevImp(n, a, med); } 22 template <class Size, class Element> Double_t MedianDevImp(Size n, const Element *a, Double_t &med); 23 Double_t MedianDev(Long64_t n, const Short_t *a, Double_t &med); 24 Double_t MedianDev(Long64_t n, const Int_t *a, Double_t &med); 25 Double_t MedianDev(Long64_t n, const Float_t *a, Double_t &med); 26 Double_t MedianDev(Long64_t n, const Double_t *a, Double_t &med); 27 Double_t MedianDev(Long64_t n, const Long_t *a, Double_t &med); 28 Double_t MedianDev(Long64_t n, const Long64_t *a, Double_t &med); 22 29 Double_t MedianDev(Long64_t n, const Short_t *a); 23 30 Double_t MedianDev(Long64_t n, const Int_t *a); -
trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc
r7692 r7899 350 350 { 351 351 TH2D *hyx=0; 352 if (!(hyx=(TH2D*)gPad->FindObject(MString::Form ("%s_%s", h.GetName(), how))))352 if (!(hyx=(TH2D*)gPad->FindObject(MString::Format("%s_%s", h.GetName(), how)))) 353 353 return; 354 354 355 TH2D *h2 = (TH2D*)h.Project3D(MString::Form ("dum_%s", how));355 TH2D *h2 = (TH2D*)h.Project3D(MString::Format("dum_%s", how)); 356 356 hyx->Reset(); 357 357 hyx->Add(h2); … … 359 359 360 360 TH1D *hx = 0; 361 if ((hx=(TH1D*)gPad->FindObject( Form("Prof%s", h.GetName()))))361 if ((hx=(TH1D*)gPad->FindObject(MString::Format("Prof%s", h.GetName())))) 362 362 { 363 363 hx = hyx->ProfileX(Form("Prof%s", h.GetName()), -1, 9999, "s");
Note:
See TracChangeset
for help on using the changeset viewer.