# Switch to CentOS7 6.18.04 from SL6 6.14.04 Causing Segmentation Violation Problem in TMVA::ROCCalc

**URL:** <https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165>\
**Category:** TMVA\
**Created:** [December 11, 2019, 5:45pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165 "2019-12-11T17:45:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![oguloncel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oguloncel/32/20692_2.png) [@oguloncel](https://root-forum.cern.ch/u/oguloncel)\
**Post date:** [December 11, 2019, 5:45pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/1 "2019-12-11T17:45:08Z")

</div>

Hi,

I recently try to switch to CentOS7 and ROOT 6.18.04 from current setup of SL6 with 6.14.04. When I try CentOS7 with 6.14.08 it works as well. But when I tried to run my code (which runs succesfully in old setup) with recommended 6.18.04 setup I am getting a Break Segmentation Violation for the line where I initiate a [TMVA::ROCCalc](https://root.cern/doc/v618/classTMVA_1_1ROCCalc.html) object:

```auto
====================================
TH1D* MVA_BDT_odd_Train_S = (TH1D*)outputFile->Get(base_path+"MVA_BDT_odd_Train_S");
TH1D* MVA_BDT_odd_Train_B = (TH1D*)outputFile->Get(base_path+"MVA_BDT_odd_Train_B");
    cout << "TEST A" << endl;
TMVA::ROCCalc *roc_odd_train = new TMVA::ROCCalc(MVA_BDT_odd_Train_S,MVA_BDT_odd_Train_B);
    cout << "TEST b" << endl;
====================================

```

The error stack is as follows:

```auto
TEST A

 ***Break*** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00002b61aabbf41c in waitpid () from /lib64/libc.so.6
#1 0x00002b61aab3cf12 in do_system () from /lib64/libc.so.6
#2 0x00002b61a5a11533 in TUnixSystem::StackTrace() () from /cvmfs/sft.cern.ch/lcg/releases/LCG_96b/ROOT/6.18.04/x86_64-centos7-gcc8-opt/lib/libCore.so
#3 0x00002b61a5a13d84 in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/sft.cern.ch/lcg/releases/LCG_96b/ROOT/6.18.04/x86_64-centos7-gcc8-opt/lib/libCore.so
#4 <signal handler called>
#5 0x00002b61a9c560c8 in TMVA::ROCCalc::ROCCalc(TH1*, TH1*) () from /cvmfs/sft.cern.ch/lcg/releases/LCG_96b/ROOT/6.18.04/x86_64-centos7-gcc8-opt/lib/libTMVA.so
#6 0x000000000040f4f9 in BDT::training(int, int, int, int, int, int, int) ()
#7 0x000000000040a57a in BDTTraining(int&, int&, int&, int&, int&, int&, int&) ()
#8 0x000000000040a296 in main ()
===========================================================
===========================================================
#5 0x00002b61a9c560c8 in TMVA::ROCCalc::ROCCalc(TH1*, TH1*) () from /cvmfs/sft.cern.ch/lcg/releases/LCG_96b/ROOT/6.18.04/x86_64-centos7-gcc8-opt/lib/libTMVA.so
#6 0x000000000040f4f9 in BDT::training(int, int, int, int, int, int, int) ()
#7 0x000000000040a57a in BDTTraining(int&, int&, int&, int&, int&, int&, int&) ()
#8 0x000000000040a296 in main ()
===========================================================

```

When switching between setups I do make clean and make sure I am using the correct lsetup commands. I am running on the local cluster with interactive condor jobs. Does anyone have any idea what the problem might be?

Thanks in advance!

Ogul

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 12, 2019, 9:33am UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/2 "2019-12-12T09:33:21Z")

</div>

Hi,

I think there is a problem retrieving the signal and background score histograms from the file.  
Are you sure that the histograms `MVA_BDT_odd_Train_S` and `TH1D* MVA_BDT_odd_Train_B` are present in `base_path`. It is possible that somewhere the location of the histogram directory has changed between the versions

Lorenzo

---

<div class="post-metadata">

**Author:** ![oguloncel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oguloncel/32/20692_2.png) [@oguloncel](https://root-forum.cern.ch/u/oguloncel)\
**Post date:** [December 12, 2019, 12:41pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/3 "2019-12-12T12:41:36Z")

</div>

Hi Lorenzo,

Thank you for the reply. This indeed is a good suggestion for a check. However, the base\_path addresses seem to be the same in both cases:

```auto
TString base_path = "/default/Method_BDT_odd/BDT_odd/";
TString base_path_even = "/default/Method_BDT_even/BDT_even/";

TH1D* MVA_BDT_odd_Train_S = (TH1D*)outputFile->Get(base_path+"MVA_BDT_odd_Train_S");
TH1D* MVA_BDT_odd_Train_B = (TH1D*)outputFile->Get(base_path+"MVA_BDT_odd_Train_B");
    cout << "TEST A" << endl;
TMVA::ROCCalc *roc_odd_train = new TMVA::ROCCalc(MVA_BDT_odd_Train_S,MVA_BDT_odd_Train_B);
    cout << "TEST b" << endl;

```

 ![Screenshot%20from%202019-12-12%2012-40-17](https://root-forum.cern.ch/uploads/default/original/3X/2/0/20628f2e936096ba4f4721c9872d5e733bb2a2a4.png)

I am not really sure why it is crushing there.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 12, 2019, 1:45pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/4 "2019-12-12T13:45:34Z")

</div>

Hi,

I have found an Issue with the ROCCalc class and I have made a PR, see

> <https://github.com/root-project/root/pull/4685>

I am not sure however this fixes your problem, since the bug I found was in the destructor.  
It would be great if you can upload your file and your macro, so I can reproduce this issue

Lorenzo

---

<div class="post-metadata">

**Author:** ![oguloncel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oguloncel/32/20692_2.png) [@oguloncel](https://root-forum.cern.ch/u/oguloncel)\
**Post date:** [December 12, 2019, 2:40pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/5 "2019-12-12T14:40:47Z")

</div>

Hi Lorenzo,

Here is a simple macro that reproduces the problem:  
[roctest.cxx](https://root-forum.cern.ch/uploads/short-url/dARPU8MEGB2gjHcNXlY5SYJroLR.cxx) (1.5 KB)

It reads the TMVA output root file from my afs public folder, to which you can access I guess?

Ogul

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 16, 2019, 2:11pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/6 "2019-12-16T14:11:09Z")

</div>

Hi,

Thank you for posting your macro. Your base path seems to be wrong and therefore the histograms pointer are null. It is always a good practise to check the return object after TFile::Get, since no error message is printed.

The correct path to use is

```auto
TString base_path = "/default/Method_BDT/BDT_odd/";

```

Lorenzo

---

<div class="post-metadata">

**Author:** ![oguloncel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oguloncel/32/20692_2.png) [@oguloncel](https://root-forum.cern.ch/u/oguloncel)\
**Post date:** [January 16, 2020, 6:04pm UTC](https://root-forum.cern.ch/t/switch-to-centos7-6-18-04-from-sl6-6-14-04-causing-segmentation-violation-problem-in-tmva-roccalc/37165/7 "2020-01-16T18:04:39Z")

</div>

Hi Lorenzo,

Thank you for the correct reply. Interestingly,

`Method_BDT_odd`

is still working in this certain version I described on the above posts. But it is

`Method_BDT`

for the same setup when ran on LXPLUS instead of local cluster, as well as in the 6.18.04 in both machines.

Thank you once again.

Cheers,

Ogul
