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 10.2.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4ParameterisationCons[Rho/Phi/Z] implement <<  26 //
                                                   >>  27 // $Id: G4ParameterisationCons.cc 66356 2012-12-18 09:02:32Z gcosmo $
                                                   >>  28 //
                                                   >>  29 // class G4ParameterisationCons 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 "G4ParameterisationCons.hh"               36 #include "G4ParameterisationCons.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 "G4Cons.hh"                               44 #include "G4Cons.hh"
 42                                                    45 
 43 //--------------------------------------------     46 //--------------------------------------------------------------------------
 44 G4VParameterisationCons::                          47 G4VParameterisationCons::
 45 G4VParameterisationCons( EAxis axis, G4int nDi     48 G4VParameterisationCons( EAxis axis, G4int nDiv, G4double width,
 46                         G4double offset, G4VSo     49                         G4double offset, G4VSolid* msolid,
 47                         DivisionType divType )     50                         DivisionType divType )
 48   :  G4VDivisionParameterisation( axis, nDiv,      51   :  G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
 49 {                                                  52 {
 50   auto msol = (G4Cons*)(msolid);               <<  53   G4Cons* msol = (G4Cons*)(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 = (G4Cons*)(mConstituentSolid);           59     msol = (G4Cons*)(mConstituentSolid);
 57                                                    60   
 58     // Create a new solid with inversed parame     61     // Create a new solid with inversed parameters
 59     auto newSolid                              <<  62     G4Cons* newSolid
 60       = new G4Cons(msol->GetName(),                63       = new G4Cons(msol->GetName(),
 61                    msol->GetInnerRadiusPlusZ()     64                    msol->GetInnerRadiusPlusZ(), msol->GetOuterRadiusPlusZ(),
 62                    msol->GetInnerRadiusMinusZ(     65                    msol->GetInnerRadiusMinusZ(), msol->GetOuterRadiusMinusZ(),
 63                    msol->GetZHalfLength(),         66                    msol->GetZHalfLength(),
 64                    msol->GetStartPhiAngle(), m     67                    msol->GetStartPhiAngle(), msol->GetDeltaPhiAngle());
 65     msol = newSolid;                               68     msol = newSolid;
 66     fmotherSolid = newSolid;                       69     fmotherSolid = newSolid;
 67     fReflectedSolid = true;                        70     fReflectedSolid = true;
 68     fDeleteSolid = true;                           71     fDeleteSolid = true;
 69   }                                                72   }    
 70 }                                                  73 }
 71                                                    74 
 72 //--------------------------------------------     75 //------------------------------------------------------------------------
 73 G4VParameterisationCons::~G4VParameterisationC <<  76 G4VParameterisationCons::~G4VParameterisationCons()
                                                   >>  77 {
                                                   >>  78 }
 74                                                    79 
 75 //--------------------------------------------     80 //--------------------------------------------------------------------------
 76 G4ParameterisationConsRho::                        81 G4ParameterisationConsRho::
 77 G4ParameterisationConsRho( EAxis axis, G4int n     82 G4ParameterisationConsRho( EAxis axis, G4int nDiv,
 78                            G4double width, G4d     83                            G4double width, G4double offset,
 79                            G4VSolid* msolid, D     84                            G4VSolid* msolid, DivisionType divType )
 80   :  G4VParameterisationCons( axis, nDiv, widt     85   :  G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
 81 {                                                  86 {
 82   CheckParametersValidity();                       87   CheckParametersValidity();
 83   SetType( "DivisionConsRho" );                    88   SetType( "DivisionConsRho" );
 84                                                    89 
 85   auto msol = (G4Cons*)(fmotherSolid);         <<  90   G4Cons* msol = (G4Cons*)(fmotherSolid);
 86   if( msol->GetInnerRadiusPlusZ() == 0. )          91   if( msol->GetInnerRadiusPlusZ() == 0. )
 87   {                                                92   {
 88     std::ostringstream message;                    93     std::ostringstream message;
 89     message << "OuterRadiusMinusZ = 0" << G4en     94     message << "OuterRadiusMinusZ = 0" << G4endl 
 90             << "Width is calculated as that of     95             << "Width is calculated as that of OuterRadiusMinusZ !";
 91     G4Exception("G4ParameterisationConsRho::G4     96     G4Exception("G4ParameterisationConsRho::G4ParameterisationConsRho()",
 92                 "GeomDiv1001", JustWarning, me     97                 "GeomDiv1001", JustWarning, message);
 93   }                                                98   } 
 94                                                    99 
 95   if( divType == DivWIDTH )                       100   if( divType == DivWIDTH )
 96   {                                               101   {
 97     fnDiv = CalculateNDiv( msol->GetOuterRadiu    102     fnDiv = CalculateNDiv( msol->GetOuterRadiusMinusZ()
 98                          - msol->GetInnerRadiu    103                          - msol->GetInnerRadiusMinusZ(), width, offset );
 99   }                                               104   }
100   else if( divType == DivNDIV )                   105   else if( divType == DivNDIV )
101   {                                               106   {
102     auto mconsol = (G4Cons*)(msolid);          << 107     G4Cons* mconsol = (G4Cons*)(msolid);
103     fwidth = CalculateWidth( mconsol->GetOuter    108     fwidth = CalculateWidth( mconsol->GetOuterRadiusMinusZ()
104                            - mconsol->GetInner    109                            - mconsol->GetInnerRadiusMinusZ(), nDiv, offset );
105   }                                               110   }
106                                                   111 
107 #ifdef G4DIVDEBUG                                 112 #ifdef G4DIVDEBUG
108   if( verbose >= 1 )                              113   if( verbose >= 1 )
109   {                                               114   {
110     G4cout << " G4ParameterisationConsRho - no    115     G4cout << " G4ParameterisationConsRho - no divisions " << fnDiv << " = "
111            << nDiv << G4endl                      116            << nDiv << G4endl
112            << " Offset " << foffset << " = " <    117            << " Offset " << foffset << " = " << offset
113            << " - Width " << fwidth << " = " <    118            << " - Width " << fwidth << " = " << width << G4endl;
114   }                                               119   }
115 #endif                                            120 #endif
116 }                                                 121 }
117                                                   122 
118 //--------------------------------------------    123 //--------------------------------------------------------------------------
119 G4ParameterisationConsRho::~G4Parameterisation << 124 G4ParameterisationConsRho::~G4ParameterisationConsRho()
                                                   >> 125 {
                                                   >> 126 }
120                                                   127 
121 //--------------------------------------------    128 //------------------------------------------------------------------------
122 G4double G4ParameterisationConsRho::GetMaxPara    129 G4double G4ParameterisationConsRho::GetMaxParameter() const
123 {                                                 130 {
124   auto msol = (G4Cons*)(fmotherSolid);         << 131   G4Cons* msol = (G4Cons*)(fmotherSolid);
125   return msol->GetOuterRadiusMinusZ() - msol->    132   return msol->GetOuterRadiusMinusZ() - msol->GetInnerRadiusMinusZ();
126 }                                                 133 }
127                                                   134 
128 //--------------------------------------------    135 //--------------------------------------------------------------------------
129 void                                              136 void
130 G4ParameterisationConsRho::                       137 G4ParameterisationConsRho::
131 ComputeTransformation( const G4int, G4VPhysica    138 ComputeTransformation( const G4int, G4VPhysicalVolume *physVol ) const
132 {                                                 139 {
133   //----- translation                             140   //----- translation 
134   G4ThreeVector origin(0.,0.,0.);                 141   G4ThreeVector origin(0.,0.,0.); 
135   //----- set translation                         142   //----- set translation 
136   physVol->SetTranslation( origin );              143   physVol->SetTranslation( origin );
137                                                   144 
138   //----- calculate rotation matrix: unit         145   //----- calculate rotation matrix: unit
139                                                   146 
140 #ifdef G4DIVDEBUG                                 147 #ifdef G4DIVDEBUG
141   if( verbose >= 2 )                              148   if( verbose >= 2 )
142   {                                               149   {
143     G4cout <<  " G4ParameterisationConsRho " <    150     G4cout <<  " G4ParameterisationConsRho " << G4endl
144            << " Offset: " << foffset              151            << " Offset: " << foffset
145            << " - Width: " << fwidth << G4endl    152            << " - Width: " << fwidth << G4endl;
146   }                                               153   }
147 #endif                                            154 #endif
148                                                   155 
149   ChangeRotMatrix( physVol );                     156   ChangeRotMatrix( physVol );
150                                                   157 
151 #ifdef G4DIVDEBUG                                 158 #ifdef G4DIVDEBUG
152   if( verbose >= 2 )                              159   if( verbose >= 2 )
153   {                                               160   {
154     G4cout << std::setprecision(8) << " G4Para    161     G4cout << std::setprecision(8) << " G4ParameterisationConsRho" << G4endl
155            << " Position: " << origin << " - W    162            << " Position: " << origin << " - Width: " << fwidth
156            << " - Axis: " << faxis  << G4endl;    163            << " - Axis: " << faxis  << G4endl;
157   }                                               164   }
158 #endif                                            165 #endif
159 }                                                 166 }
160                                                   167 
161 //--------------------------------------------    168 //--------------------------------------------------------------------------
162 void                                              169 void
163 G4ParameterisationConsRho::                       170 G4ParameterisationConsRho::
164 ComputeDimensions( G4Cons& cons, const G4int c    171 ComputeDimensions( G4Cons& cons, const G4int copyNo,
165                    const G4VPhysicalVolume* )     172                    const G4VPhysicalVolume* ) const
166 {                                                 173 {
167   auto msol = (G4Cons*)(fmotherSolid);         << 174   G4Cons* msol = (G4Cons*)(fmotherSolid);
168                                                   175 
169   G4double pRMin1 = msol->GetInnerRadiusMinusZ << 176   G4double pRMin1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * copyNo;
170   G4double pRMax1 = msol->GetInnerRadiusMinusZ << 177   G4double pRMax1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * (copyNo+1);
171                                                   178  
172   //width at Z Plus                               179   //width at Z Plus
173   //- G4double fwidthPlus =                       180   //- G4double fwidthPlus =
174   //   fwidth * ( msol->GetOuterRadiusPlusZ()/    181   //   fwidth * ( msol->GetOuterRadiusPlusZ()/ msol->GetInnerRadiusPlusZ())
175   //-         / ( msol->GetOuterRadiusMinusZ()    182   //-         / ( msol->GetOuterRadiusMinusZ() - msol->GetInnerRadiusMinusZ());
176   G4double fwidthPlus = CalculateWidth( msol->    183   G4double fwidthPlus = CalculateWidth( msol->GetOuterRadiusPlusZ()
177                            - msol->GetInnerRad    184                            - msol->GetInnerRadiusPlusZ(), fnDiv, foffset );
178   G4double pRMin2 = msol->GetInnerRadiusPlusZ(    185   G4double pRMin2 = msol->GetInnerRadiusPlusZ()
179                   + foffset + fwidthPlus * cop    186                   + foffset + fwidthPlus * copyNo;
180   G4double pRMax2 = msol->GetInnerRadiusPlusZ(    187   G4double pRMax2 = msol->GetInnerRadiusPlusZ()
181                   + foffset + fwidthPlus * (co    188                   + foffset + fwidthPlus * (copyNo+1);
182   G4double pDz = msol->GetZHalfLength();          189   G4double pDz = msol->GetZHalfLength();
183                                                   190 
184   G4double d_half_gap = fhgap * pRMax2 / pRMax    191   G4double d_half_gap = fhgap * pRMax2 / pRMax1;
185   //- already rotated  double pSR = foffset +     192   //- already rotated  double pSR = foffset + copyNo*fwidth;
186   G4double pSPhi = msol->GetStartPhiAngle();      193   G4double pSPhi = msol->GetStartPhiAngle();
187   G4double pDPhi = msol->GetDeltaPhiAngle();;     194   G4double pDPhi = msol->GetDeltaPhiAngle();;
188                                                   195 
189   cons.SetInnerRadiusMinusZ( pRMin1 + fhgap );    196   cons.SetInnerRadiusMinusZ( pRMin1 + fhgap );
190   cons.SetOuterRadiusMinusZ( pRMax1 - fhgap );    197   cons.SetOuterRadiusMinusZ( pRMax1 - fhgap );
191   cons.SetInnerRadiusPlusZ( pRMin2 + d_half_ga    198   cons.SetInnerRadiusPlusZ( pRMin2 + d_half_gap );
192   cons.SetOuterRadiusPlusZ( pRMax2 - d_half_ga    199   cons.SetOuterRadiusPlusZ( pRMax2 - d_half_gap );
193   cons.SetZHalfLength( pDz );                     200   cons.SetZHalfLength( pDz );
194   cons.SetStartPhiAngle( pSPhi, false );          201   cons.SetStartPhiAngle( pSPhi, false );
195   cons.SetDeltaPhiAngle( pDPhi );                 202   cons.SetDeltaPhiAngle( pDPhi );
196                                                   203 
197 #ifdef G4DIVDEBUG                                 204 #ifdef G4DIVDEBUG
198   if( verbose >= 2 )                              205   if( verbose >= 2 )
199   {                                               206   {
200     G4cout << " G4ParameterisationConsRho::Com    207     G4cout << " G4ParameterisationConsRho::ComputeDimensions()" << G4endl
201            << " pRMin: " << pRMin1 << " - pRMa    208            << " pRMin: " << pRMin1 << " - pRMax: " << pRMax1 << G4endl;
202     if( verbose >= 4 ) cons.DumpInfo();           209     if( verbose >= 4 ) cons.DumpInfo();
203   }                                               210   }
204 #endif                                            211 #endif
205 }                                                 212 }
206                                                   213 
207 //--------------------------------------------    214 //--------------------------------------------------------------------------
208 G4ParameterisationConsPhi::                       215 G4ParameterisationConsPhi::
209 G4ParameterisationConsPhi( EAxis axis, G4int n    216 G4ParameterisationConsPhi( EAxis axis, G4int nDiv,
210                            G4double width, G4d    217                            G4double width, G4double offset,
211                            G4VSolid* msolid, D    218                            G4VSolid* msolid, DivisionType divType )
212   :  G4VParameterisationCons( axis, nDiv, widt    219   :  G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
213 {                                                 220 { 
214   CheckParametersValidity();                      221   CheckParametersValidity();
215   SetType( "DivisionConsPhi" );                   222   SetType( "DivisionConsPhi" );
216                                                   223 
217   auto msol = (G4Cons*)(fmotherSolid);         << 224   G4Cons* msol = (G4Cons*)(fmotherSolid);
218   if( divType == DivWIDTH )                       225   if( divType == DivWIDTH )
219   {                                               226   {
220     fnDiv = CalculateNDiv( msol->GetDeltaPhiAn    227     fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
221   }                                               228   }
222   else if( divType == DivNDIV )                   229   else if( divType == DivNDIV )
223   {                                               230   {
224     fwidth = CalculateWidth( msol->GetDeltaPhi    231     fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
225   }                                               232   }
226                                                   233 
227 #ifdef G4DIVDEBUG                                 234 #ifdef G4DIVDEBUG
228   if( verbose >= 1 )                              235   if( verbose >= 1 )
229   {                                               236   {
230     G4cout << " G4ParameterisationConsPhi no d    237     G4cout << " G4ParameterisationConsPhi no divisions " << fnDiv << " = "
231            << nDiv << G4endl                      238            << nDiv << G4endl
232            << " Offset " << foffset << " = " <    239            << " Offset " << foffset << " = " << offset << G4endl
233            << " Width " << fwidth << " = " <<     240            << " Width " << fwidth << " = " << width << G4endl;
234   }                                               241   }
235 #endif                                            242 #endif
236 }                                                 243 }
237                                                   244 
238 //--------------------------------------------    245 //--------------------------------------------------------------------------
239 G4ParameterisationConsPhi::~G4Parameterisation << 246 G4ParameterisationConsPhi::~G4ParameterisationConsPhi()
                                                   >> 247 {
                                                   >> 248 }
240                                                   249 
241 //--------------------------------------------    250 //------------------------------------------------------------------------
242 G4double G4ParameterisationConsPhi::GetMaxPara    251 G4double G4ParameterisationConsPhi::GetMaxParameter() const
243 {                                                 252 {
244   auto msol = (G4Cons*)(fmotherSolid);         << 253   G4Cons* msol = (G4Cons*)(fmotherSolid);
245   return msol->GetDeltaPhiAngle();                254   return msol->GetDeltaPhiAngle();
246 }                                                 255 }
247                                                   256 
248 //--------------------------------------------    257 //--------------------------------------------------------------------------
249 void                                              258 void
250 G4ParameterisationConsPhi::                       259 G4ParameterisationConsPhi::
251 ComputeTransformation( const G4int copyNo, G4V    260 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
252 {                                                 261 {
253   //----- translation                             262   //----- translation 
254   G4ThreeVector origin(0.,0.,0.);                 263   G4ThreeVector origin(0.,0.,0.); 
255   //----- set translation                         264   //----- set translation 
256   physVol->SetTranslation( origin );              265   physVol->SetTranslation( origin );
257                                                   266 
258   //----- calculate rotation matrix (so that a    267   //----- calculate rotation matrix (so that all volumes point to the centre)
259   G4double posi = foffset  + copyNo*fwidth;       268   G4double posi = foffset  + copyNo*fwidth;
260                                                   269 
261 #ifdef G4DIVDEBUG                                 270 #ifdef G4DIVDEBUG
262   if( verbose >= 2 )                              271   if( verbose >= 2 )
263   {                                               272   {
264     G4cout << " G4ParameterisationConsPhi - po << 273     G4cout << " G4ParameterisationConsPhi - position: " << posi/deg << G4endl
265            << " Origin: " << origin << " copyN    274            << " Origin: " << origin << " copyNo: " << copyNo
266            << " - foffset: " << foffset/CLHEP: << 275            << " - foffset: " << foffset/deg
267            << " - fwidth: " << fwidth/CLHEP::d << 276            << " - fwidth: " << fwidth/deg << G4endl
268            << " - Axis: " << faxis << G4endl;     277            << " - Axis: " << faxis << G4endl;
269   }                                               278   }
270 #endif                                            279 #endif
271                                                   280 
272   ChangeRotMatrix( physVol, -posi );              281   ChangeRotMatrix( physVol, -posi );
273 }                                                 282 }
274                                                   283 
275 //--------------------------------------------    284 //--------------------------------------------------------------------------
276 void                                              285 void
277 G4ParameterisationConsPhi::                       286 G4ParameterisationConsPhi::
278 ComputeDimensions( G4Cons& cons, const G4int,     287 ComputeDimensions( G4Cons& cons, const G4int,
279                    const G4VPhysicalVolume* )     288                    const G4VPhysicalVolume* ) const
280 {                                                 289 {
281   auto msol = (G4Cons*)(fmotherSolid);         << 290   G4Cons* msol = (G4Cons*)(fmotherSolid);
282                                                   291 
283   G4double pRMin1 = msol->GetInnerRadiusMinusZ    292   G4double pRMin1 = msol->GetInnerRadiusMinusZ();
284   G4double pRMax1 = msol->GetOuterRadiusMinusZ    293   G4double pRMax1 = msol->GetOuterRadiusMinusZ();
285   G4double pRMin2 = msol->GetInnerRadiusPlusZ(    294   G4double pRMin2 = msol->GetInnerRadiusPlusZ();
286   G4double pRMax2 = msol->GetOuterRadiusPlusZ(    295   G4double pRMax2 = msol->GetOuterRadiusPlusZ();
287   G4double pDz = msol->GetZHalfLength();          296   G4double pDz = msol->GetZHalfLength();
288                                                   297 
289   //- already rotated  double pSPhi = foffset     298   //- already rotated  double pSPhi = foffset + copyNo*fwidth;
290   G4double pSPhi = foffset + msol->GetStartPhi    299   G4double pSPhi = foffset + msol->GetStartPhiAngle() + fhgap;
291   G4double pDPhi = fwidth - 2.*fhgap;             300   G4double pDPhi = fwidth - 2.*fhgap;
292                                                   301 
293   cons.SetInnerRadiusMinusZ( pRMin1 );            302   cons.SetInnerRadiusMinusZ( pRMin1 );
294   cons.SetOuterRadiusMinusZ( pRMax1 );            303   cons.SetOuterRadiusMinusZ( pRMax1 );
295   cons.SetInnerRadiusPlusZ( pRMin2 );             304   cons.SetInnerRadiusPlusZ( pRMin2 );
296   cons.SetOuterRadiusPlusZ( pRMax2 );             305   cons.SetOuterRadiusPlusZ( pRMax2 );
297   cons.SetZHalfLength( pDz );                     306   cons.SetZHalfLength( pDz );
298   cons.SetStartPhiAngle( pSPhi, false );          307   cons.SetStartPhiAngle( pSPhi, false );
299   cons.SetDeltaPhiAngle( pDPhi );                 308   cons.SetDeltaPhiAngle( pDPhi );
300                                                   309 
301 #ifdef G4DIVDEBUG                                 310 #ifdef G4DIVDEBUG
302   if( verbose >= 2 )                              311   if( verbose >= 2 )
303   {                                               312   {
304     G4cout << " G4ParameterisationConsPhi::Com    313     G4cout << " G4ParameterisationConsPhi::ComputeDimensions" << G4endl
305            << " pSPhi: " << pSPhi << " - pDPhi    314            << " pSPhi: " << pSPhi << " - pDPhi: " << pDPhi << G4endl;
306     if( verbose >= 4 ) cons.DumpInfo();           315     if( verbose >= 4 ) cons.DumpInfo();
307   }                                               316   }
308 #endif                                            317 #endif
309 }                                                 318 }
310                                                   319 
311 //--------------------------------------------    320 //--------------------------------------------------------------------------
312 G4ParameterisationConsZ::                         321 G4ParameterisationConsZ::
313 G4ParameterisationConsZ( EAxis axis, G4int nDi    322 G4ParameterisationConsZ( EAxis axis, G4int nDiv,
314                          G4double width, G4dou    323                          G4double width, G4double offset,
315                          G4VSolid* msolid, Div    324                          G4VSolid* msolid, DivisionType divType )
316   :  G4VParameterisationCons( axis, nDiv, widt    325   :  G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
317 {                                                 326 { 
318   CheckParametersValidity();                      327   CheckParametersValidity();
319   SetType( "DivisionConsZ" );                     328   SetType( "DivisionConsZ" );
320                                                   329 
321   auto msol = (G4Cons*)(fmotherSolid);         << 330   G4Cons* msol = (G4Cons*)(fmotherSolid);
322   if( divType == DivWIDTH )                       331   if( divType == DivWIDTH )
323   {                                               332   {
324     fnDiv = CalculateNDiv( 2*msol->GetZHalfLen    333     fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
325   }                                               334   }
326   else if( divType == DivNDIV )                   335   else if( divType == DivNDIV )
327   {                                               336   {
328     fwidth = CalculateWidth( 2*msol->GetZHalfL    337     fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
329   }                                               338   }
330                                                   339 
331 #ifdef G4DIVDEBUG                                 340 #ifdef G4DIVDEBUG
332   if( verbose >= 1 )                              341   if( verbose >= 1 )
333   {                                               342   {
334     G4cout << " G4ParameterisationConsZ: # div    343     G4cout << " G4ParameterisationConsZ: # divisions " << fnDiv << " = "
335            << nDiv << G4endl                      344            << nDiv << G4endl
336            << " Offset " << foffset << " = " <    345            << " Offset " << foffset << " = " << offset << G4endl
337            << " Width " << fwidth << " = " <<     346            << " Width " << fwidth << " = " << width << G4endl
338            << " - Axis: " << faxis << G4endl;     347            << " - Axis: " << faxis << G4endl;
339   }                                               348   }
340 #endif                                            349 #endif
341 }                                                 350 }
342                                                   351 
343 //--------------------------------------------    352 //--------------------------------------------------------------------------
344 G4ParameterisationConsZ::~G4ParameterisationCo << 353 G4ParameterisationConsZ::~G4ParameterisationConsZ()
                                                   >> 354 {
                                                   >> 355 }
345                                                   356 
346 //--------------------------------------------    357 //------------------------------------------------------------------------
347 G4double G4ParameterisationConsZ::GetMaxParame    358 G4double G4ParameterisationConsZ::GetMaxParameter() const
348 {                                                 359 {
349   auto msol = (G4Cons*)(fmotherSolid);         << 360   G4Cons* msol = (G4Cons*)(fmotherSolid);
350   return 2*msol->GetZHalfLength();                361   return 2*msol->GetZHalfLength();
351 }                                                 362 }
352                                                   363 
353 //--------------------------------------------    364 //--------------------------------------------------------------------------
354 void                                              365 void
355 G4ParameterisationConsZ::                         366 G4ParameterisationConsZ::
356 ComputeTransformation( const G4int copyNo, G4V    367 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
357 {                                                 368 {
358   //----- set translation: along Z axis           369   //----- set translation: along Z axis
359   auto motherCons = (G4Cons*)(GetMotherSolid() << 370   G4Cons* motherCons = (G4Cons*)(GetMotherSolid());
360   G4double posi = - motherCons->GetZHalfLength    371   G4double posi = - motherCons->GetZHalfLength() + OffsetZ()
361                   + fwidth/2 + copyNo*fwidth;     372                   + fwidth/2 + copyNo*fwidth;
362   G4ThreeVector origin(0.,0.,posi);               373   G4ThreeVector origin(0.,0.,posi); 
363   physVol->SetTranslation( origin );              374   physVol->SetTranslation( origin );
364                                                   375 
365   //----- calculate rotation matrix: unit         376   //----- calculate rotation matrix: unit
366                                                   377 
367 #ifdef G4DIVDEBUG                                 378 #ifdef G4DIVDEBUG
368   if( verbose >= 2 )                              379   if( verbose >= 2 )
369   {                                               380   {
370     G4cout << " G4ParameterisationConsZ::Compu    381     G4cout << " G4ParameterisationConsZ::ComputeTransformation()" << G4endl
371            << " Origin: " << origin << " - cop    382            << " Origin: " << origin << " - copyNo: " << copyNo << G4endl
372            << " foffset: " << foffset << " - f    383            << " foffset: " << foffset << " - fwidth: " << fwidth
373            << G4endl;                             384            << G4endl;
374   }                                               385   }
375 #endif                                            386 #endif
376                                                   387 
377   ChangeRotMatrix( physVol );                     388   ChangeRotMatrix( physVol );
378 }                                                 389 }
379                                                   390 
380                                                   391 
381 //--------------------------------------------    392 //--------------------------------------------------------------------------
382 void                                              393 void
383 G4ParameterisationConsZ::                         394 G4ParameterisationConsZ::
384 ComputeDimensions( G4Cons& cons, const G4int c    395 ComputeDimensions( G4Cons& cons, const G4int copyNo,
385                    const G4VPhysicalVolume* )     396                    const G4VPhysicalVolume* ) const
386 {                                                 397 {
387   auto msol = (G4Cons*)(fmotherSolid);         << 398   G4Cons* msol = (G4Cons*)(fmotherSolid);
388                                                   399 
389   G4double mHalfLength = msol->GetZHalfLength(    400   G4double mHalfLength = msol->GetZHalfLength() - fhgap;
390   G4double aRInner = (msol->GetInnerRadiusPlus    401   G4double aRInner = (msol->GetInnerRadiusPlusZ()
391                    - msol->GetInnerRadiusMinus    402                    - msol->GetInnerRadiusMinusZ()) / (2*mHalfLength);
392   G4double bRInner = (msol->GetInnerRadiusPlus    403   G4double bRInner = (msol->GetInnerRadiusPlusZ()
393                    + msol->GetInnerRadiusMinus    404                    + msol->GetInnerRadiusMinusZ()) / 2;
394   G4double aROuter = (msol->GetOuterRadiusPlus    405   G4double aROuter = (msol->GetOuterRadiusPlusZ()
395                    - msol->GetOuterRadiusMinus    406                    - msol->GetOuterRadiusMinusZ()) / (2*mHalfLength);
396   G4double bROuter = (msol->GetOuterRadiusPlus    407   G4double bROuter = (msol->GetOuterRadiusPlusZ()
397                    + msol->GetOuterRadiusMinus    408                    + msol->GetOuterRadiusMinusZ()) / 2;
398   G4double xMinusZ = -mHalfLength + OffsetZ()     409   G4double xMinusZ = -mHalfLength + OffsetZ() + fwidth*copyNo + fhgap;
399   G4double xPlusZ  = -mHalfLength + OffsetZ()     410   G4double xPlusZ  = -mHalfLength + OffsetZ() + fwidth*(copyNo+1) - fhgap;
400   cons.SetInnerRadiusMinusZ( aRInner * xMinusZ    411   cons.SetInnerRadiusMinusZ( aRInner * xMinusZ + bRInner );
401   cons.SetOuterRadiusMinusZ( aROuter * xMinusZ    412   cons.SetOuterRadiusMinusZ( aROuter * xMinusZ + bROuter );
402   cons.SetInnerRadiusPlusZ( aRInner * xPlusZ +    413   cons.SetInnerRadiusPlusZ( aRInner * xPlusZ + bRInner );
403   cons.SetOuterRadiusPlusZ( aROuter * xPlusZ +    414   cons.SetOuterRadiusPlusZ( aROuter * xPlusZ + bROuter );
404                                                   415  
405   G4double pDz = fwidth / 2. - fhgap;             416   G4double pDz = fwidth / 2. - fhgap;
406   G4double pSPhi = msol->GetStartPhiAngle();      417   G4double pSPhi = msol->GetStartPhiAngle();
407   G4double pDPhi = msol->GetDeltaPhiAngle();      418   G4double pDPhi = msol->GetDeltaPhiAngle();
408                                                   419 
409   cons.SetZHalfLength( pDz );                     420   cons.SetZHalfLength( pDz );
410   cons.SetStartPhiAngle( pSPhi, false );          421   cons.SetStartPhiAngle( pSPhi, false );
411   cons.SetDeltaPhiAngle( pDPhi );                 422   cons.SetDeltaPhiAngle( pDPhi );
412                                                   423 
413 #ifdef G4DIVDEBUG                                 424 #ifdef G4DIVDEBUG
414   if( verbose >= 2 )                              425   if( verbose >= 2 )
415   {                                               426   {
416     G4cout << " G4ParameterisationConsZ::Compu    427     G4cout << " G4ParameterisationConsZ::ComputeDimensions()" << G4endl
417            << " pDz: " << pDz << G4endl;          428            << " pDz: " << pDz << G4endl;
418     if( verbose >= 4 ) cons.DumpInfo();           429     if( verbose >= 4 ) cons.DumpInfo();
419   }                                               430   }
420 #endif                                            431 #endif
421                                                   432 
422 }                                                 433 }
423                                                   434