PROOF and multi trees II

Hello,
I have 3 trees in the same ROOT file, I use MakeSelector on my 3 trees to generate my code. As the content of each tree will change 1 time/week I would like to separate my code of the code generate with MakeSelector on my 3 trees and I would like to access for the same event the variables of the tree1,2 and 3. It is possible to write a code (which derived from TSelector) but not generate with MakeSelector (with the same fonction Begin, BeginSlave …) to acces the varaible of my 3 trees ?
something like that :
#include “Tree1.h”
#include “Tree2.h”
#include “Tree3.h”
// create new object
Tree1 bis1;
Tree2 bis2;
Tree3 bis3;

void Main::Begin(TTree * /tree/)
{
TString option = GetOption();
}

void Main::SlaveBegin(TTree * tree)
{

bis1.Init(tree1);

bis2.Init(tree2);

bis3.Init(tree3);

//initialize the Tree branch addresses("");
Init(tree);
}
etc …
As Main is not generate on a tree with MakeSelector do I need Init(tree) ?
It will work without Init(tree) ?

Last stupid question, If I have a c++ code (class derived form TSelector) using ROOT library can I use my code with PROOF and send it with ./Main ? connection to the PROOF server inside the code ?

Thanks a lot for your help and sorry for these basic questions
Cheers
Fabien

[quote]It is possible to write a code (which derived from TSelector) but not generate with MakeSelector (with the same fonction Begin, BeginSlave …) to acces the varaible of my 3 trees ? [/quote]Yes.

[quote]As Main is not generate on a tree with MakeSelector do I need Init(tree) ? [/quote]I dont think so.

[quote]If I have a c++ code (class derived form TSelector) using ROOT library can I use my code with PROOF and send it with ./Main ? connection to the PROOF server inside the code ? [/quote]Yes you should be able to. You might need to create a PAR file to insure the code is shipped to all slaves.

Cheers,
Philippe

Hi Philippe,
Thanks for your answer but my problem is that “entry” is empty (see last line of the output : (Long64_t)0) so when I execute my code the init part is never execute ! :

Starting the main code (Begin Section)
new tree Tree2
bis.Init(fast);// Tree2
number of entry of : Tree2 = 14000
new tree Tree3
bis.Init(truth); //Tree3
number of entry of : Tree3 = 14000
number of entry of : tree = 14000
Starting the main code (BeginSlave Section)
Starting the main code (SlaveTerminate Section)
Starting the main code (Terminate Section)
(Long64_t)0
(results : no crash but histo with 0 entries)

when is calculate “entry”? based on what ? of the number of entries of the chain (I run my code with : chain.Process(“MyCodeReadTree.C+”)) ? The number of my tree(s) have the same number of entries and it is not 0.
Thanks
Cheers
Fabien

Hi,

TChain::Process run a loop over the internal of the selector.
To know how many interation to do, it must (because this is the only information it has) use the number of entry from the chain (aka in your case chain->GetEntries()). So in order for your solution to work you will need to have one of the tree between handled via the chain.

Cheers,
Philippe

Hi,
I found the problem, the fonction :
virtual Int_t Version() const { return 2; }
was missing in my code (.h) !!!
Sorry for the noise
Cheers
Fabien