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 10.0.p3)


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