Hello,
I have a simple macro that was working with ROOT 5.34./34 on my previous Mac (OS X 10.7.5), but gives errors when I try to run it on my new Mac (macOS 10.12) with ROOT 6.12/04 (installed from binaries). Attached is the code of my macro, show_quad.cpp, and the errors I get with ROOT6 are below. The four input files are .root files that contain, among other things, a tree called rawtree. I found couple of similar topics on the forum but couldn’t figure out a solution for my problem… Please advise
show_quad(char *filename0, char *filename1, char *filename2, char *filename3)
{
gStyle->SetOptStat(00000000);
TCanvas *c1 = new TCanvas("c1","c1",800,800);
TFile *file0 = new TFile(filename0,"READ");
file0->cd();
rawtree->Draw("511-Row:255-Col>>h0(512, -0.5, 511.5, 512, -0.5, 511.5)","","colz");
TH2F *hs;
gDirectory->ls();
gDirectory->GetObject("h0",(TH2F *)hs);
hs->Print();
TFile *file1 = new TFile(filename1,"READ");
file1->cd();
rawtree->Draw("Row:Col>>h1(512, -0.5, 511.5, 512, -0.5, 511.5)","","colz");
hs->Add(h1);
hs->Print();
TFile *file2 = new TFile(filename2,"READ");
rawtree->Draw("Row:Col+256>>h2(512, -0.5, 511.5, 512, -0.5, 511.5)","","colz");
file2->cd();
hs->Add(h2);
hs->Print();
TFile *file3 = new TFile(filename3,"READ");
file3->cd();
rawtree->Draw("511-Row:511-Col>>h3(512, -0.5, 511.5, 512, -0.5, 511.5)","","colz");
hs->Add(h3);
hs->Print();
hs->SetTitle("");
hs->GetXaxis()->SetTitle("X");
hs->GetYaxis()->SetTitle("Y");
hs->Draw("colz");
}
the errors:
Processing show_quad.cpp(“W0011_F06-171213-124431-6145-1.root”,“W0011_H06-171213-124430-6145-1.root”,“W0011_H07-171213-124431-6145-1.root”,“W0011_J07-171213-124430-6145-1.root”)…
In file included from input_line_10:1:
/Users/…/show_quad.cpp:1:1: error: C++ requires a type specifier for all declarations
show_quad(char *filename0, char *filename1, char *filename2, char *filename3)
^
/Users/…/show_quad.cpp:8:5: error: use of undeclared identifier 'rawtree’
rawtree->Draw(“511-Row:255-Col>>h0(512, -0.5, 511.5, 512, -0.5, 511.5)”,"",“colz”);
^
/Users/…/show_quad.cpp:11:17: error: no matching member function for call to 'GetObject’
gDirectory->GetObject(“h0”,(TH2F *)hs);
~~~~^
/usr/local/root/include/TDirectory.h:139:35: note: candidate function [with T = TH2F] not viable: no known conversion from 'TH2F ’ to 'TH2F &’ for 2nd argument
template inline void GetObject(const char namecycle, T& ptr) // See TDirectory::Get for information
^
In file included from input_line_10:1:
/Users/…/show_quad.cpp:16:5: error: use of undeclared identifier 'rawtree’
rawtree->Draw(“Row:Col>>h1(512, -0.5, 511.5, 512, -0.5, 511.5)”,"",“colz”);
^
/Users/…/show_quad.cpp:17:13: error: use of undeclared identifier 'h1’
hs->Add(h1);
^
/Users/…/show_quad.cpp:21:5: error: use of undeclared identifier 'rawtree’
rawtree->Draw(“Row:Col+256>>h2(512, -0.5, 511.5, 512, -0.5, 511.5)”,"",“colz”);
^
/Users/…/show_quad.cpp:23:13: error: use of undeclared identifier 'h2’
hs->Add(h2);
^
/Users/…/show_quad.cpp:28:5: error: use of undeclared identifier 'rawtree’
rawtree->Draw(“511-Row:511-Col>>h3(512, -0.5, 511.5, 512, -0.5, 511.5)”,"",“colz”);
^
/Users/…/show_quad.cpp:29:13: error: use of undeclared identifier 'h3’
hs->Add(h3);