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.6.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 // G4ParameterisationBox[X/Y/Z] implementation <<  26 //
                                                   >>  27 // $Id: G4ParameterisationBox.cc 69784 2013-05-15 09:16:06Z gcosmo $
                                                   >>  28 //
                                                   >>  29 // class G4ParameterisationBox Implementation file
 27 //                                                 30 //
 28 // 26.05.03 - P.Arce, Initial version              31 // 26.05.03 - P.Arce, Initial version
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec     32 // 08.04.04 - I.Hrivnacova, Implemented reflection
 30 // 21.04.10 - M.Asai, Added gaps                   33 // 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;                   130     std::ostringstream message;
124     message << "Only axes along X are allowed     131     message << "Only axes along X are allowed !  Axis: " << faxis;
125     G4Exception("G4ParameterisationBoxX::Compu    132     G4Exception("G4ParameterisationBoxX::ComputeTransformation()",
126                 "GeomDiv0002", FatalException,    133                 "GeomDiv0002", FatalException, message);
127   }                                               134   }
128 #ifdef G4DIVDEBUG                                 135 #ifdef G4DIVDEBUG
129   if( verbose >= 2 )                              136   if( verbose >= 2 )
130   {                                               137   {
131     G4cout << std::setprecision(8) << " G4Para    138     G4cout << std::setprecision(8) << " G4ParameterisationBoxX: "
132            << copyNo << G4endl                    139            << copyNo << G4endl
133            << " Position " << origin << " Axis    140            << " Position " << origin << " Axis " << faxis << G4endl;
134   }                                               141   }
135 #endif                                            142 #endif
136   //----- set translation                         143   //----- set translation 
137   physVol->SetTranslation( origin );              144   physVol->SetTranslation( origin );
138 }                                                 145 }
139                                                   146 
140 //--------------------------------------------    147 //------------------------------------------------------------------------
141 void                                              148 void
142 G4ParameterisationBoxX::                          149 G4ParameterisationBoxX::
143 ComputeDimensions( G4Box& box, const G4int,       150 ComputeDimensions( G4Box& box, const G4int,
144                    const G4VPhysicalVolume* )     151                    const G4VPhysicalVolume* ) const
145 {                                                 152 {
146   auto msol = (G4Box*)(fmotherSolid);          << 153   G4Box* msol = (G4Box*)(fmotherSolid);
147                                                   154 
148   G4double pDx = fwidth/2. - fhgap;               155   G4double pDx = fwidth/2. - fhgap;
149   G4double pDy = msol->GetYHalfLength();          156   G4double pDy = msol->GetYHalfLength();
150   G4double pDz = msol->GetZHalfLength();          157   G4double pDz = msol->GetZHalfLength();
151                                                   158 
152   box.SetXHalfLength( pDx );                      159   box.SetXHalfLength( pDx );
153   box.SetYHalfLength( pDy );                      160   box.SetYHalfLength( pDy );
154   box.SetZHalfLength( pDz );                      161   box.SetZHalfLength( pDz );
155                                                   162 
156 #ifdef G4DIVDEBUG                                 163 #ifdef G4DIVDEBUG
157   if( verbose >= 2 )                              164   if( verbose >= 2 )
158   {                                               165   {
159     G4cout << " G4ParameterisationBoxX::Comput    166     G4cout << " G4ParameterisationBoxX::ComputeDimensions()" << G4endl
160            << " pDx: " << pDz << G4endl;          167            << " pDx: " << pDz << G4endl;
161     box.DumpInfo();                               168     box.DumpInfo();
162   }                                               169   }
163 #endif                                            170 #endif
164 }                                                 171 }
165                                                   172 
166 //--------------------------------------------    173 //------------------------------------------------------------------------
167 G4ParameterisationBoxY::                          174 G4ParameterisationBoxY::
168 G4ParameterisationBoxY( EAxis axis, G4int nDiv    175 G4ParameterisationBoxY( EAxis axis, G4int nDiv, G4double width,
169                         G4double offset, G4VSo    176                         G4double offset, G4VSolid* msolid,
170                         DivisionType divType)     177                         DivisionType divType)
171   :  G4VParameterisationBox( axis, nDiv, width    178   :  G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
172 {                                                 179 {
173   CheckParametersValidity();                      180   CheckParametersValidity();
174   SetType( "DivisionBoxY" );                      181   SetType( "DivisionBoxY" );
175                                                   182 
176   auto mbox = (G4Box*)(fmotherSolid);          << 183   G4Box* mbox = (G4Box*)(fmotherSolid);
177   if( divType == DivWIDTH )                       184   if( divType == DivWIDTH )
178   {                                               185   {
179     fnDiv = CalculateNDiv( 2*mbox->GetYHalfLen    186     fnDiv = CalculateNDiv( 2*mbox->GetYHalfLength(), width, offset );
180   }                                               187   }
181   else if( divType == DivNDIV )                   188   else if( divType == DivNDIV )
182   {                                               189   {
183     fwidth = CalculateWidth( 2*mbox->GetYHalfL    190     fwidth = CalculateWidth( 2*mbox->GetYHalfLength(), nDiv, offset );
184   }                                               191   }
185                                                   192 
186 #ifdef G4DIVDEBUG                                 193 #ifdef G4DIVDEBUG
187   if( verbose >= 1 )                              194   if( verbose >= 1 )
188   {                                               195   {
189     G4cout << " G4ParameterisationBoxY - no di    196     G4cout << " G4ParameterisationBoxY - no divisions " << fnDiv << " = "
190            << nDiv << ". Offset " << foffset <    197            << nDiv << ". Offset " << foffset << " = " << offset
191            << ". Width " << fwidth << " = " <<    198            << ". Width " << fwidth << " = " << width << G4endl;
192   }                                               199   }
193 #endif                                            200 #endif
194 }                                                 201 }
195                                                   202 
196 //--------------------------------------------    203 //------------------------------------------------------------------------
197 G4ParameterisationBoxY::~G4ParameterisationBox << 204 G4ParameterisationBoxY::~G4ParameterisationBoxY()
                                                   >> 205 {
                                                   >> 206 }
198                                                   207 
199 //--------------------------------------------    208 //------------------------------------------------------------------------
200 G4double G4ParameterisationBoxY::GetMaxParamet    209 G4double G4ParameterisationBoxY::GetMaxParameter() const
201 {                                                 210 {
202   auto msol = (G4Box*)(fmotherSolid);          << 211   G4Box* msol = (G4Box*)(fmotherSolid);
203   return 2*msol->GetYHalfLength();                212   return 2*msol->GetYHalfLength();
204 }                                                 213 }
205                                                   214 
206 //--------------------------------------------    215 //------------------------------------------------------------------------
207 void                                              216 void
208 G4ParameterisationBoxY::                          217 G4ParameterisationBoxY::
209 ComputeTransformation( const G4int copyNo, G4V    218 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
210 {                                                 219 {
211   auto msol = (G4Box*)(fmotherSolid);          << 220   G4Box* msol = (G4Box*)(fmotherSolid);
212   G4double mdy = msol->GetYHalfLength();          221   G4double mdy = msol->GetYHalfLength();
213                                                   222 
214   //----- translation                             223   //----- translation 
215   G4ThreeVector origin(0.,0.,0.);                 224   G4ThreeVector origin(0.,0.,0.); 
216   G4double posi = -mdy + foffset + (copyNo+0.5    225   G4double posi = -mdy + foffset + (copyNo+0.5)*fwidth;
217   if( faxis == kYAxis )                           226   if( faxis == kYAxis )
218   {                                               227   {
219     origin.setY( posi );                          228     origin.setY( posi ); 
220   }                                               229   }
221   else                                            230   else
222   {                                               231   {
223     std::ostringstream message;                   232     std::ostringstream message;
224     message << "Only axes along Y are allowed     233     message << "Only axes along Y are allowed !  Axis: " << faxis;
225     G4Exception("G4ParameterisationBoxY::Compu    234     G4Exception("G4ParameterisationBoxY::ComputeTransformation()",
226                 "GeomDiv0002", FatalException,    235                 "GeomDiv0002", FatalException, message);
227   }                                               236   }
228 #ifdef G4DIVDEBUG                                 237 #ifdef G4DIVDEBUG
229   if( verbose >= 2 )                              238   if( verbose >= 2 )
230   {                                               239   {
231     G4cout << std::setprecision(8) << " G4Para    240     G4cout << std::setprecision(8) << " G4ParameterisationBoxY: "
232            << copyNo << G4endl                    241            << copyNo << G4endl
233            << " Position " << origin << " Axis    242            << " Position " << origin << " Axis " << faxis << G4endl;
234   }                                               243   }
235 #endif                                            244 #endif
236    //----- set translation                        245    //----- set translation 
237   physVol->SetTranslation( origin );              246   physVol->SetTranslation( origin );
238 }                                                 247 }
239                                                   248 
240 //--------------------------------------------    249 //------------------------------------------------------------------------
241 void                                              250 void
242 G4ParameterisationBoxY::                          251 G4ParameterisationBoxY::
243 ComputeDimensions( G4Box& box, const G4int,       252 ComputeDimensions( G4Box& box, const G4int,
244                    const G4VPhysicalVolume* )     253                    const G4VPhysicalVolume* ) const
245 {                                                 254 {
246   auto msol = (G4Box*)(fmotherSolid);          << 255   G4Box* msol = (G4Box*)(fmotherSolid);
247                                                   256 
248   G4double pDx = msol->GetXHalfLength();          257   G4double pDx = msol->GetXHalfLength();
249   G4double pDy = fwidth/2. - fhgap;               258   G4double pDy = fwidth/2. - fhgap;
250   G4double pDz = msol->GetZHalfLength();          259   G4double pDz = msol->GetZHalfLength();
251                                                   260 
252   box.SetXHalfLength( pDx );                      261   box.SetXHalfLength( pDx );
253   box.SetYHalfLength( pDy );                      262   box.SetYHalfLength( pDy );
254   box.SetZHalfLength( pDz );                      263   box.SetZHalfLength( pDz );
255                                                   264 
256 #ifdef G4DIVDEBUG                                 265 #ifdef G4DIVDEBUG
257   if( verbose >= 2 )                              266   if( verbose >= 2 )
258   {                                               267   {
259     G4cout << " G4ParameterisationBoxY::Comput    268     G4cout << " G4ParameterisationBoxY::ComputeDimensions()" << G4endl
260            << " pDx: " << pDz << G4endl;          269            << " pDx: " << pDz << G4endl;
261     box.DumpInfo();                               270     box.DumpInfo();
262   }                                               271   }
263 #endif                                            272 #endif
264 }                                                 273 }
265                                                   274 
266 //--------------------------------------------    275 //------------------------------------------------------------------------
267 G4ParameterisationBoxZ::                          276 G4ParameterisationBoxZ::
268 G4ParameterisationBoxZ( EAxis axis, G4int nDiv    277 G4ParameterisationBoxZ( EAxis axis, G4int nDiv, G4double width,
269                         G4double offset, G4VSo    278                         G4double offset, G4VSolid* msolid,
270                         DivisionType divType )    279                         DivisionType divType )
271   :  G4VParameterisationBox( axis, nDiv, width    280   :  G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
272 {                                                 281 {
273   CheckParametersValidity();                      282   CheckParametersValidity();
274   SetType( "DivisionBoxZ" );                      283   SetType( "DivisionBoxZ" );
275                                                   284 
276   auto mbox = (G4Box*)(fmotherSolid);          << 285   G4Box* mbox = (G4Box*)(fmotherSolid);
277   if( divType == DivWIDTH )                       286   if( divType == DivWIDTH )
278   {                                               287   {
279     fnDiv = CalculateNDiv( 2*mbox->GetZHalfLen    288     fnDiv = CalculateNDiv( 2*mbox->GetZHalfLength(), width, offset );
280   }                                               289   }
281   else if ( divType == DivNDIV )                  290   else if ( divType == DivNDIV )
282   {                                               291   {
283     fwidth = CalculateWidth( 2*mbox->GetZHalfL    292     fwidth = CalculateWidth( 2*mbox->GetZHalfLength(), nDiv, offset );
284   }                                               293   }
285 #ifdef G4DIVDEBUG                                 294 #ifdef G4DIVDEBUG
286   if( verbose >= 1 )                              295   if( verbose >= 1 )
287   {                                               296   {
288     G4cout << " G4ParameterisationBoxZ - no di    297     G4cout << " G4ParameterisationBoxZ - no divisions " << fnDiv << " = "
289            << nDiv << ". Offset " << foffset <    298            << nDiv << ". Offset " << foffset << " = " << offset
290            << ". Width " << fwidth << " = " <<    299            << ". Width " << fwidth << " = " << width << G4endl;
291   }                                               300   }
292 #endif                                            301 #endif
293 }                                                 302 }
294                                                   303 
295 //--------------------------------------------    304 //------------------------------------------------------------------------
296 G4ParameterisationBoxZ::~G4ParameterisationBox << 305 G4ParameterisationBoxZ::~G4ParameterisationBoxZ()
                                                   >> 306 {
                                                   >> 307 }
297                                                   308 
298 //--------------------------------------------    309 //------------------------------------------------------------------------
299 G4double G4ParameterisationBoxZ::GetMaxParamet    310 G4double G4ParameterisationBoxZ::GetMaxParameter() const
300 {                                                 311 {
301   auto msol = (G4Box*)(fmotherSolid);          << 312   G4Box* msol = (G4Box*)(fmotherSolid);
302   return 2*msol->GetZHalfLength();                313   return 2*msol->GetZHalfLength();
303 }                                                 314 }
304                                                   315 
305 //--------------------------------------------    316 //------------------------------------------------------------------------
306 void                                              317 void
307 G4ParameterisationBoxZ::                          318 G4ParameterisationBoxZ::
308 ComputeTransformation( const G4int copyNo, G4V    319 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
309 {                                                 320 {
310   auto msol = (G4Box*)(fmotherSolid );         << 321   G4Box* msol = (G4Box*)(fmotherSolid );
311   G4double mdz = msol->GetZHalfLength();          322   G4double mdz = msol->GetZHalfLength();
312                                                   323 
313    //----- translation                            324    //----- translation 
314   G4ThreeVector origin(0.,0.,0.);                 325   G4ThreeVector origin(0.,0.,0.); 
315   G4double posi = -mdz + OffsetZ() + (copyNo+0    326   G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
316                                                   327 
317   if( faxis == kZAxis )                           328   if( faxis == kZAxis )
318   {                                               329   {
319     origin.setZ( posi );                          330     origin.setZ( posi ); 
320   }                                               331   }
321   else                                            332   else
322   {                                               333   { 
323     std::ostringstream message;                   334     std::ostringstream message;
324     message << "Only axes along Z are allowed     335     message << "Only axes along Z are allowed !  Axis: " << faxis;
325     G4Exception("G4ParameterisationBoxZ::Compu    336     G4Exception("G4ParameterisationBoxZ::ComputeTransformation()",
326                 "GeomDiv0002", FatalException,    337                 "GeomDiv0002", FatalException, message);
327   }                                               338   }
328 #ifdef G4DIVDEBUG                                 339 #ifdef G4DIVDEBUG
329   if( verbose >= 2 )                              340   if( verbose >= 2 )
330   {                                               341   {
331     G4cout << std::setprecision(8) << " G4Para    342     G4cout << std::setprecision(8) << " G4ParameterisationBoxZ: "
332            << copyNo << G4endl                    343            << copyNo << G4endl
333            << " Position " << origin << " Axis    344            << " Position " << origin << " Axis " << faxis << G4endl;
334   }                                               345   }
335 #endif                                            346 #endif
336    //----- set translation                        347    //----- set translation 
337   physVol->SetTranslation( origin );              348   physVol->SetTranslation( origin );
338 }                                                 349 }
339                                                   350 
340 //--------------------------------------------    351 //------------------------------------------------------------------------
341 void                                              352 void
342 G4ParameterisationBoxZ::                          353 G4ParameterisationBoxZ::
343 ComputeDimensions( G4Box& box, const G4int,       354 ComputeDimensions( G4Box& box, const G4int,
344                    const G4VPhysicalVolume* )     355                    const G4VPhysicalVolume* ) const
345 {                                                 356 {
346   auto msol = (G4Box*)(fmotherSolid);          << 357   G4Box* msol = (G4Box*)(fmotherSolid);
347                                                   358 
348   G4double pDx = msol->GetXHalfLength();          359   G4double pDx = msol->GetXHalfLength();
349   G4double pDy = msol->GetYHalfLength();          360   G4double pDy = msol->GetYHalfLength();
350   G4double pDz = fwidth/2. - fhgap;               361   G4double pDz = fwidth/2. - fhgap;
351                                                   362 
352   box.SetXHalfLength( pDx );                      363   box.SetXHalfLength( pDx );
353   box.SetYHalfLength( pDy );                      364   box.SetYHalfLength( pDy );
354   box.SetZHalfLength( pDz );                      365   box.SetZHalfLength( pDz );
355                                                   366 
356 #ifdef G4DIVDEBUG                                 367 #ifdef G4DIVDEBUG
357   if( verbose >= 2 )                              368   if( verbose >= 2 )
358   {                                               369   {
359     G4cout << " G4ParameterisationBoxZ::Comput    370     G4cout << " G4ParameterisationBoxZ::ComputeDimensions()" << G4endl
360            << " pDx: " << pDz << G4endl;          371            << " pDx: " << pDz << G4endl;
361     box.DumpInfo();                               372     box.DumpInfo();
362   }                                               373   }
363 #endif                                            374 #endif
364 }                                                 375 }
                                                   >> 376 
365                                                   377