Geant4 Cross Reference

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


  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 //                                                 25 //
 26 // G4ParameterisationPolyhedra[Rho/Phi/Z] impl <<  26 //
                                                   >>  27 // $Id: G4ParameterisationPolyhedra.cc,v 1.15 2006/06/29 18:18:46 gunter Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
                                                   >>  29 //
                                                   >>  30 // class G4ParameterisationPolyhedra Implementation file
 27 //                                                 31 //
 28 // 14.10.03 - P.Arce, Initial version              32 // 14.10.03 - P.Arce, Initial version
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec     33 // 08.04.04 - I.Hrivnacova, Implemented reflection
 30 // -------------------------------------------     34 // --------------------------------------------------------------------
 31                                                    35 
 32 #include "G4ParameterisationPolyhedra.hh"          36 #include "G4ParameterisationPolyhedra.hh"
 33                                                    37 
 34 #include <iomanip>                                 38 #include <iomanip>
 35 #include "G4PhysicalConstants.hh"              << 
 36 #include "G4ThreeVector.hh"                        39 #include "G4ThreeVector.hh"
 37 #include "G4GeometryTolerance.hh"              << 
 38 #include "G4RotationMatrix.hh"                     40 #include "G4RotationMatrix.hh"
 39 #include "G4VPhysicalVolume.hh"                    41 #include "G4VPhysicalVolume.hh"
 40 #include "G4LogicalVolume.hh"                      42 #include "G4LogicalVolume.hh"
 41 #include "G4ReflectedSolid.hh"                     43 #include "G4ReflectedSolid.hh"
 42 #include "G4Polyhedra.hh"                          44 #include "G4Polyhedra.hh"
 43                                                    45 
 44 //--------------------------------------------     46 //--------------------------------------------------------------------------
 45 G4VParameterisationPolyhedra::                     47 G4VParameterisationPolyhedra::
 46 G4VParameterisationPolyhedra( EAxis axis, G4in     48 G4VParameterisationPolyhedra( EAxis axis, G4int nDiv, G4double width,
 47                               G4double offset,     49                               G4double offset, G4VSolid* msolid,
 48                               DivisionType div     50                               DivisionType divType )
 49   :  G4VDivisionParameterisation( axis, nDiv,      51   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 50 {                                                  52 {
 51   std::ostringstream message;                  <<  53   G4Polyhedra* msol = (G4Polyhedra*)(msolid);
 52   /* #ifdef G4MULTITHREADED                    << 
 53   message << "Divisions for G4Polyhedra curren << 
 54           << G4endl                            << 
 55           << "Sorry! Solid: " << msolid->GetNa << 
 56   G4Exception("G4VParameterisationPolyhedra::G << 
 57               "GeomDiv0001", FatalException, m << 
 58         #endif */                              << 
 59                                                << 
 60   auto msol = (G4Polyhedra*)(msolid);          << 
 61   if ((msolid->GetEntityType() != "G4Reflected     54   if ((msolid->GetEntityType() != "G4ReflectedSolid") && (msol->IsGeneric()))
 62   {                                                55   {
 63     message << "Generic construct for G4Polyhe <<  56     G4String message =
 64             << "Sorry! Solid: " << msol->GetNa <<  57          "Sorry, generic construct for G4Polyhedra NOT supported.\n Solid: "
                                                   >>  58          + msol->GetName();
 65     G4Exception("G4VParameterisationPolyhedra:     59     G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()",
 66                 "GeomDiv0001", FatalException, <<  60                 "NotSupported", FatalException, message);
 67   }                                                61   }
 68   if (msolid->GetEntityType() == "G4ReflectedS     62   if (msolid->GetEntityType() == "G4ReflectedSolid")
 69   {                                                63   {
 70     // Get constituent solid                   <<  64     // Get constituent solid  
 71     //                                         << 
 72     G4VSolid* mConstituentSolid                    65     G4VSolid* mConstituentSolid 
 73        = ((G4ReflectedSolid*)msolid)->GetConst     66        = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
 74     msol = (G4Polyhedra*)(mConstituentSolid);      67     msol = (G4Polyhedra*)(mConstituentSolid);
 75                                                    68   
 76     // Get parameters                              69     // Get parameters
 77     //                                         <<  70     G4int   nofSides = msol->GetOriginalParameters()->numSide;
 78     G4int nofSides = msol->GetOriginalParamete <<  71     G4int   nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
 79     G4int nofZplanes = msol->GetOriginalParame <<  72     G4double* zValues  = msol->GetOriginalParameters()->Z_values;
 80     G4double* zValues = msol->GetOriginalParam <<  73     G4double* rminValues  = msol->GetOriginalParameters()->Rmin;
 81     G4double* rminValues = msol->GetOriginalPa <<  74     G4double* rmaxValues  = msol->GetOriginalParameters()->Rmax;
 82     G4double* rmaxValues = msol->GetOriginalPa <<  75 
 83                                                <<  76     // Invert z values, 
 84     // Invert z values, convert radius paramet <<  77     // convert radius parameters
 85     //                                         <<  78     G4double* rminValues2 = new G4double[nofZplanes];
 86     auto rminValues2 = new G4double[nofZplanes <<  79     G4double* rmaxValues2 = new G4double[nofZplanes];
 87     auto rmaxValues2 = new G4double[nofZplanes <<  80     G4double* zValuesRefl = new G4double[nofZplanes];
 88     auto zValuesRefl = new G4double[nofZplanes <<  81     for (G4int i=0; i<nofZplanes; i++)
 89     for (G4int i=0; i<nofZplanes; ++i)         << 
 90     {                                              82     {
 91       rminValues2[i] = rminValues[i] * Convert     83       rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
 92       rmaxValues2[i] = rmaxValues[i] * Convert     84       rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
 93       zValuesRefl[i] = - zValues[i];               85       zValuesRefl[i] = - zValues[i];
 94     }                                              86     }  
 95                                                    87     
 96     auto newSolid                              <<  88     G4Polyhedra* newSolid
 97       = new G4Polyhedra(msol->GetName(),           89       = new G4Polyhedra(msol->GetName(),
 98                         msol->GetStartPhi(),       90                         msol->GetStartPhi(), 
 99                         msol->GetEndPhi() - ms     91                         msol->GetEndPhi() - msol->GetStartPhi(),
100                         nofSides,                  92                         nofSides,
101                         nofZplanes, zValuesRef     93                         nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
102                                                    94 
103     delete [] rminValues2;                         95     delete [] rminValues2;       
104     delete [] rmaxValues2;                         96     delete [] rmaxValues2;       
105     delete [] zValuesRefl;                         97     delete [] zValuesRefl;       
106                                                    98 
107     msol = newSolid;                               99     msol = newSolid;
108     fmotherSolid = newSolid;                      100     fmotherSolid = newSolid;
109     fReflectedSolid = true;                       101     fReflectedSolid = true;
110     fDeleteSolid = true;                          102     fDeleteSolid = true;
111   }                                               103   }    
112 }                                                 104 }
113                                                   105 
114 //--------------------------------------------    106 //------------------------------------------------------------------------
115 G4VParameterisationPolyhedra::~G4VParameterisa << 107 G4VParameterisationPolyhedra::~G4VParameterisationPolyhedra()
                                                   >> 108 {
                                                   >> 109 }
116                                                   110 
117 //--------------------------------------------    111 //--------------------------------------------------------------------------
118 G4double                                          112 G4double 
119 G4VParameterisationPolyhedra::                    113 G4VParameterisationPolyhedra::
120 ConvertRadiusFactor(const G4Polyhedra& phedra)    114 ConvertRadiusFactor(const G4Polyhedra& phedra) const
121 {                                                 115 {
122   G4double phiTotal = phedra.GetEndPhi() - phe    116   G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi();
123   G4int nofSides = phedra.GetOriginalParameter    117   G4int nofSides = phedra.GetOriginalParameters()->numSide;
124                                                   118   
125   if ( (phiTotal <=0) || (phiTotal >           << 119   if ( (phiTotal <=0) || (phiTotal > 2*pi+kAngTolerance) )
126         2*pi+G4GeometryTolerance::GetInstance( << 120     phiTotal = 2*pi;
127     { phiTotal = 2*pi; }                       << 
128                                                   121   
129   return std::cos(0.5*phiTotal/nofSides);         122   return std::cos(0.5*phiTotal/nofSides);
130 }                                                 123 }  
131                                                   124 
132 //--------------------------------------------    125 //--------------------------------------------------------------------------
133 G4ParameterisationPolyhedraRho::                  126 G4ParameterisationPolyhedraRho::
134 G4ParameterisationPolyhedraRho( EAxis axis, G4    127 G4ParameterisationPolyhedraRho( EAxis axis, G4int nDiv,
135                                G4double width,    128                                G4double width, G4double offset,
136                                G4VSolid* msoli    129                                G4VSolid* msolid, DivisionType divType )
137   :  G4VParameterisationPolyhedra( axis, nDiv,    130   :  G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
138 {                                                 131 {
139                                                   132 
140   CheckParametersValidity();                      133   CheckParametersValidity();
141   SetType( "DivisionPolyhedraRho" );              134   SetType( "DivisionPolyhedraRho" );
142                                                   135 
143   auto msol = (G4Polyhedra*)(fmotherSolid);    << 136   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
144   G4PolyhedraHistorical* original_pars = msol-    137   G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
145                                                   138 
146   if( divType == DivWIDTH )                       139   if( divType == DivWIDTH )
147   {                                               140   {
148     fnDiv = CalculateNDiv( original_pars->Rmax    141     fnDiv = CalculateNDiv( original_pars->Rmax[0]
149                          - original_pars->Rmin    142                          - original_pars->Rmin[0], width, offset );
150   }                                               143   }
151   else if( divType == DivNDIV )                   144   else if( divType == DivNDIV )
152   {                                               145   {
153     fwidth = CalculateWidth( original_pars->Rm    146     fwidth = CalculateWidth( original_pars->Rmax[0]
154                            - original_pars->Rm    147                            - original_pars->Rmin[0], nDiv, offset );
155   }                                               148   }
156                                                   149 
157 #ifdef G4DIVDEBUG                                 150 #ifdef G4DIVDEBUG
158   if( verbose >= 1 )                              151   if( verbose >= 1 )
159   {                                               152   {
160     G4cout << " G4ParameterisationPolyhedraRho    153     G4cout << " G4ParameterisationPolyhedraRho - # divisions " << fnDiv
161            << " = " << nDiv << G4endl             154            << " = " << nDiv << G4endl
162            << " Offset " << foffset << " = " <    155            << " Offset " << foffset << " = " << offset << G4endl
163            << " Width " << fwidth << " = " <<     156            << " Width " << fwidth << " = " << width << G4endl;
164   }                                               157   }
165 #endif                                            158 #endif
166 }                                                 159 }
167                                                   160 
168 //--------------------------------------------    161 //------------------------------------------------------------------------
169 G4ParameterisationPolyhedraRho::~G4Parameteris << 162 G4ParameterisationPolyhedraRho::~G4ParameterisationPolyhedraRho()
                                                   >> 163 {
                                                   >> 164 }
170                                                   165 
171 //--------------------------------------------    166 //---------------------------------------------------------------------
172 void G4ParameterisationPolyhedraRho::CheckPara    167 void G4ParameterisationPolyhedraRho::CheckParametersValidity()
173 {                                                 168 {
174   G4VDivisionParameterisation::CheckParameters    169   G4VDivisionParameterisation::CheckParametersValidity();
175                                                   170 
176   auto msol = (G4Polyhedra*)(fmotherSolid);    << 171   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
177                                                   172 
178   if( fDivisionType == DivNDIVandWIDTH || fDiv    173   if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
179   {                                               174   {
180     std::ostringstream message;                << 175     G4cerr << "WARNING - "
181     message << "In solid " << msol->GetName()  << 176            << "G4ParameterisationPolyhedraRho::CheckParametersValidity()"
182             << "Division along R will be done  << 177            << G4endl
183             << "different for each solid secti << 178            << "          Solid " << msol->GetName() << G4endl
184             << "WIDTH will not be used !";     << 179            << "          Division along R will be done with a width "
185     G4Exception("G4ParameterisationPolyhedraRh << 180            << "different for each solid section." << G4endl
186                 "GeomDiv1001", JustWarning, me << 181            << "          WIDTH will not be used !" << G4endl;
187   }                                               182   }
188   if( foffset != 0. )                             183   if( foffset != 0. )
189   {                                               184   {
190     std::ostringstream message;                << 185     G4cerr << "WARNING - "
191     message << "In solid " << msol->GetName()  << 186            << "G4ParameterisationPolyhedraRho::CheckParametersValidity()"
192             << "Division along  R will be done << 187            << G4endl
193             << "different for each solid secti << 188            << "          Solid " << msol->GetName() << G4endl
194             << "OFFSET will not be used !";    << 189            << "          Division along  R will be done with a width "
195     G4Exception("G4ParameterisationPolyhedraRh << 190            << "different for each solid section." << G4endl
196                 "GeomDiv1001", JustWarning, me << 191            << "          OFFSET will not be used !" << G4endl;
197   }                                               192   }
198 }                                                 193 }
199                                                   194 
200 //--------------------------------------------    195 //------------------------------------------------------------------------
201 G4double G4ParameterisationPolyhedraRho::GetMa    196 G4double G4ParameterisationPolyhedraRho::GetMaxParameter() const
202 {                                                 197 {
203   auto msol = (G4Polyhedra*)(fmotherSolid);    << 198   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
204   G4PolyhedraHistorical* original_pars = msol-    199   G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
205   return original_pars->Rmax[0] - original_par    200   return original_pars->Rmax[0] - original_pars->Rmin[0];
206 }                                                 201 }
207                                                   202 
208 //--------------------------------------------    203 //--------------------------------------------------------------------------
209 void                                              204 void
210 G4ParameterisationPolyhedraRho::                  205 G4ParameterisationPolyhedraRho::
211 ComputeTransformation( const G4int, G4VPhysica    206 ComputeTransformation( const G4int, G4VPhysicalVolume* physVol ) const
212 {                                                 207 {
213   //----- translation                             208   //----- translation 
214   G4ThreeVector origin(0.,0.,0.);                 209   G4ThreeVector origin(0.,0.,0.);
215                                                   210 
216   //----- set translation                         211   //----- set translation 
217   physVol->SetTranslation( origin );              212   physVol->SetTranslation( origin );
218                                                   213 
219   //----- calculate rotation matrix: unit         214   //----- calculate rotation matrix: unit
220                                                   215 
221 #ifdef G4DIVDEBUG                                 216 #ifdef G4DIVDEBUG
222   if( verbose >= 2 )                              217   if( verbose >= 2 )
223   {                                               218   {
224     G4cout << " G4ParameterisationPolyhedraRho    219     G4cout << " G4ParameterisationPolyhedraRho " << G4endl
225            << " foffset: " << foffset/CLHEP::d << 220            << " foffset: " << foffset/deg
226            << " - fwidth: " << fwidth/CLHEP::d << 221            << " - fwidth: " << fwidth/deg << G4endl;
227   }                                               222   }
228 #endif                                            223 #endif
229                                                   224 
230   ChangeRotMatrix( physVol );                     225   ChangeRotMatrix( physVol );
231                                                   226 
232 #ifdef G4DIVDEBUG                                 227 #ifdef G4DIVDEBUG
233   if( verbose >= 2 )                              228   if( verbose >= 2 )
234   {                                               229   {
235     G4cout << std::setprecision(8) << " G4Para    230     G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraRho "
236            << G4endl                              231            << G4endl
237            << " Position: " << origin             232            << " Position: " << origin
238            << " - Width: " << fwidth              233            << " - Width: " << fwidth
239            << " - Axis: " << faxis  << G4endl;    234            << " - Axis: " << faxis  << G4endl;
240   }                                               235   }
241 #endif                                            236 #endif
242 }                                                 237 }
243                                                   238 
244 //--------------------------------------------    239 //--------------------------------------------------------------------------
245 void                                              240 void
246 G4ParameterisationPolyhedraRho::                  241 G4ParameterisationPolyhedraRho::
247 ComputeDimensions( G4Polyhedra& phedra, const     242 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
248                    const G4VPhysicalVolume* )     243                    const G4VPhysicalVolume* ) const
249 {                                                 244 {
250   auto msol = (G4Polyhedra*)(fmotherSolid);    << 245   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
251                                                   246 
252   G4PolyhedraHistorical* origparamMother = mso    247   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
253   G4PolyhedraHistorical origparam( *origparamM    248   G4PolyhedraHistorical origparam( *origparamMother );
254   G4int nZplanes = origparamMother->Num_z_plan    249   G4int nZplanes = origparamMother->Num_z_planes;
255                                                   250 
256   G4double width = 0.;                            251   G4double width = 0.;
257   for( G4int ii = 0; ii < nZplanes; ++ii )     << 252   for( G4int ii = 0; ii < nZplanes; ii++ )
258   {                                               253   {
259     width = CalculateWidth( origparamMother->R    254     width = CalculateWidth( origparamMother->Rmax[ii]
260                           - origparamMother->R    255                           - origparamMother->Rmin[ii], fnDiv, foffset );
261     origparam.Rmin[ii] = origparamMother->Rmin    256     origparam.Rmin[ii] = origparamMother->Rmin[ii]+foffset+width*copyNo;
262     origparam.Rmax[ii] = origparamMother->Rmin    257     origparam.Rmax[ii] = origparamMother->Rmin[ii]+foffset+width*(copyNo+1);
263   }                                               258   }
264                                                   259 
265   phedra.SetOriginalParameters(&origparam); //    260   phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
266   phedra.Reset();                           //    261   phedra.Reset();                           // reset to new solid parameters
267                                                   262 
268 #ifdef G4DIVDEBUG                                 263 #ifdef G4DIVDEBUG
269   if( verbose >= -2 )                             264   if( verbose >= -2 )
270   {                                               265   {
271     G4cout << "G4ParameterisationPolyhedraRho:    266     G4cout << "G4ParameterisationPolyhedraRho::ComputeDimensions()" << G4endl
272            << "-- Parametrised phedra copy-num    267            << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
273     phedra.DumpInfo();                            268     phedra.DumpInfo();
274   }                                               269   }
275 #endif                                            270 #endif
276 }                                                 271 }
277                                                   272 
278 //--------------------------------------------    273 //--------------------------------------------------------------------------
279 G4ParameterisationPolyhedraPhi::                  274 G4ParameterisationPolyhedraPhi::
280 G4ParameterisationPolyhedraPhi( EAxis axis, G4    275 G4ParameterisationPolyhedraPhi( EAxis axis, G4int nDiv,
281                                G4double width,    276                                G4double width, G4double offset,
282                                G4VSolid* msoli    277                                G4VSolid* msolid, DivisionType divType )
283   :  G4VParameterisationPolyhedra( axis, nDiv,    278   :  G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
284 {                                                 279 { 
285   CheckParametersValidity();                      280   CheckParametersValidity();
286   SetType( "DivisionPolyhedraPhi" );              281   SetType( "DivisionPolyhedraPhi" );
287                                                   282 
288   auto msol = (G4Polyhedra*)(fmotherSolid);    << 283   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
289   G4double deltaPhi = msol->GetEndPhi() - msol    284   G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
290                                                   285 
291   if( divType == DivWIDTH )                       286   if( divType == DivWIDTH )
292   {                                               287   {
293     fnDiv = msol->GetNumSide();                << 288     fnDiv = CalculateNDiv( deltaPhi, width, offset );
                                                   >> 289   }
                                                   >> 290   else if( divType == DivNDIV )
                                                   >> 291   {
                                                   >> 292     fwidth = CalculateWidth( deltaPhi, nDiv, offset );
294   }                                               293   }
295                                                << 
296   fwidth = CalculateWidth( deltaPhi, fnDiv, 0. << 
297                                                   294 
298 #ifdef G4DIVDEBUG                                 295 #ifdef G4DIVDEBUG
299   if( verbose >= 1 )                              296   if( verbose >= 1 )
300   {                                               297   {
301     G4cout << " G4ParameterisationPolyhedraPhi    298     G4cout << " G4ParameterisationPolyhedraPhi - # divisions " << fnDiv
302            << " = " << nDiv << G4endl             299            << " = " << nDiv << G4endl
303            << " Offset " << foffset << " = " <    300            << " Offset " << foffset << " = " << offset << G4endl
304            << " Width " << fwidth << " = " <<     301            << " Width " << fwidth << " = " << width << G4endl;
305   }                                               302   }
306 #endif                                            303 #endif
307 }                                                 304 }
308                                                   305 
309 //--------------------------------------------    306 //------------------------------------------------------------------------
310 G4ParameterisationPolyhedraPhi::~G4Parameteris << 307 G4ParameterisationPolyhedraPhi::~G4ParameterisationPolyhedraPhi()
                                                   >> 308 {
                                                   >> 309 }
311                                                   310 
312 //--------------------------------------------    311 //------------------------------------------------------------------------
313 G4double G4ParameterisationPolyhedraPhi::GetMa    312 G4double G4ParameterisationPolyhedraPhi::GetMaxParameter() const
314 {                                                 313 {
315   auto msol = (G4Polyhedra*)(fmotherSolid);    << 314   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
316   return msol->GetEndPhi() - msol->GetStartPhi    315   return msol->GetEndPhi() - msol->GetStartPhi();
317 }                                                 316 }
318                                                   317 
319 //--------------------------------------------    318 //---------------------------------------------------------------------
320 void G4ParameterisationPolyhedraPhi::CheckPara    319 void G4ParameterisationPolyhedraPhi::CheckParametersValidity()
321 {                                                 320 {
322   G4VDivisionParameterisation::CheckParameters    321   G4VDivisionParameterisation::CheckParametersValidity();
323                                                   322 
324   auto msol = (G4Polyhedra*)(fmotherSolid);    << 323   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
325                                                   324 
326   if( fDivisionType == DivNDIVandWIDTH || fDiv    325   if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
327   {                                               326   {
328     std::ostringstream message;                << 327     G4cerr << "WARNING - "
329     message << "In solid " << msol->GetName()  << 328            << "G4ParameterisationPolyhedraPhi::CheckParametersValidity()"
330             << " Division along PHI will be do << 329            << G4endl
331             << "in the defined numSide." << G4 << 330            << "          Solid " << msol->GetName() << G4endl
332             << "WIDTH will not be used !";     << 331            << "          Division along PHI will be done splitting "
333     G4Exception("G4ParameterisationPolyhedraPh << 332            << "in the defined numSide." << G4endl
334                 "GeomDiv1001", JustWarning, me << 333            << "          WIDTH will not be used !" << G4endl;
335   }                                               334   }
336   if( foffset != 0. )                             335   if( foffset != 0. )
337   {                                               336   {
338     std::ostringstream message;                << 337     G4cerr << "WARNING - "
339     message << "In solid " << msol->GetName()  << 338            << "G4ParameterisationPolyhedraPhi::CheckParametersValidity()"
340             << "Division along PHI will be don << 339            << G4endl
341             << "in the defined numSide." << G4 << 340            << "          Solid " << msol->GetName() << G4endl
342             << "OFFSET will not be used !";    << 341            << "          Division along PHI will be done splitting "
343     G4Exception("G4ParameterisationPolyhedraPh << 342            << "in the defined numSide." << G4endl
344                 "GeomDiv1001", JustWarning, me << 343            << "          OFFSET will not be used !" << G4endl;
345   }                                               344   }
346                                                   345 
347   G4PolyhedraHistorical* origparamMother = mso    346   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
348                                                   347 
349   if( origparamMother->numSide != fnDiv &&  fD << 348   if( origparamMother->numSide != fnDiv )
350   {                                               349   { 
351     std::ostringstream message;                << 350     G4cerr << "ERROR - "
352     message << "Configuration not supported."  << 351            << "G4ParameterisationPolyhedraPhi::CheckParametersValidity()"
353             << "Division along PHI will be don << 352            << G4endl
354             << G4endl                          << 353            << "        Division along PHI will be done splitting in the defined"
355             << "numSide, i.e, the number of di << 354            << G4endl
356             << origparamMother->numSide << " i << 355            << "        numSide, i.e, the number of division would be :"
                                                   >> 356            << "        " << origparamMother->numSide
                                                   >> 357            << " instead of " << fnDiv << " !"
                                                   >> 358            << G4endl; 
357     G4Exception("G4ParameterisationPolyhedraPh    359     G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
358                 "GeomDiv0001", FatalException, << 360                 "IllegalConstruct", FatalException,
                                                   >> 361                 "Not supported configuration.");
359   }                                               362   }
360 }                                                 363 }
361                                                   364 
362 //--------------------------------------------    365 //--------------------------------------------------------------------------
363 void                                              366 void
364 G4ParameterisationPolyhedraPhi::                  367 G4ParameterisationPolyhedraPhi::
365 ComputeTransformation( const G4int copyNo, G4V << 368 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
366 {                                                 369 {
367   //----- translation                             370   //----- translation 
368   G4ThreeVector origin(0.,0.,0.);                 371   G4ThreeVector origin(0.,0.,0.); 
369   //----- set translation                         372   //----- set translation 
370   physVol->SetTranslation( origin );              373   physVol->SetTranslation( origin );
371                                                   374 
372   //----- calculate rotation matrix (so that a    375   //----- calculate rotation matrix (so that all volumes point to the centre)
373   G4double posi = copyNo*fwidth;                  376   G4double posi = copyNo*fwidth;
374                                                   377 
375 #ifdef G4DIVDEBUG                                 378 #ifdef G4DIVDEBUG
376   if( verbose >= 2 )                              379   if( verbose >= 2 )
377   {                                               380   {
378     G4cout << " G4ParameterisationPolyhedraPhi << 381     G4cout << " G4ParameterisationPolyhedraPhi - position: " << posi/deg
379            << G4endl                              382            << G4endl
380            << " copyNo: " << copyNo               383            << " copyNo: " << copyNo
381            << " - fwidth: " << fwidth/CLHEP::d << 384            << " - fwidth: " << fwidth/deg << G4endl;
382   }                                               385   }
383 #endif                                            386 #endif
384                                                   387 
385   ChangeRotMatrix( physVol, -posi );              388   ChangeRotMatrix( physVol, -posi );
386                                                   389 
387 #ifdef G4DIVDEBUG                                 390 #ifdef G4DIVDEBUG
388   if( verbose >= 2 )                              391   if( verbose >= 2 )
389   {                                               392   {
390     G4cout << std::setprecision(8) << " G4Para << 393     G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraPhi " << copyNo
391            << copyNo << G4endl                 << 394            << G4endl
392            << " Position: " << origin << " - W    395            << " Position: " << origin << " - Width: " << fwidth
393            << " - Axis: " << faxis  << G4endl;    396            << " - Axis: " << faxis  << G4endl;
394   }                                               397   }
395 #endif                                            398 #endif
396 }                                                 399 }
397                                                   400 
398 //--------------------------------------------    401 //--------------------------------------------------------------------------
399 void                                              402 void
400 G4ParameterisationPolyhedraPhi::                  403 G4ParameterisationPolyhedraPhi::
401 ComputeDimensions( G4Polyhedra& phedra, const     404 ComputeDimensions( G4Polyhedra& phedra, const G4int,
402                    const G4VPhysicalVolume* )     405                    const G4VPhysicalVolume* ) const
403 {                                                 406 {
404   auto msol = (G4Polyhedra*)(fmotherSolid);    << 407   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
405                                                   408 
406   G4PolyhedraHistorical* origparamMother = mso    409   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
407   G4PolyhedraHistorical origparam( *origparamM    410   G4PolyhedraHistorical origparam( *origparamMother );
408                                                   411 
409   origparam.numSide = 1;                          412   origparam.numSide = 1;
410   origparam.Start_angle = origparamMother->Sta    413   origparam.Start_angle = origparamMother->Start_angle;
411   origparam.Opening_angle = fwidth;               414   origparam.Opening_angle = fwidth;
412                                                   415 
413   phedra.SetOriginalParameters(&origparam);  /    416   phedra.SetOriginalParameters(&origparam);  // copy values & transfer pointers
414   phedra.Reset();                            /    417   phedra.Reset();                            // reset to new solid parameters
415                                                   418 
416 #ifdef G4DIVDEBUG                                 419 #ifdef G4DIVDEBUG
417   if( verbose >= 2 )                              420   if( verbose >= 2 )
418   {                                               421   {
419     G4cout << "G4ParameterisationPolyhedraPhi:    422     G4cout << "G4ParameterisationPolyhedraPhi::ComputeDimensions():" << G4endl;
420     phedra.DumpInfo();                            423     phedra.DumpInfo();
421   }                                               424   }
422 #endif                                            425 #endif
423 }                                                 426 }
424                                                   427 
425 //--------------------------------------------    428 //--------------------------------------------------------------------------
426 G4ParameterisationPolyhedraZ::                    429 G4ParameterisationPolyhedraZ::
427 G4ParameterisationPolyhedraZ( EAxis axis, G4in    430 G4ParameterisationPolyhedraZ( EAxis axis, G4int nDiv,
428                              G4double width, G    431                              G4double width, G4double offset,
429                              G4VSolid* msolid,    432                              G4VSolid* msolid, DivisionType divType )
430   :  G4VParameterisationPolyhedra( axis, nDiv, << 433   :  G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
431      fOrigParamMother(((G4Polyhedra*)fmotherSo << 
432 {                                                 434 { 
433   CheckParametersValidity();                      435   CheckParametersValidity();
434   SetType( "DivisionPolyhedraZ" );                436   SetType( "DivisionPolyhedraZ" );
435                                                   437 
                                                   >> 438   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
                                                   >> 439   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
                                                   >> 440   
436   if( divType == DivWIDTH )                       441   if( divType == DivWIDTH )
437   {                                            << 442     {
438     fnDiv =                                       443     fnDiv =
439       CalculateNDiv(fOrigParamMother->Z_values << 444       CalculateNDiv( origparamMother->Z_values[origparamMother->Num_z_planes-1]
440                     - fOrigParamMother->Z_valu << 445                      - origparamMother->Z_values[0] , width, offset );
441   }                                               446   }
442   else if( divType == DivNDIV )                   447   else if( divType == DivNDIV )
443   {                                            << 448     {
444     fwidth =                                      449     fwidth =
445       CalculateNDiv(fOrigParamMother->Z_values << 450       CalculateNDiv( origparamMother->Z_values[origparamMother->Num_z_planes-1]
446                     - fOrigParamMother->Z_valu << 451                      - origparamMother->Z_values[0] , nDiv, offset );
447   }                                               452   }
448                                                   453   
449 #ifdef G4DIVDEBUG                                 454 #ifdef G4DIVDEBUG
450   if( verbose >= 1 )                              455   if( verbose >= 1 )
451   {                                            << 456     {
452     G4cout << " G4ParameterisationPolyhedraZ -    457     G4cout << " G4ParameterisationPolyhedraZ - # divisions " << fnDiv << " = "
453            << nDiv << G4endl                      458            << nDiv << G4endl
454            << " Offset " << foffset << " = " <    459            << " Offset " << foffset << " = " << offset << G4endl
455            << " Width " << fwidth << " = " <<     460            << " Width " << fwidth << " = " << width << G4endl;
456   }                                               461   }
457 #endif                                            462 #endif
458 }                                                 463 }
459                                                   464 
460 //--------------------------------------------    465 //---------------------------------------------------------------------
461 G4ParameterisationPolyhedraZ::~G4Parameterisat << 466 G4ParameterisationPolyhedraZ::~G4ParameterisationPolyhedraZ()
462                                                << 
463 //-------------------------------------------- << 
464 G4double G4ParameterisationPolyhedraZ::GetR(G4 << 
465                                            G4d << 
466                                            G4d << 
467 {                                              << 
468   // Linear parameterisation:                  << 
469   // r = az + b                                << 
470   // a = (r1 - r2)/(z1-z2)                     << 
471   // b = r1 - a*z1                             << 
472                                                << 
473   return (r1-r2)/(z1-z2)*z + ( r1 - (r1-r2)/(z << 
474 }                                              << 
475                                                << 
476 //-------------------------------------------- << 
477 G4double G4ParameterisationPolyhedraZ::GetRmin << 
478 {                                              << 
479 // Get Rmin in the given z position for the gi << 
480                                                << 
481   return GetR(z,                               << 
482               fOrigParamMother->Z_values[nseg] << 
483               fOrigParamMother->Rmin[nseg],    << 
484               fOrigParamMother->Z_values[nseg+ << 
485               fOrigParamMother->Rmin[nseg+1]); << 
486 }                                              << 
487                                                << 
488 //-------------------------------------------- << 
489 G4double G4ParameterisationPolyhedraZ::GetRmax << 
490 {                                                 467 {
491 // Get Rmax in the given z position for the gi << 468 }
492                                                   469 
493   return GetR(z,                               << 
494               fOrigParamMother->Z_values[nseg] << 
495               fOrigParamMother->Rmax[nseg],    << 
496               fOrigParamMother->Z_values[nseg+ << 
497               fOrigParamMother->Rmax[nseg+1]); << 
498 }                                              << 
499                                                << 
500 //--------------------------------------------    470 //------------------------------------------------------------------------
501 G4double G4ParameterisationPolyhedraZ::GetMaxP    471 G4double G4ParameterisationPolyhedraZ::GetMaxParameter() const
502 {                                                 472 {
503   return std::abs(fOrigParamMother->Z_values[f << 473   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
504                  -fOrigParamMother->Z_values[0 << 474   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
                                                   >> 475   return std::abs (origparamMother->Z_values[origparamMother->Num_z_planes-1]
                                                   >> 476              -origparamMother->Z_values[0]);
505 }                                                 477 }
506                                                   478 
507 //--------------------------------------------    479 //---------------------------------------------------------------------
508 void G4ParameterisationPolyhedraZ::CheckParame    480 void G4ParameterisationPolyhedraZ::CheckParametersValidity()
509 {                                                 481 {
510   G4VDivisionParameterisation::CheckParameters    482   G4VDivisionParameterisation::CheckParametersValidity();
511                                                   483 
512   // Division will be following the mother pol << 484   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
513   //                                           << 
514   if( fDivisionType == DivNDIV )               << 
515   {                                            << 
516     if( fOrigParamMother->Num_z_planes-1 != fn << 
517     {                                          << 
518       std::ostringstream message;              << 
519       message << "Configuration not supported. << 
520               << "Division along Z will be don << 
521               << G4endl                        << 
522               << "Z planes, i.e, the number of << 
523               << fOrigParamMother->Num_z_plane << 
524               << fnDiv << " !";                << 
525       G4Exception("G4ParameterisationPolyhedra << 
526                   "GeomDiv0001", FatalExceptio << 
527     }                                          << 
528   }                                            << 
529                                                   485 
530   // Division will be done within one polyhedr << 
531   // with applying given width and offset      << 
532   //                                           << 
533   if( fDivisionType == DivNDIVandWIDTH || fDiv    486   if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
534   {                                               487   {
535     // Check if divided region does not span o << 488     G4cerr << "WARNING - "
536     // than one z segment                      << 489            << "G4ParameterisationPolyhedraZ::CheckParametersValidity()"
                                                   >> 490            << G4endl
                                                   >> 491            << "          Solid " << msol->GetName() << G4endl
                                                   >> 492            << "          Division along Z will be done splitting "
                                                   >> 493            << "in the defined z_planes." << G4endl
                                                   >> 494            << "          WIDTH will not be used !" << G4endl;
                                                   >> 495   }
537                                                   496 
538     G4int isegstart = -1;  // number of the se << 497   if( foffset != 0. )
539     G4int isegend = -1;    // number of the se << 498   {
                                                   >> 499     G4cerr << "WARNING - "
                                                   >> 500            << "G4ParameterisationPolyhedraZ::CheckParametersValidity()"
                                                   >> 501            << G4endl
                                                   >> 502            << "          Solid " << msol->GetName() << G4endl
                                                   >> 503            << "          Division along Z will be done splitting "
                                                   >> 504            << "in the defined z_planes." << G4endl
                                                   >> 505            << "          OFFSET will not be used !" << G4endl;
                                                   >> 506   }
540                                                   507 
541     if ( !fReflectedSolid )                    << 508   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
542     {                                          << 509 
543       // The start/end position of the divided << 510   if( origparamMother->Num_z_planes-1 != fnDiv )
544       //                                       << 511   { 
545       G4double zstart = fOrigParamMother->Z_va << 512     G4cerr << "ERROR - "
546       G4double zend = fOrigParamMother->Z_valu << 513            << "G4ParameterisationPolyhedraZ::CheckParametersValidity()"
547                     + foffset + fnDiv*fwidth;  << 514            << G4endl
548                                                << 515            << "        Division along Z will be done splitting in the defined"
549       G4int counter = 0;                       << 516            << G4endl
550       while ( isegend < 0 && counter < fOrigPa << 517            << "        z_planes, i.e, the number of division would be :"
551       {                                        << 518            << "        " << origparamMother->Num_z_planes-1
552         // first segment                       << 519            << " instead of " << fnDiv << " !"
553         if ( zstart >= fOrigParamMother->Z_val << 520            << G4endl; 
554              zstart  < fOrigParamMother->Z_val << 521     G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()",
555         {                                      << 522                 "IllegalConstruct", FatalException,
556            isegstart = counter;                << 523                 "Not supported configuration.");
557         }                                      << 524   }
558         // last segment                        << 
559         if ( zend  > fOrigParamMother->Z_value << 
560              zend <= fOrigParamMother->Z_value << 
561         {                                      << 
562            isegend = counter;                  << 
563         }                                      << 
564         ++counter;                             << 
565       }  // Loop checking, 06.08.2015, G.Cosmo << 
566     }                                          << 
567     else                                       << 
568     {                                          << 
569       // The start/end position of the divided << 
570       //                                       << 
571       G4double zstart = fOrigParamMother->Z_va << 
572       G4double zend = fOrigParamMother->Z_valu << 
573                     - (foffset + fnDiv* fwidth << 
574                                                << 
575       G4int counter = 0;                       << 
576       while ( isegend < 0 && counter < fOrigPa << 
577       {                                        << 
578         // first segment                       << 
579         if ( zstart <= fOrigParamMother->Z_val << 
580              zstart  > fOrigParamMother->Z_val << 
581         {                                      << 
582            isegstart = counter;                << 
583         }                                      << 
584         // last segment                        << 
585         if ( zend  < fOrigParamMother->Z_value << 
586              zend >= fOrigParamMother->Z_value << 
587         {                                      << 
588            isegend = counter;                  << 
589         }                                      << 
590         ++counter;                             << 
591       }  // Loop checking, 06.08.2015, G.Cosmo << 
592     }                                          << 
593                                                << 
594     if ( isegstart != isegend )                << 
595     {                                          << 
596       std::ostringstream message;              << 
597       message << "Configuration not supported. << 
598               << "Division with user defined w << 
599               << "Solid " << fmotherSolid->Get << 
600               << "Divided region is not betwee << 
601       G4Exception("G4ParameterisationPolyhedra << 
602                   "GeomDiv0001", FatalExceptio << 
603     }                                          << 
604                                                << 
605     fNSegment = isegstart;                     << 
606   }                                            << 
607 }                                                 525 }
608                                                   526 
609 //--------------------------------------------    527 //---------------------------------------------------------------------
610 void                                              528 void
611 G4ParameterisationPolyhedraZ::                    529 G4ParameterisationPolyhedraZ::
612 ComputeTransformation( const G4int copyNo, G4V    530 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol) const
613 {                                                 531 {
614   G4double posi;                               << 532   G4Polyhedra* msol = (G4Polyhedra*)(GetMotherSolid());
615   if ( fDivisionType == DivNDIV )              << 
616   {                                            << 
617     // The position of the centre of copyNo-th << 
618                                                << 
619     posi = ( fOrigParamMother->Z_values[copyNo << 
620                     + fOrigParamMother->Z_valu << 
621     physVol->SetTranslation( G4ThreeVector(0,  << 
622   }                                            << 
623                                                << 
624   if ( fDivisionType == DivNDIVandWIDTH || fDi << 
625   {                                            << 
626     // The position of the centre of copyNo-th << 
627                                                   533 
628     posi = fOrigParamMother->Z_values[0];      << 534   //----- set translation: along Z axis
629                                                << 535   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
630     if ( !fReflectedSolid )                    << 536   G4double posi = (origparamMother->Z_values[copyNo]
631       posi += foffset + (2*copyNo + 1) * fwidt << 537                    + origparamMother->Z_values[copyNo+1])/2;
632     else                                       << 538   G4ThreeVector origin(0.,0.,posi); 
633       posi -= foffset + (2*copyNo + 1) * fwidt << 539   physVol->SetTranslation( origin );
634                                                << 
635     physVol->SetTranslation( G4ThreeVector(0,  << 
636   }                                            << 
637                                                   540 
638   //----- calculate rotation matrix: unit         541   //----- calculate rotation matrix: unit
639                                                   542 
640 #ifdef G4DIVDEBUG                                 543 #ifdef G4DIVDEBUG
641   if( verbose >= 2 )                              544   if( verbose >= 2 )
642   {                                               545   {
643     G4cout << " G4ParameterisationPolyhedraZ -    546     G4cout << " G4ParameterisationPolyhedraZ - position: " << posi << G4endl
644            << " copyNo: " << copyNo << " - fof << 547            << " copyNo: " << copyNo << " - foffset: " << foffset/deg
645            << " - fwidth: " << fwidth/CLHEP::d << 548            << " - fwidth: " << fwidth/deg << G4endl;
646   }                                               549   }
647 #endif                                            550 #endif
648                                                   551 
649   ChangeRotMatrix( physVol );                     552   ChangeRotMatrix( physVol );
650                                                   553 
651 #ifdef G4DIVDEBUG                                 554 #ifdef G4DIVDEBUG
652   if( verbose >= 2 )                              555   if( verbose >= 2 )
653   {                                               556   {
654     G4cout << std::setprecision(8) << " G4Para    557     G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraZ "
655            << copyNo << G4endl                    558            << copyNo << G4endl
656            << " Position: (0,0,0) - Width: " < << 559            << " Position: " << origin << " - Width: " << fwidth
657            << " - Axis: " << faxis  << G4endl;    560            << " - Axis: " << faxis  << G4endl;
658   }                                               561   }
659 #endif                                            562 #endif
660 }                                                 563 }
661                                                   564 
662 //--------------------------------------------    565 //---------------------------------------------------------------------
663 void                                              566 void
664 G4ParameterisationPolyhedraZ::                    567 G4ParameterisationPolyhedraZ::
665 ComputeDimensions( G4Polyhedra& phedra, const     568 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
666                    const G4VPhysicalVolume* )     569                    const G4VPhysicalVolume* ) const
667 {                                                 570 {
668   // Define division solid                     << 571   // only for mother number of planes = 2!!
669   //                                              572   //
670   G4PolyhedraHistorical origparam;             << 573   G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
671   G4int nz = 2;                                << 
672   origparam.Num_z_planes = nz;                 << 
673   origparam.numSide = fOrigParamMother->numSid << 
674   origparam.Start_angle = fOrigParamMother->St << 
675   origparam.Opening_angle = fOrigParamMother-> << 
676                                                   574 
677   // Define division solid z sections          << 575   G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
678   //                                           << 576   G4PolyhedraHistorical origparam( *origparamMother );
679   origparam.Z_values = new G4double[nz];       << 
680   origparam.Rmin = new G4double[nz];           << 
681   origparam.Rmax = new G4double[nz];           << 
682   origparam.Z_values[0] = - fwidth/2.;         << 
683   origparam.Z_values[1] = fwidth/2.;           << 
684                                                << 
685   if ( fDivisionType == DivNDIV )              << 
686   {                                            << 
687     // The position of the centre of copyNo-th << 
688     //                                         << 
689     G4double posi = ( fOrigParamMother->Z_valu << 
690                     + fOrigParamMother->Z_valu << 
691                                                << 
692     origparam.Z_values[0] = fOrigParamMother-> << 
693     origparam.Z_values[1] = fOrigParamMother-> << 
694     origparam.Rmin[0] = fOrigParamMother->Rmin << 
695     origparam.Rmin[1] = fOrigParamMother->Rmin << 
696     origparam.Rmax[0] = fOrigParamMother->Rmax << 
697     origparam.Rmax[1] = fOrigParamMother->Rmax << 
698   }                                            << 
699                                                   577 
700   if ( fDivisionType == DivNDIVandWIDTH || fDi << 578   G4double posi = (origparamMother->Z_values[copyNo]
701   {                                            << 579                    + origparamMother->Z_values[copyNo+1])/2;
702     if ( !fReflectedSolid )                    << 
703     {                                          << 
704       origparam.Z_values[0] = -fwidth/2.;      << 
705       origparam.Z_values[1] = fwidth/2.;       << 
706                                                   580 
707       // The position of the centre of copyNo- << 581   origparam.Num_z_planes = 2;
708       //                                       << 582   origparam.Z_values[0] = origparamMother->Z_values[copyNo] - posi;
709       G4double posi = fOrigParamMother->Z_valu << 583   origparam.Z_values[1] = origparamMother->Z_values[copyNo+1] - posi;
710                     + foffset + (2*copyNo + 1) << 584   origparam.Rmin[0] = origparamMother->Rmin[copyNo];
711                                                << 585   origparam.Rmin[1] = origparamMother->Rmin[copyNo+1];
712       // The first and last z sides z values   << 586   origparam.Rmax[0] = origparamMother->Rmax[copyNo];
713       G4double zstart = posi - fwidth/2.;      << 587   origparam.Rmax[1] = origparamMother->Rmax[copyNo+1];
714       G4double zend = posi + fwidth/2.;        << 
715       origparam.Rmin[0] = GetRmin(zstart, fNSe << 
716       origparam.Rmax[0] = GetRmax(zstart, fNSe << 
717       origparam.Rmin[1] = GetRmin(zend, fNSegm << 
718       origparam.Rmax[1] = GetRmax(zend, fNSegm << 
719     }                                          << 
720     else                                       << 
721     {                                          << 
722       origparam.Z_values[0] = fwidth/2.;       << 
723       origparam.Z_values[1] = -fwidth/2.;      << 
724                                                << 
725       // The position of the centre of copyNo- << 
726       //                                       << 
727       G4double posi = fOrigParamMother->Z_valu << 
728                     - ( foffset + (2*copyNo +  << 
729                                                << 
730       // The first and last z sides z values   << 
731       //                                       << 
732       G4double zstart = posi + fwidth/2.;      << 
733       G4double zend = posi - fwidth/2.;        << 
734       origparam.Rmin[0] = GetRmin(zstart, fNSe << 
735       origparam.Rmax[0] = GetRmax(zstart, fNSe << 
736       origparam.Rmin[1] = GetRmin(zend, fNSegm << 
737       origparam.Rmax[1] = GetRmax(zend, fNSegm << 
738     }                                          << 
739                                                << 
740     // It can happen due to rounding errors    << 
741     //                                         << 
742     if ( origparam.Rmin[0]    < 0.0 ) origpara << 
743     if ( origparam.Rmin[nz-1] < 0.0 ) origpara << 
744   }                                            << 
745                                                   588 
746   phedra.SetOriginalParameters(&origparam);  /    589   phedra.SetOriginalParameters(&origparam);  // copy values & transfer pointers
747   phedra.Reset();                            /    590   phedra.Reset();                            // reset to new solid parameters
748                                                   591 
749 #ifdef G4DIVDEBUG                                 592 #ifdef G4DIVDEBUG
750   if( verbose >= 2 )                              593   if( verbose >= 2 )
751   {                                               594   {
752     G4cout << "G4ParameterisationPolyhedraZ::C    595     G4cout << "G4ParameterisationPolyhedraZ::ComputeDimensions()" << G4endl
753            << "-- Parametrised phedra copy-num    596            << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
754     phedra.DumpInfo();                            597     phedra.DumpInfo();
755   }                                               598   }
756 #endif                                            599 #endif
757 }                                                 600 }
                                                   >> 601 
758                                                   602