TProof with TChains

Dear ROOTers,

the software for my experiment is based on a custom Event (i.e. a class, let’s call for now EXPEvent) with all the infos we need for the data taking (and also for the MC) and so we have root files that are essentially trees with as only brach this EXPEvent.

Then we have written an EXPChain, that derives from TChain, and we use it to loop over root files, and over events in our analysis.
Why we use not TChain but EXPChain?! Because we need additional stuff and controls when retrieving an event (for example when the current tree of the chain changes we need to load in memory the related calibration of detector [written togheter with the TTree of EXPEvents] to have it avalaible for some EXPEvent methods).

Now I would like to use TProof (actually TProofLite…) with our data and have the same stuff and controls when retrieving EXPEvent in Process…

I didn’t find a way to use TProof with TChains (and in particular with our EXPChain, but it’s the same…) instead of TDSet or TFileCollection…

In this way I have to 'replicate" all the stuff and controls implemented in EXPChain into TSelector, so creating a sort of EXPSelector…

It’s corret?!
There’s a short way to use a ‘standard’ TSelector aviding the effort to mantain another EXPObject?

Thanks to all,

Dear Matteo,

Chains can be processed on Proof by just calling TChain::SetProof before Process (and after having
opened the PROOF session):

root [] TProof *p = TProof::Open("")
root [] TChain *chain = createMyChain() // Assumes that the already loaded createMyChain macro returns your chain ...
root [] chain->SetProof()
root [] chain->Process(...)

G. Ganis

Ok, now I try it but I quite sure that I’ve tried in the past and I’ve found the same problem:
when the tree in the chain changes I’ve not an “hook”, inside from the PROOF session, to enter and use mychain methods.

Apart this, there’s also the problem (quite easily solvable, but however a problem) that the entry number during the proof processing is “local” (w.r.t. the tree) while instead usually with chains one wants to use “global” numbering…

Well, your comment should then have been:
“I didn’t find a way to use TProof with NON-standard TChains …”

I do not know what your doing in your hook, and this may very well break the PROOF model.
In PROOF the Init method of your selector is called every time a new file is opened. That’s the
place where the branch pointers are set and where to do initialization actions, like retrieving
the detector calibration for the run.

So it may be that you have to restructure a bit your way of working if you want to run on PROOF.

I do not understand your comment on the entry number. Absolute entry number is an undefined concept because it depends on the order of the files (and it may be very dangerous to depend on that; but this is up to you). PROOF gives you and entry number which is consistent with the file being processed at a given moment. And that’s is the only think that we can safely do.

G. Ganis

Ok, now reading more carefully your post probably I understood my error…

In the past I tried with this SetProof() but I however launched the processing using TProofLite::Process() and not TChain::Process() so, as you clearly understand, nothing will be processed if I not “put” files into the TDSet (or TFileCollection)… When I have a slot of time I will try.

Using TChain users usually uses “global” numbering because TChain is a daughter of TTree and so the user would like to use it as a “big” TTree, without matter of the change in numbering when the tree changes…
But ok, I understand that trough PROOF is a very dangerous way of managing numbering and, cause is not a very difficult thing to implement in a custom TChain, is not a big problem…

Thanks for your suggestions!


Ok. Obviously now it works…
I didn’t understood that I had to launch the chain->Process(tselector). I used the tprooflite->process(tfilecollection, tselector) and I didn’t find a way to use it with a chain…