source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Detector/geomReflection.xml@ 1191

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

ajout de la doc

File size: 6.5 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.Reflec">
12<title>
13Reflecting Hierarchies of Volumes
14</title>
15
16<para>
17Hierarchies of volumes based on <emphasis>CSG</emphasis> or
18<emphasis>specific</emphasis> solids can be reflected by means of the
19<literal>G4ReflectionFactory</literal> class and <literal>G4ReflectedSolid</literal>,
20which implements a solid that has been shifted from its original
21reference frame to a new 'reflected' one. The reflection
22transformation is applied as a decomposition into rotation and
23translation transformations.
24</para>
25
26<para>
27The factory is a singleton object which provides the following
28methods:
29
30<informalexample>
31<programlisting>
32 G4PhysicalVolumesPair Place(const G4Transform3D&amp; transform3D,
33 const G4String&amp; name,
34 G4LogicalVolume* LV,
35 G4LogicalVolume* motherLV,
36 G4bool isMany,
37 G4int copyNo,
38 G4bool surfCheck=false)
39
40 G4PhysicalVolumesPair Replicate(const G4String&amp; name,
41 G4LogicalVolume* LV,
42 G4LogicalVolume* motherLV,
43 EAxis axis,
44 G4int nofReplicas,
45 G4double width,
46 G4double offset=0)
47
48 G4PhysicalVolumesPair Divide(const G4String&amp; name,
49 G4LogicalVolume* LV,
50 G4LogicalVolume* motherLV,
51 EAxis axis,
52 G4int nofDivisions,
53 G4double width,
54 G4double offset);
55</programlisting>
56</informalexample>
57</para>
58
59<para>
60The method <literal>Place()</literal> used for placements, evaluates the
61passed transformation. In case the transformation contains a
62reflection, the factory will act as follows:
63
64<orderedlist spacing="compact">
65 <listitem><para>
66 Performs the transformation decomposition.
67 </para></listitem>
68 <listitem><para>
69 Creates a new reflected solid and logical volume, or retrieves
70 them from a map if the reflected object was already created.
71 </para></listitem>
72 <listitem><para>
73 Transforms the daughters (if any) and place them in the given mother.
74 </para></listitem>
75</orderedlist>
76</para>
77
78<para>
79If successful, the result is a pair of physical volumes, where the
80second physical volume is a placement in a reflected mother.
81Optionally, it is also possible to force the overlaps check at the
82time of placement, by activating the <literal>surfCheck</literal> flag.
83</para>
84
85<para>
86The method <literal>Replicate()</literal> creates replicas in the given
87mother. If successful, the result is a pair of physical volumes,
88where the second physical volume is a replica in a reflected
89mother.
90</para>
91
92<para>
93The method <literal>Divide()</literal> creates divisions in the given mother.
94If successful, the result is a pair of physical volumes, where the
95second physical volume is a division in a reflected mother. There
96exists also two more variants of this method which may specify or
97not width or number of divisions.
98</para>
99
100<note>
101<title>
102Notes
103</title>
104<para>
105<itemizedlist spacing="compact">
106 <listitem><para>
107 In order to reflect hierarchies containing divided volumes, it
108 is necessary to explicitely instantiate a concrete <emphasis>division</emphasis>
109 factory -before- applying the actual reflection: (i.e. -
110 <literal>G4PVDivisionFactory::GetInstance();</literal>).
111 </para></listitem>
112 <listitem><para>
113 Reflection of generic parameterised volumes is not possible yet.
114 </para></listitem>
115</itemizedlist>
116</para>
117</note>
118
119<example id="programlist_Geom.Reflec_1">
120<title>
121An example of usage of the
122<literal>G4ReflectionFactory</literal> class.</title>
123<programlisting>
124 #include "G4ReflectionFactory.hh"
125
126 // Calor placement with rotation
127
128 G4double calThickness = 100*cm;
129 G4double Xpos = calThickness*1.5;
130 G4RotationMatrix* rotD3 = new G4RotationMatrix();
131 rotD3-&gt;rotateY(10.*deg);
132
133 G4VPhysicalVolume* physiCalor =
134 new G4PVPlacement(rotD3, // rotation
135 G4ThreeVector(Xpos,0.,0.), // at (Xpos,0,0)
136 logicCalor, // its logical volume (defined elsewhere)
137 "Calorimeter", // its name
138 logicHall, // its mother volume (defined elsewhere)
139 false, // no boolean operation
140 0); // copy number
141
142 // Calor reflection with rotation
143 //
144 G4Translate3D translation(-Xpos, 0., 0.);
145 G4Transform3D rotation = G4Rotate3D(*rotD3);
146 G4ReflectX3D reflection;
147 G4Transform3D transform = translation*rotation*reflection;
148
149 G4ReflectionFactory::Instance()
150 -&gt;Place(transform, // the transformation with reflection
151 "Calorimeter", // the actual name
152 logicCalor, // the logical volume
153 logicHall, // the mother volume
154 false, // no boolean operation
155 1, // copy number
156 false); // no overlap check triggered
157
158 // Replicate layers
159 //
160 G4ReflectionFactory::Instance()
161 -&gt;Replicate("Layer", // layer name
162 logicLayer, // layer logical volume (defined elsewhere)
163 logicCalor, // its mother
164 kXAxis, // axis of replication
165 5, // number of replica
166 20*cm); // width of replica
167</programlisting>
168</example>
169
170</sect2>
Note: See TracBrowser for help on using the repository browser.