5 #include "KVNumberList.h"
20 void KVValues::init_val_base()
33 while (!lname.
End()) {
40 for (
Int_t mm = 0;
mm <= kordre_mom_max;
mm += 1) {
41 smoment.
Form(
"SUM%d", mm);
46 values =
new Double_t[knbre_val_max];
57 void KVValues::init_val_add()
66 kToBeRecalculated =
kTRUE;
75 void KVValues::init_val()
81 for (
Int_t nn = kdeb; nn < kval_tot; nn += 1)
84 kTimesFillVarIsCalled = 0;
105 knbre_val_max = nbre_max;
106 kordre_mom_max = ordre_max;
121 kToBeRecalculated =
kTRUE;
135 kval_tot = kval_base = kdeb = 0;
154 kval_tot = kval_base;
166 printf(
"KVValues::Print_NVL\n%s : %d values computed\n",
GetName(), kval_tot);
167 for (
Int_t nn = 0; nn < kval_tot; nn += 1) {
185 void KVValues::ComputeAdditionalValues(
Int_t min,
Int_t max)
188 if (min < 0)
min = 0;
189 if (max == -1)
max = kval_add;
194 for (
Int_t ff = min; ff <
max; ff += 1) {
200 fm->SetParameter(nn, values[nn]);
202 values[kval_tot - kval_add + ff] =
fm->Eval(0);
215 KVError::Warning(
this,
"DefineAdditionalValue()",
"le nom de variable %s est deja utilise",
name.Data());
227 if (AddFormula(
name, expr2)) {
229 ComputeAdditionalValues(kval_add - 1, kval_add);
234 KVError::Error(
this,
"DefineAdditionalValue()",
"La traduction de l'expression %s a echouee", expr.
Data());
246 if (fm->GetExpFormula().IsNull()) {
271 const char* expression =
clone.Data();
273 Int_t nouvert = 0, nferme = 0;
274 Int_t posouvert = 0, posferme = 0;
278 for (
Int_t ii = 0; ii <= nsize; ii += 1) {
279 if (expression[ii] == O[0]) {
283 else if (expression[ii] == F[0]) {
288 Int_t idx = st.Atoi();
289 if (0 <= idx && idx < kval_tot) {
308 s1.Form(
"[%s]", st.Data());
310 s2.
Form(
"[%d]", idx);
317 if (nouvert != nferme || nvar != nouvert) {
318 KVError::Error(
this,
"TransformExpr()",
"nombre [ : %d - nombre de ] : %d - nombre de variables %d", nouvert, nferme, nvar);
344 if (val < values[0]) values[0] = val;
345 if (val > values[1]) values[1] = val;
348 kToBeRecalculated =
kTRUE;
349 kTimesFillVarIsCalled += 1;
359 return kordre_mom_max;
369 return kTimesFillVarIsCalled;
390 const_cast<KVValues*
>(
this)->ComputeAdditionalValues();
434 Int_t new_idx = idx - kval_base;
436 KVError::Warning(
this,
"GetValueExpression(int)",
"Cette methode n'est implementee que pour les valeurs additionelles idx > %d", kval_base);
439 return ((
TFormula*)kform_add->
At(new_idx))->GetExpFormula();
448 if (opt ==
"base")
return kval_base;
449 else if (opt ==
"add")
return kval_add;
TObject * clone(const char *newname) const override
Extended TList class which owns its objects by default.
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
const Char_t * GetNameAt(Int_t idx) const
Int_t GetNpar() const
return the number of stored parameters
Bool_t HasParameter(const Char_t *name) const
Strings used to represent a set of ranges of values.
const Char_t * GetList() const
void Add(Int_t)
Add value 'n' to the list.
void Add(TObject *obj) override
TObject * At(Int_t idx) const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Handle Operation on variable.
Int_t GetNValues(KVString opt="base") const
Bool_t Add(KVValues *val)
void FillVar(Double_t val)
void DefineAdditionalValue(KVString name, KVString expr)
Double_t GetValue(Int_t idx) const
KVValues()
default constructor
Int_t GetValuePosition(const Char_t *name) const
TString GetValueExpression(const Char_t *name) const
void Print(Option_t *option="") const override
Info("Print","%s : %d values computed",GetName(),kval_tot);.
void Clear(Option_t *option="") override
Int_t GetNumberOfFilling() const
virtual ~KVValues()
destructeur
Int_t GetOrdreMax() const
const char * GetName() const override
virtual void SetName(const char *name)
const char * Data() const
void Form(const char *fmt,...)
TString & ReplaceAll(const char *s1, const char *s2)
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)
double min(double x, double y)
double max(double x, double y)
Double_t Power(Double_t x, Double_t y)