Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParameterisationPolyhedra.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4ParameterisationPolyhedra.cc 69784 2013-05-15 09:16:06Z gcosmo $
28 //
29 // class G4ParameterisationPolyhedra Implementation file
30 //
31 // 14.10.03 - P.Arce, Initial version
32 // 08.04.04 - I.Hrivnacova, Implemented reflection
33 // --------------------------------------------------------------------
34 
36 
37 #include <iomanip>
38 #include "G4PhysicalConstants.hh"
39 #include "G4ThreeVector.hh"
40 #include "G4GeometryTolerance.hh"
41 #include "G4RotationMatrix.hh"
42 #include "G4VPhysicalVolume.hh"
43 #include "G4LogicalVolume.hh"
44 #include "G4ReflectedSolid.hh"
45 #include "G4Polyhedra.hh"
46 
47 //--------------------------------------------------------------------------
50  G4double offset, G4VSolid* msolid,
51  DivisionType divType )
52  : G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
53 {
54  G4Polyhedra* msol = (G4Polyhedra*)(msolid);
55  if ((msolid->GetEntityType() != "G4ReflectedSolid") && (msol->IsGeneric()))
56  {
57  std::ostringstream message;
58  message << "Generic construct for G4Polyhedra NOT supported." << G4endl
59  << "Sorry! Solid: " << msol->GetName();
60  G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()",
61  "GeomDiv0001", FatalException, message);
62  }
63  if (msolid->GetEntityType() == "G4ReflectedSolid")
64  {
65  // Get constituent solid
66  G4VSolid* mConstituentSolid
67  = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
68  msol = (G4Polyhedra*)(mConstituentSolid);
69 
70  // Get parameters
71  G4int nofSides = msol->GetOriginalParameters()->numSide;
72  G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
73  G4double* zValues = msol->GetOriginalParameters()->Z_values;
74  G4double* rminValues = msol->GetOriginalParameters()->Rmin;
75  G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
76 
77  // Invert z values,
78  // convert radius parameters
79  G4double* rminValues2 = new G4double[nofZplanes];
80  G4double* rmaxValues2 = new G4double[nofZplanes];
81  G4double* zValuesRefl = new G4double[nofZplanes];
82  for (G4int i=0; i<nofZplanes; i++)
83  {
84  rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
85  rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
86  zValuesRefl[i] = - zValues[i];
87  }
88 
89  G4Polyhedra* newSolid
90  = new G4Polyhedra(msol->GetName(),
91  msol->GetStartPhi(),
92  msol->GetEndPhi() - msol->GetStartPhi(),
93  nofSides,
94  nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
95 
96  delete [] rminValues2;
97  delete [] rmaxValues2;
98  delete [] zValuesRefl;
99 
100  msol = newSolid;
101  fmotherSolid = newSolid;
102  fReflectedSolid = true;
103  fDeleteSolid = true;
104  }
105 }
106 
107 //------------------------------------------------------------------------
109 {
110 }
111 
112 //--------------------------------------------------------------------------
113 G4double
114 G4VParameterisationPolyhedra::
115 ConvertRadiusFactor(const G4Polyhedra& phedra) const
116 {
117  G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi();
118  G4int nofSides = phedra.GetOriginalParameters()->numSide;
119 
120  if ( (phiTotal <=0) || (phiTotal >
121  2*pi+G4GeometryTolerance::GetInstance()->GetAngularTolerance()) )
122  { phiTotal = 2*pi; }
123 
124  return std::cos(0.5*phiTotal/nofSides);
125 }
126 
127 //--------------------------------------------------------------------------
130  G4double width, G4double offset,
131  G4VSolid* msolid, DivisionType divType )
132  : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
133 {
134 
136  SetType( "DivisionPolyhedraRho" );
137 
139  G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
140 
141  if( divType == DivWIDTH )
142  {
143  fnDiv = CalculateNDiv( original_pars->Rmax[0]
144  - original_pars->Rmin[0], width, offset );
145  }
146  else if( divType == DivNDIV )
147  {
148  fwidth = CalculateWidth( original_pars->Rmax[0]
149  - original_pars->Rmin[0], nDiv, offset );
150  }
151 
152 #ifdef G4DIVDEBUG
153  if( verbose >= 1 )
154  {
155  G4cout << " G4ParameterisationPolyhedraRho - # divisions " << fnDiv
156  << " = " << nDiv << G4endl
157  << " Offset " << foffset << " = " << offset << G4endl
158  << " Width " << fwidth << " = " << width << G4endl;
159  }
160 #endif
161 }
162 
163 //------------------------------------------------------------------------
165 {
166 }
167 
168 //---------------------------------------------------------------------
170 {
172 
174 
176  {
177  std::ostringstream message;
178  message << "In solid " << msol->GetName() << G4endl
179  << "Division along R will be done with a width "
180  << "different for each solid section." << G4endl
181  << "WIDTH will not be used !";
182  G4Exception("G4ParameterisationPolyhedraRho::CheckParametersValidity()",
183  "GeomDiv1001", JustWarning, message);
184  }
185  if( foffset != 0. )
186  {
187  std::ostringstream message;
188  message << "In solid " << msol->GetName() << G4endl
189  << "Division along R will be done with a width "
190  << "different for each solid section." << G4endl
191  << "OFFSET will not be used !";
192  G4Exception("G4ParameterisationPolyhedraRho::CheckParametersValidity()",
193  "GeomDiv1001", JustWarning, message);
194  }
195 }
196 
197 //------------------------------------------------------------------------
199 {
201  G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
202  return original_pars->Rmax[0] - original_pars->Rmin[0];
203 }
204 
205 //--------------------------------------------------------------------------
206 void
209 {
210  //----- translation
211  G4ThreeVector origin(0.,0.,0.);
212 
213  //----- set translation
214  physVol->SetTranslation( origin );
215 
216  //----- calculate rotation matrix: unit
217 
218 #ifdef G4DIVDEBUG
219  if( verbose >= 2 )
220  {
221  G4cout << " G4ParameterisationPolyhedraRho " << G4endl
222  << " foffset: " << foffset/deg
223  << " - fwidth: " << fwidth/deg << G4endl;
224  }
225 #endif
226 
227  ChangeRotMatrix( physVol );
228 
229 #ifdef G4DIVDEBUG
230  if( verbose >= 2 )
231  {
232  G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraRho "
233  << G4endl
234  << " Position: " << origin
235  << " - Width: " << fwidth
236  << " - Axis: " << faxis << G4endl;
237  }
238 #endif
239 }
240 
241 //--------------------------------------------------------------------------
242 void
244 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
245  const G4VPhysicalVolume* ) const
246 {
248 
249  G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
250  G4PolyhedraHistorical origparam( *origparamMother );
251  G4int nZplanes = origparamMother->Num_z_planes;
252 
253  G4double width = 0.;
254  for( G4int ii = 0; ii < nZplanes; ii++ )
255  {
256  width = CalculateWidth( origparamMother->Rmax[ii]
257  - origparamMother->Rmin[ii], fnDiv, foffset );
258  origparam.Rmin[ii] = origparamMother->Rmin[ii]+foffset+width*copyNo;
259  origparam.Rmax[ii] = origparamMother->Rmin[ii]+foffset+width*(copyNo+1);
260  }
261 
262  phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
263  phedra.Reset(); // reset to new solid parameters
264 
265 #ifdef G4DIVDEBUG
266  if( verbose >= -2 )
267  {
268  G4cout << "G4ParameterisationPolyhedraRho::ComputeDimensions()" << G4endl
269  << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
270  phedra.DumpInfo();
271  }
272 #endif
273 }
274 
275 //--------------------------------------------------------------------------
278  G4double width, G4double offset,
279  G4VSolid* msolid, DivisionType divType )
280  : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
281 {
283  SetType( "DivisionPolyhedraPhi" );
284 
286  G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
287 
288  if( divType == DivWIDTH )
289  {
290  fnDiv = msol->GetNumSide();
291  }
292 
293  fwidth = CalculateWidth( deltaPhi, fnDiv, 0.0 );
294 
295 #ifdef G4DIVDEBUG
296  if( verbose >= 1 )
297  {
298  G4cout << " G4ParameterisationPolyhedraPhi - # divisions " << fnDiv
299  << " = " << nDiv << G4endl
300  << " Offset " << foffset << " = " << offset << G4endl
301  << " Width " << fwidth << " = " << width << G4endl;
302  }
303 #endif
304 }
305 
306 //------------------------------------------------------------------------
308 {
309 }
310 
311 //------------------------------------------------------------------------
313 {
315  return msol->GetEndPhi() - msol->GetStartPhi();
316 }
317 
318 //---------------------------------------------------------------------
320 {
322 
324 
326  {
327  std::ostringstream message;
328  message << "In solid " << msol->GetName() << G4endl
329  << " Division along PHI will be done splitting "
330  << "in the defined numSide." << G4endl
331  << "WIDTH will not be used !";
332  G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
333  "GeomDiv1001", JustWarning, message);
334  }
335  if( foffset != 0. )
336  {
337  std::ostringstream message;
338  message << "In solid " << msol->GetName() << G4endl
339  << "Division along PHI will be done splitting "
340  << "in the defined numSide." << G4endl
341  << "OFFSET will not be used !";
342  G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
343  "GeomDiv1001", JustWarning, message);
344  }
345 
346  G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
347 
348  if( origparamMother->numSide != fnDiv && fDivisionType != DivWIDTH)
349  {
350  std::ostringstream message;
351  message << "Configuration not supported." << G4endl
352  << "Division along PHI will be done splitting in the defined"
353  << G4endl
354  << "numSide, i.e, the number of division would be :"
355  << origparamMother->numSide << " instead of " << fnDiv << " !";
356  G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
357  "GeomDiv0001", FatalException, message);
358  }
359 }
360 
361 //--------------------------------------------------------------------------
362 void
364 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
365 {
366  //----- translation
367  G4ThreeVector origin(0.,0.,0.);
368  //----- set translation
369  physVol->SetTranslation( origin );
370 
371  //----- calculate rotation matrix (so that all volumes point to the centre)
372  G4double posi = copyNo*fwidth;
373 
374 #ifdef G4DIVDEBUG
375  if( verbose >= 2 )
376  {
377  G4cout << " G4ParameterisationPolyhedraPhi - position: " << posi/deg
378  << G4endl
379  << " copyNo: " << copyNo
380  << " - fwidth: " << fwidth/deg << G4endl;
381  }
382 #endif
383 
384  ChangeRotMatrix( physVol, -posi );
385 
386 #ifdef G4DIVDEBUG
387  if( verbose >= 2 )
388  {
389  G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraPhi " << copyNo
390  << G4endl
391  << " Position: " << origin << " - Width: " << fwidth
392  << " - Axis: " << faxis << G4endl;
393  }
394 #endif
395 }
396 
397 //--------------------------------------------------------------------------
398 void
401  const G4VPhysicalVolume* ) const
402 {
404 
405  G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
406  G4PolyhedraHistorical origparam( *origparamMother );
407 
408  origparam.numSide = 1;
409  origparam.Start_angle = origparamMother->Start_angle;
410  origparam.Opening_angle = fwidth;
411 
412  phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
413  phedra.Reset(); // reset to new solid parameters
414 
415 #ifdef G4DIVDEBUG
416  if( verbose >= 2 )
417  {
418  G4cout << "G4ParameterisationPolyhedraPhi::ComputeDimensions():" << G4endl;
419  phedra.DumpInfo();
420  }
421 #endif
422 }
423 
424 //--------------------------------------------------------------------------
427  G4double width, G4double offset,
428  G4VSolid* msolid, DivisionType divType )
429  : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ),
430  fNSegment(0),
431  fOrigParamMother(((G4Polyhedra*)fmotherSolid)->GetOriginalParameters())
432 {
434  SetType( "DivisionPolyhedraZ" );
435 
436  if( divType == DivWIDTH )
437  {
438  fnDiv =
439  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
440  - fOrigParamMother->Z_values[0] , width, offset );
441  }
442  else if( divType == DivNDIV )
443  {
444  fwidth =
445  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
446  - fOrigParamMother->Z_values[0] , nDiv, offset );
447  }
448 
449 #ifdef G4DIVDEBUG
450  if( verbose >= 1 )
451  {
452  G4cout << " G4ParameterisationPolyhedraZ - # divisions " << fnDiv << " = "
453  << nDiv << G4endl
454  << " Offset " << foffset << " = " << offset << G4endl
455  << " Width " << fwidth << " = " << width << G4endl;
456  }
457 #endif
458 }
459 
460 //---------------------------------------------------------------------
462 {
463 }
464 
465 //------------------------------------------------------------------------
466 G4double G4ParameterisationPolyhedraZ::GetR(G4double z,
467  G4double z1, G4double r1,
468  G4double z2, G4double r2) const
469 {
470  // Linear parameterisation:
471  // r = az + b
472  // a = (r1 - r2)/(z1-z2)
473  // b = r1 - a*z1
474 
475  return (r1-r2)/(z1-z2)*z + ( r1 - (r1-r2)/(z1-z2)*z1 ) ;
476 }
477 
478 //------------------------------------------------------------------------
479 G4double G4ParameterisationPolyhedraZ::GetRmin(G4double z, G4int nseg) const
480 {
481 // Get Rmin in the given z position for the given polyhedra segment
482 
483  return GetR(z,
484  fOrigParamMother->Z_values[nseg],
485  fOrigParamMother->Rmin[nseg],
486  fOrigParamMother->Z_values[nseg+1],
487  fOrigParamMother->Rmin[nseg+1]);
488 }
489 
490 //------------------------------------------------------------------------
491 G4double G4ParameterisationPolyhedraZ::GetRmax(G4double z, G4int nseg) const
492 {
493 // Get Rmax in the given z position for the given polyhedra segment
494 
495  return GetR(z,
496  fOrigParamMother->Z_values[nseg],
497  fOrigParamMother->Rmax[nseg],
498  fOrigParamMother->Z_values[nseg+1],
499  fOrigParamMother->Rmax[nseg+1]);
500 }
501 
502 //------------------------------------------------------------------------
504 {
505  return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
506  -fOrigParamMother->Z_values[0]);
507 }
508 
509 //---------------------------------------------------------------------
511 {
513 
514  // Division will be following the mother polyhedra segments
515  if( fDivisionType == DivNDIV ) {
516  if( fOrigParamMother->Num_z_planes-1 != fnDiv ) {
517  std::ostringstream message;
518  message << "Configuration not supported." << G4endl
519  << "Division along Z will be done splitting in the defined"
520  << G4endl
521  << "Z planes, i.e, the number of division would be :"
522  << fOrigParamMother->Num_z_planes-1 << " instead of "
523  << fnDiv << " !";
524  G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()",
525  "GeomDiv0001", FatalException, message);
526  }
527  }
528 
529  // Division will be done within one polyhedra segment
530  // with applying given width and offset
532  // Check if divided region does not span over more
533  // than one z segment
534 
535  G4int isegstart = -1; // number of the segment containing start position
536  G4int isegend = -1; // number of the segment containing end position
537 
538  if ( ! fReflectedSolid ) {
539  // The start/end position of the divided region
540  G4double zstart
541  = fOrigParamMother->Z_values[0] + foffset;
542  G4double zend
543  = fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth;
544 
545  G4int counter = 0;
546  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
547  // first segment
548  if ( zstart >= fOrigParamMother->Z_values[counter] &&
549  zstart < fOrigParamMother->Z_values[counter+1] ) {
550  isegstart = counter;
551  }
552  // last segment
553  if ( zend > fOrigParamMother->Z_values[counter] &&
554  zend <= fOrigParamMother->Z_values[counter+1] ) {
555  isegend = counter;
556  }
557  ++counter;
558  }
559  }
560  else {
561  // The start/end position of the divided region
562  G4double zstart
563  = fOrigParamMother->Z_values[0] - foffset;
564  G4double zend
565  = fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth);
566 
567  G4int counter = 0;
568  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
569  // first segment
570  if ( zstart <= fOrigParamMother->Z_values[counter] &&
571  zstart > fOrigParamMother->Z_values[counter+1] ) {
572  isegstart = counter;
573  }
574  // last segment
575  if ( zend < fOrigParamMother->Z_values[counter] &&
576  zend >= fOrigParamMother->Z_values[counter+1] ) {
577  isegend = counter;
578  }
579  ++counter;
580  }
581  }
582 
583  if ( isegstart != isegend ) {
584  std::ostringstream message;
585  message << "Configuration not supported." << G4endl
586  << "Division with user defined width." << G4endl
587  << "Solid " << fmotherSolid->GetName() << G4endl
588  << "Divided region is not between two Z planes.";
589  G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()",
590  "GeomDiv0001", FatalException, message);
591  }
592 
593  fNSegment = isegstart;
594  }
595 }
596 
597 //---------------------------------------------------------------------
598 void
600 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol) const
601 {
602  if ( fDivisionType == DivNDIV ) {
603  // The position of the centre of copyNo-th mother polycone segment
604  G4double posi = ( fOrigParamMother->Z_values[copyNo]
605  + fOrigParamMother->Z_values[copyNo+1])/2;
606  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
607  }
608 
610  // The position of the centre of copyNo-th division
611 
612  G4double posi = fOrigParamMother->Z_values[0];
613 
614  if ( ! fReflectedSolid )
615  posi += foffset + (2*copyNo + 1) * fwidth/2.;
616  else
617  posi -= foffset + (2*copyNo + 1) * fwidth/2.;
618 
619  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
620  }
621 
622  //----- calculate rotation matrix: unit
623 
624 #ifdef G4DIVDEBUG
625  if( verbose >= 2 )
626  {
627  G4cout << " G4ParameterisationPolyhedraZ - position: " << posi << G4endl
628  << " copyNo: " << copyNo << " - foffset: " << foffset/deg
629  << " - fwidth: " << fwidth/deg << G4endl;
630  }
631 #endif
632 
633  ChangeRotMatrix( physVol );
634 
635 #ifdef G4DIVDEBUG
636  if( verbose >= 2 )
637  {
638  G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraZ "
639  << copyNo << G4endl
640  << " Position: " << origin << " - Width: " << fwidth
641  << " - Axis: " << faxis << G4endl;
642  }
643 #endif
644 }
645 
646 //---------------------------------------------------------------------
647 void
649 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
650  const G4VPhysicalVolume* ) const
651 {
652  // Define division solid
653  G4PolyhedraHistorical origparam;
654  G4int nz = 2;
655  origparam.Num_z_planes = nz;
656  origparam.numSide = fOrigParamMother->numSide;
657  origparam.Start_angle = fOrigParamMother->Start_angle;
658  origparam.Opening_angle = fOrigParamMother->Opening_angle;
659 
660  // Define division solid z sections
661  origparam.Z_values = new G4double[nz];
662  origparam.Rmin = new G4double[nz];
663  origparam.Rmax = new G4double[nz];
664  origparam.Z_values[0] = - fwidth/2.;
665  origparam.Z_values[1] = fwidth/2.;
666 
667  if ( fDivisionType == DivNDIV ) {
668  // The position of the centre of copyNo-th mother polycone segment
669  G4double posi = ( fOrigParamMother->Z_values[copyNo]
670  + fOrigParamMother->Z_values[copyNo+1])/2;
671 
672  origparam.Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi;
673  origparam.Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi;
674  origparam.Rmin[0] = fOrigParamMother->Rmin[copyNo];
675  origparam.Rmin[1] = fOrigParamMother->Rmin[copyNo+1];
676  origparam.Rmax[0] = fOrigParamMother->Rmax[copyNo];
677  origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
678  }
679 
681  if ( ! fReflectedSolid ) {
682  origparam.Z_values[0] = - fwidth/2.;
683  origparam.Z_values[1] = fwidth/2.;
684 
685  // The position of the centre of copyNo-th division
686  G4double posi
687  = fOrigParamMother->Z_values[0] + foffset + (2*copyNo + 1) * fwidth/2.;
688 
689  // The first and last z sides z values
690  G4double zstart = posi - fwidth/2.;
691  G4double zend = posi + fwidth/2.;
692  origparam.Rmin[0] = GetRmin(zstart, fNSegment);
693  origparam.Rmax[0] = GetRmax(zstart, fNSegment);
694  origparam.Rmin[1] = GetRmin(zend, fNSegment);
695  origparam.Rmax[1] = GetRmax(zend, fNSegment);
696  }
697  else {
698  origparam.Z_values[0] = fwidth/2.;
699  origparam.Z_values[1] = - fwidth/2.;
700 
701  // The position of the centre of copyNo-th division
702  G4double posi
703  = fOrigParamMother->Z_values[0] - ( foffset + (2*copyNo + 1) * fwidth/2.);
704 
705  // The first and last z sides z values
706  G4double zstart = posi + fwidth/2.;
707  G4double zend = posi - fwidth/2.;
708  origparam.Rmin[0] = GetRmin(zstart, fNSegment);
709  origparam.Rmax[0] = GetRmax(zstart, fNSegment);
710  origparam.Rmin[1] = GetRmin(zend, fNSegment);
711  origparam.Rmax[1] = GetRmax(zend, fNSegment);
712  }
713 
714  // It can happen due to rounding errors
715  if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
716  if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
717  }
718 
719  phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
720  phedra.Reset(); // reset to new solid parameters
721 
722 #ifdef G4DIVDEBUG
723  if( verbose >= 2 )
724  {
725  G4cout << "G4ParameterisationPolyhedraZ::ComputeDimensions()" << G4endl
726  << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
727  phedra.DumpInfo();
728  }
729 #endif
730 }