1 | <!-- ******************************************************** --> |
---|
2 | <!-- --> |
---|
3 | <!-- [History] --> |
---|
4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> |
---|
5 | <!-- Changed by: Gabriele Cosmo, 18-Apr-2005 --> |
---|
6 | <!-- --> |
---|
7 | <!-- ******************************************************** --> |
---|
8 | |
---|
9 | |
---|
10 | <!-- ******************* Section (Level#2) ****************** --> |
---|
11 | <sect2 id="sect.Geom.Assemb"> |
---|
12 | <title> |
---|
13 | Creating an Assembly of Volumes |
---|
14 | </title> |
---|
15 | |
---|
16 | <para> |
---|
17 | <literal>G4AssemblyVolume</literal> is a helper class which allows several |
---|
18 | logical volumes to be combined together in an arbitrary way in 3D |
---|
19 | space. The result is a placement of a normal logical volume, but |
---|
20 | where final physical volumes are many. |
---|
21 | </para> |
---|
22 | |
---|
23 | <para> |
---|
24 | However, an <emphasis>assembly</emphasis> volume does not act as a real mother |
---|
25 | volume, being an envelope for its daughter volumes. Its role is |
---|
26 | over at the time the placement of the logical assembly volume is |
---|
27 | done. The physical volume objects become independent copies of each |
---|
28 | of the assembled logical volumes. |
---|
29 | </para> |
---|
30 | |
---|
31 | <para> |
---|
32 | This class is particularly useful when there is a need to create |
---|
33 | a regular pattern in space of a complex component which consists of |
---|
34 | different shapes and can't be obtained by using replicated volumes |
---|
35 | or parametrised volumes (see also <xref linkend="fig.Geom.Assem_1" /> |
---|
36 | reful usage of <literal>G4AssemblyVolume</literal> must be considered |
---|
37 | though, in order to avoid cases of "proliferation" of physical volumes |
---|
38 | all placed in the same mother. |
---|
39 | </para> |
---|
40 | |
---|
41 | <figure id="fig.Geom.Assem_1"> |
---|
42 | <title> |
---|
43 | Examples of <emphasis>assembly</emphasis> of volumes. |
---|
44 | </title> |
---|
45 | <mediaobject> |
---|
46 | <imageobject role="fo"> |
---|
47 | <imagedata fileref="./AllResources/Detector/geometry.src/avex1and2.jpg" |
---|
48 | format="JPG" contentwidth="8.0cm" align="center" /> |
---|
49 | </imageobject> |
---|
50 | <imageobject role="html"> |
---|
51 | <imagedata fileref="./AllResources/Detector/geometry.src/avex1and2.jpg" |
---|
52 | format="JPG" align="center" /> |
---|
53 | </imageobject> |
---|
54 | <textobject> |
---|
55 | <phrase>Assembly volumes</phrase> |
---|
56 | </textobject> |
---|
57 | </mediaobject> |
---|
58 | </figure> |
---|
59 | |
---|
60 | <!-- ******************* Section (Level#3) ****************** --> |
---|
61 | <sect3 id="sect.Geom.Assemb.Fill"> |
---|
62 | <title> |
---|
63 | Filling an assembly volume with its "daughters" |
---|
64 | </title> |
---|
65 | |
---|
66 | <para> |
---|
67 | Participating logical volumes are represented as a triplet of |
---|
68 | <logical volume, translation, rotation> |
---|
69 | (<literal>G4AssemblyTriplet</literal> class). |
---|
70 | </para> |
---|
71 | |
---|
72 | <para> |
---|
73 | The adopted approach is to place each participating logical volume |
---|
74 | with respect to the assembly's coordinate system, according to the |
---|
75 | specified translation and rotation. |
---|
76 | </para> |
---|
77 | |
---|
78 | </sect3> |
---|
79 | |
---|
80 | <!-- ******************* Section (Level#3) ****************** --> |
---|
81 | <sect3 id="sect.Geom.Assemb.Place"> |
---|
82 | <title> |
---|
83 | Assembly volume placement |
---|
84 | </title> |
---|
85 | |
---|
86 | <para> |
---|
87 | An assembly volume object is composed of a set of logical |
---|
88 | volumes; imprints of it can be made inside a mother logical |
---|
89 | volume. |
---|
90 | </para> |
---|
91 | |
---|
92 | <para> |
---|
93 | Since the assembly volume class generates physical volumes |
---|
94 | during each imprint, the user has no way to specify identifiers for |
---|
95 | these. An internal counting mechanism is used to compose uniquely |
---|
96 | the names of the physical volumes created by the invoked |
---|
97 | <literal>MakeImprint(...)</literal> method(s). |
---|
98 | </para> |
---|
99 | |
---|
100 | <para> |
---|
101 | The name for each of the physical volume is generated with |
---|
102 | the following format: |
---|
103 | |
---|
104 | <informalexample> |
---|
105 | <programlisting> |
---|
106 | av_<emphasis role="bold">WWW</emphasis>_impr_<emphasis role="bold">XXX</emphasis>_<emphasis role="bold">YYY</emphasis>_<emphasis role="bold">ZZZ</emphasis> |
---|
107 | </programlisting> |
---|
108 | </informalexample> |
---|
109 | |
---|
110 | where: |
---|
111 | |
---|
112 | <itemizedlist spacing="compact"> |
---|
113 | <listitem><para> |
---|
114 | <emphasis role="bold">WWW</emphasis> - assembly volume instance number |
---|
115 | </para></listitem> |
---|
116 | <listitem><para> |
---|
117 | <emphasis role="bold">XXX</emphasis> - assembly volume imprint number |
---|
118 | </para></listitem> |
---|
119 | <listitem><para> |
---|
120 | <emphasis role="bold">YYY</emphasis> - the name of the placed logical |
---|
121 | volume |
---|
122 | </para></listitem> |
---|
123 | <listitem><para> |
---|
124 | <emphasis role="bold">ZZZ</emphasis> - the logical volume index inside the assembly |
---|
125 | volume |
---|
126 | </para></listitem> |
---|
127 | </itemizedlist> |
---|
128 | </para> |
---|
129 | |
---|
130 | <para> |
---|
131 | It is however possible to access the constituent physical volumes |
---|
132 | of an assembly and eventually customise ID and copy-number. |
---|
133 | </para> |
---|
134 | |
---|
135 | </sect3> |
---|
136 | |
---|
137 | <!-- ******************* Section (Level#3) ****************** --> |
---|
138 | <sect3 id="sect.Geom.Assemb.Destruct"> |
---|
139 | <title> |
---|
140 | Destruction of an assembly volume |
---|
141 | </title> |
---|
142 | |
---|
143 | <para> |
---|
144 | At destruction all the generated physical volumes and associated |
---|
145 | rotation matrices of the imprints will be destroyed. A list of |
---|
146 | physical volumes created by <literal>MakeImprint()</literal> method is kept, |
---|
147 | in order to be able to cleanup the objects when not needed anymore. |
---|
148 | This requires the user to keep the assembly objects in memory |
---|
149 | during the whole job or during the life-time of the |
---|
150 | <literal>G4Navigator</literal>, logical volume store and physical volume |
---|
151 | store may keep pointers to physical volumes generated by the |
---|
152 | assembly volume. |
---|
153 | </para> |
---|
154 | |
---|
155 | <para> |
---|
156 | The <literal>MakeImprint()</literal> method will operate correctly also on |
---|
157 | transformations including reflections and can be applied also to |
---|
158 | recursive assemblies (i.e., it is possible to generate imprints of |
---|
159 | assemblies including other assemblies). |
---|
160 | Giving <literal>true</literal> as the last argument of the |
---|
161 | <literal>MakeImprint()</literal> method, |
---|
162 | it is possible to activate the volumes overlap check for the assembly's |
---|
163 | constituents (the default is <literal>false</literal>). |
---|
164 | </para> |
---|
165 | |
---|
166 | <para> |
---|
167 | At destruction of a <literal>G4AssemblyVolume</literal>, all its generated |
---|
168 | physical volumes and rotation matrices will be freed. |
---|
169 | </para> |
---|
170 | |
---|
171 | </sect3> |
---|
172 | |
---|
173 | <!-- ******************* Section (Level#3) ****************** --> |
---|
174 | <sect3 id="sect.Geom.Assemb.Example"> |
---|
175 | <title> |
---|
176 | Example |
---|
177 | </title> |
---|
178 | |
---|
179 | <para> |
---|
180 | This example shows how to use the <literal>G4AssemblyVolume</literal> |
---|
181 | class. It implements a layered detector where each layer consists |
---|
182 | of 4 plates. |
---|
183 | </para> |
---|
184 | |
---|
185 | <para> |
---|
186 | In the code below, at first the world volume is defined, then |
---|
187 | solid and logical volume for the plate are created, followed by the |
---|
188 | definition of the assembly volume for the layer. |
---|
189 | </para> |
---|
190 | |
---|
191 | <para> |
---|
192 | The assembly volume for the layer is then filled by the plates in |
---|
193 | the same way as normal physical volumes are placed inside a mother |
---|
194 | volume. |
---|
195 | </para> |
---|
196 | |
---|
197 | <para> |
---|
198 | Finally the layers are placed inside the world volume as the |
---|
199 | imprints of the assembly volume (see <xref linkend="programlist_Geom.Assem_1" />). |
---|
200 | |
---|
201 | <example id="programlist_Geom.Assem_1"> |
---|
202 | <title> |
---|
203 | An example of usage of the <literal>G4AssemblyVolume</literal> class. |
---|
204 | </title> |
---|
205 | <programlisting> |
---|
206 | static unsigned int layers = 5; |
---|
207 | |
---|
208 | void TstVADetectorConstruction::ConstructAssembly() |
---|
209 | { |
---|
210 | // Define world volume |
---|
211 | G4Box* WorldBox = new G4Box( "WBox", worldX/2., worldY/2., worldZ/2. ); |
---|
212 | G4LogicalVolume* worldLV = new G4LogicalVolume( WorldBox, selectedMaterial, "WLog", 0, 0, 0); |
---|
213 | G4VPhysicalVolume* worldVol = new G4PVPlacement(0, G4ThreeVector(), "WPhys",worldLV, |
---|
214 | 0, false, 0); |
---|
215 | |
---|
216 | // Define a plate |
---|
217 | G4Box* PlateBox = new G4Box( "PlateBox", plateX/2., plateY/2., plateZ/2. ); |
---|
218 | G4LogicalVolume* plateLV = new G4LogicalVolume( PlateBox, Pb, "PlateLV", 0, 0, 0 ); |
---|
219 | |
---|
220 | // Define one layer as one assembly volume |
---|
221 | G4AssemblyVolume* assemblyDetector = new G4AssemblyVolume(); |
---|
222 | |
---|
223 | // Rotation and translation of a plate inside the assembly |
---|
224 | G4RotationMatrix Ra; |
---|
225 | G4ThreeVector Ta; |
---|
226 | G4Transform3D Tr; |
---|
227 | |
---|
228 | // Rotation of the assembly inside the world |
---|
229 | G4RotationMatrix Rm; |
---|
230 | |
---|
231 | // Fill the assembly by the plates |
---|
232 | Ta.setX( caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. ); |
---|
233 | Tr = G4Transform3D(Ra,Ta); |
---|
234 | assemblyDetector->AddPlacedVolume( plateLV, Tr ); |
---|
235 | |
---|
236 | Ta.setX( -1*caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. ); |
---|
237 | Tr = G4Transform3D(Ra,Ta); |
---|
238 | assemblyDetector->AddPlacedVolume( plateLV, Tr ); |
---|
239 | |
---|
240 | Ta.setX( -1*caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. ); |
---|
241 | Tr = G4Transform3D(Ra,Ta); |
---|
242 | assemblyDetector->AddPlacedVolume( plateLV, Tr ); |
---|
243 | |
---|
244 | Ta.setX( caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. ); |
---|
245 | Tr = G4Transform3D(Ra,Ta); |
---|
246 | assemblyDetector->AddPlacedVolume( plateLV, Tr ); |
---|
247 | |
---|
248 | // Now instantiate the layers |
---|
249 | for( unsigned int i = 0; i < layers; i++ ) |
---|
250 | { |
---|
251 | // Translation of the assembly inside the world |
---|
252 | G4ThreeVector Tm( 0,0,i*(caloZ + caloCaloOffset) - firstCaloPos ); |
---|
253 | Tr = G4Transform3D(Rm,Tm); |
---|
254 | assemblyDetector->MakeImprint( worldLV, Tr ); |
---|
255 | } |
---|
256 | } |
---|
257 | </programlisting> |
---|
258 | </example> |
---|
259 | </para> |
---|
260 | |
---|
261 | <para> |
---|
262 | The resulting detector will look as in <xref linkend="fig.Geom.Assem_2" />, |
---|
263 | below: |
---|
264 | |
---|
265 | <figure id="fig.Geom.Assem_2"> |
---|
266 | <title> |
---|
267 | The geometry corresponding to <xref linkend="programlist_Geom.Assem_1" />. |
---|
268 | </title> |
---|
269 | <mediaobject> |
---|
270 | <imageobject role="fo"> |
---|
271 | <imagedata fileref="AllResources/Detector/geometry.src/avpic.jpg" |
---|
272 | format="JPG" contentwidth="5.0cm" align="center" /> |
---|
273 | </imageobject> |
---|
274 | <imageobject role="html"> |
---|
275 | <imagedata fileref="AllResources/Detector/geometry.src/avpic.jpg" |
---|
276 | format="JPG" align="center" /> |
---|
277 | </imageobject> |
---|
278 | |
---|
279 | |
---|
280 | <imageobject> |
---|
281 | <imagedata fileref="./AllResources/Detector/geometry.src/avpic.jpg" |
---|
282 | format="JPG" width="10.0cm" depth="10.0cm" align="center" /> |
---|
283 | </imageobject> |
---|
284 | <textobject> |
---|
285 | <phrase>Assembly volume detector</phrase> |
---|
286 | </textobject> |
---|
287 | </mediaobject> |
---|
288 | </figure> |
---|
289 | </para> |
---|
290 | |
---|
291 | |
---|
292 | </sect3> |
---|
293 | </sect2> |
---|