Test the intersection between two volumes

I’m actually using TGeoIntersection to cut a large geometry, but there are a lot of volumes that are not in the intersection shape then there are error messages like:
TGeoIntersection::ComputeBBox:0: RuntimeWarning: shapes pin and TGeoXtru do not intersect

Is there a way to test if two volumes are intersecting before perform the intersection?

The test is the one performed by TGeoIntersection::ComputeBBox, checking if the bounding boxed of the 2 shapes intersect or not. This still does not guarantee that the shapes will intersect.


Do you know how to pass a parameter in pyroot which is the output parameter too ? For example :
In C++ :

Bool_t TGeoBBox::GetPointsOnSegments(Int_t npoints, Double_t* array)

The output is Double_t* array. In python, I can’t pass a parameter. It throw me could not convert argument 2 .

There is my code :

            t = None
            clipVolume.GetShape().GetPointsOnSegments (32, t)

I’ve asked @dpiparo and @mato for help!

If a C/C++ function returns the values in an array (you provide a pointer) you translate this by passing a Python array to it. For example:

from array import array
t = array( 'd' , 32*[0.0] )
clipVolume.GetShape().GetPointsOnSegments (len(t), t)

Thanks @mato, it is working well !

I used the TGeoIntersection::ComputeBBox as @agheata said in a previous message.

It works very well by testing if the origin parameter is set to [0,0,0] after the method (to detect is the shape is intersecting or not an other shape). But this method throw warning messages. How to mute the warnings during my method ?

Edit : Or how to catch the warning in python using try: ... except: ... for example ?

What are the warnings you see?