Vector.clear gives Error: Symbol G__exception is not defined

Hi

I have a macro that looks like this:

void runMyAnalysis()
{
gSystem->Load(“libPhysics.so”);
gSystem->cd("/mnt/data/macros/");
gROOT->ProcessLine(".L loader.C+");
gSystem->CompileMacro(“style.cpp”, “k”);
gSystem->CompileMacro(“Util.cpp”, “k”);
gSystem->CompileMacro(“JetMetbTriggerTree.C”, “k”);
gSystem->CompileMacro(“AnalysisBase.cxx”, “k”);
gSystem->CompileMacro(“Analysis.cxx”, “k”);
gSystem->CompileMacro(“GetTChainFromDirectory.C”,“k”);

Analysis *Algs = new Analysis(chain_mbias,verbose);
Algs->fillRates();
}

which I run with root -q -l

I added one line in the AnalysisBase class that looks like this:
myvector.clear();

which breaks the code:
Error: Symbol G__exception is not defined in current scope /mnt/data/susyanalysis/user09.JoshuaGodfreyCogan.mLSP175_mGLU200.5/.
/runTriggerPlots_susy.C:99:
Error: type G__exception not defined FILE:/mnt/data/susyanalysis/user09.JoshuaGodfreyCogan.mLSP175_mGLU200.5/./runTriggerPlots_s
usy.C LINE:99
*** Interpreter error recovered ***

Looks like I am missing something wrt STL?
In loader.C I have the following:

#include
#ifdef MAKECINT
#pragma link C++ class vector<vector >+;
#pragma link C++ class vector<vector >+;
#pragma link C++ class vector<vector >+;
#pragma link C++ class vector<vector >+;
#pragma link C++ class vector+;
#pragma link C++ class vector+;
#pragma link C++ class vector+;
#endif

Can someone please help?

Ignacio

Hi,

this is usually a sign of a bug in your code. Can you run with a debugger? It could be that after you clear() the vector you access an element that’s out of bounds.

Cheers, Axel.

Hi Axel

I tried to attach the pid to gdb, but that reported nothing useful.
The crash happens on the third event.

The problematic function does something like this:

void TriggerRateAnalysisBase::getOfflineJets(TString jetType)
{

std::cout << "jet px size = " << m_jetPx.size() << std::endl;
if(m_jetPx.size()!=0)
m_jetPx.clear();

int jetnum = JETC4TOWER_num;
for(int j=0;j<jetnum;j++){
m_jetPx.push_back(JETC4TOWER_px->at(j));
}

}

where m_jetPx is vector and defined in the header file as a public data member. I am using root 5.22.0

Ignacio

Ok, it was indeed a bug in my code. Sorry for the spam.

Ignacio