Get chain entry number relative to current tree

How do I get the entry number of the current event in the current tree starting from the gloabl entry number in the chain? I’ve played with TChain::GetTreeOffset and similars but with no luck. Thanks.

// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
Long64_t ientry = LoadTree(jentry); // do it before you chain->GetEntry(jentry);

Thanks Coyote, it works. Not the most intuitive way to do it, but it works :slight_smile:

Try to generate an “analysis skeleton” using:
chain->MakeClass(“Trial”);
and then have a look into the generated “Trial.C” file, into the “Trial::Loop” skeleton.