# Pyroot geometry using reflections on volume

**URL:** <https://root-forum.cern.ch/t/pyroot-geometry-using-reflections-on-volume/63236>\
**Category:** Newbie\
**Tags:** python\
**Created:** [March 28, 2025, 2:17pm UTC](https://root-forum.cern.ch/t/pyroot-geometry-using-reflections-on-volume/63236 "2025-03-28T14:17:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerome0hofstetter](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jerome0hofstetter/32/38632_2.png) [@jerome0hofstetter](https://root-forum.cern.ch/u/jerome0hofstetter)\
**Post date:** [March 28, 2025, 2:17pm UTC](https://root-forum.cern.ch/t/pyroot-geometry-using-reflections-on-volume/63236/1 "2025-03-28T14:17:05Z")

</div>

Hi  
I wanted to ask what the recommended way is to add some kind of mirroring to a volume.  
I assumed it would be through some kind of transformation but only saw that TGeoHMatrix has ReflectX …Y , …Z functions while also stating that they shouldn’t be used for node definitions ([here first lines](https://root.cern.ch/doc/master/classTGeoHMatrix.html)). Further addNode seems to be the way to apply transformation to volume.  
[here](https://root.cern/doc/master/group__Geometry.html) is written that reflections are allowed (ctrl F Reflection first occurence)  
Did i miss something?

Best regards

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [March 28, 2025, 3:34pm UTC](https://root-forum.cern.ch/t/pyroot-geometry-using-reflections-on-volume/63236/2 "2025-03-28T15:34:47Z")

</div>

Hi,

Could you be a bit more precise? What volume you want to mirror and how? Adding in the loop @agheata

D

---

<div class="post-metadata">

**Author:** ![jerome0hofstetter](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jerome0hofstetter/32/38632_2.png) [@jerome0hofstetter](https://root-forum.cern.ch/u/jerome0hofstetter)\
**Post date:** [March 28, 2025, 8:42pm UTC](https://root-forum.cern.ch/t/pyroot-geometry-using-reflections-on-volume/63236/3 "2025-03-28T20:42:01Z")

</div>

quite general, i have a volume that represents some kind of sensor, containing other volumes, build up in a certain way. I would like to use this sensor mockup again just mirrored around a certain plane and thought i could do so by applying a transformation to the volume or when adding it as node to a parentvolume.

more explicitly given the codestructure i would like to know what the recommended way is to do the flip  
in the meantime i’ve found TGeoScale that also has ReflectX …Y , …Z functions and i assume i’m just supposed to use that but how would i combine it with rotations and translations without creating a TGeoHMatrix?

```auto
sensor_volume = get_sensor(...)
diag = r.TGeoScale()
diag.ReflectZ(True,True)
somerotation= ... 
#this would create TGeoHMatrix
parentvolume.addNode(sensor_volume,some_id,somerotation*diag)

```
