Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/divisions/src/G4ParameterisationBox.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/G4ParameterisationBox.cc (Version 11.3.0) and /geometry/divisions/src/G4ParameterisationBox.cc (Version 9.3.p2)


  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 // G4ParameterisationBox[X/Y/Z] implementation <<  26 //
                                                   >>  27 // $Id: G4ParameterisationBox.cc,v 1.10 2006/06/29 18:18:35 gunter Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-03-patch-02 $
                                                   >>  29 //
                                                   >>  30 // class G4ParameterisationBox Implementation file
 27 //                                                 31 //
 28 // 26.05.03 - P.Arce, Initial version              32 // 26.05.03 - P.Arce, Initial version
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec     33 // 08.04.04 - I.Hrivnacova, Implemented reflection
 30 // 21.04.10 - M.Asai, Added gaps               << 
 31 // -------------------------------------------     34 // --------------------------------------------------------------------
 32                                                    35 
 33 #include "G4ParameterisationBox.hh"                36 #include "G4ParameterisationBox.hh"
 34                                                    37 
 35 #include <iomanip>                                 38 #include <iomanip>
 36 #include "G4ThreeVector.hh"                        39 #include "G4ThreeVector.hh"
 37 #include "G4Transform3D.hh"                        40 #include "G4Transform3D.hh"
 38 #include "G4RotationMatrix.hh"                     41 #include "G4RotationMatrix.hh"
 39 #include "G4VPhysicalVolume.hh"                    42 #include "G4VPhysicalVolume.hh"
 40 #include "G4ReflectedSolid.hh"                     43 #include "G4ReflectedSolid.hh"
 41 #include "G4Box.hh"                                44 #include "G4Box.hh"
 42                                                    45 
 43 //--------------------------------------------     46 //--------------------------------------------------------------------------
 44 G4VParameterisationBox::                           47 G4VParameterisationBox::
 45 G4VParameterisationBox( EAxis axis, G4int nDiv     48 G4VParameterisationBox( EAxis axis, G4int nDiv, G4double width,
 46                         G4double offset, G4VSo     49                         G4double offset, G4VSolid* msolid,
 47                         DivisionType divType )     50                         DivisionType divType )
 48   :  G4VDivisionParameterisation( axis, nDiv,      51   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 49 {                                                  52 {
 50   auto msol = (G4Box*)(msolid);                <<  53   G4Box* msol = (G4Box*)(msolid);
 51   if (msolid->GetEntityType() == "G4ReflectedS     54   if (msolid->GetEntityType() == "G4ReflectedSolid")
 52   {                                                55   {
 53     // Get constituent solid                       56     // Get constituent solid  
 54     G4VSolid* mConstituentSolid                    57     G4VSolid* mConstituentSolid 
 55        = ((G4ReflectedSolid*)msolid)->GetConst     58        = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
 56     msol = (G4Box*)(mConstituentSolid);            59     msol = (G4Box*)(mConstituentSolid);
 57     fmotherSolid = msol;                           60     fmotherSolid = msol;
 58     fReflectedSolid = true;                        61     fReflectedSolid = true;
 59   }                                                62   }    
 60 }                                                  63 }
 61                                                    64 
 62 //--------------------------------------------     65 //--------------------------------------------------------------------------
 63 G4VParameterisationBox::~G4VParameterisationBo <<  66 G4VParameterisationBox::~G4VParameterisationBox()
                                                   >>  67 {
                                                   >>  68 }
 64                                                    69 
 65 //--------------------------------------------     70 //--------------------------------------------------------------------------
 66 G4ParameterisationBoxX::                           71 G4ParameterisationBoxX::
 67 G4ParameterisationBoxX( EAxis axis, G4int nDiv     72 G4ParameterisationBoxX( EAxis axis, G4int nDiv, G4double width,
 68                         G4double offset, G4VSo     73                         G4double offset, G4VSolid* msolid,
 69                         DivisionType divType )     74                         DivisionType divType )
 70   :  G4VParameterisationBox( axis, nDiv, width     75   :  G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
 71 {                                                  76 {
 72   CheckParametersValidity();                       77   CheckParametersValidity();
 73   SetType( "DivisionBoxX" );                       78   SetType( "DivisionBoxX" );
 74                                                    79 
 75   auto mbox = (G4Box*)(fmotherSolid);          <<  80   G4Box* mbox = (G4Box*)(fmotherSolid);
 76   if( divType == DivWIDTH )                        81   if( divType == DivWIDTH )
 77   {                                                82   {
 78     fnDiv = CalculateNDiv( 2*mbox->GetXHalfLen     83     fnDiv = CalculateNDiv( 2*mbox->GetXHalfLength(), width, offset );
 79   }                                                84   }
 80   else if( divType == DivNDIV )                    85   else if( divType == DivNDIV )
 81   {                                                86   {
 82     fwidth = CalculateWidth( 2*mbox->GetXHalfL     87     fwidth = CalculateWidth( 2*mbox->GetXHalfLength(), nDiv, offset );
 83   }                                                88   }
 84 #ifdef G4DIVDEBUG                                  89 #ifdef G4DIVDEBUG
 85   if( verbose >= 1 )                               90   if( verbose >= 1 )
 86   {                                                91   {
 87     G4cout << " G4ParameterisationBoxX - no di     92     G4cout << " G4ParameterisationBoxX - no divisions "
 88            << fnDiv << " = " << nDiv << G4endl     93            << fnDiv << " = " << nDiv << G4endl
 89            << " Offset " << foffset << " = " <     94            << " Offset " << foffset << " = " << offset << G4endl
 90            << " Width " << fwidth << " = " <<      95            << " Width " << fwidth << " = " << width << G4endl;
 91   }                                                96   }
 92 #endif                                             97 #endif
 93 }                                                  98 }
 94                                                    99 
 95 //--------------------------------------------    100 //------------------------------------------------------------------------
 96 G4ParameterisationBoxX::~G4ParameterisationBox << 101 G4ParameterisationBoxX::~G4ParameterisationBoxX()
                                                   >> 102 {
                                                   >> 103 }
 97                                                   104 
 98 //--------------------------------------------    105 //------------------------------------------------------------------------
 99 G4double G4ParameterisationBoxX::GetMaxParamet    106 G4double G4ParameterisationBoxX::GetMaxParameter() const
100 {                                                 107 {
101   auto msol = (G4Box*)(fmotherSolid);          << 108   G4Box* msol = (G4Box*)(fmotherSolid);
102   return 2*msol->GetXHalfLength();                109   return 2*msol->GetXHalfLength();
103 }                                                 110 }
104                                                   111 
105 //--------------------------------------------    112 //------------------------------------------------------------------------
106 void                                              113 void
107 G4ParameterisationBoxX::                          114 G4ParameterisationBoxX::
108 ComputeTransformation( const G4int copyNo, G4V    115 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
109 {                                                 116 {
110   auto msol = (G4Box*)(fmotherSolid );         << 117   G4Box* msol = (G4Box*)(fmotherSolid );
111   G4double mdx = msol->GetXHalfLength( );         118   G4double mdx = msol->GetXHalfLength( );
112                                                   119 
113   //----- translation                             120   //----- translation 
114   G4ThreeVector origin(0.,0.,0.);                 121   G4ThreeVector origin(0.,0.,0.); 
115   G4double posi = -mdx + foffset+(copyNo+0.5)*    122   G4double posi = -mdx + foffset+(copyNo+0.5)*fwidth;
116                                                   123 
117   if( faxis == kXAxis )                           124   if( faxis == kXAxis )
118   {                                               125   {
119     origin.setX( posi );                          126     origin.setX( posi ); 
120   }                                               127   }
121   else                                            128   else
122   {                                            << 129   { 
123     std::ostringstream message;                << 
124     message << "Only axes along X are allowed  << 
125     G4Exception("G4ParameterisationBoxX::Compu    130     G4Exception("G4ParameterisationBoxX::ComputeTransformation()",
126                 "GeomDiv0002", FatalException, << 131                 "IllegalConstruct", FatalException,
                                                   >> 132                 "Only axes along X are allowed !  Axis: "+faxis);
127   }                                               133   }
128 #ifdef G4DIVDEBUG                                 134 #ifdef G4DIVDEBUG
129   if( verbose >= 2 )                              135   if( verbose >= 2 )
130   {                                               136   {
131     G4cout << std::setprecision(8) << " G4Para    137     G4cout << std::setprecision(8) << " G4ParameterisationBoxX: "
132            << copyNo << G4endl                    138            << copyNo << G4endl
133            << " Position " << origin << " Axis    139            << " Position " << origin << " Axis " << faxis << G4endl;
134   }                                               140   }
135 #endif                                            141 #endif
136   //----- set translation                         142   //----- set translation 
137   physVol->SetTranslation( origin );              143   physVol->SetTranslation( origin );
138 }                                                 144 }
139                                                   145 
140 //--------------------------------------------    146 //------------------------------------------------------------------------
141 void                                              147 void
142 G4ParameterisationBoxX::                          148 G4ParameterisationBoxX::
143 ComputeDimensions( G4Box& box, const G4int,       149 ComputeDimensions( G4Box& box, const G4int,
144                    const G4VPhysicalVolume* )     150                    const G4VPhysicalVolume* ) const
145 {                                                 151 {
146   auto msol = (G4Box*)(fmotherSolid);          << 152   G4Box* msol = (G4Box*)(fmotherSolid);
147                                                   153 
148   G4double pDx = fwidth/2. - fhgap;            << 154   G4double pDx = fwidth/2.;
149   G4double pDy = msol->GetYHalfLength();          155   G4double pDy = msol->GetYHalfLength();
150   G4double pDz = msol->GetZHalfLength();          156   G4double pDz = msol->GetZHalfLength();
151                                                   157 
152   box.SetXHalfLength( pDx );                      158   box.SetXHalfLength( pDx );
153   box.SetYHalfLength( pDy );                      159   box.SetYHalfLength( pDy );
154   box.SetZHalfLength( pDz );                      160   box.SetZHalfLength( pDz );
155                                                   161 
156 #ifdef G4DIVDEBUG                                 162 #ifdef G4DIVDEBUG
157   if( verbose >= 2 )                              163   if( verbose >= 2 )
158   {                                               164   {
159     G4cout << " G4ParameterisationBoxX::Comput    165     G4cout << " G4ParameterisationBoxX::ComputeDimensions()" << G4endl
160            << " pDx: " << pDz << G4endl;          166            << " pDx: " << pDz << G4endl;
161     box.DumpInfo();                               167     box.DumpInfo();
162   }                                               168   }
163 #endif                                            169 #endif
164 }                                                 170 }
165                                                   171 
166 //--------------------------------------------    172 //------------------------------------------------------------------------
167 G4ParameterisationBoxY::                          173 G4ParameterisationBoxY::
168 G4ParameterisationBoxY( EAxis axis, G4int nDiv    174 G4ParameterisationBoxY( EAxis axis, G4int nDiv, G4double width,
169                         G4double offset, G4VSo    175                         G4double offset, G4VSolid* msolid,
170                         DivisionType divType)     176                         DivisionType divType)
171   :  G4VParameterisationBox( axis, nDiv, width    177   :  G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
172 {                                                 178 {
173   CheckParametersValidity();                      179   CheckParametersValidity();
174   SetType( "DivisionBoxY" );                      180   SetType( "DivisionBoxY" );
175                                                   181 
176   auto mbox = (G4Box*)(fmotherSolid);          << 182   G4Box* mbox = (G4Box*)(fmotherSolid);
177   if( divType == DivWIDTH )                       183   if( divType == DivWIDTH )
178   {                                               184   {
179     fnDiv = CalculateNDiv( 2*mbox->GetYHalfLen    185     fnDiv = CalculateNDiv( 2*mbox->GetYHalfLength(), width, offset );
180   }                                               186   }
181   else if( divType == DivNDIV )                   187   else if( divType == DivNDIV )
182   {                                               188   {
183     fwidth = CalculateWidth( 2*mbox->GetYHalfL    189     fwidth = CalculateWidth( 2*mbox->GetYHalfLength(), nDiv, offset );
184   }                                               190   }
185                                                   191 
186 #ifdef G4DIVDEBUG                                 192 #ifdef G4DIVDEBUG
187   if( verbose >= 1 )                              193   if( verbose >= 1 )
188   {                                               194   {
189     G4cout << " G4ParameterisationBoxY - no di    195     G4cout << " G4ParameterisationBoxY - no divisions " << fnDiv << " = "
190            << nDiv << ". Offset " << foffset <    196            << nDiv << ". Offset " << foffset << " = " << offset
191            << ". Width " << fwidth << " = " <<    197            << ". Width " << fwidth << " = " << width << G4endl;
192   }                                               198   }
193 #endif                                            199 #endif
194 }                                                 200 }
195                                                   201 
196 //--------------------------------------------    202 //------------------------------------------------------------------------
197 G4ParameterisationBoxY::~G4ParameterisationBox << 203 G4ParameterisationBoxY::~G4ParameterisationBoxY()
                                                   >> 204 {
                                                   >> 205 }
198                                                   206 
199 //--------------------------------------------    207 //------------------------------------------------------------------------
200 G4double G4ParameterisationBoxY::GetMaxParamet    208 G4double G4ParameterisationBoxY::GetMaxParameter() const
201 {                                                 209 {
202   auto msol = (G4Box*)(fmotherSolid);          << 210   G4Box* msol = (G4Box*)(fmotherSolid);
203   return 2*msol->GetYHalfLength();                211   return 2*msol->GetYHalfLength();
204 }                                                 212 }
205                                                   213 
206 //--------------------------------------------    214 //------------------------------------------------------------------------
207 void                                              215 void
208 G4ParameterisationBoxY::                          216 G4ParameterisationBoxY::
209 ComputeTransformation( const G4int copyNo, G4V    217 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
210 {                                                 218 {
211   auto msol = (G4Box*)(fmotherSolid);          << 219   G4Box* msol = (G4Box*)(fmotherSolid);
212   G4double mdy = msol->GetYHalfLength();          220   G4double mdy = msol->GetYHalfLength();
213                                                   221 
214   //----- translation                             222   //----- translation 
215   G4ThreeVector origin(0.,0.,0.);                 223   G4ThreeVector origin(0.,0.,0.); 
216   G4double posi = -mdy + foffset + (copyNo+0.5    224   G4double posi = -mdy + foffset + (copyNo+0.5)*fwidth;
217   if( faxis == kYAxis )                           225   if( faxis == kYAxis )
218   {                                               226   {
219     origin.setY( posi );                          227     origin.setY( posi ); 
220   }                                               228   }
221   else                                            229   else
222   {                                               230   {
223     std::ostringstream message;                << 
224     message << "Only axes along Y are allowed  << 
225     G4Exception("G4ParameterisationBoxY::Compu    231     G4Exception("G4ParameterisationBoxY::ComputeTransformation()",
226                 "GeomDiv0002", FatalException, << 232                 "IllegalConstruct", FatalException,
                                                   >> 233                 "Only axes along Y are allowed !  Axis: "+faxis);
227   }                                               234   }
228 #ifdef G4DIVDEBUG                                 235 #ifdef G4DIVDEBUG
229   if( verbose >= 2 )                              236   if( verbose >= 2 )
230   {                                               237   {
231     G4cout << std::setprecision(8) << " G4Para    238     G4cout << std::setprecision(8) << " G4ParameterisationBoxY: "
232            << copyNo << G4endl                    239            << copyNo << G4endl
233            << " Position " << origin << " Axis    240            << " Position " << origin << " Axis " << faxis << G4endl;
234   }                                               241   }
235 #endif                                            242 #endif
236    //----- set translation                        243    //----- set translation 
237   physVol->SetTranslation( origin );              244   physVol->SetTranslation( origin );
238 }                                                 245 }
239                                                   246 
240 //--------------------------------------------    247 //------------------------------------------------------------------------
241 void                                              248 void
242 G4ParameterisationBoxY::                          249 G4ParameterisationBoxY::
243 ComputeDimensions( G4Box& box, const G4int,       250 ComputeDimensions( G4Box& box, const G4int,
244                    const G4VPhysicalVolume* )     251                    const G4VPhysicalVolume* ) const
245 {                                                 252 {
246   auto msol = (G4Box*)(fmotherSolid);          << 253   G4Box* msol = (G4Box*)(fmotherSolid);
247                                                   254 
248   G4double pDx = msol->GetXHalfLength();          255   G4double pDx = msol->GetXHalfLength();
249   G4double pDy = fwidth/2. - fhgap;            << 256   G4double pDy = fwidth/2.;
250   G4double pDz = msol->GetZHalfLength();          257   G4double pDz = msol->GetZHalfLength();
251                                                   258 
252   box.SetXHalfLength( pDx );                      259   box.SetXHalfLength( pDx );
253   box.SetYHalfLength( pDy );                      260   box.SetYHalfLength( pDy );
254   box.SetZHalfLength( pDz );                      261   box.SetZHalfLength( pDz );
255                                                   262 
256 #ifdef G4DIVDEBUG                                 263 #ifdef G4DIVDEBUG
257   if( verbose >= 2 )                              264   if( verbose >= 2 )
258   {                                               265   {
259     G4cout << " G4ParameterisationBoxY::Comput    266     G4cout << " G4ParameterisationBoxY::ComputeDimensions()" << G4endl
260            << " pDx: " << pDz << G4endl;          267            << " pDx: " << pDz << G4endl;
261     box.DumpInfo();                               268     box.DumpInfo();
262   }                                               269   }
263 #endif                                            270 #endif
264 }                                                 271 }
265                                                   272 
266 //--------------------------------------------    273 //------------------------------------------------------------------------
267 G4ParameterisationBoxZ::                          274 G4ParameterisationBoxZ::
268 G4ParameterisationBoxZ( EAxis axis, G4int nDiv    275 G4ParameterisationBoxZ( EAxis axis, G4int nDiv, G4double width,
269                         G4double offset, G4VSo    276                         G4double offset, G4VSolid* msolid,
270                         DivisionType divType )    277                         DivisionType divType )
271   :  G4VParameterisationBox( axis, nDiv, width    278   :  G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
272 {                                                 279 {
273   CheckParametersValidity();                      280   CheckParametersValidity();
274   SetType( "DivisionBoxZ" );                      281   SetType( "DivisionBoxZ" );
275                                                   282 
276   auto mbox = (G4Box*)(fmotherSolid);          << 283   G4Box* mbox = (G4Box*)(fmotherSolid);
277   if( divType == DivWIDTH )                       284   if( divType == DivWIDTH )
278   {                                               285   {
279     fnDiv = CalculateNDiv( 2*mbox->GetZHalfLen    286     fnDiv = CalculateNDiv( 2*mbox->GetZHalfLength(), width, offset );
280   }                                               287   }
281   else if ( divType == DivNDIV )                  288   else if ( divType == DivNDIV )
282   {                                               289   {
283     fwidth = CalculateWidth( 2*mbox->GetZHalfL    290     fwidth = CalculateWidth( 2*mbox->GetZHalfLength(), nDiv, offset );
284   }                                               291   }
285 #ifdef G4DIVDEBUG                                 292 #ifdef G4DIVDEBUG
286   if( verbose >= 1 )                              293   if( verbose >= 1 )
287   {                                               294   {
288     G4cout << " G4ParameterisationBoxZ - no di    295     G4cout << " G4ParameterisationBoxZ - no divisions " << fnDiv << " = "
289            << nDiv << ". Offset " << foffset <    296            << nDiv << ". Offset " << foffset << " = " << offset
290            << ". Width " << fwidth << " = " <<    297            << ". Width " << fwidth << " = " << width << G4endl;
291   }                                               298   }
292 #endif                                            299 #endif
293 }                                                 300 }
294                                                   301 
295 //--------------------------------------------    302 //------------------------------------------------------------------------
296 G4ParameterisationBoxZ::~G4ParameterisationBox << 303 G4ParameterisationBoxZ::~G4ParameterisationBoxZ()
                                                   >> 304 {
                                                   >> 305 }
297                                                   306 
298 //--------------------------------------------    307 //------------------------------------------------------------------------
299 G4double G4ParameterisationBoxZ::GetMaxParamet    308 G4double G4ParameterisationBoxZ::GetMaxParameter() const
300 {                                                 309 {
301   auto msol = (G4Box*)(fmotherSolid);          << 310   G4Box* msol = (G4Box*)(fmotherSolid);
302   return 2*msol->GetZHalfLength();                311   return 2*msol->GetZHalfLength();
303 }                                                 312 }
304                                                   313 
305 //--------------------------------------------    314 //------------------------------------------------------------------------
306 void                                              315 void
307 G4ParameterisationBoxZ::                          316 G4ParameterisationBoxZ::
308 ComputeTransformation( const G4int copyNo, G4V    317 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
309 {                                                 318 {
310   auto msol = (G4Box*)(fmotherSolid );         << 319   G4Box* msol = (G4Box*)(fmotherSolid );
311   G4double mdz = msol->GetZHalfLength();          320   G4double mdz = msol->GetZHalfLength();
312                                                   321 
313    //----- translation                            322    //----- translation 
314   G4ThreeVector origin(0.,0.,0.);                 323   G4ThreeVector origin(0.,0.,0.); 
315   G4double posi = -mdz + OffsetZ() + (copyNo+0    324   G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
316                                                   325 
317   if( faxis == kZAxis )                           326   if( faxis == kZAxis )
318   {                                               327   {
319     origin.setZ( posi );                          328     origin.setZ( posi ); 
320   }                                               329   }
321   else                                            330   else
322   {                                               331   { 
323     std::ostringstream message;                << 
324     message << "Only axes along Z are allowed  << 
325     G4Exception("G4ParameterisationBoxZ::Compu    332     G4Exception("G4ParameterisationBoxZ::ComputeTransformation()",
326                 "GeomDiv0002", FatalException, << 333                 "IllegalConstruct", FatalException,
                                                   >> 334                 "Only axes along Z are allowed !  Axis: "+faxis);
327   }                                               335   }
328 #ifdef G4DIVDEBUG                                 336 #ifdef G4DIVDEBUG
329   if( verbose >= 2 )                              337   if( verbose >= 2 )
330   {                                               338   {
331     G4cout << std::setprecision(8) << " G4Para    339     G4cout << std::setprecision(8) << " G4ParameterisationBoxZ: "
332            << copyNo << G4endl                    340            << copyNo << G4endl
333            << " Position " << origin << " Axis    341            << " Position " << origin << " Axis " << faxis << G4endl;
334   }                                               342   }
335 #endif                                            343 #endif
336    //----- set translation                        344    //----- set translation 
337   physVol->SetTranslation( origin );              345   physVol->SetTranslation( origin );
338 }                                                 346 }
339                                                   347 
340 //--------------------------------------------    348 //------------------------------------------------------------------------
341 void                                              349 void
342 G4ParameterisationBoxZ::                          350 G4ParameterisationBoxZ::
343 ComputeDimensions( G4Box& box, const G4int,       351 ComputeDimensions( G4Box& box, const G4int,
344                    const G4VPhysicalVolume* )     352                    const G4VPhysicalVolume* ) const
345 {                                                 353 {
346   auto msol = (G4Box*)(fmotherSolid);          << 354   G4Box* msol = (G4Box*)(fmotherSolid);
347                                                   355 
348   G4double pDx = msol->GetXHalfLength();          356   G4double pDx = msol->GetXHalfLength();
349   G4double pDy = msol->GetYHalfLength();          357   G4double pDy = msol->GetYHalfLength();
350   G4double pDz = fwidth/2. - fhgap;            << 358   G4double pDz = fwidth/2.;
351                                                   359 
352   box.SetXHalfLength( pDx );                      360   box.SetXHalfLength( pDx );
353   box.SetYHalfLength( pDy );                      361   box.SetYHalfLength( pDy );
354   box.SetZHalfLength( pDz );                      362   box.SetZHalfLength( pDz );
355                                                   363 
356 #ifdef G4DIVDEBUG                                 364 #ifdef G4DIVDEBUG
357   if( verbose >= 2 )                              365   if( verbose >= 2 )
358   {                                               366   {
359     G4cout << " G4ParameterisationBoxZ::Comput    367     G4cout << " G4ParameterisationBoxZ::ComputeDimensions()" << G4endl
360            << " pDx: " << pDz << G4endl;          368            << " pDx: " << pDz << G4endl;
361     box.DumpInfo();                               369     box.DumpInfo();
362   }                                               370   }
363 #endif                                            371 #endif
364 }                                                 372 }
                                                   >> 373 
365                                                   374