示例#1
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;
}
示例#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);
   }
}