Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/divisions/src/G4ParameterisationCons.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/G4ParameterisationCons.cc (Version 11.3.0) and /geometry/divisions/src/G4ParameterisationCons.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 // G4ParameterisationCons[Rho/Phi/Z] implement << 
 27 //                                                 23 //
 28 // 26.05.03 - P.Arce, Initial version          <<  24 // $Id: G4ParameterisationCons.cc,v 1.6 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 G4ParameterisationCons Implementation file
                                                   >>  28 //
                                                   >>  29 // 26.05.03 - P.Arce Initial version
                                                   >>  30 // ********************************************************************
 32                                                    31 
 33 #include "G4ParameterisationCons.hh"               32 #include "G4ParameterisationCons.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 "G4Cons.hh"                               39 #include "G4Cons.hh"
 42                                                    40 
 43 //--------------------------------------------     41 //--------------------------------------------------------------------------
 44 G4VParameterisationCons::                      << 
 45 G4VParameterisationCons( EAxis axis, G4int nDi << 
 46                         G4double offset, G4VSo << 
 47                         DivisionType divType ) << 
 48   :  G4VDivisionParameterisation( axis, nDiv,  << 
 49 {                                              << 
 50   auto msol = (G4Cons*)(msolid);               << 
 51   if (msolid->GetEntityType() == "G4ReflectedS << 
 52   {                                            << 
 53     // Get constituent solid                   << 
 54     G4VSolid* mConstituentSolid                << 
 55        = ((G4ReflectedSolid*)msolid)->GetConst << 
 56     msol = (G4Cons*)(mConstituentSolid);       << 
 57                                                << 
 58     // Create a new solid with inversed parame << 
 59     auto newSolid                              << 
 60       = new G4Cons(msol->GetName(),            << 
 61                    msol->GetInnerRadiusPlusZ() << 
 62                    msol->GetInnerRadiusMinusZ( << 
 63                    msol->GetZHalfLength(),     << 
 64                    msol->GetStartPhiAngle(), m << 
 65     msol = newSolid;                           << 
 66     fmotherSolid = newSolid;                   << 
 67     fReflectedSolid = true;                    << 
 68     fDeleteSolid = true;                       << 
 69   }                                            << 
 70 }                                              << 
 71                                                << 
 72 //-------------------------------------------- << 
 73 G4VParameterisationCons::~G4VParameterisationC << 
 74                                                << 
 75 //-------------------------------------------- << 
 76 G4ParameterisationConsRho::                        42 G4ParameterisationConsRho::
 77 G4ParameterisationConsRho( EAxis axis, G4int n     43 G4ParameterisationConsRho( EAxis axis, G4int nDiv,
 78                            G4double width, G4d     44                            G4double width, G4double offset,
 79                            G4VSolid* msolid, D     45                            G4VSolid* msolid, DivisionType divType )
 80   :  G4VParameterisationCons( axis, nDiv, widt <<  46   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 81 {                                                  47 {
 82   CheckParametersValidity();                       48   CheckParametersValidity();
 83   SetType( "DivisionConsRho" );                    49   SetType( "DivisionConsRho" );
 84                                                    50 
 85   auto msol = (G4Cons*)(fmotherSolid);         <<  51   G4Cons* msol = (G4Cons*)(msolid);
 86   if( msol->GetInnerRadiusPlusZ() == 0. )          52   if( msol->GetInnerRadiusPlusZ() == 0. )
 87   {                                                53   {
 88     std::ostringstream message;                <<  54     G4cerr << "WARNING - G4ParameterisationConsRho, OuterRadiusMinusZ = 0. "
 89     message << "OuterRadiusMinusZ = 0" << G4en <<  55            << G4endl 
 90             << "Width is calculated as that of <<  56            << "          Width is calculated as that of OuterRadiusMinusZ !"
 91     G4Exception("G4ParameterisationConsRho::G4 <<  57            << G4endl;
 92                 "GeomDiv1001", JustWarning, me << 
 93   }                                                58   } 
 94                                                    59 
 95   if( divType == DivWIDTH )                        60   if( divType == DivWIDTH )
 96   {                                                61   {
 97     fnDiv = CalculateNDiv( msol->GetOuterRadiu     62     fnDiv = CalculateNDiv( msol->GetOuterRadiusMinusZ()
 98                          - msol->GetInnerRadiu     63                          - msol->GetInnerRadiusMinusZ(), width, offset );
 99   }                                                64   }
100   else if( divType == DivNDIV )                    65   else if( divType == DivNDIV )
101   {                                                66   {
102     auto mconsol = (G4Cons*)(msolid);          <<  67     G4Cons* msol = (G4Cons*)(msolid);
103     fwidth = CalculateWidth( mconsol->GetOuter <<  68     fwidth = CalculateWidth( msol->GetOuterRadiusMinusZ()
104                            - mconsol->GetInner <<  69                            - msol->GetInnerRadiusMinusZ(), nDiv, offset );
105   }                                                70   }
106                                                    71 
107 #ifdef G4DIVDEBUG                                  72 #ifdef G4DIVDEBUG
108   if( verbose >= 1 )                               73   if( verbose >= 1 )
109   {                                                74   {
110     G4cout << " G4ParameterisationConsRho - no     75     G4cout << " G4ParameterisationConsRho - no divisions " << fnDiv << " = "
111            << nDiv << G4endl                       76            << nDiv << G4endl
112            << " Offset " << foffset << " = " <     77            << " Offset " << foffset << " = " << offset
113            << " - Width " << fwidth << " = " <     78            << " - Width " << fwidth << " = " << width << G4endl;
114   }                                                79   }
115 #endif                                             80 #endif
116 }                                                  81 }
117                                                    82 
118 //--------------------------------------------     83 //--------------------------------------------------------------------------
119 G4ParameterisationConsRho::~G4Parameterisation <<  84 G4ParameterisationConsRho::~G4ParameterisationConsRho()
                                                   >>  85 {
                                                   >>  86 }
120                                                    87 
121 //--------------------------------------------     88 //------------------------------------------------------------------------
122 G4double G4ParameterisationConsRho::GetMaxPara     89 G4double G4ParameterisationConsRho::GetMaxParameter() const
123 {                                                  90 {
124   auto msol = (G4Cons*)(fmotherSolid);         <<  91   G4Cons* msol = (G4Cons*)(fmotherSolid);
125   return msol->GetOuterRadiusMinusZ() - msol->     92   return msol->GetOuterRadiusMinusZ() - msol->GetInnerRadiusMinusZ();
126 }                                                  93 }
127                                                    94 
128 //--------------------------------------------     95 //--------------------------------------------------------------------------
129 void                                               96 void
130 G4ParameterisationConsRho::                        97 G4ParameterisationConsRho::
131 ComputeTransformation( const G4int, G4VPhysica     98 ComputeTransformation( const G4int, G4VPhysicalVolume *physVol ) const
132 {                                                  99 {
133   //----- translation                             100   //----- translation 
134   G4ThreeVector origin(0.,0.,0.);                 101   G4ThreeVector origin(0.,0.,0.); 
135   //----- set translation                         102   //----- set translation 
136   physVol->SetTranslation( origin );              103   physVol->SetTranslation( origin );
137                                                   104 
138   //----- calculate rotation matrix: unit         105   //----- calculate rotation matrix: unit
139                                                   106 
140 #ifdef G4DIVDEBUG                                 107 #ifdef G4DIVDEBUG
141   if( verbose >= 2 )                              108   if( verbose >= 2 )
142   {                                               109   {
143     G4cout <<  " G4ParameterisationConsRho " <    110     G4cout <<  " G4ParameterisationConsRho " << G4endl
144            << " Offset: " << foffset              111            << " Offset: " << foffset
145            << " - Width: " << fwidth << G4endl    112            << " - Width: " << fwidth << G4endl;
146   }                                               113   }
147 #endif                                            114 #endif
148                                                   115 
149   ChangeRotMatrix( physVol );                     116   ChangeRotMatrix( physVol );
150                                                   117 
151 #ifdef G4DIVDEBUG                                 118 #ifdef G4DIVDEBUG
152   if( verbose >= 2 )                              119   if( verbose >= 2 )
153   {                                               120   {
154     G4cout << std::setprecision(8) << " G4Para    121     G4cout << std::setprecision(8) << " G4ParameterisationConsRho" << G4endl
155            << " Position: " << origin << " - W    122            << " Position: " << origin << " - Width: " << fwidth
156            << " - Axis: " << faxis  << G4endl;    123            << " - Axis: " << faxis  << G4endl;
157   }                                               124   }
158 #endif                                            125 #endif
159 }                                                 126 }
160                                                   127 
161 //--------------------------------------------    128 //--------------------------------------------------------------------------
162 void                                              129 void
163 G4ParameterisationConsRho::                       130 G4ParameterisationConsRho::
164 ComputeDimensions( G4Cons& cons, const G4int c    131 ComputeDimensions( G4Cons& cons, const G4int copyNo,
165                    const G4VPhysicalVolume* )     132                    const G4VPhysicalVolume* ) const
166 {                                                 133 {
167   auto msol = (G4Cons*)(fmotherSolid);         << 134   G4Cons* msol = (G4Cons*)(fmotherSolid);
168                                                   135 
169   G4double pRMin1 = msol->GetInnerRadiusMinusZ << 136   G4double pRMin1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * copyNo;
170   G4double pRMax1 = msol->GetInnerRadiusMinusZ << 137   G4double pRMax1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * (copyNo+1);
171                                                   138  
172   //width at Z Plus                               139   //width at Z Plus
173   //- G4double fwidthPlus =                       140   //- G4double fwidthPlus =
174   //   fwidth * ( msol->GetOuterRadiusPlusZ()/    141   //   fwidth * ( msol->GetOuterRadiusPlusZ()/ msol->GetInnerRadiusPlusZ())
175   //-         / ( msol->GetOuterRadiusMinusZ()    142   //-         / ( msol->GetOuterRadiusMinusZ() - msol->GetInnerRadiusMinusZ());
176   G4double fwidthPlus = CalculateWidth( msol->    143   G4double fwidthPlus = CalculateWidth( msol->GetOuterRadiusPlusZ()
177                            - msol->GetInnerRad    144                            - msol->GetInnerRadiusPlusZ(), fnDiv, foffset );
178   G4double pRMin2 = msol->GetInnerRadiusPlusZ(    145   G4double pRMin2 = msol->GetInnerRadiusPlusZ()
179                   + foffset + fwidthPlus * cop    146                   + foffset + fwidthPlus * copyNo;
180   G4double pRMax2 = msol->GetInnerRadiusPlusZ(    147   G4double pRMax2 = msol->GetInnerRadiusPlusZ()
181                   + foffset + fwidthPlus * (co    148                   + foffset + fwidthPlus * (copyNo+1);
182   G4double pDz = msol->GetZHalfLength();          149   G4double pDz = msol->GetZHalfLength();
183                                                   150 
184   G4double d_half_gap = fhgap * pRMax2 / pRMax << 
185   //- already rotated  double pSR = foffset +     151   //- already rotated  double pSR = foffset + copyNo*fwidth;
186   G4double pSPhi = msol->GetStartPhiAngle();      152   G4double pSPhi = msol->GetStartPhiAngle();
187   G4double pDPhi = msol->GetDeltaPhiAngle();;     153   G4double pDPhi = msol->GetDeltaPhiAngle();;
188                                                   154 
189   cons.SetInnerRadiusMinusZ( pRMin1 + fhgap ); << 155   cons.SetInnerRadiusMinusZ( pRMin1 );
190   cons.SetOuterRadiusMinusZ( pRMax1 - fhgap ); << 156   cons.SetOuterRadiusMinusZ( pRMax1 );
191   cons.SetInnerRadiusPlusZ( pRMin2 + d_half_ga << 157   cons.SetInnerRadiusPlusZ( pRMin2 );
192   cons.SetOuterRadiusPlusZ( pRMax2 - d_half_ga << 158   cons.SetOuterRadiusPlusZ( pRMax2 );
193   cons.SetZHalfLength( pDz );                     159   cons.SetZHalfLength( pDz );
194   cons.SetStartPhiAngle( pSPhi, false );       << 160   cons.SetStartPhiAngle( pSPhi );
195   cons.SetDeltaPhiAngle( pDPhi );                 161   cons.SetDeltaPhiAngle( pDPhi );
196                                                   162 
197 #ifdef G4DIVDEBUG                                 163 #ifdef G4DIVDEBUG
198   if( verbose >= 2 )                              164   if( verbose >= 2 )
199   {                                               165   {
200     G4cout << " G4ParameterisationConsRho::Com    166     G4cout << " G4ParameterisationConsRho::ComputeDimensions()" << G4endl
201            << " pRMin: " << pRMin1 << " - pRMa    167            << " pRMin: " << pRMin1 << " - pRMax: " << pRMax1 << G4endl;
202     if( verbose >= 4 ) cons.DumpInfo();           168     if( verbose >= 4 ) cons.DumpInfo();
203   }                                               169   }
204 #endif                                            170 #endif
205 }                                                 171 }
206                                                   172 
207 //--------------------------------------------    173 //--------------------------------------------------------------------------
208 G4ParameterisationConsPhi::                       174 G4ParameterisationConsPhi::
209 G4ParameterisationConsPhi( EAxis axis, G4int n    175 G4ParameterisationConsPhi( EAxis axis, G4int nDiv,
210                            G4double width, G4d    176                            G4double width, G4double offset,
211                            G4VSolid* msolid, D    177                            G4VSolid* msolid, DivisionType divType )
212   :  G4VParameterisationCons( axis, nDiv, widt << 178   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
213 {                                                 179 { 
214   CheckParametersValidity();                      180   CheckParametersValidity();
215   SetType( "DivisionConsPhi" );                   181   SetType( "DivisionConsPhi" );
216                                                   182 
217   auto msol = (G4Cons*)(fmotherSolid);         << 
218   if( divType == DivWIDTH )                       183   if( divType == DivWIDTH )
219   {                                               184   {
                                                   >> 185     G4Cons* msol = (G4Cons*)(msolid);
220     fnDiv = CalculateNDiv( msol->GetDeltaPhiAn    186     fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
221   }                                               187   }
222   else if( divType == DivNDIV )                   188   else if( divType == DivNDIV )
223   {                                               189   {
                                                   >> 190     G4Cons* msol = (G4Cons*)(msolid);
224     fwidth = CalculateWidth( msol->GetDeltaPhi    191     fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
225   }                                               192   }
226                                                   193 
227 #ifdef G4DIVDEBUG                                 194 #ifdef G4DIVDEBUG
228   if( verbose >= 1 )                              195   if( verbose >= 1 )
229   {                                               196   {
230     G4cout << " G4ParameterisationConsPhi no d    197     G4cout << " G4ParameterisationConsPhi no divisions " << fnDiv << " = "
231            << nDiv << G4endl                      198            << nDiv << G4endl
232            << " Offset " << foffset << " = " <    199            << " Offset " << foffset << " = " << offset << G4endl
233            << " Width " << fwidth << " = " <<     200            << " Width " << fwidth << " = " << width << G4endl;
234   }                                               201   }
235 #endif                                            202 #endif
236 }                                                 203 }
237                                                   204 
238 //--------------------------------------------    205 //--------------------------------------------------------------------------
239 G4ParameterisationConsPhi::~G4Parameterisation << 206 G4ParameterisationConsPhi::~G4ParameterisationConsPhi()
                                                   >> 207 {
                                                   >> 208 }
240                                                   209 
241 //--------------------------------------------    210 //------------------------------------------------------------------------
242 G4double G4ParameterisationConsPhi::GetMaxPara    211 G4double G4ParameterisationConsPhi::GetMaxParameter() const
243 {                                                 212 {
244   auto msol = (G4Cons*)(fmotherSolid);         << 213   G4Cons* msol = (G4Cons*)(fmotherSolid);
245   return msol->GetDeltaPhiAngle();                214   return msol->GetDeltaPhiAngle();
246 }                                                 215 }
247                                                   216 
248 //--------------------------------------------    217 //--------------------------------------------------------------------------
249 void                                              218 void
250 G4ParameterisationConsPhi::                       219 G4ParameterisationConsPhi::
251 ComputeTransformation( const G4int copyNo, G4V    220 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
252 {                                                 221 {
253   //----- translation                             222   //----- translation 
254   G4ThreeVector origin(0.,0.,0.);                 223   G4ThreeVector origin(0.,0.,0.); 
255   //----- set translation                         224   //----- set translation 
256   physVol->SetTranslation( origin );              225   physVol->SetTranslation( origin );
257                                                   226 
258   //----- calculate rotation matrix (so that a    227   //----- calculate rotation matrix (so that all volumes point to the centre)
259   G4double posi = foffset  + copyNo*fwidth;       228   G4double posi = foffset  + copyNo*fwidth;
260                                                   229 
261 #ifdef G4DIVDEBUG                                 230 #ifdef G4DIVDEBUG
262   if( verbose >= 2 )                              231   if( verbose >= 2 )
263   {                                               232   {
264     G4cout << " G4ParameterisationConsPhi - po << 233     G4cout << " G4ParameterisationConsPhi - position: " << posi/deg << G4endl
265            << " Origin: " << origin << " copyN    234            << " Origin: " << origin << " copyNo: " << copyNo
266            << " - foffset: " << foffset/CLHEP: << 235            << " - foffset: " << foffset/deg
267            << " - fwidth: " << fwidth/CLHEP::d << 236            << " - fwidth: " << fwidth/deg << G4endl
268            << " - Axis: " << faxis << G4endl;     237            << " - Axis: " << faxis << G4endl;
269   }                                               238   }
270 #endif                                            239 #endif
271                                                   240 
272   ChangeRotMatrix( physVol, -posi );              241   ChangeRotMatrix( physVol, -posi );
273 }                                                 242 }
274                                                   243 
275 //--------------------------------------------    244 //--------------------------------------------------------------------------
276 void                                              245 void
277 G4ParameterisationConsPhi::                       246 G4ParameterisationConsPhi::
278 ComputeDimensions( G4Cons& cons, const G4int,     247 ComputeDimensions( G4Cons& cons, const G4int,
279                    const G4VPhysicalVolume* )     248                    const G4VPhysicalVolume* ) const
280 {                                                 249 {
281   auto msol = (G4Cons*)(fmotherSolid);         << 250   G4Cons* msol = (G4Cons*)(fmotherSolid);
282                                                   251 
283   G4double pRMin1 = msol->GetInnerRadiusMinusZ    252   G4double pRMin1 = msol->GetInnerRadiusMinusZ();
284   G4double pRMax1 = msol->GetOuterRadiusMinusZ    253   G4double pRMax1 = msol->GetOuterRadiusMinusZ();
285   G4double pRMin2 = msol->GetInnerRadiusPlusZ(    254   G4double pRMin2 = msol->GetInnerRadiusPlusZ();
286   G4double pRMax2 = msol->GetOuterRadiusPlusZ(    255   G4double pRMax2 = msol->GetOuterRadiusPlusZ();
287   G4double pDz = msol->GetZHalfLength();          256   G4double pDz = msol->GetZHalfLength();
288                                                   257 
289   //- already rotated  double pSPhi = foffset     258   //- already rotated  double pSPhi = foffset + copyNo*fwidth;
290   G4double pSPhi = foffset + msol->GetStartPhi << 259   G4double pSPhi = foffset + msol->GetStartPhiAngle();
291   G4double pDPhi = fwidth - 2.*fhgap;          << 260   G4double pDPhi = fwidth;
292                                                   261 
293   cons.SetInnerRadiusMinusZ( pRMin1 );            262   cons.SetInnerRadiusMinusZ( pRMin1 );
294   cons.SetOuterRadiusMinusZ( pRMax1 );            263   cons.SetOuterRadiusMinusZ( pRMax1 );
295   cons.SetInnerRadiusPlusZ( pRMin2 );             264   cons.SetInnerRadiusPlusZ( pRMin2 );
296   cons.SetOuterRadiusPlusZ( pRMax2 );             265   cons.SetOuterRadiusPlusZ( pRMax2 );
297   cons.SetZHalfLength( pDz );                     266   cons.SetZHalfLength( pDz );
298   cons.SetStartPhiAngle( pSPhi, false );       << 267   cons.SetStartPhiAngle( pSPhi );
299   cons.SetDeltaPhiAngle( pDPhi );                 268   cons.SetDeltaPhiAngle( pDPhi );
300                                                   269 
301 #ifdef G4DIVDEBUG                                 270 #ifdef G4DIVDEBUG
302   if( verbose >= 2 )                              271   if( verbose >= 2 )
303   {                                               272   {
304     G4cout << " G4ParameterisationConsPhi::Com    273     G4cout << " G4ParameterisationConsPhi::ComputeDimensions" << G4endl
305            << " pSPhi: " << pSPhi << " - pDPhi    274            << " pSPhi: " << pSPhi << " - pDPhi: " << pDPhi << G4endl;
306     if( verbose >= 4 ) cons.DumpInfo();           275     if( verbose >= 4 ) cons.DumpInfo();
307   }                                               276   }
308 #endif                                            277 #endif
309 }                                                 278 }
310                                                   279 
311 //--------------------------------------------    280 //--------------------------------------------------------------------------
312 G4ParameterisationConsZ::                         281 G4ParameterisationConsZ::
313 G4ParameterisationConsZ( EAxis axis, G4int nDi    282 G4ParameterisationConsZ( EAxis axis, G4int nDiv,
314                          G4double width, G4dou    283                          G4double width, G4double offset,
315                          G4VSolid* msolid, Div    284                          G4VSolid* msolid, DivisionType divType )
316   :  G4VParameterisationCons( axis, nDiv, widt << 285   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
317 {                                                 286 { 
318   CheckParametersValidity();                      287   CheckParametersValidity();
319   SetType( "DivisionConsZ" );                     288   SetType( "DivisionConsZ" );
320                                                   289 
321   auto msol = (G4Cons*)(fmotherSolid);         << 
322   if( divType == DivWIDTH )                       290   if( divType == DivWIDTH )
323   {                                               291   {
                                                   >> 292     G4Cons* msol = (G4Cons*)(msolid);
324     fnDiv = CalculateNDiv( 2*msol->GetZHalfLen    293     fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
325   }                                               294   }
326   else if( divType == DivNDIV )                   295   else if( divType == DivNDIV )
327   {                                               296   {
                                                   >> 297     G4Cons* msol = (G4Cons*)(msolid);
328     fwidth = CalculateWidth( 2*msol->GetZHalfL    298     fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
329   }                                               299   }
330                                                   300 
331 #ifdef G4DIVDEBUG                                 301 #ifdef G4DIVDEBUG
332   if( verbose >= 1 )                              302   if( verbose >= 1 )
333   {                                               303   {
334     G4cout << " G4ParameterisationConsZ: # div    304     G4cout << " G4ParameterisationConsZ: # divisions " << fnDiv << " = "
335            << nDiv << G4endl                      305            << nDiv << G4endl
336            << " Offset " << foffset << " = " <    306            << " Offset " << foffset << " = " << offset << G4endl
337            << " Width " << fwidth << " = " <<     307            << " Width " << fwidth << " = " << width << G4endl
338            << " - Axis: " << faxis << G4endl;     308            << " - Axis: " << faxis << G4endl;
339   }                                               309   }
340 #endif                                            310 #endif
341 }                                                 311 }
342                                                   312 
343 //--------------------------------------------    313 //--------------------------------------------------------------------------
344 G4ParameterisationConsZ::~G4ParameterisationCo << 314 G4ParameterisationConsZ::~G4ParameterisationConsZ()
                                                   >> 315 {
                                                   >> 316 }
345                                                   317 
346 //--------------------------------------------    318 //------------------------------------------------------------------------
347 G4double G4ParameterisationConsZ::GetMaxParame    319 G4double G4ParameterisationConsZ::GetMaxParameter() const
348 {                                                 320 {
349   auto msol = (G4Cons*)(fmotherSolid);         << 321   G4Cons* msol = (G4Cons*)(fmotherSolid);
350   return 2*msol->GetZHalfLength();                322   return 2*msol->GetZHalfLength();
351 }                                                 323 }
352                                                   324 
353 //--------------------------------------------    325 //--------------------------------------------------------------------------
354 void                                              326 void
355 G4ParameterisationConsZ::                         327 G4ParameterisationConsZ::
356 ComputeTransformation( const G4int copyNo, G4V    328 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
357 {                                                 329 {
358   //----- set translation: along Z axis           330   //----- set translation: along Z axis
359   auto motherCons = (G4Cons*)(GetMotherSolid() << 331   G4Cons* motherCons = (G4Cons*)(GetMotherSolid());
360   G4double posi = - motherCons->GetZHalfLength << 332   G4double posi = - motherCons->GetZHalfLength() + foffset
361                   + fwidth/2 + copyNo*fwidth;     333                   + fwidth/2 + copyNo*fwidth;
362   G4ThreeVector origin(0.,0.,posi);               334   G4ThreeVector origin(0.,0.,posi); 
363   physVol->SetTranslation( origin );              335   physVol->SetTranslation( origin );
364                                                   336 
365   //----- calculate rotation matrix: unit         337   //----- calculate rotation matrix: unit
366                                                   338 
367 #ifdef G4DIVDEBUG                                 339 #ifdef G4DIVDEBUG
368   if( verbose >= 2 )                              340   if( verbose >= 2 )
369   {                                               341   {
370     G4cout << " G4ParameterisationConsZ::Compu    342     G4cout << " G4ParameterisationConsZ::ComputeTransformation()" << G4endl
371            << " Origin: " << origin << " - cop    343            << " Origin: " << origin << " - copyNo: " << copyNo << G4endl
372            << " foffset: " << foffset << " - f    344            << " foffset: " << foffset << " - fwidth: " << fwidth
373            << G4endl;                             345            << G4endl;
374   }                                               346   }
375 #endif                                            347 #endif
376                                                   348 
377   ChangeRotMatrix( physVol );                     349   ChangeRotMatrix( physVol );
378 }                                                 350 }
379                                                   351 
380                                                   352 
381 //--------------------------------------------    353 //--------------------------------------------------------------------------
382 void                                              354 void
383 G4ParameterisationConsZ::                         355 G4ParameterisationConsZ::
384 ComputeDimensions( G4Cons& cons, const G4int c    356 ComputeDimensions( G4Cons& cons, const G4int copyNo,
385                    const G4VPhysicalVolume* )     357                    const G4VPhysicalVolume* ) const
386 {                                                 358 {
387   auto msol = (G4Cons*)(fmotherSolid);         << 359   G4Cons* msol = (G4Cons*)(fmotherSolid);
388                                                   360 
389   G4double mHalfLength = msol->GetZHalfLength( << 361   G4double mHalfLength = msol->GetZHalfLength();
390   G4double aRInner = (msol->GetInnerRadiusPlus    362   G4double aRInner = (msol->GetInnerRadiusPlusZ()
391                    - msol->GetInnerRadiusMinus    363                    - msol->GetInnerRadiusMinusZ()) / (2*mHalfLength);
392   G4double bRInner = (msol->GetInnerRadiusPlus    364   G4double bRInner = (msol->GetInnerRadiusPlusZ()
393                    + msol->GetInnerRadiusMinus    365                    + msol->GetInnerRadiusMinusZ()) / 2;
394   G4double aROuter = (msol->GetOuterRadiusPlus    366   G4double aROuter = (msol->GetOuterRadiusPlusZ()
395                    - msol->GetOuterRadiusMinus    367                    - msol->GetOuterRadiusMinusZ()) / (2*mHalfLength);
396   G4double bROuter = (msol->GetOuterRadiusPlus    368   G4double bROuter = (msol->GetOuterRadiusPlusZ()
397                    + msol->GetOuterRadiusMinus    369                    + msol->GetOuterRadiusMinusZ()) / 2;
398   G4double xMinusZ = -mHalfLength + OffsetZ()  << 370   G4double xMinusZ = -mHalfLength + foffset + fwidth*copyNo;
399   G4double xPlusZ  = -mHalfLength + OffsetZ()  << 371   G4double xPlusZ  = -mHalfLength + foffset + fwidth*(copyNo+1);
400   cons.SetInnerRadiusMinusZ( aRInner * xMinusZ    372   cons.SetInnerRadiusMinusZ( aRInner * xMinusZ + bRInner );
401   cons.SetOuterRadiusMinusZ( aROuter * xMinusZ    373   cons.SetOuterRadiusMinusZ( aROuter * xMinusZ + bROuter );
402   cons.SetInnerRadiusPlusZ( aRInner * xPlusZ +    374   cons.SetInnerRadiusPlusZ( aRInner * xPlusZ + bRInner );
403   cons.SetOuterRadiusPlusZ( aROuter * xPlusZ +    375   cons.SetOuterRadiusPlusZ( aROuter * xPlusZ + bROuter );
404                                                   376  
405   G4double pDz = fwidth / 2. - fhgap;          << 377   G4double pDz = fwidth / 2.;
406   G4double pSPhi = msol->GetStartPhiAngle();      378   G4double pSPhi = msol->GetStartPhiAngle();
407   G4double pDPhi = msol->GetDeltaPhiAngle();      379   G4double pDPhi = msol->GetDeltaPhiAngle();
408                                                   380 
409   cons.SetZHalfLength( pDz );                     381   cons.SetZHalfLength( pDz );
410   cons.SetStartPhiAngle( pSPhi, false );       << 382   cons.SetStartPhiAngle( pSPhi );
411   cons.SetDeltaPhiAngle( pDPhi );                 383   cons.SetDeltaPhiAngle( pDPhi );
412                                                   384 
413 #ifdef G4DIVDEBUG                                 385 #ifdef G4DIVDEBUG
414   if( verbose >= 2 )                              386   if( verbose >= 2 )
415   {                                               387   {
416     G4cout << " G4ParameterisationConsZ::Compu    388     G4cout << " G4ParameterisationConsZ::ComputeDimensions()" << G4endl
417            << " pDz: " << pDz << G4endl;          389            << " pDz: " << pDz << G4endl;
418     if( verbose >= 4 ) cons.DumpInfo();           390     if( verbose >= 4 ) cons.DumpInfo();
419   }                                               391   }
420 #endif                                            392 #endif
421                                                << 
422 }                                                 393 }
423                                                   394