153 |
|
double gx, gy; |
154 |
|
g->GetPoint(j, gx, gy); |
155 |
|
if ( (x(*it)-gx)*(x(*it)-gx) + (y(*it)-gy)*(y(*it)-gy) < p*p) |
156 |
< |
std::cout << x(*it) << ", " << y(*it) << " :: " << f(*it) << std::endl; |
156 |
> |
std::cout << x(*it) << ", " << y(*it) |
157 |
> |
<< " :: " << f(*it) << std::endl; |
158 |
> |
} |
159 |
> |
} |
160 |
> |
|
161 |
> |
} |
162 |
> |
template<class T> |
163 |
> |
void PlotTools<T>::Print(double(*f)(const T*), |
164 |
> |
double(*x1)(const T*), double(*x2)(const T*), |
165 |
> |
double(*x3)(const T*), double(*x4)(const T*), |
166 |
> |
TGraph*g, double p) |
167 |
> |
{ |
168 |
> |
for (typename std::vector<T*>::const_iterator it=_scan->begin();it!=_scan->end();++it){ |
169 |
> |
for (int j=0; j<g->GetN(); ++j) { |
170 |
> |
double gx, gy; |
171 |
> |
g->GetPoint(j, gx, gy); |
172 |
> |
if ( (x1(*it)-gx)*(x1(*it)-gx) + (x2(*it)-gy)*(x2(*it)-gy) < p*p) |
173 |
> |
std::cout << x1(*it) << ", " << x2(*it) << ", " |
174 |
> |
<< x3(*it) << ", " << x4(*it) |
175 |
> |
<< " :: " << f(*it) << std::endl; |
176 |
|
} |
177 |
|
} |
178 |
|
|
212 |
|
return res; |
213 |
|
} |
214 |
|
|
215 |
+ |
template<class T> |
216 |
+ |
TGraph * PlotTools<T>::ModifyExpSigma(TGraph*g1, TGraph*g2, TGraph*g3) |
217 |
+ |
{ |
218 |
+ |
TGraph * res = new TGraph(0); |
219 |
+ |
for (int i=0; i<g1->GetN(); ++i) { |
220 |
+ |
double x, y; |
221 |
+ |
g1->GetPoint(i,x,y); |
222 |
+ |
double y2 = g2->Eval(x); |
223 |
+ |
double y3 = g3->Eval(x); |
224 |
+ |
res->SetPoint(i,x,y-y2+y3); |
225 |
+ |
} |
226 |
+ |
res->SetLineColor(g1->GetLineColor()); |
227 |
+ |
res->SetLineStyle(g1->GetLineStyle()); |
228 |
+ |
res->SetLineWidth(g1->GetLineWidth()); |
229 |
+ |
res->SetFillColor(g1->GetFillColor()); |
230 |
+ |
res->SetFillStyle(g1->GetFillStyle()); |
231 |
+ |
return res; |
232 |
+ |
} |
233 |
+ |
|
234 |
+ |
double GetX(TGraph* g, double x0, double y0){ |
235 |
+ |
double dn=999999999, up=9999999999, minx, maxx; |
236 |
+ |
for (int i=0; i<g->GetN(); ++i) { |
237 |
+ |
double x, y; |
238 |
+ |
g->GetPoint(i,x,y); |
239 |
+ |
if (y==y0) return x; |
240 |
+ |
if ( y<y0 && (x-x0)*(x-x0)+(y-y0)*(y-y0)<dn ){ |
241 |
+ |
dn=(x-x0)*(x-x0)+(y-y0)*(y-y0); |
242 |
+ |
minx=x; |
243 |
+ |
} |
244 |
+ |
if ( y>y0 && (x-x0)*(x-x0)+(y-y0)*(y-y0)<up ){ |
245 |
+ |
up=(x-x0)*(x-x0)+(y-y0)*(y-y0); |
246 |
+ |
maxx=x; |
247 |
+ |
} |
248 |
+ |
} |
249 |
+ |
return (minx+maxx)/2.; |
250 |
+ |
} |
251 |
+ |
|
252 |
+ |
template<class T> |
253 |
+ |
TGraph * PlotTools<T>::ModifyExpSigmaY(TGraph*g1, TGraph*g2, TGraph*g3) |
254 |
+ |
{ |
255 |
+ |
TGraph * res = new TGraph(0); |
256 |
+ |
for (int i=0; i<g1->GetN(); ++i) { |
257 |
+ |
double x, y; |
258 |
+ |
g1->GetPoint(i,x,y); |
259 |
+ |
double x2,y2,x3,y3; |
260 |
+ |
x2=GetX(g2,x,y); |
261 |
+ |
x3=GetX(g3,x,y); |
262 |
+ |
res->SetPoint(i,x-x2+x3,y); |
263 |
+ |
} |
264 |
+ |
res->SetLineColor(g1->GetLineColor()); |
265 |
+ |
res->SetLineStyle(g1->GetLineStyle()); |
266 |
+ |
res->SetLineWidth(g1->GetLineWidth()); |
267 |
+ |
res->SetFillColor(g1->GetFillColor()); |
268 |
+ |
res->SetFillStyle(g1->GetFillStyle()); |
269 |
+ |
return res; |
270 |
+ |
} |
271 |
+ |
|
272 |
|
|
273 |
|
template<class T> |
274 |
|
bool PlotTools<T>::sort_TGraph::operator()(const TGraph*g1, const TGraph*g2) |
392 |
|
int p=0; |
393 |
|
TGraph * f = new TGraph(0); |
394 |
|
for (int j=i+1;j!=i;++j){ |
395 |
< |
if (j==g->GetN()) j=0; |
395 |
> |
// for (int j=i+1;p<=g->GetN();++j){ |
396 |
> |
if (j>=g->GetN()) j=0; |
397 |
|
g->GetPoint(j,x,y); |
398 |
|
if (y<110+(x-120)*390/442||(x<330&&y<1000)||(x<500&&y<600)) continue; |
399 |
|
f->SetPoint(p++,x,y); |