# Smarter Histograms Handling and Plotting Class

**URL:** <https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403>\
**Category:** ROOT\
**Tags:** hist\
**Created:** [November 13, 2025, 12:55pm UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403 "2025-11-13T12:55:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ammelsayed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ammelsayed/32/39472_2.png) [@ammelsayed](https://root-forum.cern.ch/u/ammelsayed)\
**Post date:** [November 13, 2025, 12:55pm UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/1 "2025-11-13T12:55:25Z")

</div>

Hello,

When searching for new particles, my typical workflow involves stacking background histograms in a `THStack` while keeping the signal separate in a `TH1D`. With multiple processes, this requires creating many histograms, carefully handling error bars and systematics, stacking, managing legends, and drawing on a canvas.

While this is manageable for a single plot, it becomes tedious and error-prone when producing many plots for different variables. The code quickly becomes difficult to maintain.

Has ROOT developed a dedicated class or tool to streamline this process and manage these tasks in a more robust, professional manner?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 13, 2025, 1:05pm UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/2 "2025-11-13T13:05:49Z")

</div>

Hi, thanks for reaching out! I don’t think we have something like you describe, but maybe @couet know better

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [November 13, 2025, 2:21pm UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/3 "2025-11-13T14:21:36Z")

</div>

> [@ammelsayed](#):
>
> Has ROOT developed a dedicated class or tool to streamline this process and manage these tasks in a more robust, professional manner?

My first answer is: no, ROOT does not have such a tool. However, I’m not entirely sure I fully understand what you’re trying to do. From what I gather, you’d like to generalize a certain process. Could you share a simple example so I can see whether it’s possible to generalize it using standard ROOT tools?

---

<div class="post-metadata">

**Author:** ![ammelsayed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ammelsayed/32/39472_2.png) [@ammelsayed](https://root-forum.cern.ch/u/ammelsayed)\
**Post date:** [November 14, 2025, 1:01am UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/4 "2025-11-14T01:01:20Z")

</div>

Yes, after realizing there is no such class yet, I wrote one for myself in python overnight and uploaded it on GitHub:

> **[GitHub - ammelsayed/ROOT-Multihistogram-Plotting-Assistant](https://github.com/ammelsayed/ROOT-Multihistogram-Plotting-Assistant)**
>
> Contribute to ammelsayed/ROOT-Multihistogram-Plotting-Assistant development by creating an account on GitHub.

If you think this is a good idea, I can try contributing to the C++ framework.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [November 14, 2025, 8:19am UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/5 "2025-11-14T08:19:06Z")

</div>

Your Python module `EventsFillerClass.py` seems to be a powerful tool for working with TH1D objects, distinguishing backgrounds from signals, stacking background histograms, and visualizing signals individually in an automatic way. It’s great that you published it on the ROOT forum.

You might consider moving the post to the [_My ROOT App and Ideas_](https://root-forum.cern.ch/c/my-root-app-and-ideas/16) category to receive more user feedback, perhaps adding a concrete example to illustrate how it works ?

---

<div class="post-metadata">

**Author:** ![ammelsayed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ammelsayed/32/39472_2.png) [@ammelsayed](https://root-forum.cern.ch/u/ammelsayed)\
**Post date:** [November 18, 2025, 8:50am UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/6 "2025-11-18T08:50:58Z")

</div>

Thank you @couet , I will provide a concrete example and repost it in this forum.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [November 18, 2025, 9:15am UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/7 "2025-11-18T09:15:47Z")

</div>

> [@ammelsayed](#):
>
> epost it in this forum

in [_My ROOT App and Ideas_](https://root-forum.cern.ch/c/my-root-app-and-ideas/16) 😉

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 2, 2025, 9:16am UTC](https://root-forum.cern.ch/t/smarter-histograms-handling-and-plotting-class/64403/8 "2025-12-02T09:16:33Z")

</div>

Closed on December 2, 2025, 9:16am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
