Error when using SetUserExtension()

Hi rooters,
I was trying to do the following:

TGeoExtension* ext = new TGeoExtension();
some_defined_volume->SetUserExtenion();

But I got the error:

Error: Can’t call TGeoVolume::SetUserExtension(ext) in current scope

what can I assign User extension to some volume?

Sheren

Hi Sheren

TGeoExtension is a pure virtual class, you can only create derived instances. You either derive from it an implement empty Grab() and Release() functions, or use the built in TGeoRCExtension.

Regards,

Hi Andrei,

I tried to built the extension using:
TGeoRCExtension* ext = new TGeoRCExtension();
some_defined_volume->SetUserExtension(ext);

but I got an error:

Error: Can’t call TGeoVolume::SetUserExtension(ext) in current scope

I’m not sure if I get it

Hi,
The following works OK for me in ROOT6:

.x $ROOTSYS/tutorials/geom/rootgeom.C
gGeoManager->GetTopVolume()->SetUserExtension(new TGeoRCExtension());

Regards,

[quote=“agheata”]Hi,
The following works OK for me in ROOT6:

.x $ROOTSYS/tutorials/geom/rootgeom.C
gGeoManager->GetTopVolume()->SetUserExtension(new TGeoRCExtension());

Regards,[/quote]

I’m using ROOT 5.34 and got the following error:

Error: Can’t call TGeoVolume::SetUserExtension(ext) in current scope (tmpfile):1:
Possible candidates are…
(in TGeoVolume)
(in TGeoAtt)
Error: non class,struct,union object GetTopVolume() used with . or -> (tmpfile):1:
*** Interpreter error recovered ***

Is there any other way for me to call a specific volume with its Field?

Thanks

Hi,
Try first:
gSystem->Load(“libGeom”);
Then call the code I’ve pointed you to.

Cheers,

[quote=“agheata”]Hi,
Try first:
gSystem->Load(“libGeom”);
Then call the code I’ve pointed you to.

Cheers,[/quote]

I used
gSystem->Load(“libGeom”);
and got the same error… Nothing seemed to be changed.

Hi,
Which is the exact ROOT version you are using? Can you check if the method TGeoVolume::SetUserExtension exists in your version?
Regards,

[quote=“agheata”]Hi,
Which is the exact ROOT version you are using? Can you check if the method TGeoVolume::SetUserExtension exists in your version?
Regards,[/quote]
I’m using version v5-34-01 and TGeoVolume::SetUserExtension does not exist

Hi,

Then you should move to v5-34-10 at least.

Regards,