17 #include "KVIDentifier.h"
160 MyVector2(
double X,
double Y) :
x(
X),
y(Y) {}
161 MyVector2(
const MyVector2&
T)
173 friend MyVector2
operator-(
const MyVector2&
a,
const MyVector2&
b)
175 return {
a.x -
b.x,
a.y -
b.y};
177 friend double operator*(
const MyVector2&
a,
const MyVector2&
b)
179 return a.x *
b.x +
a.y *
b.y;
181 friend MyVector2
operator*(
const MyVector2&
a,
double s)
183 return {
a.x * s,
a.y * s};
185 friend MyVector2
operator*(
double s,
const MyVector2&
a)
191 return (*
this) * (*this);
197 MyVector2 Proj(
const MyVector2&
v)
const
199 double scalar =
v * (*this);
203 MyVector2 Norm(
const MyVector2&
v)
const
205 return (*
this) - Proj(
v);
272 distance = dist2 = 9999.;
273 Int_t i_nearest_point = 0, inear1 = 0, inear2 = 0;
278 for (i = 0; i <
fNpoints - 1; i++) {
292 inear2 = i + i_nearest_point;
298 if (distance < 9999.)
302 if (inear2 > 0 && inear2 < (
fNpoints - 1))
314 Int_t& i_nearest_point)
339 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
340 MyVector2 P1P2 = P2 - P1;
341 MyVector2 P1P = P - P1;
342 MyVector2 P2P = P - P2;
343 MyVector2 MP = P1P.Norm((P1P2));
346 Double_t sum = (P1P - MP).Mod() + (P2P - MP).Mod();
350 if (P1P.Mod() < P2P.Mod()) {
393 MyVector2 P1(xp1, yp1), P2(xp2, yp2), P(px, py);
394 MyVector2 P1P2 = P2 - P1;
395 MyVector2 P1P = P - P1;
396 MyVector2 MP = P1P.Norm((P1P2));
403 if (!strcmp(opt,
"left")) {
404 result = (phi > 90. && phi < 270.);
406 else if (!strcmp(opt,
"right")) {
407 result = (phi < 90. || phi > 270.);
409 else if (!strcmp(opt,
"above")) {
410 result = (phi > 0. && phi < 180.);
412 else if (!strcmp(opt,
"below")) {
413 result = (phi > 180. && phi < 360.);
435 if (!strcmp(opt,
"left")) {
441 else if (!strcmp(opt,
"right")) {
448 else if (!strcmp(opt,
"above")) {
455 else if (!strcmp(opt,
"below")) {
465 Int_t prev_i_stop = 0;
467 while ((i_start < i_stop - 1) || same_sign) {
469 if (same_sign && (prev_i_stop == 0))
break;
470 else if (same_sign) {
472 i_stop = prev_i_stop;
475 prev_i_stop = i_stop;
476 i_stop = (
Int_t)((i_start + i_stop) / 2 + 0.5);
482 Double_t a = (YY[i_stop] - YY[i_start]) / (XX[i_stop] - XX[i_start]);
485 Bool_t res = (sign * yy < sign * (
a * xx +
b));
495 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
507 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,3)
523 TString ax = axis.value_or(
"");
538 else if (ax ==
"Y") {
542 return (in_range_x && in_range_y);
#define ClassDefOverride(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
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)
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) const
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Bool_t IsBetweenEndPoints(Double_t x, Double_t y, std::optional< TString > axis={}) const
void GetStartPoint(Double_t &x, Double_t &y) const
void GetEndPoint(Double_t &x, Double_t &y) const
void WaitForPrimitive() override
Base class for graphical cuts used in particle identification.
TCutG & operator=(const TCutG &)
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Expr< BinaryOpCopyL< MulOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > operator*(const A &lhs, const SMatrix< T, D, D2, R > &rhs)
Expr< UnaryOp< Sqrt< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > sqrt(const SMatrix< T, D, D2, R > &rhs)
Expr< BinaryOpCopyL< MinOp< T >, Constant< A >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > operator-(const A &lhs, const SMatrix< 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()