Hello there!
I’m currently trying two draw a 2D histogram while applying a TCutG to it. This TCutG is generated by static casting a TGraph object save in a separate root file. The code is as follows:
void GraphCutTest( int run ){
TFile* cut_file = new TFile("LowBeCut.root", "UPDATE");
TCutG* graph_cut = nullptr;
TString cut_name = Form("lowBecut_%d", run);
if ( cut_file -> IsOpen() ){
graph_cut = static_cast<TCutG*>( cut_file -> Get(cut_name) );
cut_file -> Close();
}
TFile* data_file = new TFile(Form("runs/run_%d.root", run), "UPDATE");
TTree* reco; data_file -> GetObject("reco", reco);
graph_cut -> SetName("graph_cut");
graph_cut -> SetVarX("baseline_mean[31] - ymin[31]");
graph_cut -> SetVarY("baseline_mean[30] - ymin[30]");
reco -> Draw("baseline_mean[30] - ymin[30]:baseline_mean[31] - ymin[31] >> hist", "graph_cut", "colz");
}
However, while the macro loads properly, running it returns the following:
Error in <TTreeFormula::Compile>: Bad numerical expression : "graph_cut"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {baseline_mean[30] - ymin[30]:baseline_mean[31] - ymin[31] ,graph_cut}
I’m not sure what is going on here. I’ve looked around and I feel I’ve implemented the TCutG object appropriately. Any help would be deeply appreciated.
Here’s a link with the files used in the code if anyone wishes to reproduce the error. I’ve also anexed the full macro used here.
LowBeToF.C (7.9 KB)
ROOT Version: 6.18/04
Platform: 18.04.4 LTS
Compiler: Not Provided