My input root files have two TTree-s and I need to use branches from both of them when processing events. I am able to use PROOF on one of the trees in the usual way : ttree1->Process(“myTSelector.C+”). I would like to know whether there is some smart ways how to pass the second tree to ‘myTSelector’? I don’t really want to make it hardcoded in myTSelector.C file rather to have it configurable in a main script (where lives the above ‘ttree1->Process(“myTSelector.C+”)’ ). Thank you very much in advance.
BTW, is it foreseen to implement TChain::Process(TSelector*, char*) method in the next ROOT release? I believe It would be very useful.
[quote]BTW, is it foreseen to implement TChain::Process(TSelector*, char*) method in the next ROOT release? I believe It would be very useful.
[/quote]Humm … this function has existed for as long as the TTree equivalent …
[quote]I would like to know whether there is some smart ways how to pass the second tree to ‘myTSelector’?[/quote]This is done by using a TChain instead of a TTree.
So, if running analysis with proof the only option is to use myChain->Process("mySelector.C+")
which makes mySelector hard to configure in a supervisor routine.
As to your second comment I didn’t mean the same TTree from the different files but the different TTrees in each file of a data set. If the method above was working it would be very easy to handle this case. The way I am doing it now is quite ugly. That’s why I asked if somebody already knew some intelligent solution.
Cheers, Gia
[quote=“pcanal”][quote]BTW, is it foreseen to implement TChain::Process(TSelector*, char*) method in the next ROOT release? I believe It would be very useful.
[/quote]Humm … this function has existed for as long as the TTree equivalent …
[quote]I would like to know whether there is some smart ways how to pass the second tree to ‘myTSelector’?[/quote]This is done by using a TChain instead of a TTree.
I’m afraid that there is not simple solution. But if you’re willing to do it in a bit more complicated fashion, it can be done.
You have two very handy functions in TSelector: Init(TTree*) and Notify(). I don’t really remember why I chose to do it like that, but what I do right now is that in Init(TTree*) I save the pointer to the input tree (this is the TTree that I give to PROOF), and then in Notify() I do something like this (pseudo code!):
Thanks lot for the comments and the code.
I do more-or-less the same in my code. For that I use Init()-method. The only thing I don’t like is that hard-coded “MyOtherTree”. Instead I pass it as an option to the Process() -method and retrieve in the Init() by calling the GetOption()-method.
Cheers, Gia
[quote=“krasznaa”]Hi Gia,
I’m afraid that there is not simple solution. But if you’re willing to do it in a bit more complicated fashion, it can be done.
You have two very handy functions in TSelector: Init(TTree*) and Notify(). I don’t really remember why I chose to do it like that, but what I do right now is that in Init(TTree*) I save the pointer to the input tree (this is the TTree that I give to PROOF), and then in Notify() I do something like this (pseudo code!):