Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/divisions/src/G4PVDivision.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/divisions/src/G4PVDivision.cc (Version 11.3.0) and /geometry/divisions/src/G4PVDivision.cc (Version 7.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 // G4PVDivision Implementation file            << 
 27 //                                                 23 //
 28 // 26.05.03 - P.Arce, Initial version          <<  24 // $Id: G4PVDivision.cc,v 1.12 2004/08/26 07:58:37 gcosmo Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-07-00-patch-01 $
                                                   >>  26 //
                                                   >>  27 // class G4PVDivision Implementation file
                                                   >>  28 //
                                                   >>  29 // 26.05.03 - P.Arce Initial version
 29 // -------------------------------------------     30 // --------------------------------------------------------------------
 30                                                    31 
 31 #include "G4PVDivision.hh"                         32 #include "G4PVDivision.hh"
 32 #include "G4LogicalVolume.hh"                      33 #include "G4LogicalVolume.hh"
 33 #include "G4VSolid.hh"                             34 #include "G4VSolid.hh"
 34 #include "G4ReflectedSolid.hh"                     35 #include "G4ReflectedSolid.hh"
 35 #include "G4ParameterisationBox.hh"                36 #include "G4ParameterisationBox.hh"
 36 #include "G4ParameterisationTubs.hh"               37 #include "G4ParameterisationTubs.hh"
 37 #include "G4ParameterisationCons.hh"               38 #include "G4ParameterisationCons.hh"
 38 #include "G4ParameterisationTrd.hh"                39 #include "G4ParameterisationTrd.hh"
 39 #include "G4ParameterisationPara.hh"               40 #include "G4ParameterisationPara.hh"
 40 #include "G4ParameterisationPolycone.hh"           41 #include "G4ParameterisationPolycone.hh"
 41 #include "G4ParameterisationPolyhedra.hh"          42 #include "G4ParameterisationPolyhedra.hh"
 42                                                    43 
 43 //--------------------------------------------     44 //--------------------------------------------------------------------------
 44 G4PVDivision::G4PVDivision(const G4String& pNa     45 G4PVDivision::G4PVDivision(const G4String& pName,
 45                                  G4LogicalVolu     46                                  G4LogicalVolume* pLogical,
 46                                  G4LogicalVolu     47                                  G4LogicalVolume* pMotherLogical,
 47                            const EAxis pAxis,      48                            const EAxis pAxis,
 48                            const G4int nDivs,      49                            const G4int nDivs,
 49                            const G4double widt     50                            const G4double width,
 50                            const G4double offs     51                            const G4double offset )
 51   : G4PVReplica(pName, nDivs, pAxis, pLogical, <<  52   : G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
                                                   >>  53     fcopyNo(-1)
 52 {                                                  54 {
 53   if (pMotherLogical == nullptr)               <<  55   if (pMotherLogical) pMotherLogical->AddDaughter(this);
 54   {                                            <<  56   SetParameterisation( pMotherLogical, pAxis, nDivs,
 55     std::ostringstream message;                <<  57                        width, offset, DivNDIVandWIDTH );
 56     message << "Invalid setup." << G4endl      << 
 57             << "NULL pointer specified as moth << 
 58     G4Exception("G4PVDivision::G4PVDivision()" << 
 59                 FatalException, message);      << 
 60     return;                                    << 
 61   }                                            << 
 62   if (pLogical == pMotherLogical)              << 
 63   {                                            << 
 64     std::ostringstream message;                << 
 65     message << "Invalid setup." << G4endl      << 
 66             << "Cannot place a volume inside i << 
 67     G4Exception("G4PVDivision::G4PVDivision()" << 
 68                 FatalException, message);      << 
 69   }                                            << 
 70   pMotherLogical->AddDaughter(this);           << 
 71   SetMotherLogical(pMotherLogical);            << 
 72   SetParameterisation(pMotherLogical, pAxis, n << 
 73                       width, offset, DivNDIVan << 
 74   CheckAndSetParameters (pAxis, nDivs, width,      58   CheckAndSetParameters (pAxis, nDivs, width, offset,
 75                          DivNDIVandWIDTH, pMot <<  59                          DivNDIVandWIDTH, pMotherLogical );
 76 }                                                  60 }
 77                                                    61 
 78 //--------------------------------------------     62 //--------------------------------------------------------------------------
 79 G4PVDivision::G4PVDivision(const G4String& pNa     63 G4PVDivision::G4PVDivision(const G4String& pName,
 80                                  G4LogicalVolu     64                                  G4LogicalVolume* pLogical,
 81                                  G4LogicalVolu     65                                  G4LogicalVolume* pMotherLogical,
 82                            const EAxis pAxis,      66                            const EAxis pAxis,
 83                            const G4int nDivs,      67                            const G4int nDivs,
 84                            const G4double offs     68                            const G4double offset )
 85   : G4PVReplica(pName, nDivs, pAxis, pLogical, <<  69   : G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
                                                   >>  70     fcopyNo(-1)
 86 {                                                  71 {
 87   if (pMotherLogical == nullptr)               <<  72   if (pMotherLogical) pMotherLogical->AddDaughter(this);
 88   {                                            <<  73   SetParameterisation( pMotherLogical, pAxis, nDivs, 0., offset, DivNDIV );
 89     std::ostringstream message;                <<  74   CheckAndSetParameters (pAxis, nDivs, 0., offset, DivNDIV, pMotherLogical );
 90     message << "Invalid setup." << G4endl      << 
 91             << "NULL pointer specified as moth << 
 92     G4Exception("G4PVDivision::G4PVDivision()" << 
 93                 FatalException, message);      << 
 94     return;                                    << 
 95   }                                            << 
 96   if (pLogical == pMotherLogical)              << 
 97   {                                            << 
 98     std::ostringstream message;                << 
 99     message << "Invalid setup." << G4endl      << 
100             << "Cannot place a volume inside i << 
101     G4Exception("G4PVDivision::G4PVDivision()" << 
102                 FatalException, message);      << 
103   }                                            << 
104   pMotherLogical->AddDaughter(this);           << 
105   SetMotherLogical(pMotherLogical);            << 
106   SetParameterisation(pMotherLogical, pAxis, n << 
107   CheckAndSetParameters (pAxis, nDivs, 0., off << 
108 }                                                  75 }
109                                                    76 
110 //--------------------------------------------     77 //--------------------------------------------------------------------------
111 G4PVDivision::G4PVDivision(const G4String& pNa     78 G4PVDivision::G4PVDivision(const G4String& pName,
112                                  G4LogicalVolu     79                                  G4LogicalVolume* pLogical,
113                                  G4LogicalVolu     80                                  G4LogicalVolume* pMotherLogical,
114                            const EAxis pAxis,      81                            const EAxis pAxis,
115                            const G4double widt     82                            const G4double width,
116                            const G4double offs     83                            const G4double offset )
117   : G4PVReplica(pName, 0, pAxis, pLogical, pMo <<  84   : G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
118 {                                              <<  85     fcopyNo(-1)
119   if (pMotherLogical == nullptr)               << 
120   {                                            << 
121     std::ostringstream message;                << 
122     message << "Invalid setup." << G4endl      << 
123             << "NULL pointer specified as moth << 
124     G4Exception("G4PVDivision::G4PVDivision()" << 
125                 FatalException, message);      << 
126     return;                                    << 
127   }                                            << 
128   if (pLogical == pMotherLogical)              << 
129   {                                            << 
130     std::ostringstream message;                << 
131     message << "Invalid setup." << G4endl      << 
132             << "Cannot place a volume inside i << 
133     G4Exception("G4PVDivision::G4PVDivision()" << 
134                 FatalException, message);      << 
135   }                                            << 
136   pMotherLogical->AddDaughter(this);           << 
137   SetMotherLogical(pMotherLogical);            << 
138   SetParameterisation(pMotherLogical, pAxis, 0 << 
139   CheckAndSetParameters (pAxis, 0, width, offs << 
140 }                                              << 
141                                                << 
142 //-------------------------------------------- << 
143 G4PVDivision::G4PVDivision(const G4String& pNa << 
144                                  G4LogicalVolu << 
145                                  G4VPhysicalVo << 
146                            const EAxis pAxis,  << 
147                            const G4int nDivs,  << 
148                            const G4double widt << 
149                            const G4double offs << 
150   : G4PVReplica(pName, nDivs, pAxis, pLogical, << 
151                 pMotherPhysical != nullptr ? p << 
152 {                                                  86 {
153   if (pMotherPhysical == nullptr)              <<  87   if (pMotherLogical) pMotherLogical->AddDaughter(this);
154   {                                            <<  88   SetParameterisation( pMotherLogical, pAxis, 0, width, offset, DivWIDTH );
155     std::ostringstream message;                <<  89   CheckAndSetParameters (pAxis, 0, width, offset, DivWIDTH, pMotherLogical );
156     message << "Invalid setup." << G4endl      << 
157             << "NULL pointer specified as moth << 
158     G4Exception("G4PVDivision::G4PVDivision()" << 
159                 FatalException, message);      << 
160     return;                                    << 
161   }                                            << 
162   G4LogicalVolume* pMotherLogical = pMotherPhy << 
163   if (pLogical == pMotherLogical)              << 
164   {                                            << 
165     std::ostringstream message;                << 
166     message << "Invalid setup." << G4endl      << 
167             << "Cannot place a volume inside i << 
168     G4Exception("G4PVDivision::G4PVDivision()" << 
169                 FatalException, message);      << 
170   }                                            << 
171   pMotherLogical->AddDaughter(this);           << 
172   SetMotherLogical(pMotherLogical);            << 
173   SetParameterisation(pMotherLogical, pAxis, n << 
174                       width, offset, DivNDIVan << 
175   CheckAndSetParameters (pAxis, nDivs, width,  << 
176                          DivNDIVandWIDTH, pMot << 
177 }                                                  90 }
178                                                    91 
179 //--------------------------------------------     92 //--------------------------------------------------------------------------
180 void                                               93 void
181 G4PVDivision::CheckAndSetParameters( const EAx     94 G4PVDivision::CheckAndSetParameters( const EAxis pAxis,
182                                      const G4i     95                                      const G4int nDivs,
183                                      const G4d     96                                      const G4double width,
184                                      const G4d     97                                      const G4double offset, 
185                                            Div     98                                            DivisionType divType,
186                                      const G4L     99                                      const G4LogicalVolume* pMotherLogical )
187 {                                                 100 {
188   if( divType == DivWIDTH )                       101   if( divType == DivWIDTH )
189   {                                               102   {
190     fnReplicas = fparam->GetNoDiv();              103     fnReplicas = fparam->GetNoDiv();
191   }                                               104   }
192   else                                            105   else
193   {                                               106   {
194     fnReplicas = nDivs;                           107     fnReplicas = nDivs;
195   }                                               108   }
196   if (fnReplicas < 1 )                            109   if (fnReplicas < 1 )
197   {                                               110   {
198     G4Exception("G4PVDivision::CheckAndSetPara << 111     G4Exception("G4PVDivision::G4PVDivision()", "IllegalConstruct",
199                 FatalException, "Illegal numbe    112                 FatalException, "Illegal number of replicas!");
200   }                                               113   }
201                                                   114 
202   if( divType != DivNDIV)                         115   if( divType != DivNDIV)
203   {                                               116   {
204     fwidth = fparam->GetWidth();                  117     fwidth = fparam->GetWidth();
205   }                                               118   }
206   else                                            119   else
207   {                                               120   {
208     fwidth = width;                               121     fwidth = width;
209   }                                               122   }
210   if( fwidth < 0 )                                123   if( fwidth < 0 )
211   {                                               124   {
212     G4Exception("G4PVDivision::CheckAndSetPara << 125     G4Exception("G4PVDivision::G4PVDivision()", "IllegalConstruct",
213                 FatalException, "Width must be    126                 FatalException, "Width must be positive!");
214   }                                               127   }
215                                                   128   
216   foffset = offset;                            << 129   foffset=offset;
217   fdivAxis = pAxis;                            << 130   
218                                                << 
219   //!!!!! axis has to be x/y/z in G4VoxelLimit    131   //!!!!! axis has to be x/y/z in G4VoxelLimits::GetMinExtent
220   //                                              132   //
221   if( pAxis == kRho || pAxis == kRadial3D || p    133   if( pAxis == kRho || pAxis == kRadial3D || pAxis == kPhi )
222   {                                               134   {
223     faxis = kZAxis;                               135     faxis = kZAxis;
224   }                                               136   }
225   else                                            137   else
226   {                                               138   {
227     faxis = pAxis;                                139     faxis = pAxis;
228   }                                               140   }
229                                                   141   
230   // Create rotation matrix: for phi axis it w    142   // Create rotation matrix: for phi axis it will be changed
231   // in G4VPVParameterisation::ComputeTransfor    143   // in G4VPVParameterisation::ComputeTransformation, for others
232   // it will stay the unity                       144   // it will stay the unity
233   //                                              145   //
234   auto  pRMat = new G4RotationMatrix();        << 146   G4RotationMatrix *pRMat = new G4RotationMatrix();
235   SetRotation(pRMat);                             147   SetRotation(pRMat);
236                                                   148   
237   switch (faxis)                                  149   switch (faxis)
238   {                                               150   {
239     case kPhi:                                    151     case kPhi:
240       break;                                      152       break;
241     case kRho:                                    153     case kRho:
242     case kXAxis:                                  154     case kXAxis:
243     case kYAxis:                                  155     case kYAxis:
244     case kZAxis:                                  156     case kZAxis:
245       break;                                      157       break;
246     default:                                      158     default:
247       G4Exception("G4PVDivision::CheckAndSetPa << 159       G4Exception("G4PVDivision::G4PVDivision()", "IllegalConstruct",
248                   FatalException, "Unknown axi    160                   FatalException, "Unknown axis of replication.");
249       break;                                      161       break;
250   }                                               162   }
251                                                   163 
252                                                   164 
253   //----- Check that mother solid is of the sa    165   //----- Check that mother solid is of the same type than
254   //      daughter solid (otherwise, the corre    166   //      daughter solid (otherwise, the corresponding
255   //      Parameterisation::ComputeDimension()    167   //      Parameterisation::ComputeDimension() will not be called)
256   //                                              168   //
257   G4String msolType = pMotherLogical->GetSolid    169   G4String msolType = pMotherLogical->GetSolid()->GetEntityType();
258   G4String dsolType = GetLogicalVolume()->GetS    170   G4String dsolType = GetLogicalVolume()->GetSolid()->GetEntityType();
259   if( msolType != dsolType && ( msolType != "G << 171   if( msolType != dsolType )
260   {                                               172   {
261     std::ostringstream message;                << 173     G4cerr << "ERROR - G4PVDivision::CheckAndSetParameters()"
262     message << "Incorrect solid type for divis << 174            << G4endl
263             << GetName() << "." << G4endl      << 175            << "        Incorrect solid type in call to G4PVDivision of volume "
264             << "It is: " << msolType           << 176            << GetName() << G4endl
265             << ", while it should be: " << dso << 177            << "        It is: " << msolType
266     G4Exception("G4PVDivision::CheckAndSetPara << 178            << ", while it should be: " << dsolType << "." << G4endl;
267                 "GeomDiv0002", FatalException, << 179     G4Exception("G4VDivisionParameterisation::CheckAndSetParameters()",
                                                   >> 180                 "IllegalConstruct", FatalException,
                                                   >> 181                 "Incorrect solid type for division !");
268   }                                               182   }
269 }                                                 183 }
270                                                   184 
271 //--------------------------------------------    185 //--------------------------------------------------------------------------
272 G4PVDivision::~G4PVDivision() = default;       << 186 G4PVDivision::~G4PVDivision()
273                                                << 
274 //-------------------------------------------- << 
275 EAxis G4PVDivision::GetDivisionAxis() const    << 
276 {                                                 187 {
277   return fdivAxis;                             << 188   delete GetRotation();
278 }                                                 189 }
279                                                   190 
280 //--------------------------------------------    191 //--------------------------------------------------------------------------
281 G4bool G4PVDivision::IsParameterised() const      192 G4bool G4PVDivision::IsParameterised() const
282 {                                                 193 { 
283   return true;                                    194   return true;
284 }                                                 195 }
285                                                   196 
286 //--------------------------------------------    197 //--------------------------------------------------------------------------
287 G4bool G4PVDivision::IsMany() const               198 G4bool G4PVDivision::IsMany() const
288 {                                                 199 {
289   return false;                                   200   return false; 
290 }                                                 201 }
291                                                   202 
292 //--------------------------------------------    203 //--------------------------------------------------------------------------
293 G4bool G4PVDivision::IsReplicated() const      << 204 G4int G4PVDivision::GetCopyNo() const
294 {                                                 205 {
295   return true;                                 << 206   return fcopyNo;
                                                   >> 207 }
                                                   >> 208 
                                                   >> 209 //--------------------------------------------------------------------------
                                                   >> 210 void  G4PVDivision::SetCopyNo(G4int newCopyNo)
                                                   >> 211 {
                                                   >> 212   fcopyNo= newCopyNo;
296 }                                                 213 }
297                                                   214 
298 //--------------------------------------------    215 //--------------------------------------------------------------------------
299 G4int G4PVDivision::GetMultiplicity() const    << 216 G4bool G4PVDivision::IsReplicated() const
300 {                                                 217 {
301   return fnReplicas;                           << 218   return true;
302 }                                                 219 }
303                                                   220 
304 //--------------------------------------------    221 //--------------------------------------------------------------------------
305 G4VPVParameterisation* G4PVDivision::GetParame    222 G4VPVParameterisation* G4PVDivision::GetParameterisation() const
306 {                                                 223 {
307   return fparam;                                  224   return fparam;
308 }                                                 225 }
309                                                   226 
310 //--------------------------------------------    227 //--------------------------------------------------------------------------
311 void G4PVDivision::GetReplicationData(EAxis& a    228 void G4PVDivision::GetReplicationData(EAxis& axis,
312                                       G4int& n    229                                       G4int& nDivs,
313                                       G4double    230                                       G4double& width,
314                                       G4double    231                                       G4double& offset,
315                                       G4bool&     232                                       G4bool& consuming ) const
316 {                                                 233 {
317   axis = faxis;                                << 234   axis=faxis;
318   nDivs = fnReplicas;                          << 235   nDivs=fnReplicas;
319   width = fwidth;                              << 236   width=fwidth;
320   offset = foffset;                            << 237   offset=foffset;
321   consuming = false;                           << 238   consuming=false;
322 }                                                 239 }
323                                                   240 
324 //-------------------------------------------- << 
325 EVolume G4PVDivision::VolumeType() const       << 
326 {                                              << 
327   return kParameterised;                       << 
328 }                                              << 
329                                                   241 
330 //--------------------------------------------    242 //--------------------------------------------------------------------------
331 // TODO: this method should check that the chi << 243 //TODO: this method should check that the child lv is of the correct type,
332 //       else the ComputeDimensions will never << 244 //      else the ComputeDimensions will never be called
333 //                                             << 
334 void G4PVDivision::SetParameterisation( G4Logi    245 void G4PVDivision::SetParameterisation( G4LogicalVolume* motherLogical,
335                                   const EAxis     246                                   const EAxis axis,
336                                   const G4int     247                                   const G4int nDivs,
337                                   const G4doub    248                                   const G4double width,
338                                   const G4doub    249                                   const G4double offset,
339                                         Divisi    250                                         DivisionType divType )
340 {                                                 251 {
341   // Check that solid is compatible with mothe    252   // Check that solid is compatible with mother solid and axis of division   
342   // CheckSolid( solid, motherSolid );            253   // CheckSolid( solid, motherSolid );
343   // G4cout << " Axis " << axis << G4endl;        254   // G4cout << " Axis " << axis << G4endl;
344                                                   255 
345   G4VSolid* mSolid = motherLogical->GetSolid()    256   G4VSolid* mSolid = motherLogical->GetSolid();
346   G4String mSolidType = mSolid->GetEntityType(    257   G4String mSolidType = mSolid->GetEntityType();
347                                                   258 
348   // If the solid is a reflected one, update t    259   // If the solid is a reflected one, update type to its
349   // real constituent solid.                      260   // real constituent solid.
350   //                                              261   // 
351   if (mSolidType == "G4ReflectedSolid")           262   if (mSolidType == "G4ReflectedSolid")
352   {                                               263   {
353       mSolidType = ((G4ReflectedSolid*)mSolid)    264       mSolidType = ((G4ReflectedSolid*)mSolid)->GetConstituentMovedSolid()
354                  ->GetEntityType();               265                  ->GetEntityType(); 
355   }                                               266   }    
356                                                   267 
357   // Parameterisation type depend of mother so    268   // Parameterisation type depend of mother solid type and axis of division
358   //                                              269   //
359   if( mSolidType == "G4Box" )                     270   if( mSolidType == "G4Box" )
360   {                                               271   {
361     switch( axis )                                272     switch( axis )
362     {                                             273     {
363       case kXAxis:                                274       case kXAxis:
364         fparam = new G4ParameterisationBoxX( a    275         fparam = new G4ParameterisationBoxX( axis, nDivs, width,
365                                              o    276                                              offset, mSolid, divType );
366         break;                                    277         break;
367       case kYAxis:                                278       case kYAxis:
368         fparam = new G4ParameterisationBoxY( a    279         fparam = new G4ParameterisationBoxY( axis, nDivs, width,
369                                              o    280                                              offset, mSolid, divType );
370         break;                                    281         break;
371       case kZAxis:                                282       case kZAxis:
372         fparam = new G4ParameterisationBoxZ( a    283         fparam = new G4ParameterisationBoxZ( axis, nDivs, width,
373                                              o    284                                              offset, mSolid, divType );
374         break;                                    285         break;
375       default:                                    286       default:
376         ErrorInAxis( axis, mSolid );              287         ErrorInAxis( axis, mSolid );
377         break;                                    288         break;
378     }                                             289     }
379   }                                               290   }
380   else if( mSolidType == "G4Tubs" )               291   else if( mSolidType == "G4Tubs" )
381   {                                               292   {
382     switch( axis )                                293     switch( axis )
383     {                                             294     {
384       case kRho:                                  295       case kRho:
385         fparam = new G4ParameterisationTubsRho    296         fparam = new G4ParameterisationTubsRho( axis, nDivs, width,
386                                                   297                                                 offset, mSolid, divType );
387         break;                                    298         break;
388       case kPhi:                                  299       case kPhi:
389         fparam = new G4ParameterisationTubsPhi    300         fparam = new G4ParameterisationTubsPhi( axis, nDivs, width,
390                                                   301                                                 offset, mSolid, divType );
391         break;                                    302         break;
392       case kZAxis:                                303       case kZAxis:
393         fparam = new G4ParameterisationTubsZ(     304         fparam = new G4ParameterisationTubsZ( axis, nDivs, width,
394                                                   305                                               offset, mSolid, divType );
395         break;                                    306         break;
396       default:                                    307       default:
397         ErrorInAxis( axis, mSolid );              308         ErrorInAxis( axis, mSolid );
398         break;                                    309         break;
399     }                                             310     }
400   }                                               311   }
401   else if( mSolidType == "G4Cons" )               312   else if( mSolidType == "G4Cons" )
402   {                                               313   {
403     switch( axis )                                314     switch( axis )
404     {                                             315     {
405       case kRho:                                  316       case kRho:
406         fparam = new G4ParameterisationConsRho    317         fparam = new G4ParameterisationConsRho( axis, nDivs, width,
407                                                   318                                                 offset, mSolid, divType );
408         break;                                    319         break;
409       case kPhi:                                  320       case kPhi:
410         fparam = new G4ParameterisationConsPhi    321         fparam = new G4ParameterisationConsPhi( axis, nDivs, width,
411                                                   322                                                 offset, mSolid, divType );
412         break;                                    323         break;
413       case kZAxis:                                324       case kZAxis:
414         fparam = new G4ParameterisationConsZ(     325         fparam = new G4ParameterisationConsZ( axis, nDivs, width,
415                                                   326                                               offset, mSolid, divType );
416         break;                                    327         break;
417       default:                                    328       default:
418         ErrorInAxis( axis, mSolid );              329         ErrorInAxis( axis, mSolid );
419         break;                                    330         break;
420     }                                             331     }
421   }                                               332   }
422   else if( mSolidType == "G4Trd" )                333   else if( mSolidType == "G4Trd" )
423   {                                               334   { 
424     switch( axis )                                335     switch( axis )
425     {                                             336     {
426       case kXAxis:                                337       case kXAxis:
427         fparam = new G4ParameterisationTrdX( a    338         fparam = new G4ParameterisationTrdX( axis, nDivs, width,
428                                              o    339                                              offset, mSolid, divType );
429         break;                                    340         break;
430       case kYAxis:                                341       case kYAxis:
431         fparam = new G4ParameterisationTrdY( a    342         fparam = new G4ParameterisationTrdY( axis, nDivs, width,
432                                              o    343                                              offset, mSolid, divType );
433         break;                                    344         break;
434       case kZAxis:                                345       case kZAxis:
435         fparam = new G4ParameterisationTrdZ( a    346         fparam = new G4ParameterisationTrdZ( axis, nDivs, width,
436                                              o    347                                              offset, mSolid, divType );
437         break;                                    348         break;
438       default:                                    349       default:
439         ErrorInAxis( axis, mSolid );              350         ErrorInAxis( axis, mSolid );
440         break;                                    351         break;
441     }                                             352     }
442   }                                               353   }
443   else if( mSolidType == "G4Para" )               354   else if( mSolidType == "G4Para" )
444   {                                               355   { 
445     switch( axis )                                356     switch( axis )
446     {                                             357     {
447       case kXAxis:                                358       case kXAxis:
448         fparam = new G4ParameterisationParaX(     359         fparam = new G4ParameterisationParaX( axis, nDivs, width,
449                                              o    360                                              offset, mSolid, divType );
450         break;                                    361         break;
451       case kYAxis:                                362       case kYAxis:
452         fparam = new G4ParameterisationParaY(     363         fparam = new G4ParameterisationParaY( axis, nDivs, width,
453                                              o    364                                              offset, mSolid, divType );
454         break;                                    365         break;
455       case kZAxis:                                366       case kZAxis:
456         fparam = new G4ParameterisationParaZ(     367         fparam = new G4ParameterisationParaZ( axis, nDivs, width,
457                                              o    368                                              offset, mSolid, divType );
458         break;                                    369         break;
459       default:                                    370       default:
460         ErrorInAxis( axis, mSolid );              371         ErrorInAxis( axis, mSolid );
461         break;                                    372         break;
462     }                                             373     }
463   }                                               374   }
464 //  else if( mSolidType == "G4Trap" )             375 //  else if( mSolidType == "G4Trap" )
465 //  {                                             376 //  {
466 //  }                                             377 //  }
467   else if( mSolidType == "G4Polycone" )           378   else if( mSolidType == "G4Polycone" )
468   {                                               379   {
469     switch( axis )                                380     switch( axis )
470     {                                             381     {
471       case kRho:                                  382       case kRho:
472         fparam = new G4ParameterisationPolycon    383         fparam = new G4ParameterisationPolyconeRho( axis, nDivs, width,
473                                                   384                                                     offset, mSolid, divType );
474         break;                                    385         break;
475       case kPhi:                                  386       case kPhi:
476         fparam = new G4ParameterisationPolycon    387         fparam = new G4ParameterisationPolyconePhi( axis, nDivs, width,
477                                                   388                                                     offset, mSolid, divType );
478         break;                                    389         break;
479       case kZAxis:                                390       case kZAxis:
480         fparam = new G4ParameterisationPolycon    391         fparam = new G4ParameterisationPolyconeZ( axis, nDivs, width,
481                                                   392                                                   offset, mSolid, divType );
482         break;                                    393         break;
483       default:                                    394       default:
484         ErrorInAxis( axis, mSolid );              395         ErrorInAxis( axis, mSolid );
485       break;                                      396       break;
486     }                                             397     }
487   }                                               398   }
488   else if( mSolidType == "G4Polyhedra" )          399   else if( mSolidType == "G4Polyhedra" )
489   {                                               400   {
490     switch( axis )                                401     switch( axis )
491     {                                             402     {
492       case kRho:                                  403       case kRho:
493         fparam = new G4ParameterisationPolyhed    404         fparam = new G4ParameterisationPolyhedraRho( axis, nDivs, width,
494                                                   405                                                     offset, mSolid, divType );
495         break;                                    406         break;
496       case kPhi:                                  407       case kPhi:
497         fparam = new G4ParameterisationPolyhed    408         fparam = new G4ParameterisationPolyhedraPhi( axis, nDivs, width,
498                                                   409                                                     offset, mSolid, divType );
499         break;                                    410         break;
500       case kZAxis:                                411       case kZAxis:
501         fparam = new G4ParameterisationPolyhed    412         fparam = new G4ParameterisationPolyhedraZ( axis, nDivs, width,
502                                                   413                                                   offset, mSolid, divType );
503         break;                                    414         break;
504       default:                                    415       default:
505         ErrorInAxis( axis, mSolid );              416         ErrorInAxis( axis, mSolid );
506       break;                                      417       break;
507     }                                             418     }
508   }                                               419   }
509   else                                            420   else
510   {                                               421   {
511     std::ostringstream message;                << 422     G4cerr << "ERROR - G4PVDivision::SetParameterisation()" << G4endl
512     message << "Solid type " << mSolidType <<  << 423            << "        Divisions for " << mSolidType
513             << "Divisions for " << mSolidType  << 424            << " not implemented." << G4endl;
514     G4Exception("G4PVDivision::SetParameterisa << 425     G4Exception("G4PVDivision::SetParameterisation()", "IllegalConstruct",
515                 FatalException, message);      << 426                 FatalException, "Solid type not supported.");
516   }                                               427   }
517 }                                                 428 }
518                                                   429 
519 //--------------------------------------------    430 //--------------------------------------------------------------------------
520 void G4PVDivision::ErrorInAxis( EAxis axis, G4    431 void G4PVDivision::ErrorInAxis( EAxis axis, G4VSolid* solid )
521 {                                                 432 {
522   G4String error = "Trying to divide solid " +    433   G4String error = "Trying to divide solid " + solid->GetName()
523                  + " of type " + solid->GetEnt    434                  + " of type " + solid->GetEntityType() + " along axis ";
524   switch( axis )                                  435   switch( axis )
525   {                                               436   {
526     case kXAxis:                                  437     case kXAxis:
527       error += "X.";                              438       error += "X.";
528       break;                                      439       break;
529     case kYAxis:                                  440     case kYAxis:
530       error += "Y.";                              441       error += "Y.";
531       break;                                      442       break;
532     case kZAxis:                                  443     case kZAxis:
533       error += "Z.";                              444       error += "Z.";
534       break;                                      445       break;
535     case kRho:                                    446     case kRho:
536       error += "Rho.";                            447       error += "Rho.";
537       break;                                      448       break;
538     case kRadial3D:                               449     case kRadial3D:
539       error += "Radial3D.";                       450       error += "Radial3D.";
540       break;                                      451       break;
541     case kPhi:                                    452     case kPhi:
542       error += "Phi.";                            453       error += "Phi.";
543       break;                                      454       break;
544     default:                                      455     default:
545       break;                                      456       break;
546   }                                               457   }
547   G4Exception("G4PVDivision::ErrorInAxis()", " << 458   G4Exception("G4PVDivision::ErrorInAxis()", "IllegalConstruct",
548               FatalException, error);             459               FatalException, error);
549 }                                                 460 }
550                                                << 
551 // The next methods are for specialised repeat << 
552 // parameterised vol.) which are completely re << 
553 // Currently this is not applicable to divisio << 
554                                                << 
555 // ------------------------------------------- << 
556 // IsRegularStructure()                        << 
557 //                                             << 
558 G4bool G4PVDivision::IsRegularStructure() cons << 
559 {                                              << 
560   return false;                                << 
561 }                                              << 
562                                                << 
563 // ------------------------------------------- << 
564 // GetRegularStructureId()                     << 
565 //                                             << 
566 G4int G4PVDivision::GetRegularStructureId() co << 
567 {                                              << 
568   return 0;                                    << 
569 }                                              << 
570                                                   461