Reopen - Problem with MakeCone and CompositeShape

Hello,
I reopen a subject that stilled without solution a few months ago concerning Geometry with ROOT, especially TGeoCompositeShape. Can I have your suggestions please ?

I’d like to create a geometry formed by a shape defined by a composite shape : difference between 2 shapes (a rectangle and a cone).

First, I define a makebox and a makecone. Then, I define my composite shape : Rectangle – Cone:translation. Finally I define a volume using the shape built with the composite shape.
My problem is that the cone shape can’t be found, whereas it exits. For prove, if I replace the MakeCone by a MakeTube, the shape is found and the volume created using the composite shape.

So, I’m very surprised, and I’d like to know if there is a problem in my geometry (see below) or if there is a more global problem.

Version used : ROOT 6.14/06 (also test with 6.12/04) on MacOs

Thanks a lot

Julien



void test()
{

TString root_file = "TEST" ;
TGeoManager *geom = new TGeoManager ("GeoManager", "Root_Geometry") ;

TGeoMaterial* vacuum = new TGeoMaterial ("vacuum") ;
TGeoMedium * vide = new TGeoMedium ("VIDE", 1 , vacuum) ;

TGeoTranslation *trsl_1 = new TGeoTranslation ("tr1" , 0.0, 0.0, -21.25/2+2.887/2 ) ;
trsl_1->RegisterYourself() ;

Double_t x_size, y_size, z_size ;
x_size = 21.4 ;
y_size = 21.4 ;
z_size = 21.2 ;
TGeoVolume *rectangle_ext = geom -> MakeBox ( "Rectangle_ext" , vide , x_size/2 , y_size/2 , z_size/2 ) ;

//TGeoVolume *cone_bas = geom -> MakeCone ( "Cone_bas", vide, 2.887/2, 0.0 , 4.0 , 0.0, 10.0); //NOK
TGeoVolume *cone_bas = geom -> MakeTube ( "Cone_bas", vide, 0.0, 10.0, 2.887/2); //OK

TString operation_booleenne = "Rectangle_ext - Cone_bas:tr1" ;
TGeoCompositeShape * world_shape = new TGeoCompositeShape( "World_shape", operation_booleenne) ;
TGeoVolume *world = new TGeoVolume ("World" , world_shape, vide) ;

world->Export("test.root") ;
world->Draw();

geom -> SetTopVolume (world) ;
geom->CheckOverlaps(0.0001) ;
geom->PrintOverlaps() ;

}


ROOT Version: 6.14/06
Platform: MacOs
Compiler: Cling


Hi Julen,

It is ROOT problem - shape name in the Cone volume does not named properly. Just insert following line:

printf("Volume name: %s shape name %s\n", cone_bas->GetName(), cone_bas->GetShape()->GetName());

I hope, we can fix problem soon.

Regards,
Sergey

Problem is here:

As a first argument of TGeoCone constructor name should be specified.
I hope, @agheata can fix problem.

Hi,
This is not really a bug, but a misuse of composites. TGeoManager::MakeXXX methods are creating volumes (shape + medium), so the name passed there is supposed to be the name of the created volume (the created shape does not necessary need to have the same name). I agree on the inconsistency between MakeTube and MakeCone, but fixing this I would rather remove the name being passed to the shape.

To do a composite, one should not create volumes just for this purpose, otherwise the volumes will just stay unconnected to the geometry hierarchy (this is what happens with your rectangle_ext and cone_bas. You should just replace the 2 lines creating volumes with::

TGeoBBox *rectangle_ext = new TGeoBBox("Rectangle_ext", ...);
TGeoTube *cone_bas = new TGeoCone("Cone_bas", ...);

Best,

Hello everyone,

Thanks for your answers. I understand the misuse : in the future I won’t use MakeXXXX methods for building my Compositeshapes anymore. I tested your solution, it worked perfectly, and I will apply it on my geometries.

Thanks a lot,

Best,

Julien

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.