I am running a root macro on the cluster using bsub. The files I use to do this are located in https://github.com/mjukilop/PYTHIA_HYDJET/tree/dev. I run the lxplusbatchscript with a few arguments which calls submit.sh which runs macro.c.
The section of code in macro.c which is giving me trouble is this:
// Clear the vectors used in the last event
if (ii != 0) {
std::vector<int, allocator<int> >::iterator begin = pf.muonPosition->begin(), end = pf.muonPosition->end();
pf.muonPosition->erase(begin, end);
cout << "erased\n";
pf.muonPosition->clear();
pf.muonPairPosition->clear();
pf.muonExclusion->clear();
}
Which returns:
Error: Can't call vector<int,allocator<int> >::erase(begin,end) in current scope macro.c:443:
Possible candidates are...
public: void vector<int,allocator<int> >::erase(vector<int,allocator<int> >::iterator position);
public: void vector<int,allocator<int> >::erase(vector<int,allocator<int> >::iterator first,vector<int,allocator<int> >::iterator last);
*** Interpreter error recovered ***
counters set
with the full output in STDOUT attached. When instead I have the erase code commented:
// Clear the vectors used in the last event
if (ii != 0) {
// std::vector<int, allocator<int> >::iterator begin = pf.muonPosition->begin(), end = pf.muonPosition->end();
// pf.muonPosition->erase(begin, end);
cout << "erased\n";
pf.muonPosition->clear();
pf.muonPairPosition->clear();
pf.muonExclusion->clear();
}
I get the error:
counters set
0
Warning: wrong member access operator '.' macro.c:461:
Warning: wrong member access operator '.' macro.c:471:
Warning: Automatic variable motherPtEMP is allocated macro.c:510:
Warning: wrong member access operator '.' macro.c:526:
Warning: wrong member access operator '.' macro.c:527:
Warning: wrong member access operator '.' macro.c:528:
Warning: wrong member access operator '.' macro.c:532:
cleared
counters set
0
*** Break *** segmentation violation
erased
with the entire crash output in STDOUT2 attached.
Changing the access operator on those lines to -> gives the same warning: Warning: wrong member access operator ‘->’ macro.c
I have no idea why this is happening. While I will attempt to rewrite my code such that I do not need to pass vectors to this function I may have need to access the same vector in another function at a later time.
Can anyone see what is happening?
Thanks
STDOUT2.txt (10.5 KB)
STDOUT.txt (32.3 KB)