Changeset 1340 for trunk/source/geometry
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (15 years ago)
- Location:
- trunk/source/geometry
- Files:
-
- 39 edited
-
magneticfield/History (modified) (2 diffs)
-
magneticfield/include/G4CashKarpRKF45.hh (modified) (2 diffs)
-
magneticfield/include/G4ConstRK4.hh (modified) (2 diffs)
-
magneticfield/include/G4EqEMFieldWithEDM.hh (modified) (2 diffs)
-
magneticfield/include/G4EqEMFieldWithSpin.hh (modified) (2 diffs)
-
magneticfield/include/G4ExactHelixStepper.hh (modified) (2 diffs)
-
magneticfield/include/G4MagErrorStepper.hh (modified) (2 diffs)
-
magneticfield/include/G4MagErrorStepper.icc (modified) (2 diffs)
-
magneticfield/include/G4MagIntegratorDriver.hh (modified) (2 diffs)
-
magneticfield/include/G4Mag_SpinEqRhs.hh (modified) (2 diffs)
-
magneticfield/include/G4NystromRK4.hh (modified) (2 diffs)
-
magneticfield/include/G4RKG3_Stepper.hh (modified) (3 diffs)
-
magneticfield/src/G4CashKarpRKF45.cc (modified) (3 diffs)
-
magneticfield/src/G4ConstRK4.cc (modified) (3 diffs)
-
magneticfield/src/G4EqEMFieldWithEDM.cc (modified) (4 diffs)
-
magneticfield/src/G4EqEMFieldWithSpin.cc (modified) (5 diffs)
-
magneticfield/src/G4ExactHelixStepper.cc (modified) (4 diffs)
-
magneticfield/src/G4FieldTrack.cc (modified) (5 diffs)
-
magneticfield/src/G4MagHelicalStepper.cc (modified) (2 diffs)
-
magneticfield/src/G4MagIntegratorDriver.cc (modified) (7 diffs)
-
magneticfield/src/G4Mag_EqRhs.cc (modified) (2 diffs)
-
magneticfield/src/G4Mag_SpinEqRhs.cc (modified) (4 diffs)
-
magneticfield/src/G4Mag_UsualEqRhs.cc (modified) (2 diffs)
-
magneticfield/src/G4NystromRK4.cc (modified) (3 diffs)
-
magneticfield/src/G4RKG3_Stepper.cc (modified) (8 diffs)
-
magneticfield/src/G4UniformElectricField.cc (modified) (2 diffs)
-
magneticfield/src/G4UniformMagField.cc (modified) (2 diffs)
-
management/GNUmakefile (modified) (2 diffs)
-
management/History (modified) (2 diffs)
-
management/include/G4LogicalSurface.hh (modified) (5 diffs)
-
management/include/G4LogicalSurface.icc (modified) (10 diffs)
-
management/include/G4ReflectedSolid.hh (modified) (4 diffs)
-
management/include/G4VSolid.hh (modified) (2 diffs)
-
management/src/G4ErrorTarget.cc (modified) (2 diffs)
-
management/src/G4GeometryManager.cc (modified) (3 diffs)
-
management/src/G4LogicalVolume.cc (modified) (3 diffs)
-
management/src/G4ReflectedSolid.cc (modified) (5 diffs)
-
management/src/G4SmartVoxelHeader.cc (modified) (18 diffs)
-
management/src/G4VSolid.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/magneticfield/History
r1315 r1340 1 $Id: History,v 1.1 46 2009/11/12 15:05:49japost Exp $1 $Id: History,v 1.152 2010/09/10 16:02:44 japost Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 Sep 10th, 2010 J.Apostolakis - field-V09-03-03 20 ----------------------------- 21 - Revised constructor of G4MagErrorStepper to add number of State variables 22 - Corrected MagErrorStepper to copy State Variable to output 23 - Enable G4ConstRK4 to copy remaining State Variables (must integrate 6) 24 25 Sep 10th, 2010 J.Apostolakis - field-V09-03-02 26 ----------------------------- 27 - Fixed passing of time in G4NystromRK4 28 29 Jul 21st, 2010 T.Nikitina - field-V09-03-01 30 -------------------------- 31 - Fixed cases of memory corruption in G4RKG3_Stepper. 32 - Fixed case of unused array data member in G4ExactHelixStepper. 33 - Removed useless code never executed in G4ConstRK4::Stepper(). 34 - Fixed initialization in G4NystromRK4 constructor. 35 36 Jul 14th, 2010 G.Cosmo - field-V09-03-00 37 ----------------------- 38 - Added dummy initialization of members in constructors for G4CashKarpRKF45, 39 G4ConstRK4, G4EqEMFieldWithEDM, G4EqEMFieldWithSpin, G4ExactHelixStepper, 40 G4FieldTrack, G4MagHelicalStepper, G4MagInt_Driver, G4Mag_EqRhs, 41 G4Mag_SpinEqRhs, G4Mag_UsualEqRhs, G4NystromRK4, G4RKG3_Stepper, 42 G4UniformElectricField, G4UniformElectricField. 43 44 Nov 12th, 2009 J.Apostolakis - field-V09-02-09 45 ----------------------------- 46 - G4MagIntegratorDriver: activate check on integration error for spin. 19 47 20 48 Nov 12th, 2009 J.Apostolakis - field-V09-02-08 21 ----------------------------- 49 ----------------------------- (fix only) 22 50 - G4Nystrom: Corrected interface method getField: array now has explicit dimension[4] 23 51 (Problem found by gcc 4.3 - it checked indices used in inline method! ) -
trunk/source/geometry/magneticfield/include/G4CashKarpRKF45.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4CashKarpRKF45.hh,v 1.1 1 2008/01/11 15:23:54 japostExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4CashKarpRKF45.hh,v 1.12 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 88 88 private: 89 89 90 // G4int fNumberOfVariables ; // Already kept in G4MagIntegratorStepper91 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn;// scratch space90 G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn; 91 // scratch space 92 92 93 // for DistChord calculations 93 G4double fLastStepLength; 94 G4double *fLastInitialVector, *fLastFinalVector, 95 *fLastDyDx, *fMidVector, *fMidError; 96 // for DistChord calculations 94 97 95 G4double fLastStepLength; 96 G4double *fLastInitialVector, *fLastFinalVector, 97 *fLastDyDx, *fMidVector, *fMidError; 98 G4CashKarpRKF45* fAuxStepper; 98 G4CashKarpRKF45* fAuxStepper; 99 99 100 }; 100 101 -
trunk/source/geometry/magneticfield/include/G4ConstRK4.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ConstRK4.hh,v 1. 2 2008/10/29 14:17:42 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4ConstRK4.hh,v 1.3 2010/09/10 15:50:17 japost Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 54 54 public: // with description 55 55 56 G4ConstRK4(G4Mag_EqRhs *EquationMotion, G4int numberOfVariables =8);56 G4ConstRK4(G4Mag_EqRhs *EquationMotion, G4int numberOfStateVariables=8); 57 57 ~G4ConstRK4(); 58 58 -
trunk/source/geometry/magneticfield/include/G4EqEMFieldWithEDM.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4EqEMFieldWithEDM.hh,v 1. 1 2009/11/04 23:51:42 gumExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4EqEMFieldWithEDM.hh,v 1.2 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 78 78 G4double fElectroMagCof ; 79 79 G4double fMassCof; 80 81 80 G4double omegac; 82 81 G4double anomaly; 83 82 G4double eta; 84 G4double ParticleCharge;83 G4double pcharge; 85 84 G4double E; 86 85 G4double gamma; -
trunk/source/geometry/magneticfield/include/G4EqEMFieldWithSpin.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4EqEMFieldWithSpin.hh,v 1. 3 2008/11/14 13:37:09gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4EqEMFieldWithSpin.hh,v 1.4 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 73 73 G4double fElectroMagCof ; 74 74 G4double fMassCof; 75 76 75 G4double omegac; 77 76 G4double anomaly; 78 G4double ParticleCharge;77 G4double pcharge; 79 78 G4double E; 80 79 G4double gamma; -
trunk/source/geometry/magneticfield/include/G4ExactHelixStepper.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4ExactHelixStepper.hh,v 1. 5 2007/05/18 12:50:31tnikitin Exp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4ExactHelixStepper.hh,v 1.7 2010/07/21 13:45:37 tnikitin Exp $ 27 // GEANT4 tag $Name: field-V09-03-03 $ 28 28 // 29 29 // … … 82 82 83 83 private: 84 G4ThreeVector fBfieldValue; // Initial value of field at last step85 G4ThreeVector yInitialEHS, yFinalEHS;86 G4ThreeVector pInitial;87 G4double fLastStepSize; // Length of last step88 G4double fYInSav[7]; // Starting state of x, p, ...89 // Values saved for calculating mid-point for chord90 84 91 G4Mag_EqRhs* fPtrMagEqOfMot; 85 G4ThreeVector fBfieldValue; 86 // Initial value of field at last step 87 G4Mag_EqRhs* fPtrMagEqOfMot; 92 88 }; 93 89 -
trunk/source/geometry/magneticfield/include/G4MagErrorStepper.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4MagErrorStepper.hh,v 1.1 1 2006/06/29 18:22:50 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4MagErrorStepper.hh,v 1.12 2010/09/10 15:52:53 japost Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 52 52 public: // with description 53 53 54 // G4MagErrorStepper(G4Mag_EqRhs *EqRhs, G4int numberOfVariables); 55 G4MagErrorStepper(G4EquationOfMotion *EqRhs, G4int numberOfVariables); 54 G4MagErrorStepper(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4int numStateVariables=12); 56 55 virtual ~G4MagErrorStepper(); 57 56 -
trunk/source/geometry/magneticfield/include/G4MagErrorStepper.icc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4MagErrorStepper.icc,v 1.1 3 2006/06/29 18:22:52 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4MagErrorStepper.icc,v 1.14 2010/09/10 15:52:53 japost Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // -------------------------------------------------------------------- … … 32 32 inline 33 33 G4MagErrorStepper::G4MagErrorStepper(G4EquationOfMotion *EquationRhs, 34 G4int numberOfVariables) 35 : G4MagIntegratorStepper(EquationRhs,numberOfVariables) 34 G4int numberOfVariables, 35 G4int numStateVariables) 36 : G4MagIntegratorStepper(EquationRhs,numberOfVariables,numStateVariables) 36 37 { 37 38 G4int nvar = std::max(this->GetNumberOfVariables(), 8); -
trunk/source/geometry/magneticfield/include/G4MagIntegratorDriver.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4MagIntegratorDriver.hh,v 1.2 0 2007/05/10 10:10:05 japostExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4MagIntegratorDriver.hh,v 1.21 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 241 241 G4int fNoTotalSteps, fNoBadSteps, fNoSmallSteps, fNoInitialSmallSteps; 242 242 G4double fDyerr_max, fDyerr_mx2; 243 G4double fDyerrPos_smTot, fDyerr Vel_smTot, fDyerrPos_lgTot, fDyerrVel_lgTot;244 G4double fSumH_sm, fSumH_lg;243 G4double fDyerrPos_smTot, fDyerrPos_lgTot, fDyerrVel_lgTot; 244 G4double fSumH_sm, fSumH_lg; 245 245 // Step Statistics 246 246 -
trunk/source/geometry/magneticfield/include/G4Mag_SpinEqRhs.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4Mag_SpinEqRhs.hh,v 1.1 1 2006/06/29 18:23:09 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4Mag_SpinEqRhs.hh,v 1.12 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 75 75 G4double omegac; 76 76 G4double anomaly; 77 G4double ParticleCharge; 78 77 G4double pcharge; 79 78 G4double E; 80 79 G4double gamma; -
trunk/source/geometry/magneticfield/include/G4NystromRK4.hh
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4NystromRK4.hh,v 1. 3 2009/11/12 15:01:36 japostExp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4NystromRK4.hh,v 1.4 2010/07/14 10:00:36 gcosmo Exp $ 27 // GEANT4 tag $Name: field-V09-03-03 $ 28 28 // 29 29 // class G4NystromRK4 … … 123 123 G4double dz = P[2]-m_fldPosition[2]; 124 124 125 if((dx*dx+dy*dy+dz*dz) > m_magdistance2) {126 125 if((dx*dx+dy*dy+dz*dz) > m_magdistance2) 126 { 127 127 m_fldPosition[0] = P[0]; 128 128 m_fldPosition[1] = P[1]; -
trunk/source/geometry/magneticfield/include/G4RKG3_Stepper.hh
r1337 r1340 26 26 // 27 27 // 28 // $Id: G4RKG3_Stepper.hh,v 1.1 3 2007/05/18 12:44:02tnikitin Exp $29 // GEANT4 tag $Name: geant4-09-04-beta-01$28 // $Id: G4RKG3_Stepper.hh,v 1.14 2010/07/23 14:13:09 tnikitin Exp $ 29 // GEANT4 tag $Name: field-V09-03-03 $ 30 30 // 31 31 // … … 69 69 G4double DistChord() const ; 70 70 71 void StepNoErr( const G4double tIn[ 7],72 const G4double dydx[ 7],71 void StepNoErr( const G4double tIn[8], 72 const G4double dydx[6], 73 73 G4double Step, 74 G4double tOut[ 7],74 G4double tOut[8], 75 75 G4double B[3] ); 76 76 // Integrator RK Stepper from G3 with only two field evaluation per … … 79 79 // B[3] is magnetic field which is passed from substep to substep. 80 80 81 void StepWithEst( const G4double tIn[ 7],82 const G4double dydx[ 7],81 void StepWithEst( const G4double tIn[8], 82 const G4double dydx[6], 83 83 G4double Step, 84 G4double tOut[ 7],84 G4double tOut[8], 85 85 G4double& alpha2, 86 86 G4double& beta2, -
trunk/source/geometry/magneticfield/src/G4CashKarpRKF45.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4CashKarpRKF45.cc,v 1.1 5 2008/01/11 18:11:44 japostExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4CashKarpRKF45.cc,v 1.16 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth … … 49 49 G4int noIntegrationVariables, 50 50 G4bool primary) 51 : G4MagIntegratorStepper(EqRhs, noIntegrationVariables) 52 { 53 // unsigned int noVariables= std::max(numberOfVariables,8); // For Time .. 7+1 51 : G4MagIntegratorStepper(EqRhs, noIntegrationVariables), 52 fLastStepLength(0.), fAuxStepper(0) 53 { 54 54 const G4int numberOfVariables = noIntegrationVariables; 55 55 … … 69 69 fMidVector = new G4double[numberOfVariables]; 70 70 fMidError = new G4double[numberOfVariables]; 71 fAuxStepper = 0;72 if( primary )73 fAuxStepper = new G4CashKarpRKF45(EqRhs, numberOfVariables, !primary);74 71 if( primary ) 72 { 73 fAuxStepper = new G4CashKarpRKF45(EqRhs, numberOfVariables, !primary); 74 } 75 75 } 76 76 -
trunk/source/geometry/magneticfield/src/G4ConstRK4.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ConstRK4.cc,v 1. 2 2008/10/29 14:17:42 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4ConstRK4.cc,v 1.5 2010/09/10 15:51:10 japost Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 38 38 ////////////////////////////////////////////////////////////////// 39 39 // 40 // Constructor sets the number of variables (default = 8) 41 42 G4ConstRK4::G4ConstRK4(G4Mag_EqRhs* EqRhs, G4int numberOfVariables) 43 : G4MagErrorStepper(EqRhs, numberOfVariables) 44 { 45 if(numberOfVariables !=8 ) 40 // Constructor sets the number of *State* variables (default = 8) 41 // The number of variables integrated is always 6 42 43 G4ConstRK4::G4ConstRK4(G4Mag_EqRhs* EqRhs, G4int numStateVariables) 44 : G4MagErrorStepper(EqRhs, 6, numStateVariables) 45 { 46 // const G4int numberOfVariables= 6; 47 if( numStateVariables < 8 ) 46 48 { 49 G4cerr << "ERROR in G4ConstRK4::G4ConstRK4 " 50 << " The number of State variables at least 8 " << G4endl; 51 G4cerr << " Instead it is numStateVariables= " << numStateVariables << G4endl; 47 52 G4Exception("G4ConstRK4::G4ConstRK4()", "InvalidSetup", FatalException, 48 "Valid only for number of variables=8. Use another Stepper!");53 "Valid only for number of state variables of 8 or more. Use another Stepper!"); 49 54 } 50 else 51 { 52 fEq=EqRhs; 53 yMiddle= new G4double[8]; 54 dydxMid= new G4double[8]; 55 yInitial= new G4double[8]; 56 yOneStep= new G4double[8]; 57 58 dydxm = new G4double[8]; 59 dydxt = new G4double[8]; 60 yt = new G4double[8]; 61 Field[0]=0.;Field[1]=0.;Field[2]=0.; 62 } 55 56 fEq = EqRhs; 57 yMiddle = new G4double[8]; 58 dydxMid = new G4double[8]; 59 yInitial = new G4double[8]; 60 yOneStep = new G4double[8]; 61 62 dydxm = new G4double[8]; 63 dydxt = new G4double[8]; 64 yt = new G4double[8]; 65 Field[0]=0.; Field[1]=0.; Field[2]=0.; 63 66 } 64 67 … … 150 153 G4double yError [] ) 151 154 { 152 const G4int nvar = 8 ; 153 const G4int maxvar= 8; 155 const G4int nvar = 6; // number of variables integrated 156 const G4int maxvar= GetNumberOfStateVariables(); 157 158 // Correction for Richardson extrapolation 159 G4double correction = 1. / ( (1 << IntegratorOrder()) -1 ); 154 160 155 161 G4int i; 156 157 // Correction for Richardson extrapolation158 //159 G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );160 162 161 163 // Saving yInput because yInput and yOutput can be aliases for same array 162 163 for (i=0;i<nvar;i++) { yInitial[i]=yInput[i]; } 164 165 yInitial[7]= yInput[7]; // Copy the time in case...even if not really needed 166 yMiddle[7] = yInput[7]; // Copy the time from initial value 167 yOneStep[7] = yInput[7]; // As it contributes to final value of yOutput ? 168 yOutput[7] = yInput[7]; // -> dumb stepper does it too for RK4 169 for (i=nvar;i<maxvar;i++) { yOutput[i]=yInput[i]; } 164 for (i=0; i<maxvar; i++) { yInitial[i]= yInput[i]; } 165 166 // Must copy the part of the state *not* integrated to the output 167 for (i=nvar; i<maxvar; i++) { yOutput[i]= yInput[i]; } 168 169 // yInitial[7]= yInput[7]; // The time is typically needed 170 yMiddle[7] = yInput[7]; // Copy the time from initial value 171 yOneStep[7] = yInput[7]; // As it contributes to final value of yOutput ? 172 // yOutput[7] = yInput[7]; // -> dumb stepper does it too for RK4 170 173 yError[7] = 0.0; 171 174 -
trunk/source/geometry/magneticfield/src/G4EqEMFieldWithEDM.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4EqEMFieldWithEDM.cc,v 1. 2 2009/11/06 22:31:54 gumExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4EqEMFieldWithEDM.cc,v 1.3 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 43 43 44 44 G4EqEMFieldWithEDM::G4EqEMFieldWithEDM(G4ElectroMagneticField *emField ) 45 : G4EquationOfMotion( emField ) 45 : G4EquationOfMotion( emField ), fElectroMagCof(0.), fMassCof(0.), 46 omegac(0.), anomaly(0.0011659208), eta(0.), pcharge(0.), E(0.), 47 gamma(0.), beta(0.) 46 48 { 47 anomaly = 0.0011659208;48 eta = 0.;49 49 } 50 50 … … 63 63 omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss); 64 64 65 ParticleCharge = particleCharge;65 pcharge = particleCharge; 66 66 67 67 E = std::sqrt(sqr(MomentumXc)+sqr(particleMass)); … … 145 145 146 146 G4ThreeVector dSpin 147 = ParticleCharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u))147 = pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u)) 148 148 // from Jackson 149 149 // -uce*Spin.cross(u.cross(EField)) ) 150 150 // but this form has one less operation 151 - uce*(u*(Spin*EField) - EField*(Spin*u)) 152 +eta/2.*(Spin.cross(EField) - ude*(Spin.cross(u)) 153 // +Spin.cross(u.cross(Bfield)) 154 + (u*(Spin*BField) - BField*(Spin*u)) 155 ) 156 ); 157 151 - uce*(u*(Spin*EField) - EField*(Spin*u)) 152 + eta/2.*(Spin.cross(EField) - ude*(Spin.cross(u)) 153 // +Spin.cross(u.cross(Bfield)) 154 + (u*(Spin*BField) - BField*(Spin*u)) ) ); 155 158 156 dydx[ 9] = dSpin.x(); 159 157 dydx[10] = dSpin.y(); -
trunk/source/geometry/magneticfield/src/G4EqEMFieldWithSpin.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4EqEMFieldWithSpin.cc,v 1. 8 2009/11/06 22:31:35 gumExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4EqEMFieldWithSpin.cc,v 1.9 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 33 33 // 30.08.2007 Chris Gong, Peter Gumplinger 34 34 // 14.02.2009 Kevin Lynch 35 // 06.11.2009 Hiromi Iinuma see: 36 // http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emfields/161.html 35 // 06.11.2009 Hiromi Iinuma 37 36 // 38 37 // ------------------------------------------------------------------- … … 44 43 45 44 G4EqEMFieldWithSpin::G4EqEMFieldWithSpin(G4ElectroMagneticField *emField ) 46 : G4EquationOfMotion( emField ) 45 : G4EquationOfMotion( emField ), fElectroMagCof(0.), fMassCof(0.), 46 omegac(0.), anomaly(0.0011659208), pcharge(0.), E(0.), gamma(0.), beta(0.) 47 47 { 48 anomaly = 0.0011659208;49 48 } 50 49 … … 63 62 omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss); 64 63 65 ParticleCharge = particleCharge;64 pcharge = particleCharge; 66 65 67 66 E = std::sqrt(sqr(MomentumXc)+sqr(particleMass)); … … 135 134 136 135 G4ThreeVector dSpin 137 = ParticleCharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u))136 = pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u)) 138 137 // from Jackson 139 138 // -uce*Spin.cross(u.cross(EField)) ); 140 139 // but this form has one less operation 141 - uce*(u*(Spin*EField) - EField*(Spin*u)) );140 - uce*(u*(Spin*EField) - EField*(Spin*u)) ); 142 141 143 142 dydx[ 9] = dSpin.x(); -
trunk/source/geometry/magneticfield/src/G4ExactHelixStepper.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ExactHelixStepper.cc,v 1. 9 2008/10/29 14:34:35 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4ExactHelixStepper.cc,v 1.11 2010/07/21 13:46:01 tnikitin Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // Helix a-la-Explicity Euler: x_1 = x_0 + helix(h) … … 43 43 #include "G4LineSection.hh" 44 44 45 46 45 G4ExactHelixStepper::G4ExactHelixStepper(G4Mag_EqRhs *EqRhs) 47 46 : G4MagHelicalStepper(EqRhs), 48 fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), yInitialEHS(DBL_MAX), yFinalEHS(-DBL_MAX)49 47 fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), 48 fPtrMagEqOfMot(EqRhs) 50 49 { 51 const G4int nvar = 6 ; 52 G4int i; 53 for(i=0;i<nvar;i++) { 54 fYInSav[i]= DBL_MAX; 55 } 56 fPtrMagEqOfMot=EqRhs; 50 ; 57 51 } 58 52 … … 61 55 void 62 56 G4ExactHelixStepper::Stepper( const G4double yInput[], 63 const G4double*,64 G4double hstep,65 G4double yOut[],66 G4double yErr[] )57 const G4double*, 58 G4double hstep, 59 G4double yOut[], 60 G4double yErr[] ) 67 61 { 68 const G4int nvar = 6 ;62 const G4int nvar = 6; 69 63 70 64 G4int i; 71 // G4double yTemp[7], yIn[7] ;72 65 G4ThreeVector Bfld_value; 73 66 74 for(i=0;i<nvar;i++) { 75 // yIn[i]= yInput[i]; 76 fYInSav[i]= yInput[i]; 77 } 78 79 MagFieldEvaluate(yInput, Bfld_value) ; 80 81 // DumbStepper(yIn, Bfld_value, hstep, yTemp); 67 MagFieldEvaluate(yInput, Bfld_value); 82 68 AdvanceHelix(yInput, Bfld_value, hstep, yOut); 83 69 84 // We are assuming a constant field: helix is exact. 85 for(i=0;i<nvar;i++) { 86 yErr[i] = 0.0 ; 87 } 70 // We are assuming a constant field: helix is exact 71 // 72 for(i=0;i<nvar;i++) 73 { 74 yErr[i] = 0.0 ; 75 } 88 76 89 yInitialEHS = G4ThreeVector( yInput[0], yInput[1], yInput[2]); 90 yFinalEHS = G4ThreeVector( yOut[0], yOut[1], yOut[2]); 91 fBfieldValue=Bfld_value; 92 77 fBfieldValue=Bfld_value; 93 78 } 94 79 95 80 void 96 81 G4ExactHelixStepper::DumbStepper( const G4double yIn[], 97 G4ThreeVector Bfld,98 G4double h,99 G4double yOut[])82 G4ThreeVector Bfld, 83 G4double h, 84 G4double yOut[]) 100 85 { 101 86 // Assuming a constant field: solution is a helix 87 102 88 AdvanceHelix(yIn, Bfld, h, yOut); 103 89 104 G4Exception("G4ExactHelixStepper::DumbStepper should not be called.", 105 "EHS:NoDumbStepper", FatalException, "Stepper must do all the work." ); 90 G4Exception("G4ExactHelixStepper::DumbStepper", 91 "EHS:NoDumbStepper", FatalException, 92 "Should not be called. Stepper must do all the work." ); 106 93 } 107 94 … … 109 96 // --------------------------------------------------------------------------- 110 97 111 G4double G4ExactHelixStepper::DistChord() const 98 G4double 99 G4ExactHelixStepper::DistChord() const 112 100 { 113 101 // Implementation : must check whether h/R > pi !! 114 102 // If( h/R < pi) DistChord=h/2*std::tan(Ang_curve/4) 115 103 // Else DistChord=R_helix 116 // 104 117 105 G4double distChord; 118 106 G4double Ang_curve=GetAngCurve(); 119 107 120 121 if(Ang_curve<=pi){ 122 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve)); 123 } 124 else 125 if(Ang_curve<twopi){ 126 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve))); 127 } 128 else{ 129 distChord=2.*GetRadHelix(); 130 } 131 132 108 if (Ang_curve<=pi) 109 { 110 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve)); 111 } 112 else if(Ang_curve<twopi) 113 { 114 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve))); 115 } 116 else 117 { 118 distChord=2.*GetRadHelix(); 119 } 133 120 134 121 return distChord; 135 136 122 } 137 123 -
trunk/source/geometry/magneticfield/src/G4FieldTrack.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4FieldTrack.cc,v 1.1 4 2007/10/03 15:34:42 japostExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4FieldTrack.cc,v 1.15 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // ------------------------------------------------------------------- … … 36 36 const G4double *SixV = SixVec.SixVector; 37 37 os << " ( "; 38 os << " X= " << SixV[0] << " " << SixV[1] << " " << SixV[2] << " "; // Position 39 os << " V= " << SixV[3] << " " << SixV[4] << " " << SixV[5] << " "; // Momentum 40 os << " v2= " << G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude 38 os << " X= " << SixV[0] << " " << SixV[1] << " " 39 << SixV[2] << " "; // Position 40 os << " V= " << SixV[3] << " " << SixV[4] << " " 41 << SixV[5] << " "; // Momentum 42 os << " v2= " 43 << G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude 41 44 os << " mdm= " << SixVec.fMomentumDir.mag(); 42 45 os << " l= " << SixVec.GetCurveLength(); … … 57 60 fRestMass_c2(restMass_c2), 58 61 fLabTimeOfFlight(LaboratoryTimeOfFlight), 59 // fProperTimeOfFlight(0.0),62 fProperTimeOfFlight(0.), 60 63 // fMomentumDir(pMomentumDirection), 61 64 fChargeState( charge, magnetic_dipole_moment ) … … 63 66 G4double momentum = std::sqrt(kineticEnergy*kineticEnergy 64 67 +2.0*restMass_c2*kineticEnergy); 65 66 68 G4ThreeVector pMomentum= momentum * pMomentumDirection; 67 69 SetCurvePnt( pPosition, pMomentum, curve_length ); 68 // Sets momentum direction as well.70 // Sets momentum direction as well. 69 71 70 // Set the momentum direction again - keeping value from argument exactly71 72 fMomentumDir=pMomentumDirection; 73 // Set the momentum direction again - keeping value from argument exactly 72 74 73 75 InitialiseSpin( Spin ); 74 75 // fpChargeState = new G4ChargeState( charge, magnetic_dipole_moment );76 76 } 77 77 … … 107 107 else Spin= *pSpin; 108 108 InitialiseSpin( Spin ); 109 110 // fpChargeState = new G4ChargeState( DBL_MAX ); // charge not yet set !!111 109 } 112 110 113 111 G4FieldTrack::G4FieldTrack( char ) // Nothing is set !! 114 : f RestMass_c2(0.0), fLabTimeOfFlight(0.0),115 fChargeState( DBL_MAX ) // charge not set112 : fKineticEnergy(0.), fRestMass_c2(0.), fLabTimeOfFlight(0.), 113 fProperTimeOfFlight(0.), fChargeState( DBL_MAX ) 116 114 { 117 115 G4ThreeVector Zero(0.0, 0.0, 0.0); 118 116 SetCurvePnt( Zero, Zero, 0.0 ); 119 117 InitialiseSpin( Zero ); 120 // fpChargeState = new G4ChargeState( DBL_MAX );121 118 } 122 119 -
trunk/source/geometry/magneticfield/src/G4MagHelicalStepper.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4MagHelicalStepper.cc,v 1.2 3 2007/09/05 12:20:17gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4MagHelicalStepper.cc,v 1.24 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // -------------------------------------------------------------------- … … 45 45 46 46 G4MagHelicalStepper::G4MagHelicalStepper(G4Mag_EqRhs *EqRhs) 47 : G4MagIntegratorStepper(EqRhs, 6) // integrate over 6 variables only !!47 : G4MagIntegratorStepper(EqRhs, 6), // integrate over 6 variables only !! 48 48 // position & velocity 49 { 50 fPtrMagEqOfMot = EqRhs; 49 fPtrMagEqOfMot(EqRhs), fAngCurve(0.), frCurve(0.), frHelix(0.) 50 { 51 51 } 52 52 -
trunk/source/geometry/magneticfield/src/G4MagIntegratorDriver.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4MagIntegratorDriver.cc,v 1.5 3 2009/11/05 22:31:43 japostExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4MagIntegratorDriver.cc,v 1.57 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 78 78 fNoInitialSmallSteps(0), fDyerr_max(0.0), fDyerr_mx2(0.0), 79 79 fDyerrPos_smTot(0.0), fDyerrPos_lgTot(0.0), fDyerrVel_lgTot(0.0), 80 fSumH_sm(0.0), fSumH_lg(0.0),80 fSumH_sm(0.0), fSumH_lg(0.0), 81 81 fStatisticsVerboseLevel(statisticsVerbose) 82 82 { … … 208 208 209 209 #ifdef G4DEBUG_FIELD 210 G4double xSubStepStart= x; 210 211 for (i=0;i<nvar;i++) { ySubStepStart[i] = y[i]; } 211 212 yFldTrkStart.LoadFromArray(y, fNoIntegrationVariables); … … 227 228 lastStepSucceeded= (hdid == h); 228 229 #ifdef G4DEBUG_FIELD 229 if (dbg>2) 230 { 231 PrintStatus( ySubStepStart, xSubStart, y, x, h, nstp); // Only 230 if (dbg>2) { 231 PrintStatus( ySubStepStart, xSubStepStart, y, x, h, nstp); // Only 232 232 } 233 233 #endif … … 291 291 { 292 292 if( nstp==nStpPr ) { G4cout << "***** Many steps ****" << G4endl; } 293 G4cout << "MagIntDrv: " ; 293 294 G4cout << "hdid=" << std::setw(12) << hdid << " " 294 << "hnext=" << std::setw(12) << hnext << " " << G4endl; 295 << "hnext=" << std::setw(12) << hnext << " " 296 << "hstep=" << std::setw(12) << hstep << " (requested) " 297 << G4endl; 295 298 PrintStatus( ystart, x1, y, x, h, (nstp==nStpPr) ? -nstp: nstp); 296 299 } … … 369 372 lastStep = true; 370 373 #ifdef G4DEBUG_FIELD 371 if (dbg )374 if (dbg>2) 372 375 { 376 int prec= G4cout.precision(12); 373 377 G4cout << "Warning: G4MagIntegratorDriver::AccurateAdvance" 374 378 << G4endl 375 379 << " Integration step 'h' became " 376 << h << " due to roundoff " << G4endl 380 << h << " due to roundoff. " << G4endl 381 << " Calculated as difference of x2= "<< x2 << " and x=" << x 377 382 << " Forcing termination of advance." << G4endl; 383 G4cout.precision(prec); 378 384 } 379 385 #endif … … 581 587 / ( sqr(y[9]) + sqr(y[10]) + sqr(y[11]) ); 582 588 errspin_sq *= inv_eps_vel_sq; 583 } 589 errmax_sq = std::max( errmax_sq, errspin_sq ); 590 } 584 591 585 592 if ( errmax_sq <= 1.0 ) { break; } // Step succeeded. -
trunk/source/geometry/magneticfield/src/G4Mag_EqRhs.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4Mag_EqRhs.cc,v 1.1 1 2006/06/29 18:24:36 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4Mag_EqRhs.cc,v 1.12 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // This is the standard right-hand side for equation of motion … … 48 48 // 49 49 G4Mag_EqRhs::G4Mag_EqRhs( G4MagneticField *magField ) 50 : G4EquationOfMotion(magField) 50 : G4EquationOfMotion(magField), fCof_val(0.) 51 51 { 52 52 } -
trunk/source/geometry/magneticfield/src/G4Mag_SpinEqRhs.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4Mag_SpinEqRhs.cc,v 1.1 5 2009/03/25 15:29:02gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4Mag_SpinEqRhs.cc,v 1.16 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // This is the standard right-hand side for equation of motion. … … 43 43 44 44 G4Mag_SpinEqRhs::G4Mag_SpinEqRhs( G4MagneticField* MagField ) 45 : G4Mag_EqRhs( MagField ) 45 : G4Mag_EqRhs( MagField ), omegac(0.), anomaly(0.0011659208), 46 pcharge(0.), E(0.), gamma(0.), beta(0.) 46 47 { 47 anomaly = 0.0011659208;48 48 } 49 49 … … 62 62 omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss); 63 63 64 ParticleCharge = particleCharge;64 pcharge = particleCharge; 65 65 66 66 E = std::sqrt(sqr(MomentumXc)+sqr(particleMass)); … … 101 101 G4ThreeVector dSpin; 102 102 103 dSpin = ParticleCharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));103 dSpin = pcharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u))); 104 104 105 105 dydx[ 9] = dSpin.x(); -
trunk/source/geometry/magneticfield/src/G4Mag_UsualEqRhs.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4Mag_UsualEqRhs.cc,v 1.1 2 2006/06/29 18:24:42 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4Mag_UsualEqRhs.cc,v 1.13 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 40 40 41 41 G4Mag_UsualEqRhs::G4Mag_UsualEqRhs( G4MagneticField* MagField ) 42 : G4Mag_EqRhs( MagField ) {}42 : G4Mag_EqRhs( MagField ), fInvCurrentMomentumXc(0.) {} 43 43 44 44 G4Mag_UsualEqRhs::~G4Mag_UsualEqRhs() {} -
trunk/source/geometry/magneticfield/src/G4NystromRK4.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4NystromRK4.cc,v 1. 6 2009/12/16 17:49:57 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4NystromRK4.cc,v 1.9 2010/09/10 15:42:09 japost Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // History: … … 49 49 m_cachedMom( false ) 50 50 { 51 m_fldPosition[0] = m_iPoint[ 1] = m_fPoint[2] = 9.9999999e+99 ;52 m_fldPosition[1] = m_iPoint[1] = m_fPoint[ 2] = 9.9999999e+99 ;53 m_fldPosition[2] = m_iPoint[ 1] = m_fPoint[2] = 9.9999999e+99 ;51 m_fldPosition[0] = m_iPoint[0] = m_fPoint[0] = m_mPoint[0] = 9.9999999e+99 ; 52 m_fldPosition[1] = m_iPoint[1] = m_fPoint[1] = m_mPoint[1] = 9.9999999e+99 ; 53 m_fldPosition[2] = m_iPoint[2] = m_fPoint[2] = m_mPoint[2] = 9.9999999e+99 ; 54 54 m_fldPosition[3] = -9.9999999e+99; 55 m_lastField[0] = m_lastField[1] = m_lastField[2] = 0.0; 55 56 56 57 m_magdistance2 = distanceConstField*distanceConstField; … … 196 197 G4NystromRK4::ComputeRightHandSide(const G4double P[],G4double dPdS[]) 197 198 { 198 getField(P); 199 G4double P4vec[4]= { P[0], P[1], P[2], P[7] }; // Time is P[7] 200 getField(P4vec); 199 201 m_mom = std::sqrt(P[3]*P[3]+P[4]*P[4]+P[5]*P[5]) ; 200 202 m_imom = 1./m_mom ; -
trunk/source/geometry/magneticfield/src/G4RKG3_Stepper.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4RKG3_Stepper.cc,v 1.1 5 2007/08/21 10:17:41tnikitin Exp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4RKG3_Stepper.cc,v 1.17 2010/07/23 14:13:49 tnikitin Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // ------------------------------------------------------------------- … … 35 35 36 36 G4RKG3_Stepper::G4RKG3_Stepper(G4Mag_EqRhs *EqRhs) 37 : G4MagIntegratorStepper(EqRhs,6) 38 { 39 40 fPtrMagEqOfMot=EqRhs; 41 37 : G4MagIntegratorStepper(EqRhs,6), hStep(0.), fPtrMagEqOfMot(EqRhs) 38 { 42 39 } 43 40 … … 46 43 } 47 44 48 void G4RKG3_Stepper::Stepper( const G4double yInput[7],49 const G4double dydx[ 7],45 void G4RKG3_Stepper::Stepper( const G4double yInput[8], 46 const G4double dydx[6], 50 47 G4double Step, 51 G4double yOut[ 7],48 G4double yOut[8], 52 49 G4double yErr[]) 53 50 { … … 57 54 G4double by15 = 1. / 15. ; // was 0.066666666 ; 58 55 59 G4double yTemp[ 7], dydxTemp[6], yIn[7] ;56 G4double yTemp[8], dydxTemp[6], yIn[8] ; 60 57 // Saving yInput because yInput and yOut can be aliases for same array 61 58 for(i=0;i<nvar;i++) yIn[i]=yInput[i]; 62 59 yIn[6] = yInput[6]; 60 yIn[7] = yInput[7]; 63 61 G4double h = Step * 0.5; 64 62 hStep=Step; … … 82 80 83 81 h *= 2 ; 84 StepNoErr(yIn,dydx,h,yTemp,B); // ,beTemp2) ;82 StepNoErr(yIn,dydx,h,yTemp,B); 85 83 for(i=0;i<nvar;i++) 86 84 { … … 127 125 // is passed from substep to substep. 128 126 129 void G4RKG3_Stepper::StepNoErr(const G4double tIn[ 7],130 const G4double dydx[ 7],127 void G4RKG3_Stepper::StepNoErr(const G4double tIn[8], 128 const G4double dydx[6], 131 129 G4double Step, 132 G4double tOut[ 7],130 G4double tOut[8], 133 131 G4double B[3] ) // const 134 132 … … 137 135 // Copy and edit the routine above, to delete alpha2, beta2, ... 138 136 G4double K1[7],K2[7],K3[7],K4[7] ; 139 G4double tTemp[ 7], yderiv[6] ;137 G4double tTemp[8], yderiv[6] ; 140 138 141 139 // Need Momentum value to give correct values to the coefficients in equation … … 188 186 tOut[i+3] = tIn[i+3] + mom*(K1[i] + 2*K2[i] + 2*K3[i] +K4[i])*c3 ; 189 187 } 190 188 tOut[6] = tIn[6]; 189 tOut[7] = tIn[7]; 191 190 // NormaliseTangentVector( tOut ); 192 191 -
trunk/source/geometry/magneticfield/src/G4UniformElectricField.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4UniformElectricField.cc,v 1.1 2 2006/06/29 18:24:56 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4UniformElectricField.cc,v 1.13 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 52 52 G4double vPhi ) 53 53 { 54 if(vField >= 0 && 55 vTheta >= 0 && vTheta <= pi && 56 vPhi >= 0 && vPhi <= twopi) 57 { 58 fFieldComponents[0] = 0.0; 59 fFieldComponents[1] = 0.0; 60 fFieldComponents[2] = 0.0; 61 fFieldComponents[3] = vField*std::sin(vTheta)*std::cos(vPhi) ; 62 fFieldComponents[4] = vField*std::sin(vTheta)*std::sin(vPhi) ; 63 fFieldComponents[5] = vField*std::cos(vTheta) ; 64 } 65 else 54 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) ) 66 55 { 67 56 G4Exception("G4UniformElectricField::G4UniformElectricField()", 68 57 "WrongArgumentValue", FatalException, "Invalid parameters."); 69 58 } 59 60 fFieldComponents[0] = 0.0; 61 fFieldComponents[1] = 0.0; 62 fFieldComponents[2] = 0.0; 63 fFieldComponents[3] = vField*std::sin(vTheta)*std::cos(vPhi) ; 64 fFieldComponents[4] = vField*std::sin(vTheta)*std::sin(vPhi) ; 65 fFieldComponents[5] = vField*std::cos(vTheta) ; 70 66 } 71 67 -
trunk/source/geometry/magneticfield/src/G4UniformMagField.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4UniformMagField.cc,v 1.1 1 2006/06/29 18:24:58 gunterExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4UniformMagField.cc,v 1.12 2010/07/14 10:00:36 gcosmo Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // … … 56 56 G4double vPhi ) 57 57 { 58 if(vField >= 0 && 59 vTheta >= 0 && vTheta <= pi && 60 vPhi >= 0 && vPhi <= twopi) 61 { 62 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ; 63 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ; 64 fFieldComponents[2] = vField*std::cos(vTheta) ; 65 } 66 else 58 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) ) 67 59 { 68 60 G4Exception("G4UniformMagField::G4UniformMagField()", 69 61 "WrongArgumentValue", FatalException, "Invalid parameters.") ; 70 62 } 63 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ; 64 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ; 65 fFieldComponents[2] = vField*std::cos(vTheta) ; 71 66 } 72 67 -
trunk/source/geometry/management/GNUmakefile
r831 r1340 1 # $Id: GNUmakefile,v 1. 5 2004/11/12 09:05:05gcosmo Exp $1 # $Id: GNUmakefile,v 1.6 2010/10/19 10:18:01 gcosmo Exp $ 2 2 # ----------------------------------------------------------------------- 3 3 # GNUmakefile for geometry/management library. Gabriele Cosmo, 16/11/96. … … 12 12 include $(G4INSTALL)/config/architecture.gmk 13 13 14 CPPFLAGS += -DG4 GEOM_ALLOC_EXPORT14 CPPFLAGS += -DG4ALLOC_EXPORT 15 15 CPPFLAGS += -I$(G4BASE)/graphics_reps/include \ 16 16 -I$(G4BASE)/intercoms/include \ -
trunk/source/geometry/management/History
r1315 r1340 1 $Id: History,v 1.1 39 2010/02/09 16:50:44gcosmo Exp $1 $Id: History,v 1.145 2010/10/19 15:20:33 gcosmo Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 October 19, 2010 G.Cosmo geommng-V09-03-05 21 - Added Clone() virtual method to G4VSolid, to return a pointer to a 22 dynamically allocated copy of the solid. To be used by Geant4-MT. 23 - Added copy-ctr and assignment operator to G4ReflectedSolid, now also 24 implementing the Clone() method. 25 26 September 6, 2010 G.Cosmo geommng-V09-03-04 27 - Fixed false-positive null forward case in G4SmartVoxelHeader. 28 29 July 16, 2010 G.Cosmo geommng-V09-03-03 30 - Fixed compilation errors for code within G4GEOMETRY_VOXELDEBUG flag 31 in G4GeometryManager and G4SmartVoxelHeader. 32 - Added printout of voxel limits in G4SmartVoxelHeader::Buildnodes() and 33 removed protection on node width previously introduced. 34 35 July 13, 2010 G.Cosmo geommng-V09-03-02 36 - G4SmartVoxelHeader: added protection against rare cases of zero computed 37 node width in BuildNodes(). 38 39 July 2, 2010 G.Cosmo geommng-V09-03-01 40 - G4LogicalSurface: added missing initialisation for 'theTransRadSurface' 41 data member. Made virtual destructor and constructors not inline. 42 - G4ErrorTarget: added missing default initialisation of a data member. 43 - G4SmartVoxelHeader: added return statement after exceptions in methods 44 BuildVoxelsWithinLimits() and BuildNodes(); fixed case of invalid iterator 45 in deletion of test slices in BuildVoxelsWithinLimits(); added protection 46 for cases of invalide number of nodes in RefineNodes(), and added return 47 statement after exceptions. 48 - G4GeometryManager: restore cout precision after printing voxel statistics. 49 - G4LogicalVolume: added return statement after exception in GetMass(). 50 - G4ReflectedSolid: moved reserve() statement for 'vertices' within null-check 51 condition in CalculateExtent() ... 19 52 20 53 February 9, 2010 G.Cosmo geommng-V09-03-00 -
trunk/source/geometry/management/include/G4LogicalSurface.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4LogicalSurface.hh,v 1.1 1 2009/04/21 15:18:15gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4LogicalSurface.hh,v 1.12 2010/07/05 09:22:58 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// … … 53 53 // Data members: 54 54 // G4String theName 55 // G4SurfaceProperty* theSurfaceProperty55 // G4SurfaceProperty* theSurfaceProperty 56 56 // G4TransitionRadiationSurface* theTransRadSurface 57 57 … … 83 83 public: // with description 84 84 85 G4SurfaceProperty* GetSurfaceProperty() const;86 voidSetSurfaceProperty(G4SurfaceProperty* ptrSurfaceProperty);85 inline G4SurfaceProperty* GetSurfaceProperty() const; 86 inline void SetSurfaceProperty(G4SurfaceProperty* ptrSurfaceProperty); 87 87 88 const G4String& GetName() const;89 voidSetName(const G4String& name);88 inline const G4String& GetName() const; 89 inline void SetName(const G4String& name); 90 90 91 G4TransitionRadiationSurface*GetTransitionRadiationSurface() const;92 void SetTransitionRadiationSurface(G4TransitionRadiationSurface* tRadSurf);91 inline G4TransitionRadiationSurface* GetTransitionRadiationSurface() const; 92 inline void SetTransitionRadiationSurface(G4TransitionRadiationSurface* tRadSurf); 93 93 94 94 public: // without description … … 96 96 virtual ~G4LogicalSurface(); 97 97 98 G4int operator==(const G4LogicalSurface &right) const;99 G4int operator!=(const G4LogicalSurface &right) const;98 inline G4int operator==(const G4LogicalSurface &right) const; 99 inline G4int operator!=(const G4LogicalSurface &right) const; 100 100 101 101 protected: … … 103 103 // There should be no instances of this class 104 104 105 G4LogicalSurface(const G4String& name, G4SurfaceProperty* surfaceProperty);105 G4LogicalSurface(const G4String& name, G4SurfaceProperty* prop); 106 106 // Is the name more meaningful for the properties or the logical surface ? 107 107 108 private: 108 private: // Copying restricted 109 109 110 G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted111 const G4LogicalSurface& operator=(const G4LogicalSurface& right);110 G4LogicalSurface(const G4LogicalSurface &right); 111 inline const G4LogicalSurface& operator=(const G4LogicalSurface& right); 112 112 113 113 private: -
trunk/source/geometry/management/include/G4LogicalSurface.icc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4LogicalSurface.icc,v 1.1 0 2009/04/21 15:18:15gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4LogicalSurface.icc,v 1.11 2010/07/05 09:22:58 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// … … 42 42 G4LogicalSurface::GetSurfaceProperty() const 43 43 { 44 return theSurfaceProperty;44 return theSurfaceProperty; 45 45 } 46 46 … … 48 48 G4LogicalSurface::SetSurfaceProperty(G4SurfaceProperty* ptrSurfaceProperty) 49 49 { 50 theSurfaceProperty = ptrSurfaceProperty;50 theSurfaceProperty = ptrSurfaceProperty; 51 51 } 52 52 … … 54 54 G4LogicalSurface::GetName() const 55 55 { 56 return theName;56 return theName; 57 57 } 58 58 … … 60 60 G4LogicalSurface::SetName(const G4String& name) 61 61 { 62 theName = name;62 theName = name; 63 63 } 64 64 … … 66 66 G4LogicalSurface::GetTransitionRadiationSurface() const 67 67 { 68 return theTransRadSurface;68 return theTransRadSurface; 69 69 } 70 70 … … 73 73 transRadSurf ) 74 74 { 75 theTransRadSurface= transRadSurf;75 theTransRadSurface= transRadSurf; 76 76 } 77 78 77 79 78 ////////////// … … 84 83 G4LogicalSurface::operator=(const G4LogicalSurface &right) 85 84 { 86 if (&right == this) return *this;87 theName = right.theName;88 theSurfaceProperty = right.theSurfaceProperty;89 theTransRadSurface = right.theTransRadSurface;85 if (&right == this) { return *this; } 86 theName = right.theName; 87 theSurfaceProperty = right.theSurfaceProperty; 88 theTransRadSurface = right.theTransRadSurface; 90 89 91 return *this;90 return *this; 92 91 } 93 92 … … 95 94 G4LogicalSurface::operator==(const G4LogicalSurface &right) const 96 95 { 97 return (this == (G4LogicalSurface *) &right);96 return (this == (G4LogicalSurface *) &right); 98 97 } 99 98 … … 101 100 G4LogicalSurface::operator!=(const G4LogicalSurface &right) const 102 101 { 103 return (this != (G4LogicalSurface *) &right);102 return (this != (G4LogicalSurface *) &right); 104 103 } 105 106 /////////////////107 // Constructors108 /////////////////109 110 inline G4LogicalSurface::G4LogicalSurface(const G4String& name,111 G4SurfaceProperty* surfaceProperty)112 : theName(name), theSurfaceProperty(surfaceProperty)113 {114 }115 116 inline G4LogicalSurface::G4LogicalSurface(const G4LogicalSurface &right)117 {118 *this = right;119 }120 121 inline G4LogicalSurface::~G4LogicalSurface()122 {123 } -
trunk/source/geometry/management/include/G4ReflectedSolid.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ReflectedSolid.hh,v 1. 5 2006/06/29 18:31:03 gunterExp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4ReflectedSolid.hh,v 1.6 2010/10/19 15:20:18 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // … … 94 94 G4ThreeVector GetPointOnSurface() const; 95 95 96 G4VSolid* Clone() const; 97 96 98 public: // with description 97 99 … … 114 116 115 117 public: // without description 118 119 G4ReflectedSolid(const G4ReflectedSolid& rhs); 120 G4ReflectedSolid& operator=(const G4ReflectedSolid& rhs); 121 // Copy constructor and assignment operator. 116 122 117 123 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ; … … 149 155 mutable G4Polyhedron* fpPolyhedron; // Caches reflected G4Polyhedron. 150 156 151 private:152 153 G4ReflectedSolid(const G4ReflectedSolid&);154 G4ReflectedSolid& operator=(const G4ReflectedSolid&);155 // Private copy constructor and assignment operator.156 157 } ; 157 158 -
trunk/source/geometry/management/include/G4VSolid.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4VSolid.hh,v 1. 29 2008/09/10 13:18:42gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4VSolid.hh,v 1.30 2010/10/19 15:19:37 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // … … 193 193 // Returns a random point located on the surface of the solid. 194 194 195 virtual G4VSolid* Clone() const; 196 // Returns a pointer of a dynamically allocated copy of the solid. 197 // Returns NULL pointer with warning in case the concrete solid does not 198 // implement this method. The caller has responsibility for ownership. 199 195 200 virtual std::ostream& StreamInfo(std::ostream& os) const = 0; 196 201 // Dumps contents of the solid to a stream. -
trunk/source/geometry/management/src/G4ErrorTarget.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ErrorTarget.cc,v 1. 1 2007/05/16 12:50:52gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4ErrorTarget.cc,v 1.2 2010/07/05 09:22:58 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // … … 35 35 #include "G4ErrorTarget.hh" 36 36 37 G4ErrorTarget::G4ErrorTarget(){} 38 G4ErrorTarget::~G4ErrorTarget(){} 37 G4ErrorTarget::G4ErrorTarget() 38 : theType(G4ErrorTarget_GeomVolume) {} 39 40 G4ErrorTarget::~G4ErrorTarget() {} 39 41 40 42 G4double G4ErrorTarget::GetDistanceFromPoint( const G4ThreeVector&, -
trunk/source/geometry/management/src/G4GeometryManager.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4GeometryManager.cc,v 1.2 2 2008/05/16 13:46:48gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4GeometryManager.cc,v 1.24 2010/07/16 15:52:57 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // class G4GeometryManager … … 261 261 #ifdef G4GEOMETRY_VOXELDEBUG 262 262 G4cout << "**** G4GeometryManager::BuildOptimisations" << G4endl 263 << " Skipping logical volume name = " << volume->GetName()263 << " Skipping logical volume name = " << tVolume->GetName() 264 264 << G4endl; 265 265 #endif … … 359 359 << totalMemory/1024 << " kByte" << G4endl; 360 360 G4cout << " Total CPU time elapsed for geometry optimisation: " 361 << std::setprecision(2) << totalCpuTime << " seconds" << G4endl; 361 << std::setprecision(2) << totalCpuTime << " seconds" 362 << std::setprecision(6) << G4endl; 362 363 363 364 // -
trunk/source/geometry/management/src/G4LogicalVolume.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4LogicalVolume.cc,v 1.3 4 2009/09/24 13:22:57gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4LogicalVolume.cc,v 1.35 2010/07/05 09:22:58 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // … … 211 211 G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException, 212 212 "No material associated to the logical volume !"); 213 return 0; 213 214 } 214 215 if (!fSolid) … … 219 220 G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException, 220 221 "No solid associated to the logical volume !"); 222 return 0; 221 223 } 222 224 G4double globalDensity = logMaterial->GetDensity(); -
trunk/source/geometry/management/src/G4ReflectedSolid.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ReflectedSolid.cc,v 1.1 1 2006/11/08 09:56:33gcosmo Exp $28 // 29 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4ReflectedSolid.cc,v 1.13 2010/10/19 15:20:18 gcosmo Exp $ 28 // 29 // GEANT4 tag $Name: geommng-V09-03-05 $ 30 30 // 31 31 // Implementation for G4ReflectedSolid class for boolean … … 93 93 } 94 94 95 /////////////////////////////////////////////////////////////////// 96 // 97 98 G4ReflectedSolid::G4ReflectedSolid(const G4ReflectedSolid& rhs) 99 : G4VSolid(rhs), fPtrSolid(rhs.fPtrSolid), fpPolyhedron(0) 100 { 101 fPtrTransform = new G4AffineTransform(*rhs.fPtrTransform); 102 fDirectTransform = new G4AffineTransform(*rhs.fDirectTransform); 103 fPtrTransform3D = new G4Transform3D(*rhs.fPtrTransform3D); 104 fDirectTransform3D = new G4Transform3D(*rhs.fDirectTransform3D); 105 } 106 107 /////////////////////////////////////////////////////////////////// 108 // 109 110 G4ReflectedSolid& G4ReflectedSolid::operator=(const G4ReflectedSolid& rhs) 111 { 112 // Check assignment to self 113 // 114 if (this == &rhs) { return *this; } 115 116 // Copy base class data 117 // 118 G4VSolid::operator=(rhs); 119 120 // Copy data 121 // 122 fPtrSolid= rhs.fPtrSolid; fpPolyhedron= 0; 123 delete fPtrTransform; 124 fPtrTransform= new G4AffineTransform(*rhs.fPtrTransform); 125 delete fDirectTransform; 126 fDirectTransform= new G4AffineTransform(*rhs.fDirectTransform); 127 delete fPtrTransform3D; 128 fPtrTransform3D= new G4Transform3D(*rhs.fPtrTransform3D); 129 delete fDirectTransform3D; 130 fDirectTransform3D= new G4Transform3D(*rhs.fDirectTransform3D); 131 132 return *this; 133 } 134 135 /////////////////////////////////////////////////////////////////// 136 // 137 95 138 G4GeometryType G4ReflectedSolid::GetEntityType() const 96 139 { … … 257 300 G4Point3D tmpPoint; 258 301 259 // Calculate rotated vertex coordinates302 // Calculate rotated vertex coordinates 260 303 261 304 G4ThreeVectorList* vertices = new G4ThreeVectorList(); 262 vertices->reserve(8);263 305 264 306 if (vertices) 265 307 { 308 vertices->reserve(8); 309 266 310 G4ThreeVector vertex0(x1,y1,z1) ; 267 311 tmpPoint = transform3D*G4Point3D(vertex0); … … 494 538 { 495 539 DumpInfo(); 496 G4Exception("G4 BooleanSolid::ComputeDimensions()",540 G4Exception("G4ReflectedSolid::ComputeDimensions()", 497 541 "NotApplicable", FatalException, 498 542 "Method not applicable in this context!"); … … 511 555 return G4ThreeVector(newPoint.x(),newPoint.y(),newPoint.z()); 512 556 } 557 558 ////////////////////////////////////////////////////////////////////////// 559 // 560 // Make a clone of this object 561 562 G4VSolid* G4ReflectedSolid::Clone() const 563 { 564 return new G4ReflectedSolid(*this); 565 } 566 513 567 514 568 ////////////////////////////////////////////////////////////////////////// -
trunk/source/geometry/management/src/G4SmartVoxelHeader.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4SmartVoxelHeader.cc,v 1.3 5 2010/02/09 16:50:25gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4SmartVoxelHeader.cc,v 1.39 2010/09/06 09:39:21 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // … … 148 148 } 149 149 } 150 else150 else 151 151 { 152 152 dyingNode = fslices[node]->GetNode(); … … 510 510 pTestSlices->pop_back(); 511 511 for (G4ProxyVector::iterator i=pTestSlices->begin(); 512 i!=pTestSlices->end(); i++)512 i!=pTestSlices->end(); ) 513 513 { 514 514 if (*i==tmpProx) 515 515 { 516 pTestSlices->erase(i); i--; 516 i = pTestSlices->erase(i); 517 } 518 else 519 { 520 ++i; 517 521 } 518 522 } 519 523 if ( tmpProx ) { delete tmpProx; } 520 } 524 } 521 525 delete pTestSlices; 522 526 } … … 534 538 "InvalidSetup", FatalException, 535 539 "Cannot select more than 3 axis for optimisation."); 540 return; 536 541 } 537 542 … … 548 553 549 554 #ifdef G4GEOMETRY_VOXELDEBUG 550 G4cout << G4endl << " Selected axis = " << faxis << G4endl; 555 G4cout << G4endl << " Volume = " << pVolume->GetName() 556 << G4endl << " Selected axis = " << faxis << G4endl; 551 557 for (size_t islice=0; islice<fslices.size(); islice++) 552 558 { … … 808 814 G4Exception("G4SmartVoxelHeader::BuildNodes()", "InvalidSetup", 809 815 FatalException, "Missing parameterisation."); 816 return 0; 810 817 } 811 818 … … 864 871 minExtents[nVol] = targetMinExtent; 865 872 maxExtents[nVol] = targetMaxExtent; 873 874 #ifdef G4GEOMETRY_VOXELDEBUG 875 G4cout << "---------------------------------------------------" << G4endl 876 << " Volume = " << pDaughter->GetName() << G4endl 877 << " Min Extent = " << targetMinExtent << G4endl 878 << " Max Extent = " << targetMaxExtent << G4endl 879 << "---------------------------------------------------" << G4endl; 880 #endif 866 881 867 882 // Check not entirely outside mother when processing toplevel nodes … … 960 975 G4double nodeWidth = (motherMaxExtent-motherMinExtent)/noNodes; 961 976 962 // Create G4VoxelNodes. Will Add proxies before setting fslices963 //977 // Create G4VoxelNodes. Will Add proxies before setting fslices 978 // 964 979 G4NodeVector* nodeList = new G4NodeVector(); 965 nodeList->reserve(noNodes);966 980 if (!nodeList) 967 981 { … … 970 984 G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError", 971 985 FatalException, "NodeList allocation error."); 972 } 986 return 0; 987 } 988 nodeList->reserve(noNodes); 989 973 990 for (nNode=0; nNode<noNodes; nNode++) 974 991 { … … 981 998 G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError", 982 999 FatalException, "Node allocation error."); 1000 return 0; 983 1001 } 984 1002 nodeList->push_back(pNode); … … 1026 1044 // 1027 1045 G4ProxyVector* proxyList = new G4ProxyVector(); 1028 proxyList->reserve(noNodes);1029 1046 if (!proxyList) 1030 1047 { … … 1033 1050 G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError", 1034 1051 FatalException, "Proxy list allocation error."); 1035 } 1052 return 0; 1053 } 1054 proxyList->reserve(noNodes); 1055 1036 1056 // 1037 1057 // Fill proxy List … … 1049 1069 G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError", 1050 1070 FatalException, "Proxy node allocation failed."); 1071 return 0; 1051 1072 } 1052 1073 proxyList->push_back(pProxyNode); … … 1196 1217 noContainedDaughters = targetNode->GetNoContained(); 1197 1218 targetList = new G4VolumeNosVector(); 1198 targetList->reserve(noContainedDaughters);1199 1219 if (!targetList) 1200 1220 { … … 1205 1225 "FatalError", FatalException, 1206 1226 "Target volume node list allocation error."); 1207 } 1227 return; 1228 } 1229 targetList->reserve(noContainedDaughters); 1208 1230 for (i=0; i<noContainedDaughters; i++) 1209 1231 { … … 1218 1240 << " - " << maxNo << " inclusive" << G4endl; 1219 1241 #endif 1242 if (minNo > maxNo) // Delete node and list to be replaced 1243 { // and avoid further action ... 1244 delete targetNode; 1245 delete targetList; 1246 return; 1247 } 1248 1220 1249 // Delete node proxies at start of collected sets of nodes/headers 1221 1250 // … … 1246 1275 G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError", 1247 1276 FatalException, "Refined VoxelHeader allocation error."); 1277 return; 1248 1278 } 1249 1279 replaceHeader->SetMinEquivalentSliceNo(minNo); 1250 1280 replaceHeader->SetMaxEquivalentSliceNo(maxNo); 1251 1281 replaceHeaderProxy = new G4SmartVoxelProxy(replaceHeader); 1252 if (!replaceHeader )1282 if (!replaceHeaderProxy) 1253 1283 { 1254 1284 G4cerr << "ERROR - G4SmartVoxelHeader::RefineNodes()" << G4endl … … 1256 1286 G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError", 1257 1287 FatalException, "Refined VoxelProxy allocation error."); 1288 return; 1258 1289 } 1259 1290 for (replaceNo=minNo; replaceNo<=maxNo; replaceNo++) -
trunk/source/geometry/management/src/G4VSolid.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4VSolid.cc,v 1. 39 2008/09/23 13:07:41gcosmo Exp $28 // GEANT4 tag $Name: ge ant4-09-04-beta-01$27 // $Id: G4VSolid.cc,v 1.40 2010/10/19 15:19:37 gcosmo Exp $ 28 // GEANT4 tag $Name: geommng-V09-03-05 $ 29 29 // 30 30 // class G4VSolid … … 158 158 JustWarning, "Not implemented for this solid ! Returning origin."); 159 159 return G4ThreeVector(0,0,0); 160 } 161 162 ////////////////////////////////////////////////////////////////////////// 163 // 164 // Dummy implementations ... 165 166 const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const 167 { return 0; } 168 169 G4VSolid* G4VSolid::GetConstituentSolid(G4int) 170 { return 0; } 171 172 const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const 173 { return 0; } 174 175 G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() 176 { return 0; } 177 178 //////////////////////////////////////////////////////////////// 179 // 180 // Returns an estimation of the solid volume in internal units. 181 // The number of statistics and error accuracy is fixed. 182 // This method may be overloaded by derived classes to compute the 183 // exact geometrical quantity for solids where this is possible. 184 // or anyway to cache the computed value. 185 // This implementation does NOT cache the computed value. 186 187 G4double G4VSolid::GetCubicVolume() 188 { 189 G4int cubVolStatistics = 1000000; 190 G4double cubVolEpsilon = 0.001; 191 return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon); 192 } 193 194 //////////////////////////////////////////////////////////////// 195 // 196 // Calculate cubic volume based on Inside() method. 197 // Accuracy is limited by the second argument or the statistics 198 // expressed by the first argument. 199 // Implementation is courtesy of Vasiliki Despoina Mitsou, 200 // University of Athens. 201 202 G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const 203 { 204 G4int iInside=0; 205 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume; 206 G4bool yesno; 207 G4ThreeVector p; 208 EInside in; 209 210 // values needed for CalculateExtent signature 211 212 G4VoxelLimits limit; // Unlimited 213 G4AffineTransform origin; 214 215 // min max extents of pSolid along X,Y,Z 216 217 yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX); 218 yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY); 219 yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ); 220 221 // limits 222 223 if(nStat < 100) nStat = 100; 224 if(epsilon > 0.01) epsilon = 0.01; 225 226 for(G4int i = 0; i < nStat; i++ ) 227 { 228 px = minX+(maxX-minX)*G4UniformRand(); 229 py = minY+(maxY-minY)*G4UniformRand(); 230 pz = minZ+(maxZ-minZ)*G4UniformRand(); 231 p = G4ThreeVector(px,py,pz); 232 in = this->Inside(p); 233 if(in != kOutside) iInside++; 234 } 235 volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat; 236 return volume; 237 } 238 239 //////////////////////////////////////////////////////////////// 240 // 241 // Returns an estimation of the solid surface area in internal units. 242 // The number of statistics and error accuracy is fixed. 243 // This method may be overloaded by derived classes to compute the 244 // exact geometrical quantity for solids where this is possible. 245 // or anyway to cache the computed value. 246 // This implementation does NOT cache the computed value. 247 248 G4double G4VSolid::GetSurfaceArea() 249 { 250 G4int stat = 1000000; 251 G4double ell = -1.; 252 return EstimateSurfaceArea(stat,ell); 253 } 254 255 //////////////////////////////////////////////////////////////// 256 // 257 // Estimate surface area based on Inside(), DistanceToIn(), and 258 // DistanceToOut() methods. Accuracy is limited by the statistics 259 // defined by the first argument. Implemented by Mikhail Kosov. 260 261 G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const 262 { 263 G4int inside=0; 264 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf; 265 G4bool yesno; 266 G4ThreeVector p; 267 EInside in; 268 269 // values needed for CalculateExtent signature 270 271 G4VoxelLimits limit; // Unlimited 272 G4AffineTransform origin; 273 274 // min max extents of pSolid along X,Y,Z 275 276 yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX); 277 yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY); 278 yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ); 279 280 // limits 281 282 if(nStat < 100) { nStat = 100; } 283 284 G4double dX=maxX-minX; 285 G4double dY=maxY-minY; 286 G4double dZ=maxZ-minZ; 287 if(ell<=0.) // Automatic definition of skin thickness 288 { 289 G4double minval=dX; 290 if(dY<dX) { minval=dY; } 291 if(dZ<minval) { minval=dZ; } 292 ell=.01*minval; 293 } 294 295 G4double dd=2*ell; 296 minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd; 297 298 for(G4int i = 0; i < nStat; i++ ) 299 { 300 px = minX+dX*G4UniformRand(); 301 py = minY+dY*G4UniformRand(); 302 pz = minZ+dZ*G4UniformRand(); 303 p = G4ThreeVector(px,py,pz); 304 in = this->Inside(p); 305 if(in != kOutside) 306 { 307 if (DistanceToOut(p)<ell) { inside++; } 308 } 309 else if(DistanceToIn(p)<ell) { inside++; } 310 } 311 // @@ The conformal correction can be upgraded 312 surf = dX*dY*dZ*inside/dd/nStat; 313 return surf; 314 } 315 316 /////////////////////////////////////////////////////////////////////////// 317 // 318 // Returns a pointer of a dynamically allocated copy of the solid. 319 // Returns NULL pointer with warning in case the concrete solid does not 320 // implement this method. The caller has responsibility for ownership. 321 // 322 323 G4VSolid* G4VSolid::Clone() const 324 { 325 G4String ErrMessage = "Clone() method not implemented for type: " 326 + GetEntityType() + "! Returning NULL pointer!"; 327 G4Exception("G4VSolid::Clone()", "NotImplemented", 328 JustWarning, ErrMessage); 329 return 0; 160 330 } 161 331 … … 447 617 } 448 618 449 const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const450 { return 0; }451 452 G4VSolid* G4VSolid::GetConstituentSolid(G4int)453 { return 0; }454 455 const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const456 { return 0; }457 458 G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr()459 { return 0; }460 461 619 G4VisExtent G4VSolid::GetExtent () const 462 620 { … … 491 649 return 0; 492 650 } 493 494 ////////////////////////////////////////////////////////////////495 //496 // Returns an estimation of the solid volume in internal units.497 // The number of statistics and error accuracy is fixed.498 // This method may be overloaded by derived classes to compute the499 // exact geometrical quantity for solids where this is possible.500 // or anyway to cache the computed value.501 // This implementation does NOT cache the computed value.502 503 G4double G4VSolid::GetCubicVolume()504 {505 G4int cubVolStatistics = 1000000;506 G4double cubVolEpsilon = 0.001;507 return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);508 }509 510 ////////////////////////////////////////////////////////////////511 //512 // Calculate cubic volume based on Inside() method.513 // Accuracy is limited by the second argument or the statistics514 // expressed by the first argument.515 // Implementation is courtesy of Vasiliki Despoina Mitsou,516 // University of Athens.517 518 G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const519 {520 G4int iInside=0;521 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;522 G4bool yesno;523 G4ThreeVector p;524 EInside in;525 526 // values needed for CalculateExtent signature527 528 G4VoxelLimits limit; // Unlimited529 G4AffineTransform origin;530 531 // min max extents of pSolid along X,Y,Z532 533 yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);534 yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);535 yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);536 537 // limits538 539 if(nStat < 100) nStat = 100;540 if(epsilon > 0.01) epsilon = 0.01;541 542 for(G4int i = 0; i < nStat; i++ )543 {544 px = minX+(maxX-minX)*G4UniformRand();545 py = minY+(maxY-minY)*G4UniformRand();546 pz = minZ+(maxZ-minZ)*G4UniformRand();547 p = G4ThreeVector(px,py,pz);548 in = this->Inside(p);549 if(in != kOutside) iInside++;550 }551 volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;552 return volume;553 }554 555 ////////////////////////////////////////////////////////////////556 //557 // Returns an estimation of the solid surface area in internal units.558 // The number of statistics and error accuracy is fixed.559 // This method may be overloaded by derived classes to compute the560 // exact geometrical quantity for solids where this is possible.561 // or anyway to cache the computed value.562 // This implementation does NOT cache the computed value.563 564 G4double G4VSolid::GetSurfaceArea()565 {566 G4int stat = 1000000;567 G4double ell = -1.;568 return EstimateSurfaceArea(stat,ell);569 }570 571 ////////////////////////////////////////////////////////////////572 //573 // Estimate surface area based on Inside(), DistanceToIn(), and574 // DistanceToOut() methods. Accuracy is limited by the statistics575 // defined by the first argument. Implemented by Mikhail Kosov.576 577 G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const578 {579 G4int inside=0;580 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf;581 G4bool yesno;582 G4ThreeVector p;583 EInside in;584 585 // values needed for CalculateExtent signature586 587 G4VoxelLimits limit; // Unlimited588 G4AffineTransform origin;589 590 // min max extents of pSolid along X,Y,Z591 592 yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);593 yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);594 yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);595 596 // limits597 598 if(nStat < 100) { nStat = 100; }599 600 G4double dX=maxX-minX;601 G4double dY=maxY-minY;602 G4double dZ=maxZ-minZ;603 if(ell<=0.) // Automatic definition of skin thickness604 {605 G4double minval=dX;606 if(dY<dX) { minval=dY; }607 if(dZ<minval) { minval=dZ; }608 ell=.01*minval;609 }610 611 G4double dd=2*ell;612 minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd;613 614 for(G4int i = 0; i < nStat; i++ )615 {616 px = minX+dX*G4UniformRand();617 py = minY+dY*G4UniformRand();618 pz = minZ+dZ*G4UniformRand();619 p = G4ThreeVector(px,py,pz);620 in = this->Inside(p);621 if(in != kOutside)622 {623 if (DistanceToOut(p)<ell) { inside++; }624 }625 else if(DistanceToIn(p)<ell) { inside++; }626 }627 // @@ The conformal correction can be upgraded628 surf = dX*dY*dZ*inside/dd/nStat;629 return surf;630 }
Note:
See TracChangeset
for help on using the changeset viewer.
