Hi, I’m a beginner with root.
I’m trying to do an executable that when run delivers a histogram.
This so far is my simple code:
//Lots of libraries
#include <iostream> // class for inputoutput streams
#include <stdio.h> // printf, scanf, puts, NULL
#include <stdlib.h> // srand, rand, atof
#include <time.h> // time
#include <fstream> // class for inputoutput file streams
#include <dirent.h>
#include <string.h> // class to manipulate strings
#include <sstream> // class for parsing strings
#include <vector>
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TH1F.h>
#include <TF1.h>
#include <TCanvas.h>
#include <TPaveStats.h>
#include <TPad.h>
#include <TMath.h>
#include <TStyle.h>
#include <TSystem.h>
#include <TLegend.h>
#include <TString.h>
#include <TGraph.h>
#include <TLatex.h>
#include <unistd.h>
#define GetCurrentDir getcwd
#include <TTree.h>
using namespace std;
int main(int argc, char* argv[])
{
if(argc!= 1 ) return 3;
TFile* file = TFile::Open("/Users/Fer/Documents/traajo/samples/NeroNtuples_9.root"); // TFile::Open() instead of a constructor since it works over xrootd etc.
TH1F * h1 = new TH1F("h1","Mi histograma" , 100, 0, 10);
h1 = (TH1F*)file->Get("rho");
h1->Draw();
return 0;
}
And it obviously doesn’t work.
The error I get is this
*** Break *** segmentation violation
Generating stack trace...
Someone told it me it may be my make file, but I hope it isn’t because it is a black box to me and it works for everyone else.
Thanks a lot