17#include "KVIDentifier.h"
175 return {
a.x -
b.x,
a.y -
b.y};
179 return a.x *
b.x +
a.y *
b.y;
183 return {
a.x * s,
a.y * s};
191 return (*
this) * (*this);
199 double scalar =
v * (*this);
205 return (*
this) -
Proj(
v);
219 virtual ~ KVIDLine();
236 const Char_t* axis =
"")
const;
271 distance = dist2 = 9999.;
272 Int_t i_nearest_point = 0, inear1 = 0, inear2 = 0;
277 for (i = 0; i <
fNpoints - 1; i++) {
291 inear2 = i + i_nearest_point;
297 if (distance < 9999.)
301 if (inear2 > 0 && inear2 < (
fNpoints - 1))
313 Int_t& i_nearest_point)
338 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
345 Double_t sum = (P1P - MP).Mod() + (P2P - MP).Mod();
349 if (P1P.
Mod() < P2P.
Mod()) {
392 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
393 MyVector2 P1P2 = P2 - P1;
394 MyVector2 P1P = P - P1;
395 MyVector2 MP = P1P.Norm((P1P2));
402 if (!strcmp(opt,
"left")) {
403 result = (phi > 90. && phi < 270.);
405 else if (!strcmp(opt,
"right")) {
406 result = (phi < 90. || phi > 270.);
408 else if (!strcmp(opt,
"above")) {
409 result = (phi > 0. && phi < 180.);
411 else if (!strcmp(opt,
"below")) {
412 result = (phi > 180. && phi < 360.);
432 if (!strcmp(opt,
"left")) {
438 else if (!strcmp(opt,
"right")) {
445 else if (!strcmp(opt,
"above")) {
452 else if (!strcmp(opt,
"below")) {
462 Int_t prev_i_stop = 0;
464 while ((i_start < i_stop - 1) || same_sign) {
466 if (same_sign && (prev_i_stop == 0))
break;
467 else if (same_sign) {
469 i_stop = prev_i_stop;
472 prev_i_stop = i_stop;
473 i_stop = (
Int_t)((i_start + i_stop) / 2 + 0.5);
479 Double_t a = (YY[i_stop] - YY[i_start]) / (XX[i_stop] - XX[i_start]);
482 Bool_t res = (sign * yy < sign * (
a * xx +
b));
492#if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
504#if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
536 else if (ax ==
"Y") {
540 return (in_range_x && in_range_y);
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
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
MyVector2 & operator=(const MyVector2 &T)
friend MyVector2 operator-(const MyVector2 &a, const MyVector2 &b)
MyVector2(double X, double Y)
MyVector2 Norm(const MyVector2 &v) const
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
Expr< UnaryOp< Sqrt< T >, Expr< A, T, D, D2, R >, T >, T, D, D2, R > sqrt(const Expr< A, T, D, D2, R > &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()