Geant4 Cross Reference

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


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 // G4ParameterisationTubs[Rho/Phi/Z] implement << 
 27 //                                                 23 //
 28 // 26.05.03 - P.Arce, Initial version          <<  24 // $Id: G4ParameterisationTubs.cc,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
 29 // 08.04.04 - I.Hrivnacova, Implemented reflec <<  25 // GEANT4 tag $Name: geant4-06-00 $
 30 // 21.04.10 - M.Asai, Added gaps               <<  26 //
 31 // ------------------------------------------- <<  27 // class G4ParameterisationTubs Implementation file
                                                   >>  28 //
                                                   >>  29 // 26.05.03 - P.Arce Initial version
                                                   >>  30 // ********************************************************************
 32                                                    31 
 33 #include "G4ParameterisationTubs.hh"               32 #include "G4ParameterisationTubs.hh"
 34                                                    33 
 35 #include <iomanip>                                 34 #include <iomanip>
 36 #include "G4ThreeVector.hh"                        35 #include "G4ThreeVector.hh"
 37 #include "G4RotationMatrix.hh"                     36 #include "G4RotationMatrix.hh"
 38 #include "G4VPhysicalVolume.hh"                    37 #include "G4VPhysicalVolume.hh"
 39 #include "G4LogicalVolume.hh"                      38 #include "G4LogicalVolume.hh"
 40 #include "G4ReflectedSolid.hh"                 << 
 41 #include "G4Tubs.hh"                               39 #include "G4Tubs.hh"
 42                                                    40 
 43 //--------------------------------------------     41 //--------------------------------------------------------------------------
 44 G4VParameterisationTubs::                      << 
 45 G4VParameterisationTubs( EAxis axis, G4int nDi << 
 46                          G4double offset, G4VS << 
 47                          DivisionType divType  << 
 48   : G4VDivisionParameterisation( axis, nDiv, w << 
 49 {                                              << 
 50   auto msol = (G4Tubs*)(msolid);               << 
 51   if (msolid->GetEntityType() == "G4ReflectedS << 
 52   {                                            << 
 53     //----- get constituent solid              << 
 54     G4VSolid* mConstituentSolid                << 
 55        = ((G4ReflectedSolid*)msolid)->GetConst << 
 56     msol = (G4Tubs*)(mConstituentSolid);       << 
 57     fmotherSolid = msol;                       << 
 58     fReflectedSolid = true;                    << 
 59   }                                            << 
 60 }                                              << 
 61                                                << 
 62 //-------------------------------------------- << 
 63 G4VParameterisationTubs::~G4VParameterisationT << 
 64                                                << 
 65 //-------------------------------------------- << 
 66 G4ParameterisationTubsRho::                        42 G4ParameterisationTubsRho::
 67 G4ParameterisationTubsRho( EAxis axis, G4int n     43 G4ParameterisationTubsRho( EAxis axis, G4int nDiv,
 68                            G4double width, G4d     44                            G4double width, G4double offset,
 69                            G4VSolid* msolid, D     45                            G4VSolid* msolid, DivisionType divType )
 70   : G4VParameterisationTubs( axis, nDiv, width <<  46   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 71 {                                                  47 {
 72   CheckParametersValidity();                       48   CheckParametersValidity();
 73   SetType( "DivisionTubsRho" );                    49   SetType( "DivisionTubsRho" );
 74                                                    50 
 75   auto msol = (G4Tubs*)(fmotherSolid);         << 
 76   if( divType == DivWIDTH )                        51   if( divType == DivWIDTH )
 77   {                                                52   {
                                                   >>  53     G4Tubs* msol = (G4Tubs*)(msolid);
 78     fnDiv = CalculateNDiv( msol->GetOuterRadiu     54     fnDiv = CalculateNDiv( msol->GetOuterRadius() - msol->GetInnerRadius(),
 79                            width, offset );        55                            width, offset );
 80   }                                                56   }
 81   else if( divType == DivNDIV )                    57   else if( divType == DivNDIV )
 82   {                                                58   {
                                                   >>  59     G4Tubs* msol = (G4Tubs*)(msolid);
 83     fwidth = CalculateWidth( msol->GetOuterRad     60     fwidth = CalculateWidth( msol->GetOuterRadius() - msol->GetInnerRadius(),
 84                              nDiv, offset );       61                              nDiv, offset );
 85   }                                                62   }
 86                                                    63 
 87 #ifdef G4DIVDEBUG                                  64 #ifdef G4DIVDEBUG
 88   if( verbose >= 1 )                               65   if( verbose >= 1 )
 89   {                                                66   {
 90     G4cout << " G4ParameterisationTubsRho - no     67     G4cout << " G4ParameterisationTubsRho - no divisions " << fnDiv << " = "
 91            << nDiv << G4endl                       68            << nDiv << G4endl
 92            << " Offset " << foffset << " = " <     69            << " Offset " << foffset << " = " << offset << G4endl
 93            << " Width " << fwidth << " = " <<      70            << " Width " << fwidth << " = " << width << G4endl
 94            << " DivType " << divType << G4endl     71            << " DivType " << divType << G4endl;
 95   }                                                72   }
 96 #endif                                             73 #endif
 97 }                                                  74 }
 98                                                    75 
 99 //--------------------------------------------     76 //--------------------------------------------------------------------------
100 G4ParameterisationTubsRho::~G4Parameterisation <<  77 G4ParameterisationTubsRho::~G4ParameterisationTubsRho()
                                                   >>  78 {
                                                   >>  79 }
101                                                    80 
102 //--------------------------------------------     81 //------------------------------------------------------------------------
103 G4double G4ParameterisationTubsRho::GetMaxPara     82 G4double G4ParameterisationTubsRho::GetMaxParameter() const
104 {                                                  83 {
105   auto msol = (G4Tubs*)(fmotherSolid);         <<  84   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
106   return msol->GetOuterRadius() - msol->GetInn     85   return msol->GetOuterRadius() - msol->GetInnerRadius();
107 }                                                  86 }
108                                                    87 
109                                                    88 
110 //--------------------------------------------     89 //--------------------------------------------------------------------------
111 void                                               90 void
112 G4ParameterisationTubsRho::                        91 G4ParameterisationTubsRho::
113 ComputeTransformation(const G4int, G4VPhysical     92 ComputeTransformation(const G4int, G4VPhysicalVolume* physVol) const
114 {                                                  93 {
115   //----- translation                              94   //----- translation 
116   G4ThreeVector origin(0.,0.,0.);                  95   G4ThreeVector origin(0.,0.,0.); 
117   //----- set translation                          96   //----- set translation 
118   physVol->SetTranslation( origin );               97   physVol->SetTranslation( origin );
119                                                    98 
120   //----- calculate rotation matrix: unit          99   //----- calculate rotation matrix: unit
121                                                   100 
122 #ifdef G4DIVDEBUG                                 101 #ifdef G4DIVDEBUG
123   if( verbose >= 2 )                              102   if( verbose >= 2 )
124   {                                               103   {
125     G4cout << " G4ParameterisationTubsRho " <<    104     G4cout << " G4ParameterisationTubsRho " << G4endl
126            << " Offset: " << foffset/CLHEP::de << 105            << " Offset: " << foffset/deg
127            << " - Width: " << fwidth/CLHEP::de << 106            << " - Width: " << fwidth/deg << G4endl;
128   }                                               107   }
129 #endif                                            108 #endif
130                                                   109 
131   ChangeRotMatrix( physVol );                     110   ChangeRotMatrix( physVol );
132                                                   111 
133 #ifdef G4DIVDEBUG                                 112 #ifdef G4DIVDEBUG
134   if( verbose >= 2 )                              113   if( verbose >= 2 )
135   {                                               114   {
136     G4cout << std::setprecision(8) << " G4Para    115     G4cout << std::setprecision(8) << " G4ParameterisationTubsRho " << G4endl
137            << " Position: " << origin << " - W    116            << " Position: " << origin << " - Width: " << fwidth
138            << " - Axis " << faxis  << G4endl;     117            << " - Axis " << faxis  << G4endl;
139   }                                               118   }
140 #endif                                            119 #endif
141 }                                                 120 }
142                                                   121 
143 //--------------------------------------------    122 //--------------------------------------------------------------------------
144 void                                              123 void
145 G4ParameterisationTubsRho::                       124 G4ParameterisationTubsRho::
146 ComputeDimensions( G4Tubs& tubs, const G4int c    125 ComputeDimensions( G4Tubs& tubs, const G4int copyNo,
147                    const G4VPhysicalVolume* )     126                    const G4VPhysicalVolume* ) const
148 {                                                 127 {
149   auto msol = (G4Tubs*)(fmotherSolid);         << 128   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
150                                                   129 
151   G4double pRMin = msol->GetInnerRadius() + fo << 130   G4double pRMin = msol->GetInnerRadius() + foffset + fwidth * copyNo;
152   G4double pRMax = msol->GetInnerRadius() + fo << 131   G4double pRMax = msol->GetInnerRadius() + foffset + fwidth * (copyNo+1);
153   G4double pDz = msol->GetZHalfLength();          132   G4double pDz = msol->GetZHalfLength();
154   //- already rotated  G4double pSR = foffset     133   //- already rotated  G4double pSR = foffset + copyNo*fwidth;
155   G4double pSPhi = msol->GetStartPhiAngle();      134   G4double pSPhi = msol->GetStartPhiAngle();
156   G4double pDPhi = msol->GetDeltaPhiAngle();;     135   G4double pDPhi = msol->GetDeltaPhiAngle();;
157                                                   136 
158   tubs.SetInnerRadius( pRMin );                   137   tubs.SetInnerRadius( pRMin );
159   tubs.SetOuterRadius( pRMax );                   138   tubs.SetOuterRadius( pRMax );
160   tubs.SetZHalfLength( pDz );                     139   tubs.SetZHalfLength( pDz );
161   tubs.SetStartPhiAngle( pSPhi, false );       << 140   tubs.SetStartPhiAngle( pSPhi );
162   tubs.SetDeltaPhiAngle( pDPhi );                 141   tubs.SetDeltaPhiAngle( pDPhi );
163                                                   142 
164 #ifdef G4DIVDEBUG                                 143 #ifdef G4DIVDEBUG
165   if( verbose >= 2 )                              144   if( verbose >= 2 )
166   {                                               145   {
167     G4cout << " G4ParameterisationTubsRho::Com    146     G4cout << " G4ParameterisationTubsRho::ComputeDimensions()" << G4endl
168            << " pRMin: " << pRMin << " - pRMax    147            << " pRMin: " << pRMin << " - pRMax: " << pRMax << G4endl;
169     tubs.DumpInfo();                              148     tubs.DumpInfo();
170   }                                               149   }
171 #endif                                            150 #endif
172 }                                                 151 }
173                                                   152 
174 //--------------------------------------------    153 //--------------------------------------------------------------------------
175 G4ParameterisationTubsPhi::                       154 G4ParameterisationTubsPhi::
176 G4ParameterisationTubsPhi( EAxis axis, G4int n    155 G4ParameterisationTubsPhi( EAxis axis, G4int nDiv,
177                            G4double width, G4d    156                            G4double width, G4double offset,
178                            G4VSolid* msolid, D    157                            G4VSolid* msolid, DivisionType divType )
179   : G4VParameterisationTubs( axis, nDiv, width << 158   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
180 {                                                 159 { 
181   CheckParametersValidity();                      160   CheckParametersValidity();
182   SetType( "DivisionTubsPhi" );                   161   SetType( "DivisionTubsPhi" );
183                                                   162 
184   auto msol = (G4Tubs*)(fmotherSolid);         << 
185   if( divType == DivWIDTH )                       163   if( divType == DivWIDTH )
186   {                                               164   {
                                                   >> 165     G4Tubs* msol = (G4Tubs*)(msolid);
187     fnDiv = CalculateNDiv( msol->GetDeltaPhiAn    166     fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
188   }                                               167   }
189   else if( divType == DivNDIV )                   168   else if( divType == DivNDIV )
190   {                                               169   {
                                                   >> 170     G4Tubs* msol = (G4Tubs*)(msolid);
191     fwidth = CalculateWidth( msol->GetDeltaPhi    171     fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
192   }                                               172   }
193                                                   173 
194 #ifdef G4DIVDEBUG                                 174 #ifdef G4DIVDEBUG
195   if( verbose >= 1 )                              175   if( verbose >= 1 )
196   {                                               176   {
197     G4cout << " G4ParameterisationTubsPhi no d    177     G4cout << " G4ParameterisationTubsPhi no divisions " << fnDiv << " = "
198            << nDiv << G4endl                      178            << nDiv << G4endl
199            << " Offset " << foffset << " = " <    179            << " Offset " << foffset << " = " << offset << G4endl
200            << " Width " << fwidth << " = " <<     180            << " Width " << fwidth << " = " << width << G4endl;
201   }                                               181   }
202 #endif                                            182 #endif
203 }                                                 183 }
204                                                   184 
205 //--------------------------------------------    185 //--------------------------------------------------------------------------
206 G4ParameterisationTubsPhi::~G4Parameterisation << 186 G4ParameterisationTubsPhi::~G4ParameterisationTubsPhi()
                                                   >> 187 {
                                                   >> 188 }
207                                                   189 
208 //--------------------------------------------    190 //------------------------------------------------------------------------
209 G4double G4ParameterisationTubsPhi::GetMaxPara    191 G4double G4ParameterisationTubsPhi::GetMaxParameter() const
210 {                                                 192 {
211   auto msol = (G4Tubs*)(fmotherSolid);         << 193   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
212   return msol->GetDeltaPhiAngle();                194   return msol->GetDeltaPhiAngle();
213 }                                                 195 }
214                                                   196 
215 //--------------------------------------------    197 //--------------------------------------------------------------------------
216 void                                              198 void
217 G4ParameterisationTubsPhi::                       199 G4ParameterisationTubsPhi::
218 ComputeTransformation(const G4int copyNo, G4VP    200 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
219 {                                                 201 {
220   //----- translation                             202   //----- translation 
221   G4ThreeVector origin(0.,0.,0.);                 203   G4ThreeVector origin(0.,0.,0.); 
222   //----- set translation                         204   //----- set translation 
223   physVol->SetTranslation( origin );              205   physVol->SetTranslation( origin );
224                                                   206 
225   //----- calculate rotation matrix (so that a    207   //----- calculate rotation matrix (so that all volumes point to the centre)
226   G4double posi = foffset  + copyNo*fwidth;       208   G4double posi = foffset  + copyNo*fwidth;
227                                                   209 
228 #ifdef G4DIVDEBUG                                 210 #ifdef G4DIVDEBUG
229   if( verbose >= 2 )                              211   if( verbose >= 2 )
230   {                                               212   {
231     G4cout << " G4ParameterisationTubsPhi - po << 213     G4cout << " G4ParameterisationTubsPhi - position: " << posi/deg << G4endl
232            << " copyNo: " << copyNo << " - fof << 214            << " copyNo: " << copyNo << " - foffset: " << foffset/deg
233            << " - fwidth: " << fwidth/CLHEP::d << 215            << " - fwidth: " << fwidth/deg << G4endl;
234   }                                               216   }
235 #endif                                            217 #endif
236                                                   218 
237   ChangeRotMatrix( physVol, -posi );              219   ChangeRotMatrix( physVol, -posi );
238                                                   220 
239 #ifdef G4DIVDEBUG                                 221 #ifdef G4DIVDEBUG
240   if( verbose >= 2 )                              222   if( verbose >= 2 )
241   {                                               223   {
242     G4cout << std::setprecision(8) << " G4Para    224     G4cout << std::setprecision(8) << " G4ParameterisationTubsPhi " << copyNo
243            << G4endl                              225            << G4endl
244            << " Position: " << origin << " - W    226            << " Position: " << origin << " - Width: " << fwidth
245            << " - Axis: " << faxis  << G4endl;    227            << " - Axis: " << faxis  << G4endl;
246   }                                               228   }
247 #endif                                            229 #endif
248 }                                                 230 }
249                                                   231 
250 //--------------------------------------------    232 //--------------------------------------------------------------------------
251 void                                              233 void
252 G4ParameterisationTubsPhi::                       234 G4ParameterisationTubsPhi::
253 ComputeDimensions( G4Tubs& tubs, const G4int,     235 ComputeDimensions( G4Tubs& tubs, const G4int,
254                    const G4VPhysicalVolume* )     236                    const G4VPhysicalVolume* ) const
255 {                                                 237 {
256   auto msol = (G4Tubs*)(fmotherSolid);         << 238   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
257                                                   239 
258   G4double pRMin = msol->GetInnerRadius();        240   G4double pRMin = msol->GetInnerRadius();
259   G4double pRMax = msol->GetOuterRadius();        241   G4double pRMax = msol->GetOuterRadius();
260   G4double pDz = msol->GetZHalfLength();          242   G4double pDz = msol->GetZHalfLength();
261   //----- already rotated in 'ComputeTransform    243   //----- already rotated in 'ComputeTransformation'
262   G4double pSPhi = msol->GetStartPhiAngle() +  << 244   G4double pSPhi = msol->GetStartPhiAngle();
263   G4double pDPhi = fwidth - 2.*fhgap;          << 245   G4double pDPhi = fwidth;
264                                                   246 
265   tubs.SetInnerRadius( pRMin );                   247   tubs.SetInnerRadius( pRMin );
266   tubs.SetOuterRadius( pRMax );                   248   tubs.SetOuterRadius( pRMax );
267   tubs.SetZHalfLength( pDz );                     249   tubs.SetZHalfLength( pDz );
268   tubs.SetStartPhiAngle( pSPhi, false );       << 250   tubs.SetStartPhiAngle( pSPhi );
269   tubs.SetDeltaPhiAngle( pDPhi );                 251   tubs.SetDeltaPhiAngle( pDPhi );
270                                                   252 
271 #ifdef G4DIVDEBUG                                 253 #ifdef G4DIVDEBUG
272   if( verbose >= 2 )                              254   if( verbose >= 2 )
273   {                                               255   {
274     G4cout << " G4ParameterisationTubsPhi::Com    256     G4cout << " G4ParameterisationTubsPhi::ComputeDimensions" << G4endl
275            << " pSPhi: " << pSPhi << " - pDPhi    257            << " pSPhi: " << pSPhi << " - pDPhi: " << pDPhi << G4endl;
276     tubs.DumpInfo();                              258     tubs.DumpInfo();
277   }                                               259   }
278 #endif                                            260 #endif
279 }                                                 261 }
280                                                   262 
281 //--------------------------------------------    263 //--------------------------------------------------------------------------
282 G4ParameterisationTubsZ::                         264 G4ParameterisationTubsZ::
283 G4ParameterisationTubsZ( EAxis axis, G4int nDi    265 G4ParameterisationTubsZ( EAxis axis, G4int nDiv,
284                          G4double width, G4dou    266                          G4double width, G4double offset,
285                          G4VSolid* msolid, Div    267                          G4VSolid* msolid, DivisionType divType )
286   : G4VParameterisationTubs( axis, nDiv, width << 268   : G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
287 {                                                 269 { 
288   CheckParametersValidity();                      270   CheckParametersValidity();
289   SetType( "DivisionTubsZ" );                     271   SetType( "DivisionTubsZ" );
290                                                << 
291   auto msol = (G4Tubs*)(fmotherSolid);         << 
292   if( divType == DivWIDTH )                       272   if( divType == DivWIDTH )
293   {                                               273   {
                                                   >> 274     G4Tubs* msol = (G4Tubs*)(msolid);
294     fnDiv = CalculateNDiv( 2*msol->GetZHalfLen    275     fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
295   }                                               276   }
296   else if( divType == DivNDIV )                   277   else if( divType == DivNDIV )
297   {                                               278   {
                                                   >> 279     G4Tubs* msol = (G4Tubs*)(msolid);
298     fwidth = CalculateWidth( 2*msol->GetZHalfL    280     fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
299   }                                               281   }
300                                                   282 
301 #ifdef G4DIVDEBUG                                 283 #ifdef G4DIVDEBUG
302   if( verbose >= 1 )                              284   if( verbose >= 1 )
303   {                                               285   {
304     G4cout << " G4ParameterisationTubsZ: # div    286     G4cout << " G4ParameterisationTubsZ: # divisions " << fnDiv << " = "
305            << nDiv << G4endl                      287            << nDiv << G4endl
306            << " Offset " << foffset << " = " <    288            << " Offset " << foffset << " = " << offset << G4endl
307            << " Width " << fwidth << " = " <<     289            << " Width " << fwidth << " = " << width << G4endl;
308   }                                               290   }
309 #endif                                            291 #endif
310 }                                                 292 }
311                                                   293 
312 //--------------------------------------------    294 //--------------------------------------------------------------------------
313 G4ParameterisationTubsZ::~G4ParameterisationTu << 295 G4ParameterisationTubsZ::~G4ParameterisationTubsZ()
                                                   >> 296 {
                                                   >> 297 }
314                                                   298 
315 //--------------------------------------------    299 //------------------------------------------------------------------------
316 G4double G4ParameterisationTubsZ::GetMaxParame    300 G4double G4ParameterisationTubsZ::GetMaxParameter() const
317 {                                                 301 {
318   auto msol = (G4Tubs*)(fmotherSolid);         << 302   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
319   return 2*msol->GetZHalfLength();                303   return 2*msol->GetZHalfLength();
320 }                                                 304 }
321                                                   305 
322 //--------------------------------------------    306 //--------------------------------------------------------------------------
323 void                                              307 void
324 G4ParameterisationTubsZ::                         308 G4ParameterisationTubsZ::
325 ComputeTransformation(const G4int copyNo, G4VP    309 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
326 {                                                 310 {
327   //----- set translation: along Z axis           311   //----- set translation: along Z axis
328   auto motherTubs = (G4Tubs*)(fmotherSolid);   << 312   G4Tubs* motherTubs = (G4Tubs*)(fmotherSolid);
329   G4double posi = - motherTubs->GetZHalfLength << 313   G4double posi = - motherTubs->GetZHalfLength() + foffset
330                   + fwidth/2 + copyNo*fwidth;     314                   + fwidth/2 + copyNo*fwidth;
331   G4ThreeVector origin(0.,0.,posi);               315   G4ThreeVector origin(0.,0.,posi); 
332   physVol->SetTranslation( origin );              316   physVol->SetTranslation( origin );
333                                                   317 
334   //----- calculate rotation matrix: unit         318   //----- calculate rotation matrix: unit
335                                                   319 
336 #ifdef G4DIVDEBUG                                 320 #ifdef G4DIVDEBUG
337   if( verbose >= 2 )                              321   if( verbose >= 2 )
338   {                                               322   {
339     G4cout << " G4ParameterisationTubsZ::Compu    323     G4cout << " G4ParameterisationTubsZ::ComputeTransformation()" << G4endl
340            << " Position: " << posi << " - cop    324            << " Position: " << posi << " - copyNo: " << copyNo << G4endl
341            << " foffset " << foffset/CLHEP::de << 325            << " foffset " << foffset/deg << " - fwidth " << fwidth/deg
342            << G4endl;                             326            << G4endl;
343   }                                               327   }
344 #endif                                            328 #endif
345                                                   329 
346   ChangeRotMatrix( physVol );                     330   ChangeRotMatrix( physVol );
347                                                   331 
348 #ifdef G4DIVDEBUG                                 332 #ifdef G4DIVDEBUG
349   if( verbose >= 2 )                              333   if( verbose >= 2 )
350   {                                               334   {
351     G4cout << std::setprecision(8) << " G4Para    335     G4cout << std::setprecision(8) << " G4ParameterisationTubsZ " << copyNo
352            << G4endl                              336            << G4endl
353            << " Position: " << origin << " - W    337            << " Position: " << origin << " - Width: " << fwidth
354            << " - Axis: " << faxis  << G4endl;    338            << " - Axis: " << faxis  << G4endl; 
355   }                                               339   }
356 #endif                                            340 #endif
357 }                                                 341 }
358                                                   342 
359 //--------------------------------------------    343 //--------------------------------------------------------------------------
360 void                                              344 void
361 G4ParameterisationTubsZ::                         345 G4ParameterisationTubsZ::
362 ComputeDimensions( G4Tubs& tubs, const G4int,     346 ComputeDimensions( G4Tubs& tubs, const G4int,
363                    const G4VPhysicalVolume* )     347                    const G4VPhysicalVolume* ) const
364 {                                                 348 {
365   auto msol = (G4Tubs*)(fmotherSolid);         << 349   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
366                                                   350 
367   G4double pRMin = msol->GetInnerRadius();        351   G4double pRMin = msol->GetInnerRadius();
368   G4double pRMax = msol->GetOuterRadius();        352   G4double pRMax = msol->GetOuterRadius();
369   //  G4double pDz = msol->GetZHalfLength() /     353   //  G4double pDz = msol->GetZHalfLength() / GetNoDiv();
370   G4double pDz = fwidth/2. - fhgap;            << 354   G4double pDz = fwidth/2.;
371   G4double pSPhi = msol->GetStartPhiAngle();      355   G4double pSPhi = msol->GetStartPhiAngle();
372   G4double pDPhi = msol->GetDeltaPhiAngle();      356   G4double pDPhi = msol->GetDeltaPhiAngle();
373                                                   357 
374   tubs.SetInnerRadius( pRMin );                   358   tubs.SetInnerRadius( pRMin );
375   tubs.SetOuterRadius( pRMax );                   359   tubs.SetOuterRadius( pRMax );
376   tubs.SetZHalfLength( pDz );                     360   tubs.SetZHalfLength( pDz );
377   tubs.SetStartPhiAngle( pSPhi, false );       << 361   tubs.SetStartPhiAngle( pSPhi );
378   tubs.SetDeltaPhiAngle( pDPhi );                 362   tubs.SetDeltaPhiAngle( pDPhi );
379                                                   363 
380 #ifdef G4DIVDEBUG                                 364 #ifdef G4DIVDEBUG
381   if( verbose >= 2 )                              365   if( verbose >= 2 )
382   {                                               366   {
383     G4cout << " G4ParameterisationTubsZ::Compu    367     G4cout << " G4ParameterisationTubsZ::ComputeDimensions()" << G4endl
384            << " pDz: " << pDz << G4endl;          368            << " pDz: " << pDz << G4endl;
385     tubs.DumpInfo();                              369     tubs.DumpInfo();
386   }                                               370   }
387 #endif                                            371 #endif
388 }                                                 372 }
389                                                   373