I am trying to run this macro that takes histograms from files, scales them and adds them together. The files are called dyj70_100.root, dyj100_200.root and so on. Each file contains a histogram called lh_jetpt that I want to scale and add. The code is below:
Float_t sigma70 = 1.47E02;
Float_t sigma100 = 1.61E02;
Float_t sigma200 = 4.86E01;
Float_t sigma400 = 6.98;
Float_t sigma600 = 1.95;
Float_t sigma800 = 8.05E-01;
Float_t sigma1200 = 1.93E-01;
Float_t sigma2500 = 3.48E-03;
TFile* bin70_100 = new TFile("dyj70_100hist.root");
TH1F* hist70_100;
gDirectory->GetObject("lh_jetpt", hist70_100);
bin70_100->Close();
TFile* bin100_200 = new TFile("dyj100_200hist.root");
TH1F* hist100_200;
gDirectory->GetObject("lh_jetpt", hist100_200);
bin100_200->Close();
TFile* bin200_400 = new TFile("dyj200_400hist.root");
TH1F* hist200_400;
gDirectory->GetObject("lh_jetpt", hist200_400);
bin200_400->Close();
TFile* bin400_600 = new TFile("dyj400_600hist.root");
TH1F* hist400_600;
gDirectory->GetObject("lh_jetpt", hist400_600);
bin400_600->Close();
TFile* bin600_800 = new TFile("dyj600_800hist.root");
TH1F* hist600_800;
gDirectory->GetObject("lh_jetpt", hist600_800);
bin600_800->Close();
TFile* bin800_1200 = new TFile("dyj800_1200hist.root");
TH1F* hist800_1200;
gDirectory->GetObject("lh_jetpt", hist800_1200);
bin800_1200->Close();
TFile* bin800_1200 = new TFile("dyj800_1200hist.root");
TH1F* hist800_1200;
gDirectory->GetObject("lh_jetpt", hist800_1200);
bin800_1200->Close();
TFile* bin1200_2500 = new TFile("dyj1200_2500hist.root");
TH1F* hist1200_2500;
gDirectory->GetObject("lh_jetpt", hist1200_2500);
bin1200_2500->Close();
TFile* bin2500_inf = new TFile("dyj2500_infhist.root");
TH1F* hist2500_inf;
gDirectory->GetObject("lh_jetpt", hist2500_inf);
bin2500_inf->Close();
hist70_100->Scale(sigma70);
hist100_200->Scale(sigma100);
hist200_400->Scale(sigma200);
hist400_600->Scale(sigma400);
hist600_800->Scale(sigma600);
hist800_1200->Scale(sigma800);
hist1200_2500->Scale(sigma200);
hist2500_inf->Scale(sigma2500);
TH1F *histallbins = (TH1F*)hist70_100->Clone("histallbins");
histallbins->Add(hist100_200);
histallbins->Add(hist200_400);
histallbins->Add(hist400_600);
histallbins->Add(hist600_800);
histallbins->Add(hist800_1200);
histallbins->Add(hist1200_2500);
histallbins->Add(hist2500_inf);
}
I get this error:
*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/anaconda3/lib/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)
[/anaconda3/lib/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/anaconda3/lib/libCling.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/anaconda3/lib/libCling.so] cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) (no debug info)
[/anaconda3/lib/libCling.so] cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/anaconda3/lib/libCling.so] cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/anaconda3/lib/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/anaconda3/lib/libCling.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/anaconda3/lib/libCling.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/anaconda3/lib/libCling.so] TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (no debug info)
[/anaconda3/lib/libCore.6.18.so] TApplication::ExecuteFile(char const*, int*, bool) (no debug info)
[/anaconda3/lib/libRint.6.18.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/anaconda3/lib/libRint.6.18.so] TRint::Run(bool) (no debug info)
[/anaconda3/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)