Yosemite 10.10.2, Xcode 6.1.1, Atos -d issue

I am now facing an other issue, trying to run a “production” analysis code written on ROOT version 5.
I get many errors and I do not understand why.

Following is a sample of the code.

// Travail sur l’etalonnage YAP
// On selectionne les evenements ayant declenche la voie 5
TCut YInPMT5 = “Amp[5]<(-10*SigLB[5])” ; // Seuil a 10 sigma

HHeader = "Etalonnage YAP ";
TCanvas *c11 = new TCanvas(“c11”, HHeader.c_str(), 10, 10, 1200, 800);
c11->Divide(2,2);

c11->cd(1);
TH1F hYAPAmp_Cut(“HistAmpYAPCutPMT5”, “Spectre YAP Amp Cut PMT5”, 200, -0.5, 0.);
te->Draw(“Amp[0]>>HistAmpYAPCutPMT5”, YInPMT5);
hYAPAmp_Cut.Fit(“gaus”,“R”,"", -0.15, -0.1);
// On calcule la constante Etalonnage YAP Amp
double FitRes_YAPAmp511;
{ TF1 *fit = hYAPAmp_Cut.GetFunction(“gaus”);
FitRes_YAPAmp511= fit->GetParameter(1);
}
double CalVal_YAPAmp= 511./FitRes_YAPAmp511; //keV/Volt
StrRes<<“Constante Calibration YAP: keV/volt\n” << CalVal_YAPAmp << endl;
cout <<“Constante Calibration YAP: keV/volt\n” << CalVal_YAPAmp << endl;

// Up to now it works :slight_smile:

// On affiche le spectre etalonne et on fitte la resolution en energie
TH1F hYAP_Energ(“hYAP_Amp_keV”,“Spectre YAP Amp Cut PMT5”, 200, 0., 1000.);
char CalVal[10]; sprintf(CalVal, “%f”, CalVal_YAPAmp);
string toto = CalVal; toto += “*Amp[0]>>hYAP_Amp_keV”; cout<< toto << endl;
te->Draw(toto.c_str(),YInPMT5);

// There I get:
Constante Calibration YAP: keV/volt
-4339.94
-4339.944165*Amp[0]>>hYAP_Amp_keV

*** Break *** segmentation violation
Generating stack trace…
[invalid usage]: unrecognized option '-d’
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address …]
0x0000000112594c36 in _ZN13TSelectorDraw5BeginEP5TTree + 0x1166 from /Volumes/AliBaba/Codes/ExternLib/root/lib/libTreePlayer.so
[invalid usage]: unrecognized option '-d’
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address …]
0x00000001125c40f5 in _ZN11TTreePlayer7ProcessEP9TSelectorPKcxx + 0x95 from /Volumes/AliBaba/Codes/ExternLib/root/lib/libTreePlayer.so
[invalid usage]: unrecognized option '-d’
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address …]
0x00000001125bd23a in _ZN11TTreePlayer10DrawSelectEPKcS1_S1_xx + 0x78a from /Volumes/AliBaba/Codes/ExternLib/root/lib/libTreePlayer.so
[invalid usage]: unrecognized option '-d’
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address …]
0x00000001088b3d62 in main + 0xf22 from /Volumes/AliBaba/Codes/DO2Analyse/.//AnalyseDO2Exe
[invalid usage]: unrecognized option '-d’
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address …]
0x00007fff8b6715c9 in start + 0x1 from /usr/lib/system/libdyld.dylib

Can you help me?

Best regards

Of course a piece of code we could run would help…

Same problem, also OS X 10.10.2, ROOT 6.02/04.
It happens when there is a segmentation fault (or other error signal), when cling tries to generate a stack trace.

For example when entering

Hi,

That’s a known bug; see sft.its.cern.ch/jira/browse/ROOT-7002

Cheers, Axel.

Thanks for your answers.
Do you kwony way to avoid this bug?
best regards

Hi,

Well - your code crashes; what you see is a consequence of that crash. By removing the bug that causes the crash (likely in TSelectorDraw::Begin(TTree*) thus likely in the expression toto of te->Draw(toto.c_str(),YInPMT5)) you should not see the atos errors anymore.

Cheers, Axel.

Good afternoon,
I checked the expression of toto.c_str() in the code and its value (shown above) is :
-4339.944165*Amp[0]>>hYAP_Amp_keV

Then the code: te->Draw(toto.c_str(),YInPMT5);
looks like correct and has been used to run in production when compiled and run with the previous version sof the MacOSX system and Xcode.

It is very similar to the code used few lines above, that works :
te->Draw(“Amp[0]>>HistAmpYAPCutPMT5”, YInPMT5)

And this crash behavior repeat several time in the following work of the same production code.
That is why I am disoriented.
Best
Dominique

[quote=“Axel”]Hi,

Well - your code crashes; what you see is a consequence of that crash. By removing the bug that causes the crash (likely in TSelectorDraw::Begin(TTree*) thus likely in the expression toto of te->Draw(toto.c_str(),YInPMT5)) you should not see the atos errors anymore.

Cheers, Axel.[/quote]

[quote=“Axel”]Hi,

Well - your code crashes; what you see is a consequence of that crash. By removing the bug that causes the crash (likely in TSelectorDraw::Begin(TTree*) thus likely in the expression toto of te->Draw(toto.c_str(),YInPMT5)) you should not see the atos errors anymore.

Cheers, Axel.[/quote]

Dear Axel,
looking at the code once more, I realized that -4339.944165 exceeded the length booked in with

char CalVal[10];
Thus the sprintf call was likely to mess the memory content. Going to :
char CalVal[20];
The code does not crash anymore.
Thanks for guiding me on this point.
Best Regards
Dominique