RootTalk


ROOT Discussion Forums

vectors in 5.28.00

Discuss installing and running ROOT here. Please post bug reports here.

Moderator: rootdev

vectors in 5.28.00

Unread postby apinder » Wed Feb 09, 2011 14:17

Hi there,

I have recently updated my Root version to 5.28, and my compiled code, which ran fine in 5.26, now throws some mysterious errors. The problem seems to be that Root no longer recognises stl vectors as valid TBranches. So something like this:

// HEADER
vector<float>* b_jetHad_pt;

// IMPLEMENTATION
b_jetHad_pt = new vector<float>;
oxsusy->Branch("jetHad_pt",&b_jetHad_pt); // oxsusy is the name of my TTree

Used to be valid, but now I get errors at runtime:

Error in <TTree::Branch>: The pointer specified for jetHad_pt is not of a class known to ROOT

I am doing #include <vector> at the top of my header file. As I say, this worked fine in the old release (I can't keep using 5.26 for unrelated reasons). As a check I just went back and ran my code under 5.26 (without changing anything) and it worked beautifully. Any ideas?

Thanks,

Alex
apinder
 
Posts: 7
Joined: Wed Feb 09, 2011 12:45

Re: vectors in 5.28.00

Unread postby apinder » Fri Feb 11, 2011 13:04

Hi again,

