Changeset 12920 for trunk/Mars/mgui
- Timestamp:
- 02/22/12 19:02:50 (13 years ago)
- Location:
- trunk/Mars/mgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mgui/MCamEvent.cc
r8907 r12920 43 43 44 44 #include "MGeomCam.h" 45 #include "MArrayD.h" 45 46 46 47 ClassImp(MCamEvent); … … 60 61 // -------------------------------------------------------------------------- 61 62 // 62 // Return the me an of all corresponding GetPixelContent63 // Return the median of all corresponding GetPixelContent 63 64 // 64 Double_t MCamEvent::GetCameraMe an(const MGeomCam &cam, Int_t type) const65 Double_t MCamEvent::GetCameraMedian(const MGeomCam &cam, Int_t type) const 65 66 { 66 return GetCameraStat(cam, type)[0]; 67 /* 68 Int_t num = 0; 69 Double_t mean = 0; 67 Int_t num = 0; 68 Double_t sum = 0; 69 Double_t sq = 0; 70 71 MArrayD arr(cam.GetNumPixels()); 70 72 for (unsigned int i=0; i<cam.GetNumPixels(); i++) 71 73 { … … 74 76 continue; 75 77 76 mean += val;78 arr[i] = val; 77 79 num ++; 78 80 } 79 return num == 0 ? 0 : mean/num; 80 */ 81 82 return TMath::Median(num, arr.GetArray()); 83 } 84 85 // -------------------------------------------------------------------------- 86 // 87 // Return the mean of all corresponding GetPixelContent 88 // 89 Double_t MCamEvent::GetCameraMean(const MGeomCam &cam, Int_t type) const 90 { 91 return GetCameraStat(cam, type)[0]; 81 92 } 82 93 … … 88 99 { 89 100 return GetCameraStat(cam, type)[1]; 90 /*91 Int_t num = 0;92 Double_t sum = 0;93 Double_t sq = 0;94 95 for (unsigned int i=0; i<cam.GetNumPixels(); i++)96 {97 Double_t val;98 if (!GetPixelContent(val, i, cam, type))99 continue;100 101 sum += val;102 sq += val;103 num ++;104 }105 106 if (num==0)107 return 0;108 109 sum /= num;110 sq /= num;111 112 return TMath::Sqrt(sq-sum*sum);113 */114 101 } 115 102 -
trunk/Mars/mgui/MCamEvent.h
r7780 r12920 20 20 21 21 virtual Double_t GetCameraMean(const MGeomCam &cam, Int_t type=0) const; 22 virtual Double_t GetCameraMedian(const MGeomCam &cam, Int_t type=0) const; 22 23 virtual Double_t GetCameraRMS(const MGeomCam &cam, Int_t type=0) const; 23 24 virtual TArrayD GetCameraStat(const MGeomCam &cam, Int_t type=0) const;
Note:
See TracChangeset
for help on using the changeset viewer.