Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/volumes/src/G4AssemblyVolume.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/volumes/src/G4AssemblyVolume.cc (Version 11.3.0) and /geometry/volumes/src/G4AssemblyVolume.cc (Version 9.2.p4)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
                                                   >>  25 //
                                                   >>  26 //
                                                   >>  27 // $Id: G4AssemblyVolume.cc,v 1.11.4.1 2010/01/26 13:26:52 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-02-patch-04 $
                                                   >>  29 //
 25 //                                                 30 // 
 26 // Class G4AssemblyVolume - implementation         31 // Class G4AssemblyVolume - implementation
 27 //                                                 32 //
 28 // Author: Radovan Chytracek, CERN - November  <<  33 // ----------------------------------------------------------------------
 29 // ------------------------------------------- << 
 30                                                    34 
 31 #include "G4AssemblyVolume.hh"                     35 #include "G4AssemblyVolume.hh"
 32 #include "G4AssemblyStore.hh"                  << 
 33 #include "G4PVPlacement.hh"                        36 #include "G4PVPlacement.hh"
 34 #include "G4RotationMatrix.hh"                     37 #include "G4RotationMatrix.hh"
 35 #include "G4AffineTransform.hh"                    38 #include "G4AffineTransform.hh"
 36 #include "G4LogicalVolume.hh"                      39 #include "G4LogicalVolume.hh"
 37 #include "G4VPhysicalVolume.hh"                    40 #include "G4VPhysicalVolume.hh"
 38 #include "G4ReflectionFactory.hh"                  41 #include "G4ReflectionFactory.hh"
 39                                                    42 
 40 #include <sstream>                                 43 #include <sstream>
 41                                                    44 
 42 G4ThreadLocal unsigned int G4AssemblyVolume::f <<  45 unsigned int G4AssemblyVolume::fsInstanceCounter = 0;
 43                                                    46 
 44 // ------------------------------------------- << 
 45 // Default constructor                             47 // Default constructor
 46 //                                                 48 //
 47 G4AssemblyVolume::G4AssemblyVolume()               49 G4AssemblyVolume::G4AssemblyVolume()
                                                   >>  50   : fAssemblyID( 0 )
 48 {                                                  51 {
 49   InstanceCountPlus();                             52   InstanceCountPlus();
 50   SetAssemblyID( GetInstanceCount() );             53   SetAssemblyID( GetInstanceCount() );
 51   SetImprintsCount( 0 );                           54   SetImprintsCount( 0 );
 52   G4AssemblyStore* aStore = G4AssemblyStore::G << 
 53   if (aStore->GetAssembly(fAssemblyID,false) ! << 
 54   {                                            << 
 55     std::ostringstream message;                << 
 56     message << "The assembly has NOT been regi << 
 57             << "          Assembly " << fAssem << 
 58             << " already existing in store !"  << 
 59     G4Exception("G4AssemblyVolume::G4AssemblyV << 
 60                 JustWarning, message);         << 
 61   }                                            << 
 62   else                                         << 
 63   {                                            << 
 64     aStore->Register(this);                    << 
 65   }                                            << 
 66 }                                                  55 }
 67                                                    56 
 68 // ------------------------------------------- << 
 69 // Composing constructor                           57 // Composing constructor
 70 //                                                 58 //
 71 G4AssemblyVolume::G4AssemblyVolume( G4LogicalV     59 G4AssemblyVolume::G4AssemblyVolume( G4LogicalVolume* volume,
 72                                     G4ThreeVec     60                                     G4ThreeVector& translation,
 73                                     G4Rotation     61                                     G4RotationMatrix* rotation )
                                                   >>  62   : fAssemblyID( 0 )
 74 {                                                  63 {
 75   InstanceCountPlus();                             64   InstanceCountPlus();
 76   SetAssemblyID( GetInstanceCount() );             65   SetAssemblyID( GetInstanceCount() );
 77   SetImprintsCount( 0 );                           66   SetImprintsCount( 0 );
 78   AddPlacedVolume(volume, translation, rotatio     67   AddPlacedVolume(volume, translation, rotation);
 79   G4AssemblyStore* aStore = G4AssemblyStore::G << 
 80   if (aStore->GetAssembly(fAssemblyID,false) ! << 
 81   {                                            << 
 82     std::ostringstream message;                << 
 83     message << "The assembly has NOT been regi << 
 84             << "          Assembly " << fAssem << 
 85             << " already existing in store !"  << 
 86     G4Exception("G4Assembly::G4Assembly()", "G << 
 87                 JustWarning, message);         << 
 88   }                                            << 
 89   else                                         << 
 90   {                                            << 
 91     aStore->Register(this);                    << 
 92   }                                            << 
 93 }                                                  68 }
 94                                                    69 
 95 // ------------------------------------------- << 
 96 // Destructor                                      70 // Destructor
 97 //                                                 71 //
 98 G4AssemblyVolume::~G4AssemblyVolume()              72 G4AssemblyVolume::~G4AssemblyVolume()
 99 {                                                  73 {
100   std::size_t howmany = fTriplets.size();      <<  74   unsigned int howmany = fTriplets.size();
101   if( howmany != 0 )                               75   if( howmany != 0 )
102   {                                                76   {
103     for( std::size_t i = 0; i < howmany; ++i ) <<  77     for( unsigned int i = 0; i < howmany; i++ )
104     {                                              78     {
105       G4RotationMatrix* pRotToClean = fTriplet     79       G4RotationMatrix* pRotToClean = fTriplets[i].GetRotation();
106       delete pRotToClean;                      <<  80       if( pRotToClean != 0 )
                                                   >>  81       {
                                                   >>  82         delete pRotToClean;
                                                   >>  83       }
107     }                                              84     }
108   }                                                85   }
109   fTriplets.clear();                               86   fTriplets.clear();
110                                                    87   
111   // No need to delete physical volumes, as th <<  88   howmany = fPVStore.size();
112   // by physical-volumes store.                <<  89   if( howmany != 0 )
113   //                                           <<  90   {
                                                   >>  91     for( unsigned int j = 0; j < howmany; j++ )
                                                   >>  92     {
                                                   >>  93       delete fPVStore[j];
                                                   >>  94     }
                                                   >>  95   }
114   fPVStore.clear();                                96   fPVStore.clear();
115   InstanceCountMinus();                            97   InstanceCountMinus();
116   G4AssemblyStore::GetInstance()->DeRegister(t << 
117 }                                                  98 }
118                                                    99 
119 // ------------------------------------------- << 
120 // Add and place the given volume according to    100 // Add and place the given volume according to the specified
121 // translation and rotation.                      101 // translation and rotation.
122 //                                                102 //
123 // The rotation matrix passed in can be 0 = id    103 // The rotation matrix passed in can be 0 = identity or an address even of an
124 // object on the upper stack frame. During ass    104 // object on the upper stack frame. During assembly imprint, it creates anyway
125 // a new matrix and keeps track of it so it ca    105 // a new matrix and keeps track of it so it can delete it later at destruction
126 // time.                                          106 // time.
127 // This policy has been adopted since user has    107 // This policy has been adopted since user has no control on the way the
128 // rotations are combined.                        108 // rotations are combined.
129 //                                                109 //
130 void G4AssemblyVolume::AddPlacedVolume( G4Logi    110 void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume*  pVolume,
131                                         G4Thre    111                                         G4ThreeVector&    translation,
132                                         G4Rota    112                                         G4RotationMatrix* pRotation )
133 {                                                 113 {
134   auto toStore = new G4RotationMatrix;         << 114   G4RotationMatrix*  toStore  = new G4RotationMatrix;
135                                                   115   
136   if( pRotation != nullptr )  { *toStore = *pR << 116   if( pRotation != 0 )  { *toStore = *pRotation; }
137                                                   117   
138   G4AssemblyTriplet toAdd( pVolume, translatio    118   G4AssemblyTriplet toAdd( pVolume, translation, toStore );
139   fTriplets.push_back( toAdd );                   119   fTriplets.push_back( toAdd );
140 }                                                 120 }
141                                                   121 
142 // ------------------------------------------- << 
143 // Add and place the given volume according to    122 // Add and place the given volume according to the specified transformation
144 //                                                123 //
145 void G4AssemblyVolume::AddPlacedVolume( G4Logi    124 void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume*  pVolume,
146                                         G4Tran    125                                         G4Transform3D&    transformation )
147 {                                                 126 {
148   // Decompose transformation                     127   // Decompose transformation
149   G4Scale3D     scale;                            128   G4Scale3D     scale;
150   G4Rotate3D    rotation;                         129   G4Rotate3D    rotation;
151   G4Translate3D translation;                      130   G4Translate3D translation;
152   transformation.getDecomposition(scale, rotat    131   transformation.getDecomposition(scale, rotation, translation);
153                                                   132 
154   G4ThreeVector v = translation.getTranslation << 133   G4ThreeVector      v = translation.getTranslation();
155   auto r = new G4RotationMatrix;               << 134   G4RotationMatrix*  r = new G4RotationMatrix;
156       *r = rotation.getRotation();             << 135                     *r = rotation.getRotation();
157                                                   136   
158   G4bool isReflection = false;                    137   G4bool isReflection = false;
159   if (scale(0,0)*scale(1,1)*scale(2,2) < 0.)      138   if (scale(0,0)*scale(1,1)*scale(2,2) < 0.)  { isReflection = true; }
160                                                   139 
161   G4AssemblyTriplet toAdd( pVolume, v, r, isRe    140   G4AssemblyTriplet toAdd( pVolume, v, r, isReflection );
162   fTriplets.push_back( toAdd );                   141   fTriplets.push_back( toAdd );
163 }                                                 142 }
164                                                   143 
165 // ------------------------------------------- << 
166 // Add and place the given assembly volume acc    144 // Add and place the given assembly volume according to the specified
167 // translation and rotation.                      145 // translation and rotation.
168 //                                                146 //
169 void G4AssemblyVolume::AddPlacedAssembly( G4As    147 void G4AssemblyVolume::AddPlacedAssembly( G4AssemblyVolume* pAssembly,
170                                           G4Th    148                                           G4ThreeVector&    translation,
171                                           G4Ro    149                                           G4RotationMatrix* pRotation )
172 {                                                 150 {
173   auto toStore = new G4RotationMatrix;         << 151   G4RotationMatrix*  toStore  = new G4RotationMatrix;
174                                                   152   
175   if( pRotation != nullptr )  { *toStore = *pR << 153   if( pRotation != 0 )  { *toStore = *pRotation; }
176                                                   154   
177   G4AssemblyTriplet toAdd( pAssembly, translat    155   G4AssemblyTriplet toAdd( pAssembly, translation, toStore );
178   fTriplets.push_back( toAdd );                   156   fTriplets.push_back( toAdd );
179 }                                                 157 }
180                                                   158 
181 // ------------------------------------------- << 
182 // Add and place the given assembly volume acc    159 // Add and place the given assembly volume according to the specified 
183 // transformation                                 160 // transformation
184 //                                                161 //
185 void G4AssemblyVolume::AddPlacedAssembly( G4As    162 void G4AssemblyVolume::AddPlacedAssembly( G4AssemblyVolume* pAssembly,
186                                           G4Tr    163                                           G4Transform3D&    transformation )
187 {                                                 164 {
188   // Decompose transformation                     165   // Decompose transformation
189   //                                              166   //
190   G4Scale3D     scale;                            167   G4Scale3D     scale;
191   G4Rotate3D    rotation;                         168   G4Rotate3D    rotation;
192   G4Translate3D translation;                      169   G4Translate3D translation;
193   transformation.getDecomposition(scale, rotat    170   transformation.getDecomposition(scale, rotation, translation);
194                                                   171 
195   G4ThreeVector      v = translation.getTransl    172   G4ThreeVector      v = translation.getTranslation();
196   auto r = new G4RotationMatrix;               << 173   G4RotationMatrix*  r = new G4RotationMatrix;
197       *r = rotation.getRotation();             << 174                     *r = rotation.getRotation();
198                                                   175   
199   G4bool isReflection = false;                    176   G4bool isReflection = false;
200   if (scale(0,0)*scale(1,1)*scale(2,2) < 0.)      177   if (scale(0,0)*scale(1,1)*scale(2,2) < 0.)  { isReflection = true; }
201                                                   178   
202   G4AssemblyTriplet toAdd( pAssembly, v, r, is    179   G4AssemblyTriplet toAdd( pAssembly, v, r, isReflection );
203   fTriplets.push_back( toAdd );                   180   fTriplets.push_back( toAdd );
204 }                                                 181 }
205                                                   182 
206 // ------------------------------------------- << 
207 // Create an instance of an assembly volume in    183 // Create an instance of an assembly volume inside of the specified
208 // mother volume. This works analogically to m    184 // mother volume. This works analogically to making stamp imprints.
209 // This method makes use of the Geant4 affine     185 // This method makes use of the Geant4 affine transformation class.
210 // The algorithm is defined as follows:           186 // The algorithm is defined as follows:
211 //                                                187 //  
212 // Having rotation matrix Rm and translation v    188 // Having rotation matrix Rm and translation vector Tm to be applied
213 // inside the mother and rotation matrix Ra an    189 // inside the mother and rotation matrix Ra and translation vector Ta
214 // to be applied inside the assembly itself fo    190 // to be applied inside the assembly itself for each of the participating
215 // volumes the resulting transformation is        191 // volumes the resulting transformation is
216 //                                                192 //  
217 // Tfinal = Ta * Tm                               193 // Tfinal = Ta * Tm
218 //                                                194 //  
219 // where Ta and Tm are constructed as             195 // where Ta and Tm are constructed as
220 //                                                196 //  
221 //        -1                                      197 //        -1                                     -1
222 // Ta = Ra  * Ta           and            Tm =    198 // Ta = Ra  * Ta           and            Tm = Rm  * Tm
223 //                                                199 //  
224 // which in words means that we create first t    200 // which in words means that we create first the affine transformations
225 // by inverse rotation matrices and translatio    201 // by inverse rotation matrices and translations for mother and assembly.
226 // The resulting final transformation to be ap    202 // The resulting final transformation to be applied to each of the
227 // participating volumes is their product.        203 // participating volumes is their product.
228 //                                                204 //
229 // IMPORTANT NOTE!                                205 // IMPORTANT NOTE!
230 // The order of multiplication is reversed whe    206 // The order of multiplication is reversed when comparing to CLHEP 3D
231 // transformation matrix(G4Transform3D class).    207 // transformation matrix(G4Transform3D class).
232 //                                                208 //  
233 // The rotation matrix passed in can be 0 = id    209 // The rotation matrix passed in can be 0 = identity or an address even of an
234 // object on the upper stack frame. During ass    210 // object on the upper stack frame. During assembly imprint, it creates anyway
235 // a new matrix and keeps track of it so it ca    211 // a new matrix and keeps track of it so it can delete it later at destruction
236 // time.                                          212 // time.
237 // This policy has been adopted since user has    213 // This policy has been adopted since user has no control on the way the
238 // rotations are combined.                        214 // rotations are combined.
239 //                                                215 // 
240 // If the assembly volume contains assembly (a    216 // If the assembly volume contains assembly (a'), the function is called
241 // recursively with composed transformation:      217 // recursively with composed transformation:
242 //                                                218 //
243 // Tanew =  Ta * Ta'                              219 // Tanew =  Ta * Ta'
244 //                                                220 //
245 void G4AssemblyVolume::MakeImprint( G4Assembly    221 void G4AssemblyVolume::MakeImprint( G4AssemblyVolume* pAssembly,
246                                     G4LogicalV    222                                     G4LogicalVolume*  pMotherLV,
247                                     G4Transfor    223                                     G4Transform3D&    transformation,
248                                     G4int copy    224                                     G4int copyNumBase,
249                                     G4bool sur    225                                     G4bool surfCheck )
250 {                                                 226 {
251   std::size_t numberOfDaughters;               << 227   unsigned int  numberOfDaughters;
252                                                << 228   
253   if( copyNumBase == 0 )                          229   if( copyNumBase == 0 )
254   {                                               230   {
255     numberOfDaughters = pMotherLV->GetNoDaught    231     numberOfDaughters = pMotherLV->GetNoDaughters();
256   }                                               232   }
257   else                                            233   else
258   {                                               234   {
259     numberOfDaughters = copyNumBase;              235     numberOfDaughters = copyNumBase;
260   }                                               236   }
261                                                   237 
262   // We start from the first available index      238   // We start from the first available index
263   //                                              239   //
264   ++numberOfDaughters;                         << 240   numberOfDaughters++;
265                                                   241 
266   ImprintsCountPlus();                            242   ImprintsCountPlus();
267                                                   243   
268   auto triplets = pAssembly->fTriplets;        << 244   std::vector<G4AssemblyTriplet> triplets = pAssembly->fTriplets;
269                                                << 
270   // store the transformation in a container ( << 
271   fImprintsTransf[GetImprintsCount()] = transf << 
272                                                   245 
273   for( std::size_t i = 0; i < triplets.size(); << 246   for( unsigned int   i = 0; i < triplets.size(); i++ )
274   {                                               247   {
275     G4Transform3D Ta( *(triplets[i].GetRotatio    248     G4Transform3D Ta( *(triplets[i].GetRotation()),
276                       triplets[i].GetTranslati    249                       triplets[i].GetTranslation() );
277     if ( triplets[i].IsReflection() )  { Ta =     250     if ( triplets[i].IsReflection() )  { Ta = Ta * G4ReflectZ3D(); }
278                                                   251 
279     G4Transform3D Tfinal = transformation * Ta    252     G4Transform3D Tfinal = transformation * Ta;
280                                                   253     
281     if ( triplets[i].GetVolume() != nullptr )  << 254     if ( triplets[i].GetVolume() )
282     {                                             255     {
283       // Generate the unique name for the next    256       // Generate the unique name for the next PV instance
284       // The name has format:                     257       // The name has format:
285       //                                          258       //
286       // av_WWW_impr_XXX_YYY_ZZZ                  259       // av_WWW_impr_XXX_YYY_ZZZ
287       // where the fields mean:                   260       // where the fields mean:
288       // WWW - assembly volume instance number    261       // WWW - assembly volume instance number
289       // XXX - assembly volume imprint number     262       // XXX - assembly volume imprint number
290       // YYY - the name of a log. volume we wa    263       // YYY - the name of a log. volume we want to make a placement of
291       // ZZZ - the log. volume index inside th    264       // ZZZ - the log. volume index inside the assembly volume
292       //                                          265       //
293       std::stringstream pvName;                   266       std::stringstream pvName;
294       pvName << "av_"                             267       pvName << "av_"
295              << GetAssemblyID()                   268              << GetAssemblyID()
296              << "_impr_"                          269              << "_impr_"
297              << GetImprintsCount()                270              << GetImprintsCount()
298              << "_"                               271              << "_"
299              << triplets[i].GetVolume()->GetNa    272              << triplets[i].GetVolume()->GetName().c_str()
300              << "_pv_"                            273              << "_pv_"
301              << i                                 274              << i
302              << std::ends;                        275              << std::ends;
303                                                   276 
304       // Generate a new physical volume instan    277       // Generate a new physical volume instance inside a mother
305       // (as we allow 3D transformation use G4    278       // (as we allow 3D transformation use G4ReflectionFactory to 
306       //  take into account eventual reflectio    279       //  take into account eventual reflection)
307       //                                          280       //
308       G4PhysicalVolumesPair pvPlaced              281       G4PhysicalVolumesPair pvPlaced
309         = G4ReflectionFactory::Instance()->Pla    282         = G4ReflectionFactory::Instance()->Place( Tfinal,
310                                                   283                                                   pvName.str().c_str(),
311                                                   284                                                   triplets[i].GetVolume(),
312                                                   285                                                   pMotherLV,
313                                                   286                                                   false,
314                                                << 287                                                   numberOfDaughters + i,
315                                                   288                                                   surfCheck );
316                                                   289 
317       // Register the physical volume created     290       // Register the physical volume created by us so we can delete it later
318       //                                          291       //
319       fPVStore.push_back( pvPlaced.first );       292       fPVStore.push_back( pvPlaced.first );
320       if ( pvPlaced.second != nullptr )  { fPV << 293       if ( pvPlaced.second )  { fPVStore.push_back( pvPlaced.second ); }
321                                                << 
322       // Here I want to save the imprint trans << 
323       // imprintTrans[GetImprintsCount()] = tr << 
324                                                << 
325     }                                             294     }
326     else if ( triplets[i].GetAssembly() != nul << 295     else if ( triplets[i].GetAssembly() )
327     {                                             296     {
328       // Place volumes in this assembly with c    297       // Place volumes in this assembly with composed transformation
329       //                                          298       //
330       MakeImprint( triplets[i].GetAssembly(),     299       MakeImprint( triplets[i].GetAssembly(), pMotherLV,
331                    Tfinal, (G4int)i*100+copyNu << 300                    Tfinal, i*100+copyNumBase, surfCheck ); 
332     }                                             301     }
333     else                                          302     else
334     {                                             303     {
335       G4Exception("G4AssemblyVolume::MakeImpri    304       G4Exception("G4AssemblyVolume::MakeImprint(..)",
336                   "GeomVol0003", FatalExceptio << 305                   "NotApplicable", FatalException,
337                   "Triplet has no volume and n    306                   "Triplet has no volume and no assembly");
338     }                                             307     }  
339   }                                               308   }  
340 }                                                 309 }    
341                                                   310 
342 // ------------------------------------------- << 
343 void G4AssemblyVolume::MakeImprint( G4LogicalV    311 void G4AssemblyVolume::MakeImprint( G4LogicalVolume*  pMotherLV,
344                                     G4ThreeVec    312                                     G4ThreeVector&    translationInMother,
345                                     G4Rotation    313                                     G4RotationMatrix* pRotationInMother,
346                                     G4int copy    314                                     G4int copyNumBase,
347                                     G4bool sur    315                                     G4bool surfCheck )
348 {                                                 316 {
349   // If needed user can specify explicitely th    317   // If needed user can specify explicitely the base count from which to start
350   // off for the generation of phys. vol. copy    318   // off for the generation of phys. vol. copy numbers.
351   // The old behaviour is preserved when copyN    319   // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
352   // copy numbers start from the count equal t    320   // copy numbers start from the count equal to current number of daughter
353   // volumes before an imprint is made            321   // volumes before an imprint is made
354                                                   322 
355   // Compose transformation                       323   // Compose transformation
356   //                                              324   //
357   if( pRotationInMother == nullptr )           << 325   if( pRotationInMother == 0 )
358   {                                               326   {
359     // Make it by default an indentity matrix     327     // Make it by default an indentity matrix
360     //                                            328     //
361     pRotationInMother =                           329     pRotationInMother =
362       const_cast<G4RotationMatrix*>( &G4Rotati    330       const_cast<G4RotationMatrix*>( &G4RotationMatrix::IDENTITY );
363   }                                               331   }
364                                                   332 
365   G4Transform3D transform( *pRotationInMother,    333   G4Transform3D transform( *pRotationInMother,
366                             translationInMothe    334                             translationInMother );
367   MakeImprint(this, pMotherLV, transform, copy    335   MakeImprint(this, pMotherLV, transform, copyNumBase, surfCheck);
368 }                                                 336 }
369                                                   337 
370 // ------------------------------------------- << 
371 void G4AssemblyVolume::MakeImprint( G4LogicalV    338 void G4AssemblyVolume::MakeImprint( G4LogicalVolume*  pMotherLV,
372                                     G4Transfor    339                                     G4Transform3D&    transformation,
373                                     G4int copy    340                                     G4int copyNumBase,
374                                     G4bool sur    341                                     G4bool surfCheck )
375 {                                                 342 {
376   // If needed user can specify explicitely th    343   // If needed user can specify explicitely the base count from which to start
377   // off for the generation of phys. vol. copy    344   // off for the generation of phys. vol. copy numbers.
378   // The old behaviour is preserved when copyN    345   // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
379   // copy numbers start from the count equal t    346   // copy numbers start from the count equal to current number of daughter
380   // volumes before a imprint is made             347   // volumes before a imprint is made
381                                                   348 
382   MakeImprint(this, pMotherLV, transformation,    349   MakeImprint(this, pMotherLV, transformation, copyNumBase, surfCheck);
383 }                                                 350 }
384                                                   351 
385 // ------------------------------------------- << 
386 unsigned int G4AssemblyVolume::GetInstanceCoun    352 unsigned int G4AssemblyVolume::GetInstanceCount() const
387 {                                                 353 {
388   return G4AssemblyVolume::fsInstanceCounter;     354   return G4AssemblyVolume::fsInstanceCounter;
389 }                                                 355 }
390                                                   356 
391 // ------------------------------------------- << 357 void         G4AssemblyVolume::SetInstanceCount( unsigned int value )
392 void G4AssemblyVolume::SetInstanceCount( unsig << 
393 {                                                 358 {
394   G4AssemblyVolume::fsInstanceCounter = value;    359   G4AssemblyVolume::fsInstanceCounter = value;
395 }                                                 360 }
396                                                   361 
397 // ------------------------------------------- << 362 void         G4AssemblyVolume::InstanceCountPlus()
398 void G4AssemblyVolume::InstanceCountPlus()     << 
399 {                                                 363 {
400   G4AssemblyVolume::fsInstanceCounter++;          364   G4AssemblyVolume::fsInstanceCounter++;
401 }                                                 365 }
402                                                   366 
403 // ------------------------------------------- << 367 void         G4AssemblyVolume::InstanceCountMinus()
404 void G4AssemblyVolume::InstanceCountMinus()    << 
405 {                                                 368 {
406   G4AssemblyVolume::fsInstanceCounter--;          369   G4AssemblyVolume::fsInstanceCounter--;
407 }                                                 370 }
408                                                   371