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