When using a graphical cut as follows
[root 1] TTree*tree = new TTree();
[root 2] tree->ReadFile("data.txt");
[root 3] tree->Draw("TMath::Log10(var1):var2")
///// Make a graphical cut ////
[root 4] TCutG *mycutg;
[root 5] mycutg = (TCutG*)gROOT->GetListOfSpecials()->FindObject("CUTG")
[root 6] mycutg->SetName("mycutg");
[root 7] tree->Draw("TMath::Log10(var1):var2", "mycutg")
Error in <TCint::CheckClassInfo>: unexpected token : in :Log10(var1
Error in <TTreeFormula::AnalyzeFunction>: We thought we had a function but we dont (in :Log10(var1):var2)
Error in <TTreeFormula::Compile>: Bad numerical expression : ":Log10(var1):var2"
Error in <TTreeFormula::Compile>: Bad numerical expression : "TMath"
The double colon is being parsed out as two single colons for the formula. This error does not occur if one takes the logarithm of the last variable in the varexp. Unfortunately I actually want to take logarithms of both my variables. I’ve thought about making a friend tree that contains the log of these variables but that is somewhat time consuming for lots and lots of data.
My solution currently is to define a function MLog10 that is loaded in my logon scripts that simply calls the Log10 method from the TMath namespace. This works, but isn’t portable. I thought I’d give a heads up and ask for any portable solutions. Thanks.