Changeset 1010 for trunk/source/geometry/divisions/src
- Timestamp:
- Apr 22, 2009, 11:58:58 AM (15 years ago)
- Location:
- trunk/source/geometry/divisions/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/divisions/src/G4PVDivision.cc
r850 r1010 25 25 // 26 26 // 27 // $Id: G4PVDivision.cc,v 1.2 1 2008/08/18 14:06:13 tnikitinExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4PVDivision.cc,v 1.22 2008/12/03 16:41:45 arce Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4PVDivision Implementation file … … 74 74 SetParameterisation(pMotherLogical, pAxis, nDivs, 75 75 width, offset, DivNDIVandWIDTH); 76 CheckAndSetParameters (pAxis,offset, pMotherLogical); 76 CheckAndSetParameters (pAxis, nDivs, width, offset, 77 DivNDIVandWIDTH, pMotherLogical); 77 78 } 78 79 … … 104 105 SetMotherLogical(pMotherLogical); 105 106 SetParameterisation(pMotherLogical, pAxis, nDivs, 0., offset, DivNDIV); 106 CheckAndSetParameters (pAxis, offset, pMotherLogical);107 CheckAndSetParameters (pAxis, nDivs, 0., offset, DivNDIV, pMotherLogical); 107 108 } 108 109 … … 134 135 SetMotherLogical(pMotherLogical); 135 136 SetParameterisation(pMotherLogical, pAxis, 0, width, offset, DivWIDTH); 136 CheckAndSetParameters (pAxis, offset, pMotherLogical);137 CheckAndSetParameters (pAxis, 0, width, offset, DivWIDTH, pMotherLogical); 137 138 } 138 139 … … 140 141 void 141 142 G4PVDivision::CheckAndSetParameters( const EAxis pAxis, 143 const G4int nDivs, 144 const G4double width, 142 145 const G4double offset, 146 DivisionType divType, 143 147 const G4LogicalVolume* pMotherLogical ) 144 148 { 145 fnReplicas = fparam->GetNoDiv(); 146 149 if( divType == DivWIDTH ) 150 { 151 fnReplicas = fparam->GetNoDiv(); 152 } 153 else 154 { 155 fnReplicas = nDivs; 156 } 147 157 if (fnReplicas < 1 ) 148 158 { … … 151 161 } 152 162 153 fwidth = fparam->GetWidth(); 154 163 if( divType != DivNDIV) 164 { 165 fwidth = fparam->GetWidth(); 166 } 167 else 168 { 169 fwidth = width; 170 } 155 171 if( fwidth < 0 ) 156 172 { … … 202 218 G4String msolType = pMotherLogical->GetSolid()->GetEntityType(); 203 219 G4String dsolType = GetLogicalVolume()->GetSolid()->GetEntityType(); 204 if( msolType != dsolType )220 if( msolType != dsolType && ( msolType != "G4Trd" || dsolType != "G4Trap" ) ) 205 221 { 206 222 G4String message = 207 223 "Incorrect solid type for division of volume " + GetName() 208 224 + " It is: " + msolType + ", while it should be: " + dsolType; 209 G4Exception("G4 VDivisionParameterisation::CheckAndSetParameters()",225 G4Exception("G4PVDivision::CheckAndSetParameters()", 210 226 "IllegalConstruct", FatalException, message ); 211 227 } -
trunk/source/geometry/divisions/src/G4PVDivisionFactory.cc
r850 r1010 26 26 // 27 27 // $Id: G4PVDivisionFactory.cc,v 1.2 2006/06/29 18:18:33 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4PVDivisionFactory Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationBox.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationBox.cc,v 1.10 2006/06/29 18:18:35 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationBox Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationCons.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationCons.cc,v 1.9 2006/06/29 18:18:38 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationCons Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationPara.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationPara.cc,v 1.11 2006/06/29 18:18:42 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationPara Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationPolycone.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationPolycone.cc,v 1.15 2006/06/29 18:18:44 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationPolycone Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationPolyhedra.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationPolyhedra.cc,v 1.16 2007/05/18 07:27:23 gcosmo Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationPolyhedra Implementation file -
trunk/source/geometry/divisions/src/G4ParameterisationTrd.cc
r850 r1010 25 25 // 26 26 // 27 // $Id: G4ParameterisationTrd.cc,v 1.1 4 2006/06/29 18:18:48gunter Exp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4ParameterisationTrd.cc,v 1.16 2008/12/18 12:57:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationTrd Implementation file … … 91 91 if( divType == DivWIDTH ) 92 92 { 93 fnDiv = CalculateNDiv( 2*msol->GetXHalfLength1(),93 fnDiv = CalculateNDiv( msol->GetXHalfLength1()+msol->GetXHalfLength2(), 94 94 width, offset ); 95 95 } 96 96 else if( divType == DivNDIV ) 97 97 { 98 fwidth = CalculateWidth( 2*msol->GetXHalfLength1(), nDiv, offset );99 } 100 101 #ifdef G4DIVDEBUG 102 if( verbose >= -1 )98 fwidth = CalculateWidth( msol->GetXHalfLength1()+msol->GetXHalfLength2(), nDiv, offset ); 99 } 100 101 #ifdef G4DIVDEBUG 102 if( verbose >= 1 ) 103 103 { 104 104 G4cout << " G4ParameterisationTrdX - ## divisions " << fnDiv << " = " … … 108 108 } 109 109 #endif 110 111 G4double mpDx1 = msol->GetXHalfLength1(); 112 G4double mpDx2 = msol->GetXHalfLength2(); 113 if( std::fabs(mpDx1 - mpDx2) > kCarTolerance ) 114 { 115 bDivInTrap = true; 116 } 110 117 } 111 118 … … 119 126 { 120 127 G4Trd* msol = (G4Trd*)(fmotherSolid); 121 return 2*msol->GetXHalfLength1();128 return (msol->GetXHalfLength1()+msol->GetXHalfLength2()); 122 129 } 123 130 … … 129 136 { 130 137 G4Trd* msol = (G4Trd*)(fmotherSolid ); 131 G4double mdx = msol->GetXHalfLength1();138 G4double mdx = ( msol->GetXHalfLength1() + msol->GetXHalfLength2() ) / 2.; 132 139 133 140 //----- translation 134 141 G4ThreeVector origin(0.,0.,0.); 135 G4double posi = -mdx + foffset + (copyNo+0.5)*fwidth; 142 G4double posi; 143 if( !bDivInTrap ) { 144 posi = -mdx + foffset + (copyNo+0.5)*fwidth; 145 } else { 146 G4double aveHL = (msol->GetXHalfLength1()+msol->GetXHalfLength2())/2.; 147 posi = - aveHL + foffset + (copyNo+0.5)*aveHL/fnDiv*2; 148 } 136 149 if( faxis == kXAxis ) 137 150 { … … 146 159 147 160 #ifdef G4DIVDEBUG 148 if( verbose >= -2 )149 { 150 G4cout << std::setprecision(8) << " G4ParameterisationTrdX: "161 if( verbose >= 2 ) 162 { 163 G4cout << std::setprecision(8) << " G4ParameterisationTrdX::ComputeTransformation " 151 164 << copyNo << G4endl 152 165 << " Position: " << origin << " - Axis: " << faxis << G4endl; … … 169 182 G4double pDz = msol->GetZHalfLength(); 170 183 G4double pDx = fwidth/2.; 171 184 172 185 trd.SetAllParameters ( pDx, pDx, pDy1, pDy2, pDz ); 173 186 174 187 #ifdef G4DIVDEBUG 175 if( verbose >= -2 )176 { 177 G4cout << " G4ParameterisationTrdX::ComputeDimensions():"<< G4endl;188 if( verbose >= 2 ) 189 { 190 G4cout << " G4ParameterisationTrdX::ComputeDimensions():" << copyNo << G4endl; 178 191 trd.DumpInfo(); 192 } 193 #endif 194 } 195 196 G4VSolid* G4ParameterisationTrdX:: 197 ComputeSolid(const G4int i, G4VPhysicalVolume * pv) 198 { 199 if( bDivInTrap ) 200 { 201 return G4VDivisionParameterisation::ComputeSolid(i, pv); 202 } 203 else 204 { 205 return theTrap; 206 } 207 } 208 209 210 //-------------------------------------------------------------------------- 211 void 212 G4ParameterisationTrdX:: 213 ComputeDimensions( G4Trap& trap, const G4int copyNo, const G4VPhysicalVolume* ) const 214 { 215 G4Trd* msol = (G4Trd*)(fmotherSolid); 216 G4double pDy1 = msol->GetYHalfLength1(); 217 G4double pDy2 = msol->GetYHalfLength2(); 218 G4double pDz = msol->GetZHalfLength(); 219 G4double pDx1 = msol->GetXHalfLength1()/fnDiv; 220 G4double pDx2 = msol->GetXHalfLength2()/fnDiv; 221 222 G4double cxy1 = -msol->GetXHalfLength1() + foffset + (copyNo+0.5)*pDx1*2;// centre of the side at y=-pDy1 223 G4double cxy2 = -msol->GetXHalfLength2() + foffset + (copyNo+0.5)*pDx2*2;// centre of the side at y=+pDy1 224 G4double alp = std::atan( (cxy2-cxy1)/pDz ); 225 226 trap.SetAllParameters ( pDz, 227 0., 228 0., 229 pDy1, 230 pDx1, 231 pDx2, 232 alp, 233 pDy2, 234 pDx1, 235 pDx2, 236 alp); 237 238 #ifdef G4DIVDEBUG 239 if( verbose >= 2 ) 240 { 241 G4cout << " G4ParameterisationTrdX::ComputeDimensions():" << copyNo << G4endl; 242 trap.DumpInfo(); 179 243 } 180 244 #endif … … 190 254 G4double mpDx1 = msol->GetXHalfLength1(); 191 255 G4double mpDx2 = msol->GetXHalfLength2(); 256 bDivInTrap = false; 192 257 193 258 if( std::fabs(mpDx1 - mpDx2) > kCarTolerance ) 194 259 { 260 return; 261 195 262 G4cerr << "ERROR - G4ParameterisationTrdX::CheckParametersValidity()" 196 263 << G4endl … … 206 273 207 274 //-------------------------------------------------------------------------- 275 void G4ParameterisationTrdX:: 276 ComputeTrapParams() 277 { 278 } 279 280 //-------------------------------------------------------------------------- 208 281 G4ParameterisationTrdY:: 209 282 G4ParameterisationTrdY( EAxis axis, G4int nDiv, … … 261 334 G4ThreeVector origin(0.,0.,0.); 262 335 G4double posi = -mdy + foffset + (copyNo+0.5)*fwidth; 336 263 337 if( faxis == kYAxis ) 264 338 { … … 275 349 if( verbose >= 2 ) 276 350 { 277 G4cout << std::setprecision(8) << " G4ParameterisationTrdY " << copyNo351 G4cout << std::setprecision(8) << " G4ParameterisationTrdY::ComputeTransformation " << copyNo 278 352 << " pos " << origin << " rot mat " << " axis " << faxis << G4endl; 279 353 } -
trunk/source/geometry/divisions/src/G4ParameterisationTubs.cc
r850 r1010 26 26 // 27 27 // $Id: G4ParameterisationTubs.cc,v 1.8 2006/06/29 18:18:50 gunter Exp $ 28 // GEANT4 tag $Name: HEAD$28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4ParameterisationTubs Implementation file -
trunk/source/geometry/divisions/src/G4VDivisionParameterisation.cc
r850 r1010 25 25 // 26 26 // 27 // $Id: G4VDivisionParameterisation.cc,v 1.1 3 2008/07/25 16:23:35 ivanaExp $28 // GEANT4 tag $Name: HEAD$27 // $Id: G4VDivisionParameterisation.cc,v 1.14 2008/12/03 16:41:15 arce Exp $ 28 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 29 29 // 30 30 // class G4VDivisionParameterisation Implementation file … … 163 163 << " has too big offset + width*nDiv = " << G4endl 164 164 << " " << foffset + fwidth*fnDiv << " > " 165 << maxPar<< ". Width = "165 << foffset << ". Width = " 166 166 << G4endl 167 167 << " " << fwidth << ". nDiv = " << fnDiv << " !"
Note: See TracChangeset
for help on using the changeset viewer.