Hello,
I’m using ROOT6 on Mac. There is some problem when I using the following code.
//*********************************************************
void test(){
TCanvas* c1 = new TCanvas("c1","c1 test", 900, 300);
c1->Divide(3,1);
TFile* ofile = new TFile("test.root","RECREATE");
TH1F* hpx = new TH1F("hpx", "hpx" , 400, -20, 20);
TH1F* hpy = new TH1F("hpy", "hpy" , 400, -20, 20);
TH1F* hpz = new TH1F("hpz", "hpz" , 400, -20, 20);
for(int i=0; i<10000; i++)
{
hpx->Fill(gRandom->Gaus(0,1)); hpy->Fill(gRandom->Gaus(0,2)); hpz->Fill(gRandom->Gaus(0,3));
}
c1->cd(1); hpx->Draw(); hpx->Fit("gaus");
c1->cd(2); hpy->Draw(); hpy->Fit("gaus");
c1->cd(3); hpz->Draw(); hpz->Fit("gaus");
c1->cd();
ofile->cd();
hpx->Write();hpy->Write();hpz->Write();
c1->Write();
ofile->Close();
}
//*********************************************************
root -l test.root
root [0]
Attaching file test.root as _file0...
(TFile *) 0x7ffdfc289e30
root [1] .ls
TFile** test.root
TFile* test.root
KEY: TH1F hpx;1 hpx
KEY: TH1F hpy;1 hpy
KEY: TH1F hpz;1 hpz
KEY: TCanvas c1;1 c1 test
root [2] c1->Draw()
Error in <TClingCallFunc::make_wrapper>: Failed to compile
==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) extern "C" void __cf_0(void* obj, int nargs, void** args, void* ret)
{
if (ret) {
new (ret) (double) (TFormula____id18130473110346259110(*(double**)args[0], *(double**)args[1]));
return;
}
else {
TFormula____id18130473110346259110(*(double**)args[0], *(double**)args[1]);
return;
}
}
#pragma clang diagnostic pop
==== SOURCE END ====
*** Break *** segmentation violation
Generating stack trace...
An admin user name and password is required to enter Developer Mode.