Hi,
looks I also have similar error output
My code is running without crash in my computer, but when I am trying to run it in
lab’s machines it again crashes at some point of the loop.
If you interested, the code is quoted
#include <TF1.h>
#include <TF2.h>
#include <TH1D.h>
#include <TH2D.h>
#include <cmath>
#include <ctime>
#include <TFile.h>
#include <sys/time.h>
#include <kin_funcs.h>
#include <cross_sections.h>
using namespace std;
int main()
{
const int n_Q2 = 100;
const int n_s = 100;
const int n_t = 5;
const double deg2rad = 1.74532925199432955e-02;
double ma = 0.; //incoming photon mass (GeV)
double mb = 0.938; //target masss (GeV)
double m1 = sqrt(4.6); //Timelike photon mass (GeV)
double m2 = 0.938; //recoil proton mass (GeV)
const int n_tbins = 4;
const int n_phi_bins = 12;
const int n_th_bins = 8;
double t_edges_[n_tbins + 1] = {-0.1, -0.2, -0.35, -0.55, -0.8}; // This is a random choise of t bins
double phi_edges_[n_phi_bins + 1] = {0., 30., 60., 90., 120., 150., 180., 210., 240., 270., 300., 330., 360.};
double th_edges_[n_th_bins + 1] = {0., 22.5, 45., 67.5, 90., 112.5, 135., 157.5, 180.};
const double Eg_min = 2;
const double Eg_max = 5.76;
const double s_min = mb*(mb + 2*Eg_min);
const double s_max = mb*(mb + 2*Eg_max);
const double ds = (s_max - s_min)/double(n_s);
const double Q2_min = 1.05;
TFile *file_out = new TFile("BH_estimate.root", "Recreate");
// TF2 *f_BH_crs = new TF2("f_BH_crs", BH_cros_section, 0, 360, 0, 180, 4);
TF2 f_BH_crs("f_BH_crs", BH_cros_section, 0, 360, 0, 180, 4);
f_BH_crs.SetParameters(-0.29, 1.25, 5.45, -1);
f_BH_crs.Draw("colz");
TH2D *h_BH_crs = (TH2D*)f_BH_crs.GetHistogram()->Clone("h_BH_crs");
TH1D *h_delt_t = new TH1D("h_delt_t", "", 1000, 0, 1000);
timespec ts;
int counter = 0;
double s = s_min;
for( int is = 0; is < n_s; is++ )
{
double Q2_max = (sqrt(s) - mb)*(sqrt(s) - mb);
double dQ2 = (Q2_max - Q2_min)/double(n_Q2);
double Q2 = Q2_min;
for( int iQ2 = 0; iQ2 < n_Q2; iQ2++ )
{
for(int t_bin = 0; t_bin < n_tbins; t_bin++)
{
double t_min = min(T_min( ma, mb, sqrt(Q2), m2, s), t_edges_[t_bin]);
double t_max = max(T_max( ma, mb, sqrt(Q2), m2, s), t_edges_[t_bin + 1]);
double dt = (t_max - t_min)/double(n_t);
double t = t_min;
for( int it = 0; it < n_t; it++ )
{
double Eg = (s - mb*mb)/(2*mb);
f_BH_crs.SetParameters(t, Q2, Eg, -2);
// cout<<"s, Q2, t_min, t_max, t => "<<s<<"\t"<<Q2<<"\t"<<t_min<<"\t"<<t_max<<"\t"<<t<<endl;
for( int phi_bin = 10; phi_bin < 11; phi_bin++ )
{
for( int th_bin = 5; th_bin < 6; th_bin++ )
{
//clock_t t_before = clock();
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
Double_t time_before = Double_t(ts.tv_nsec);
//cout<<"timespec time before = "<<ts.tv_nsec/1e9<<endl;
f_BH_crs.Integral(phi_edges_[phi_bin], phi_edges_[phi_bin + 1],
th_edges_[th_bin], th_edges_[th_bin + 1]);
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
Double_t time_after = Double_t(ts.tv_nsec);
Double_t delt_t = time_after - time_before;
if( delt_t > 1e5 )
{
cout<<"counter = "<<counter<<" delt_t = "<<delt_t<<endl;
}
counter = counter + 1;
//cout<<"elapsed time = "<<delt_t<<endl;
h_delt_t->Fill(delt_t/1000.);
}
}
t = t + dt;
}
}
Q2 = Q2 + dQ2;
}
s = s + ds;
}
cout<<"counter ="<<counter<<endl;
h_delt_t->Write();
h_BH_crs->Write();
file_out->Close();
}
without TF2.Integral()
f_BH_crs.Integral(phi_edges_[phi_bin], phi_edges_[phi_bin + 1],
th_edges_[th_bin], th_edges_[th_bin + 1]);
It runs normally without crashing.
In the lab’s computers I have used different root versions 5.34, 5.32, 5.26, but again the same
error.
In my computer I have version 5.34.
The only difference that I think may be relevant is that I am using 32 bit Ubuntu, while in the lab system is
64 bit CentOS.
I appreciate any clue on that
Rafayel