Message: Re: "T" form Tube Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: "T" form Tube 

Forum: Geometry
Re: Question "T" form Tube (Leonardo Ghizoni)
Re: None Re: "T" form Tube (John Apostolakis)
Re: None Re: "T" form Tube (Leonardo Ghizoni)
Date: 25 Mar, 2014
From: John Apostolakis <John Apostolakis>

Hi Leonardo,

It is possible to add a transformation for the second solid in the constructor of any boolean solid.

Please refer to the Users Guide for Application Developers in the Documentation section of the geant4 web site.

John Apostolakis,  PH Department, CERN
SFT (SoFTware for Experiments) Group
Office: Building 32/ room R-003 (ground floor),  Mail: J27210
Email:<>       Office Tel:  +41-22-767-7239

On Mar 24, 2014, at 5:20 PM, Leonardo Ghizoni wrote:

Hello again John,

I'm builting the T form tube on Geant4, and done the following steps:

  G4RotationMatrix* rm1 = new G4RotationMatrix();

  G4ThreeVector tr1 = G4ThreeVector(0,0,dim_X1/2);

  G4VSolid* Tube1 = new
  G4VSolid* Tube2 = new

  G4VSolid* Cyllinder1 = new G4Tubs("Cyl1",0,Inner_radius,5*dim_X1,startAngle,spanningAngle);
  G4VSolid* Cyllinder2 = new G4Tubs("Cyl2",0,Inner_radius,dim_X1/2,startAngle,spanningAngle);

  G4VSolid* Union1 = new G4UnionSolid("Tube1+Tube2",Tube1,Tube2);
  G4VSolid* Intersection1 = new G4IntersectionSolid("Tube1&&Cyllinder2",Tube1,Cyllinder2);
  G4VSolid* Intersection2 = new G4IntersectionSolid("Tube2&&Cyllinder1",Tube2,Cyllinder1);
  G4VSolid* Subtraction1 = new G4SubtractionSolid("Union1-Intersection1",Union1,Intersection1);
  G4VSolid* Subtraction2 = new G4SubtractionSolid("Subtraction1-Intersection2",Subtraction1,Intersection2);
  G4VSolid* Subtraction3 = new G4SubtractionSolid("Subtraction2-Cyllinder1",Subtraction2,Cyllinder1);
  G4VSolid* Subtraction4 = new G4SubtractionSolid("Subtraction3-Cyllinder2",Subtraction3,Cyllinder2);

I just need to rotate one of the tubes and translate the other before the Booleans....

I always rotate a volume on it's logical respective..

Could you help me, please?

Thanks in advance.


2013-08-28 11:33 GMT-03:00 John Apostolakis <<>>:

*** Discussion title: Geometry

Dear Leonardo,

Please look at the Root forums for help with this issue - they are more
qualified to advise if you intend to build a geometry that way and then
port it to Geant4.

For a complicated shape as the one you appear to be building, I would
suggest a different approach to your boolean operation.

Instead of using the constructs
A - B - C - D
I suggest to make a Union of B, C and D and then subtract that from A:

A - ( B U C U D )  - where 'U' is Union.

I also note that in Geant4 the visualiation of Boolean volumes is
tricky. The most robust option to use the ray Tracing viewers, which
show you the view of the Geometry as the Navigator sees it. This is
slower than the 'simple' visualisation, but for complicated shapes, such
as this, it is much more reliable. For further suggestins please look in
our applications developers guide, and conslut the responses to queries
about this topic in the User Forum area for visualisation.


On 8/27/13 3:54 PM, Leonardo Ghizoni wrote:
> *** Discussion title: Geometry
> Hello,
> I'm trying to build a tube in a "T" form, but getting some problems...
> First, I'm trying to build it on ROOT (its faster to compile), but not
> sure if I'm getting it right.
> Here's what I'm trying to do:
>    TGeoBBox *Tube1 = new TGeoTube("Tube1",Inner_radius,Tube_radius,dim_X1);
>    TGeoBBox *Tube2 = new TGeoTube("Tube2",Inner_radius,Tube_radius,dim_X1/2);
>    TGeoBBox *Tube3 = new TGeoTube("Tube3",0,Inner_radius,dim_X1);
>    TGeoBBox *Tube4 = new TGeoTube("Tube4",0,Inner_radius,dim_X1/2);
>    TGeoRotation *r1 = new TGeoRotation("r1",0,90,0);
>    r1->RegisterYourself();
>    TGeoTranslation *t1 = new TGeoTranslation(0.,0.,dim_X1/2);
>    t1->SetName("t1");
>    t1->RegisterYourself();
>    TGeoCompositeShape *Cs = new TGeoCompositeShape("Cs","(Tube1:r1+Tube2:t1)-(Tube1:r1*Tube3:r1)-(Tube2:t1*Tube4:t1)-(Tube3:r1+Tube4:t1)");
>    TGeoVolume *comp = new TGeoVolume("COMP",Cs);
>    comp->SetLineColor(kBlue);
>    top->AddNode(comp,1);
> The problem is that I cannot visualize it with OpenGL, and don't for
> sure what's the result.
> Could someone help me, if possible??
> Thanks in advance.
> Leonardo.
> -------------------------------------------------------------
> Visit this GEANT4 at<> message (to reply or unsubscribe) at:

Visit this GEANT4 at<> message (to reply or unsubscribe) at:

 [ MIME part of type text/html without a name stripped ]

 Add Message Add Message
to: "Re: "T" form Tube"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]