1 | <HTML> |
---|
2 | <TITLE> |
---|
3 | </TITLE> |
---|
4 | <!-- Changed by: Katsuya Amako, 6-Aug-1998 --> |
---|
5 | <!-- Changed by: Dennis Wright, 28-Nov-2001 --> |
---|
6 | <!-- Proof read by: Joe Chuma, 14-Jun-1999 --> |
---|
7 | |
---|
8 | <BODY> |
---|
9 | <TABLE WIDTH="100%"><TR> |
---|
10 | <TD> |
---|
11 | |
---|
12 | |
---|
13 | <A HREF="index.html"> |
---|
14 | <IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></A> |
---|
15 | <A HREF="mainProgram.html"> |
---|
16 | <IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></A> |
---|
17 | <A HREF="materialDef.html"> |
---|
18 | <IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></A> |
---|
19 | </TD> |
---|
20 | <TD ALIGN="Right"> |
---|
21 | <FONT SIZE="-1" COLOR="#238E23"> |
---|
22 | <B>Geant4 User's Guide</B> |
---|
23 | <BR> |
---|
24 | <B>For Application Developers</B> |
---|
25 | <BR> |
---|
26 | <B>Getting Started with Geant4</B> |
---|
27 | </FONT> |
---|
28 | </TD> |
---|
29 | </TR></TABLE> |
---|
30 | <BR><BR> |
---|
31 | |
---|
32 | <P ALIGN="Center"> |
---|
33 | <FONT SIZE="+3" COLOR="#238E23"> |
---|
34 | <B>2.2 How to Define a Detector Geometry</B> |
---|
35 | </FONT> |
---|
36 | <P><BR> |
---|
37 | |
---|
38 | <HR ALIGN="Center" SIZE="7%"> |
---|
39 | <p> |
---|
40 | |
---|
41 | <A NAME="2.2.1"> |
---|
42 | <h2>2.2.1 Basic Concepts</H2></A> |
---|
43 | |
---|
44 | A detector geometry in Geant4 is made of a number of volumes. The largest |
---|
45 | volume is called the <b>World</b> volume. It must contain, with some margin, |
---|
46 | all other volumes in the detector geometry. The other volumes are created |
---|
47 | and placed inside previous volumes, included in the World volume. |
---|
48 | The most simple (and efficient) shape to describe the World is a box. |
---|
49 | <P> |
---|
50 | Each volume is created by describing its shape and its physical |
---|
51 | characteristics, and then placing it inside a containing volume. |
---|
52 | <P> |
---|
53 | When a volume is placed within another volume, we call the former volume the |
---|
54 | daughter volume and the latter the mother volume. The coordinate system used |
---|
55 | to specify where the daughter volume is placed, is the coordinate system of the |
---|
56 | mother volume. |
---|
57 | <P> |
---|
58 | To describe a volume's shape, we use the concept of a solid. A solid is |
---|
59 | a geometrical object that has a shape and specific values for each of |
---|
60 | that shape's dimensions. A cube with a side of 10 centimeters |
---|
61 | and a cylinder of radius 30 cm and length 75 cm are examples of solids. |
---|
62 | <P> |
---|
63 | To describe a volume's full properties, we use a logical volume. |
---|
64 | It includes the geometrical properties of the solid, and adds physical |
---|
65 | characteristics: the material of the volume; whether it contains any |
---|
66 | sensitive detector elements; the magnetic field; etc. |
---|
67 | <P> |
---|
68 | We have yet to describe how to position the volume. To do this you |
---|
69 | create a physical volume, which places a copy of the logical volume inside |
---|
70 | a larger, containing, volume. |
---|
71 | <P> |
---|
72 | |
---|
73 | <HR> |
---|
74 | <A NAME="2.2.2"> |
---|
75 | <H2>2.2.2 Create a Simple Volume</H2></A> |
---|
76 | |
---|
77 | What do you need to do to create a volume? |
---|
78 | <P> |
---|
79 | <UL> |
---|
80 | <LI> Create a solid. |
---|
81 | <LI> Create a logical volume, using this solid, and adding other attributes. |
---|
82 | </UL> |
---|
83 | <p> |
---|
84 | |
---|
85 | <HR> |
---|
86 | <A NAME="2.2.3"> |
---|
87 | <H2>2.2.3 Choose a Solid</H2></A> |
---|
88 | |
---|
89 | To create a simple box, you only need to define its name and its |
---|
90 | extent along each of the Cartesian axes. You can find an example how to do |
---|
91 | this in Novice Example N01. |
---|
92 | <P> |
---|
93 | In the detector description in the source file <tt>ExN01DetectorConstruction.cc</tt>, |
---|
94 | you will find the following box definition: |
---|
95 | <p> |
---|
96 | <center> |
---|
97 | <table border=2 cellpadding=10> |
---|
98 | <tr> |
---|
99 | <td> |
---|
100 | <PRE> |
---|
101 | G4double expHall_x = 3.0*m; |
---|
102 | G4double expHall_y = 1.0*m; |
---|
103 | G4double expHall_z = 1.0*m; |
---|
104 | |
---|
105 | G4Box* experimentalHall_box |
---|
106 | = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z); |
---|
107 | </PRE> |
---|
108 | </td> |
---|
109 | </tr> |
---|
110 | <tr> |
---|
111 | <td align=center> |
---|
112 | Source listing 2.2.1<BR> |
---|
113 | Creating a box. |
---|
114 | </td> |
---|
115 | </tr> |
---|
116 | </table></center> |
---|
117 | <p> |
---|
118 | This creates a box named "expHall_box" |
---|
119 | with extent from -3.0 meters to +3.0 meters along the X axis, |
---|
120 | from -1.0 to 1.0 meters in Y, and from -1.0 to 1.0 meters in Z. |
---|
121 | <P> |
---|
122 | It is also very simple to create a cylinder. To do this, you can use the |
---|
123 | <i>G4Tubs</i> class. |
---|
124 | <p> |
---|
125 | <center> |
---|
126 | <table border=2 cellpadding=10> |
---|
127 | <tr> |
---|
128 | <td> |
---|
129 | <PRE> |
---|
130 | G4double innerRadiusOfTheTube = 0.*cm; |
---|
131 | G4double outerRadiusOfTheTube = 60.*cm; |
---|
132 | G4double hightOfTheTube = 25.*cm; |
---|
133 | G4double startAngleOfTheTube = 0.*deg; |
---|
134 | G4double spanningAngleOfTheTube = 360.*deg; |
---|
135 | |
---|
136 | G4Tubs* tracker_tube |
---|
137 | = new G4Tubs("tracker_tube", |
---|
138 | innerRadiusOfTheTube, |
---|
139 | outerRadiusOfTheTube, |
---|
140 | hightOfTheTube, |
---|
141 | startAngleOfTheTube, |
---|
142 | spanningAngleOfTheTube); |
---|
143 | </PRE> |
---|
144 | </td> |
---|
145 | </tr> |
---|
146 | <tr> |
---|
147 | <td align=center> |
---|
148 | Source listing 2.2.2<BR> |
---|
149 | Creating a cylinder. |
---|
150 | </td> |
---|
151 | </tr> |
---|
152 | </table></center> |
---|
153 | <p> |
---|
154 | This creates a full cylinder, named "tracker_tube", |
---|
155 | of radius 60 centimeters and length 50 cm. |
---|
156 | <P> |
---|
157 | |
---|
158 | <HR> |
---|
159 | <A NAME="2.2.4"> |
---|
160 | <H2>2.2.4 Create a Logical Volume</H2></A> |
---|
161 | |
---|
162 | To create a logical volume, you must start with a solid and a material. |
---|
163 | So, using the box created above, you can create a simple logical volume filled |
---|
164 | with argon gas (see materials) by entering: |
---|
165 | <PRE> |
---|
166 | G4LogicalVolume* experimentalHall_log |
---|
167 | = new G4LogicalVolume(experimentalHall_box,Ar,"expHall_log"); |
---|
168 | </PRE> |
---|
169 | This logical volume is named "expHall_log". |
---|
170 | <P> |
---|
171 | Similarly we create a logical volume with the cylindrical solid filled with |
---|
172 | aluminium |
---|
173 | <PRE> |
---|
174 | G4LogicalVolume* tracker_log |
---|
175 | = new G4LogicalVolume(tracker_tube,Al,"tracker_log"); |
---|
176 | </PRE> |
---|
177 | and named "tracker_log" |
---|
178 | <P> |
---|
179 | |
---|
180 | <HR> |
---|
181 | <A NAME="2.2.5"> |
---|
182 | <H2>2.2.5 Place a Volume</H2></A> |
---|
183 | |
---|
184 | How do you place a volume? You start with a logical volume, and then you decide |
---|
185 | the already existing volume inside of which to place it. Then you decide |
---|
186 | where to place its center within that volume, and how to rotate it. Once you have |
---|
187 | made these decisions, you can create a physical volume, which is the placed |
---|
188 | instance of the volume, and embodies all of these atributes. |
---|
189 | <P> |
---|
190 | |
---|
191 | <HR> |
---|
192 | <A NAME="2.2.6"> |
---|
193 | <H2>2.2.6 Create a Physical Volume</H2></A> |
---|
194 | <P> |
---|
195 | You create a physical volume starting with your logical volume. |
---|
196 | A physical volume is simply a placed instance of the logical volume. |
---|
197 | This instance must be placed inside a mother logical volume. |
---|
198 | For simplicity it is unrotated: |
---|
199 | <p> |
---|
200 | <center> |
---|
201 | <table border=2 cellpadding=10> |
---|
202 | <tr> |
---|
203 | <td> |
---|
204 | <PRE> |
---|
205 | G4double trackerPos_x = -1.0*meter; |
---|
206 | G4double trackerPos_y = 0.0*meter; |
---|
207 | G4double trackerPos_z = 0.0*meter; |
---|
208 | |
---|
209 | G4VPhysicalVolume* tracker_phys |
---|
210 | = new G4PVPlacement(0, // no rotation |
---|
211 | G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z), |
---|
212 | // translation position |
---|
213 | tracker_log, // its logical volume |
---|
214 | "tracker", // its name |
---|
215 | experimentalHall_log, // its mother (logical) volume |
---|
216 | false, // no boolean operations |
---|
217 | 0); // its copy number |
---|
218 | </PRE> |
---|
219 | </td> |
---|
220 | </tr> |
---|
221 | <tr> |
---|
222 | <td align=center> |
---|
223 | Source listing 2.2.3<BR> |
---|
224 | A simple physical volume. |
---|
225 | </td> |
---|
226 | </tr> |
---|
227 | </table></center> |
---|
228 | <p> |
---|
229 | This places the logical volume <tt>tracker_log</tt> at the origin of the |
---|
230 | mother volume <tt>experimentalHall_log</tt>, shifted by one meter along X and |
---|
231 | unrotated. The resulting physical volume is named "tracker" and has a copy |
---|
232 | number of 0. |
---|
233 | <P> |
---|
234 | An exception exists to the rule that a physical volume must be placed inside |
---|
235 | a mother volume. That exception is for the World volume, which is the largest |
---|
236 | volume created, and which contains all other volumes. This volume obviously |
---|
237 | cannot be contained in any other. Instead, it must be created as a |
---|
238 | <i>G4PVPlacement</i> with a null mother pointer. It also must be |
---|
239 | unrotated, and it must be placed at the origin of the global coordinate system. |
---|
240 | <P> |
---|
241 | Generally, it is best to choose a simple solid as the World volume, and in |
---|
242 | Example N01, we use the experimental hall: |
---|
243 | <p> |
---|
244 | <center> |
---|
245 | <table border=2 cellpadding=10> |
---|
246 | <tr> |
---|
247 | <td> |
---|
248 | <PRE> |
---|
249 | G4VPhysicalVolume* experimentalHall_phys |
---|
250 | = new G4PVPlacement(0, // no rotation |
---|
251 | G4ThreeVector(0.,0.,0.), // translation position |
---|
252 | experimentalHall_log, // its logical volume |
---|
253 | "expHall", // its name |
---|
254 | 0, // its mother volume |
---|
255 | false, // no boolean operations |
---|
256 | 0); // its copy number |
---|
257 | </PRE> |
---|
258 | </td> |
---|
259 | </tr> |
---|
260 | <tr> |
---|
261 | <td align=center> |
---|
262 | Source listing 2.2.4<BR> |
---|
263 | The World volume from Example N01. |
---|
264 | </td> |
---|
265 | </tr> |
---|
266 | </table></center> |
---|
267 | <p> |
---|
268 | |
---|
269 | <HR> |
---|
270 | <A NAME="2.2.7"> |
---|
271 | <H2>2.2.7 Coordinate Systems and Rotations</H2></A> |
---|
272 | |
---|
273 | In Geant4, the rotation matrix associated to a placed physical volume represents |
---|
274 | the rotation of the reference system of this volume with respect to |
---|
275 | its mother. |
---|
276 | <p> |
---|
277 | A rotation matrix is normally constructed as in CLHEP, by instantiating the |
---|
278 | identity matrix and then applying a rotation to it. This is also demonstrated |
---|
279 | in Example N04. |
---|
280 | <P> |
---|
281 | |
---|
282 | <HR> |
---|
283 | <A HREF="../../../../Authors/html/subjectsToAuthors.html"> |
---|
284 | <I>About the authors</I></A> |
---|
285 | |
---|
286 | </BODY> |
---|
287 | </HTML> |
---|