FEDRA emulsion software from the OPERA Collaboration
EdbMath.h
Go to the documentation of this file.
1 #ifndef ROOT_EdbMath
2 #define ROOT_EdbMath
3 
5 // //
6 // EdbMath //
7 // //
8 // Collection of matematical algorithns //
9 // //
11 #include "TObject.h"
12 #include "TArrayI.h"
13 #include "TArrayD.h"
14 #include "TH2D.h"
15 
16 //______________________________________________________________________________
17 class EdbMath {
18 
19  public:
20  EdbMath(){}
21  virtual ~EdbMath(){}
22 
23  static double Magnitude3( float Point1[3], float Point2[3] );
24  static double DistancePointLine3( float Point[3],
25  float LineStart[3], float LineEnd[3],
26  bool inside );
27 
28  static double Angle3( float tx1, float ty1, float tx2, float ty2);
29 
30  static bool LineLineIntersect( float p1[3], float p2[3], float p3[3], float p4[3],
31  float pa[3], float pb[3],
32  double &mua, double &mub );
33 
34  static bool LinFitDiag( int n, float *x, float *y, float *e,
35  float p[2], float d[2][2], float *chi2);
36  static bool LinFitCOV( int n, float *x, float *y, double *c,
37  float *p, float *d, float *chi2);
38  static void LFITW( float *X, float *Y, float *W, int L, int KEY, float &A, float &B, float &E );
39 
40  static int LFIT3( float *X, float *Y, float *Z, float *W, int L,
41  float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY );
42 
43  static int ArrStat( int n, float *x, float par[4] );
44 
45  ClassDef(EdbMath,2) // general matematical algorithms
46 };
47 
48 //______________________________________________________________________________
49 class TIndex2 : public TArrayD {
50  private:
51 
52  public:
53  TIndex2() : TArrayD() {}
54  TIndex2(int size) : TArrayD(size) {}
55  virtual ~TIndex2(){}
56 
57  static Double_t BuildValue( Int_t major, Int_t minor ) {return major+minor*1e-9;}
58  void SetMinor(int i, Int_t minor) { (*this)[i] = BuildValue( Major(i), minor ); }
59 
60  Int_t Major(int i) { return (Int_t)((*this)[i]); }
61  Int_t Minor(int i) { return (Int_t)(((*this)[i]- (Double_t)Major(i)+1e-10)*1e+9 ); }
62  void BuildIndex( int n, double *w );
63  Int_t Find(Int_t major, Int_t minor);
64  Int_t FindIndex(Int_t major);
65  Int_t FindIndexArr(Int_t major, TArrayI &mina );
66  void Print();
67 
68  ClassDef(TIndex2,1) // simple index class for fast search in linear cases
69 };
70 
71 //______________________________________________________________________________
72 class EdbFilter2D {
73 
74  private:
75  Int_t eKX,eKY;
76  Double_t *eKernel;
77 
78  public:
80  virtual ~EdbFilter2D(){}
81 
82  void SetKernel(int k);
83  void Smooth0(TH2D &h);
84  void Smooth(TH2D &h);
85  void Print();
86 
87  ClassDef(EdbFilter2D,1) // 2D histogram filtering (i.e. smoothing)
88 };
89 
90 #endif /* ROOT_EdbMath */
void d()
Definition: RecDispEX.C:381
Definition: EdbMath.h:72
Int_t eKX
Definition: EdbMath.h:75
EdbFilter2D()
Definition: EdbMath.h:79
void Print()
Definition: EdbMath.cxx:471
Int_t eKY
Definition: EdbMath.h:75
virtual ~EdbFilter2D()
Definition: EdbMath.h:80
void SetKernel(int k)
Definition: EdbMath.cxx:429
void Smooth0(TH2D &h)
Definition: EdbMath.cxx:527
Double_t * eKernel
Definition: EdbMath.h:76
void Smooth(TH2D &h)
Definition: EdbMath.cxx:482
Definition: EdbMath.h:17
static double Magnitude3(float Point1[3], float Point2[3])
Definition: EdbMath.cxx:52
static bool LinFitCOV(int n, float *x, float *y, double *c, float *p, float *d, float *chi2)
Definition: EdbMath.cxx:193
static int LFIT3(float *X, float *Y, float *Z, float *W, int L, float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY)
Definition: EdbMath.cxx:313
virtual ~EdbMath()
Definition: EdbMath.h:21
static void LFITW(float *X, float *Y, float *W, int L, int KEY, float &A, float &B, float &E)
Definition: EdbMath.cxx:262
static bool LinFitDiag(int n, float *x, float *y, float *e, float p[2], float d[2][2], float *chi2)
Definition: EdbMath.cxx:147
static double Angle3(float tx1, float ty1, float tx2, float ty2)
Definition: EdbMath.cxx:42
static int ArrStat(int n, float *x, float par[4])
Definition: EdbMath.cxx:23
EdbMath()
Definition: EdbMath.h:20
static double DistancePointLine3(float Point[3], float LineStart[3], float LineEnd[3], bool inside)
Definition: EdbMath.cxx:61
static bool LineLineIntersect(float p1[3], float p2[3], float p3[3], float p4[3], float pa[3], float pb[3], double &mua, double &mub)
Definition: EdbMath.cxx:88
Definition: EdbMath.h:49
Int_t FindIndexArr(Int_t major, TArrayI &mina)
Definition: EdbMath.cxx:397
static Double_t BuildValue(Int_t major, Int_t minor)
Definition: EdbMath.h:57
void Print()
Definition: EdbMath.cxx:422
virtual ~TIndex2()
Definition: EdbMath.h:55
void SetMinor(int i, Int_t minor)
Definition: EdbMath.h:58
Int_t FindIndex(Int_t major)
Definition: EdbMath.cxx:381
TIndex2(int size)
Definition: EdbMath.h:54
Int_t Find(Int_t major, Int_t minor)
Definition: EdbMath.cxx:370
void BuildIndex(int n, double *w)
Definition: EdbMath.cxx:359
Int_t Minor(int i)
Definition: EdbMath.h:61
TIndex2()
Definition: EdbMath.h:53
Int_t Major(int i)
Definition: EdbMath.h:60
struct @8 Z
float X0
Definition: emthickness.cpp:69
struct @6 B
float Y0
Definition: emthickness.cpp:70
float Z0
Definition: hwinit.C:67
Double_t X
Definition: tlg2pattern.C:77
Double_t Y
Definition: tlg2pattern.C:77
Double_t TY
Definition: tlg2pattern.C:79
Double_t TX
Definition: tlg2pattern.C:79
p
Definition: testBGReduction_AllMethods.C:8
Float_t chi2
Definition: testBGReduction_By_ANN.C:14
Int_t W
Definition: testBGReduction_By_ANN.C:15
void w(int rid=2, int nviews=2)
Definition: test.C:27