# Vectors in 5.28.00

**URL:** <https://root-forum.cern.ch/t/vectors-in-5-28-00/11846>\
**Category:** ROOT\
**Created:** [February 9, 2011, 1:17pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846 "2011-02-09T13:17:57Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![apinder](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@apinder](https://root-forum.cern.ch/u/apinder)\
**Post date:** [February 9, 2011, 1:17pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/1 "2011-02-09T13:17:57Z")

</div>

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\* b\_jetHad\_pt;

// IMPLEMENTATION  
b\_jetHad\_pt = new vector;  
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 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

---

<div class="post-metadata">

**Author:** ![apinder](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@apinder](https://root-forum.cern.ch/u/apinder)\
**Post date:** [February 11, 2011, 12:04pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/2 "2011-02-11T12:04:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [February 15, 2011, 10:43am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/3 "2011-02-15T10:43:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![apinder](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@apinder](https://root-forum.cern.ch/u/apinder)\
**Post date:** [February 16, 2011, 6:00pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/4 "2011-02-16T18:00:58Z")

</div>

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  
[Root528Test.C](https://root-forum.cern.ch/uploads/default/original/2X/1/1e27501546bb7ae740d00b87ce4c7bea684d3023.C) (497 Bytes)

---

<div class="post-metadata">

**Author:** ![apinder](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@apinder](https://root-forum.cern.ch/u/apinder)\
**Post date:** [February 16, 2011, 6:31pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/5 "2011-02-16T18:31:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pmermod](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f4b2a3/32.png) [@pmermod](https://root-forum.cern.ch/u/pmermod)\
**Post date:** [February 17, 2011, 2:03pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/6 "2011-02-17T14:03:19Z")

</div>

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:

[quote]{

gSystem-\>Load(“[libCintex.so](http://libCintex.so)”);  
Cintex::Cintex::Enable();

#include “Rtypes.h”  
#include

vector\<vector\> i;

}  
[/quote]  
The last command gives me an error message with version 5.28:

[quote]Warning in : 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 : Compilation failed!  
Warning in : 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 : Compilation failed!  
[/quote]

although my code actually runs fine despite of it:

[quote]root [1] i  
(class vector\<vector \>)151828176  
[/quote]

Try also the following macro:

[quote]{

gSystem-\>Load(“[libCintex.so](http://libCintex.so)”);  
Cintex::Cintex::Enable();

#include “Rtypes.h”  
#include

vector\<vector\> f;  
vector ff;  
ff.push\_back(1);  
f.push\_back(ff);

vector\<vector\> d;  
vector dd;  
dd.push\_back(2);  
d.push\_back(dd);

}[/quote]

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

[quote]Error: Can’t call vector\<vector\<double,allocator \>,allocator\<vector\<double,allocator \> \> \>::push\_back(dd) in current scope (tmpfile):1:  
Possible candidates are…  
(in vector\<vector\<double,allocator \>,allocator\<vector\<double,allocator \> \> \>)  
\*\*\* Interpreter error recovered \*\*\*  
[/quote]

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

---

<div class="post-metadata">

**Author:** ![pmermod](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f4b2a3/32.png) [@pmermod](https://root-forum.cern.ch/u/pmermod)\
**Post date:** [February 21, 2011, 10:22am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/7 "2011-02-21T10:22:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [February 21, 2011, 12:48pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/8 "2011-02-21T12:48:31Z")

</div>

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   
root [1] vector\< vector \> i

and/or when I do:

root [0] #include   
root [1] vector\<vector\> d;  
root [2] vector dd;  
root [3] dd.push\_back(2);  
root [4] d.push\_back(dd);

A similar issue involving “vector\< pair\<\> \>” has been reported here: [url][Vector\< pair\<\> \>](https://root-forum.cern.ch/t/vector-pair/11896/1)

(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)

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [March 1, 2011, 1:24pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/9 "2011-03-01T13:24:57Z")

</div>

Hi,

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

Axel.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [March 2, 2011, 10:42am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/10 "2011-03-02T10:42:25Z")

</div>

Hi,

vector\<vector \> and vector\<vector \> 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.]

---

<div class="post-metadata">

**Author:** ![SebastianSchmitt](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/58f4c7/32.png) [@SebastianSchmitt](https://root-forum.cern.ch/u/SebastianSchmitt)\
**Post date:** [July 13, 2011, 9:46am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/11 "2011-07-13T09:46:18Z")

</div>

Hi!

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

Error: Invalid type ‘vector\<vector’ in declaration of ‘\>’

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

Could you please check?

Thanks,

Sebastian

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [July 13, 2011, 3:44pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/12 "2011-07-13T15:44:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SebastianSchmitt](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/58f4c7/32.png) [@SebastianSchmitt](https://root-forum.cern.ch/u/SebastianSchmitt)\
**Post date:** [July 18, 2011, 7:28am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/13 "2011-07-18T07:28:09Z")

</div>

Hi,

Thanks. I opened a new thread: [url][MakeSelector TTree gives: Invalid type vector\<vector\<int\>](https://root-forum.cern.ch/t/makeselector-ttree-gives-invalid-type-vector-vector-int/12780/1)

Best regards,

Sebastian

---

<div class="post-metadata">

**Author:** ![henryjonas](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@henryjonas](https://root-forum.cern.ch/u/henryjonas)\
**Post date:** [March 6, 2013, 11:59am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/14 "2013-03-06T11:59:35Z")

</div>

[quote=“SebastianSchmitt”]Hi,

Thanks. I opened a new thread: [url][MakeSelector TTree gives: Invalid type vector\<vector\<int\>](https://root-forum.cern.ch/t/makeselector-ttree-gives-invalid-type-vector-vector-int/12780/1)

Best regards,

Sebastian[/quote]

Thanks Seb, the code to resolve this is:

Code: Select all  
gInterpreter-\>GenerateDictionary(“vector\<pair\<double, double\> \>”,“vector”);

---

<div class="post-metadata">

**Author:** ![fenkerbb](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/94ad74/32.png) [@fenkerbb](https://root-forum.cern.ch/u/fenkerbb)\
**Post date:** [January 17, 2014, 11:14pm UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/15 "2014-01-17T23:14:35Z")

</div>

First, thanks for the solution to this problem. When I implement this, ROOT creates three files (.cxx, .d, .so) in the directory where I started ROOT. Is there an elegant way to avoid this clutter? I suppose one way to do it would be in rootlogoff.C but I’m looking for a better way ![8)](https://root-forum.cern.ch/uploads/default/original/1X/fe5f42ae79e389360ae9d969db4dcc4bca03d384.gif "Cool")

The files in my particular case are:

```auto
AutoDict_vector_pair_double __double___.cxx
AutoDict_vector_pair_double __double___.so
AutoDict_vector_pair_double __double___.d
```

Thanks in advance!

(Will cling in ROOT 6 fix this issue altogether?)

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [January 18, 2014, 12:18am UTC](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/16 "2014-01-18T00:18:36Z")

</div>

Hi,

yes, ROOT 6 fixes the issue (with no temporary files).

All the files produced in this scheme will start with AutoDict\_ (So AutoDict\_\*.[cxx|so|d])

Cheers,  
Philippe.
