source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/Detector/geomReflection.html

Last change on this file was 1208, checked in by garnier, 15 years ago

CVS update

File size: 6.6 KB
Line 
1<html>
2<head>
3<title>ADG: Geometry</title>
4</head>
5
6<!-- Changed by: Gabriele Cosmo, 18-Apr-2005 -->
7<!-- $Id: geomReflection.html,v 1.2 2006/06/09 13:57:14 gcosmo Exp $ -->
8<!-- $Name:  $ -->
9<body>
10<table WIDTH="100%"><TR>
11<td>
12<a href="../../../../Overview/html/index.html">
13<IMG SRC="../../../../resources/html/IconsGIF/Overview.gif" ALT="Overview"></a>
14<a href="geometry.html">
15<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></a>
16<a href="geomAssembly.html">
17<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></a>
18<a href="geomNav.html">
19<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></a>
20</td>
21<td ALIGN="Right">
22<font SIZE="-1" COLOR="#238E23">
23<b>Geant4 User's Guide</b>
24<br>
25<b>For Application Developers</b>
26<br>
27<b>Geometry</b>
28</font>
29</td>
30</tr></table>
31<br><br>
32
33<a name="4.1.7">
34<h2>4.1.7 Reflecting Hierarchies of Volumes</h2></a>
35
36<p>
37Hierarchies of volumes based on <i>CSG</i> or <i>specific</i> solids can be
38reflected by means of the <tt>G4ReflectionFactory</tt> class and
39<tt>G4ReflectedSolid</tt>, which implements a solid that has been shifted
40from its original reference frame to a new 'reflected' one. The reflection
41transformation is applied as a decomposition into rotation and translation
42transformations.<br>
43
44The factory is a singleton object which provides the following methods:
45<pre>
46   G4PhysicalVolumesPair Place(const G4Transform3D&amp;   transform3D,
47                               const G4String&amp;        name,
48                                     G4LogicalVolume* LV,
49                                     G4LogicalVolume* motherLV,
50                                     G4bool           isMany,
51                                     G4int            copyNo,
52                                     G4bool           surfCheck=false)
53 
54   G4PhysicalVolumesPair Replicate(const G4String&amp;        name,
55                                         G4LogicalVolume* LV,
56                                         G4LogicalVolume* motherLV,
57                                         EAxis            axis,
58                                         G4int            nofReplicas,
59                                         G4double         width,
60                                         G4double         offset=0)
61                                                                                             
62   G4PhysicalVolumesPair Divide(const G4String&amp;        name,
63                                      G4LogicalVolume* LV,
64                                      G4LogicalVolume* motherLV,
65                                      EAxis            axis,
66                                      G4int            nofDivisions,
67                                      G4double         width,
68                                      G4double         offset);
69</pre>
70 
71The method <tt>Place()</tt> used for placements, evaluates the passed
72transformation.  In case the transformation contains a reflection, the
73factory will act as follows:
74 <ol>
75 <li>Performs the transformation decomposition.</li>
76 <li>Creates a new reflected solid and logical volume, or retrieves them
77     from a map if the reflected object was already created.</li>
78 <li>Transforms the daughters (if any) and place them in the given mother.</li>
79 </ol>
80If successful, the result is a pair of physical volumes, where the second
81physical volume is a placement in a reflected mother. Optionally, it is also
82possible to force the overlaps check at the time of placement, by activating
83the <tt>surfCheck</tt> flag.
84<br>
85The method <tt>Replicate()</tt> creates replicas in the given mother.
86If successful, the result is a pair of physical volumes, where the second
87physical volume is a replica in a reflected mother.
88<br>
89The method <tt>Divide()</tt> creates divisions in the given mother.
90If successful, the result is a pair of physical volumes, where the second
91physical volume is a division in a reflected mother. There exists also two
92more variants of this method which may specify or not width or number of
93divisions.
94</p>
95<p>
96<b>Notes</b>
97<ul>
98<li>In order to reflect hierarchies containing divided volumes,
99    it is necessary to explicitely instantiate a concrete <i>division</i>
100    factory -before- applying the actual reflection:
101    (i.e. - <TT>G4PVDivisionFactory::GetInstance();</TT>).</li>
102<li>Reflection of generic parameterised volumes is not possible yet.</li>
103</ul>
104</p>
105 
106<p>
107<center>
108 <table BORDER=1 CELLPADDING=8>
109 <tr><td>
110 <pre>
111 #include "G4ReflectionFactory.hh"
112 
113 // Calor placement with rotation
114 
115 G4double calThickness = 100*cm;
116 G4double Xpos = calThickness*1.5;
117 G4RotationMatrix* rotD3 = new G4RotationMatrix();
118 rotD3->rotateY(10.*deg);
119 
120 G4VPhysicalVolume* physiCalor =
121     new G4PVPlacement(rotD3,                     // rotation
122                       G4ThreeVector(Xpos,0.,0.), // at (Xpos,0,0)
123                       logicCalor,     // its logical volume (defined elsewhere)
124                       "Calorimeter",  // its name
125                       logicHall,      // its mother volume (defined elsewhere)
126                       false,          // no boolean operation
127                       0);             // copy number
128 
129 // Calor reflection with rotation
130 //
131 G4Translate3D translation(-Xpos, 0., 0.);
132 G4Transform3D rotation = G4Rotate3D(*rotD3);
133 G4ReflectX3D  reflection;
134 G4Transform3D transform = translation*rotation*reflection;
135 
136 G4ReflectionFactory::Instance()
137          ->Place(transform,     // the transformation with reflection
138                  "Calorimeter", // the actual name
139                  logicCalor,    // the logical volume
140                  logicHall,     // the mother volume
141                  false,         // no boolean operation
142                  1,             // copy number
143                  false);        // no overlap check triggered
144 
145 // Replicate layers
146 //
147 G4ReflectionFactory::Instance()
148          ->Replicate("Layer",    // layer name
149                      logicLayer, // layer logical volume (defined elsewhere)
150                      logicCalor, // its mother
151                      kXAxis,     // axis of replication
152                      5,          // number of replica
153                      20*cm);     // width of replica
154 </pre>
155 </tr></td>
156
157 <tr>
158 <td ALIGN=center>
159   Source listing 4.1.8<br>
160   An example of usage of the <tt>G4ReflectionFactory</tt> class.
161 </td>
162 </tr>
163 </table>
164</center>
165
166<hr><a href="../../../../Authors/html/subjectsToAuthors.html">
167<i>About the authors</a></i> </P>
168
169</body>
170</html>
Note: See TracBrowser for help on using the repository browser.