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.4.p4)


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