HI all,
I want to use “particles” in the root file to reconstruct “jet”. So I want to read the root file and create a new branch to contain my result, jet. The reason that I want to store them in the old file is that I want to keep the relationship of jet and event. So I write a code:
I just pick the core of the code because I don’t want to confuse you with Delphes and fastjet classes.
And my question is that:
Since I don’t know how many jets I will get in each event, I write a loop. And I fill the branch in the loop. I thought all the jets can stored after tree->Write(). But in fact it’s not. It just store one jet per event ( even there are more than one jet ). Why and how can I solve it?
to store the objects. But this no so good because I have to declare the “TCloneArray” length before I know the jet number. And I was extremely wired , for example , when I have 10000 events but I break the loop after run 1 events and in this events I get 2 jets, I thought in my result I should get 2 jets in the branch but in fact the code repeat the 2 jets for 10000 times.
the include file providing gInterpreter is TInterpreter.h.
Note that this technique works for a single class. If you want to scale to a full datamodel it’s probably much better to create the dictionary separately with rootcling/genreflex and then link it together with the rest of the code.
the include file providing gInterpreter is TInterpreter.h.
Note that this technique works for a single class. If you want to scale to a full datamodel it’s probably much better to create the dictionary separately with rootcling/genreflex and then link it together with the rest of the code.
Cheers,
D[/quote]
Hi, Danilo
Tring adding this code, there is a error,
lis-MacBook-Pro:test_folder li$ g++ write.cxx -std=c++11 `root-config --cflags --libs`
lis-MacBook-Pro:test_folder li$ ./a.out
In file included from /Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.cxx:17:
In file included from /Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.h:34:
/Users/li/work/test_folder/AutoDict_vector_TLorentzVector_.cxx:1:10: fatal error:
'vector.h' file not found
#include "vector.h"
^
1 error generated.
clang: error: no such file or directory: '/Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.o'
Error in <ACLiC>: Compilation failed!
Error in <TTree::Branch>: The pointer specified for vec is not of a class or type known to ROOT
lis-MacBook-Pro:test_folder li$ g++ write.cxx -std=c++11 `root-config --cflags --libs`
lis-MacBook-Pro:test_folder li$ ./a.out
In file included from /Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.cxx:17:
In file included from /Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.h:34:
/Users/li/work/test_folder/AutoDict_vector_TLorentzVector_.cxx:1:10: fatal error:
'vector.h' file not found
#include "vector.h"
^
1 error generated.
clang: error: no such file or directory: '/Users/li/work/test_folder/AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.o'
Error in <ACLiC>: Compilation failed!
Error in <TTree::Branch>: The pointer specified for vec is not of a class or type known to ROOT
I find the file “AutoDict_vector_TLorentzVector__cxx_ACLiC_dict.cxx” and changed
to
Then it works well.
So the problem should be there. I guess that include “xxx.h” and include is different when finding head files (In my previous experience, I never find a case that they are different…).
so in your case the line in the interpreter works but if you compile an executable containing only that line it does not work?
Cheers,
D[/quote]
Hi Danilo,
Yes, and I guess the reason is that it generate files like “AutoDict_random_access_iterator_TLorentzVector_long_.cxx” contains include “vector.h” but, in fact except for standard library of C++, many compiles can’t recognize this. It can only recognize include .
so what you are experiencing is a different behaviour of the interpreted and compiled code, right? Just tried both on standard Scientific Linux and had no problem.
If the answer to the above after trying is yes, another question: can you move to ROOT6?
so what you are experiencing is a different behaviour of the interpreted and compiled code, right? Just tried both on standard Scientific Linux and had no problem.
If the answer to the above after trying is yes, another question: can you move to ROOT6?
Cheers,
Danilo[/quote]
Hi Danilo,
yes, I guess the problem is some compiles cant read “vector.h” since it’s a old style and the standard way is but some compiles are nicer.
Since I don’t have Linux with me, so I can’t try it. But I find that even I delete all the compilation files and recompile it again. In this file : AutoDict_vector_TLorentzVector_.cxx is produced automatically but now it can produce a good version now. It seems ROOT have “memory”…It use:
so also for ROOT5, can we consider the issue closed? I understand you had some remnants around which prevented you to pick up the latest changes.
As for ROOT6: it’s not an obligation to move but ROOT5 is in bugfixmode. The new 6 series is actively developed and provides tons of new features which may really boost your productivity.
so also for ROOT5, can we consider the issue closed? I understand you had some remnants around which prevented you to pick up the latest changes.
As for ROOT6: it’s not an obligation to move but ROOT5 is in bugfixmode. The new 6 series is actively developed and provides tons of new features which may really boost your productivity.
Cheers,
Danilo[/quote]
Hi Danilo,
It’s closed and thanks for suggestions. I find the point may be that I don’t know basic compile knowledge so I can’t understand some errors. I will try it!