| 1 | <html>
|
|---|
| 2 | <head>
|
|---|
| 3 | <title>ADG: Geometry</title>
|
|---|
| 4 | </head>
|
|---|
| 5 |
|
|---|
| 6 | <!-- Changed by: Gabriele Cosmo, 18-Apr-2005 -->
|
|---|
| 7 | <!-- $Id: geomAssembly.html,v 1.3 2006/11/23 16:35:55 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="geomTouch.html">
|
|---|
| 17 | <IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></a>
|
|---|
| 18 | <a href="geomReflection.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.6">
|
|---|
| 34 | <h2>4.1.6 Creating an Assembly of Volumes</h2></a>
|
|---|
| 35 |
|
|---|
| 36 | <p>
|
|---|
| 37 | <tt>G4AssemblyVolume</tt> is a helper class which allows several logical
|
|---|
| 38 | volumes to be combined together in an arbitrary way in 3D space. The result
|
|---|
| 39 | is a placement of a normal logical volume, but where final physical volumes are
|
|---|
| 40 | many.
|
|---|
| 41 | </p>
|
|---|
| 42 | <p>
|
|---|
| 43 | However, an <i>assembly</i> volume does not act as a real mother volume,
|
|---|
| 44 | being an envelope for its daughter volumes. Its role is over at the time
|
|---|
| 45 | the placement of the logical assembly volume is done. The physical volume
|
|---|
| 46 | objects become independent copies of each of the assembled logical volumes.
|
|---|
| 47 | </p>
|
|---|
| 48 | <P>
|
|---|
| 49 | This class is particularly useful when there is a need to create a regular
|
|---|
| 50 | pattern in space of a complex component which consists of different shapes
|
|---|
| 51 | and can't be obtained by using replicated volumes or parametrised volumes
|
|---|
| 52 | (see also figure 4.1.2).
|
|---|
| 53 | Careful usage of <tt>G4AssemblyVolume</tt> must be considered though, in order
|
|---|
| 54 | to avoid cases of "proliferation" of physical volumes all placed in the same
|
|---|
| 55 | mother.</P>
|
|---|
| 56 | <P>
|
|---|
| 57 | <center>
|
|---|
| 58 | <table BORDER=1 CELLPADDING=8>
|
|---|
| 59 | <tr>
|
|---|
| 60 | <td>
|
|---|
| 61 | <IMG SRC="geometry.src/avex1.jpg" ALT="Assembly volumes 1">
|
|---|
| 62 | <IMG SRC="geometry.src/avex2.jpg" ALT="Assembly volumes 2">
|
|---|
| 63 | </td>
|
|---|
| 64 | </tr>
|
|---|
| 65 | <tr>
|
|---|
| 66 | <td ALIGN=center>
|
|---|
| 67 | Figure 4.1.2<BR>
|
|---|
| 68 | Examples of <i>assembly</i> of volumes.
|
|---|
| 69 | </td>
|
|---|
| 70 | </tr>
|
|---|
| 71 | </table>
|
|---|
| 72 | </center>
|
|---|
| 73 | <P>
|
|---|
| 74 |
|
|---|
| 75 | <b>Filling an assembly volume with its "daughters"</b>
|
|---|
| 76 | <P>
|
|---|
| 77 | Participating logical volumes are represented as a triplet of <logical
|
|---|
| 78 | volume, translation, rotation> (<tt>G4AssemblyTriplet</tt> class).<BR>
|
|---|
| 79 | The adopted approach is to place each participating logical volume with
|
|---|
| 80 | respect to the assembly's coordinate system, according to the specified
|
|---|
| 81 | translation and rotation.
|
|---|
| 82 | <P>
|
|---|
| 83 | <B>Assembly volume placement</B>
|
|---|
| 84 | <P>
|
|---|
| 85 | An assembly volume object is composed of a set of logical volumes;
|
|---|
| 86 | imprints of it can be made inside a mother logical volume.
|
|---|
| 87 | <P>
|
|---|
| 88 | Since the assembly volume class generates physical volumes during each
|
|---|
| 89 | imprint, the user has no way to specify identifiers for these. An
|
|---|
| 90 | internal counting mechanism is used to compose uniquely the names of the
|
|---|
| 91 | physical volumes created by the invoked <tt>MakeImprint(...)</tt> method(s).<BR>
|
|---|
| 92 | The name for each of the physical volume is generated with the following
|
|---|
| 93 | format:
|
|---|
| 94 |
|
|---|
| 95 | <PRE>
|
|---|
| 96 | av_<B>WWW</B>_impr_<B>XXX</B>_<B>YYY</B>_<B>ZZZ</B>
|
|---|
| 97 | </PRE>
|
|---|
| 98 |
|
|---|
| 99 | where:
|
|---|
| 100 | <UL>
|
|---|
| 101 | <LI><B>WWW</B> - assembly volume instance number</LI>
|
|---|
| 102 | <LI><B>XXX</B> - assembly volume imprint number</LI>
|
|---|
| 103 | <LI><B>YYY</B> - the name of the placed logical volume</LI>
|
|---|
| 104 | <LI><B>ZZZ</B> - the logical volume index inside the assembly volume</LI>
|
|---|
| 105 | </UL>
|
|---|
| 106 | It is however possible to access the constituent physical volumes of an
|
|---|
| 107 | assembly and eventually customise ID and copy-number.
|
|---|
| 108 |
|
|---|
| 109 | <P>
|
|---|
| 110 | <b>Destruction of an assembly volume</b>
|
|---|
| 111 | <P>
|
|---|
| 112 | At destruction all the generated physical volumes and associated rotation
|
|---|
| 113 | matrices of the imprints will be destroyed. A list of physical volumes created
|
|---|
| 114 | by <tt>MakeImprint()</tt> method is kept, in order to be able to cleanup the objects
|
|---|
| 115 | when not needed anymore. This requires the user to keep the assembly objects in
|
|---|
| 116 | memory during the whole job or during the life-time of the <tt>G4Navigator</tt>,
|
|---|
| 117 | logical volume store and physical volume store may keep pointers to physical
|
|---|
| 118 | volumes generated by the assembly volume.<BR>
|
|---|
| 119 | The <tt>MakeImprint()</tt> method will operate correctly also on transformations
|
|---|
| 120 | including reflections and can be applied also to recursive assemblies (i.e., it
|
|---|
| 121 | is possible to generate imprints of assemblies including other assemblies).
|
|---|
| 122 | Giving <TT>true</TT> as the last argument of the <tt>MakeImprint()</tt> method,
|
|---|
| 123 | it is possible to activate the volumes overlap check for the assembly's
|
|---|
| 124 | constituents (the default is <TT>false</TT>).<BR>
|
|---|
| 125 | At destruction of a <tt>G4AssemblyVolume</tt>, all its generated physical
|
|---|
| 126 | volumes and rotation matrices will be freed.
|
|---|
| 127 | <P>
|
|---|
| 128 | <b>Example</b>
|
|---|
| 129 | <P>
|
|---|
| 130 | This example shows how to use the <tt>G4AssemblyVolume</tt> class.
|
|---|
| 131 | It implements a layered detector where each layer consists of 4 plates.
|
|---|
| 132 | <P>
|
|---|
| 133 | In the code below, at first the world volume is defined, then solid
|
|---|
| 134 | and logical volume for the plate are created, followed by the definition of
|
|---|
| 135 | the assembly volume for the layer.<BR>
|
|---|
| 136 | The assembly volume for the layer is then filled by the plates in the same
|
|---|
| 137 | way as normal physical volumes are placed inside a mother volume.<BR>
|
|---|
| 138 | Finally the layers are placed inside the world volume as the imprints
|
|---|
| 139 | of the assembly volume (see source listing 4.1.7).
|
|---|
| 140 | <P>
|
|---|
| 141 | <center>
|
|---|
| 142 | <table BORDER=1 CELLPADDING=8>
|
|---|
| 143 | <tr><td>
|
|---|
| 144 | <pre>
|
|---|
| 145 | static unsigned int layers = 5;
|
|---|
| 146 |
|
|---|
| 147 | void TstVADetectorConstruction::ConstructAssembly()
|
|---|
| 148 | {
|
|---|
| 149 | // Define world volume
|
|---|
| 150 | G4Box* WorldBox = new G4Box( "WBox", worldX/2., worldY/2., worldZ/2. );
|
|---|
| 151 | G4LogicalVolume* worldLV = new G4LogicalVolume( WorldBox, selectedMaterial, "WLog", 0, 0, 0);
|
|---|
| 152 | G4VPhysicalVolume* worldVol = new G4PVPlacement(0, G4ThreeVector(), "WPhys", worldLV, 0, false, 0);
|
|---|
| 153 |
|
|---|
| 154 | // Define a plate
|
|---|
| 155 | G4Box* PlateBox = new G4Box( "PlateBox", plateX/2., plateY/2., plateZ/2. );
|
|---|
| 156 | G4LogicalVolume* plateLV = new G4LogicalVolume( PlateBox, Pb, "PlateLV", 0, 0, 0 );
|
|---|
| 157 |
|
|---|
| 158 | // Define one layer as one assembly volume
|
|---|
| 159 | G4AssemblyVolume* assemblyDetector = new G4AssemblyVolume();
|
|---|
| 160 |
|
|---|
| 161 | // Rotation and translation of a plate inside the assembly
|
|---|
| 162 | G4RotationMatrix Ra;
|
|---|
| 163 | G4ThreeVector Ta;
|
|---|
| 164 |
|
|---|
| 165 | // Rotation of the assembly inside the world
|
|---|
| 166 | G4RotationMatrix Rm;
|
|---|
| 167 |
|
|---|
| 168 | // Fill the assembly by the plates
|
|---|
| 169 | Ta.setX( caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. );
|
|---|
| 170 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
|
|---|
| 171 |
|
|---|
| 172 | Ta.setX( -1*caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. );
|
|---|
| 173 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
|
|---|
| 174 |
|
|---|
| 175 | Ta.setX( -1*caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. );
|
|---|
| 176 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
|
|---|
| 177 |
|
|---|
| 178 | Ta.setX( caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. );
|
|---|
| 179 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
|
|---|
| 180 |
|
|---|
| 181 | // Now instantiate the layers
|
|---|
| 182 | for( unsigned int i = 0; i < layers; i++ )
|
|---|
| 183 | {
|
|---|
| 184 | // Translation of the assembly inside the world
|
|---|
| 185 | G4ThreeVector Tm( 0,0,i*(caloZ + caloCaloOffset) - firstCaloPos );
|
|---|
| 186 | assemblyDetector->MakeImprint( worldLV, G4Transform3D(Tm,Rm) );
|
|---|
| 187 | }
|
|---|
| 188 | }
|
|---|
| 189 | </pre>
|
|---|
| 190 | </td></tr>
|
|---|
| 191 | <tr>
|
|---|
| 192 | <td ALIGN=center>
|
|---|
| 193 | Source listing 4.1.7<br>
|
|---|
| 194 | An example of usage of the <tt>G4AssemblyVolume</tt> class.
|
|---|
| 195 | </td>
|
|---|
| 196 | </tr>
|
|---|
| 197 | </table>
|
|---|
| 198 | </center>
|
|---|
| 199 | <p>
|
|---|
| 200 |
|
|---|
| 201 | The resulting detector will look as in figure 4.1.3, below:
|
|---|
| 202 | <P>
|
|---|
| 203 | <center>
|
|---|
| 204 | <table BORDER=1 CELLPADDING=8>
|
|---|
| 205 | <tr>
|
|---|
| 206 | <td><IMG SRC="geometry.src/avpic.jpg" ALT="Assembly volume detector" height=525 width=445></td>
|
|---|
| 207 | <tr>
|
|---|
| 208 | <td ALIGN=center>
|
|---|
| 209 | Figure 4.1.3<br>
|
|---|
| 210 | The geometry corresponding to source listing 4.1.7.</td>
|
|---|
| 211 | </tr>
|
|---|
| 212 | </table>
|
|---|
| 213 | </center>
|
|---|
| 214 |
|
|---|
| 215 | <hr><a href="../../../../Authors/html/subjectsToAuthors.html">
|
|---|
| 216 | <i>About the authors</a></i> </P>
|
|---|
| 217 |
|
|---|
| 218 | </body>
|
|---|
| 219 | </html>
|
|---|