Using an input variable as a cut value for TCut

Hello,

I am wondering how to provide a cut with a variable input on a variable used in my analysis.

int main(double logsig)
{
// Some file input
TCut logsigprob = "Btag_log10_sigProb > logsig";

// Some drawing
}

As you can see, I wish to use some sort of numerical input which I can change for the cut on the variable, but this error occurs

warning: missing terminating ' " ' character [-Winvalid-pp-token]
pression : "logsig
error: expected expression

Is there any way for me to get this to work in the way I want?

Thanks,
Andre

ROOT Version: 6.20/04
Platform: x86_64-redhat-linux-gnu
Compiler: gcc 9.3.0

TCut is a string, so put the value of the variable in that string, e.g.

TCut logsigprob = Form("%s%f", "Btag_log10_sigProb>", logsig);

I have tried with this and the same error occurs.

warning: missing terminating '"' character [-Winvalid-pp-token]
pression : "logsig
           ^
error: expected expression

Edit: The solution has worked. Apologies as there was a slight error afterwards whihch needed to be corrected.

1 Like

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