# SetBranchStatus - third flag?

**URL:** <https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [December 10, 2025, 11:35am UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531 "2025-12-10T11:35:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwielane](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dwielane/32/12354_2.png) [@dwielane](https://root-forum.cern.ch/u/dwielane)\
**Post date:** [December 10, 2025, 11:35am UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531/1 "2025-12-10T11:35:42Z")

</div>

Dear Developers,

I would like to suggest adding a third status option to the `SetBranchStatus` method. Currently, there are only two possibilities:

- process branch

- do not process branch

In my opinion, it would be very useful to introduce an additional option: **“never process branch”**.

Here is the motivation:  
In my analysis I sometimes need to process rare events, where the relevant information is stored in the lets call it _Trigger_ branch. Once a valid trigger is found, I have to call `TTree::GetEntry(n, 1)`, which forces loading of all branches — including those that I do not need (for example, hits, when I am only analyzing tracks).

With a **“never process branch”** option, it would be possible to permanently disable branches that are never needed e.g. those “hits”.

This could significantly improve performance of some analyses.

---

<div class="post-metadata">

**Author:** ![mczurylo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mczurylo/32/33269_2.png) [@mczurylo](https://root-forum.cern.ch/u/mczurylo)\
**Post date:** [December 11, 2025, 9:06am UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531/2 "2025-12-11T09:06:45Z")

</div>

Hi @dwielane,

thank you for sharing your use case and idea with us. I will let our TTree Expert - @pcanal comment on this.

However, the best and easiest way to improve the performance of your analysis, is to move to RDataFrame: [ROOT: ROOT::RDataFrame Class Reference](https://root.cern/doc/master/classROOT_1_1RDataFrame.html) where you can take advantage of many optimisations starting from implicit Multi Threading. It will also allow you to move to RNTuple seamlessly. In fact, regarding the new features for analysis, all the effort from our side as the ROOT team is put into RDataFrame.

We have a number of tutorials from which you can learn about different RDataFrame features: [ROOT: RDataFrame analysis tutorials](https://root.cern/doc/master/group __tutorial__ dataframe.html) . I would be happy to help you with the transition of your analysis to RDF in case you have any further questions.

Cheers,

Marta

---

<div class="post-metadata">

**Author:** ![dwielane](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dwielane/32/12354_2.png) [@dwielane](https://root-forum.cern.ch/u/dwielane)\
**Post date:** [May 28, 2026, 8:24pm UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531/3 "2026-05-28T20:24:00Z")

</div>

Hi,

I’m not sure if this will be easy, the current architecture assumes that users have an array of bidirectional pointers (each to a different branch to write/read stuff). I think it is possible to do this in RDataFrame but I will have to change a lot of things. But if someday I will try to this and have a problem I will ask on this forum 🙂

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [June 15, 2026, 5:56pm UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531/4 "2026-06-15T17:56:22Z")

</div>

We do not plan to extend the `TTree` interfaces at the moment. Note that it is usually more efficient to call `GetEntry` on each of the top level branches you need rather than use `SetBranchStatus`. You can also emulate the feature you describe by simply removing the branches that should never be read from the list of branches of the `TTree`.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [June 16, 2026, 5:36pm UTC](https://root-forum.cern.ch/t/setbranchstatus-third-flag/64531/6 "2026-06-16T17:36:36Z")

</div>

```auto
auto child = tree->GetBranch(unwanted_branch_name);
auto parent = child->GetMother()->GetSubBranch(child);
parent->GetListOfBranches()->Remove(child);
parent->GetListOfBranches()->Compress();

```

Note that if you have a chain, you need to execute this at each file boundary, so you would also need attach a `notify` action to the chain. (See [ROOT: TNotifyLink\< Type \> Class Template Reference](https://root.cern.ch/doc/PR/html/classTNotifyLink.html) and See also the doc of [TChain::LoadTree](https://root.cern.ch/doc/master/classTChain.html#ab6cae493037968229cfff713a3d86844) for an explanation on the usage of the notify object by the chain and [TTreeReader TChain notify on change of file - #5 by zhubacek](https://root-forum.cern.ch/t/ttreereader-tchain-notify-on-change-of-file/58244/5))