Has anyone had a chance to look into this? Is it a problem with my local build (in which case I'm hoping someone can suggest what the problem might be)? A feature? Otherwise, it would appear to be a pretty major bug.

Thanks,

Alex
apinder
 
Posts: 7
Joined: Wed Feb 09, 2011 12:45

Re: vectors in 5.28.00

Unread postby Axel » Tue Feb 15, 2011 11:43

Hi,

can you re-rty with the tip of the branch v5-28-00-patches? If that fails, too (or if you are unable to test with that version of ROOT): can you send a little standalone test case that reproduces the error?

Cheers, Axel.
User avatar
Axel
 
Posts: 2008
Joined: Wed Sep 03, 2003 21:35
Location: CERN

Re: vectors in 5.28.00

Unread postby apinder » Wed Feb 16, 2011 19:00

Hi Axel,

Thanks very much for getting back!

I am unable to get a more recent patch of Root, either on lxplus or locally, so I made a little program that reproduces the problem. Use the following makefile to make the attached source file:

"""

ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
INCLUDES = -I $(ROOTSYS)/include

CC = g++
CCFLAGS = -fpic -g -Wall -O3

default:
$(CC) $(CCFLAGS) Root528Test.C $(INCLUDES) $(ROOTLIBS) -o Root528Test

"""

Interestingly, it seems only vectors of floats are affected. The first time I tried this test program, I had a vector of integers instead, and it worked fine.

Thanks again,

Alex
Attachments
Root528Test.C
(497 Bytes) Downloaded 79 times
apinder
 
Posts: 7
Joined: Wed Feb 09, 2011 12:45

Re: vectors in 5.28.00

Unread postby apinder » Wed Feb 16, 2011 19:31

Quick update to the above.

Annoyingly, this example also breaks under Root 5.26.00, whereas my original code (which is obviously much more complex) works fine under 5.26 and fails under 5.28. So the example kind of undermines the problem I was trying to highlight!

Anyway, my colleague has just suggested using vectors of doubles instead of floats. Tried that - works fine! Go figure.

Alex
apinder
 
Posts: 7
Joined: Wed Feb 09, 2011 12:45

Re: vectors in 5.28.00

Unread postby pmermod » Thu Feb 17, 2011 15:03

Hi Alex and others,

I installed root version 5.28 on my new laptop and I also get problems with vectors of vectors, which I don't have when running on lxplus (version 5.26).

Try the following macro:

{

gSystem->Load("libCintex.so");
Cintex::Cintex::Enable();

#include "Rtypes.h"
#include<vector>

vector<vector<int>> i;

}

The last command gives me an error message with version 5.28:

Warning in <ACLiC>: Failed to generate the dependency file for /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_vector_vector_int_allocator_int______cxx.so
In file included from /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_vector_vector_int_allocator_int______cxx_ACLiC_dict.h:34,
from /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_vector_vector_int_allocator_int______cxx_ACLiC_dict.cxx:17:
/home/phil/MyCode/SYNTcode/testana/macros/AutoDict_vector_vector_int_allocator_int_____.cxx:2: fatal error: prec_stl/vector: No such file or directory
compilation terminated.
g++: /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_vector_vector_int_allocator_int______cxx_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!
Warning in <ACLiC>: Failed to generate the dependency file for /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_random_access_iterator_vector_int_allocator_int____long__cxx.so
In file included from /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_random_access_iterator_vector_int_allocator_int____long__cxx_ACLiC_dict.h:34,
from /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_random_access_iterator_vector_int_allocator_int____long__cxx_ACLiC_dict.cxx:17:
/home/phil/MyCode/SYNTcode/testana/macros/AutoDict_random_access_iterator_vector_int_allocator_int____long_.cxx:2: fatal error: prec_stl/vector: No such file or directory
compilation terminated.
g++: /home/phil/MyCode/SYNTcode/testana/macros/AutoDict_random_access_iterator_vector_int_allocator_int____long__cxx_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!


although my code actually runs fine despite of it:

root [1] i
(class vector<vector<int> >)151828176


Try also the following macro:

{

gSystem->Load("libCintex.so");
Cintex::Cintex::Enable();

#include "Rtypes.h"
#include<vector>

vector<vector<float>> f;
vector<float> ff;
ff.push_back(1);
f.push_back(ff);

vector<vector<double>> d;
vector<double> dd;
dd.push_back(2);
d.push_back(dd);

}


There the operation with floats works very fine, while the last command (with double) does not work:

Error: Can't call vector<vector<double,allocator<double> >,allocator<vector<double,allocator<double> > > >::push_back(dd) in current scope (tmpfile):1:
Possible candidates are...
(in vector<vector<double,allocator<double> >,allocator<vector<double,allocator<double> > > >)
*** Interpreter error recovered ***


Now my immediate problem is that I need to use vectors of vectors of double in my analysis code and there is no way I can run it on my laptop. Any idea?

Cheers
Phil
pmermod
 
Posts: 2
Joined: Thu Sep 18, 2008 11:35

Re: vectors in 5.28.00

Unread postby pmermod » Mon Feb 21, 2011 11:22

Hi,

Does anyone know if there is a solution other than playing tricks with variable types or reinstalling root in an older version?

Cheers
Phil
pmermod
 
Posts: 2
Joined: Thu Sep 18, 2008 11:35

Re: vectors in 5.28.00

Unread postby Pepe Le Pew » Mon Feb 21, 2011 13:48

I believe you've found a real bug in cint. And I believe Alex will take care of it ... just needs time.
I also get problems (reported by you) when I do:

root [0] #include <vector>
root [1] vector< vector <int> > i

and/or when I do:

root [0] #include <vector>
root [1] vector<vector<double>> d;
root [2] vector<double> dd;
root [3] dd.push_back(2);
root [4] d.push_back(dd);

A similar issue involving "vector< pair<> >" has been reported here: http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=12174

(ROOT 5.28/00a - v5-28-00-patches, checked out revision 38187 on 2011.02.21 at about 18:03 UTC, Ubuntu 10.04.2 LTS i686, gcc 4.4.3)
Pepe Le Pew
 
Posts: 1174
Joined: Sat Oct 17, 2009 14:00

Re: vectors in 5.28.00

Unread postby Axel » Tue Mar 01, 2011 14:24

Hi,

Sorry - I just saw this now! I will look into it tomorrow.

Axel.
User avatar
Axel
 
Posts: 2008
Joined: Wed Sep 03, 2003 21:35
Location: CERN

Re: vectors in 5.28.00

Unread postby Axel » Wed Mar 02, 2011 11:42

Hi,

vector<vector<int> > and vector<vector<double> > are now fixed in the trunk and v5-28-00-patches (will become part of v5.28b); thanks for your reports! FYI, these two bugs were caused by completely different problems, which explains why they were behaving so differently.

Cheers, Axel.

[Note: It will show up in 5.28b, in my original version I unfortunately misspelled that as 5.28a.]
User avatar
Axel
 
Posts: 2008
Joined: Wed Sep 03, 2003 21:35
Location: CERN

Re: vectors in 5.28.00

Unread postby SebastianSchmitt » Wed Jul 13, 2011 10:46

Hi!

I get the problem with vector<vector<int>> again in 5.30.00:

Error: Invalid type 'vector<vector<int>' in declaration of '>'

having a tree with that type while compiling (.L) the class generated with MakeSelector.

Could you please check?

Thanks,

Sebastian
SebastianSchmitt
 
Posts: 53
Joined: Mon May 18, 2009 16:25

Re: vectors in 5.28.00

Unread postby pcanal » Wed Jul 13, 2011 16:44

Hi,

The problem described in the earlier part of this thread are still working in v5.30. You are likely to have a different problem. I recommend that you open a new thread and given more information about the issue you are encountering.

Cheers,
Philippe.
pcanal
 
Posts: 6288
Joined: Wed Aug 27, 2003 14:22
Location: Fermilab

Re: vectors in 5.28.00

Unread postby SebastianSchmitt » Mon Jul 18, 2011 8:28

Hi,

Thanks. I opened a new thread: http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=13117

Best regards,

Sebastian
SebastianSchmitt
 
Posts: 53
Joined: Mon May 18, 2009 16:25

Re: vectors in 5.28.00

Unread postby henryjonas » Wed Mar 06, 2013 12:59

SebastianSchmitt wrote:Hi,

Thanks. I opened a new thread: http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=13117

Best regards,

Sebastian


Thanks Seb, the code to resolve this is:

Code: Select all
gInterpreter->GenerateDictionary("vector<pair<double, double> >","vector");
Henry
henryjonas
 
Posts: 1
Joined: Tue Feb 26, 2013 20:30


Return to ROOT Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests