I ran your macro using AClic and got some errors. May be you would like to fix them first ?
$ root Convert_GiBUU_2ROOT.C++
----------------------------------------------------------------
| Welcome to ROOT 6.07/07 http://root.cern.ch |
| (c) 1995-2016, The ROOT Team |
| Built for macosx64 |
| From heads/master@v6-07-06-645-g6594d17, Jun 20 2016, 12:53:42 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
----------------------------------------------------------------
root [0]
Processing Convert_GiBUU_2ROOT.C++...
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Downloads/./Convert_GiBUU_2ROOT_C.so
In file included from input_line_12:9:
././Convert_GiBUU_2ROOT.C:49:27: error: allocation of incomplete type
'TClonesArray'
TClonesArray* arr = new TClonesArray("TParticle");
^~~~~~~~~~~~
/Users/couet/git/roottrunk-bin/include/TObject.h:200:17: note: forward
declaration of 'TClonesArray'
friend class TClonesArray; // needs to reset kNotDeleted in fBits
^
In file included from input_line_12:9:
././Convert_GiBUU_2ROOT.C:52:6: error: member access into incomplete type
'TClonesArray'
arr->BypassStreamer();
^
/Users/couet/git/roottrunk-bin/include/TObject.h:200:17: note: forward
declaration of 'TClonesArray'
friend class TClonesArray; // needs to reset kNotDeleted in fBits
^
In file included from input_line_12:9:
././Convert_GiBUU_2ROOT.C:68:9: error: member access into incomplete type
'TClonesArray'
ar.Clear();
^
/Users/couet/git/roottrunk-bin/include/TObject.h:200:17: note: forward
declaration of 'TClonesArray'
friend class TClonesArray; // needs to reset kNotDeleted in fBits
^
In file included from input_line_12:9:
././Convert_GiBUU_2ROOT.C:82:13: error: type 'TClonesArray' does not provide a
subscript operator
new(ar[event.n_particles]) TParticle(event.particle_ID, 1, event.M...
~~^~~~~~~~~~~~~~~~~~
In file included from input_line_12:9:
In file included from ././Convert_GiBUU_2ROOT.C:8:
/Users/couet/git/roottrunk-bin/include/TTree.h:344:48: error: 'typeid' of
incomplete type 'TClonesArray'
return BranchImp(name, TBuffer::GetClass(typeid(T)), addobj, bufsi...
^
././Convert_GiBUU_2ROOT.C:51:6: note: in instantiation of function template
specialization 'TTree::Branch<TClonesArray>' requested here
t->Branch("b_TParticle",&arr,8000,99);
^
/Users/couet/git/roottrunk-bin/include/TObject.h:200:17: note: forward
declaration of 'TClonesArray'
friend class TClonesArray; // needs to reset kNotDeleted in fBits
^
Error in <ACLiC>: Dictionary generation failed!
root [1]
#include "TClonesArray.h"
To compile with AClic, now it gives me the different errors as when compiling without AClic.
Updated code attached.
Error I receive without AClic
[code]root [0]
Processing Convert_GiBUU_2ROOT.C…
Warning in TTree::Bronch: Using split mode on a class: TParticle with a custom Streamer
3 Number of particles in event
*** Break *** segmentation violation
Generating stack trace…
An admin user name and password is required to enter Developer Mode.
Admin user name ([/code]
No error with AClic, but there is no data in the tree and the output of the macro cannot be true, i.e.
root [0]
Processing Convert_GiBUU_2ROOT.C+…
Warning in TTree::Bronch: Using split mode on a class: TParticle with a custom Streamer 1514067120 total events (there is only 2 events in the file)
Thanks for that help.
The code works when AClic is not invoked, i.e.
root -q Convert_GiBUU_2ROOT.C
...
...
Processing Convert_GiBUU_2ROOT.C...
Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer
3 Number of particles in event
4 Number of particles in event
2 total events
This is correct, 2 events in the test file, and the tree is filled appropriately.
When using AClic
root -q Convert_GiBUU_2ROOT.C+
...
...
Processing Convert_GiBUU_2ROOT.C+...
Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer
1459463344 total events
This is not correct, and the tree is empty.
I would like to use AClic, because I will be processing >10M lines.
Any further help would be greatly appreciated.
Thanks
Processing Convert_GiBUU_2ROOT.C++...
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/michaelkunkel/WORK/GiBUU/release2016/testRun/Electroproduction/skimmer/./Convert_GiBUU_2ROOT_C.so
Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer
1408308402 total events
The tree is filled, but the number of reported events is incorrect. I am not sure on the reliability of the output.
Yes, but I missed it when reviewing your version to my version.
I like to understand my mistakes but comparison, that initialization missed my eye at first glance.