Message: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working? Not Logged In (login)

## Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?

Keywords: Volumes of G4Tubs, Boolean operations between G4Tubs w/ finite inner radii
Forum: Geometry
Date: 11 Mar, 2005
From: Kazuyoshi Furutaka <Kazuyoshi Furutaka>

 ```Hi all, I'm using G4 7.0.p01 on Fedora Core 3 Linux system (g++/libstdc++-3.4.2). 1. G4Tubs seems to produce discs/tubes with smaller volume than expected. The volume of "Tubs1" (attached at the bottom of this message) should be 3.1415*(100.0)^2*2.0*2.0~125660cm3, but by inspecting the output of /vis/drawTree it is 124233cm3 (124233/125660=0.989, and the ratio is almost constant for other discs/tubes. Why is it so? 2. It seems that Boolean operations (G4UnionSolid/G4SubtractionSolid/ G4IntersectionSolid) don't work between two G4Tubs with finite inner radii ("solidUni2", "solidSub", and "solidInt" in the attached, respectively); volumes as well as shapes are all equal to the first solid "Tubs3". When I combine two discs (i.e. G4Tubs w/ inner radii=0), it works ("solidUni1" below). The following is a sample to see the effect of the operations in 'example/novice/N02' of G4 7.0p01. Did I do something wrong? Kazuyoshi --- ExN02DetectorConstruction.cc.orig Sat Dec 18 01:07:12 2004 +++ ExN02DetectorConstruction.cc Fri Mar 11 16:24:49 2005 @@ -35,7 +35,11 @@ #include "G4Material.hh" #include "G4Box.hh" +#include "G4Tubs.hh" #include "G4LogicalVolume.hh" +#include "G4UnionSolid.hh" +#include "G4SubtractionSolid.hh" +#include "G4IntersectionSolid.hh" #include "G4PVPlacement.hh" #include "G4PVParameterised.hh" #include "G4SDManager.hh" @@ -212,6 +216,90 @@ << ChamberMater->GetName() << "\n The distance between chamber is " << ChamberSpacing/cm << " cm" << G4endl; + // + // Test the union solid of two tubs + // + G4double fRadius = 100.0 * cm; + G4double fHalfThick = 2.0 * cm; + G4double fHalfThick2 = fHalfThick * 2.; + G4RotationMatrix unitRot; + + G4Tubs* solidTubs1 = + new G4Tubs("Tubs1", 0.0*cm, fRadius, fHalfThick, 0.*deg, 360.*deg); + G4Tubs* solidTubs2 = + new G4Tubs("Tubs2", 0.0*cm, fRadius/2., fHalfThick2, 0.*deg, 360.*deg); + G4Tubs* solidTubs3 = + new G4Tubs("Tubs3", fRadius/4., fRadius, fHalfThick, 0.*deg, 360.*deg); + G4Tubs* solidTubs4 = + new G4Tubs("Tubs4", fRadius/4., fRadius/2., fHalfThick2, 0.*deg, 360.*deg); + + // ---------- Simple disc ---------- + G4LogicalVolume* logicTubs1 = + new G4LogicalVolume( solidTubs1, Air, "Tubs1",0,0,0); + G4VisAttributes* VisAttT1 = new G4VisAttributes(G4Colour(1.,0.,0.)); // Red + logicTubs1->SetVisAttributes(VisAttT1); + G4VPhysicalVolume* physTubs1; + physTubs1 = + new G4PVPlacement(0, + G4ThreeVector(0,0,trackerSize+fHalfThick), + logicTubs1, "Tubs1", logicWorld, false,0); + + // ---------- Union of two discs ---------- + G4UnionSolid* solidUni1 = + new G4UnionSolid("solidUni1", solidTubs1, solidTubs2, + &unitRot, G4ThreeVector(0,0,fHalfThick)); + G4LogicalVolume* logicUni1 = + new G4LogicalVolume( solidUni1, Air, "logicUni1",0,0,0); + G4VisAttributes* VisAttU1 = new G4VisAttributes(G4Colour(0.,1.,0.)); // Green + logicUni1->SetVisAttributes(VisAttU1); + G4VPhysicalVolume* physUni1; + physUni1 = + new G4PVPlacement(0, + G4ThreeVector(0,0,trackerSize+5.*fHalfThick), + logicUni1, "physUni1", logicWorld, false,0); + + // ---------- Union of two rings ---------- + G4UnionSolid* solidUni2 = + new G4UnionSolid("solidUni2", solidTubs3, solidTubs4, + &unitRot, G4ThreeVector(0,0,fHalfThick)); + G4LogicalVolume* logicUni2 = + new G4LogicalVolume( solidUni2, Air, "logicUni2",0,0,0); + G4VisAttributes* VisAttU2 = new G4VisAttributes(G4Colour(0.,0.,1.)); // Blue + logicUni2->SetVisAttributes(VisAttU2); + G4VPhysicalVolume* physUni2; + physUni2 = + new G4PVPlacement(0, + G4ThreeVector(0,0,trackerSize+10.*fHalfThick), + logicUni2, "physUni2", logicWorld, false,0); + + // ---------- Subtraction of two rings ---------- + G4SubtractionSolid* solidSub = + new G4SubtractionSolid("solidSub", solidTubs3, solidTubs4, + &unitRot, G4ThreeVector(0,0,fHalfThick)); + G4LogicalVolume* logicSub = + new G4LogicalVolume( solidSub, Air, "logicSub",0,0,0); + G4VisAttributes* VisAttS = new G4VisAttributes(G4Colour(1.,0.,1.)); //Magenta + logicSub->SetVisAttributes(VisAttS); + G4VPhysicalVolume* physSub; + physSub = + new G4PVPlacement(0, + G4ThreeVector(0,0,trackerSize+15.*fHalfThick), + logicSub, "physSub", logicWorld, false,0); + + // ---------- Intersection of two rings ---------- + G4IntersectionSolid* solidInt = + new G4IntersectionSolid("solidInt", solidTubs3, solidTubs4, + &unitRot, G4ThreeVector(0,0,fHalfThick)); + G4LogicalVolume* logicInt = + new G4LogicalVolume( solidInt, Air, "logicInt",0,0,0); + G4VisAttributes* VisAttI = new G4VisAttributes(G4Colour(0.,1.,1.)); //Pale + logicInt->SetVisAttributes(VisAttI); + G4VPhysicalVolume* physInt; + physInt = + new G4PVPlacement(0, + G4ThreeVector(0,0,trackerSize+20.*fHalfThick), + logicInt, "physInt", logicWorld, false,0); + //------------------------------------------------ // Sensitive detectors //------------------------------------------------ ```

 Inline Depth: Outline Depth: Add message:

1 Re: Volumes of G4Tubs smaller? & Boolean operation between two 'ring's not working?   (Kazuyoshi Furutaka - 11 Mar, 2005)
3 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (Vladimir Grichine - 11 Mar, 2005)
1 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (Kazuyoshi Furutaka - 11 Mar, 2005)
5 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (John Allison - 11 Mar, 2005)
1 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (Kazuyoshi Furutaka - 11 Mar, 2005)
Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (John Allison - 11 Mar, 2005)
Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (Kazuyoshi Furutaka - 11 Mar, 2005)
Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (John Allison - 12 Mar, 2005)
Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (Kazuyoshi Furutaka - 12 Mar, 2005)
9 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (n.nankov@fz-rossendorf.de - 11 Apr, 2005)
1 Re: Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?   (John Allison - 13 Apr, 2005)
 to: "Volumes of G4Tubs smaller? & Boolean operation between to 'ring's not working?"
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 ]