source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Detector/geomAssembly.xml @ 904

Last change on this file since 904 was 904, checked in by garnier, 16 years ago

ajout de la doc

File size: 9.2 KB
Line 
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>
13Creating an Assembly of Volumes
14</title>
15
16<para>
17<literal>G4AssemblyVolume</literal> is a helper class which allows several
18logical volumes to be combined together in an arbitrary way in 3D
19space. The result is a placement of a normal logical volume, but
20where final physical volumes are many.
21</para>
22
23<para>
24However, an <emphasis>assembly</emphasis> volume does not act as a real mother
25volume, being an envelope for its daughter volumes. Its role is
26over at the time the placement of the logical assembly volume is
27done. The physical volume objects become independent copies of each
28of the assembled logical volumes.
29</para>
30
31<para>
32This class is particularly useful when there is a need to create
33a regular pattern in space of a complex component which consists of
34different shapes and can't be obtained by using replicated volumes
35or parametrised volumes (see also <xref linkend="fig.Geom.Assem_1" /> 
36reful usage of <literal>G4AssemblyVolume</literal> must be considered
37though, in order to avoid cases of "proliferation" of physical volumes
38all placed in the same mother.
39</para>
40
41<figure id="fig.Geom.Assem_1">
42<title>
43Examples 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>
63Filling an assembly volume with its "daughters"
64</title>
65
66<para>
67Participating logical volumes are represented as a triplet of
68&lt;logical volume, translation, rotation&gt;
69(<literal>G4AssemblyTriplet</literal> class).
70</para>
71
72<para>
73The adopted approach is to place each participating logical volume
74with respect to the assembly's coordinate system, according to the
75specified translation and rotation.
76</para>
77
78</sect3>
79
80<!-- ******************* Section (Level#3) ****************** -->
81<sect3 id="sect.Geom.Assemb.Place">
82<title>
83Assembly volume placement
84</title>
85
86<para>
87An assembly volume object is composed of a set of logical
88volumes; imprints of it can be made inside a mother logical
89volume.
90</para>
91
92<para>
93Since the assembly volume class generates physical volumes
94during each imprint, the user has no way to specify identifiers for
95these. An internal counting mechanism is used to compose uniquely
96the names of the physical volumes created by the invoked
97<literal>MakeImprint(...)</literal> method(s).
98</para>
99
100<para>
101The name for each of the physical volume is generated with
102the 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
110where:
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>
131It is however possible to access the constituent physical volumes
132of 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>
140Destruction of an assembly volume
141</title>
142
143<para>
144At destruction all the generated physical volumes and associated
145rotation matrices of the imprints will be destroyed. A list of
146physical volumes created by <literal>MakeImprint()</literal> method is kept,
147in order to be able to cleanup the objects when not needed anymore.
148This requires the user to keep the assembly objects in memory
149during the whole job or during the life-time of the
150<literal>G4Navigator</literal>, logical volume store and physical volume
151store may keep pointers to physical volumes generated by the
152assembly volume.
153</para>
154
155<para>
156The <literal>MakeImprint()</literal> method will operate correctly also on
157transformations including reflections and can be applied also to
158recursive assemblies (i.e., it is possible to generate imprints of
159assemblies including other assemblies).
160Giving <literal>true</literal> as the last argument of the
161<literal>MakeImprint()</literal> method,
162it is possible to activate the volumes overlap check for the assembly's
163constituents (the default is <literal>false</literal>).
164</para>
165
166<para>
167At destruction of a <literal>G4AssemblyVolume</literal>, all its generated
168physical 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>
176Example
177</title>
178
179<para>
180This example shows how to use the <literal>G4AssemblyVolume</literal>
181class. It implements a layered detector where each layer consists
182of 4 plates.
183</para>
184
185<para>
186In the code below, at first the world volume is defined, then
187solid and logical volume for the plate are created, followed by the
188definition of the assembly volume for the layer.
189</para>
190
191<para>
192The assembly volume for the layer is then filled by the plates in
193the same way as normal physical volumes are placed inside a mother
194volume.
195</para>
196
197<para>
198Finally the layers are placed inside the world volume as the
199imprints of the assembly volume (see <xref linkend="programlist_Geom.Assem_1" />).
200
201<example id="programlist_Geom.Assem_1">
202<title>
203An 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
227   // Rotation of the assembly inside the world
228   G4RotationMatrix Rm;
229
230   // Fill the assembly by the plates
231   Ta.setX( caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. );
232   assemblyDetector-&gt;AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
233
234   Ta.setX( -1*caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. );
235   assemblyDetector-&gt;AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
236
237   Ta.setX( -1*caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. );
238   assemblyDetector-&gt;AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
239
240   Ta.setX( caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. );
241   assemblyDetector-&gt;AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
242
243   // Now instantiate the layers
244   for( unsigned int i = 0; i &lt; layers; i++ )
245   {
246     // Translation of the assembly inside the world
247     G4ThreeVector Tm( 0,0,i*(caloZ + caloCaloOffset) - firstCaloPos );
248     assemblyDetector-&gt;MakeImprint( worldLV, G4Transform3D(Tm,Rm) );
249   }
250}
251</programlisting>
252</example>
253</para>
254
255<para>
256The resulting detector will look as in <xref linkend="fig.Geom.Assem_2" />,
257below:
258
259<figure id="fig.Geom.Assem_2">
260<title>
261The geometry corresponding to <xref linkend="programlist_Geom.Assem_1" />.
262</title>
263<mediaobject>
264  <imageobject role="fo">
265    <imagedata fileref="AllResources/Detector/geometry.src/avpic.jpg" 
266               format="JPG" contentwidth="5.0cm" align="center" />
267  </imageobject>
268  <imageobject role="html">
269    <imagedata fileref="AllResources/Detector/geometry.src/avpic.jpg" 
270               format="JPG" align="center" />
271  </imageobject>
272
273
274  <imageobject>
275    <imagedata fileref="./AllResources/Detector/geometry.src/avpic.jpg" 
276               format="JPG" width="10.0cm" depth="10.0cm" align="center" />
277  </imageobject>
278  <textobject>
279    <phrase>Assembly volume detector</phrase>
280  </textobject>
281</mediaobject>
282</figure>
283</para>
284
285
286</sect3>
287</sect2>
Note: See TracBrowser for help on using the repository browser.