Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/divisions/src/G4ParameterisationPara.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/G4ParameterisationPara.cc (Version 11.3.0) and /geometry/divisions/src/G4ParameterisationPara.cc (Version 11.0.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 // class G4ParameterisationPara[X,Y,Z] impleme     26 // class G4ParameterisationPara[X,Y,Z] implementation
 27 //                                                 27 //
 28 // 26.05.03 - P.Arce, Initial version              28 // 26.05.03 - P.Arce, Initial version
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec     29 // 08.04.04 - I.Hrivnacova, Implemented reflection
 30 // 21.04.10 - M.Asai, Added gaps                   30 // 21.04.10 - M.Asai, Added gaps
 31 // -------------------------------------------     31 // --------------------------------------------------------------------
 32                                                    32 
 33 #include "G4ParameterisationPara.hh"               33 #include "G4ParameterisationPara.hh"
 34                                                    34 
 35 #include <iomanip>                                 35 #include <iomanip>
 36                                                    36 
 37 #include "G4PhysicalConstants.hh"                  37 #include "G4PhysicalConstants.hh"
 38 #include "G4ThreeVector.hh"                        38 #include "G4ThreeVector.hh"
 39 #include "G4Transform3D.hh"                        39 #include "G4Transform3D.hh"
 40 #include "G4RotationMatrix.hh"                     40 #include "G4RotationMatrix.hh"
 41 #include "G4VPhysicalVolume.hh"                    41 #include "G4VPhysicalVolume.hh"
 42 #include "G4ReflectedSolid.hh"                     42 #include "G4ReflectedSolid.hh"
 43 #include "G4Para.hh"                               43 #include "G4Para.hh"
 44                                                    44 
 45 //--------------------------------------------     45 //--------------------------------------------------------------------------
 46 G4VParameterisationPara::                          46 G4VParameterisationPara::
 47 G4VParameterisationPara( EAxis axis, G4int nDi     47 G4VParameterisationPara( EAxis axis, G4int nDiv, G4double width,
 48                          G4double offset, G4VS     48                          G4double offset, G4VSolid* msolid,
 49                          DivisionType divType      49                          DivisionType divType )
 50   :  G4VDivisionParameterisation( axis, nDiv,      50   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 51 {                                                  51 {
 52   auto msol = (G4Para*)(msolid);               <<  52   G4Para* msol = (G4Para*)(msolid);
 53   if (msolid->GetEntityType() == "G4ReflectedS     53   if (msolid->GetEntityType() == "G4ReflectedSolid")
 54   {                                                54   {
 55     // Get constituent solid                       55     // Get constituent solid  
 56     G4VSolid* mConstituentSolid                    56     G4VSolid* mConstituentSolid 
 57        = ((G4ReflectedSolid*)msolid)->GetConst     57        = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
 58     msol = (G4Para*)(mConstituentSolid);           58     msol = (G4Para*)(mConstituentSolid);
 59     fmotherSolid = msol;                           59     fmotherSolid = msol;
 60                                                    60 
 61     // Create a new solid with inversed parame     61     // Create a new solid with inversed parameters
 62     auto newSolid                              <<  62     G4Para* newSolid
 63       = new G4Para(msol->GetName(),                63       = new G4Para(msol->GetName(),
 64                    msol->GetXHalfLength(),         64                    msol->GetXHalfLength(), 
 65                    msol->GetYHalfLength(),         65                    msol->GetYHalfLength(),
 66                    msol->GetZHalfLength(),         66                    msol->GetZHalfLength(),
 67                    std::atan(msol->GetTanAlpha     67                    std::atan(msol->GetTanAlpha()),
 68                    pi - msol->GetSymAxis().the     68                    pi - msol->GetSymAxis().theta(),
 69                    msol->GetSymAxis().phi());      69                    msol->GetSymAxis().phi());
 70                                                    70    
 71     msol = newSolid;                               71     msol = newSolid;
 72     fmotherSolid = newSolid;                       72     fmotherSolid = newSolid;
 73     fReflectedSolid = true;                        73     fReflectedSolid = true;
 74     fDeleteSolid = true;                           74     fDeleteSolid = true;
 75   }                                                75   }    
 76 }                                                  76 }
 77                                                    77 
 78 //--------------------------------------------     78 //------------------------------------------------------------------------
 79 G4VParameterisationPara::~G4VParameterisationP <<  79 G4VParameterisationPara::~G4VParameterisationPara()
                                                   >>  80 {
                                                   >>  81 }
 80                                                    82 
 81 //--------------------------------------------     83 //------------------------------------------------------------------------
 82 G4ParameterisationParaX::                          84 G4ParameterisationParaX::
 83 G4ParameterisationParaX( EAxis axis, G4int nDi     85 G4ParameterisationParaX( EAxis axis, G4int nDiv,
 84                          G4double width, G4dou     86                          G4double width, G4double offset,
 85                          G4VSolid* msolid, Div     87                          G4VSolid* msolid, DivisionType divType )
 86   :  G4VParameterisationPara( axis, nDiv, widt     88   :  G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
 87 {                                                  89 {
 88   CheckParametersValidity();                       90   CheckParametersValidity();
 89   SetType( "DivisionParaX" );                      91   SetType( "DivisionParaX" );
 90                                                    92 
 91   auto mpara = (G4Para*)(fmotherSolid);        <<  93   G4Para* mpara = (G4Para*)(fmotherSolid);
 92   if( divType == DivWIDTH )                        94   if( divType == DivWIDTH )
 93   {                                                95   {
 94     fnDiv = CalculateNDiv( 2*mpara->GetXHalfLe     96     fnDiv = CalculateNDiv( 2*mpara->GetXHalfLength(), width, offset );
 95   }                                                97   }
 96   else if( divType == DivNDIV )                    98   else if( divType == DivNDIV )
 97   {                                                99   {
 98     fwidth = CalculateWidth( 2*mpara->GetXHalf    100     fwidth = CalculateWidth( 2*mpara->GetXHalfLength(), nDiv, offset );
 99   }                                               101   }
100                                                   102 
101 #ifdef G4DIVDEBUG                                 103 #ifdef G4DIVDEBUG
102   if( verbose >= 1 )                              104   if( verbose >= 1 )
103   {                                               105   {
104     G4cout << " G4ParameterisationParaX - # di    106     G4cout << " G4ParameterisationParaX - # divisions " << fnDiv
105            << " = " << nDiv << G4endl             107            << " = " << nDiv << G4endl
106            << " Offset " << foffset << " = " <    108            << " Offset " << foffset << " = " << offset << G4endl
107            << " Width " << fwidth << " = " <<     109            << " Width " << fwidth << " = " << width << G4endl;
108   }                                               110   }
109 #endif                                            111 #endif
110 }                                                 112 }
111                                                   113 
112 //--------------------------------------------    114 //------------------------------------------------------------------------
113 G4double G4ParameterisationParaX::GetMaxParame    115 G4double G4ParameterisationParaX::GetMaxParameter() const
114 {                                                 116 {
115   auto msol = (G4Para*)(fmotherSolid);         << 117   G4Para* msol = (G4Para*)(fmotherSolid);
116   return 2*msol->GetXHalfLength();                118   return 2*msol->GetXHalfLength();
117 }                                                 119 }
118                                                   120 
119 //--------------------------------------------    121 //------------------------------------------------------------------------
120 G4ParameterisationParaX::~G4ParameterisationPa << 122 G4ParameterisationParaX::~G4ParameterisationParaX()
                                                   >> 123 {
                                                   >> 124 }
121                                                   125 
122 //--------------------------------------------    126 //------------------------------------------------------------------------
123 void                                              127 void
124 G4ParameterisationParaX::                         128 G4ParameterisationParaX::
125 ComputeTransformation( const G4int copyNo, G4V    129 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
126 {                                                 130 {
127   auto msol = (G4Para*)(fmotherSolid );        << 131   G4Para* msol = (G4Para*)(fmotherSolid );
128   G4double mdx = msol->GetXHalfLength( );         132   G4double mdx = msol->GetXHalfLength( );
129                                                   133 
130   //----- translation                             134   //----- translation 
131   G4ThreeVector origin(0.,0.,0.);                 135   G4ThreeVector origin(0.,0.,0.); 
132   G4double posi = -mdx + foffset+(copyNo+0.5)*    136   G4double posi = -mdx + foffset+(copyNo+0.5)*fwidth;
133   origin.setX( posi );                            137   origin.setX( posi ); 
134                                                   138   
135 #ifdef G4DIVDEBUG                                 139 #ifdef G4DIVDEBUG
136   if( verbose >= 2 )                              140   if( verbose >= 2 )
137   {                                               141   {
138     G4cout << std::setprecision(8) << " G4Para    142     G4cout << std::setprecision(8) << " G4ParameterisationParaX "
139            << copyNo << G4endl                    143            << copyNo << G4endl
140            << " Position: " << origin << " - A    144            << " Position: " << origin << " - Axis: " << faxis << G4endl;
141   }                                               145   }
142 #endif                                            146 #endif
143                                                   147 
144   //----- set translation                         148   //----- set translation 
145   physVol->SetTranslation( origin );              149   physVol->SetTranslation( origin );
146 }                                                 150 }
147                                                   151 
148 //--------------------------------------------    152 //--------------------------------------------------------------------------
149 void                                              153 void
150 G4ParameterisationParaX::                         154 G4ParameterisationParaX::
151 ComputeDimensions(G4Para& para, const G4int,      155 ComputeDimensions(G4Para& para, const G4int,
152                   const G4VPhysicalVolume*) co    156                   const G4VPhysicalVolume*) const
153 {                                                 157 {
154   //---- The division along X of a Para will r    158   //---- The division along X of a Para will result a Para
155   auto msol = (G4Para*)(fmotherSolid);         << 159   G4Para* msol = (G4Para*)(fmotherSolid);
156                                                   160 
157   //---- Get                                      161   //---- Get
158   G4double pDx = fwidth/2. - fhgap;               162   G4double pDx = fwidth/2. - fhgap;
159   G4double pDy = msol->GetYHalfLength();          163   G4double pDy = msol->GetYHalfLength();
160   G4double pDz = msol->GetZHalfLength();          164   G4double pDz = msol->GetZHalfLength();
161   G4double pAlpha = std::atan(msol->GetTanAlph    165   G4double pAlpha = std::atan(msol->GetTanAlpha());
162   G4double pTheta = msol->GetSymAxis().theta()    166   G4double pTheta = msol->GetSymAxis().theta();
163   G4double pPhi = msol->GetSymAxis().phi();       167   G4double pPhi = msol->GetSymAxis().phi();
164                                                   168  
165   para.SetAllParameters ( pDx, pDy, pDz, pAlph    169   para.SetAllParameters ( pDx, pDy, pDz, pAlpha, pTheta, pPhi );
166                                                   170 
167 #ifdef G4DIVDEBUG                                 171 #ifdef G4DIVDEBUG
168   if( verbose >= 1 )                              172   if( verbose >= 1 )
169   {                                               173   {
170     G4cout << " G4ParameterisationParaX::Compu    174     G4cout << " G4ParameterisationParaX::ComputeDimensions()"
171            << " - Mother PARA " << G4endl;        175            << " - Mother PARA " << G4endl;
172     msol->DumpInfo();                             176     msol->DumpInfo();
173     G4cout << " - Parameterised PARA: " << G4e    177     G4cout << " - Parameterised PARA: " << G4endl;
174     para.DumpInfo();                              178     para.DumpInfo();
175   }                                               179   }
176 #endif                                            180 #endif
177 }                                                 181 }
178                                                   182 
179 //--------------------------------------------    183 //------------------------------------------------------------------------
180 G4ParameterisationParaY::                         184 G4ParameterisationParaY::
181 G4ParameterisationParaY( EAxis axis, G4int nDi    185 G4ParameterisationParaY( EAxis axis, G4int nDiv,
182                          G4double width, G4dou    186                          G4double width, G4double offset,
183                          G4VSolid* msolid, Div    187                          G4VSolid* msolid, DivisionType divType )
184   :  G4VParameterisationPara( axis, nDiv, widt    188   :  G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
185 {                                                 189 {
186   CheckParametersValidity();                      190   CheckParametersValidity();
187   SetType( "DivisionParaY" );                     191   SetType( "DivisionParaY" );
188                                                   192 
189   auto mpara = (G4Para*)(fmotherSolid);        << 193   G4Para* mpara = (G4Para*)(fmotherSolid);
190   if( divType == DivWIDTH )                       194   if( divType == DivWIDTH )
191   {                                               195   {
192     fnDiv = CalculateNDiv( 2*mpara->GetYHalfLe    196     fnDiv = CalculateNDiv( 2*mpara->GetYHalfLength(), width, offset );
193   }                                               197   }
194   else if( divType == DivNDIV )                   198   else if( divType == DivNDIV )
195   {                                               199   {
196     fwidth = CalculateWidth( 2*mpara->GetYHalf    200     fwidth = CalculateWidth( 2*mpara->GetYHalfLength(), nDiv, offset );
197   }                                               201   }
198                                                   202 
199 #ifdef G4DIVDEBUG                                 203 #ifdef G4DIVDEBUG
200   if( verbose >= 1 )                              204   if( verbose >= 1 )
201   {                                               205   {
202     G4cout << " G4ParameterisationParaY - # di    206     G4cout << " G4ParameterisationParaY - # divisions " << fnDiv
203            << " = " << nDiv << G4endl             207            << " = " << nDiv << G4endl
204            << " Offset " << foffset << " = " <    208            << " Offset " << foffset << " = " << offset << G4endl
205            << " Width " << fwidth << " = " <<     209            << " Width " << fwidth << " = " << width << G4endl;
206   }                                               210   }
207 #endif                                            211 #endif
208 }                                                 212 }
209                                                   213 
210 //--------------------------------------------    214 //------------------------------------------------------------------------
211 G4ParameterisationParaY::~G4ParameterisationPa << 215 G4ParameterisationParaY::~G4ParameterisationParaY()
                                                   >> 216 {
                                                   >> 217 }
212                                                   218 
213 //--------------------------------------------    219 //------------------------------------------------------------------------
214 G4double G4ParameterisationParaY::GetMaxParame    220 G4double G4ParameterisationParaY::GetMaxParameter() const
215 {                                                 221 {
216   auto msol = (G4Para*)(fmotherSolid);         << 222   G4Para* msol = (G4Para*)(fmotherSolid);
217   return 2*msol->GetYHalfLength();                223   return 2*msol->GetYHalfLength();
218 }                                                 224 }
219                                                   225 
220 //--------------------------------------------    226 //------------------------------------------------------------------------
221 void                                              227 void
222 G4ParameterisationParaY::                         228 G4ParameterisationParaY::
223 ComputeTransformation( const G4int copyNo, G4V    229 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
224 {                                                 230 {
225   auto msol = (G4Para*)(fmotherSolid );        << 231   G4Para* msol = (G4Para*)(fmotherSolid );
226   G4double mdy = msol->GetYHalfLength( );         232   G4double mdy = msol->GetYHalfLength( );
227                                                   233 
228   //----- translation                             234   //----- translation 
229   G4ThreeVector origin(0.,0.,0.);                 235   G4ThreeVector origin(0.,0.,0.); 
230   G4double posiY = -mdy + foffset+(copyNo+0.5)    236   G4double posiY = -mdy + foffset+(copyNo+0.5)*fwidth;
231   origin.setY( posiY );                           237   origin.setY( posiY );
232   G4double posiX = posiY * msol->GetTanAlpha()    238   G4double posiX = posiY * msol->GetTanAlpha();
233   origin.setX( posiX );                           239   origin.setX( posiX );
234                                                   240 
235 #ifdef G4DIVDEBUG                                 241 #ifdef G4DIVDEBUG
236   if( verbose >= 2 )                              242   if( verbose >= 2 )
237   {                                               243   {
238     G4cout << std::setprecision(8) << " G4Para    244     G4cout << std::setprecision(8) << " G4ParameterisationParaY "
239            << copyNo << G4endl                    245            << copyNo << G4endl
240            << " Position: " << origin << " - A    246            << " Position: " << origin << " - Axis: " << faxis << G4endl;
241   }                                               247   }
242 #endif                                            248 #endif
243                                                   249 
244   //----- set translation                         250   //----- set translation 
245   physVol->SetTranslation( origin );              251   physVol->SetTranslation( origin );
246 }                                                 252 }
247                                                   253 
248 //--------------------------------------------    254 //--------------------------------------------------------------------------
249 void                                              255 void
250 G4ParameterisationParaY::                         256 G4ParameterisationParaY::
251 ComputeDimensions(G4Para& para, const G4int,      257 ComputeDimensions(G4Para& para, const G4int,
252                   const G4VPhysicalVolume*) co    258                   const G4VPhysicalVolume*) const
253 {                                                 259 {
254   //---- The division along Y of a Para will r    260   //---- The division along Y of a Para will result a Para
255   auto msol = (G4Para*)(fmotherSolid);         << 261   G4Para* msol = (G4Para*)(fmotherSolid);
256                                                   262 
257   //---- Get                                      263   //---- Get
258   G4double pDx = msol->GetXHalfLength();          264   G4double pDx = msol->GetXHalfLength();
259   G4double pDy = fwidth/2. - fhgap;               265   G4double pDy = fwidth/2. - fhgap;
260   G4double pDz = msol->GetZHalfLength();          266   G4double pDz = msol->GetZHalfLength();
261   G4double pAlpha = std::atan(msol->GetTanAlph    267   G4double pAlpha = std::atan(msol->GetTanAlpha());
262   G4double pTheta = msol->GetSymAxis().theta()    268   G4double pTheta = msol->GetSymAxis().theta();
263   G4double pPhi = msol->GetSymAxis().phi();       269   G4double pPhi = msol->GetSymAxis().phi();
264                                                   270  
265   para.SetAllParameters ( pDx, pDy, pDz, pAlph    271   para.SetAllParameters ( pDx, pDy, pDz, pAlpha, pTheta, pPhi );
266                                                   272 
267 #ifdef G4DIVDEBUG                                 273 #ifdef G4DIVDEBUG
268   if( verbose >= -1 )                             274   if( verbose >= -1 )
269   {                                               275   {
270     G4cout << " G4ParameterisationParaY::Compu    276     G4cout << " G4ParameterisationParaY::ComputeDimensions()"
271            << " - Mother PARA " << G4endl;        277            << " - Mother PARA " << G4endl;
272     msol->DumpInfo();                             278     msol->DumpInfo();
273     G4cout << " - Parameterised PARA: " << G4e    279     G4cout << " - Parameterised PARA: " << G4endl;
274     para.DumpInfo();                              280     para.DumpInfo();
275   }                                               281   }
276 #endif                                            282 #endif
277 }                                                 283 }
278                                                   284 
279 //--------------------------------------------    285 //------------------------------------------------------------------------
280 G4ParameterisationParaZ::                         286 G4ParameterisationParaZ::
281 G4ParameterisationParaZ( EAxis axis, G4int nDi    287 G4ParameterisationParaZ( EAxis axis, G4int nDiv,
282                          G4double width, G4dou    288                          G4double width, G4double offset,
283                          G4VSolid* msolid, Div    289                          G4VSolid* msolid, DivisionType divType )
284   :  G4VParameterisationPara( axis, nDiv, widt    290   :  G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
285 {                                                 291 {
286   CheckParametersValidity();                      292   CheckParametersValidity();
287   SetType( "DivisionParaZ" );                     293   SetType( "DivisionParaZ" );
288                                                   294 
289   auto mpara = (G4Para*)(fmotherSolid);        << 295   G4Para* mpara = (G4Para*)(fmotherSolid);
290   if( divType == DivWIDTH )                       296   if( divType == DivWIDTH )
291   {                                               297   {
292     fnDiv = CalculateNDiv( 2*mpara->GetZHalfLe    298     fnDiv = CalculateNDiv( 2*mpara->GetZHalfLength(), width, offset );
293   }                                               299   }
294   else if( divType == DivNDIV )                   300   else if( divType == DivNDIV )
295   {                                               301   {
296     fwidth = CalculateWidth( 2*mpara->GetZHalf    302     fwidth = CalculateWidth( 2*mpara->GetZHalfLength(), nDiv, offset );
297   }                                               303   }
298                                                   304 
299 #ifdef G4DIVDEBUG                                 305 #ifdef G4DIVDEBUG
300   if( verbose >= -1 )                             306   if( verbose >= -1 )
301   {                                               307   {
302     G4cout << " G4ParameterisationParaZ - # di    308     G4cout << " G4ParameterisationParaZ - # divisions " << fnDiv
303            << " = " << nDiv << G4endl             309            << " = " << nDiv << G4endl
304            << " Offset " << foffset << " = " <    310            << " Offset " << foffset << " = " << offset << G4endl
305            << " Width " << fwidth << " = " <<     311            << " Width " << fwidth << " = " << width << G4endl;
306   }                                               312   }
307 #endif                                            313 #endif
308 }                                                 314 }
309                                                   315 
310 //--------------------------------------------    316 //------------------------------------------------------------------------
311 G4ParameterisationParaZ::~G4ParameterisationPa << 317 G4ParameterisationParaZ::~G4ParameterisationParaZ()
                                                   >> 318 {
                                                   >> 319 }
312                                                   320 
313 //--------------------------------------------    321 //------------------------------------------------------------------------
314 G4double G4ParameterisationParaZ::GetMaxParame    322 G4double G4ParameterisationParaZ::GetMaxParameter() const
315 {                                                 323 {
316   auto msol = (G4Para*)(fmotherSolid);         << 324   G4Para* msol = (G4Para*)(fmotherSolid);
317   return 2*msol->GetZHalfLength();                325   return 2*msol->GetZHalfLength();
318 }                                                 326 }
319                                                   327 
320 //--------------------------------------------    328 //------------------------------------------------------------------------
321 void                                              329 void
322 G4ParameterisationParaZ::                         330 G4ParameterisationParaZ::
323 ComputeTransformation( const G4int copyNo, G4V    331 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
324 {                                                 332 {
325   auto msol = (G4Para*)(fmotherSolid );        << 333   G4Para* msol = (G4Para*)(fmotherSolid );
326   G4double mdz = msol->GetZHalfLength( );         334   G4double mdz = msol->GetZHalfLength( );
327                                                   335 
328   //----- translation                             336   //----- translation 
329   G4double posi = -mdz + OffsetZ() + (copyNo+0    337   G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
330   G4ThreeVector symAxis = msol->GetSymAxis();     338   G4ThreeVector symAxis = msol->GetSymAxis();
331   G4ThreeVector origin( symAxis * posi / symAx    339   G4ThreeVector origin( symAxis * posi / symAxis.z() ); 
332                                                   340   
333 #ifdef G4DIVDEBUG                                 341 #ifdef G4DIVDEBUG
334   if( verbose >= 2 )                              342   if( verbose >= 2 )
335   {                                               343   {
336     G4cout << std::setprecision(8) << " G4Para    344     G4cout << std::setprecision(8) << " G4ParameterisationParaZ "
337            << copyNo << G4endl                    345            << copyNo << G4endl
338            << " Position: " << origin << " - A    346            << " Position: " << origin << " - Axis: " << faxis << G4endl;
339   }                                               347   }
340 #endif                                            348 #endif
341                                                   349 
342   //----- set translation                         350   //----- set translation 
343   physVol->SetTranslation( origin );              351   physVol->SetTranslation( origin );
344 }                                                 352 }
345                                                   353 
346 //--------------------------------------------    354 //--------------------------------------------------------------------------
347 void                                              355 void
348 G4ParameterisationParaZ::                         356 G4ParameterisationParaZ::
349 ComputeDimensions(G4Para& para, const G4int,      357 ComputeDimensions(G4Para& para, const G4int,
350                   const G4VPhysicalVolume*) co    358                   const G4VPhysicalVolume*) const
351 {                                                 359 {
352   //---- The division along Z of a Para will r    360   //---- The division along Z of a Para will result a Para
353   auto msol = (G4Para*)(fmotherSolid);         << 361   G4Para* msol = (G4Para*)(fmotherSolid);
354                                                   362 
355   //---- Get                                      363   //---- Get
356   G4double pDx = msol->GetXHalfLength();          364   G4double pDx = msol->GetXHalfLength();
357   G4double pDy = msol->GetYHalfLength();          365   G4double pDy = msol->GetYHalfLength();
358   G4double pDz = fwidth/2. - fhgap;               366   G4double pDz = fwidth/2. - fhgap;
359   G4double pAlpha = std::atan(msol->GetTanAlph    367   G4double pAlpha = std::atan(msol->GetTanAlpha());
360   G4double pTheta = msol->GetSymAxis().theta()    368   G4double pTheta = msol->GetSymAxis().theta();
361   G4double pPhi = msol->GetSymAxis().phi();       369   G4double pPhi = msol->GetSymAxis().phi();
362                                                   370  
363   para.SetAllParameters ( pDx, pDy, pDz, pAlph    371   para.SetAllParameters ( pDx, pDy, pDz, pAlpha, pTheta, pPhi );
364                                                   372 
365 #ifdef G4DIVDEBUG                                 373 #ifdef G4DIVDEBUG
366   if( verbose >= -1 )                             374   if( verbose >= -1 )
367   {                                               375   {
368     G4cout << " G4ParameterisationParaZ::Compu    376     G4cout << " G4ParameterisationParaZ::ComputeDimensions()"
369            << " - Mother PARA " << G4endl;        377            << " - Mother PARA " << G4endl;
370     msol->DumpInfo();                             378     msol->DumpInfo();
371     G4cout << " - Parameterised PARA: " << G4e    379     G4cout << " - Parameterised PARA: " << G4endl;
372     para.DumpInfo();                              380     para.DumpInfo();
373   }                                               381   }
374 #endif                                            382 #endif
375 }                                                 383 }
376                                                   384