Writing vector<vector<..> > to a tree

Dear experts,
I want to write vector<vector<…> > to a tree . The tree is defined by myself. When using root 5.26.00c-python2.6 no vector<vector< …> > variables can be written. While another version(for example 5.26.00) is used, such kind of variables can be written out.

Would you please help me figure out what’s wrong? Unfortunately, I have to use 5.26.00c-python2.6 because of running on grid.

Thanks a lot.

Best regards,
Zhaoxia

[quote=“mengzx”]Dear experts,
I want to write vector<vector<…> > to a tree . The tree is defined by myself. When using root 5.26.00c-python2.6 no vector<vector< …> > variables can be written. While another version(for example 5.26.00) is used, such kind of variables can be written out.

Would you please help me figure out what’s wrong? Unfortunately, I have to use 5.26.00c-python2.6 because of running on grid.

Thanks a lot.

Best regards,
Zhaoxia[/quote]

Add some more information. I tried an older version 5.22.00j. It works on my local computer(slc5 with afs), but not on lxplus when using the same code. (the quoted message is saying on local computer(slc5 with afs))
The error message:
Error in TTree::Branch: The pointer specified for tau_cluster_eta is not of a class or type known to ROOT

of course the always ignored messages before above error line:
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored

Thanks a lot for any help.

[quote]Error in TTree::Branch: The pointer specified for tau_cluster_eta is not of a class or type known to ROOT[/quote]indicates that you must generate, compile and load a dictionary for the class (here vector<vector<…> >).

Cheers,
Philippe.

Dear Philippe.

    Thanks a lot for your reply. But I have created a file loader.C 

In loader.C
#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<vector >+;
#pragma link C++ class vector+;
#pragma link C++ class vector+;
#endif

