BackFill in a TChain the TTrees so that they align in terms of branches

Dear all,
I want to understand how i can efficiently backfill some branches even if missing in a TChain or using RDataFrame.

Let’s say i have
TTree 1 ,
TTree 2

and Tree 1 contains branch “A, C” but Tree 2 “B, C” ,
I do add them in a random order, and i want to enforce Tree 1 to have B ==1 always, and in Tree1 have C==1 always
Is there a “trick-a-posteriori” to achieve this or i am forced to go back to the basic tuples level and Define dummy values so that the TChain can be used correctly?
Thanks in advance

_ROOT Version: 6.18
Platform: Not Provided
Compiler: Not Provided


Hi @RENATO_QUAGLIANI,

I am not sure I understood your problem. Could you please elaborate a bit more on the issue (and perhaps attach a code excerpt)?

Cheers,
J.

Hi @jalopezg the question concerns the possibility to backfill a TChain.
I am sure many people encountered this use case

Let’s say you have 2 Tfiles with 2 Ttrees in
They do match 90percent of the branches but one of the 2 Tfiles have 10 extra branches. You want to then treat the Tchain of the 2 Ttrees and cut over 1 of the extra branch you have in the second Ttree.

You have 2 options generally :
Fix the ntuples inconsistency a priori and align the branches naming schemes, for example adding dummy branches being alway true or false (or a default double/float) value.
Or try to patch it a posteriori telling the Tchain to backfill with some default value the TTrees missing the branch.

I don’t have an example unfortunately. I hope I have been clearer now.

Hi @RENATO_QUAGLIANI,

Yes, your issue is much clearer now. Unfortunately, I never faced that issue myself, but I am sure @pcanal can suggest something here.

Cheers,
J.

In TTree::Draw you can use Alt$(B,1) to obtain the desired result (i.e. use the column B if it exists and the value 1 otherwise). @eguiraud might remember the syntax (if any) for RDataFrame.

I’m afraid RDataFrame is built around the assumption of a fixed schema, it doesn’t support branches that materialize only at some point of the TChain.