Changeset 8549
- Timestamp:
- 06/11/07 21:51:55 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mextralgo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.cc
r8546 r8549 124 124 // The defaule for y is 0 125 125 // 126 Double_t MExtralgoSpline::FindY(Int_t i, Double_t y, Double_t min, Double_t max) const126 Double_t MExtralgoSpline::FindY(Int_t i, Bool_t downwards, Double_t y, Double_t min, Double_t max) const 127 127 { 128 128 // y = a*x^3 + b*x^2 + c*x + d' … … 144 144 const Int_t rc = MMath::SolvePol3(a, b, c, d, x1, x2, x3); 145 145 146 Double_t x = -1; 147 if (rc>0 && x1>=min && x1<max && x1>x) 148 x = x1; 149 if (rc>1 && x2>=min && x2<max && x2>x) 150 x = x2; 151 if (rc>2 && x3>=min && x3<max && x3>x) 152 x = x3; 153 154 return x<0 ? -2 : x+i; 146 if (downwards==kTRUE) 147 { 148 Double_t x = -1; 149 150 if (rc>0 && x1>=min && x1<max && x1>x) 151 x = x1; 152 if (rc>1 && x2>=min && x2<max && x2>x) 153 x = x2; 154 if (rc>2 && x3>=min && x3<max && x3>x) 155 x = x3; 156 157 return x<0 ? -2 : x+i; 158 } 159 else 160 { 161 Double_t x = 2; 162 163 if (rc>0 && x1>min && x1<=max && x1<x) 164 x = x1; 165 if (rc>1 && x2>min && x2<=max && x2<x) 166 x = x2; 167 if (rc>2 && x3>min && x3<=max && x3<x) 168 x = x3; 169 170 return x>1 ? -2 : x+i; 171 } 172 173 return -2; 155 174 } 156 175 … … 166 185 167 186 Int_t i = TMath::FloorNint(x); 168 Double_t rc = FindY(i, y, 0, x-i);187 Double_t rc = FindY(i, kTRUE, y, 0, x-i); 169 188 while (--i>=0 && rc<0) 170 rc = FindY(i, y);189 rc = FindY(i, kTRUE, y); 171 190 172 191 return rc; … … 179 198 180 199 Int_t i = TMath::FloorNint(x); 181 Double_t rc = FindY(i, y, x-i, 1.);200 Double_t rc = FindY(i, kFALSE, y, x-i, 1.); 182 201 while (i++<fNum-1 && rc<0) 183 rc = FindY(i, y);202 rc = FindY(i, kFALSE, y); 184 203 185 204 return rc; -
trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h
r8548 r8549 74 74 } 75 75 76 Double_t FindY(Int_t i, Double_t y=0, Double_t min=0, Double_t max=1) const;76 Double_t FindY(Int_t i, Bool_t downwards, Double_t y=0, Double_t min=0, Double_t max=1) const; 77 77 Double_t SearchY(Float_t maxpos, Float_t y) const; 78 78 Double_t SearchYup(Float_t maxpos, Float_t y) const;
Note:
See TracChangeset
for help on using the changeset viewer.