# How to implement TEveCaloLego in python

**URL:** <https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034>\
**Category:** Newbie\
**Created:** [September 28, 2021, 2:42pm UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034 "2021-09-28T14:42:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Songshaptak\_De](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/songshaptak_de/32/27468_2.png) [@Songshaptak\_De](https://root-forum.cern.ch/u/Songshaptak_De)\
**Post date:** [September 28, 2021, 2:42pm UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/1 "2021-09-28T14:42:34Z")

</div>

Hello,

I want to generate calorimeter lego plots in ROOT to visualize events in eta-phi plane. I have the eta, phi and pt values of the events, but I don’t understand how to make the calorimeter lego plots using **TEveCaloLego** in python 2.7. Following are the details of my system,

- ROOT Version: 5.34/09
- Platform: Scientific Linux
- Compiler: GCC 4.8.5

Looking forward for your help.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [September 28, 2021, 3:38pm UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/2 "2021-09-28T15:38:04Z")

</div>

Hello,

Please note that we don’t support ROOT 5 anymore, would it be an option for you to upgrade to a newer version?

---

<div class="post-metadata">

**Author:** ![Songshaptak\_De](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/songshaptak_de/32/27468_2.png) [@Songshaptak\_De](https://root-forum.cern.ch/u/Songshaptak_De)\
**Post date:** [September 29, 2021, 8:38am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/3 "2021-09-29T08:38:58Z")

</div>

It would have been better if I can do it in ROOT 5.  
If you can tell the procedure for the higher version of ROOT, then I can try to incorporate in my version of ROOT.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 29, 2021, 8:51am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/4 "2021-09-29T08:51:32Z")

</div>

There do not seem to exist any python [“Event display classes” tutorials](https://root.cern/doc/master/group __tutorial__ eve.html).

In particular, the [TEveCaloLego](https://root.cern/doc/master/classTEveCaloLego.html) class is only used in one of them:  
[${ROOTSYS}/tutorials/eve/calo\_detail.C](https://root.cern/doc/master/calo__detail_8C.html) + [${ROOTSYS}/tutorials/eve/calorimeters.C](https://root.cern/doc/master/eve_2calorimeters_8C.html)

---

<div class="post-metadata">

**Author:** ![Songshaptak\_De](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/songshaptak_de/32/27468_2.png) [@Songshaptak\_De](https://root-forum.cern.ch/u/Songshaptak_De)\
**Post date:** [September 29, 2021, 8:53am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/5 "2021-09-29T08:53:37Z")

</div>

Okay!  
So, is there any alternative way to construct calorimeter lego plots in ROOT to visualize events in eta-phi plane ?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 29, 2021, 8:59am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/6 "2021-09-29T08:59:59Z")

</div>

You can have a look at some “general purpose” drawing capabilities, e.g.:  
[THistPainter](https://root.cern/doc/master/classTHistPainter.html)  
[TGraph2D](https://root.cern/doc/master/classTGraph2D.html) and / or [TGraph2DErrors](https://root.cern/doc/master/classTGraph2DErrors.html)  
[TGraphPainter](https://root.cern/doc/master/classTGraphPainter.html)

Maybe @couet can give more hints.

---

<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:** [September 29, 2021, 9:20am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/7 "2021-09-29T09:20:33Z")

</div>

Calorimeter Lego Plots are special lego plots not drawn by the general purpose painters. They are part of the Events display package. See the [eve tutorials](https://root.cern/doc/master/group __tutorial__ eve.html).  
Or, may be, [these special options](https://root.cern/doc/master/classTHistPainter.html#HP19) can help ?

---

<div class="post-metadata">

**Author:** ![Songshaptak\_De](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/songshaptak_de/32/27468_2.png) [@Songshaptak\_De](https://root-forum.cern.ch/u/Songshaptak_De)\
**Post date:** [September 29, 2021, 9:31am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/8 "2021-09-29T09:31:12Z")

</div>

Thank you for the suggestion.  
I have managed to draw the plot attached herewith [QCD\_Event\_v2.pdf](https://root-forum.cern.ch/uploads/short-url/7aCRNY9VYRFhFwAIwD34IFJwDI7.pdf) (256.0 KB)  
Is there any way/option to show the jet radius and the jet axis in the plot ?

---

<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:** [September 29, 2021, 10:58am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/9 "2021-09-29T10:58:36Z")

</div>

> [@Songshaptak\_De](#):
>
> Is there any way/option to show the jet radius and the jet axis in the plot ?

What is it exactly ? lines ? markers ?  
Some 3D line can be added like in [this example](https://root.cern/doc/master/annotation3d_8C.html).

---

<div class="post-metadata">

**Author:** ![Songshaptak\_De](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/songshaptak_de/32/27468_2.png) [@Songshaptak\_De](https://root-forum.cern.ch/u/Songshaptak_De)\
**Post date:** [September 29, 2021, 11:03am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/10 "2021-09-29T11:03:38Z")

</div>

I am talking about how to make this circular patch in eta-phi plane and the vertical lines like this given in the attached picture  
 ![Calo_Image](https://root-forum.cern.ch/uploads/default/original/3X/0/c/0c4544c21b47459652f42cdf1d69b600a7f5040f.jpeg)

---

<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:** [September 29, 2021, 11:07am UTC](https://root-forum.cern.ch/t/how-to-implement-tevecalolego-in-python/47034/11 "2021-09-29T11:07:17Z")

</div>

Well , try to get ideas from the example I sent. You can use the the option “0” in addition to the LEGO option to not draw the empty bins. I am not sure it works with ROOT 5 …
