Hello ROOTers,
I'm trying to use a contour as a TCutG to draw a TH2F but I'm not being
successful.
I have a file containing a histogram that I draw with the option "cont3"
and I want to save it as a cut so I can draw some parameters from another
file. I was able to do it using the graphical cut but I also need to do it
within a code. I'm doing the following:
TCanvas *can = new TCanvas("can", "Cut with Contour");
TFile *file = new TFile("Contour.root"); TH2F *contour = (TH2F*)file->Get("Contour Hist"); contour->Draw("CONT3");
TCutG *cut = (TCutG*)file->Get("Contour Hist"); cut->SetName("mycut");
TFile *file2 = new TFile("merged_all_file.root"); TTree *oldtree = (TTree*)file2->Get("ntuple");
TH2F *par = new TH2F("par","Parameters",100,0.65,1.05,100,0.0,0.0085);
can->cd();
ntuple->Draw("par1:par2 >> par","mycut");
contour->Draw("same CONT3");
can->Print("cut_contour.png");
But I get the error:
Error in <TTreeFormula::Compile>: Bad numerical expression : "mycut"
Does anybody know what I'm doing wrong or how can I do this to get the results that I want?
Thanks in advance!
Michelle. Received on Mon Apr 09 2012 - 18:35:15 CEST
This archive was generated by hypermail 2.2.0 : Mon Apr 09 2012 - 23:50:01 CEST