Ameen
February 16, 2017, 11:57pm
1
Hi All,
I am using ROOT 5.34.21 and in my script I am calling the Lester MT2 code which calculates MT2. Running the script results in a seg fault. I tracked the error until I found the function in the MT2 code causing it:
double lesterFactor(const EllipseParams & e2) const {
const EllipseParams & e1 = this;
const double ans = e1.c_xx e1.c_yye2.c + 2.0 e1.c_xye1.c_y e2.c_x - 2.0e1.c_x e1.c_yye2.c_x + e1.c e1.c_yye2.c_xx - 2.0 e1.ce1.c_xy e2.c_xy + 2.0e1.c_x e1.c_ye2.c_xy + 2.0 e1.c_xe1.c_xy e2.c_y - 2.0e1.c_xx e1.c_ye2.c_y + e1.c e1.c_xxe2.c_yy - e2.c_yy (e1.c_xe1.c_x) - e2.c (e1.c_xye1.c_xy) - e2.c_xx (e1.c_y*e1.c_y);
return ans;
}
If I remove the reference “&” from “const EllipseParams & e2”, it works but becomes very very slow.
I don’t know if the information I provided is enough for someone to figure out what’s going on, but the code is huge and I’ve been battling with it for some time. I will gladly supply additional information if needed.
Thanks in advance.
Best,
Amin
P.S. I am using this dated version since I am having trouble running my scripts on ROOT 6.
Danilo
February 17, 2017, 5:58am
2
Hi Amin,
running external code on ROOT6 is much easier and should be seamless: import header, load library, call functions. What is the is exact issue you have with ROOT6?
Danilo
Try to use:
double lesterFactor(const EllipseParams e2) const {
const EllipseParams e1 = this;
double ans = e1->c_xx e1->c_yy e2->c + …
and then call your function using “lesterFactor(& some_e2)”.
Ameen
February 17, 2017, 4:41pm
4
Hi Danillo,
Thank you very much for the reply. I will try your suggestion for the function.
ROOT 6 yells at me every time I run a script. It gives this error:
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/deltaPhi.C:1:8: error: redefinition of 'deltaPhi’
double deltaPhi(double Phi1, double Phi2) {
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/deltaPhi.C:1:8: note: previous definition is here
double deltaPhi(double Phi1, double Phi2) {
^
In file included from input_line_8:1:
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:43:18: warning: result of comparison against a string literal is
unspecified (use strncmp instead) [-Wstring-compare]
if(signalfile!="") {
^ ~~
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:45:14: error: array initializer must be an initializer list
char files[NFILES][100] = signalfile;
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:49:28: error: use of undeclared identifier 'bg_header_num_files’
const int NFILES = bg_header_num_files;
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:54:28: error: use of undeclared identifier 'NFILES’
for(int ifile=0; ifile<NFILES; ++ifile) {
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:55:22: warning: result of comparison against a string literal is
unspecified (use strncmp instead) [-Wstring-compare]
if(signalfile=="") {
^ ~~
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:56:20: error: use of undeclared identifier 'files’
strcpy(files[ifile],bg_header_file_names[ifile]);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:56:33: error: use of undeclared identifier 'bg_header_file_names’
strcpy(files[ifile],bg_header_file_names[ifile]);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:57:13: error: use of undeclared identifier 'weights’
weights[ifile] = bg_header_weights[ifile];
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:57:30: error: use of undeclared identifier 'bg_header_weights’
weights[ifile] = bg_header_weights[ifile];
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:60:34: error: use of undeclared identifier 'files’
sprintf(inroot,"%s.root",files[ifile]);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:66:49: error: use of undeclared identifier 'files’
sprintf(outrootname,"%s.%s_%i.root",files[ifile],srname,iSR+1);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:109:13: error: unknown type name 'MissingET’
MissingET met = (MissingET ) branchMissingET->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:109:31: error: use of undeclared identifier 'MissingET’
MissingET met = (MissingET ) branchMissingET->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:109:41: error: expected expression
MissingET met = (MissingET ) branchMissingET->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:116:13: error: unknown type name 'Jet’
Jet jet1 = (Jet ) branchJet->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:116:26: error: use of undeclared identifier 'Jet’
Jet jet1 = (Jet ) branchJet->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:116:30: error: expected expression
Jet jet1 = (Jet ) branchJet->At(0);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:127:17: error: unknown type name 'Jet’
Jet jeti = (Jet ) branchJet->At(ijet);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:127:30: error: use of undeclared identifier 'Jet’
Jet jeti = (Jet ) branchJet->At(ijet);
^
/home/amin/Documents/Physics/MG5_aMC_v2_4_2/bin/345.68.394.287.3690.10/Events/run_01/./SR_1tABC.C:127:34: error: expected expression
Jet jeti = (Jet ) branchJet->At(ijet);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
ROOT 5.34 has no problem with it. I don’t know why that is the case.
Hope you can help.
Thanks again.
Amin
Danilo
February 18, 2017, 1:19pm
5
Hi Amin,
to me the error messages are rather clear (they are standard compiler warning and errors). For example you have the deltaPhi function defined twice, you are comparing const char* variables to the literal “”…
Cheers,
D
Ameen
February 18, 2017, 9:33pm
6
Thanks Danillo.
I’m working on fixing those errors!
Best,
Amin