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