KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVDroite.cpp
Go to the documentation of this file.
1 #include "KVDroite.h"
2 
3 using namespace std;
4 
6 
7 
8 
11 {
12  _a0 = 0.;
13  _theta = 0.;
14  _is_initialized = false;
15  _f = 0;
16 }
17 
18 
19 
21 
22 KVDroite::KVDroite(double a0_, double theta_)
23 {
24  _a0 = a0_;
25  _theta = theta_;
26  _is_initialized = false;
27  _f = 0;
28  SetName(Form("y=%lf+x*tan(%lf)", _a0, _theta));
29  Init();
30 }
31 
32 
33 
35 
36 KVDroite::KVDroite(double x0_, double y0_, double theta_)
37 {
38  _a0 = y0_ - x0_ * TMath::Tan(TMath::DegToRad() * theta_);
39  _theta = theta_;
40  _is_initialized = false;
41  _f = 0;
42  SetName(Form("y=%lf+x*tan(%lf)", _a0, _theta));
43  Init();
44 }
45 
46 
47 
49 
51 {
52  return _a0;
53 }
54 
55 
56 
58 
60 {
61  return _theta;
62 }
63 
64 
65 
67 
69 {
70  if (_is_initialized) return _f;
71  cout << "ERROR: KVDroite::GetFunction: I'm not initialized !" << endl;
72  return 0;
73 }
74 
75 
76 
78 
79 void KVDroite::Init(double min_, double max_)
80 {
81  if ((_a0 == 0) && (_theta == 0.)) {
82  cout << "ERROR: KVDroite::Init: you have to define theta and a0 befor initialisation !" << endl;
83  return;
84  }
85  else if (_is_initialized) {
86  cout << "WARNING: KVDroite::Init: already initialized !" << endl;
87  }
88  SetName(Form("y=%lf+x*tan(%lf)", _a0, _theta));
89  _f = new TF1(Form("f_%s", GetName()), Form("%lf+x*%lf", _a0, TMath::Tan(TMath::DegToRad()*_theta)), min_, max_);
90  _is_initialized = true;
91 }
92 
93 
94 
96 
97 void KVDroite::SetA0(double a0)
98 {
99  _a0 = a0;
100 }
101 
102 
103 
105 
106 void KVDroite::SetTheta(double theta)
107 {
108  _theta = theta;
109 }
110 
111 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char * Form(const char *fmt,...)
Apparently, a straight line.
Definition: KVDroite.h:16
KVDroite()
Definition: KVDroite.cpp:10
void SetA0(double a0)
Definition: KVDroite.cpp:97
TF1 * GetFunction()
Definition: KVDroite.cpp:68
double GetTheta()
Definition: KVDroite.cpp:59
void Init(double min_=0., double max_=4096.)
Definition: KVDroite.cpp:79
void SetTheta(double theta)
Definition: KVDroite.cpp:106
double GetA0()
Definition: KVDroite.cpp:50
gr SetName("gr")
void Init()
constexpr Double_t DegToRad()
Double_t Tan(Double_t)