119 std::istringstream iss(str);
121 return iss >> std::noskipws >> number && iss.eof();
144 fDidBooleanOptimization(false), fDimensionSetup(nullptr)
175 :
ROOT::v5::
TFormula(), fTree(tree), fQuickLoad(false), fNeedLoading(true),
176 fDidBooleanOptimization(false), fDimensionSetup(nullptr)
185 const std::vector<std::string>& aliases)
186 :
ROOT::v5::
TFormula(), fTree(tree), fQuickLoad(false), fNeedLoading(true),
187 fDidBooleanOptimization(false), fDimensionSetup(nullptr), fAliasesUsed(aliases)
227 if(savedir) savedir->
cd();
232 Warning(
"TTreeFormula",
"Too many items in expression:%s",expression);
242 if (!leafc)
continue;
285 for(k0 = 0; k0 <
fNcodes; k0++) {
290 Error(
"TTreeFormula",
291 "Index %d for dimension #%d in %s is too high (max is %d)",
294 if(savedir) savedir->
cd();
323 if (readentry >= 0) {
328 if (readentry >= 0) {
335 if(savedir) savedir->
cd();
357 for (
int j=0; j<
fNcodes; j++) {
385 bool scalarindex =
false;
391 switch (index_multiplicity) {
422 const char * current;
431 if (current[0] !=
'[') current--;
434 scanindex = sscanf(current,
"%d",&
size);
438 if (scanindex==0)
size = -1;
447 current = (
char*)strstr( current,
"[" );
461 return (
size==-1) ? 1 : 0;
469 bool useCollectionObject) {
502 if (maininfo==0 || maininfo==leafinfo || 1) {
508 delete currentinfo->
fNext;
533 }
else if (
c &&
c->GetReferenceProxy() &&
c->GetReferenceProxy()->HasCounter() ) {
564 }
while (current<ndim);
601 Int_t numberOfVarDim = 0;
609 const char *tname = sname.
Data();
610 char *leaf_dim = (
char*)strstr( tname,
"[" );
613 char *branch_dim = (
char*)strstr(bname,
"[");
614 if (branch_dim) branch_dim++;
616 bool isString =
false;
626 if (!branch_dim || strncmp(branch_dim,leaf_dim,strlen(branch_dim))) {
629 }
else if (branch_dim && strncmp(branch_dim,leaf_dim,strlen(branch_dim))==0
630 && strlen(leaf_dim)>strlen(branch_dim)
631 && (leaf_dim+strlen(branch_dim))[0]==
'[') {
650 "Noticed an incorrect in-memory TBranchElement object (%s).\nIt has a BranchCount2 but no BranchCount!\nThe result might be incorrect!",
652 return numberOfVarDim;
658 "Already in kDataMember mode when handling multiple variable dimensions");
666 return numberOfVarDim;
679 static const char *altfunc =
"Alt$(";
680 static const char *minfunc =
"MinIf$(";
681 static const char *maxfunc =
"MaxIf$(";
685 if ( strncmp(expression,altfunc,strlen(altfunc))==0
686 && expression[strlen(expression)-1]==
')' ) {
688 start = strlen(altfunc);
690 if ( strncmp(expression,maxfunc,strlen(maxfunc))==0
691 && expression[strlen(expression)-1]==
')' ) {
693 start = strlen(maxfunc);
695 if ( strncmp(expression,minfunc,strlen(minfunc))==0
696 && expression[strlen(expression)-1]==
')' ) {
698 start = strlen(minfunc);
708 for(
unsigned int i=start;i<strlen(expression);++i) {
709 switch (expression[i]) {
710 case '(': paran++;
break;
711 case ')': paran--;
break;
712 case '"': instr = instr ? 0 : 1;
break;
713 case '[': brack++;
break;
714 case ']': brack--;
break;
716 if (expression[i]==
',' && paran==0 && instr==0 && brack==0) {
717 part1 = full( start, i-start );
718 part2 = full( i+1, full.Length() -1 - (i+1) );
730 Error(
"DefineAlternate",
"The 2nd arguments in %s can not be an array (%s,%d)!",
739 Error(
"DefineAlternate",
740 "The 2nd arguments in %s has to return the same type as the 1st argument (string)!",
746 Error(
"DefineAlternate",
747 "The 2nd arguments in %s has to return the same type as the 1st argument (numerical type)!",
756 Error(
"DefineAlternate",
757 "The arguments of %s can not be strings!",
788 Int_t numberOfVarDim = 0;
791 char scratch[
kMaxLen]; scratch[0] =
'\0';
792 char work[
kMaxLen]; work[0] =
'\0';
794 const char *right = subExpression;
799 if (readentry < 0) readentry=0;
801 bool useLeafReferenceObject =
false;
811 if ( br->
GetInfo() == nullptr ) {
812 Error(
"ParseWithLeaf",
"Missing StreamerInfo for %s. We will be unable to read!",
824 Error(
"ParseWithLeaf",
"Missing StreamerInfo for %s."
825 " We will be unable to read!",
830 Error(
"ParseWithLeaf",
"Address not set when the type of the branch is negative for for %s. We will be unable to read!", mom->
GetName());
843 const char* alias =
nullptr;
846 if (!alias && realtree!=
fTree) {
851 Int_t leafname_len = 0;
853 leafname_len = strlen(alias) + strlen(leaf->
GetName()) + 1;
857 leafname_len = strlen(leaf->
GetName());
860 if (leafname_len >
kMaxLen - 1) {
861 Error(
"TTreeFormula",
862 "Length of leafname (%d) exceeds maximum allowed by the buffer (%d), formula will be truncated.",
868 TTree *tleaf = realtree;
875 if (mother_name[strlen(mother_name)-1]!=
'.') {
876 br_extended_name = mother_name;
877 br_extended_name.
Append(
'.');
882 if (dim >= 0) br_extended_name.
Remove(dim);
902 bool unwindCollection =
false;
970 "Missing TStreamerElement in object in TClonesArray section");
981 maininfo = clonesinfo;
1000 maininfo->
fNext = previnfo;
1001 unwindCollection =
true;
1003 }
else if (branchEl->
GetType()==41) {
1008 Warning(
"ParseWithLeaf",
"Missing TStreamerElement in object in Collection section");
1014 if ( count->
GetID() >= 0 ) {
1033 maininfo = collectioninfo;
1052 maininfo->
fNext = previnfo;
1053 unwindCollection =
true;
1055 }
else if ( branchEl->
GetType()==3) {
1057 if (useLeafCollectionObject) {
1062 numberOfVarDim +=
RegisterDimensions(code,clonesinfo,maininfo,useLeafCollectionObject);
1065 maininfo = clonesinfo;
1066 previnfo = maininfo;
1068 }
else if (!useLeafCollectionObject && branchEl->
GetType()==4) {
1071 if (useLeafCollectionObject) {
1076 numberOfVarDim +=
RegisterDimensions(code,collectioninfo,maininfo,useLeafCollectionObject);
1079 maininfo = collectioninfo;
1080 previnfo = maininfo;
1084 if (useLeafCollectionObject) {
1087 maininfo = collectioninfo;
1088 previnfo = collectioninfo;
1095 maininfo = collectioninfo;
1096 previnfo = collectioninfo;
1106 previnfo->
fNext = multi;
1109 previnfo = multi->
fNext;
1117 previnfo = previnfo->
fNext;
1123 }
else if (strlen(right)==0 && cl && element &&
final) {
1126 if (!useLeafCollectionObject
1137 maininfo = collectioninfo;
1138 previnfo = collectioninfo;
1147 previnfo->
fNext = multi;
1150 previnfo = multi->
fNext;
1157 previnfo = previnfo->
fNext;
1160 }
else if (!useLeafCollectionObject
1176 collectioninfo->
fNext =
1179 maininfo = collectioninfo;
1180 previnfo = maininfo->
fNext;
1182 }
else if (!useLeafCollectionObject
1193 previnfo = maininfo;
1198 if ( useLeafCollectionObject || fullExpression[0] ==
'@' || fullExpression[strlen(scratch)] ==
'@' ) {
1199 useLeafReferenceObject =
true;
1210 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1220 Error(
"ParseWithLeaf",
"Failed to access class type of reference target (%s)",element->
GetName());
1227 if (subExpression && subExpression[0]) {
1228 Error(
"ParseWithLeaf",
"Found a numerical leaf but the name has trailing characters: \"%s\"", subExpression);
1237 if (unwindCollection) {
1240 R__ASSERT(numberOfVarDim==1 && maininfo);
1247 previnfo->
fNext = multi;
1250 previnfo = multi->
fNext;
1257 previnfo = previnfo->
fNext;
1265 previnfo->
fNext = multi;
1268 previnfo = multi->
fNext;
1277 Int_t nchname = strlen(right);
1292 Error(
"ParseWithLeaf",
"%s does not inherit from %s. Casting not possible!",
1298 if (maininfo==
nullptr) {
1299 maininfo = leafinfo;
1301 if (previnfo==
nullptr) {
1302 previnfo = leafinfo;
1304 previnfo->
fNext = leafinfo;
1305 previnfo = leafinfo;
1310 castqueue.
AddAt(
nullptr,paran_level);
1314 bool prevUseCollectionObject = useLeafCollectionObject;
1315 bool useCollectionObject = useLeafCollectionObject;
1316 bool useReferenceObject = useLeafReferenceObject;
1317 bool prevUseReferenceObject = useLeafReferenceObject;
1318 for (i=0, current = &(work[0]); i<=nchname;i++ ) {
1320 if (right[i] ==
'(') {
1323 *current++ = right[i++];
1324 }
while(right[i]!=
')' && right[i]);
1325 *current++ = right[i];
1327 char *params = strchr(work,
'(');
1329 *params = 0; params++;
1330 }
else params = (
char *)
")";
1332 Error(
"ParseWithLeaf",
"Can not call '%s' with a class",work);
1336 Error(
"ParseWithLeaf",
"Class probably unavailable:%s",cl->
GetName());
1347 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", lres);
1367 previnfo = clonesinfo;
1368 maininfo = clonesinfo;
1382 if (previnfo==
nullptr) {
1400 previnfo = collectioninfo;
1401 maininfo = collectioninfo;
1406 if (inside_cl) cl = inside_cl;
1408 Warning(
"ParseWithLeaf",
"Can not call method on content of %s in %s\n",
1415 Error(
"ParseWithLeaf",
1416 "Could not discover the TClass corresponding to (%s)!",
1420 method =
new TMethodCall(cl,
"GetEntriesFast",
"");
1422 if (maininfo==
nullptr) {
1424 if (useLeafCollectionObject) {
1430 maininfo=previnfo=collectioninfo;
1436 Error(
"ParseWithLeaf",
1437 "Can not call method %s on class without dictionary (%s)!",
1445 Error(
"ParseWithLeaf",
"Unknown method:%s in %s",right,cl->
GetName());
1470 Error(
"DefineVariable",
"Method %s from %s has an impossible return type %d",
1475 if (maininfo==
nullptr) {
1476 maininfo = leafinfo;
1478 if (previnfo==
nullptr) {
1479 previnfo = leafinfo;
1481 previnfo->
fNext = leafinfo;
1482 previnfo = leafinfo;
1485 current = &(work[0]);
1487 prevUseCollectionObject =
false;
1488 prevUseReferenceObject =
false;
1489 useCollectionObject =
false;
1492 if (numberOfVarDim>1) {
1493 Warning(
"ParseWithLeaf",
"TTreeFormula support only 2 level of variables size collections. Assuming '@' notation for the collection %s.",
1496 useCollectionObject =
true;
1497 }
else if (numberOfVarDim==0) {
1501 }
else if (numberOfVarDim==1) {
1506 previnfo->
fNext = leafinfo;
1507 previnfo = leafinfo;
1513 previnfo->
fNext = leafinfo;
1514 previnfo = leafinfo;
1518 }
else if (right[i] ==
')') {
1521 TClass * casted = (
TClass*) ((
int(--paran_level)>=0) ? castqueue.
At(paran_level) :
nullptr);
1526 if (maininfo==
nullptr) {
1527 maininfo = leafinfo;
1529 if (previnfo==
nullptr) {
1530 previnfo = leafinfo;
1532 previnfo->
fNext = leafinfo;
1533 previnfo = leafinfo;
1536 current = &(work[0]);
1543 }
else if (i > 0 && (right[i] ==
'.' || right[i] ==
'[' || right[i] ==
'\0') ) {
1546 bool needClass =
true;
1550 if (strlen(work)==0)
continue;
1552 prevUseCollectionObject = useCollectionObject;
1553 prevUseReferenceObject = useReferenceObject;
1555 useReferenceObject =
true;
1556 useCollectionObject =
true;
1558 for(
l=0;work[
l+1]!=0;++
l) work[
l] = work[
l+1];
1560 }
else if (work[strlen(work)-1]==
'@') {
1561 useReferenceObject =
true;
1562 useCollectionObject =
true;
1563 work[strlen(work)-1] =
'\0';
1565 useReferenceObject =
false;
1566 useCollectionObject =
false;
1569 bool mustderef =
false;
1573 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1581 prevUseReferenceObject =
false;
1584 previnfo = previnfo->
fNext;
1588 for(
Long64_t entry=0; entry<leaf->
GetBranch()->GetEntries()-readentry; ++entry) {
1591 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", eres);
1611 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1634 previnfo = clonesinfo;
1635 maininfo = clonesinfo;
1639 Error(
"ParseWithLeaf",
"Unimplemented usage of ClonesArray");
1648 if (clones==
nullptr) {
1650 "TClonesArray object was not retrievable for %s!",
1659 if (1 || inside_cl) cl = inside_cl;
1661 if (0 && strlen(work)==0) {
1676 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1680 if (maininfo==
nullptr) {
1699 previnfo = collectioninfo;
1700 maininfo = collectioninfo;
1709 Error(
"ParseWithLeaf",
"Could you not find the inner class for %s with coll type = %d",
1713 Warning(
"ParseWithLeaf",
"No data member in content of %s in %s\n",
1722 Warning(
"ParseWithLeaf",
"Missing class for %s!",
name.Data());
1727 if (!element && !prevUseCollectionObject) {
1734 Int_t clones_offset = 0;
1741 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1746 previnfo->
fNext = clonesinfo;
1748 previnfo->
fNext =
nullptr;
1760 if (maininfo==
nullptr) maininfo = leafinfo;
1761 if (previnfo==
nullptr) previnfo = leafinfo;
1763 previnfo->
fNext = leafinfo;
1764 previnfo = leafinfo;
1772 Int_t coll_offset = 0;
1781 if (numberOfVarDim>1) {
1782 Warning(
"ParseWithLeaf",
"TTreeFormula support only 2 level of variables size collections. Assuming '@' notation for the collection %s.",
1785 useCollectionObject =
true;
1786 }
else if (numberOfVarDim==1) {
1798 if (maininfo==
nullptr) maininfo = leafinfo;
1799 if (previnfo==
nullptr) previnfo = leafinfo;
1801 previnfo->
fNext = leafinfo;
1802 previnfo = leafinfo;
1804 if (leafinfo->
fNext) {
1805 previnfo = leafinfo->
fNext;
1820 if (numberOfVarDim>=1 &&
type>40) {
1825 if (leafinfo &&
type<=40 ) {
1832 bool object =
false;
1833 bool pointer =
false;
1834 bool objarr =
false;
1865 Error(
"ParseWithLeaf",
1866 "%s is a datamember of %s BUT is not yet of a supported type (%d)",
1871 Error(
"ParseWithLeaf",
1872 "%s is a datamember of %s BUT is not of a unknown type (%d)",
1877 if (
object && !useCollectionObject &&
1883 if (
object && leafinfo) {
1885 }
else if (objarr) {
1900 if (numberOfVarDim>1) {
1901 Warning(
"ParseWithLeaf",
"TTreeFormula support only 2 level of variables size collections. Assuming '@' notation for the collection %s.",
1904 useCollectionObject =
true;
1905 }
else if (numberOfVarDim==1) {
1925 else leafinfo->
fNext = info;
1932 if (!maininfo) maininfo = leafinfo;
1937 if (previnfo==
nullptr) previnfo = leafinfo;
1939 previnfo->
fNext = leafinfo;
1940 previnfo = leafinfo;
1955 else leafinfo->
fNext = info;
1962 Error(
"ParseWithLeaf",
"Branch could not be loaded:%d", res);
1975 prevUseReferenceObject =
false;
1978 }
else if (pointer) {
1990 if (cl)
Error(
"ParseWithLeaf",
"%s is not a datamember of %s",work,cl->
GetName());
1996 if (maininfo==
nullptr) {
1997 maininfo = leafinfo;
1999 if (previnfo==
nullptr) {
2000 previnfo = leafinfo;
2001 }
else if (previnfo!=leafinfo) {
2002 previnfo->
fNext = leafinfo;
2003 previnfo = leafinfo;
2005 while (previnfo->
fNext) previnfo = previnfo->
fNext;
2007 if ( right[i] !=
'\0' ) {
2008 if ( !needClass && mustderef ) {
2014 if ( inf->IsReference() ) {
2025 Error(
"ParseWithLeaf",
"Failed to access class type of reference target (%s)",element->
GetName());
2031 Error(
"ParseWithLeaf",
"Failed to access class type of reference target (%s)",element->
GetName());
2035 else if ( needClass ) {
2039 if (mustderef) leafinfo =
nullptr;
2040 current = &(work[0]);
2049 nchname = strlen(right);
2053 *current++ = right[i];
2062 if (strlen(work)!=0) {
2074 if (!last)
return action;
2078 if (last && last->
GetClass() != objClass) {
2090 last->
fNext = collectioninfo;
2102 if (!last)
return action;
2106 const char *funcname =
nullptr;
2110 }
else if (objClass == stdStringClass) {
2153 method =
new TMethodCall(objClass,
"AsString",
"");
2206 const char *funcname =
nullptr;
2209 }
else if (objClass == stdStringClass) {
2249 if (readentry < 0) readentry=0;
2250 const char *
cname = expression;
2251 char first[
kMaxLen]; first[0] =
'\0';
2252 char second[
kMaxLen*2]; second[0] =
'\0';
2253 char right[
kMaxLen*2]; right[0] =
'\0';
2254 char work[
kMaxLen]; work[0] =
'\0';
2255 char left[
kMaxLen]; left[0] =
'\0';
2258 std::string currentname;
2259 Int_t previousdot = 0;
2261 TLeaf *tmp_leaf=
nullptr;
2262 TBranch *branch=
nullptr, *tmp_branch=
nullptr;
2265 bool foundAtSign =
false;
2266 bool startWithParan =
false;
2268 for (i=0, current = &(work[0]); i<=nchname && !
final;i++ ) {
2270 *current++ =
cname[i];
2272 if (
cname[i] ==
'(') {
2275 if (current==work+1) {
2278 startWithParan =
true;
2290 if (
cname[i] ==
')') {
2291 if (paran_level==0) {
2292 Error(
"FindLeafForExpression",
"Unmatched parenthesis in %s",fullExpression);
2297 if (startWithParan) {
2298 startWithParan =
false;
2307 current = &(work[0]);
2311 }
else if (
gROOT->GetType(cast_name)) {
2313 current = &(work[0]);
2315 Warning(
"FindLeafForExpression",
2316 "Casting to primary types like \"%s\" is not supported yet",cast_name.
Data());
2323 char *params = strchr(work,
'(');
2325 *params = 0; params++;
2327 if (branch && !leaf) {
2338 TLeaf* leafcur =
nullptr;
2339 while (!leaf && (leafcur = (
TLeaf*) next())) {
2349 if (strlen(left) && left[strlen(left)-1]==
'.') left[strlen(left)-1]=0;
2351 if (aliasValue && strcspn(aliasValue,
"()[]+*/-%&!=<>|") == strlen(aliasValue) &&
2355 if (find(aliasUsed.begin(),
2357 left) != aliasUsed.end()) {
2358 Error(
"FindLeafForExpression",
2359 "The substitution of the branch alias \"%s\" by \"%s\" in \"%s\" failed\n"\
2360 "\tbecause \"%s\" is used [recursively] in its own definition!",
2361 left,aliasValue,fullExpression,left);
2364 aliasUsed.push_back(left);
2365 TString newExpression = aliasValue;
2366 newExpression += (
cname+strlen(left));
2368 castqueue, aliasUsed, useLeafCollectionObject, fullExpression);
2370 Error(
"FindLeafForExpression",
2371 "The substitution of the alias \"%s\" by \"%s\" failed.",left,aliasValue);
2388 strlcpy(right,work,2*
kMaxLen);
2389 strncat(right,
"(",2*
kMaxLen-1-strlen(right));
2390 strncat(right,params,2*
kMaxLen-1-strlen(right));
2397 current = &(work[0]);
2411 for(
l=0;work[
l+1]!=0;++
l) work[
l] = work[
l+1];
2414 }
else if (
len>=2 && work[
len-2]==
'@') {
2420 foundAtSign =
false;
2423 if (left[0]==0) strlcpy(left,work,
kMaxLen);
2424 if (!leaf && !branch) {
2428 std::string treename(first);
2429 if (!treename.empty() && treename[treename.size()-1]==
'.') {
2430 treename.erase(treename.size()-1);
2432 if (treename==
"This" ) {
2469 if (
cname[i]) first[strlen(first)-1]=
'\0';
2483 useLeafCollectionObject = foundAtSign;
2485 current = &(work[0]);
2488 else if (branch && (foundAtSign ||
cname[i] != 0) ) {
2493 if (leaf==
nullptr) {
2502 useLeafCollectionObject = foundAtSign;
2503 foundAtSign =
false;
2504 current = &(work[0]);
2514 useLeafCollectionObject = foundAtSign;
2515 foundAtSign =
false;
2516 current = &(work[0]);
2518 }
else if (leaf || branch) {
2519 if (leaf && branch) {
2533 current = &(work[0]);
2546 if (foundAtSign) strncat(right,
"@",2*
kMaxLen-1-strlen(right));
2547 if (
cname[i]==
'.') strncat(right,
".",2*
kMaxLen-1-strlen(right));
2550 current = &(work[0]);
2553 }
else if (
cname[i] ==
'.') {
2560 while(!branch && (branchcur=(
TBranch*)next()) ) {
2565 current = &(work[0]);
2572 Error(
"FindLeafForExpression",
"Unexpected control flow!");
2578 if (
cname[i]) work[strlen(work)-1] =
'\0';
2579 snprintf(scratch,
sizeof(scratch),
"%s.%s",first,work);
2580 snprintf(scratch2,
sizeof(scratch2),
"%s.%s.%s",first,second,work);
2583 currentname = &(work[previousdot+1]);
2590 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(scratch);
2591 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(scratch2);
2592 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(currentname.c_str());
2602 if (!tmp_branch) tmp_branch = branch->
FindBranch(scratch);
2603 if (!tmp_branch) tmp_branch = branch->
FindBranch(scratch2);
2604 if (!tmp_branch) tmp_branch = branch->
FindBranch(currentname.c_str());
2612 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(scratch);
2613 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(scratch2);
2614 if (!tmp_leaf) tmp_leaf = branch->
FindLeaf(currentname.c_str());
2625 if (second[0]) strncat(second,
".",2*
kMaxLen-1-strlen(second));
2626 strncat(second,work,2*
kMaxLen-1-strlen(second));
2628 useLeafCollectionObject = foundAtSign;
2629 foundAtSign =
false;
2632 current = &(work[0]);
2638 Int_t where = strlen(work);
2640 work[where+1] =
cname[i];
2642 previousdot = where+1;
2644 previousdot = strlen(work);
2645 work[strlen(work)] =
cname[i];
2655 strncat(right,work,2*
kMaxLen-1-strlen(right));
2659 if (strlen(right) && right[strlen(right)-1]!=
'.' &&
cname[i]!=
'.') {
2663 strncat(right,
".",2*
kMaxLen-1-strlen(right));
2668 if (!
final && branch) {
2671 if (!leaf)
return -1;
2677 if (strlen(right)==0) strlcpy(right,work,2*
kMaxLen);
2680 if (leaf==
nullptr && left[0]!=0) {
2681 if (left[strlen(left)-1]==
'.') left[strlen(left)-1]=0;
2685 if (aliasValue && strcspn(aliasValue,
"()[]+*/-%&!=<>|") == strlen(aliasValue) && !
IsNumberConstant(aliasValue)) {
2688 if (find(aliasUsed.begin(),
2690 left) != aliasUsed.end()) {
2691 Error(
"FindLeafForExpression",
2692 "The substitution of the branch alias \"%s\" by \"%s\" in \"%s\" failed\n"\
2693 "\tbecause \"%s\" is used [recursively] in its own definition!",
2694 left,aliasValue,fullExpression,left);
2697 aliasUsed.push_back(left);
2698 TString newExpression = aliasValue;
2699 newExpression += (
cname+strlen(left));
2701 castqueue, aliasUsed, useLeafCollectionObject, fullExpression);
2703 Error(
"FindLeafForExpression",
2704 "The substitution of the alias \"%s\" by \"%s\" failed.",left,aliasValue);
2755 if (!
fTree)
return -1;
2759 Error(
"TTreeFormula",
"The length of the variable name (%d) exceeds the maximum allowed (%d)",
name.Length(),
kMaxLen);
2764 if (
name ==
"Entry$") {
2770 if (
name ==
"LocalEntry$") {
2776 if (
name ==
"Entries$") {
2784 if (
name ==
"LocalEntries$") {
2792 if (
name ==
"Iteration$") {
2798 if (
name ==
"Length$") {
2804 static const char *lenfunc =
"Length$(";
2805 if (strncmp(
name.Data(),
"Length$(",strlen(lenfunc))==0
2817 static const char *minfunc =
"Min$(";
2818 if (strncmp(
name.Data(),
"Min$(",strlen(minfunc))==0
2830 static const char *maxfunc =
"Max$(";
2831 if (strncmp(
name.Data(),
"Max$(",strlen(maxfunc))==0
2843 static const char *sumfunc =
"Sum$(";
2844 if (strncmp(
name.Data(),
"Sum$(",strlen(sumfunc))==0
2863 if (res<0)
return res;
2871 char dims[
kMaxLen]; dims[0] =
'\0';
2880 for(i=0,k=0; i<cnamelen; ++i, ++k) {
2881 if (
cname[i] ==
'[') {
2883 int bracket_level = 1;
2885 for (j=++i; j<cnamelen && (bracket_level>0 ||
cname[j]==
'['); j++, i++) {
2886 if (
cname[j]==
'[') bracket_level++;
2887 else if (
cname[j]==
']') bracket_level--;
2889 if (bracket_level != 0) {
2893 strncat(dims,&
cname[bracket],j-bracket);
2900 bool useLeafCollectionObject =
false;
2902 TLeaf *leaf =
nullptr;
2907 if (res<0)
return res;
2909 if (!leaf && res!=2) {
2918 Error(
"DefinedVariable",
2919 "The substitution of the alias \"%s\" by \"%s\" failed\n"\
2920 "\tbecause \"%s\" is recursively used in its own definition!",
2925 if (strcspn(aliasValue,
"()[]+*/-%&!=<>|") != strlen(aliasValue) ||
IsNumberConstant(aliasValue)) {
2931 aliasSofar.push_back(
cname );
2933 TString subValue( aliasValue );
2942 Error(
"DefinedVariable",
2943 "The substitution of the alias \"%s\" by \"%s\" failed.",
cname,aliasValue);
2958 TString thisAlias( aliasValue );
2966 Error(
"Compile",
" Bad numerical expression : \"%s\"",thisAlias.
Data());
2967 }
else if (aliasRes==-2) {
2968 Error(
"Compile",
" Part of the Variable \"%s\" exists but some of it is not accessible or useable",thisAlias.
Data());
2971 Error(
"DefinedVariable",
2972 "The substitution of the alias \"%s\" by \"%s\" failed.",
cname,aliasValue);
2981 if (leaf || res==2) {
2984 Error(
"DefinedVariable",
"the branch \"%s\" has to be enabled to be used",leaf->
GetBranch()->
GetName());
2993 char *current = &( dims[0] );
3000 if (current[0] ==
']') {
3004 auto closePos = tempIndex.
First(
']');
3006 tempIndex = tempIndex(0, closePos);
3007 if (tempIndex.
IsDigit() && (scanindex = sscanf(current,
"%d", &
index)) && scanindex == 1) {
3012 char *end = (
char*)(varindex.
Data());
3013 for(
char bracket_level = 0;*end!=0;end++) {
3014 if (*end==
'[') bracket_level++;
3015 if (bracket_level==0 && *end==
']')
break;
3016 if (*end==
']') bracket_level--;
3026 current += strlen(varindex)+1;
3034 current = (
char*)strstr( current,
"[" );
3041 res =
ParseWithLeaf(leaf,leftover,
final,paran_level,castqueue,useLeafCollectionObject,
name);
3042 if (res<0)
return res;
3043 if (res>0) action = res;
3071 }
else if (strlen(gcut->
GetVarX())) {
3080 for(
Int_t i2 = 1; i2<
n; i2++) {
3081 if (
x[i2] < min) min =
x[i2];
3082 if (
x[i2] > max) max =
x[i2];
3101 Error(
"DefinedVariable",
"Found a TCutG without leaf information (%s)",
3138 while ((leafcur = (
TLeaf*)nextleaf())) {
3166 if (clonesinfo) {
delete clonesinfo; clonesinfo =
nullptr; }
3173 Error(
"GetLeafWithDatamember",
"Branch could not be loaded:%d", res);
3190 bool toplevel = (branch == branch->
GetMother());
3194 if (clones) cl = clones->
GetClass();
3236 leafinfo = clonesinfo;
3248 Int_t clones_offset = 0;
3253 else leafinfo->
fNext = sub_clonesinfo;
3254 else leafinfo = sub_clonesinfo;
3258 Error(
"GetLeafWithDatamember",
"Branch could not be loaded:%d", res);
3264 delete leafinfo; clonesinfo =
nullptr;
3269 if (!clones)
continue;
3330 }
else if (
type > 60) {
3358 Error(
"BranchHasMethod",
"Branch could not be loaded:%d", res);
3385 Error(
"BranchHasMethod",
"Branch could not be loaded:%d", cres);
3397 Error(
"BranchHasMethod",
"A TClonesArray was stored in a branch type no yet support (i.e. neither TBranchObject nor TBranchElement): %s",branch->
IsA()->
GetName());
3400 cl = clones ? clones->
GetClass() :
nullptr;
3434 Int_t real_instance = 0;
3469 if (local_index<0) {
3470 Error(
"EvalInstance",
"Index %s is out of bound (%d) in formula %s",
3477 real_instance = local_index *
fCumulSizes[codeindex][1];
3502 if (local_index<0) {
3503 Error(
"EvalInstance",
"Index %s is out of bound (%d) in formula %s",
3523 if (check)
return fNdata[0]+1;
3528 }
while(
instance >= virt_accum && local_index<maxloop);
3534 if (local_index==(maxloop-1) && (
instance >= virt_accum)) {
3536 if (check)
return fNdata[0]+1;
3542 if (check)
return fNdata[0]+1;
3550 local_index =
fIndexes[codeindex][0];
3577 if (
fIndexes[codeindex][vdim]>=0) {
3580 if (isize!=1 &&
fIndexes[codeindex][vdim]>isize) {
3585 for(
Int_t k=vdim -1; k>0; --k) {
3589 real_instance = local_index *
fCumulSizes[codeindex][1];
3593 for (
Int_t dim = 1; dim < max_dim; dim++) {
3604 if (
fIndexes[codeindex][dim]==-2) {
3611 if (local_index<0 ||
3613 Error(
"EvalInstance",
"Index %s is out of bound (%d/%d) in formula %s",
3621 real_instance += local_index *
fCumulSizes[codeindex][dim+1];
3625 if (
fIndexes[codeindex][max_dim]>=0) {
3626 if (!info) real_instance +=
fIndexes[codeindex][max_dim];
3634 if (info && local_index>=
fCumulSizes[codeindex][max_dim]) {
3638 if (
fIndexes[codeindex][max_dim]==-2) {
3644 if (local_index<0 ||
3646 Error(
"EvalInstance",
"Index %s is of out bound (%d/%d) in formula %s",
3654 real_instance += local_index;
3659 return real_instance;
3698 if (elem==
nullptr) {
3713 if (!obj)
return nullptr;
3717 default:
return nullptr;
3757 Error(
"EvalObject",
"Branch could not be loaded:%d", res);
3761 else if (real_instance>=
fNdata[0])
return nullptr;
3767 if (real_instance) {
3768 Warning(
"EvalObject",
"Not yet implement for kDirect and arrays (for %s).\nPlease contact the developers",
GetName());
3775 default:
return nullptr;
3787 const Int_t kMAXSTRINGFOUND = 10;
3788 const char *stringStack[kMAXSTRINGFOUND];
3800 Error(
"EvalStringInstance",
"Branch could not be loaded:%d", res);
3803 }
else if (real_instance>=
fNdata[0]) {
3816 return stringStack[0];
3819#define TT_EVAL_INIT \
3820 TLeaf *leaf = (TLeaf*)fLeaves.UncheckedAt(0); \
3822 const Int_t real_instance = GetRealInstance(instance,0); \
3824 if (instance==0) fNeedLoading = true; \
3825 if (real_instance>=fNdata[0]) return TMath::SignalingNaN(); \
3831 if (fNeedLoading) { \
3832 fNeedLoading = false; \
3833 TBranch *br = leaf->GetBranch(); \
3834 if (br && br->GetTree()) { \
3835 Long64_t tEntry = br->GetTree()->GetReadEntry(); \
3836 auto lres = R__LoadBranch(br, tEntry, fQuickLoad); \
3838 Error("TTreeFormula::TT_EVAL_INIT", \
3839 "Could not read entry (%lld) of leaf (%s), r=(%d).", tEntry, leaf->GetName(), lres);\
3841 Error("TTreeFormula::TT_EVAL_INIT", \
3842 "Could not init branch associated to this leaf (%s).", leaf->GetName()); \
3850 if (fLookupType[0]==kDirect) { \
3851 label = (char*)leaf->GetValuePointer(); \
3853 label = (char*)GetLeafInfo(0)->GetValuePointer(leaf,instance); \
3855 Int_t bin = fAxis->FindBin(label); \
3859#define TREE_EVAL_INIT \
3860 const Int_t real_instance = GetRealInstance(instance,0); \
3862 if (real_instance>=fNdata[0]) return TMath::SignalingNaN(); \
3868 label = (char*)GetLeafInfo(0)->GetValuePointer((TLeaf*)0x0,instance); \
3869 Int_t bin = fAxis->FindBin(label); \
3873#define TT_EVAL_INIT_LOOP \
3874 TLeaf *leaf = (TLeaf*)fLeaves.UncheckedAt(code); \
3877 const Int_t real_instance = GetRealInstance(instance,code); \
3880 TBranch *branch = (TBranch*)fBranches.UncheckedAt(code); \
3882 if (branch->GetTree()) { \
3883 Long64_t tEntry = branch->GetTree()->GetReadEntry(); \
3884 auto lres = R__LoadBranch(branch, tEntry, fQuickLoad); \
3886 Error("TTreeFormula::TT_EVAL_INIT_LOOP", \
3887 "Could not read entry (%lld) of leaf (%s), r=(%d).", tEntry, leaf->GetName(), lres);\
3890 Error("TTreeFormula::TT_EVAL_INIT_LOOP", \
3891 "Could not init branch associated to this leaf (%s).", leaf->GetName()); \
3893 } else if (fDidBooleanOptimization) { \
3894 branch = leaf->GetBranch(); \
3895 if (branch && branch->GetTree()) { \
3896 Long64_t tEntry = branch->GetTree()->GetReadEntry(); \
3897 if (branch->GetReadEntry() != tEntry) branch->GetEntry(tEntry); \
3899 Error("TTreeFormula::TT_EVAL_INIT_LOOP", \
3900 "Could not init branch associated to this leaf (%s).", leaf->GetName()); \
3907 if (fDidBooleanOptimization) { \
3908 TBranch *br = leaf->GetBranch(); \
3909 if (br->GetTree()) { \
3910 Long64_t tEntry = br->GetTree()->GetReadEntry(); \
3911 if (br->GetReadEntry() != tEntry) br->GetEntry(tEntry); \
3913 Error("TTreeFormula::TT_EVAL_INIT_LOOP", \
3914 "Could not init branch associated to this leaf (%s).", leaf->GetName()); \
3918 if (real_instance>=fNdata[code]) return TMath::SignalingNaN();
3920#define TREE_EVAL_INIT_LOOP \
3922 const Int_t real_instance = GetRealInstance(instance,code); \
3924 if (real_instance>=fNdata[code]) return TMath::SignalingNaN();
3930 for (
int i=0; i<
len; ++i) res +=
sum->EvalInstance<T>(i);
3939 for (
int i=1; i<
len; ++i) {
3954 for (
int i=1; i<
len; ++i) {
3971 condval = condition->EvalInstance<T>(i);
3973 }
while (!condval && i<
len);
3974 if (!condval && i==
len) {
3983 for (; i<
len; ++i) {
3984 condval = condition->EvalInstance<T>(i);
4003 condval = condition->EvalInstance<T>(i);
4005 }
while (!condval && i<
len);
4006 if (!condval && i==
len) {
4015 for (; i<
len; ++i) {
4016 condval = condition->EvalInstance<T>(i);
4030template <
typename T> T fmod_local(T
x, T
y) {
return fmod(
x,
y); }
4044inline void CheckIntegerPrintPrecision(
LongDouble_t evaluated,
const char *expression)
4051 const LongDouble_t threshold = std::ldexp(1.0L, std::numeric_limits<LongDouble_t>::digits);
4056 if (evaluated >= threshold || evaluated <= -threshold)
4057 ::Error(
"TTreeFormula::PrintValue",
4058 "the integer value of \"%s\" may be inexact: its magnitude reaches 2^%d, "
4059 "the point beyond which the long double used to evaluate it can no longer "
4060 "represent every integer exactly, so the printed value may be rounded. "
4061 "This is a known limitation "
4062 "(https://github.com/root-project/root/issues/7844).",
4063 expression, std::numeric_limits<LongDouble_t>::digits);
4076 if( !strncmp(
fExpr[op],
"0x", 2) || !strncmp(
fExpr[op],
"0X", 2) ) {
4078 sscanf(
fExpr[op],
"%llx", &val );
4169 return leaf->GetTypedValue<T>(real_instance);
4227 const Int_t kMAXSTRINGFOUND = 10;
4228 const char *stringStackLocal[kMAXSTRINGFOUND];
4229 const char **stringStack = stringStackArg?stringStackArg:stringStackLocal;
4245 if (newaction==
kConstant) { pos++; tab[pos-1] = GetConstant<T>(oper &
kTFOperMask);
continue; }
4249 case kEnd :
return tab[0];
4250 case kAdd : pos--; tab[pos-1] += tab[pos];
continue;
4251 case kSubstract : pos--; tab[pos-1] -= tab[pos];
continue;
4252 case kMultiply : pos--; tab[pos-1] *= tab[pos];
continue;
4253 case kDivide : pos--;
if (tab[pos] == 0) tab[pos-1] = 0;
4254 else tab[pos-1] /= tab[pos];
4259 tab[pos-1] = T(int1 % int2);
4279 case kacosh:
if (tab[pos-1] < 1) {tab[pos-1] = 0;}
4288 case kfmod : pos--; tab[pos-1] = fmod_local(tab[pos-1],tab[pos]);
continue;
4289 case kpow : pos--; tab[pos-1] =
TMath::Power(tab[pos-1],tab[pos]);
continue;
4290 case ksq : tab[pos-1] = tab[pos-1]*tab[pos-1];
continue;
4293 case kstrstr : pos2 -= 2; pos++;
if (strstr(stringStack[pos2],stringStack[pos2+1])) tab[pos-1]=1;
4297 case kmin : pos--; tab[pos-1] = std::min(tab[pos-1],tab[pos]);
continue;
4298 case kmax : pos--; tab[pos-1] = std::max(tab[pos-1],tab[pos]);
continue;
4300 case klog :
if (tab[pos-1] > 0) tab[pos-1] =
TMath::Log(tab[pos-1]);
4301 else {tab[pos-1] = 0;}
4304 if (dexp < -700) {tab[pos-1] = 0;
continue;}
4305 if (dexp > 700) {tab[pos-1] =
TMath::Exp(700);
continue;}
4309 else {tab[pos-1] = 0;}
4315 case ksign :
if (tab[pos-1] < 0) tab[pos-1] = -1;
else tab[pos-1] = 1;
4317 case kint : tab[pos-1] = T(
Long64_t(tab[pos-1]));
continue;
4318 case kSignInv: tab[pos-1] = -1 * tab[pos-1];
continue;
4321 case kAnd : pos--;
if (tab[pos-1]!=0 && tab[pos]!=0) tab[pos-1]=1;
4324 case kOr : pos--;
if (tab[pos-1]!=0 || tab[pos]!=0) tab[pos-1]=1;
4328 case kEqual : pos--; tab[pos-1] = (tab[pos-1] == tab[pos]) ? 1 : 0;
continue;
4329 case kNotEqual : pos--; tab[pos-1] = (tab[pos-1] != tab[pos]) ? 1 : 0;
continue;
4330 case kLess : pos--; tab[pos-1] = (tab[pos-1] < tab[pos]) ? 1 : 0;
continue;
4331 case kGreater : pos--; tab[pos-1] = (tab[pos-1] > tab[pos]) ? 1 : 0;
continue;
4332 case kLessThan : pos--; tab[pos-1] = (tab[pos-1] <= tab[pos]) ? 1 : 0;
continue;
4333 case kGreaterThan: pos--; tab[pos-1] = (tab[pos-1] >= tab[pos]) ? 1 : 0;
continue;
4334 case kNot : tab[pos-1] = (tab[pos-1] != 0) ? 0 : 1;
continue;
4336 case kStringEqual : pos2 -= 2; pos++;
if (!strcmp(stringStack[pos2+1],stringStack[pos2])) tab[pos-1]=1;
4339 case kStringNotEqual: pos2 -= 2; pos++;
if (strcmp(stringStack[pos2+1],stringStack[pos2])) tab[pos-1]=1;
4364 pos2++; stringStack[pos2-1] = (
char*)
fExpr[i].Data();
4378 int op = param % 10;
4380 if (op == 1 && (!tab[pos-1]) ) {
4389 }
else if (op == 2 && tab[pos-1] ) {
4400 int toskip = param / 10;
4411 int fno = param / 1000;
4412 int nargs = param % 1000;
4420 UInt_t argloc = pos-nargs;
4421 for(
Int_t j=0;j<nargs;j++,argloc++,pos--) {
4422 SetMethodParam(method, tab[argloc]);
4445 switch (lookupType) {
4460 GetTypedValue<T>(leaf,real_instance);
continue; }
4462 GetTypedValue<T>((
TLeaf*)
nullptr,real_instance);
continue; }
4467 default: tab[pos++] = 0;
continue;
4480 tab[pos++] = gcut->
IsInside(xcut,ycut);
4509 tab[pos] = param; pos++;
4527 T param = FindMin<T>(primary,condition);
4529 tab[pos] = param; pos++;
4536 T param = FindMax<T>(primary,condition);
4538 tab[pos] = param; pos++;
4548 if (instance < primary->
GetNdata()) {
4554 tab[pos] = param; pos++;
4568 if (instance < primary->
GetNdata()) {
4598 Error(
"EvalInstance",
"Branch could not be loaded:%d", res);
4610 Error(
"EvalInstance",
"Branch could not be loaded:%d", res);
4636template double TTreeFormula::EvalInstance<double> (
int,
char const**);
4637template long double TTreeFormula::EvalInstance<long double> (
int,
char const**);
4638template long long TTreeFormula::EvalInstance<long long> (
int,
char const**);
4691 void* thisobj =
nullptr;
4704 Warning(
"GetValueFromMethod",
"No streamer info for branch %s.", branch->
GetName());
4714 thisobj = *((
char**) (address +
offset));
4764 Warning(
"GetValuePointerFromMethod",
"No streamer info for branch %s.", branch->
GetName());
4774 thisobj = *((
char**) (address +
offset));
4830 if (
fNoper > 1)
return false;
4889 if (
fAxis)
return true;
4900 if (!strcmp(leaf->
GetTypeName(),
"Int_t"))
return true;
4901 if (!strcmp(leaf->
GetTypeName(),
"Short_t"))
return true;
4902 if (!strcmp(leaf->
GetTypeName(),
"UInt_t"))
return true;
4903 if (!strcmp(leaf->
GetTypeName(),
"UShort_t"))
return true;
4904 if (!strcmp(leaf->
GetTypeName(),
"Bool_t"))
return true;
4905 if (!strcmp(leaf->
GetTypeName(),
"Char_t"))
return true;
4906 if (!strcmp(leaf->
GetTypeName(),
"UChar_t"))
return true;
4907 if (!strcmp(leaf->
GetTypeName(),
"Long64_t"))
return true;
4908 if (!strcmp(leaf->
GetTypeName(),
"ULong64_t"))
return true;
4909 if (!strcmp(leaf->
GetTypeName(),
"string"))
return true;
4957 if (indexname[strlen(indexname)-1] ==
'_' ) {
4969 if (bid < 0)
return false;
5032 const int kMAXLENGTH =
kMaxLen;
5033 static char value[kMAXLENGTH];
5036 for (
int i = 0; i < kMAXLENGTH-1; i++)
5038 value[kMAXLENGTH-1] = 0;
5039 }
else if (
mode == -1) {
5041 }
else if (
mode == 0) {
5044 const char * val =
nullptr;
5057 Error(
"PrintValue",
"Branch could not be loaded:%d", res);
5071 strlcpy(
value, val, kMAXLENGTH);
5075 value[kMAXLENGTH-1] = 0;
5080 if (real_instance<
fNdata[0]) {
5082 Char_t outputSizeLevel = 1;
5083 char *expo =
nullptr;
5085 switch (decform[
len-2]) {
5088 outputSizeLevel = 2;
5089 if (
len > 2 && tolower(decform[
len - 3]) ==
'l') {
5090 outputSizeLevel = 3;
5094 case 'h': outputSizeLevel = 0;
break;
5097 switch(decform[
len-1]) {
5102 switch (outputSizeLevel) {
5110 CheckIntegerPrintPrecision(
v,
GetTitle());
5116 CheckIntegerPrintPrecision(
v,
GetTitle());
5130 switch (outputSizeLevel) {
5137 CheckIntegerPrintPrecision(
v,
GetTitle());
5143 CheckIntegerPrintPrecision(
v,
GetTitle());
5158 switch (outputSizeLevel) {
5163 expo = strchr(
value,
'e');
5168 expo = strchr(
value,
'e');
5173 UInt_t declen = atoi(decform);
5174 if (strlen(
value)>declen) {
5176 char *start = expo - off;
5177 UInt_t vlen = strlen(expo);
5178 for(
UInt_t z=0;z<=vlen;++z) {
5185 if (isalpha(decform[strlen(decform)-1])) {
5186 TString short_decform(decform);
5188 snprintf(
value,kMAXLENGTH,
Form(
" %%%sc",short_decform.
Data()),
' ');
5190 snprintf(
value,kMAXLENGTH,
Form(
" %%%sc",decform),
' ');
5209 for(
UInt_t dim=0; dim<max_dim ;++dim) {
5219 for(
Int_t k=0; k <=
n; ++k) {
5242 if (!axis) {
fAxis =
nullptr;
return;}
5332 for (
Int_t i=0;i<nleaves;i++) {
5415 Int_t last_code = -1;
5418 if (last_code!=info->fCode) {
5423 last_code = info->fCode;
5432 while(nextinfo && nextinfo->
fCode==info->fCode) {
5436 if (!nextinfo)
break;
5440 last_code = info->fCode;
5492 if (!gcut)
continue;
5522 if (!leaf)
continue;
5551 if (tleaf && tleaf != realtree && tleaf->
GetTreeIndex()) {
5557 Int_t virt_dim2 = 0;
5565 if (
fIndexes[i][k] < 0 ) virt_dim2++;
5594 for (i = 0; i <
fNoper; i++) {
5627 for (i=0; i<
fNoper ; ++i) {
5629 if (leaf==
nullptr)
continue;
5635 Error(
"LoadBranches",
"Branch could not be loaded:%d", res);
5643 for (
Int_t dim = 0; dim < max_dim; ++dim) {
5654 bool outofbounds =
false;
5657 if (
fCodes[i] < 0)
continue;
5685 if (tleaf && tleaf != realtree && tleaf->
GetTreeIndex()) {
5694 bool hasBranchCount2 =
false;
5703 if (readentry < 0) readentry=0;
5707 Error(
"LoadCurrentDim",
"Branch could not be loaded:%d", res);
5714 branchcount->TBranch::GetEntry(readentry);
5737 Error(
"LoadCurrentDim",
"Branch could not be loaded:%d", res);
5745 hasBranchCount2 =
true;
5752 for(
Int_t k=vdim -1; k>=0; k--) {
5766 if (readentry < 0) readentry=0;
5769 Error(
"LoadCurrentDim",
"Branch could not be loaded:%d", res);
5774 if (hasBranchCount2) {
5803 }
else if (hasBranchCount2) {
5819 if (readentry < 0) readentry=0;
5822 Error(
"LoadCurrentDim",
"Branch could not be loaded:%d", res);
5848 hasBranchCount2 =
true;
5850 for(
int z=0; z<
size; ++z) {
5854 }
else if (
fIndexes[i][vdim] >= 0 ) {
5864 for(
Int_t k=vdim -1; k>=0; k--) {
5874 if (readentry < 0) readentry=0;
5877 Error(
"LoadCurrentDim",
"Branch could not be loaded:%d", res);
5897 if (
fManager->
fUsedSizes[virt_dim]==1 || (index_size!=1 && index_size<fManager->fUsedSizes[virt_dim]) )
5904 if (index_size==1) {
5908 if (index_size<fManager->fUsedSizes[virt_dim])
fManager->
fUsedSizes[virt_dim] = index_size;
5912 index_size<fManager->fUsedSizes[virt_dim]) {
5916 }
else if (hasBranchCount2 && info && k==info->
GetVarDim()) {
5920 if (
fManager->
fUsedSizes[virt_dim]==1 || (index_size!=1 && index_size<fManager->fUsedSizes[virt_dim]) )
5925 }
else if (hasBranchCount2 && info && k==info->
GetVarDim()) {
5938 return ! outofbounds;
5948 enum { kOldAlias = 100000+10000+1,
5949 kOldAliasString = kOldAlias+1,
5950 kOldAlternate = kOldAlias+2,
5951 kOldAlternateString = kOldAliasString+2
5954 for (
int k=0; k<
fNoper; k++) {
5961 case kOldAlias:
GetOper()[k] = -kOldAlias;
break;
5962 case kOldAliasString:
GetOper()[k] = -kOldAliasString;
break;
5963 case kOldAlternate:
GetOper()[k] = -kOldAlternate;
break;
5964 case kOldAlternateString:
GetOper()[k] = -kOldAlternateString;
break;
5996 if (!leaf)
return false;
6010 last = clonesinfo->
fNext;
6014 }
else if (br->
GetType()==41) {
6019 if ( count->
GetID() >= 0 ) {
6038 last = collectioninfo->
fNext;
6042 }
else if (br->
GetID()<0) {
static Roo_reg_AGKInteg1D instance
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
int Int_t
Signed integer 4 bytes (int)
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
short Version_t
Class version identifier (short)
char Char_t
Character 1 byte (char)
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
short Short_t
Signed Short integer 2 bytes (short)
double Double_t
Double 8 bytes.
long double LongDouble_t
Long Double (not portable)
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
const Int_t kDoNotProcess
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Set(Int_t n) override
Set size of this array to n ints.
const Int_t * GetArray() const
void AddAt(Int_t c, Int_t i)
Add Int_t c at position i. Check for out of bounds.
Class to manage histogram axis.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
A Branch for the case of an object.
TBranchElement * GetBranchCount() const
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
TStreamerInfo * GetInfo() const
Get streamer info for the branch class.
void SetupAddresses() override
If the branch address is not set, we set all addresses starting with the top level parent branch.
Int_t GetStreamerType() const
TBranchElement * GetBranchCount2() const
char * GetAddress() const override
Get the branch address.
char * GetObject() const
Return a pointer to our object.
A Branch for the case of an object.
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
A TTree is a list of TBranches.
virtual char * GetAddress() const
TObjArray * GetListOfBranches()
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
TClass * IsA() const override
void Print(Option_t *option="") const override
Print TBranch parameters.
virtual TLeaf * FindLeaf(const char *name)
Find the leaf corresponding to the name 'searchname'.
Long64_t GetReadEntry() const
virtual void ResetReadEntry()
virtual TBranch * FindBranch(const char *name)
Find the immediate sub-branch with passed name.
TObjArray * GetListOfLeaves()
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClassRef is used to implement a permanent reference to a TClass object.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t HasDataMemberInfo() const
ClassInfo_t * GetClassInfo() const
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
TVirtualRefProxy * GetReferenceProxy() const
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
An array of clone (identical) objects.
TClass * GetClass() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
const char * GetVarX() const
virtual void SetObjectY(TObject *obj)
Set the Y object (and delete the previous one if any).
TObject * GetObjectY() const
virtual void SetObjectX(TObject *obj)
Set the X object (and delete the previous one if any).
TObject * GetObjectX() const
const char * GetVarY() const
A small helper class to help in keeping track of the array dimensions encountered in the analysis of ...
TDimensionInfo(Int_t code, Int_t oper, Int_t size, TFormLeafInfoMultiVarDim *multiDim)
~TDimensionInfo() override
TFormLeafInfoMultiVarDim * fMultiDim
Describe directory structure in memory.
virtual Bool_t cd()
Change current directory to "this" directory.
A List of entry numbers in a TTree or TChain.
virtual Int_t Contains(Long64_t entry, TTree *tree=nullptr)
virtual Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside the polygon defined by the graph vertices 0 otherwise.
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
A TLeaf for the general case when using the branches created via a TStreamerInfo (i....
bool IsOnTerminalBranch() const override
Return true if this leaf is does not have any sub-branch/leaf.
A TLeaf for a general object derived from TObject.
TClass * GetClass() const
TObject * GetObject() const
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void * GetValuePointer() const
virtual bool IsUnsigned() const
virtual const char * GetTypeName() const
virtual Int_t GetLen() const
Return the number of effective elements of this leaf, for the current entry.
virtual TLeaf * GetLeafCount() const
If this leaf stores a variable-sized array or a multi-dimensional array whose last dimension has vari...
TClass * IsA() const override
virtual bool IsOnTerminalBranch() const
TBranch * GetBranch() const
virtual Int_t GetLenStatic() const
Return the fixed length of this leaf.
void Add(TObject *obj) override
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Method or function calling interface.
EReturnType ReturnType()
Returns the return type of the method.
static const EReturnType kLong
static const EReturnType kString
void ResetParam()
Reset parameter list. To be used before the first call the SetParam().
static const EReturnType kOther
TFunction * GetMethod()
Returns the TMethod describing the method to be executed.
void Execute(const char *, const char *, int *=nullptr) override
Execute method on this object with the given parameter string, e.g.
Bool_t IsValid() const
Return true if the method call has been properly initialized and is usable.
static const EReturnType kDouble
void SetParam(Long_t l)
Add a long method parameter.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Int_t GetEntriesFast() const
Int_t IndexOf(const TObject *obj) const override
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
TObject * Last() const override
Return the object in the last filled slot. Returns 0 if no entries.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
void Streamer(TBuffer &) override
Stream all objects in the array to or from the I/O buffer.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
Int_t GetLast() const override
Return index of last object in array.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Execute(const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Double_t Rndm() override
Machine independent random number generator.
const char * GetCountName() const
Describe one element (data member) to be Streamed.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element and updates fClassObject.
Int_t GetArrayDim() const
Int_t GetMaxIndex(Int_t i) const
virtual Bool_t IsaPointer() const
TClass * GetClass() const
TClass * IsA() const override
Describes a persistent version of a class.
TStreamerElement * GetElement(Int_t id) const override
Int_t GetElementOffset(Int_t id) const override
TClass * GetClass() const override
TStreamerElement * GetStreamerElement(const char *datamember, Int_t &offset) const override
Return the StreamerElement of "datamember" inside our class or any of its base classes.
static constexpr Ssiz_t kNPOS
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
A TTree represents a columnar dataset.
virtual TBranch * FindBranch(const char *name)
Return the branch that correspond to the path 'branchname', which can include the name of the tree or...
virtual TObjArray * GetListOfLeaves()
virtual TIterator * GetIteratorOnAllLeaves(bool dir=kIterForward)
Creates a new iterator that will go through all the leaves on the tree itself and its friend.
virtual TVirtualIndex * GetTreeIndex() const
virtual Long64_t GetEntries() const
virtual TLeaf * GetLeaf(const char *branchname, const char *leafname)
Searches in this tree and any of its friends for a leaf named leafname in branch branchname ,...
virtual Long64_t GetReadEntry() const
virtual TObjArray * GetListOfBranches()
virtual TTree * GetTree() const
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
virtual const char * GetAlias(const char *aliasName) const
Returns the expanded value of the alias. Search in the friends if any.
virtual Int_t GetTreeNumber() const
virtual TLeaf * FindLeaf(const char *name)
Find first leaf containing searchname.
virtual const char * GetFriendAlias(TTree *) const
If the 'tree' is a friend, this method returns its alias name.
virtual EDataType GetType() const =0
If the value type is a fundamental data type, return its type (see enumeration EDataType).
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
virtual TClass * GetValueClass(void *data) const =0
virtual Bool_t HasCounter() const =0
Bool_t IsCompiled() const
virtual TObjArray * GetElements() const =0
RVec< PromoteTypes< T0, T1 > > fmod(const T0 &x, const RVec< T1 > &v)
Double_t CosH(Double_t)
Returns the hyperbolic cosine of x.
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Double_t ASin(Double_t)
Returns the principal value of the arc sine of x, expressed in radians.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Double_t ASinH(Double_t)
Returns the area hyperbolic sine of x.
Double_t TanH(Double_t)
Returns the hyperbolic tangent of x.
Double_t ACosH(Double_t)
Returns the nonnegative area hyperbolic cosine of x.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t SignalingNaN()
Returns a signaling NaN as defined by IEEE 754.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Double_t ATanH(Double_t)
Returns the area hyperbolic tangent of x.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Double_t SinH(Double_t)
Returns the hyperbolic sine of x.
static uint64_t sum(uint64_t i)