173 return {
a.x -
b.x,
a.y -
b.y};
177 return a.x *
b.x +
a.y *
b.y;
181 return {
a.x *
s,
a.y *
s};
189 return (*
this) * (*this);
197 double scalar =
v * (*this);
203 return (*
this) -
Proj(
v);
234 const Char_t* axis =
"")
const;
269 distance = dist2 = 9999.;
270 Int_t i_nearest_point = 0, inear1 = 0, inear2 = 0;
275 for (i = 0; i <
fNpoints - 1; i++) {
289 inear2 = i + i_nearest_point;
295 if (distance < 9999.)
299 if (inear2 > 0 && inear2 < (
fNpoints - 1))
311 Int_t& i_nearest_point)
336 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
343 Double_t sum = (P1P - MP).Mod() + (P2P - MP).Mod();
347 if (P1P.
Mod() < P2P.
Mod()) {
390 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
391 MyVector2 P1P2 = P2 - P1;
392 MyVector2 P1P = P - P1;
393 MyVector2 MP = P1P.Norm((P1P2));
400 if (!strcmp(opt,
"left")) {
401 result = (phi > 90. && phi < 270.);
403 else if (!strcmp(opt,
"right")) {
404 result = (phi < 90. || phi > 270.);
406 else if (!strcmp(opt,
"above")) {
407 result = (phi > 0. && phi < 180.);
409 else if (!strcmp(opt,
"below")) {
410 result = (phi > 180. && phi < 360.);
430 if (!strcmp(opt,
"left")) {
436 else if (!strcmp(opt,
"right")) {
443 else if (!strcmp(opt,
"above")) {
450 else if (!strcmp(opt,
"below")) {
460 Int_t prev_i_stop = 0;
462 while ((i_start < i_stop - 1) || same_sign) {
464 if (same_sign && (prev_i_stop == 0))
break;
465 else if (same_sign) {
467 i_stop = prev_i_stop;
470 prev_i_stop = i_stop;
471 i_stop = (
Int_t)((i_start + i_stop) / 2 + 0.5);
477 Double_t a = (YY[i_stop] - YY[i_start]) / (XX[i_stop] - XX[i_start]);
480 Bool_t res = (sign * yy < sign * (
a * xx +
b));
490 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
502 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
534 else if (ax ==
"Y") {
538 return (in_range_x && in_range_y);
#define ClassDef(name, id)
A lightweight replacement for the TVector2 class.
MyVector2(const MyVector2 &T)
friend MyVector2 operator*(const MyVector2 &a, double s)
friend MyVector2 operator*(double s, const MyVector2 &a)
friend double operator*(const MyVector2 &a, const MyVector2 &b)
MyVector2 Proj(const MyVector2 &v) const
friend MyVector2 operator-(const MyVector2 &a, const MyVector2 &b)
MyVector2(double X, double Y)
MyVector2 Norm(const MyVector2 &v) const
MyVector2 & operator=(const MyVector2 &T)
Base class for lines/cuts used for particle identification in 2D data maps.
static KVIDLine * MakeIDLine(TObject *obj, Double_t xdeb=-1., Double_t xfin=-1., Double_t np=1., Bool_t save=kFALSE)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Bool_t PosRelToLine(Option_t *opt, Double_t px, Double_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Double_t DistanceToLine(Double_t px, Double_t py, Int_t &)
Bool_t WhereAmI(Double_t px, Double_t py, Option_t *opt)
void GetStartPoint(Double_t &x, Double_t &y) const
Bool_t IsBetweenEndPoints(Double_t x, Double_t y, const Char_t *axis="") const
void GetEndPoint(Double_t &x, Double_t &y) const
virtual void WaitForPrimitive()
Base class for graphical cuts used in particle identification.
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
VecExpr< UnaryOp< Sqrt< T >, SVector< T, D >, T >, T, D > sqrt(const SVector< T, D > &rhs)
Double_t Min(Double_t a, Double_t b)
Double_t Sign(Double_t a, Double_t b)
Double_t ATan2(Double_t y, Double_t x)
Double_t Max(Double_t a, Double_t b)
constexpr Double_t RadToDeg()