Changeset 4920 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 09/10/04 14:06:46 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r4891 r4920 72 72 73 73 } 74 74 75 void MBinning::SetEdges(const TAxis &axe) 75 76 { 76 const TArrayD &arr = * ((TAxis&)axe).GetXbins();77 const TArrayD &arr = *axe.GetXbins(); 77 78 if (arr.GetSize()>0) 78 79 { … … 82 83 83 84 SetEdges(axe.GetNbins(), axe.GetXmin(), axe.GetXmax()); 85 } 86 87 void MBinning::AddEdge(Axis_t up) 88 { 89 const Int_t n = fEdges.GetSize(); 90 91 if (up<=fEdges[n-1]) 92 { 93 *fLog << warn << dbginf << "WARNING - New upper edge not greater than old upper edge... ignored." << endl; 94 return; 95 } 96 97 fEdges.Set(n+1); 98 fEdges[n] = up; 99 100 fType = kIsUserArray; 84 101 } 85 102 … … 111 128 void MBinning::SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up) 112 129 { 113 const Double_t binsize = (up-lo)/nbins;130 const Double_t binsize = nbins<=0 ? 0 : (up-lo)/nbins; 114 131 fEdges.Set(nbins+1); 115 132 for (int i=0; i<=nbins; i++) 116 133 fEdges[i] = binsize*i + lo; 117 134 118 135 fType = kIsLinear; -
trunk/MagicSoft/Mars/mhbase/MBinning.h
r4891 r4920 79 79 Double_t *GetEdges() const { return (Double_t*)fEdges.GetArray(); } 80 80 81 void AddEdge(Axis_t up); 82 81 83 Bool_t IsLinear() const { return fType==kIsLinear; } 82 84 Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; }
Note:
See TracChangeset
for help on using the changeset viewer.