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 // G4ParameterisationPolyhedra[Rho/Phi/Z] impl << 26 // >> 27 // $Id: G4ParameterisationPolyhedra.cc 95287 2016-02-03 14:37:00Z gcosmo $ >> 28 // >> 29 // class G4ParameterisationPolyhedra Implementation file 27 // 30 // 28 // 14.10.03 - P.Arce, Initial version 31 // 14.10.03 - P.Arce, Initial version 29 // 08.04.04 - I.Hrivnacova, Implemented reflec 32 // 08.04.04 - I.Hrivnacova, Implemented reflection 30 // ------------------------------------------- 33 // -------------------------------------------------------------------- 31 34 32 #include "G4ParameterisationPolyhedra.hh" 35 #include "G4ParameterisationPolyhedra.hh" 33 36 34 #include <iomanip> 37 #include <iomanip> 35 #include "G4PhysicalConstants.hh" 38 #include "G4PhysicalConstants.hh" 36 #include "G4ThreeVector.hh" 39 #include "G4ThreeVector.hh" 37 #include "G4GeometryTolerance.hh" 40 #include "G4GeometryTolerance.hh" 38 #include "G4RotationMatrix.hh" 41 #include "G4RotationMatrix.hh" 39 #include "G4VPhysicalVolume.hh" 42 #include "G4VPhysicalVolume.hh" 40 #include "G4LogicalVolume.hh" 43 #include "G4LogicalVolume.hh" 41 #include "G4ReflectedSolid.hh" 44 #include "G4ReflectedSolid.hh" 42 #include "G4Polyhedra.hh" 45 #include "G4Polyhedra.hh" 43 46 44 //-------------------------------------------- 47 //-------------------------------------------------------------------------- 45 G4VParameterisationPolyhedra:: 48 G4VParameterisationPolyhedra:: 46 G4VParameterisationPolyhedra( EAxis axis, G4in 49 G4VParameterisationPolyhedra( EAxis axis, G4int nDiv, G4double width, 47 G4double offset, 50 G4double offset, G4VSolid* msolid, 48 DivisionType div 51 DivisionType divType ) 49 : G4VDivisionParameterisation( axis, nDiv, 52 : G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid ) 50 { 53 { 51 std::ostringstream message; 54 std::ostringstream message; 52 /* #ifdef G4MULTITHREADED << 55 #ifdef G4MULTITHREADED 53 message << "Divisions for G4Polyhedra curren 56 message << "Divisions for G4Polyhedra currently NOT supported in MT-mode." 54 << G4endl 57 << G4endl 55 << "Sorry! Solid: " << msolid->GetNa 58 << "Sorry! Solid: " << msolid->GetName(); 56 G4Exception("G4VParameterisationPolyhedra::G 59 G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()", 57 "GeomDiv0001", FatalException, m 60 "GeomDiv0001", FatalException, message); 58 #endif */ << 61 #endif 59 62 60 auto msol = (G4Polyhedra*)(msolid); << 63 G4Polyhedra* msol = (G4Polyhedra*)(msolid); 61 if ((msolid->GetEntityType() != "G4Reflected 64 if ((msolid->GetEntityType() != "G4ReflectedSolid") && (msol->IsGeneric())) 62 { 65 { 63 message << "Generic construct for G4Polyhe 66 message << "Generic construct for G4Polyhedra NOT supported." << G4endl 64 << "Sorry! Solid: " << msol->GetNa 67 << "Sorry! Solid: " << msol->GetName(); 65 G4Exception("G4VParameterisationPolyhedra: 68 G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()", 66 "GeomDiv0001", FatalException, 69 "GeomDiv0001", FatalException, message); 67 } 70 } 68 if (msolid->GetEntityType() == "G4ReflectedS 71 if (msolid->GetEntityType() == "G4ReflectedSolid") 69 { 72 { 70 // Get constituent solid << 73 // Get constituent solid 71 // << 72 G4VSolid* mConstituentSolid 74 G4VSolid* mConstituentSolid 73 = ((G4ReflectedSolid*)msolid)->GetConst 75 = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid(); 74 msol = (G4Polyhedra*)(mConstituentSolid); 76 msol = (G4Polyhedra*)(mConstituentSolid); 75 77 76 // Get parameters 78 // Get parameters 77 // << 79 G4int nofSides = msol->GetOriginalParameters()->numSide; 78 G4int nofSides = msol->GetOriginalParamete << 80 G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes; 79 G4int nofZplanes = msol->GetOriginalParame << 81 G4double* zValues = msol->GetOriginalParameters()->Z_values; 80 G4double* zValues = msol->GetOriginalParam << 82 G4double* rminValues = msol->GetOriginalParameters()->Rmin; 81 G4double* rminValues = msol->GetOriginalPa << 83 G4double* rmaxValues = msol->GetOriginalParameters()->Rmax; 82 G4double* rmaxValues = msol->GetOriginalPa << 84 83 << 85 // Invert z values, 84 // Invert z values, convert radius paramet << 86 // convert radius parameters 85 // << 87 G4double* rminValues2 = new G4double[nofZplanes]; 86 auto rminValues2 = new G4double[nofZplanes << 88 G4double* rmaxValues2 = new G4double[nofZplanes]; 87 auto rmaxValues2 = new G4double[nofZplanes << 89 G4double* zValuesRefl = new G4double[nofZplanes]; 88 auto zValuesRefl = new G4double[nofZplanes << 90 for (G4int i=0; i<nofZplanes; i++) 89 for (G4int i=0; i<nofZplanes; ++i) << 90 { 91 { 91 rminValues2[i] = rminValues[i] * Convert 92 rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol); 92 rmaxValues2[i] = rmaxValues[i] * Convert 93 rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol); 93 zValuesRefl[i] = - zValues[i]; 94 zValuesRefl[i] = - zValues[i]; 94 } 95 } 95 96 96 auto newSolid << 97 G4Polyhedra* newSolid 97 = new G4Polyhedra(msol->GetName(), 98 = new G4Polyhedra(msol->GetName(), 98 msol->GetStartPhi(), 99 msol->GetStartPhi(), 99 msol->GetEndPhi() - ms 100 msol->GetEndPhi() - msol->GetStartPhi(), 100 nofSides, 101 nofSides, 101 nofZplanes, zValuesRef 102 nofZplanes, zValuesRefl, rminValues2, rmaxValues2); 102 103 103 delete [] rminValues2; 104 delete [] rminValues2; 104 delete [] rmaxValues2; 105 delete [] rmaxValues2; 105 delete [] zValuesRefl; 106 delete [] zValuesRefl; 106 107 107 msol = newSolid; 108 msol = newSolid; 108 fmotherSolid = newSolid; 109 fmotherSolid = newSolid; 109 fReflectedSolid = true; 110 fReflectedSolid = true; 110 fDeleteSolid = true; 111 fDeleteSolid = true; 111 } 112 } 112 } 113 } 113 114 114 //-------------------------------------------- 115 //------------------------------------------------------------------------ 115 G4VParameterisationPolyhedra::~G4VParameterisa << 116 G4VParameterisationPolyhedra::~G4VParameterisationPolyhedra() >> 117 { >> 118 } 116 119 117 //-------------------------------------------- 120 //-------------------------------------------------------------------------- 118 G4double 121 G4double 119 G4VParameterisationPolyhedra:: 122 G4VParameterisationPolyhedra:: 120 ConvertRadiusFactor(const G4Polyhedra& phedra) 123 ConvertRadiusFactor(const G4Polyhedra& phedra) const 121 { 124 { 122 G4double phiTotal = phedra.GetEndPhi() - phe 125 G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi(); 123 G4int nofSides = phedra.GetOriginalParameter 126 G4int nofSides = phedra.GetOriginalParameters()->numSide; 124 127 125 if ( (phiTotal <=0) || (phiTotal > 128 if ( (phiTotal <=0) || (phiTotal > 126 2*pi+G4GeometryTolerance::GetInstance( 129 2*pi+G4GeometryTolerance::GetInstance()->GetAngularTolerance()) ) 127 { phiTotal = 2*pi; } 130 { phiTotal = 2*pi; } 128 131 129 return std::cos(0.5*phiTotal/nofSides); 132 return std::cos(0.5*phiTotal/nofSides); 130 } 133 } 131 134 132 //-------------------------------------------- 135 //-------------------------------------------------------------------------- 133 G4ParameterisationPolyhedraRho:: 136 G4ParameterisationPolyhedraRho:: 134 G4ParameterisationPolyhedraRho( EAxis axis, G4 137 G4ParameterisationPolyhedraRho( EAxis axis, G4int nDiv, 135 G4double width, 138 G4double width, G4double offset, 136 G4VSolid* msoli 139 G4VSolid* msolid, DivisionType divType ) 137 : G4VParameterisationPolyhedra( axis, nDiv, 140 : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ) 138 { 141 { 139 142 140 CheckParametersValidity(); 143 CheckParametersValidity(); 141 SetType( "DivisionPolyhedraRho" ); 144 SetType( "DivisionPolyhedraRho" ); 142 145 143 auto msol = (G4Polyhedra*)(fmotherSolid); << 146 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 144 G4PolyhedraHistorical* original_pars = msol- 147 G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters(); 145 148 146 if( divType == DivWIDTH ) 149 if( divType == DivWIDTH ) 147 { 150 { 148 fnDiv = CalculateNDiv( original_pars->Rmax 151 fnDiv = CalculateNDiv( original_pars->Rmax[0] 149 - original_pars->Rmin 152 - original_pars->Rmin[0], width, offset ); 150 } 153 } 151 else if( divType == DivNDIV ) 154 else if( divType == DivNDIV ) 152 { 155 { 153 fwidth = CalculateWidth( original_pars->Rm 156 fwidth = CalculateWidth( original_pars->Rmax[0] 154 - original_pars->Rm 157 - original_pars->Rmin[0], nDiv, offset ); 155 } 158 } 156 159 157 #ifdef G4DIVDEBUG 160 #ifdef G4DIVDEBUG 158 if( verbose >= 1 ) 161 if( verbose >= 1 ) 159 { 162 { 160 G4cout << " G4ParameterisationPolyhedraRho 163 G4cout << " G4ParameterisationPolyhedraRho - # divisions " << fnDiv 161 << " = " << nDiv << G4endl 164 << " = " << nDiv << G4endl 162 << " Offset " << foffset << " = " < 165 << " Offset " << foffset << " = " << offset << G4endl 163 << " Width " << fwidth << " = " << 166 << " Width " << fwidth << " = " << width << G4endl; 164 } 167 } 165 #endif 168 #endif 166 } 169 } 167 170 168 //-------------------------------------------- 171 //------------------------------------------------------------------------ 169 G4ParameterisationPolyhedraRho::~G4Parameteris << 172 G4ParameterisationPolyhedraRho::~G4ParameterisationPolyhedraRho() >> 173 { >> 174 } 170 175 171 //-------------------------------------------- 176 //--------------------------------------------------------------------- 172 void G4ParameterisationPolyhedraRho::CheckPara 177 void G4ParameterisationPolyhedraRho::CheckParametersValidity() 173 { 178 { 174 G4VDivisionParameterisation::CheckParameters 179 G4VDivisionParameterisation::CheckParametersValidity(); 175 180 176 auto msol = (G4Polyhedra*)(fmotherSolid); << 181 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 177 182 178 if( fDivisionType == DivNDIVandWIDTH || fDiv 183 if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) 179 { 184 { 180 std::ostringstream message; 185 std::ostringstream message; 181 message << "In solid " << msol->GetName() 186 message << "In solid " << msol->GetName() << G4endl 182 << "Division along R will be done 187 << "Division along R will be done with a width " 183 << "different for each solid secti 188 << "different for each solid section." << G4endl 184 << "WIDTH will not be used !"; 189 << "WIDTH will not be used !"; 185 G4Exception("G4ParameterisationPolyhedraRh 190 G4Exception("G4ParameterisationPolyhedraRho::CheckParametersValidity()", 186 "GeomDiv1001", JustWarning, me 191 "GeomDiv1001", JustWarning, message); 187 } 192 } 188 if( foffset != 0. ) 193 if( foffset != 0. ) 189 { 194 { 190 std::ostringstream message; 195 std::ostringstream message; 191 message << "In solid " << msol->GetName() 196 message << "In solid " << msol->GetName() << G4endl 192 << "Division along R will be done 197 << "Division along R will be done with a width " 193 << "different for each solid secti 198 << "different for each solid section." << G4endl 194 << "OFFSET will not be used !"; 199 << "OFFSET will not be used !"; 195 G4Exception("G4ParameterisationPolyhedraRh 200 G4Exception("G4ParameterisationPolyhedraRho::CheckParametersValidity()", 196 "GeomDiv1001", JustWarning, me 201 "GeomDiv1001", JustWarning, message); 197 } 202 } 198 } 203 } 199 204 200 //-------------------------------------------- 205 //------------------------------------------------------------------------ 201 G4double G4ParameterisationPolyhedraRho::GetMa 206 G4double G4ParameterisationPolyhedraRho::GetMaxParameter() const 202 { 207 { 203 auto msol = (G4Polyhedra*)(fmotherSolid); << 208 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 204 G4PolyhedraHistorical* original_pars = msol- 209 G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters(); 205 return original_pars->Rmax[0] - original_par 210 return original_pars->Rmax[0] - original_pars->Rmin[0]; 206 } 211 } 207 212 208 //-------------------------------------------- 213 //-------------------------------------------------------------------------- 209 void 214 void 210 G4ParameterisationPolyhedraRho:: 215 G4ParameterisationPolyhedraRho:: 211 ComputeTransformation( const G4int, G4VPhysica 216 ComputeTransformation( const G4int, G4VPhysicalVolume* physVol ) const 212 { 217 { 213 //----- translation 218 //----- translation 214 G4ThreeVector origin(0.,0.,0.); 219 G4ThreeVector origin(0.,0.,0.); 215 220 216 //----- set translation 221 //----- set translation 217 physVol->SetTranslation( origin ); 222 physVol->SetTranslation( origin ); 218 223 219 //----- calculate rotation matrix: unit 224 //----- calculate rotation matrix: unit 220 225 221 #ifdef G4DIVDEBUG 226 #ifdef G4DIVDEBUG 222 if( verbose >= 2 ) 227 if( verbose >= 2 ) 223 { 228 { 224 G4cout << " G4ParameterisationPolyhedraRho 229 G4cout << " G4ParameterisationPolyhedraRho " << G4endl 225 << " foffset: " << foffset/CLHEP::d << 230 << " foffset: " << foffset/deg 226 << " - fwidth: " << fwidth/CLHEP::d << 231 << " - fwidth: " << fwidth/deg << G4endl; 227 } 232 } 228 #endif 233 #endif 229 234 230 ChangeRotMatrix( physVol ); 235 ChangeRotMatrix( physVol ); 231 236 232 #ifdef G4DIVDEBUG 237 #ifdef G4DIVDEBUG 233 if( verbose >= 2 ) 238 if( verbose >= 2 ) 234 { 239 { 235 G4cout << std::setprecision(8) << " G4Para 240 G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraRho " 236 << G4endl 241 << G4endl 237 << " Position: " << origin 242 << " Position: " << origin 238 << " - Width: " << fwidth 243 << " - Width: " << fwidth 239 << " - Axis: " << faxis << G4endl; 244 << " - Axis: " << faxis << G4endl; 240 } 245 } 241 #endif 246 #endif 242 } 247 } 243 248 244 //-------------------------------------------- 249 //-------------------------------------------------------------------------- 245 void 250 void 246 G4ParameterisationPolyhedraRho:: 251 G4ParameterisationPolyhedraRho:: 247 ComputeDimensions( G4Polyhedra& phedra, const 252 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo, 248 const G4VPhysicalVolume* ) 253 const G4VPhysicalVolume* ) const 249 { 254 { 250 auto msol = (G4Polyhedra*)(fmotherSolid); << 255 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 251 256 252 G4PolyhedraHistorical* origparamMother = mso 257 G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 253 G4PolyhedraHistorical origparam( *origparamM 258 G4PolyhedraHistorical origparam( *origparamMother ); 254 G4int nZplanes = origparamMother->Num_z_plan 259 G4int nZplanes = origparamMother->Num_z_planes; 255 260 256 G4double width = 0.; 261 G4double width = 0.; 257 for( G4int ii = 0; ii < nZplanes; ++ii ) << 262 for( G4int ii = 0; ii < nZplanes; ii++ ) 258 { 263 { 259 width = CalculateWidth( origparamMother->R 264 width = CalculateWidth( origparamMother->Rmax[ii] 260 - origparamMother->R 265 - origparamMother->Rmin[ii], fnDiv, foffset ); 261 origparam.Rmin[ii] = origparamMother->Rmin 266 origparam.Rmin[ii] = origparamMother->Rmin[ii]+foffset+width*copyNo; 262 origparam.Rmax[ii] = origparamMother->Rmin 267 origparam.Rmax[ii] = origparamMother->Rmin[ii]+foffset+width*(copyNo+1); 263 } 268 } 264 269 265 phedra.SetOriginalParameters(&origparam); // 270 phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers 266 phedra.Reset(); // 271 phedra.Reset(); // reset to new solid parameters 267 272 268 #ifdef G4DIVDEBUG 273 #ifdef G4DIVDEBUG 269 if( verbose >= -2 ) 274 if( verbose >= -2 ) 270 { 275 { 271 G4cout << "G4ParameterisationPolyhedraRho: 276 G4cout << "G4ParameterisationPolyhedraRho::ComputeDimensions()" << G4endl 272 << "-- Parametrised phedra copy-num 277 << "-- Parametrised phedra copy-number: " << copyNo << G4endl; 273 phedra.DumpInfo(); 278 phedra.DumpInfo(); 274 } 279 } 275 #endif 280 #endif 276 } 281 } 277 282 278 //-------------------------------------------- 283 //-------------------------------------------------------------------------- 279 G4ParameterisationPolyhedraPhi:: 284 G4ParameterisationPolyhedraPhi:: 280 G4ParameterisationPolyhedraPhi( EAxis axis, G4 285 G4ParameterisationPolyhedraPhi( EAxis axis, G4int nDiv, 281 G4double width, 286 G4double width, G4double offset, 282 G4VSolid* msoli 287 G4VSolid* msolid, DivisionType divType ) 283 : G4VParameterisationPolyhedra( axis, nDiv, 288 : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ) 284 { 289 { 285 CheckParametersValidity(); 290 CheckParametersValidity(); 286 SetType( "DivisionPolyhedraPhi" ); 291 SetType( "DivisionPolyhedraPhi" ); 287 292 288 auto msol = (G4Polyhedra*)(fmotherSolid); << 293 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 289 G4double deltaPhi = msol->GetEndPhi() - msol 294 G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi(); 290 295 291 if( divType == DivWIDTH ) 296 if( divType == DivWIDTH ) 292 { 297 { 293 fnDiv = msol->GetNumSide(); 298 fnDiv = msol->GetNumSide(); 294 } 299 } 295 300 296 fwidth = CalculateWidth( deltaPhi, fnDiv, 0. 301 fwidth = CalculateWidth( deltaPhi, fnDiv, 0.0 ); 297 302 298 #ifdef G4DIVDEBUG 303 #ifdef G4DIVDEBUG 299 if( verbose >= 1 ) 304 if( verbose >= 1 ) 300 { 305 { 301 G4cout << " G4ParameterisationPolyhedraPhi 306 G4cout << " G4ParameterisationPolyhedraPhi - # divisions " << fnDiv 302 << " = " << nDiv << G4endl 307 << " = " << nDiv << G4endl 303 << " Offset " << foffset << " = " < 308 << " Offset " << foffset << " = " << offset << G4endl 304 << " Width " << fwidth << " = " << 309 << " Width " << fwidth << " = " << width << G4endl; 305 } 310 } 306 #endif 311 #endif 307 } 312 } 308 313 309 //-------------------------------------------- 314 //------------------------------------------------------------------------ 310 G4ParameterisationPolyhedraPhi::~G4Parameteris << 315 G4ParameterisationPolyhedraPhi::~G4ParameterisationPolyhedraPhi() >> 316 { >> 317 } 311 318 312 //-------------------------------------------- 319 //------------------------------------------------------------------------ 313 G4double G4ParameterisationPolyhedraPhi::GetMa 320 G4double G4ParameterisationPolyhedraPhi::GetMaxParameter() const 314 { 321 { 315 auto msol = (G4Polyhedra*)(fmotherSolid); << 322 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 316 return msol->GetEndPhi() - msol->GetStartPhi 323 return msol->GetEndPhi() - msol->GetStartPhi(); 317 } 324 } 318 325 319 //-------------------------------------------- 326 //--------------------------------------------------------------------- 320 void G4ParameterisationPolyhedraPhi::CheckPara 327 void G4ParameterisationPolyhedraPhi::CheckParametersValidity() 321 { 328 { 322 G4VDivisionParameterisation::CheckParameters 329 G4VDivisionParameterisation::CheckParametersValidity(); 323 330 324 auto msol = (G4Polyhedra*)(fmotherSolid); << 331 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 325 332 326 if( fDivisionType == DivNDIVandWIDTH || fDiv 333 if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) 327 { 334 { 328 std::ostringstream message; 335 std::ostringstream message; 329 message << "In solid " << msol->GetName() 336 message << "In solid " << msol->GetName() << G4endl 330 << " Division along PHI will be do 337 << " Division along PHI will be done splitting " 331 << "in the defined numSide." << G4 338 << "in the defined numSide." << G4endl 332 << "WIDTH will not be used !"; 339 << "WIDTH will not be used !"; 333 G4Exception("G4ParameterisationPolyhedraPh 340 G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()", 334 "GeomDiv1001", JustWarning, me 341 "GeomDiv1001", JustWarning, message); 335 } 342 } 336 if( foffset != 0. ) 343 if( foffset != 0. ) 337 { 344 { 338 std::ostringstream message; 345 std::ostringstream message; 339 message << "In solid " << msol->GetName() 346 message << "In solid " << msol->GetName() << G4endl 340 << "Division along PHI will be don 347 << "Division along PHI will be done splitting " 341 << "in the defined numSide." << G4 348 << "in the defined numSide." << G4endl 342 << "OFFSET will not be used !"; 349 << "OFFSET will not be used !"; 343 G4Exception("G4ParameterisationPolyhedraPh 350 G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()", 344 "GeomDiv1001", JustWarning, me 351 "GeomDiv1001", JustWarning, message); 345 } 352 } 346 353 347 G4PolyhedraHistorical* origparamMother = mso 354 G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 348 355 349 if( origparamMother->numSide != fnDiv && fD 356 if( origparamMother->numSide != fnDiv && fDivisionType != DivWIDTH) 350 { 357 { 351 std::ostringstream message; 358 std::ostringstream message; 352 message << "Configuration not supported." 359 message << "Configuration not supported." << G4endl 353 << "Division along PHI will be don 360 << "Division along PHI will be done splitting in the defined" 354 << G4endl 361 << G4endl 355 << "numSide, i.e, the number of di 362 << "numSide, i.e, the number of division would be :" 356 << origparamMother->numSide << " i 363 << origparamMother->numSide << " instead of " << fnDiv << " !"; 357 G4Exception("G4ParameterisationPolyhedraPh 364 G4Exception("G4ParameterisationPolyhedraPhi::CheckParametersValidity()", 358 "GeomDiv0001", FatalException, 365 "GeomDiv0001", FatalException, message); 359 } 366 } 360 } 367 } 361 368 362 //-------------------------------------------- 369 //-------------------------------------------------------------------------- 363 void 370 void 364 G4ParameterisationPolyhedraPhi:: 371 G4ParameterisationPolyhedraPhi:: 365 ComputeTransformation( const G4int copyNo, G4V << 372 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const 366 { 373 { 367 //----- translation 374 //----- translation 368 G4ThreeVector origin(0.,0.,0.); 375 G4ThreeVector origin(0.,0.,0.); 369 //----- set translation 376 //----- set translation 370 physVol->SetTranslation( origin ); 377 physVol->SetTranslation( origin ); 371 378 372 //----- calculate rotation matrix (so that a 379 //----- calculate rotation matrix (so that all volumes point to the centre) 373 G4double posi = copyNo*fwidth; 380 G4double posi = copyNo*fwidth; 374 381 375 #ifdef G4DIVDEBUG 382 #ifdef G4DIVDEBUG 376 if( verbose >= 2 ) 383 if( verbose >= 2 ) 377 { 384 { 378 G4cout << " G4ParameterisationPolyhedraPhi << 385 G4cout << " G4ParameterisationPolyhedraPhi - position: " << posi/deg 379 << G4endl 386 << G4endl 380 << " copyNo: " << copyNo 387 << " copyNo: " << copyNo 381 << " - fwidth: " << fwidth/CLHEP::d << 388 << " - fwidth: " << fwidth/deg << G4endl; 382 } 389 } 383 #endif 390 #endif 384 391 385 ChangeRotMatrix( physVol, -posi ); 392 ChangeRotMatrix( physVol, -posi ); 386 393 387 #ifdef G4DIVDEBUG 394 #ifdef G4DIVDEBUG 388 if( verbose >= 2 ) 395 if( verbose >= 2 ) 389 { 396 { 390 G4cout << std::setprecision(8) << " G4Para << 397 G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraPhi " << copyNo 391 << copyNo << G4endl << 398 << G4endl 392 << " Position: " << origin << " - W 399 << " Position: " << origin << " - Width: " << fwidth 393 << " - Axis: " << faxis << G4endl; 400 << " - Axis: " << faxis << G4endl; 394 } 401 } 395 #endif 402 #endif 396 } 403 } 397 404 398 //-------------------------------------------- 405 //-------------------------------------------------------------------------- 399 void 406 void 400 G4ParameterisationPolyhedraPhi:: 407 G4ParameterisationPolyhedraPhi:: 401 ComputeDimensions( G4Polyhedra& phedra, const 408 ComputeDimensions( G4Polyhedra& phedra, const G4int, 402 const G4VPhysicalVolume* ) 409 const G4VPhysicalVolume* ) const 403 { 410 { 404 auto msol = (G4Polyhedra*)(fmotherSolid); << 411 G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid); 405 412 406 G4PolyhedraHistorical* origparamMother = mso 413 G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 407 G4PolyhedraHistorical origparam( *origparamM 414 G4PolyhedraHistorical origparam( *origparamMother ); 408 415 409 origparam.numSide = 1; 416 origparam.numSide = 1; 410 origparam.Start_angle = origparamMother->Sta 417 origparam.Start_angle = origparamMother->Start_angle; 411 origparam.Opening_angle = fwidth; 418 origparam.Opening_angle = fwidth; 412 419 413 phedra.SetOriginalParameters(&origparam); / 420 phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers 414 phedra.Reset(); / 421 phedra.Reset(); // reset to new solid parameters 415 422 416 #ifdef G4DIVDEBUG 423 #ifdef G4DIVDEBUG 417 if( verbose >= 2 ) 424 if( verbose >= 2 ) 418 { 425 { 419 G4cout << "G4ParameterisationPolyhedraPhi: 426 G4cout << "G4ParameterisationPolyhedraPhi::ComputeDimensions():" << G4endl; 420 phedra.DumpInfo(); 427 phedra.DumpInfo(); 421 } 428 } 422 #endif 429 #endif 423 } 430 } 424 431 425 //-------------------------------------------- 432 //-------------------------------------------------------------------------- 426 G4ParameterisationPolyhedraZ:: 433 G4ParameterisationPolyhedraZ:: 427 G4ParameterisationPolyhedraZ( EAxis axis, G4in 434 G4ParameterisationPolyhedraZ( EAxis axis, G4int nDiv, 428 G4double width, G 435 G4double width, G4double offset, 429 G4VSolid* msolid, 436 G4VSolid* msolid, DivisionType divType ) 430 : G4VParameterisationPolyhedra( axis, nDiv, 437 : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ), >> 438 fNSegment(0), 431 fOrigParamMother(((G4Polyhedra*)fmotherSo 439 fOrigParamMother(((G4Polyhedra*)fmotherSolid)->GetOriginalParameters()) 432 { 440 { 433 CheckParametersValidity(); 441 CheckParametersValidity(); 434 SetType( "DivisionPolyhedraZ" ); 442 SetType( "DivisionPolyhedraZ" ); 435 443 436 if( divType == DivWIDTH ) 444 if( divType == DivWIDTH ) 437 { << 445 { 438 fnDiv = 446 fnDiv = 439 CalculateNDiv(fOrigParamMother->Z_values << 447 CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1] 440 - fOrigParamMother->Z_valu << 448 - fOrigParamMother->Z_values[0] , width, offset ); 441 } 449 } 442 else if( divType == DivNDIV ) 450 else if( divType == DivNDIV ) 443 { << 451 { 444 fwidth = 452 fwidth = 445 CalculateNDiv(fOrigParamMother->Z_values << 453 CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1] 446 - fOrigParamMother->Z_valu << 454 - fOrigParamMother->Z_values[0] , nDiv, offset ); 447 } 455 } 448 456 449 #ifdef G4DIVDEBUG 457 #ifdef G4DIVDEBUG 450 if( verbose >= 1 ) 458 if( verbose >= 1 ) 451 { << 459 { 452 G4cout << " G4ParameterisationPolyhedraZ - 460 G4cout << " G4ParameterisationPolyhedraZ - # divisions " << fnDiv << " = " 453 << nDiv << G4endl 461 << nDiv << G4endl 454 << " Offset " << foffset << " = " < 462 << " Offset " << foffset << " = " << offset << G4endl 455 << " Width " << fwidth << " = " << 463 << " Width " << fwidth << " = " << width << G4endl; 456 } 464 } 457 #endif 465 #endif 458 } 466 } 459 467 460 //-------------------------------------------- 468 //--------------------------------------------------------------------- 461 G4ParameterisationPolyhedraZ::~G4Parameterisat << 469 G4ParameterisationPolyhedraZ::~G4ParameterisationPolyhedraZ() >> 470 { >> 471 } 462 472 463 //-------------------------------------------- 473 //------------------------------------------------------------------------ 464 G4double G4ParameterisationPolyhedraZ::GetR(G4 474 G4double G4ParameterisationPolyhedraZ::GetR(G4double z, 465 G4d 475 G4double z1, G4double r1, 466 G4d 476 G4double z2, G4double r2) const 467 { 477 { 468 // Linear parameterisation: 478 // Linear parameterisation: 469 // r = az + b 479 // r = az + b 470 // a = (r1 - r2)/(z1-z2) 480 // a = (r1 - r2)/(z1-z2) 471 // b = r1 - a*z1 481 // b = r1 - a*z1 472 482 473 return (r1-r2)/(z1-z2)*z + ( r1 - (r1-r2)/(z 483 return (r1-r2)/(z1-z2)*z + ( r1 - (r1-r2)/(z1-z2)*z1 ) ; 474 } 484 } 475 485 476 //-------------------------------------------- 486 //------------------------------------------------------------------------ 477 G4double G4ParameterisationPolyhedraZ::GetRmin 487 G4double G4ParameterisationPolyhedraZ::GetRmin(G4double z, G4int nseg) const 478 { 488 { 479 // Get Rmin in the given z position for the gi 489 // Get Rmin in the given z position for the given polyhedra segment 480 490 481 return GetR(z, 491 return GetR(z, 482 fOrigParamMother->Z_values[nseg] 492 fOrigParamMother->Z_values[nseg], 483 fOrigParamMother->Rmin[nseg], 493 fOrigParamMother->Rmin[nseg], 484 fOrigParamMother->Z_values[nseg+ 494 fOrigParamMother->Z_values[nseg+1], 485 fOrigParamMother->Rmin[nseg+1]); 495 fOrigParamMother->Rmin[nseg+1]); 486 } 496 } 487 497 488 //-------------------------------------------- 498 //------------------------------------------------------------------------ 489 G4double G4ParameterisationPolyhedraZ::GetRmax 499 G4double G4ParameterisationPolyhedraZ::GetRmax(G4double z, G4int nseg) const 490 { 500 { 491 // Get Rmax in the given z position for the gi 501 // Get Rmax in the given z position for the given polyhedra segment 492 502 493 return GetR(z, 503 return GetR(z, 494 fOrigParamMother->Z_values[nseg] 504 fOrigParamMother->Z_values[nseg], 495 fOrigParamMother->Rmax[nseg], 505 fOrigParamMother->Rmax[nseg], 496 fOrigParamMother->Z_values[nseg+ 506 fOrigParamMother->Z_values[nseg+1], 497 fOrigParamMother->Rmax[nseg+1]); 507 fOrigParamMother->Rmax[nseg+1]); 498 } 508 } 499 509 500 //-------------------------------------------- 510 //------------------------------------------------------------------------ 501 G4double G4ParameterisationPolyhedraZ::GetMaxP 511 G4double G4ParameterisationPolyhedraZ::GetMaxParameter() const 502 { 512 { 503 return std::abs(fOrigParamMother->Z_values[f << 513 return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1] 504 -fOrigParamMother->Z_values[0 << 514 -fOrigParamMother->Z_values[0]); 505 } 515 } 506 516 507 //-------------------------------------------- 517 //--------------------------------------------------------------------- 508 void G4ParameterisationPolyhedraZ::CheckParame 518 void G4ParameterisationPolyhedraZ::CheckParametersValidity() 509 { 519 { 510 G4VDivisionParameterisation::CheckParameters 520 G4VDivisionParameterisation::CheckParametersValidity(); 511 521 512 // Division will be following the mother pol 522 // Division will be following the mother polyhedra segments 513 // << 523 if( fDivisionType == DivNDIV ) { 514 if( fDivisionType == DivNDIV ) << 524 if( fOrigParamMother->Num_z_planes-1 != fnDiv ) { 515 { << 516 if( fOrigParamMother->Num_z_planes-1 != fn << 517 { << 518 std::ostringstream message; 525 std::ostringstream message; 519 message << "Configuration not supported. 526 message << "Configuration not supported." << G4endl 520 << "Division along Z will be don 527 << "Division along Z will be done splitting in the defined" 521 << G4endl 528 << G4endl 522 << "Z planes, i.e, the number of 529 << "Z planes, i.e, the number of division would be :" 523 << fOrigParamMother->Num_z_plane 530 << fOrigParamMother->Num_z_planes-1 << " instead of " 524 << fnDiv << " !"; 531 << fnDiv << " !"; 525 G4Exception("G4ParameterisationPolyhedra 532 G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()", 526 "GeomDiv0001", FatalExceptio 533 "GeomDiv0001", FatalException, message); 527 } 534 } 528 } 535 } 529 536 530 // Division will be done within one polyhedr 537 // Division will be done within one polyhedra segment 531 // with applying given width and offset 538 // with applying given width and offset 532 // << 539 if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) { 533 if( fDivisionType == DivNDIVandWIDTH || fDiv << 534 { << 535 // Check if divided region does not span o 540 // Check if divided region does not span over more 536 // than one z segment 541 // than one z segment 537 542 538 G4int isegstart = -1; // number of the se 543 G4int isegstart = -1; // number of the segment containing start position 539 G4int isegend = -1; // number of the se 544 G4int isegend = -1; // number of the segment containing end position 540 545 541 if ( !fReflectedSolid ) << 546 if ( ! fReflectedSolid ) { 542 { << 543 // The start/end position of the divided 547 // The start/end position of the divided region 544 // << 548 G4double zstart 545 G4double zstart = fOrigParamMother->Z_va << 549 = fOrigParamMother->Z_values[0] + foffset; 546 G4double zend = fOrigParamMother->Z_valu << 550 G4double zend 547 + foffset + fnDiv*fwidth; << 551 = fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth; 548 552 549 G4int counter = 0; 553 G4int counter = 0; 550 while ( isegend < 0 && counter < fOrigPa << 554 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) { 551 { << 552 // first segment 555 // first segment 553 if ( zstart >= fOrigParamMother->Z_val 556 if ( zstart >= fOrigParamMother->Z_values[counter] && 554 zstart < fOrigParamMother->Z_val << 557 zstart < fOrigParamMother->Z_values[counter+1] ) { 555 { << 556 isegstart = counter; 558 isegstart = counter; 557 } 559 } 558 // last segment 560 // last segment 559 if ( zend > fOrigParamMother->Z_value 561 if ( zend > fOrigParamMother->Z_values[counter] && 560 zend <= fOrigParamMother->Z_value << 562 zend <= fOrigParamMother->Z_values[counter+1] ) { 561 { << 562 isegend = counter; 563 isegend = counter; 563 } 564 } 564 ++counter; 565 ++counter; 565 } // Loop checking, 06.08.2015, G.Cosmo 566 } // Loop checking, 06.08.2015, G.Cosmo 566 } 567 } 567 else << 568 else { 568 { << 569 // The start/end position of the divided 569 // The start/end position of the divided region 570 // << 570 G4double zstart 571 G4double zstart = fOrigParamMother->Z_va << 571 = fOrigParamMother->Z_values[0] - foffset; 572 G4double zend = fOrigParamMother->Z_valu << 572 G4double zend 573 - (foffset + fnDiv* fwidth << 573 = fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth); 574 574 575 G4int counter = 0; 575 G4int counter = 0; 576 while ( isegend < 0 && counter < fOrigPa << 576 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) { 577 { << 578 // first segment 577 // first segment 579 if ( zstart <= fOrigParamMother->Z_val 578 if ( zstart <= fOrigParamMother->Z_values[counter] && 580 zstart > fOrigParamMother->Z_val << 579 zstart > fOrigParamMother->Z_values[counter+1] ) { 581 { << 582 isegstart = counter; 580 isegstart = counter; 583 } 581 } 584 // last segment 582 // last segment 585 if ( zend < fOrigParamMother->Z_value 583 if ( zend < fOrigParamMother->Z_values[counter] && 586 zend >= fOrigParamMother->Z_value << 584 zend >= fOrigParamMother->Z_values[counter+1] ) { 587 { << 588 isegend = counter; 585 isegend = counter; 589 } 586 } 590 ++counter; 587 ++counter; 591 } // Loop checking, 06.08.2015, G.Cosmo 588 } // Loop checking, 06.08.2015, G.Cosmo 592 } 589 } 593 590 594 if ( isegstart != isegend ) << 591 if ( isegstart != isegend ) { 595 { << 596 std::ostringstream message; 592 std::ostringstream message; 597 message << "Configuration not supported. 593 message << "Configuration not supported." << G4endl 598 << "Division with user defined w 594 << "Division with user defined width." << G4endl 599 << "Solid " << fmotherSolid->Get 595 << "Solid " << fmotherSolid->GetName() << G4endl 600 << "Divided region is not betwee 596 << "Divided region is not between two Z planes."; 601 G4Exception("G4ParameterisationPolyhedra 597 G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()", 602 "GeomDiv0001", FatalExceptio 598 "GeomDiv0001", FatalException, message); 603 } 599 } 604 600 605 fNSegment = isegstart; 601 fNSegment = isegstart; 606 } 602 } 607 } 603 } 608 604 609 //-------------------------------------------- 605 //--------------------------------------------------------------------- 610 void 606 void 611 G4ParameterisationPolyhedraZ:: 607 G4ParameterisationPolyhedraZ:: 612 ComputeTransformation( const G4int copyNo, G4V 608 ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol) const 613 { 609 { 614 G4double posi; << 610 if ( fDivisionType == DivNDIV ) { 615 if ( fDivisionType == DivNDIV ) << 616 { << 617 // The position of the centre of copyNo-th 611 // The position of the centre of copyNo-th mother polycone segment 618 << 612 G4double posi = ( fOrigParamMother->Z_values[copyNo] 619 posi = ( fOrigParamMother->Z_values[copyNo << 620 + fOrigParamMother->Z_valu 613 + fOrigParamMother->Z_values[copyNo+1])/2; 621 physVol->SetTranslation( G4ThreeVector(0, 614 physVol->SetTranslation( G4ThreeVector(0, 0, posi) ); 622 } 615 } 623 616 624 if ( fDivisionType == DivNDIVandWIDTH || fDi << 617 if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) { 625 { << 626 // The position of the centre of copyNo-th 618 // The position of the centre of copyNo-th division 627 619 628 posi = fOrigParamMother->Z_values[0]; << 620 G4double posi = fOrigParamMother->Z_values[0]; 629 621 630 if ( !fReflectedSolid ) << 622 if ( ! fReflectedSolid ) 631 posi += foffset + (2*copyNo + 1) * fwidt 623 posi += foffset + (2*copyNo + 1) * fwidth/2.; 632 else 624 else 633 posi -= foffset + (2*copyNo + 1) * fwidt 625 posi -= foffset + (2*copyNo + 1) * fwidth/2.; 634 626 635 physVol->SetTranslation( G4ThreeVector(0, 627 physVol->SetTranslation( G4ThreeVector(0, 0, posi) ); 636 } 628 } 637 629 638 //----- calculate rotation matrix: unit 630 //----- calculate rotation matrix: unit 639 631 640 #ifdef G4DIVDEBUG 632 #ifdef G4DIVDEBUG 641 if( verbose >= 2 ) 633 if( verbose >= 2 ) 642 { 634 { 643 G4cout << " G4ParameterisationPolyhedraZ - 635 G4cout << " G4ParameterisationPolyhedraZ - position: " << posi << G4endl 644 << " copyNo: " << copyNo << " - fof << 636 << " copyNo: " << copyNo << " - foffset: " << foffset/deg 645 << " - fwidth: " << fwidth/CLHEP::d << 637 << " - fwidth: " << fwidth/deg << G4endl; 646 } 638 } 647 #endif 639 #endif 648 640 649 ChangeRotMatrix( physVol ); 641 ChangeRotMatrix( physVol ); 650 642 651 #ifdef G4DIVDEBUG 643 #ifdef G4DIVDEBUG 652 if( verbose >= 2 ) 644 if( verbose >= 2 ) 653 { 645 { 654 G4cout << std::setprecision(8) << " G4Para 646 G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraZ " 655 << copyNo << G4endl 647 << copyNo << G4endl 656 << " Position: (0,0,0) - Width: " < << 648 << " Position: " << origin << " - Width: " << fwidth 657 << " - Axis: " << faxis << G4endl; 649 << " - Axis: " << faxis << G4endl; 658 } 650 } 659 #endif 651 #endif 660 } 652 } 661 653 662 //-------------------------------------------- 654 //--------------------------------------------------------------------- 663 void 655 void 664 G4ParameterisationPolyhedraZ:: 656 G4ParameterisationPolyhedraZ:: 665 ComputeDimensions( G4Polyhedra& phedra, const 657 ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo, 666 const G4VPhysicalVolume* ) 658 const G4VPhysicalVolume* ) const 667 { 659 { 668 // Define division solid 660 // Define division solid 669 // << 670 G4PolyhedraHistorical origparam; 661 G4PolyhedraHistorical origparam; 671 G4int nz = 2; 662 G4int nz = 2; 672 origparam.Num_z_planes = nz; 663 origparam.Num_z_planes = nz; 673 origparam.numSide = fOrigParamMother->numSid 664 origparam.numSide = fOrigParamMother->numSide; 674 origparam.Start_angle = fOrigParamMother->St 665 origparam.Start_angle = fOrigParamMother->Start_angle; 675 origparam.Opening_angle = fOrigParamMother-> 666 origparam.Opening_angle = fOrigParamMother->Opening_angle; 676 667 677 // Define division solid z sections 668 // Define division solid z sections 678 // << 679 origparam.Z_values = new G4double[nz]; 669 origparam.Z_values = new G4double[nz]; 680 origparam.Rmin = new G4double[nz]; 670 origparam.Rmin = new G4double[nz]; 681 origparam.Rmax = new G4double[nz]; 671 origparam.Rmax = new G4double[nz]; 682 origparam.Z_values[0] = - fwidth/2.; 672 origparam.Z_values[0] = - fwidth/2.; 683 origparam.Z_values[1] = fwidth/2.; 673 origparam.Z_values[1] = fwidth/2.; 684 674 685 if ( fDivisionType == DivNDIV ) << 675 if ( fDivisionType == DivNDIV ) { 686 { << 687 // The position of the centre of copyNo-th 676 // The position of the centre of copyNo-th mother polycone segment 688 // << 689 G4double posi = ( fOrigParamMother->Z_valu 677 G4double posi = ( fOrigParamMother->Z_values[copyNo] 690 + fOrigParamMother->Z_valu 678 + fOrigParamMother->Z_values[copyNo+1])/2; 691 679 692 origparam.Z_values[0] = fOrigParamMother-> 680 origparam.Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi; 693 origparam.Z_values[1] = fOrigParamMother-> 681 origparam.Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi; 694 origparam.Rmin[0] = fOrigParamMother->Rmin 682 origparam.Rmin[0] = fOrigParamMother->Rmin[copyNo]; 695 origparam.Rmin[1] = fOrigParamMother->Rmin 683 origparam.Rmin[1] = fOrigParamMother->Rmin[copyNo+1]; 696 origparam.Rmax[0] = fOrigParamMother->Rmax 684 origparam.Rmax[0] = fOrigParamMother->Rmax[copyNo]; 697 origparam.Rmax[1] = fOrigParamMother->Rmax 685 origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1]; 698 } 686 } 699 687 700 if ( fDivisionType == DivNDIVandWIDTH || fDi << 688 if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) { 701 { << 689 if ( ! fReflectedSolid ) { 702 if ( !fReflectedSolid ) << 690 origparam.Z_values[0] = - fwidth/2.; 703 { << 704 origparam.Z_values[0] = -fwidth/2.; << 705 origparam.Z_values[1] = fwidth/2.; 691 origparam.Z_values[1] = fwidth/2.; 706 692 707 // The position of the centre of copyNo- 693 // The position of the centre of copyNo-th division 708 // << 694 G4double posi 709 G4double posi = fOrigParamMother->Z_valu << 695 = fOrigParamMother->Z_values[0] + foffset + (2*copyNo + 1) * fwidth/2.; 710 + foffset + (2*copyNo + 1) << 711 696 712 // The first and last z sides z values 697 // The first and last z sides z values 713 G4double zstart = posi - fwidth/2.; 698 G4double zstart = posi - fwidth/2.; 714 G4double zend = posi + fwidth/2.; 699 G4double zend = posi + fwidth/2.; 715 origparam.Rmin[0] = GetRmin(zstart, fNSe 700 origparam.Rmin[0] = GetRmin(zstart, fNSegment); 716 origparam.Rmax[0] = GetRmax(zstart, fNSe 701 origparam.Rmax[0] = GetRmax(zstart, fNSegment); 717 origparam.Rmin[1] = GetRmin(zend, fNSegm 702 origparam.Rmin[1] = GetRmin(zend, fNSegment); 718 origparam.Rmax[1] = GetRmax(zend, fNSegm 703 origparam.Rmax[1] = GetRmax(zend, fNSegment); 719 } 704 } 720 else << 705 else { 721 { << 722 origparam.Z_values[0] = fwidth/2.; 706 origparam.Z_values[0] = fwidth/2.; 723 origparam.Z_values[1] = -fwidth/2.; << 707 origparam.Z_values[1] = - fwidth/2.; 724 708 725 // The position of the centre of copyNo- 709 // The position of the centre of copyNo-th division 726 // << 710 G4double posi 727 G4double posi = fOrigParamMother->Z_valu << 711 = fOrigParamMother->Z_values[0] - ( foffset + (2*copyNo + 1) * fwidth/2.); 728 - ( foffset + (2*copyNo + << 729 712 730 // The first and last z sides z values 713 // The first and last z sides z values 731 // << 732 G4double zstart = posi + fwidth/2.; 714 G4double zstart = posi + fwidth/2.; 733 G4double zend = posi - fwidth/2.; 715 G4double zend = posi - fwidth/2.; 734 origparam.Rmin[0] = GetRmin(zstart, fNSe 716 origparam.Rmin[0] = GetRmin(zstart, fNSegment); 735 origparam.Rmax[0] = GetRmax(zstart, fNSe 717 origparam.Rmax[0] = GetRmax(zstart, fNSegment); 736 origparam.Rmin[1] = GetRmin(zend, fNSegm 718 origparam.Rmin[1] = GetRmin(zend, fNSegment); 737 origparam.Rmax[1] = GetRmax(zend, fNSegm 719 origparam.Rmax[1] = GetRmax(zend, fNSegment); 738 } 720 } 739 721 740 // It can happen due to rounding errors 722 // It can happen due to rounding errors 741 // << 742 if ( origparam.Rmin[0] < 0.0 ) origpara 723 if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0; 743 if ( origparam.Rmin[nz-1] < 0.0 ) origpara 724 if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0; 744 } 725 } 745 726 746 phedra.SetOriginalParameters(&origparam); / 727 phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers 747 phedra.Reset(); / 728 phedra.Reset(); // reset to new solid parameters 748 729 749 #ifdef G4DIVDEBUG 730 #ifdef G4DIVDEBUG 750 if( verbose >= 2 ) 731 if( verbose >= 2 ) 751 { 732 { 752 G4cout << "G4ParameterisationPolyhedraZ::C 733 G4cout << "G4ParameterisationPolyhedraZ::ComputeDimensions()" << G4endl 753 << "-- Parametrised phedra copy-num 734 << "-- Parametrised phedra copy-number: " << copyNo << G4endl; 754 phedra.DumpInfo(); 735 phedra.DumpInfo(); 755 } 736 } 756 #endif 737 #endif 757 } 738 } 758 739