TTree selection string syntax


I read a root file and scan some leaves of tree contained in it successfully:

gLabVIEWTree->Scan(“bankName:time:fSisCounter”);


  • Row * bankName * time * fSisCount *

  •    0 *      LYRQ *         0 *         0 *
    
  •    1 *      LYRQ *         0 *         0 *
    

bankName is a branch containing strings (presumably TStrings) that I want a selection on:

gLabVIEWTree->Scan(“bankName:time:fSisCounter”,“bankName.CompareTo(‘D243’)==0”);


  • Row * bankName * time * fSisCount *

*** Break *** segmentation violation

Simpler selection strings fail on syntax errors - I expect correctly.

gLabVIEWTree->Scan(“bankName:time:fSisCounter”,“bankName==‘D243’”);
Error in TTreeFormula::Compile: Bad numerical expression : “‘D243’”

Is the segfault a real bug or just another syntax error?

_ROOT Version:_6.22.06
Platform: fedora33
Compiler: 10.2.1 20201125 (Red Hat 10.2.1-9)


Try escaping the quotes

gLabVIEWTree->Scan("bankName:time:fSisCounter","bankName==\"D243\"");

Thanks dastudillo, it solves the problem. I had tried single quotes inside the double quotes, which did not work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.