Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -1,26 +1,49 @@
|
||||
$Id$
|
||||
|
||||
///\file "geometry/transforms/.README.txt"
|
||||
///\brief Extended example Transforms README page
|
||||
|
||||
/*! \page Exampletransforms Example transforms
|
||||
|
||||
This example shows various ways of definition of 3D transformations for
|
||||
placing volumes.
|
||||
|
||||
|
||||
This example illustrates various ways to place a volume.
|
||||
|
||||
There are two G4PVPlacement constructors. One uses a direct rotation matrix,
|
||||
via G4Transform3D class. The other uses an inverse rotation matrix.
|
||||
The rotation matrices themselves, direct or inverse, can be explicitely computed
|
||||
by users, or built with various G4 build-in transformations methods,
|
||||
like axial rotations.
|
||||
|
||||
\section Transforms_s1 Geometry construction
|
||||
|
||||
Two G4Trd volumes (daughters) are placed within a G4Tubs (mother).
|
||||
Two G4Trd volumes (daughters) are placed within a G4Tubs (mother), in such a way
|
||||
that their z_axis are in the mother xy plane.
|
||||
To see the picture, run the example in interactive mode.
|
||||
|
||||
The various ways of placement are implemented in the DetectorConstruction class
|
||||
in the following private functions:
|
||||
|
||||
- PlaceWithDirectMatrix()
|
||||
- PlaceWithInverseMatrix()
|
||||
- PlaceWithAxialRotations()
|
||||
- PlaceWithEulerAngles()
|
||||
- PlaceWithReflections()
|
||||
|
||||
which are then called from the Construct() function.
|
||||
- \link DetectorConstruction::PlaceWithDirectMatrix() PlaceWithDirectMatrix() \endlink \n
|
||||
This method is using G4PVPlacement with G4Transform3D, which is constructed from a rotation matrix (G4RotationMatrix) and a translation vector (G4ThreeVector). The rotation and translation in this case represent the active transformation: the solid itself is moved by rotating and translating it to bring it into the system of coordinates of the mother volume.\n
|
||||
The rotation matrix is defined via the daughter frame axes with respect to the mother frame.\n\n
|
||||
|
||||
- \link DetectorConstruction::PlaceWithInverseMatrix() PlaceWithInverseMatrix() \endlink \n
|
||||
This method is using G4PVPlacement with a rotation matrix (G4RotationMatrix) and a translation vector (G4ThreeVector). The rotation Matrix represents the rotation of the reference frame of the considered volume relatively to its mother volume’s reference frame. The translation Vector represents the translation of the current volume in the reference frame of its mother volume. \n
|
||||
If compared to the previous construct, the transformation in this case is generated by specifying the same translation with respect to its mother volume and the inverse of the rotation matrix. \n
|
||||
The rotation matrix is defined again via the daughter frame axes with respect to the mother frame. \n\n
|
||||
|
||||
- \link DetectorConstruction::PlaceWithAxialRotations() PlaceWithAxialRotations() \endlink \n
|
||||
This method is using G4PVPlacement with G4Transform3D again, but in difference from
|
||||
PlaceWithDirectMatrix(), the rotation matrix is defined via rotate[X,Y,Z]() member functions of G4RotationMatrix. \n\n
|
||||
|
||||
- \link DetectorConstruction::PlaceWithEulerAngles() PlaceWithEulerAngles() \endlink \n
|
||||
This method is using G4PVPlacement with G4Transform3D again, but with the rotation matrix is defined via Euler angles. \n\n
|
||||
|
||||
- \link DetectorConstruction::PlaceWithReflections() PlaceWithReflections() \endlink \n
|
||||
In this method, in addition to two positions defined via "PlaceWithAxialRotations" method, two more positions including reflection symmetry are defined.
|
||||
When reflections are present in geometry, the placements have to be applied
|
||||
via G4ReflectionFactory::Place() method, where a G4Transform3D with reflection
|
||||
can be used.
|
||||
|
||||
These functions are then called from the Construct() function.
|
||||
All methods define exactly same geometry except for the placement
|
||||
with reflection where trapezoids are placed with their symmetry axis
|
||||
in parallel with z-axis in order to make easier to check reflection
|
||||
@@ -30,6 +53,8 @@ $Id$
|
||||
(see DetectorMessenger and transforms.in):
|
||||
\verbatim
|
||||
/placement/setMethod method
|
||||
where method = WithDirectMatrix, WithInverseMatrix, WithAxialRotations,
|
||||
WithEulerAngles, WithReflections
|
||||
\endverbatim
|
||||
|
||||
\section Transforms_s2 Physics list
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# $Id: GNUmakefile 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
$Id:$
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -15,6 +14,13 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
01-10-18 mma, I. Hrivnacova (exTransforms-V10-04-02)
|
||||
- DetectorConstruction::PlaceWithAxialRotations : use rotate(angle, axis)
|
||||
- Added descriptions for placement methods in README
|
||||
|
||||
24-09-18 mma (exTransforms-V10-04-01)
|
||||
- update README
|
||||
|
||||
11-03-18 mma (exTransforms-V10-04-00)
|
||||
- transforms.cc : remove G4UI_USE and G4VIS_USE
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
$Id: README 99889 2016-10-10 12:20:17Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -7,25 +6,46 @@ $Id: README 99889 2016-10-10 12:20:17Z gcosmo $
|
||||
|
||||
transforms
|
||||
----------
|
||||
|
||||
This example shows various ways of definition of 3D transformations for
|
||||
placing volumes.
|
||||
|
||||
|
||||
This example illustrates various ways to place a volume.
|
||||
There are two G4PVPlacement constructors. One uses a direct rotation matrix,
|
||||
via G4Transform3D class. The other uses an inverse rotation matrix.
|
||||
The rotation matrices themselves, direct or inverse, can be explicitely computed
|
||||
by users, or built with various G4 build-in transformations methods,
|
||||
like axial rotations.
|
||||
|
||||
1- Geometry construction
|
||||
---------------------
|
||||
Two G4Trd volumes (daughters) are placed within a G4Tubs (mother), as shown
|
||||
in picture rotm.jpg
|
||||
Two G4Trd volumes (daughters) are placed within a G4Tubs (mother), in such a way
|
||||
that their z_axis are in the mother xy plane.
|
||||
To see the picture, run the example in interactive mode.
|
||||
|
||||
The various ways of placement are implemented in the DetectorConstruction class
|
||||
in the following private functions:
|
||||
|
||||
- PlaceWithDirectMatrix()
|
||||
This method is using G4PVPlacement with G4Transform3D, which is constructed from a rotation matrix (G4RotationMatrix) and a translation vector (G4ThreeVector). The rotation and translation in this case represent the active transformation: the solid itself is moved by rotating and translating it to bring it into the system of coordinates of the mother volume.
|
||||
The rotation matrix is defined via the daughter frame axes with respect to the mother frame.
|
||||
|
||||
- PlaceWithInverseMatrix()
|
||||
This method is using G4PVPlacement with a rotation matrix (G4RotationMatrix) and a translation vector (G4ThreeVector). The rotation Matrix represents the rotation of the reference frame of the considered volume relatively to its mother volume’s reference frame. The translation Vector represents the translation of the current volume in the reference frame of its mother volume.
|
||||
- If compared to the previous construct, the transformation in this case is generated by specifying the same translation with respect to its mother volume and the inverse of the rotation matrix.
|
||||
The rotation matrix is defined again via the daughter frame axes with respect to the mother frame.
|
||||
|
||||
- PlaceWithAxialRotations()
|
||||
This method is using G4PVPlacement with G4Transform3D again, but in difference from
|
||||
PlaceWithDirectMatrix(), the rotation matrix is defined via rotate[X,Y,Z]() member functions of G4RotationMatrix.
|
||||
|
||||
- PlaceWithEulerAngles()
|
||||
This method is using G4PVPlacement with G4Transform3D again, but with the rotation matrix is defined via Euler angles.
|
||||
|
||||
- PlaceWithReflections()
|
||||
In this method, in addition to two positions defined via "PlaceWithAxialRotations" method, two more positions including reflection symmetry are defined.
|
||||
When reflections are present in geometry, the placements have to be applied
|
||||
via G4ReflectionFactory::Place() method, where a G4Transform3D with reflection
|
||||
can be used.
|
||||
|
||||
which are then called from the Construct() function.
|
||||
These functions are then called from the Construct() function.
|
||||
All methods define exactly same geometry except for the placement
|
||||
with reflection where trapezoids are placed with their symmetry axis
|
||||
in parallel with z-axis in order to make easier to check reflection
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
############################################
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-10-05-beta-01 (29-June-2018)
|
||||
Geant4 version Name: geant4-10-05-ref-00 (7-December-2018)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -138,7 +138,7 @@ Step# X Y Z KineE dEStep StepLeng TrakLeng
|
||||
Run terminated.
|
||||
Run Summary
|
||||
Number of events processed : 1
|
||||
User=0.000000s Real=0.001226s Sys=0.000000s
|
||||
User=0.000000s Real=0.001045s Sys=0.000000s
|
||||
Graphics systems deleted.
|
||||
Visualization Manager deleting...
|
||||
G4 kernel has come to Quit state.
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.hh 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorMessenger.hh 68726 2013-04-05 09:35:20Z gcosmo $
|
||||
//
|
||||
/// \file DetectorMessenger.hh
|
||||
/// \brief Definition of the DetectorMessenger class
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Definition of the PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id: PhysicsList.hh 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.hh 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Definition of the SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingVerbose.hh 98266 2016-07-04 17:48:45Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 68726 2013-04-05 09:35:20Z gcosmo $
|
||||
//
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
@@ -182,7 +181,7 @@ void DetectorConstruction::PlaceWithDirectMatrix()
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
false, //no boolean operation
|
||||
1); //copy number
|
||||
2); //copy number
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -239,12 +238,17 @@ void DetectorConstruction::PlaceWithAxialRotations()
|
||||
// 1st position (with first G4PVPlacement constructor)
|
||||
//
|
||||
G4double phi = 30*deg, theta = 90*deg;
|
||||
G4ThreeVector rotAxis =
|
||||
G4ThreeVector(std::sin(theta-pi/2), 0., std::cos(theta-pi/2));
|
||||
G4RotationMatrix rotm1 = G4RotationMatrix();
|
||||
rotm1.rotateY(theta);
|
||||
rotm1.rotateZ(phi);
|
||||
G4cout << "\n --> phi = " << phi/deg << " deg; direct rotation matrix : ";
|
||||
rotm1.rotateY(theta);
|
||||
rotm1.rotate (phi, rotAxis);
|
||||
G4cout << "\n --> direct rotation matrix : "
|
||||
<< " theta = " << theta/deg << " deg;"
|
||||
<< " phi = " << phi/deg << " deg;";
|
||||
rotm1.print(G4cout);
|
||||
G4ThreeVector w = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector w = G4ThreeVector( std::sin(theta)*std::cos(phi),
|
||||
std::sin(phi), std::cos(theta)*std::cos(phi));
|
||||
G4ThreeVector position1 = og*w;
|
||||
G4Transform3D transform1(rotm1,position1);
|
||||
|
||||
@@ -253,21 +257,22 @@ void DetectorConstruction::PlaceWithAxialRotations()
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
false, //no boolean operation
|
||||
1); //copy number
|
||||
1); //copy number
|
||||
|
||||
// 2nd position (with second G4PVPlacement constructor)
|
||||
//
|
||||
phi = phi + 90*deg;
|
||||
phi = phi + 90*deg;
|
||||
//rotm2Inv could be calculated with rotm2.inverse()
|
||||
//but also by the following :
|
||||
G4RotationMatrix* rotm2Inv = new G4RotationMatrix();
|
||||
rotm2Inv->rotateZ(-phi);
|
||||
rotm2Inv->rotateY(-theta);
|
||||
w = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4RotationMatrix* rotm2Inv = new G4RotationMatrix();
|
||||
rotm2Inv->rotate (-phi, rotAxis);
|
||||
rotm2Inv->rotateY(-theta);
|
||||
w = G4ThreeVector( std::sin(theta)*std::cos(phi),
|
||||
std::sin(phi), std::cos(theta)*std::cos(phi));
|
||||
G4ThreeVector position2 = og*w;
|
||||
|
||||
new G4PVPlacement(rotm2Inv, //rotation
|
||||
position2, //position
|
||||
position2, //position
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -333,7 +338,7 @@ void DetectorConstruction::PlaceWithEulerAngles()
|
||||
|
||||
void DetectorConstruction::PlaceWithReflections()
|
||||
{
|
||||
/// Placement with reflcetions.
|
||||
/// Placement with reflections.
|
||||
/// In order to better show the reflection symmetry we do not apply
|
||||
/// the rotation along Y axis.
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
/// \file DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id: PhysicsList.cc 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 68023 2013-03-13 13:40:16Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Implementation of the SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingVerbose.cc 98266 2016-07-04 17:48:45Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
/// \brief Main program of the geometry/transforms example
|
||||
//
|
||||
//
|
||||
// $Id: TestEm4.cc,v 1.13 2010-05-19 09:19:51 maire Exp $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
Reference in New Issue
Block a user