ROOT Version: 6.22.00 built for linuxx8664gcc on Jul 31 2020, 11:07:00
Platform: Linux zion 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Compiler: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
I was taking a look at the tutorials/tree/JetEvent.h example because I need to implement something similar for our experiment.
I noticed that in the JetEvent class, the TClonesArray-s are defined two times, as non-static members and static members. In the constructor, the static members are allocated and then their pointers are copied into the non-static members. In the destructor, the static members are deallocated, end of the story.
Now, this does not make any sense to me but maybe there is a reason I cannot see. By having static members I must be careful to only define one object (singleton) of the JetEvent class and I preclude myself from ever using this class in a multithreading environment. Seems like shooting yourself in the foot to me.
Could you please clarify?