in my source code I have do like
#include “loader.C"
void Loop(){
gROOT->ProcessLine(”#include");
gROOT->ProcessLine(".L loader.C+");

}

As I said, the problem appears only when sourcing athena environment .

Best regards,
Zhaoxia

[quote]As I said, the problem appears only when sourcing athena environment.[/quote]Ok then the problem is likely an Athena problem due to the fact that they have a reflex dictionary for the class you need (and it interfere with the generation of the dictionary in your case.) On possible solution you have is to prepare the loader_C.so on a local machine (similar to the grid node) and to upload loader_C.so alongside your script on the grid nodes (and load it directly rather than going through ACLiC).

Cheers,
Philippe.

Another convoluted solution is to have:// loaderDictWrapper.C #ifndef __CINT__ #include "loaderDict.cxx" #endifand do#include "loader.C" void Loop(){ gROOT->ProcessLine(".! touch myloaderlinkdef.h"); gROOT->ProcessLine("rootcint -f loaderDict.cxx -c loader.C myloaderlinkdef.h"); gROOT->ProcessLine("#include<vector>"); gROOT->ProcessLine(".L loaderWrapper.C+"); }

Dear Philippe,
Thank you very much for your reply.
Sorry if I am asking so naive question.
None of your two solutions I can implemented.
For the first one, would you like to say more detailed how to do?
For the second one, would you like to tell me what’s in the related files like : loaderDict.cxx , myloaderlinkdef.h… How to include rootcint option in Makefile or somewhere?

Best regards,
Zhaoxia

[quote]For the first one, would you like to say more detailed how to do?[/quote]Well you should need run .L loader.C+ on your local machine and then in addition to loading your scrip up to the grid nodes you would need to upload loader_C.so up to the grid nodes (I do not know anything about your grid software so I can not be more specific).

[quote]For the second one, would you like to tell me what’s in the related files like : loaderDict.cxx[/quote]This file is created by rootcint and willl contains the dictionary for your classes.

[quote]myloaderlinkdef.h[/quote]is an empty file created in my example via:gROOT->ProcessLine(".! touch myloaderlinkdef.h");(really it just need to be an empty file).

[quote]How to include rootcint option in Makefile or somewhere?[/quote] I don’t know what you mean. There is no makefile here … if you need to add some customization to the call to rootcint, just go ahead of modify the string containing the word rootcint.

Cheers,
Philippe.

I have done this before asking the question. The problem is even not submitting on grid, just running locally by sourcing athena environment the vector<vector<…> > can not be written out. So I will try the second solution and feedback to you. Thanks a lot.

Best regards,
Zhaoxia

[quote]This file is created by rootcint and willl contains the dictionary for your classes.

[quote]myloaderlinkdef.h[/quote]is an empty file created in my example via:gROOT->ProcessLine(".! touch myloaderlinkdef.h");(really it just need to be an empty file).

[quote]How to include rootcint option in Makefile or somewhere?[/quote] I don’t know what you mean. There is no makefile here … if you need to add some customization to the call to rootcint, just go ahead of modify the string containing the word rootcint.

Cheers,
Philippe.[/quote]

Dear Philippe,
I am sorry for another naive question.
When I tried second solution, the error is :
Error: Symbol rootcint is not defined in current scope (tmpfile):1:
Error: Symbol floaderDict is not defined in current scope (tmpfile):1:
Error: Failed to evaluate floaderDict.cxx
Error: Symbol cloader is not defined in current scope (tmpfile):1:
Error: Failed to evaluate cloader.Cmyloaderlinkdef
Error: Failed to evaluate cloader.Cmyloaderlinkdef.h
*** Interpreter error recovered ***
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Warning in TEnvRec::ChangeValue: duplicate entry <Library.vector=vector.dll> for level 0; ignored
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C.so
In file included from /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.h:33,
from /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:16:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper.C:2:26: error: loaderDict.cxx: No such file or directory
g++: /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!
(const int)0

You see, symbol rootcint is not defined. Something I missed?

Thanks a lot for your help.
Best regards,
Zhaoxia

Hi,

There was a typo in my proposed code, it was missing ‘.!’:gROOT->ProcessLine(".! rootcint -f loaderDict.cxx -c loader.C myloaderlinkdef.h");

Cheers,
Philippe.

[quote=“pcanal”]Hi,

There was a typo in my proposed code, it was missing ‘.!’:gROOT->ProcessLine(".! rootcint -f loaderDict.cxx -c loader.C myloaderlinkdef.h");

Cheers,
Philippe.[/quote]

Dear Philippe,
Really very sorry. But it still doesn’t work for me:
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C.so
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_global0()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:154: error: redefinition of ‘void G__cpp_setup_global0()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2827: error: ‘void G__cpp_setup_global0()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_global1()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:161: error: redefinition of ‘void G__cpp_setup_global1()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2834: error: ‘void G__cpp_setup_global1()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func0()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:173: error: redefinition of ‘void G__cpp_setup_func0()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2846: error: ‘void G__cpp_setup_func0()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func1()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:178: error: redefinition of ‘void G__cpp_setup_func1()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2851: error: ‘void G__cpp_setup_func1()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func2()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:181: error: redefinition of ‘void G__cpp_setup_func2()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2854: error: ‘void G__cpp_setup_func2()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func3()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:184: error: redefinition of ‘void G__cpp_setup_func3()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2857: error: ‘void G__cpp_setup_func3()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func4()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:187: error: redefinition of ‘void G__cpp_setup_func4()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2860: error: ‘void G__cpp_setup_func4()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func5()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:190: error: redefinition of ‘void G__cpp_setup_func5()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2863: error: ‘void G__cpp_setup_func5()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func6()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:193: error: redefinition of ‘void G__cpp_setup_func6()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2866: error: ‘void G__cpp_setup_func6()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func7()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:196: error: redefinition of ‘void G__cpp_setup_func7()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2869: error: ‘void G__cpp_setup_func7()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func8()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:199: error: redefinition of ‘void G__cpp_setup_func8()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2872: error: ‘void G__cpp_setup_func8()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func9()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:202: error: redefinition of ‘void G__cpp_setup_func9()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2875: error: ‘void G__cpp_setup_func9()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func10()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:205: error: redefinition of ‘void G__cpp_setup_func10()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2878: error: ‘void G__cpp_setup_func10()’ previously defined here
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx: In function ‘void G__cpp_setup_func11()’:
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.cxx:208: error: redefinition of ‘void G__cpp_setup_func11()’
/afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderDict.cxx:2881: error: ‘void G__cpp_setup_func11()’ previously defined here
g++: /afs/cern.ch/user/z/zmeng/pandajob/runrootonpanda/subjobs/./loaderWrapper_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!

Even I have tried different versions.

I have no any idea on this. Thanks a lot for your help.

Best regards,
Zhaoxia

Hi,

Humm … unfortunately you are right, this solution will not work. Instead you can try use the original loader.C in:gROOT->ProcessLine("#include<vector>"); gInterpreter->GetRootMapFiles()->Clear(); gROOT->ProcessLine(".L loader.C+");

Cheers,
Philippe.