KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSpiderLineSiCsI.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Fri Nov 30 09:01:11 2012
2 //Author: dgruyer
3 
4 #include "KVSpiderLineSiCsI.h"
5 #include "TMath.h"
6 
8 
9 
10 
11 
15 {
16  // Default constructor
17 }
18 
19 
20 
22 
24 {
25  Info("KVSpiderLineSiCsI", "called...");
26 }
27 
28 
29 
31 
33 {
34  Info("KVSpiderLineSiCsI", "called...");
35 }
36 
37 
38 
39 //KVSpiderLineSiCsI::KVSpiderLineSiCsI(const KVSpiderLineSiCsI& obj) : KVSpiderLine()
40 //{
41 // // Copy constructor
42 // // This ctor is used to make a copy of an existing object (for example
43 // // when a method returns an object), and it is always a good idea to
44 // // implement it.
45 // // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
46 
47 // obj.Copy(*this);
48 //}
49 
50 
53 
55 {
56  // Destructor
57 }
58 
59 
60 
61 //void KVSpiderLineSiCsI::Copy(TObject& obj) const
62 //{
63 // // This method copies the current state of 'this' object into 'obj'
64 // // You should add here any member variables, for example:
65 // // (supposing a member variable KVSpiderLineSiCsI::fToto)
66 // // CastedObj.fToto = fToto;
67 // // or
68 // // CastedObj.SetToto( GetToto() );
69 
70 // KVSpiderLine::Copy(obj);
71 // //KVSpiderLineSiCsI& CastedObj = (KVSpiderLineSiCsI&)obj;
72 //}
73 
74 
76 
77 TF1* KVSpiderLineSiCsI::GetFunction(double min_, double max_)
78 {
79  if (!CheckStatus()) return 0;
80 
81  double min;
82  double max;
83 
84 // double xtest = GetX();
85 // if (GetX(0) > GetX()) xtest = GetX(0);
86 // double ytest = GetY();
87 // if (GetY(0) > GetY()) ytest = GetY(0);
88 
89  //double p0 = TMath::Power(xtest, 0.4) * ytest;
90 
91  if (min_ == -1.) {
92  if (GetX(0) < GetX()) min = GetX(0) - 10;
93  else min = GetX() - 10;
94  if (min <= 0.) min += 10.;
95  }
96  else min = min_;
97  if (max_ == -1.) {
98  if (GetX(0) < GetX()) max = GetX() + 10.;
99  else max = GetX(0) + 10.;
100  }
101  else max = max_;
102 
103  if (!_ff) {
104 // _ff = new TF1(GetName(), Form("[0]*TMath::Power(x,%lf)/(TMath::Power((x+[1]),[2]))", _pow), min, max);
105 // _ff->SetParameters(p0, 100., 0.4);
106 
107  _ff = new TF1(GetName(), "[0]*(-1+[1]/(TMath::Power(x,[2])+[3]))", min, max);
108  _ff->SetParameters(0.01, 3e5, 1.0, 200);
109  _ff->FixParameter(2, 1.0);
110 
111  _ff->SetParLimits(0, 0.0001, 0.1);
112  _ff->SetParLimits(1, 1e4, 1e11);
113  _ff->SetParLimits(3, 10, 500);
114 
115  }
116  else {
117  double fmin, fmax;
118  _ff->GetRange(fmin, fmax);
119  if ((min <= fmin) || (max >= fmax)) {
120  _ff->SetRange(min, max);
121  }
122  }
123  _ff->FixParameter(2, 1.0);
124 
125  _fitStatus = _line->Fit(_ff, "WQN");
126  _fitStatus = _line->Fit(_ff, "WQN");
127 
128  _ff->ReleaseParameter(2);
129  _ff->SetParLimits(2, 0.5, 1.0);
130 
131  _fitStatus = _line->Fit(_ff, "WQN");
132  _fitStatus = _line->Fit(_ff, "WQN");
133 
134 
135 // printf("\tfit status = %d\n",_fitStatus);
136 // for (Int_t ii=0;ii<_ff->GetNpar();ii+=1)
137 // {
138 // printf("\t%d %lf\n",ii,_ff->GetParameter(ii));
139 // }
140 // if (_fitStatus==0){
141 // for (Int_t ii=0;ii<_ff->GetNpar();ii+=1)
142 // {
143 // printf("%lf ",_ff->GetParameter(ii));
144 // }
145 // printf("\n");
146 // }
147  return _ff;
148 }
149 
150 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
KVSpiderLine specialized for PSA matrix.
virtual TF1 * GetFunction(double min_=-1., double max_=-1.)
void Copy(TObject&) const;
virtual ~KVSpiderLineSiCsI()
KVSpiderLineSiCsI(const KVSpiderLineSiCsI&) ;.
KVSpiderLineSiCsI()
Default constructor.
Part of Spider Identification.
Definition: KVSpiderLine.h:18
Int_t _fitStatus
Definition: KVSpiderLine.h:28
bool CheckStatus() const
double GetX() const
TGraph * _line
Definition: KVSpiderLine.h:21
virtual void ReleaseParameter(Int_t ipar)
virtual void SetRange(Double_t xmin, Double_t xmax)
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
virtual void GetRange(Double_t &xmin, Double_t &xmax) const
virtual void SetParameters(const Double_t *params)
virtual void FixParameter(Int_t ipar, Double_t value)
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
virtual const char * GetName() const
virtual void Info(const char *method, const char *msgfmt,...) const