`Draw()` option containing `std::string` branch of `TTree`

I have a TTree tree with std::string branch modeFlag. Suppose I want to draw data in this tree corresponding to some special modeFlag, for example, "A". The following code is not working:

tree->Draw("floatBranch", " modeFlag == "A" ");

It causes error

Error: String literal syntax error (tmpfile):1:
Error: String literal syntax error (tmpfile):1:
*** Interpreter error recovered ***

How to construct the cut corresponding to std::string branch in Draw() option?

I have found a solution accidently :slight_smile:

tree->Draw("floatBranch", " modeFlag == \"A\" "); 

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