Hello everyone,
I am new using ROOT and we are trying to create a histogram but the output file I want to create (“gaus.root”) is not being created and I can’t figure out why. Help me please.
Here it is the core we are using:
#include<TH1.h>
#include<TFile.h>
#include<TRandom.h>
int main(){
TH1F*h = new TH1F(“hgaus”, “A Gauss Function”, 100,-5.0,5.0);
TRandom rnd;
for (int i=0; i<10000; ++i){
double x= rnd.Gaus(1.5,1.0);
h->Fill(x);
}
TFile outfile(“gaus.root”, “RECREATE”);
h->Write();
outfile.Close();
return 0;
}
Regards.
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.18/04
Platform: Ubuntu 18.04 o 16.04
Compiler: C++