# Struggling with TGeoRCExtension

**URL:** <https://root-forum.cern.ch/t/struggling-with-tgeorcextension/32694>\
**Category:** Newbie\
**Created:** [February 11, 2019, 5:20pm UTC](https://root-forum.cern.ch/t/struggling-with-tgeorcextension/32694 "2019-02-11T17:20:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TLacaze](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/tlacaze/32/20770_2.png) [@TLacaze](https://root-forum.cern.ch/u/TLacaze)\
**Post date:** [February 11, 2019, 5:20pm UTC](https://root-forum.cern.ch/t/struggling-with-tgeorcextension/32694/1 "2019-02-11T17:20:07Z")

</div>

Hi there,

I am using ROOT to generate geometries. I need to link some properties to the volumes. The way I chose to do this is to make the geometry nodes carry the properties.  
So I am trying to add a python dict to a TGeoRCExtension and then store it in a TGeoNodeMatrix. I think i’m having some scope issue. I can access to the dict inside the method which created it, but not outside.

Here is a simple example showing my issue:

```auto
from ROOT import TGeoVolume,TGeoTube,TGeoRCExtension

def apply_property_to_node(node,prop):
    tprop=TGeoRCExtension()
    tprop.data=prop
    node.SetUserExtension(tprop)
    print 'tprop in : ', tprop
    print 'data in : ',tprop.data
    return tprop

radius=5.
height=10.
cyl_1=TGeoVolume("cyl_1",TGeoTube("cyl_1_shape", 0., radius, height/2))
cyl_2=TGeoVolume("cyl_2",TGeoTube("cyl_2_shape", 0., radius/2, height/2))
index=0
cyl_1.AddNode(cyl_2,index)

node_2=cyl_1.GetNode("cyl_2_0")

prop={"test":12}

apply_property_to_node(node_2, prop)

tprop=node_2.GetUserExtension()

print 'tprop out : ',tprop
print 'data out : ',tprop.data

```

Can anyone help me?

Thanks !

---

<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:** [February 11, 2019, 8:16pm UTC](https://root-forum.cern.ch/t/struggling-with-tgeorcextension/32694/2 "2019-02-11T20:16:46Z")

</div>

What error message do you see?

---

<div class="post-metadata">

**Author:** ![TLacaze](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/tlacaze/32/20770_2.png) [@TLacaze](https://root-forum.cern.ch/u/TLacaze)\
**Post date:** [February 12, 2019, 8:39am UTC](https://root-forum.cern.ch/t/struggling-with-tgeorcextension/32694/3 "2019-02-12T08:39:27Z")

</div>

The output is :

> Info in TGeoManager::TGeoManager: Geometry Geometry, default geometry created  
> tprop in : \<ROOT.TGeoRCExtension object (“TGeoRCExtension”) at 0x1bdd410\>  
> data in : {‘test’: 12}  
> tprop out : \<ROOT.TGeoRCExtension object (“TGeoRCExtension”) at 0x1bdd410\>  
> data out :  
> Traceback (most recent call last):  
> File “/home/\*\*\*/test\_tgeorcextension.py”, line 27, in   
> print 'data out : ',tprop.data  
> AttributeError: ‘TGeoRCExtension’ object has no attribute ‘data’
