I have a very strange problem…
I am reading a TTree containing a std::vector (and other stuff).
So I am trying to read this with a code as simple as possible…
see the code below…
what is puzzling to me, is that it run without any problems if I run the code with CINT (“root -l Test.C”).
But when I compile the code before runing it crashes at the GetEntry line. (“root -l Test.C++”).
In advance, thanks for help
Loic,
//I SKIP THE INCLUDES
void Test(){
TChain* tree = new TChain(“shallowTree/tree”);
tree->Add(“tree.root”);
[quote]But when I compile the code before runing it crashes at the GetEntry line. (“root -l Test.C++”).
[/quote]In some case CINT and the compiler are behaving differently, in particular in the cases where the behavior is ‘undefined’ by the C++ standard; for example when variable are not initialized:[quote]std::vector* charge;
tree->SetBranchAddress(“GainCalibrationcharge”, &charge, NULL); [/quote]
So usestd::vector<unsigned int>* charge = 0;
tree->SetBranchAddress("GainCalibrationcharge", &charge, NULL);
[quote]How may I define charge as a vector instead of a pointer on it?
[/quote]This is currently only supported via the cumbersome:
std::vector<unsigned int> charge;
std::vector<unsigned int> *charge_ptr = &charge;