Ejemplo n.º 1
0
//___________________________________________________________________________________________
Bool_t KVValues::AddFormula(KVString name, KVString expr)
{

   TFormula* fm = new TFormula(name.Data(), expr.Data());
   if (fm->GetExpFormula().IsNull()) {
      Warning("AddFormula", "%s considere comme nulle", expr.Data());
      return kFALSE;
      delete fm;
   }
   kform_add->Add(fm);
   SetValue(name.Data(), kval_tot++);
   kval_add += 1;
   return kTRUE;
}
Ejemplo n.º 2
0
//___________________________________________________________________________________________
void KVValues::ComputeAdditionalValues(Int_t min, Int_t max)
{

   if (min < 0)   min = 0;
   if (max == -1) max = kval_add;

   KVNumberList* nl = 0;
   TFormula* fm = 0;

   for (Int_t ff = min; ff < max; ff += 1) {
      nl = (KVNumberList*)kpar_add->At(ff);
      fm = (TFormula*)kform_add->At(ff);
      nl->Begin();
      while (!nl->End()) {
         Int_t nn = nl->Next();
         fm->SetParameter(nn, values[nn]);
      }
      values[kval_tot - kval_add + ff] = fm->Eval(0);
   }
}
Ejemplo n.º 3
0
void tform(int formula, int iter) {

   TFormula *form;
   switch(formula) {
      case 0: form = new TFormula("form","[0]"); break;
      case 1: form = new TFormula("form","xylandau"); break;
      default: return;
   }
   form->Print();

   Double_t x[2];
   Double_t param[10];
   x[0] = 1.0;
   x[1] = 2.0;
   for(int i=0;i<10;i++) param[i] = (i+2.5)*3;

   for(int n=0; n<iter; ++n) {
      form->EvalPar(x,param);
   }
      
}
Ejemplo n.º 4
0
int execTestString() {
   TFormula *f = new TFormula("f0","\"a+b\"");
   if (f->GetNdim()!=1) return 0;
   Int_t res = f->Eval(0);
   if (res!=0) return 0;   

   f = new TFormula("f1","strstr(\"a+b\",\"a+b\")");
   if (f->GetNdim()!=1) return 0;
   res = f->Eval(0);
   if (res!=1) return 0;

   f = new TFormula("f2","\"af(d+gd\"+2");
   if (f->GetNdim()!=0) return 0;
   res = f->Eval(0);
   if (res!=2) return 0;

   f = new TFormula("f3","strstr(\"a\",\"a+b\")");
   if (f->GetNdim()!=1) return 0;
   res = f->Eval(0);
   if (res!=0) return 0;

   f = new TFormula("f4","(strstr(\"a\",\"a+b\")+8)");
   if (f->GetNdim()!=1) return 0;
   res = f->Eval(0);
   if (res!=8) return 0;

   f = new TFormula("f5","strstr(\"a + b\",\"a + b\")");
   if (f->GetNdim()!=1) return 0;
   res = f->Eval(0);
   if (res!=1) return 0;

   return 1;
}