Creating a Right Trapezoid Prism

Hello All,
I am a newbie to ROOT programming. I am using ROOT
version : v6-24-06@v6-24-06 .

I am currently trying to construct a right triangular prism. I tried to do so by using the MakeTrd1 command. However I ended up with the following outputs. As it can be seen, the prism is expanding upwards in both directions.

However, my goal is to construct a prism as in the following image (only one side of the prism should be extending from bottom to the top, right angles are the case for the other sides) :

The prism sizes are:

z axis: 30 cm
y axis: 36 cm
at the bottom end, length in x -axis is 6cm, at the top end, it is 24 cm.

Which command should I be using in order to create such a volume? Any help would be greatly appreciated.

Try TGeoArb8

  Double_t verts[8][2];
  verts[0][0] = 0.;
  verts[0][1] = 0.;
  verts[1][0] = 0.;
  verts[1][1] = 36.;
  verts[2][0] = 6.;
  verts[2][1] = 36.;
  verts[3][0] = 6.;
  verts[3][1] = 0.;
  verts[4][0] = 0.;
  verts[4][1] = 0.;
  verts[5][0] = 0.;
  verts[5][1] = 36.;
  verts[6][0] = 24.;
  verts[6][1] = 36.;
  verts[7][0] = 24.;
  verts[7][1] = 0.;

  TGeoArb8 *c= new TGeoArb8(15,(Double_t*)verts);

1 Like

@dastudillo It works perfectly, thank you very much.

However, If you don’t mind, I have an additional question concerning this shape:

I want to add this shape inside a container and later I will add other volumes as well. I am trying to use AddNode command as I did for other volumes, however It was unable to add this shape. I though I should transform this shape into a volume using :

TGeoManager::Volume(prisms,c, 2)
container1->AddNode(c, 1);

where number 2 represents the medium Aluminium. But this idea did not work. How can I add this shape inside any container volume, using AddNode command, like it is the case for an ordinary box or tube ?

Thank you for your attention.

May be @agheata can help with your last question.

1 Like
TGeoArb8 *righ_prism_shape = new TGeoArb8("right_prism", 15, (Double_t*)verts);
TGeoVolume *right_prism_vol = new TGeoVolume("right_prism_vol", righ_prism_shape, some_medium_ptr);
container1->AddNode(right_prism_vol, 1);
1 Like

@agheata Thank you very much, this code solved the problem.