Problem with deleting TGeoVolume

Dear Rooters

I want to know how to delete a TGeoVolume object without troubles ?

in my work, after about 5 or 6 delete operations of different TGeoVolume objects, it shows me

*** Break *** segmentation violation
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/21519/exe, process 21519
`shared object read from target memory’ has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]



Root > Function DoEventApply() busy flag cleared

Note that there is a TGeoManager::AddVolume() method but there is not TGeoManager::Remove/deleteVolume() method. Confused

Thank you in advance

Regards, Ismail

Hi Ismail,

TGeoVolume’s are objects that are multiply referenced in a hierarchical structure. You may play with volume objects and delete/remove them from the list of volumes, but as soon as you create hierarchical links via nodes deleting is no longer an option. This would make the structure invalid so the operation is not supported at the level of TGeoManager. You can remove however nodes inside a volume.

Cheers,

Thank you for reply

I want to explain my problem :
first of all when you execute the macro project.C a window shows up which contains a canvas
When you click on “OK” button in WORLD GroupFrame you will see a BoxEditor window which create a box in the canvas

In the BoxEditor window I have two buttons “Apply” and “Valid”
the first “Apply” : I need only, without saving, to see, on the canvas, changes in dimensions made by the user
the second “Valid” : when you click valid, it saves it on the canvas (with different color)

My idea was to create a TGeoVolume object in each time you click on Apply or Valid

In Apply case, it draws it then deletes it WITHOUT adding it.

In Valid case, it adds the TGeoVolume created to TGeoManager object (TGeoManager->AddVolume()) and draws it WITHOUT deleting.

To have better idea, here is the code joined, you may see line 367

Thanks again

Regards,Ismail
project.C (21 KB)

Ismail, creating a volume automatically calls TGeoManager::AddVolume(). You probably do a double delete.
Anyway I don’t understand why you are doing this in the first place: just doing:

TGeoManager *geom = new TGeoManager(“geom”,"");
geom->Edit();

will start the geometry editor, that allows you to create/draw volumes, shapes,… Of course it’s your business, by I just wanted to be sure that you know the functionality is already there.

Cheers

Hi Andrei,

I want to thank you for the Edit() method :slight_smile:

Is there any possibility to modifiy the code of Edit() ?
I want to custom the geometry editor : adding Buttons, disabling itemes from menu…
It will be like creating a CustomEdit() method inspired from Edit();

Thanks in advance,

Regards, Ismail

Hi Ismail,

What you seem to want is to overwrite the TGeoManager editor. The problem is that the mechanism of ged allows only one editor named Editor. Otherwise, in principle you could derive from TGeoManagerEditor. Anyway what exactly you don’t like in the geometry manager GUI itself? I believe that better than developping a different GUI we should better improve the existing one - with your help if possible.

Cheers,

Hi Andrei,

Sometimes when I use the TGeoManagerEditor, (I build some shapes), it crashs :angry: (segmentation violation…), do you have any ideas how to solve this ?

(maybe problems with ROOT installation ? missing files ?)

Thank you in advance,

Regards, Ismail

Hi Ismail,

Could you tell me the sequence of operations that produce the crash. We need to reproduce this for fixing it.

Thanks,