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 9.6.p1)


  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 // G4ParameterisationTubs[Rho/Phi/Z] implement <<  26 //
                                                   >>  27 // $Id$
                                                   >>  28 //
                                                   >>  29 // class G4ParameterisationTubs 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 "G4ParameterisationTubs.hh"               36 #include "G4ParameterisationTubs.hh"
 34                                                    37 
 35 #include <iomanip>                                 38 #include <iomanip>
 36 #include "G4ThreeVector.hh"                        39 #include "G4ThreeVector.hh"
 37 #include "G4RotationMatrix.hh"                     40 #include "G4RotationMatrix.hh"
 38 #include "G4VPhysicalVolume.hh"                    41 #include "G4VPhysicalVolume.hh"
 39 #include "G4LogicalVolume.hh"                      42 #include "G4LogicalVolume.hh"
 40 #include "G4ReflectedSolid.hh"                     43 #include "G4ReflectedSolid.hh"
 41 #include "G4Tubs.hh"                               44 #include "G4Tubs.hh"
 42                                                    45 
 43 //--------------------------------------------     46 //--------------------------------------------------------------------------
 44 G4VParameterisationTubs::                          47 G4VParameterisationTubs::
 45 G4VParameterisationTubs( EAxis axis, G4int nDi     48 G4VParameterisationTubs( EAxis axis, G4int nDiv, G4double width,
 46                          G4double offset, G4VS <<  49                         G4double offset, G4VSolid* msolid,
 47                          DivisionType divType  <<  50                         DivisionType divType )
 48   : G4VDivisionParameterisation( axis, nDiv, w <<  51   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 49 {                                                  52 {
 50   auto msol = (G4Tubs*)(msolid);               <<  53   G4Tubs* msol = (G4Tubs*)(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 = (G4Tubs*)(mConstituentSolid);           59     msol = (G4Tubs*)(mConstituentSolid);
 57     fmotherSolid = msol;                           60     fmotherSolid = msol;
 58     fReflectedSolid = true;                        61     fReflectedSolid = true;
 59   }                                                62   }    
 60 }                                                  63 }
 61                                                    64 
 62 //--------------------------------------------     65 //------------------------------------------------------------------------
 63 G4VParameterisationTubs::~G4VParameterisationT <<  66 G4VParameterisationTubs::~G4VParameterisationTubs()
                                                   >>  67 {
                                                   >>  68 }
 64                                                    69 
 65 //--------------------------------------------     70 //--------------------------------------------------------------------------
 66 G4ParameterisationTubsRho::                        71 G4ParameterisationTubsRho::
 67 G4ParameterisationTubsRho( EAxis axis, G4int n     72 G4ParameterisationTubsRho( EAxis axis, G4int nDiv,
 68                            G4double width, G4d     73                            G4double width, G4double offset,
 69                            G4VSolid* msolid, D     74                            G4VSolid* msolid, DivisionType divType )
 70   : G4VParameterisationTubs( axis, nDiv, width <<  75   :  G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
 71 {                                                  76 {
 72   CheckParametersValidity();                       77   CheckParametersValidity();
 73   SetType( "DivisionTubsRho" );                    78   SetType( "DivisionTubsRho" );
 74                                                    79 
 75   auto msol = (G4Tubs*)(fmotherSolid);         <<  80   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
 76   if( divType == DivWIDTH )                        81   if( divType == DivWIDTH )
 77   {                                                82   {
 78     fnDiv = CalculateNDiv( msol->GetOuterRadiu     83     fnDiv = CalculateNDiv( msol->GetOuterRadius() - msol->GetInnerRadius(),
 79                            width, offset );        84                            width, offset );
 80   }                                                85   }
 81   else if( divType == DivNDIV )                    86   else if( divType == DivNDIV )
 82   {                                                87   {
 83     fwidth = CalculateWidth( msol->GetOuterRad     88     fwidth = CalculateWidth( msol->GetOuterRadius() - msol->GetInnerRadius(),
 84                              nDiv, offset );       89                              nDiv, offset );
 85   }                                                90   }
 86                                                    91 
 87 #ifdef G4DIVDEBUG                                  92 #ifdef G4DIVDEBUG
 88   if( verbose >= 1 )                               93   if( verbose >= 1 )
 89   {                                                94   {
 90     G4cout << " G4ParameterisationTubsRho - no     95     G4cout << " G4ParameterisationTubsRho - no divisions " << fnDiv << " = "
 91            << nDiv << G4endl                       96            << nDiv << G4endl
 92            << " Offset " << foffset << " = " <     97            << " Offset " << foffset << " = " << offset << G4endl
 93            << " Width " << fwidth << " = " <<      98            << " Width " << fwidth << " = " << width << G4endl
 94            << " DivType " << divType << G4endl     99            << " DivType " << divType << G4endl;
 95   }                                               100   }
 96 #endif                                            101 #endif
 97 }                                                 102 }
 98                                                   103 
 99 //--------------------------------------------    104 //--------------------------------------------------------------------------
100 G4ParameterisationTubsRho::~G4Parameterisation << 105 G4ParameterisationTubsRho::~G4ParameterisationTubsRho()
                                                   >> 106 {
                                                   >> 107 }
101                                                   108 
102 //--------------------------------------------    109 //------------------------------------------------------------------------
103 G4double G4ParameterisationTubsRho::GetMaxPara    110 G4double G4ParameterisationTubsRho::GetMaxParameter() const
104 {                                                 111 {
105   auto msol = (G4Tubs*)(fmotherSolid);         << 112   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
106   return msol->GetOuterRadius() - msol->GetInn    113   return msol->GetOuterRadius() - msol->GetInnerRadius();
107 }                                                 114 }
108                                                   115 
109                                                   116 
110 //--------------------------------------------    117 //--------------------------------------------------------------------------
111 void                                              118 void
112 G4ParameterisationTubsRho::                       119 G4ParameterisationTubsRho::
113 ComputeTransformation(const G4int, G4VPhysical    120 ComputeTransformation(const G4int, G4VPhysicalVolume* physVol) const
114 {                                                 121 {
115   //----- translation                             122   //----- translation 
116   G4ThreeVector origin(0.,0.,0.);                 123   G4ThreeVector origin(0.,0.,0.); 
117   //----- set translation                         124   //----- set translation 
118   physVol->SetTranslation( origin );              125   physVol->SetTranslation( origin );
119                                                   126 
120   //----- calculate rotation matrix: unit         127   //----- calculate rotation matrix: unit
121                                                   128 
122 #ifdef G4DIVDEBUG                                 129 #ifdef G4DIVDEBUG
123   if( verbose >= 2 )                              130   if( verbose >= 2 )
124   {                                               131   {
125     G4cout << " G4ParameterisationTubsRho " <<    132     G4cout << " G4ParameterisationTubsRho " << G4endl
126            << " Offset: " << foffset/CLHEP::de << 133            << " Offset: " << foffset/deg
127            << " - Width: " << fwidth/CLHEP::de << 134            << " - Width: " << fwidth/deg << G4endl;
128   }                                               135   }
129 #endif                                            136 #endif
130                                                   137 
131   ChangeRotMatrix( physVol );                     138   ChangeRotMatrix( physVol );
132                                                   139 
133 #ifdef G4DIVDEBUG                                 140 #ifdef G4DIVDEBUG
134   if( verbose >= 2 )                              141   if( verbose >= 2 )
135   {                                               142   {
136     G4cout << std::setprecision(8) << " G4Para    143     G4cout << std::setprecision(8) << " G4ParameterisationTubsRho " << G4endl
137            << " Position: " << origin << " - W    144            << " Position: " << origin << " - Width: " << fwidth
138            << " - Axis " << faxis  << G4endl;     145            << " - Axis " << faxis  << G4endl;
139   }                                               146   }
140 #endif                                            147 #endif
141 }                                                 148 }
142                                                   149 
143 //--------------------------------------------    150 //--------------------------------------------------------------------------
144 void                                              151 void
145 G4ParameterisationTubsRho::                       152 G4ParameterisationTubsRho::
146 ComputeDimensions( G4Tubs& tubs, const G4int c    153 ComputeDimensions( G4Tubs& tubs, const G4int copyNo,
147                    const G4VPhysicalVolume* )     154                    const G4VPhysicalVolume* ) const
148 {                                                 155 {
149   auto msol = (G4Tubs*)(fmotherSolid);         << 156   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
150                                                   157 
151   G4double pRMin = msol->GetInnerRadius() + fo << 158   G4double pRMin = msol->GetInnerRadius() + foffset + fwidth * copyNo + fhgap;
152   G4double pRMax = msol->GetInnerRadius() + fo << 159   G4double pRMax = msol->GetInnerRadius() + foffset + fwidth * (copyNo+1) - fhgap;
153   G4double pDz = msol->GetZHalfLength();          160   G4double pDz = msol->GetZHalfLength();
154   //- already rotated  G4double pSR = foffset     161   //- already rotated  G4double pSR = foffset + copyNo*fwidth;
155   G4double pSPhi = msol->GetStartPhiAngle();      162   G4double pSPhi = msol->GetStartPhiAngle();
156   G4double pDPhi = msol->GetDeltaPhiAngle();;     163   G4double pDPhi = msol->GetDeltaPhiAngle();;
157                                                   164 
158   tubs.SetInnerRadius( pRMin );                   165   tubs.SetInnerRadius( pRMin );
159   tubs.SetOuterRadius( pRMax );                   166   tubs.SetOuterRadius( pRMax );
160   tubs.SetZHalfLength( pDz );                     167   tubs.SetZHalfLength( pDz );
161   tubs.SetStartPhiAngle( pSPhi, false );          168   tubs.SetStartPhiAngle( pSPhi, false );
162   tubs.SetDeltaPhiAngle( pDPhi );                 169   tubs.SetDeltaPhiAngle( pDPhi );
163                                                   170 
164 #ifdef G4DIVDEBUG                                 171 #ifdef G4DIVDEBUG
165   if( verbose >= 2 )                              172   if( verbose >= 2 )
166   {                                               173   {
167     G4cout << " G4ParameterisationTubsRho::Com    174     G4cout << " G4ParameterisationTubsRho::ComputeDimensions()" << G4endl
168            << " pRMin: " << pRMin << " - pRMax    175            << " pRMin: " << pRMin << " - pRMax: " << pRMax << G4endl;
169     tubs.DumpInfo();                              176     tubs.DumpInfo();
170   }                                               177   }
171 #endif                                            178 #endif
172 }                                                 179 }
173                                                   180 
174 //--------------------------------------------    181 //--------------------------------------------------------------------------
175 G4ParameterisationTubsPhi::                       182 G4ParameterisationTubsPhi::
176 G4ParameterisationTubsPhi( EAxis axis, G4int n    183 G4ParameterisationTubsPhi( EAxis axis, G4int nDiv,
177                            G4double width, G4d    184                            G4double width, G4double offset,
178                            G4VSolid* msolid, D    185                            G4VSolid* msolid, DivisionType divType )
179   : G4VParameterisationTubs( axis, nDiv, width << 186   :  G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
180 {                                                 187 { 
181   CheckParametersValidity();                      188   CheckParametersValidity();
182   SetType( "DivisionTubsPhi" );                   189   SetType( "DivisionTubsPhi" );
183                                                   190 
184   auto msol = (G4Tubs*)(fmotherSolid);         << 191   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
185   if( divType == DivWIDTH )                       192   if( divType == DivWIDTH )
186   {                                               193   {
187     fnDiv = CalculateNDiv( msol->GetDeltaPhiAn    194     fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
188   }                                               195   }
189   else if( divType == DivNDIV )                   196   else if( divType == DivNDIV )
190   {                                               197   {
191     fwidth = CalculateWidth( msol->GetDeltaPhi    198     fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
192   }                                               199   }
193                                                   200 
194 #ifdef G4DIVDEBUG                                 201 #ifdef G4DIVDEBUG
195   if( verbose >= 1 )                              202   if( verbose >= 1 )
196   {                                               203   {
197     G4cout << " G4ParameterisationTubsPhi no d    204     G4cout << " G4ParameterisationTubsPhi no divisions " << fnDiv << " = "
198            << nDiv << G4endl                      205            << nDiv << G4endl
199            << " Offset " << foffset << " = " <    206            << " Offset " << foffset << " = " << offset << G4endl
200            << " Width " << fwidth << " = " <<     207            << " Width " << fwidth << " = " << width << G4endl;
201   }                                               208   }
202 #endif                                            209 #endif
203 }                                                 210 }
204                                                   211 
205 //--------------------------------------------    212 //--------------------------------------------------------------------------
206 G4ParameterisationTubsPhi::~G4Parameterisation << 213 G4ParameterisationTubsPhi::~G4ParameterisationTubsPhi()
                                                   >> 214 {
                                                   >> 215 }
207                                                   216 
208 //--------------------------------------------    217 //------------------------------------------------------------------------
209 G4double G4ParameterisationTubsPhi::GetMaxPara    218 G4double G4ParameterisationTubsPhi::GetMaxParameter() const
210 {                                                 219 {
211   auto msol = (G4Tubs*)(fmotherSolid);         << 220   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
212   return msol->GetDeltaPhiAngle();                221   return msol->GetDeltaPhiAngle();
213 }                                                 222 }
214                                                   223 
215 //--------------------------------------------    224 //--------------------------------------------------------------------------
216 void                                              225 void
217 G4ParameterisationTubsPhi::                       226 G4ParameterisationTubsPhi::
218 ComputeTransformation(const G4int copyNo, G4VP    227 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
219 {                                                 228 {
220   //----- translation                             229   //----- translation 
221   G4ThreeVector origin(0.,0.,0.);                 230   G4ThreeVector origin(0.,0.,0.); 
222   //----- set translation                         231   //----- set translation 
223   physVol->SetTranslation( origin );              232   physVol->SetTranslation( origin );
224                                                   233 
225   //----- calculate rotation matrix (so that a    234   //----- calculate rotation matrix (so that all volumes point to the centre)
226   G4double posi = foffset  + copyNo*fwidth;       235   G4double posi = foffset  + copyNo*fwidth;
227                                                   236 
228 #ifdef G4DIVDEBUG                                 237 #ifdef G4DIVDEBUG
229   if( verbose >= 2 )                              238   if( verbose >= 2 )
230   {                                               239   {
231     G4cout << " G4ParameterisationTubsPhi - po << 240     G4cout << " G4ParameterisationTubsPhi - position: " << posi/deg << G4endl
232            << " copyNo: " << copyNo << " - fof << 241            << " copyNo: " << copyNo << " - foffset: " << foffset/deg
233            << " - fwidth: " << fwidth/CLHEP::d << 242            << " - fwidth: " << fwidth/deg << G4endl;
234   }                                               243   }
235 #endif                                            244 #endif
236                                                   245 
237   ChangeRotMatrix( physVol, -posi );              246   ChangeRotMatrix( physVol, -posi );
238                                                   247 
239 #ifdef G4DIVDEBUG                                 248 #ifdef G4DIVDEBUG
240   if( verbose >= 2 )                              249   if( verbose >= 2 )
241   {                                               250   {
242     G4cout << std::setprecision(8) << " G4Para    251     G4cout << std::setprecision(8) << " G4ParameterisationTubsPhi " << copyNo
243            << G4endl                              252            << G4endl
244            << " Position: " << origin << " - W    253            << " Position: " << origin << " - Width: " << fwidth
245            << " - Axis: " << faxis  << G4endl;    254            << " - Axis: " << faxis  << G4endl;
246   }                                               255   }
247 #endif                                            256 #endif
248 }                                                 257 }
249                                                   258 
250 //--------------------------------------------    259 //--------------------------------------------------------------------------
251 void                                              260 void
252 G4ParameterisationTubsPhi::                       261 G4ParameterisationTubsPhi::
253 ComputeDimensions( G4Tubs& tubs, const G4int,     262 ComputeDimensions( G4Tubs& tubs, const G4int,
254                    const G4VPhysicalVolume* )     263                    const G4VPhysicalVolume* ) const
255 {                                                 264 {
256   auto msol = (G4Tubs*)(fmotherSolid);         << 265   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
257                                                   266 
258   G4double pRMin = msol->GetInnerRadius();        267   G4double pRMin = msol->GetInnerRadius();
259   G4double pRMax = msol->GetOuterRadius();        268   G4double pRMax = msol->GetOuterRadius();
260   G4double pDz = msol->GetZHalfLength();          269   G4double pDz = msol->GetZHalfLength();
261   //----- already rotated in 'ComputeTransform    270   //----- already rotated in 'ComputeTransformation'
262   G4double pSPhi = msol->GetStartPhiAngle() +     271   G4double pSPhi = msol->GetStartPhiAngle() + fhgap;
263   G4double pDPhi = fwidth - 2.*fhgap;             272   G4double pDPhi = fwidth - 2.*fhgap;
264                                                   273 
265   tubs.SetInnerRadius( pRMin );                   274   tubs.SetInnerRadius( pRMin );
266   tubs.SetOuterRadius( pRMax );                   275   tubs.SetOuterRadius( pRMax );
267   tubs.SetZHalfLength( pDz );                     276   tubs.SetZHalfLength( pDz );
268   tubs.SetStartPhiAngle( pSPhi, false );          277   tubs.SetStartPhiAngle( pSPhi, false );
269   tubs.SetDeltaPhiAngle( pDPhi );                 278   tubs.SetDeltaPhiAngle( pDPhi );
270                                                   279 
271 #ifdef G4DIVDEBUG                                 280 #ifdef G4DIVDEBUG
272   if( verbose >= 2 )                              281   if( verbose >= 2 )
273   {                                               282   {
274     G4cout << " G4ParameterisationTubsPhi::Com    283     G4cout << " G4ParameterisationTubsPhi::ComputeDimensions" << G4endl
275            << " pSPhi: " << pSPhi << " - pDPhi    284            << " pSPhi: " << pSPhi << " - pDPhi: " << pDPhi << G4endl;
276     tubs.DumpInfo();                              285     tubs.DumpInfo();
277   }                                               286   }
278 #endif                                            287 #endif
279 }                                                 288 }
280                                                   289 
281 //--------------------------------------------    290 //--------------------------------------------------------------------------
282 G4ParameterisationTubsZ::                         291 G4ParameterisationTubsZ::
283 G4ParameterisationTubsZ( EAxis axis, G4int nDi    292 G4ParameterisationTubsZ( EAxis axis, G4int nDiv,
284                          G4double width, G4dou    293                          G4double width, G4double offset,
285                          G4VSolid* msolid, Div    294                          G4VSolid* msolid, DivisionType divType )
286   : G4VParameterisationTubs( axis, nDiv, width    295   : G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
287 {                                                 296 { 
288   CheckParametersValidity();                      297   CheckParametersValidity();
289   SetType( "DivisionTubsZ" );                     298   SetType( "DivisionTubsZ" );
290                                                   299 
291   auto msol = (G4Tubs*)(fmotherSolid);         << 300   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
292   if( divType == DivWIDTH )                       301   if( divType == DivWIDTH )
293   {                                               302   {
294     fnDiv = CalculateNDiv( 2*msol->GetZHalfLen    303     fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
295   }                                               304   }
296   else if( divType == DivNDIV )                   305   else if( divType == DivNDIV )
297   {                                               306   {
298     fwidth = CalculateWidth( 2*msol->GetZHalfL    307     fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
299   }                                               308   }
300                                                   309 
301 #ifdef G4DIVDEBUG                                 310 #ifdef G4DIVDEBUG
302   if( verbose >= 1 )                              311   if( verbose >= 1 )
303   {                                               312   {
304     G4cout << " G4ParameterisationTubsZ: # div    313     G4cout << " G4ParameterisationTubsZ: # divisions " << fnDiv << " = "
305            << nDiv << G4endl                      314            << nDiv << G4endl
306            << " Offset " << foffset << " = " <    315            << " Offset " << foffset << " = " << offset << G4endl
307            << " Width " << fwidth << " = " <<     316            << " Width " << fwidth << " = " << width << G4endl;
308   }                                               317   }
309 #endif                                            318 #endif
310 }                                                 319 }
311                                                   320 
312 //--------------------------------------------    321 //--------------------------------------------------------------------------
313 G4ParameterisationTubsZ::~G4ParameterisationTu << 322 G4ParameterisationTubsZ::~G4ParameterisationTubsZ()
                                                   >> 323 {
                                                   >> 324 }
314                                                   325 
315 //--------------------------------------------    326 //------------------------------------------------------------------------
316 G4double G4ParameterisationTubsZ::GetMaxParame    327 G4double G4ParameterisationTubsZ::GetMaxParameter() const
317 {                                                 328 {
318   auto msol = (G4Tubs*)(fmotherSolid);         << 329   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
319   return 2*msol->GetZHalfLength();                330   return 2*msol->GetZHalfLength();
320 }                                                 331 }
321                                                   332 
322 //--------------------------------------------    333 //--------------------------------------------------------------------------
323 void                                              334 void
324 G4ParameterisationTubsZ::                         335 G4ParameterisationTubsZ::
325 ComputeTransformation(const G4int copyNo, G4VP    336 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
326 {                                                 337 {
327   //----- set translation: along Z axis           338   //----- set translation: along Z axis
328   auto motherTubs = (G4Tubs*)(fmotherSolid);   << 339   G4Tubs* motherTubs = (G4Tubs*)(fmotherSolid);
329   G4double posi = - motherTubs->GetZHalfLength    340   G4double posi = - motherTubs->GetZHalfLength() + OffsetZ() 
330                   + fwidth/2 + copyNo*fwidth;     341                   + fwidth/2 + copyNo*fwidth;
331   G4ThreeVector origin(0.,0.,posi);               342   G4ThreeVector origin(0.,0.,posi); 
332   physVol->SetTranslation( origin );              343   physVol->SetTranslation( origin );
333                                                   344 
334   //----- calculate rotation matrix: unit         345   //----- calculate rotation matrix: unit
335                                                   346 
336 #ifdef G4DIVDEBUG                                 347 #ifdef G4DIVDEBUG
337   if( verbose >= 2 )                              348   if( verbose >= 2 )
338   {                                               349   {
339     G4cout << " G4ParameterisationTubsZ::Compu    350     G4cout << " G4ParameterisationTubsZ::ComputeTransformation()" << G4endl
340            << " Position: " << posi << " - cop    351            << " Position: " << posi << " - copyNo: " << copyNo << G4endl
341            << " foffset " << foffset/CLHEP::de << 352            << " foffset " << foffset/deg << " - fwidth " << fwidth/deg
342            << G4endl;                             353            << G4endl;
343   }                                               354   }
344 #endif                                            355 #endif
345                                                   356 
346   ChangeRotMatrix( physVol );                     357   ChangeRotMatrix( physVol );
347                                                   358 
348 #ifdef G4DIVDEBUG                                 359 #ifdef G4DIVDEBUG
349   if( verbose >= 2 )                              360   if( verbose >= 2 )
350   {                                               361   {
351     G4cout << std::setprecision(8) << " G4Para    362     G4cout << std::setprecision(8) << " G4ParameterisationTubsZ " << copyNo
352            << G4endl                              363            << G4endl
353            << " Position: " << origin << " - W    364            << " Position: " << origin << " - Width: " << fwidth
354            << " - Axis: " << faxis  << G4endl;    365            << " - Axis: " << faxis  << G4endl; 
355   }                                               366   }
356 #endif                                            367 #endif
357 }                                                 368 }
358                                                   369 
359 //--------------------------------------------    370 //--------------------------------------------------------------------------
360 void                                              371 void
361 G4ParameterisationTubsZ::                         372 G4ParameterisationTubsZ::
362 ComputeDimensions( G4Tubs& tubs, const G4int,     373 ComputeDimensions( G4Tubs& tubs, const G4int,
363                    const G4VPhysicalVolume* )     374                    const G4VPhysicalVolume* ) const
364 {                                                 375 {
365   auto msol = (G4Tubs*)(fmotherSolid);         << 376   G4Tubs* msol = (G4Tubs*)(fmotherSolid);
366                                                   377 
367   G4double pRMin = msol->GetInnerRadius();        378   G4double pRMin = msol->GetInnerRadius();
368   G4double pRMax = msol->GetOuterRadius();        379   G4double pRMax = msol->GetOuterRadius();
369   //  G4double pDz = msol->GetZHalfLength() /     380   //  G4double pDz = msol->GetZHalfLength() / GetNoDiv();
370   G4double pDz = fwidth/2. - fhgap;               381   G4double pDz = fwidth/2. - fhgap;
371   G4double pSPhi = msol->GetStartPhiAngle();      382   G4double pSPhi = msol->GetStartPhiAngle();
372   G4double pDPhi = msol->GetDeltaPhiAngle();      383   G4double pDPhi = msol->GetDeltaPhiAngle();
373                                                   384 
374   tubs.SetInnerRadius( pRMin );                   385   tubs.SetInnerRadius( pRMin );
375   tubs.SetOuterRadius( pRMax );                   386   tubs.SetOuterRadius( pRMax );
376   tubs.SetZHalfLength( pDz );                     387   tubs.SetZHalfLength( pDz );
377   tubs.SetStartPhiAngle( pSPhi, false );          388   tubs.SetStartPhiAngle( pSPhi, false );
378   tubs.SetDeltaPhiAngle( pDPhi );                 389   tubs.SetDeltaPhiAngle( pDPhi );
379                                                   390 
380 #ifdef G4DIVDEBUG                                 391 #ifdef G4DIVDEBUG
381   if( verbose >= 2 )                              392   if( verbose >= 2 )
382   {                                               393   {
383     G4cout << " G4ParameterisationTubsZ::Compu    394     G4cout << " G4ParameterisationTubsZ::ComputeDimensions()" << G4endl
384            << " pDz: " << pDz << G4endl;          395            << " pDz: " << pDz << G4endl;
385     tubs.DumpInfo();                              396     tubs.DumpInfo();
386   }                                               397   }
387 #endif                                            398 #endif
388 }                                                 399 }
389                                                   400