Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.24 2000/11/20 17:29:03 gcosmo Exp $
|
||||
$Id: History,v 1.33 2001/04/04 10:43:11 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,73 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Apr 04th, 2001 G. Cosmo - field-V03-00-05
|
||||
------------------------
|
||||
- G4FieldTrack.icc: fixed pedantic warnings on Linux-g++.
|
||||
|
||||
Mar 23rd, 2001 J. Apostolakis - field-V03-00-04
|
||||
------------------------------
|
||||
- Electric Field unit test now works: test runs until completion.
|
||||
Test outputs saved (on Linux).
|
||||
|
||||
- Fixed src/G4UniformElectricField.cc to set correct field components
|
||||
(compatible with Equation of Motion
|
||||
G4EqMagElectricField )
|
||||
|
||||
- Tidied G4FieldTrack
|
||||
* deleted obsolete methods Set/Get MomentumModulus() and its data member.
|
||||
* in constructor to set the value of the spin to (0.0, 0.0, 0.0)
|
||||
if pSpin is null. (It was undefined.)
|
||||
|
||||
Mar 23rd, 2001 J. Apostolakis - field-V03-00-03
|
||||
------------------------------
|
||||
- Fixed (hacked) CashKarp to work using Auxiliary Stepper.
|
||||
|
||||
- Modified G4MagIntegratorStepper
|
||||
to use pointer to G4EquationOfMotion
|
||||
instead of G4Mag_EqRhs
|
||||
|
||||
- Design iteration appears neccessary
|
||||
|
||||
Mar 23rd, 2001 J. Apostolakis - field-V03-00-02
|
||||
------------------------------
|
||||
- Fixed G4MagHelicalStepper::AdvanceHelix for momentum, allowing
|
||||
the possibility of (correct) use of all Helical Steppers.
|
||||
|
||||
- test/testProElectroMagField.cc updated for momentum.
|
||||
(Not yet updated: Spin tests)
|
||||
|
||||
|
||||
Mar 19th, 2001 J. Apostolakis - field-V03-00-01
|
||||
------------------------------
|
||||
- Tagging the modification of several classes to integrate in momentum*c_light
|
||||
instead of velocity.
|
||||
Reason for change: Velocity integration can result in superluminar
|
||||
velocities, due to arithmetic inaccuracies.
|
||||
Classes modified:
|
||||
G4FieldTrack, (Changed components 3,4,5 of SixVector to Momentum,
|
||||
G4Mag_EqRhs, G4Mag_UsualEqRhs, G4EqMagElectricField
|
||||
|
||||
Feb 20th, 2001 J. Apostolakis
|
||||
|
||||
- Modified several classes to integrate in momentum instead of velocity.
|
||||
|
||||
G4FieldTrack:
|
||||
Changed components 3,4,5 of SixVector to Momentum,
|
||||
Modified constructor
|
||||
Added energy calculation to "LoadFromArray" method
|
||||
GetEnergy method is now implemented.
|
||||
Deleted obsolete (old) method names for Curve and Position. New have "Get"
|
||||
|
||||
G4ChordFinder
|
||||
Renamed old-method names of Field Track to new ones.
|
||||
|
||||
Jan 29th, 2001 G. Cosmo - field-V03-00-00
|
||||
-------------------------
|
||||
|
||||
- Minor fix to G4MagneticField.hh: added explicit call to G4Field() in
|
||||
copy constructor. Fixes report #205.
|
||||
|
||||
Nov 20th, 2000 G. Cosmo - field-V02-00-02
|
||||
|
||||
- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4CashKarpRKF45.hh,v 1.6 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4CashKarpRKF45
|
||||
@@ -33,7 +33,7 @@ class G4CashKarpRKF45 : public G4MagIntegratorStepper
|
||||
|
||||
public: // with description
|
||||
|
||||
G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariables = 6, G4bool primary= true) ;
|
||||
~G4CashKarpRKF45() ;
|
||||
|
||||
void Stepper( const G4double y[],
|
||||
@@ -53,8 +53,8 @@ class G4CashKarpRKF45 : public G4MagIntegratorStepper
|
||||
|
||||
public: // without description
|
||||
|
||||
G4double DistChord() const = 0 ; // This is not IMPLEMENTED yet.
|
||||
// It must be done before it can work.
|
||||
G4double DistChord() const;
|
||||
|
||||
G4int IntegratorOrder() const { return 4; }
|
||||
|
||||
private:
|
||||
@@ -67,6 +67,12 @@ class G4CashKarpRKF45 : public G4MagIntegratorStepper
|
||||
|
||||
G4int fNumberOfVariables ;
|
||||
G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn; // scratch space
|
||||
|
||||
// for DistChord calculations
|
||||
|
||||
G4double fLastStepLength;
|
||||
G4double *fLastInitialVector, *fLastFinalVector, *fLastDyDx, *fMidVector, *fMidError;
|
||||
G4CashKarpRKF45* fAuxStepper;
|
||||
};
|
||||
|
||||
#endif /* G4CashKARP_RKF45 */
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChordFinder.hh,v 1.5 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4ChordFinder.hh,v 1.6 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4ChordFinder
|
||||
@@ -100,7 +100,7 @@ class G4ChordFinder
|
||||
|
||||
// Variables used in construction/destruction
|
||||
G4bool fAllocatedStepper;
|
||||
G4Mag_EqRhs* fEquation;
|
||||
G4EquationOfMotion* fEquation;
|
||||
G4MagIntegratorStepper* fDriversStepper;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChordFinder.icc,v 1.2 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// G4ChordFinder inline implementations
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ClassicalRK4.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4ClassicalRK4
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ElectroMagneticField.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4ElectroMagneticField
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EqMagElectricField.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4EqMagElectricField.hh,v 1.5 2001/02/20 08:49:29 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4EqMagElectricField
|
||||
@@ -46,7 +46,8 @@ class G4EqMagElectricField : public G4Mag_EqRhs
|
||||
|
||||
private:
|
||||
|
||||
G4double fElectroMagCof;
|
||||
G4double fElectroMagCof ;
|
||||
G4double fMassCof;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4EquationOfMotion
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.icc,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ExplicitEuler.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4ExplicitEuler
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Field.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4Field
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldManager.hh,v 1.5 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldManager
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldManager.icc,v 1.3 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4FieldManager inline implementation
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4FieldTrack.hh,v 1.6 2001/03/27 15:35:14 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldTrack
|
||||
@@ -35,10 +35,12 @@ class G4FieldTrack
|
||||
public: // with description
|
||||
|
||||
G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Or UnitVelocity
|
||||
const G4ThreeVector& pMomentumDirection,
|
||||
G4double curve_length,
|
||||
G4double Energy,
|
||||
G4double LabratTimeOfFlight=0.0,
|
||||
G4double kineticEnergy,
|
||||
const G4double restMass_c2,
|
||||
G4double velocity,
|
||||
G4double LaboratoryTimeOfFlight=0.0,
|
||||
G4double ProperTimeOfFlight=0.0,
|
||||
const G4ThreeVector* pSpin=0);
|
||||
|
||||
@@ -50,27 +52,29 @@ class G4FieldTrack
|
||||
inline G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
|
||||
// Assignment operator
|
||||
|
||||
inline G4ThreeVector GetVelocity() const;
|
||||
inline G4ThreeVector GetMomentum() const;
|
||||
inline G4ThreeVector GetPosition() const;
|
||||
inline const G4ThreeVector& GetMomentumDir() const;
|
||||
inline G4double GetCurveLength() const;
|
||||
// Distance along curve of point.
|
||||
inline G4double GetMomentumModulus() const;
|
||||
// inline G4double GetMomentumModulus() const; // Obsolete
|
||||
inline G4ThreeVector GetSpin() const;
|
||||
inline G4double GetLabTimeOfFlight() const;
|
||||
inline G4double GetProperTimeOfFlight() const;
|
||||
// Accessors.
|
||||
|
||||
inline void SetPosition(G4ThreeVector nPos);
|
||||
inline void SetVelocity(G4ThreeVector nMomDir);
|
||||
inline void SetMomentum(G4ThreeVector nMomDir);
|
||||
// Does change mom-dir too.
|
||||
|
||||
inline void SetMomentumDir(G4ThreeVector nMomDir);
|
||||
// Does NOT change velocity.
|
||||
// Does NOT change Momentum or Velocity Vector.
|
||||
|
||||
inline void SetCurveLength(G4double nCurve_s);
|
||||
// Distance along curve.
|
||||
inline void SetEnergy(G4double nEnergy);
|
||||
inline void SetKineticEnergy(G4double nEnergy);
|
||||
// Does not modify momentum.
|
||||
inline void SetMomentumModulus(G4double nMomentumMod);
|
||||
// inline void SetMomentumModulus(G4double nMomentumMod); // Obsolete
|
||||
// Does not modify energy.
|
||||
inline void SetSpin(G4ThreeVector nSpin);
|
||||
inline void SetLabTimeOfFlight(G4double nTOF);
|
||||
@@ -80,26 +84,18 @@ class G4FieldTrack
|
||||
public: // without description
|
||||
|
||||
inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity,
|
||||
const G4ThreeVector& pMomentum,
|
||||
G4double s_curve );
|
||||
// Old multi-set method
|
||||
|
||||
inline G4ThreeVector Position() const;
|
||||
// Renamed to GetPosition
|
||||
G4double GetKineticEnergy() const; // Check it --> FIXME
|
||||
|
||||
inline G4double CurveS() const;
|
||||
// Distance along curve of point
|
||||
inline void SetCurveS(G4double new_curve_s);
|
||||
// Old methods to be deleted.
|
||||
|
||||
// G4double GetEnergy() const; // Wrong Energy --> FIXME
|
||||
|
||||
// G4double* PosVelVec(); // [6] Needed for RK integrator
|
||||
// G4double* PosVelVec(); // [6] Needed(?) for RK integrator
|
||||
// This old method completely broke encapsulation ?
|
||||
|
||||
// static const G4int ncompSVEC=15;
|
||||
// Needed and should be used only for RK integration driver
|
||||
enum { ncompSVEC = 16 };
|
||||
enum { ncompSVEC = 12 };
|
||||
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
|
||||
inline void LoadFromArray(G4double valArr[ncompSVEC]);
|
||||
|
||||
@@ -110,10 +106,11 @@ class G4FieldTrack
|
||||
|
||||
G4double SixVector[6];
|
||||
G4double fDistanceAlongCurve; // distance along curve of point
|
||||
G4double fEnergy;
|
||||
G4double fKineticEnergy;
|
||||
G4double fRestMass_c2;
|
||||
G4double fLabTimeOfFlight;
|
||||
G4double fProperTimeOfFlight;
|
||||
G4double fMomentumModulus;
|
||||
// G4double fMomentumModulus; // Unused
|
||||
G4ThreeVector fSpin;
|
||||
G4ThreeVector fMomentumDir;
|
||||
};
|
||||
|
||||
@@ -5,35 +5,45 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.icc,v 1.4 2000/11/20 17:29:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4FieldTrack.icc,v 1.7 2001/04/04 10:39:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "PhysicalConstants.h"
|
||||
|
||||
inline
|
||||
G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Can be unit
|
||||
const G4ThreeVector& pMomentumDirection,
|
||||
G4double curve_length,
|
||||
G4double pEnergy,
|
||||
G4double pLabortTimeOfFlight,
|
||||
G4double kineticEnergy,
|
||||
const G4double restMass_c2,
|
||||
G4double velocity,
|
||||
G4double pLaboratoryTimeOfFlight,
|
||||
G4double pProperTimeOfFlight,
|
||||
const G4ThreeVector* pSpin)
|
||||
: fEnergy(pEnergy),
|
||||
fLabTimeOfFlight(pLabortTimeOfFlight),
|
||||
: fKineticEnergy(kineticEnergy),
|
||||
fRestMass_c2(restMass_c2),
|
||||
fLabTimeOfFlight(pLaboratoryTimeOfFlight),
|
||||
fProperTimeOfFlight(pProperTimeOfFlight),
|
||||
fMomentumDir(pVelocity.unit())
|
||||
fMomentumDir(pMomentumDirection)
|
||||
{
|
||||
SetCurvePnt( pPosition, pVelocity, curve_length );
|
||||
G4double momentum = sqrt(kineticEnergy*kineticEnergy
|
||||
+2.0*restMass_c2*kineticEnergy);
|
||||
|
||||
G4ThreeVector pMomentum= momentum * pMomentumDirection;
|
||||
// fMomentumModulus= pMomentum;
|
||||
SetCurvePnt( pPosition, pMomentum, curve_length );
|
||||
if(pSpin) fSpin = *pSpin;
|
||||
else fSpin = G4ThreeVector(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
inline
|
||||
G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec )
|
||||
: fDistanceAlongCurve( rStVec.fDistanceAlongCurve),
|
||||
fEnergy( rStVec.fEnergy ),
|
||||
fKineticEnergy( rStVec.fKineticEnergy ),
|
||||
fRestMass_c2( rStVec.fRestMass_c2),
|
||||
fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
|
||||
fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
|
||||
fMomentumModulus( rStVec.fMomentumModulus ),
|
||||
// fMomentumModulus( rStVec.fMomentumModulus ),
|
||||
fSpin( rStVec.fSpin ),
|
||||
fMomentumDir( rStVec.fMomentumDir )
|
||||
{
|
||||
@@ -56,18 +66,18 @@ G4FieldTrack::~G4FieldTrack()
|
||||
|
||||
inline G4FieldTrack&
|
||||
G4FieldTrack::SetCurvePnt(const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Can be Unit
|
||||
const G4ThreeVector& pMomentum, // Can be Unit
|
||||
G4double s_curve )
|
||||
{
|
||||
SixVector[0] = pPosition.x();
|
||||
SixVector[1] = pPosition.y();
|
||||
SixVector[2] = pPosition.z();
|
||||
|
||||
SixVector[3] = pVelocity.x();
|
||||
SixVector[4] = pVelocity.y();
|
||||
SixVector[5] = pVelocity.z();
|
||||
SixVector[3] = pMomentum.x();
|
||||
SixVector[4] = pMomentum.y();
|
||||
SixVector[5] = pMomentum.z();
|
||||
|
||||
fMomentumDir = pVelocity.unit();
|
||||
fMomentumDir = pMomentum.unit();
|
||||
|
||||
fDistanceAlongCurve= s_curve;
|
||||
|
||||
@@ -89,17 +99,10 @@ void G4FieldTrack::SetPosition( G4ThreeVector pPosition)
|
||||
SixVector[2] = pPosition.z();
|
||||
}
|
||||
|
||||
// Older ... obsolete
|
||||
inline
|
||||
G4ThreeVector G4FieldTrack::Position() const
|
||||
{
|
||||
return this->GetPosition();
|
||||
}
|
||||
|
||||
inline
|
||||
const G4ThreeVector& G4FieldTrack::GetMomentumDir() const
|
||||
{
|
||||
// G4ThreeVector myVelocity( SixVector[3], SixVector[4], SixVector[5] );
|
||||
// G4ThreeVector myMomentum( SixVector[3], SixVector[4], SixVector[5] );
|
||||
// return myVelocity;
|
||||
return fMomentumDir;
|
||||
}
|
||||
@@ -110,36 +113,24 @@ G4double G4FieldTrack::GetCurveLength() const
|
||||
return fDistanceAlongCurve;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4FieldTrack::CurveS() const
|
||||
{
|
||||
return this->GetCurveLength();
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldTrack::SetCurveLength(G4double nCurve_s)
|
||||
{
|
||||
fDistanceAlongCurve= nCurve_s;
|
||||
}
|
||||
|
||||
// #ifdef ENERGY_OK
|
||||
inline
|
||||
void G4FieldTrack::SetCurveS(G4double new_curve_s)
|
||||
G4double G4FieldTrack::GetKineticEnergy() const
|
||||
{
|
||||
this->SetCurveLength(new_curve_s);
|
||||
return fKineticEnergy;
|
||||
}
|
||||
|
||||
#ifdef ENERGY_OK
|
||||
inline
|
||||
G4double G4FieldTrack::GetEnergy() const
|
||||
{
|
||||
return fEnergy;
|
||||
}
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
inline
|
||||
void G4FieldTrack::SetEnergy(G4double nEnergy)
|
||||
void G4FieldTrack::SetKineticEnergy(G4double newKinEnergy)
|
||||
{
|
||||
fEnergy=nEnergy;
|
||||
fKineticEnergy=newKinEnergy;
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -178,6 +169,7 @@ void G4FieldTrack::SetProperTimeOfFlight(G4double nTOF)
|
||||
fProperTimeOfFlight=nTOF;
|
||||
}
|
||||
|
||||
#ifdef MOMENTUM_MODULUS
|
||||
inline
|
||||
G4double G4FieldTrack::GetMomentumModulus() const
|
||||
{
|
||||
@@ -189,6 +181,7 @@ void G4FieldTrack::SetMomentumModulus(G4double nMomentumMod)
|
||||
{
|
||||
fMomentumModulus= nMomentumMod; // does not modify energy
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
void G4FieldTrack::SetMomentumDir(G4ThreeVector newMomDir)
|
||||
@@ -197,19 +190,19 @@ void G4FieldTrack::SetMomentumDir(G4ThreeVector newMomDir)
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4FieldTrack::GetVelocity() const
|
||||
G4ThreeVector G4FieldTrack::GetMomentum() const
|
||||
{
|
||||
return G4ThreeVector( SixVector[3], SixVector[4], SixVector[5] );
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldTrack::SetVelocity(G4ThreeVector pVelocity)
|
||||
void G4FieldTrack::SetMomentum(G4ThreeVector pMomentum)
|
||||
{
|
||||
SixVector[3] = pVelocity.x();
|
||||
SixVector[4] = pVelocity.y();
|
||||
SixVector[5] = pVelocity.z();
|
||||
SixVector[3] = pMomentum.x();
|
||||
SixVector[4] = pMomentum.y();
|
||||
SixVector[5] = pMomentum.z();
|
||||
|
||||
fMomentumDir = pVelocity.unit();
|
||||
fMomentumDir = pMomentum.unit();
|
||||
}
|
||||
|
||||
// Dump values to array
|
||||
@@ -226,12 +219,14 @@ void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
|
||||
valArr[4]=SixVector[4];
|
||||
valArr[5]=SixVector[5];
|
||||
|
||||
G4ThreeVector Velocity(valArr[3],valArr[4],valArr[5]);
|
||||
G4double velocity_mag_sq = Velocity.mag2();
|
||||
G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
|
||||
|
||||
G4double mass_in_Kg;
|
||||
mass_in_Kg = fEnergy / velocity_mag_sq * (1-velocity_mag_sq/c_squared);
|
||||
valArr[6]= mass_in_Kg;
|
||||
// G4double mass_in_Kg;
|
||||
// mass_in_Kg = fEnergy / velocity_mag_sq * (1-velocity_mag_sq/c_squared);
|
||||
// valArr[6]= mass_in_Kg;
|
||||
|
||||
// The following components may or may not be integrated.
|
||||
valArr[6]= fKineticEnergy;
|
||||
|
||||
// valArr[6]=fEnergy; // When it is integrated over, do this ...
|
||||
valArr[7]=fLabTimeOfFlight;
|
||||
@@ -259,15 +254,19 @@ void G4FieldTrack::LoadFromArray(G4double valArr[ncompSVEC])
|
||||
SixVector[4]=valArr[4];
|
||||
SixVector[5]=valArr[5];
|
||||
|
||||
G4ThreeVector Velocity(valArr[3],valArr[4],valArr[5]);
|
||||
G4double velocity_mag_sq = Velocity.mag2();
|
||||
G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
|
||||
|
||||
// fEnergy=valArr[6]; // When it is integrated over, do this ...
|
||||
G4double momentum_square= Momentum.mag2();
|
||||
fMomentumDir= Momentum.unit();
|
||||
|
||||
G4double mass_in_Kg=valArr[6];
|
||||
fEnergy= mass_in_Kg * velocity_mag_sq / (1-velocity_mag_sq/c_squared);
|
||||
// sqr(c_light)
|
||||
fMomentumDir= Velocity.unit();
|
||||
fKineticEnergy = momentum_square /
|
||||
(sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
|
||||
+ fRestMass_c2 );
|
||||
// The above equation is stable for small and large momenta
|
||||
|
||||
// The following components may or may not be
|
||||
// integrated over -- integration is optional
|
||||
// fKineticEnergy= valArr[6];
|
||||
|
||||
fLabTimeOfFlight=valArr[7];
|
||||
fProperTimeOfFlight=valArr[8];
|
||||
@@ -292,11 +291,11 @@ G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
|
||||
SixVector[5]= rStVec.SixVector[5];
|
||||
SetCurveLength( rStVec.GetCurveLength() );
|
||||
|
||||
SetEnergy( rStVec.fEnergy );
|
||||
SetKineticEnergy( rStVec.fKineticEnergy );
|
||||
SetLabTimeOfFlight( rStVec.GetLabTimeOfFlight() );
|
||||
SetProperTimeOfFlight( rStVec.GetProperTimeOfFlight() );
|
||||
SetSpin( rStVec.GetSpin() );
|
||||
SetMomentumModulus( rStVec.GetMomentumModulus());
|
||||
// SetMomentumModulus( rStVec.GetMomentumModulus());
|
||||
SetMomentumDir( rStVec.fMomentumDir );
|
||||
|
||||
return *this;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixExplicitEuler
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixHeum.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixHeum
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixImplicitEuler
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.hh,v 1.4 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 03/12/98
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ImplicitEuler.hh,v 1.3 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LineSection.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4LineSection
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.hh,v 1.7 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagErrorStepper
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.icc,v 1.7 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagHelicalStepper.hh,v 1.6 2001/03/22 18:48:52 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagHelicalStepper
|
||||
@@ -80,6 +80,7 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
|
||||
G4MagHelicalStepper& operator=(const G4MagHelicalStepper&);
|
||||
// Private copy constructor and assignment operator.
|
||||
|
||||
static const G4double fUnitConstant; // As in G4Mag_EqRhs.hh/cc where it is not used.
|
||||
private:
|
||||
|
||||
G4ThreeVector yInitial, yMidPoint, yFinal;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.icc,v 1.4 2000/11/01 15:15:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
|
||||
// linear Step in regions of no field
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.hh,v 1.7 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagInt_Driver
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.icc,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagIntegratorStepper.hh,v 1.6 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagIntegratorStepper
|
||||
@@ -23,13 +23,13 @@
|
||||
#define G4MAGIntegratorSTEPPER
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4EquationOfMotion.hh"
|
||||
|
||||
class G4MagIntegratorStepper
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs, G4int num_variables);
|
||||
G4MagIntegratorStepper(G4EquationOfMotion *Equation, G4int num_variables);
|
||||
virtual ~G4MagIntegratorStepper();
|
||||
// Constructor and destructor. No actions.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.icc,v 1.4 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_EqRhs
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_SpinEqRhs.hh,v 1.4 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_SpinEqRhs
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_UsualEqRhs
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagneticField.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagneticField.hh,v 1.6 2001/01/29 10:13:29 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagneticField
|
||||
@@ -45,7 +45,7 @@ class G4MagneticField : public G4Field
|
||||
|
||||
inline G4MagneticField::G4MagneticField() {}
|
||||
inline G4MagneticField::~G4MagneticField() {}
|
||||
inline G4MagneticField::G4MagneticField(const G4MagneticField &) {}
|
||||
inline G4MagneticField::G4MagneticField(const G4MagneticField &):G4Field() {}
|
||||
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &p)
|
||||
{ if (&p == this) return *this; *this = p; return *this; }
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.hh,v 1.5 2000/11/01 15:15:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4RKG3_Stepper.hh,v 1.6 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4RKG3_Stepper
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
|
||||
class G4RKG3_Stepper : public G4MagIntegratorStepper
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleHeum.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleHeum
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleRunge.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleRunge
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformElectricField.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformElectricField
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformMagField.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformMagField
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.8 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
|
||||
// order method (giving fifth-order accuracy) for the solution
|
||||
@@ -19,12 +19,13 @@
|
||||
//
|
||||
|
||||
#include "G4CashKarpRKF45.hh"
|
||||
#include "G4LineSection.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
|
||||
G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
|
||||
G4CashKarpRKF45::G4CashKarpRKF45(G4EquationOfMotion *EqRhs, G4int numberOfVariables, G4bool primary)
|
||||
: G4MagIntegratorStepper(EqRhs, numberOfVariables)
|
||||
{
|
||||
fNumberOfVariables = numberOfVariables ;
|
||||
@@ -36,6 +37,17 @@ G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
|
||||
ak6 = new G4double[fNumberOfVariables] ;
|
||||
yTemp = new G4double[fNumberOfVariables] ;
|
||||
yIn = new G4double[fNumberOfVariables] ;
|
||||
|
||||
fLastInitialVector = new G4double[fNumberOfVariables] ;
|
||||
fLastFinalVector = new G4double[fNumberOfVariables] ;
|
||||
fLastDyDx = new G4double[fNumberOfVariables];
|
||||
|
||||
fMidVector = new G4double[fNumberOfVariables];
|
||||
fMidError = new G4double[fNumberOfVariables];
|
||||
fAuxStepper = 0;
|
||||
if( primary )
|
||||
fAuxStepper = new G4CashKarpRKF45(EqRhs, numberOfVariables, !primary);
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -52,6 +64,14 @@ G4CashKarpRKF45::~G4CashKarpRKF45()
|
||||
delete[] ak7;
|
||||
delete[] yTemp;
|
||||
delete[] yIn;
|
||||
|
||||
delete[] fLastInitialVector;
|
||||
delete[] fLastFinalVector;
|
||||
delete[] fLastDyDx;
|
||||
delete[] fMidVector;
|
||||
delete[] fMidError;
|
||||
|
||||
delete fAuxStepper;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -145,12 +165,21 @@ G4CashKarpRKF45::Stepper(const G4double yInput[],
|
||||
|
||||
yErr[i] = Step*(dc1*dydx[i] + dc3*ak3[i] + dc4*ak4[i] +
|
||||
dc5*ak5[i] + dc6*ak6[i]) ;
|
||||
|
||||
// Store Input and Final values, for possible use in calculating chord
|
||||
fLastInitialVector[i] = yIn[i] ;
|
||||
fLastFinalVector[i] = yOut[i];
|
||||
fLastDyDx[i] = dydx[i];
|
||||
}
|
||||
// NormaliseTangentVector( yOut ); // Not wanted
|
||||
|
||||
fLastStepLength =Step;
|
||||
|
||||
return ;
|
||||
|
||||
} // end of Stepper .......................................................
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
G4CashKarpRKF45::StepWithEst(const G4double yInput[],
|
||||
@@ -283,5 +312,42 @@ G4CashKarpRKF45::StepWithEst(const G4double yInput[],
|
||||
|
||||
return ;
|
||||
|
||||
} // end of StepWithEst ....................................................
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
G4double G4CashKarpRKF45::DistChord() const
|
||||
{
|
||||
G4double distLine, distChord;
|
||||
G4ThreeVector initialPoint, finalPoint, midPoint;
|
||||
|
||||
// Store last initial and final points (they will be overwritten in self-Stepper call!)
|
||||
initialPoint = G4ThreeVector( fLastInitialVector[0],
|
||||
fLastInitialVector[1], fLastInitialVector[2]);
|
||||
finalPoint = G4ThreeVector( fLastFinalVector[0],
|
||||
fLastFinalVector[1], fLastFinalVector[2]);
|
||||
|
||||
// Do half a step using StepNoErr
|
||||
|
||||
fAuxStepper->Stepper( fLastInitialVector, fLastDyDx, 0.5 * fLastStepLength,
|
||||
fMidVector, fMidError );
|
||||
|
||||
midPoint = G4ThreeVector( fMidVector[0], fMidVector[1], fMidVector[2]);
|
||||
|
||||
// Use stored values of Initial and Endpoint + new Midpoint to evaluate
|
||||
// distance of Chord
|
||||
|
||||
|
||||
if (initialPoint != finalPoint)
|
||||
{
|
||||
distLine = G4LineSection::Distline( midPoint, initialPoint, finalPoint );
|
||||
distChord = distLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
distChord = (midPoint-initialPoint).mag();
|
||||
}
|
||||
return distChord;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChordFinder.cc,v 1.16 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4ChordFinder.cc,v 1.18 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// 25.02.97 John Apostolakis, design and implimentation
|
||||
@@ -34,16 +34,16 @@ G4ChordFinder::G4ChordFinder( G4MagneticField* theMagField,
|
||||
{
|
||||
// Construct the Chord Finder
|
||||
// by creating in inverse order the Driver, the Stepper and EqRhs ...
|
||||
// G4Mag_EqRhs *
|
||||
fEquation = new G4Mag_UsualEqRhs(theMagField); // Should move q, p to
|
||||
fLastStepEstimate_Unconstrained = DBL_MAX;
|
||||
//G4FieldTrack ??
|
||||
G4Mag_EqRhs *pEquation = new G4Mag_UsualEqRhs(theMagField);
|
||||
fEquation = pEquation;
|
||||
fLastStepEstimate_Unconstrained = DBL_MAX; // Should move q, p to
|
||||
// G4FieldTrack ??
|
||||
// --->> Charge Q = 0
|
||||
// --->> Momentum P = 1 NOMINAL VALUES !!!!!!!!!!!!!!!!!!
|
||||
|
||||
if( pItsStepper == 0 )
|
||||
{
|
||||
pItsStepper = fDriversStepper = new G4ClassicalRK4(fEquation);
|
||||
pItsStepper = fDriversStepper = new G4ClassicalRK4(pEquation);
|
||||
fAllocatedStepper= true;
|
||||
}
|
||||
else
|
||||
@@ -290,8 +290,8 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
|
||||
|
||||
G4FieldTrack Current_PointVelocity= CurveA_PointVelocity;
|
||||
|
||||
G4ThreeVector CurveA_Point= CurveA_PointVelocity.Position();
|
||||
G4ThreeVector CurveB_Point= CurveB_PointVelocity.Position();
|
||||
G4ThreeVector CurveA_Point= CurveA_PointVelocity.GetPosition();
|
||||
G4ThreeVector CurveB_Point= CurveB_PointVelocity.GetPosition();
|
||||
|
||||
G4ThreeVector ChordAB_Vector= CurveB_Point - CurveA_Point;
|
||||
G4ThreeVector ChordAE_Vector= CurrentE_Point - CurveA_Point;
|
||||
@@ -301,7 +301,7 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
|
||||
G4double AE_fraction;
|
||||
|
||||
curve_length=
|
||||
CurveB_PointVelocity.CurveS() - CurveA_PointVelocity.CurveS();
|
||||
CurveB_PointVelocity.GetCurveLength() - CurveA_PointVelocity.GetCurveLength();
|
||||
|
||||
// const
|
||||
G4double integrationInaccuracyLimit= G4std::max( perMillion, 0.5*eps_step );
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ClassicalRK4.cc,v 1.3 2000/11/01 15:15:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -14,8 +14,8 @@ G4EqMagElectricField::SetChargeMomentumMass(G4double particleCharge, // e+ units
|
||||
G4double MomentumXc,
|
||||
G4double particleMass)
|
||||
{
|
||||
fElectroMagCof = eplus*c_squared ;
|
||||
fElectroMagCof *= particleCharge/particleMass;
|
||||
fElectroMagCof = eplus*particleCharge*c_light ;
|
||||
fMassCof = particleMass*particleMass ;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,28 +28,27 @@ G4EqMagElectricField::EvaluateRhsGivenB(const G4double y[],
|
||||
|
||||
// Components of y:
|
||||
// 0-2 dr/ds,
|
||||
// 3-5 dv/ds
|
||||
// FCof() = charge/mass
|
||||
// 3-5 dp/ds - momentum derivatives
|
||||
|
||||
G4double vSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
|
||||
G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
|
||||
|
||||
G4double vModule = sqrt(vSquared) ;
|
||||
G4double cof2 = sqrt( pSquared + fMassCof )/c_light ;
|
||||
|
||||
G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
|
||||
G4double pModuleInverse = 1.0/sqrt(pSquared) ;
|
||||
|
||||
G4double gammaReci = sqrt(1 - vSquared/c_squared) ;
|
||||
G4double cof1 = fElectroMagCof*pModuleInverse ;
|
||||
|
||||
dydx[0] = y[3]/vModule ;
|
||||
dydx[1] = y[4]/vModule ;
|
||||
dydx[2] = y[5]/vModule ;
|
||||
// G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
|
||||
|
||||
dydx[3] = fElectroMagCof*(Field[3] + (y[4]*Field[2] - y[5]*Field[1])/c_light -
|
||||
y[3]*vDotE/c_light/c_light )*gammaReci/vModule ;
|
||||
|
||||
dydx[0] = y[3]*pModuleInverse ;
|
||||
dydx[1] = y[4]*pModuleInverse ;
|
||||
dydx[2] = y[5]*pModuleInverse ;
|
||||
|
||||
dydx[3] = cof1*(cof2*Field[3] + (y[4]*Field[2] - y[5]*Field[1])) ;
|
||||
|
||||
dydx[4] = fElectroMagCof*(Field[4] + (y[5]*Field[0] - y[3]*Field[2])/c_light -
|
||||
y[4]*vDotE/c_light/c_light )*gammaReci/vModule ;
|
||||
dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
|
||||
|
||||
dydx[5] = fElectroMagCof*(Field[5] + (y[3]*Field[1] - y[4]*Field[0])/c_light -
|
||||
y[5]*vDotE/c_light/c_light)*gammaReci/vModule ;
|
||||
dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4EquationOfMotion.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ExplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Explicit Euler: x_1 = x_0 + h * dx_0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldManager.cc,v 1.3 2000/11/09 18:06:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4FieldTrack.cc,v 1.3 2001/02/20 18:15:54 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4FieldTrack.hh"
|
||||
|
||||
@@ -15,6 +15,6 @@ G4std::ostream& operator<<( G4std::ostream& os, G4FieldTrack& SixVec)
|
||||
G4double *SixV = SixVec.SixVector;
|
||||
os << " X= " << SixV[0] << " " << SixV[1] << " " << SixV[2] << " ";
|
||||
os << " V= " << SixV[3] << " " << SixV[4] << " " << SixV[5] << " ";
|
||||
os << " l= " << SixVec.CurveS();
|
||||
os << " l= " << SixVec.GetCurveLength();
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixExplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixHeum.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixHeum.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixImplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.cc,v 1.4 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4HelixSimpleRunge.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ImplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Implicit Euler:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LineSection.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// typedef double G4double;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.cc,v 1.8 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagErrorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.7 2001/03/22 18:48:03 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -29,6 +29,9 @@ G4MagHelicalStepper::~G4MagHelicalStepper()
|
||||
{
|
||||
}
|
||||
|
||||
// Constant for determining unit conversion when using normal as integrand.
|
||||
const G4double G4MagHelicalStepper::fUnitConstant = 0.299792458 * (GeV/(tesla*m));
|
||||
|
||||
void
|
||||
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
G4ThreeVector Bfld,
|
||||
@@ -48,7 +51,13 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
G4double Bmag = Bfld.mag();
|
||||
const G4double *pIn = yIn+3;
|
||||
G4ThreeVector initTangent= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4ThreeVector initMomentum= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4double momentumVal = initMomentum.mag();
|
||||
G4ThreeVector initTangent = (1.0/momentumVal) * initMomentum; // .unit();
|
||||
|
||||
// fCof = fUnitConstant*particleCharge/MomentumXc;
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
G4double fCoefficient = (fUnitConstant / momentumVal) * particleCharge;
|
||||
|
||||
// for too small magnetic fields there is no curvature
|
||||
// (include momentum here) FIXME
|
||||
@@ -74,7 +83,8 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// calculate the radius^-1 of the helix and the stepping angle
|
||||
|
||||
R_1 = - fPtrMagEqOfMot->FCof() * Bmag; // / B_v_P - but this cancels
|
||||
// R_1 = - fPtrMagEqOfMot->FCof() * Bmag; // / B_v_P - but this cancels
|
||||
R_1 = - fCoefficient * Bmag; // / B_v_P - but this cancels
|
||||
|
||||
// again in Theta - so we don't need it.
|
||||
if( fabs(R_1) < 1e-10 ) {
|
||||
@@ -85,7 +95,7 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// Trigonometrix
|
||||
|
||||
if( Theta < - approc_limit || Theta > approc_limit ) {
|
||||
if( fabs(Theta) > approc_limit ) {
|
||||
SinT2 = sin(0.5 * Theta);
|
||||
CosT2 = cos(0.5 * Theta);
|
||||
// SinT = sin(Theta);
|
||||
@@ -104,8 +114,9 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
// the actual "rotation"
|
||||
|
||||
positionMove = h * ( CosT2 * vperp +
|
||||
SinT2 * B_x_P + vpar );
|
||||
G4double R = 1.0 / R_1;
|
||||
// positionMove = h * ( CosT2 * vperp + SinT2 * B_x_P + vpar );
|
||||
positionMove = R * ( SinT * vperp + (1-CosT) * B_x_P) + h * vpar;
|
||||
endTangent = (CosT * vperp + SinT * B_x_P + vpar);
|
||||
|
||||
// Store the resulting position and tangent
|
||||
@@ -113,9 +124,9 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
yHelix[1] = yIn[1] + positionMove.y();
|
||||
yHelix[2] = yIn[2] + positionMove.z();
|
||||
|
||||
yHelix[3] = endTangent.x();
|
||||
yHelix[4] = endTangent.y();
|
||||
yHelix[5] = endTangent.z();
|
||||
yHelix[3] = momentumVal * endTangent.x();
|
||||
yHelix[4] = momentumVal * endTangent.y();
|
||||
yHelix[5] = momentumVal * endTangent.z();
|
||||
|
||||
// Store and/or calculate parameters for chord distance.
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.14 2000/11/20 17:29:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.5 2001/03/23 18:50:33 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
|
||||
// Constructor for stepper abstract base class.
|
||||
//
|
||||
|
||||
G4MagIntegratorStepper::G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs,
|
||||
G4MagIntegratorStepper::G4MagIntegratorStepper(G4EquationOfMotion* Equation,
|
||||
G4int num_var)
|
||||
: fEquation_Rhs(EqRhs),
|
||||
: fEquation_Rhs(Equation),
|
||||
fNumberOfVariables(num_var)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.6 2001/03/02 10:48:30 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion
|
||||
// in a pure Magnetic Field .
|
||||
@@ -35,7 +35,8 @@ G4Mag_EqRhs::SetChargeMomentumMass( G4double particleCharge, // e+ units
|
||||
G4double MomentumXc,
|
||||
G4double particleMass)
|
||||
{
|
||||
fCof_val = fUnitConstant*particleCharge/MomentumXc; // B must be in Tesla
|
||||
fCof_val = particleCharge*eplus*c_light ; // B must be in Tesla
|
||||
// fCof_val = fUnitConstant*particleCharge/MomentumXc; // B must be in Tesla
|
||||
// fMass = particleMass;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4Mag_UsualEqRhs.cc,v 1.3 2001/02/19 16:52:05 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
@@ -24,15 +24,21 @@ G4Mag_UsualEqRhs::EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const
|
||||
{
|
||||
G4double velocity_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_velocity_magnitude = 1.0 / sqrt( velocity_mag_square );
|
||||
G4double momentum_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_momentum_magnitude = 1.0 / sqrt( momentum_mag_square );
|
||||
|
||||
dydx[0] = y[3] * inv_velocity_magnitude; // (d/ds)x = Vx/V
|
||||
dydx[1] = y[4] * inv_velocity_magnitude; // (d/ds)y = Vy/V
|
||||
dydx[2] = y[5] * inv_velocity_magnitude; // (d/ds)z = Vz/V
|
||||
dydx[3] = FCof()*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
|
||||
dydx[4] = FCof()*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
|
||||
dydx[5] = FCof()*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
|
||||
G4double cof = FCof()*inv_momentum_magnitude;
|
||||
|
||||
dydx[0] = y[3]*inv_momentum_magnitude; // (d/ds)x = Vx/V
|
||||
dydx[1] = y[4]*inv_momentum_magnitude; // (d/ds)y = Vy/V
|
||||
dydx[2] = y[5]*inv_momentum_magnitude; // (d/ds)z = Vz/V
|
||||
|
||||
dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
|
||||
dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
|
||||
dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.cc,v 1.5 2000/11/20 17:29:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
#include "G4RKG3_Stepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleHeum.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// Simple Heum:
|
||||
// x_1 = x_0 + h *
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleRunge.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// Simple Runge:
|
||||
//
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformElectricField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4UniformElectricField.cc,v 1.3 2001/03/27 09:43:22 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
G4UniformElectricField::G4UniformElectricField(const G4ThreeVector FieldVector )
|
||||
{
|
||||
fFieldComponents[0] = 0.0;
|
||||
fFieldComponents[1] = 0.0;
|
||||
fFieldComponents[2] = 0.0;
|
||||
fFieldComponents[3] = FieldVector.x();
|
||||
fFieldComponents[4] = FieldVector.y();
|
||||
fFieldComponents[5] = FieldVector.z();
|
||||
@@ -33,6 +36,9 @@ G4UniformElectricField::G4UniformElectricField(G4double vField,
|
||||
vTheta >= 0 && vTheta <= pi &&
|
||||
vPhi >= 0 && vPhi <= twopi)
|
||||
{
|
||||
fFieldComponents[0] = 0.0;
|
||||
fFieldComponents[1] = 0.0;
|
||||
fFieldComponents[2] = 0.0;
|
||||
fFieldComponents[3] = vField*sin(vTheta)*cos(vPhi) ;
|
||||
fFieldComponents[4] = vField*sin(vTheta)*sin(vPhi) ;
|
||||
fFieldComponents[5] = vField*cos(vTheta) ;
|
||||
@@ -50,13 +56,13 @@ G4UniformElectricField::~G4UniformElectricField()
|
||||
|
||||
G4UniformElectricField::G4UniformElectricField (const G4UniformElectricField &p)
|
||||
{
|
||||
for (G4int i=3; i<6; i++)
|
||||
for (G4int i=0; i<6; i++)
|
||||
fFieldComponents[i] = p.fFieldComponents[i];
|
||||
}
|
||||
|
||||
G4UniformElectricField& G4UniformElectricField::operator = (const G4UniformElectricField &p)
|
||||
{
|
||||
for (G4int i=3; i<6; i++)
|
||||
for (G4int i=0; i<6; i++)
|
||||
fFieldComponents[i] = p.fFieldComponents[i];
|
||||
return *this;
|
||||
}
|
||||
@@ -65,11 +71,14 @@ G4UniformElectricField& G4UniformElectricField::operator = (const G4UniformElect
|
||||
|
||||
|
||||
void G4UniformElectricField::GetFieldValue (const G4double [3],
|
||||
G4double E[3] ) const
|
||||
G4double fieldBandE[6] ) const
|
||||
{
|
||||
E[0]= fFieldComponents[3] ;
|
||||
E[1]= fFieldComponents[4] ;
|
||||
E[2]= fFieldComponents[5] ;
|
||||
fieldBandE[0]= 0.0;
|
||||
fieldBandE[1]= 0.0;
|
||||
fieldBandE[2]= 0.0;
|
||||
fieldBandE[3]= fFieldComponents[3] ;
|
||||
fieldBandE[4]= fFieldComponents[4] ;
|
||||
fieldBandE[5]= fFieldComponents[5] ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformMagField.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.15 2000/11/20 17:31:33 gcosmo Exp $
|
||||
$Id: History,v 1.19 2001/03/08 13:21:11 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,23 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
March 07, 2001 G. Cosmo geommng-V03-00-01
|
||||
- G4PVPlacement.hh: corrected comments to constructor with G4RotationMatrix*
|
||||
as argument, to correspond to specifications in the User's Manual.
|
||||
- G4AssemblyVolume.cc: corrected comments about unique PV identifiers
|
||||
(by R.Chytracek).
|
||||
|
||||
February 07, 2001 G. Cosmo geommng-V03-00-00
|
||||
- Introduced first implementation of G4AssemblyVolume, a helper class to
|
||||
combine several volumes together in an arbitrary way in the 3D space.
|
||||
Added files: G4AssemblyVolume[.hh.icc.cc], G4AssemblyTriplet[.hh.icc]
|
||||
(by R.Chytracek).
|
||||
- Added unit test suite for G4AssemblyVolume class: TestAssemblyVolume
|
||||
(by R.Chytracek).
|
||||
|
||||
December 04, 2000 G. Cosmo
|
||||
- Minor fix to private assignment operator.
|
||||
|
||||
November 20, 2000 G. Cosmo geommng-V02-00-04
|
||||
- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
|
||||
o commented out variables declared and not used.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AffineTransform.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4AffineTransform
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AffineTransform.icc,v 1.3 1999/12/15 14:49:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4AffineTransformation Inline implementation
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AssemblyTriplet.hh,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Class G4AssemblyTriplet
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A class to help place logical volumes inside a generic containers (like
|
||||
// STL vector ) together with information about its rotation and placement.
|
||||
// How to interpret the rotation and translation depends on the class which
|
||||
// uses a container of these triplets. The first class using G4AssemblyTriplet
|
||||
// is G4AssemblyVolume class.
|
||||
// The pointer to the logical volume is copied so this class does not take
|
||||
// its ownership and does not delete the object behind.
|
||||
|
||||
// Author: Radovan Chytracek
|
||||
// Version: 1.0
|
||||
// Date: November 2000
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4_ASSEMBLYTRIPLET_H
|
||||
#define G4_ASSEMBLYTRIPLET_H
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AssemblyTriplet
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4AssemblyTriplet();
|
||||
// Default constructor
|
||||
|
||||
G4AssemblyTriplet( G4LogicalVolume* pVolume,
|
||||
G4ThreeVector& translation,
|
||||
G4RotationMatrix* pRotation);
|
||||
// An explicit constructor
|
||||
|
||||
G4AssemblyTriplet( const G4AssemblyTriplet& second );
|
||||
// Copy constructor
|
||||
|
||||
~G4AssemblyTriplet();
|
||||
// Destructor
|
||||
|
||||
G4AssemblyTriplet& operator=( const G4AssemblyTriplet& second );
|
||||
// Assignment operator
|
||||
|
||||
G4LogicalVolume* GetVolume() const;
|
||||
// Retrieve the logical volume reference
|
||||
|
||||
void SetVolume( G4LogicalVolume* pVolume );
|
||||
// Update the logical volume reference
|
||||
|
||||
G4ThreeVector GetTranslation() const;
|
||||
// Retrieve the logical volume translation
|
||||
|
||||
void SetTranslation( G4ThreeVector& pVolume );
|
||||
// Update the logical volume translation
|
||||
|
||||
G4RotationMatrix* GetRotation() const;
|
||||
// Retrieve the logical volume rotation
|
||||
|
||||
void SetRotation( G4RotationMatrix* pVolume );
|
||||
// Update the logical volume rotation
|
||||
|
||||
|
||||
private:
|
||||
|
||||
G4LogicalVolume* fVolume;
|
||||
// A logical volume
|
||||
|
||||
G4ThreeVector fTranslation;
|
||||
// A logical volume translation
|
||||
|
||||
G4RotationMatrix* fRotation;
|
||||
// A logical volume rotation
|
||||
};
|
||||
|
||||
#include "G4AssemblyTriplet.icc"
|
||||
|
||||
#endif // G4_ASSEMBLYTRIPLET_H
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AssemblyTriplet.icc,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Class G4AssemblyTriplet - inline implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline
|
||||
G4AssemblyTriplet::G4AssemblyTriplet()
|
||||
: fVolume( 0 ), fRotation( 0 )
|
||||
{
|
||||
G4ThreeVector v(0.,0.,0.);
|
||||
fTranslation = v;
|
||||
}
|
||||
|
||||
inline
|
||||
G4AssemblyTriplet::G4AssemblyTriplet( G4LogicalVolume* pVolume,
|
||||
G4ThreeVector& translation,
|
||||
G4RotationMatrix* pRotation )
|
||||
: fVolume( pVolume ), fTranslation( translation ), fRotation( pRotation )
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
G4AssemblyTriplet::G4AssemblyTriplet( const G4AssemblyTriplet& second )
|
||||
{
|
||||
fVolume = second.GetVolume();
|
||||
fRotation = second.GetRotation();
|
||||
fTranslation = second.GetTranslation();
|
||||
}
|
||||
|
||||
inline
|
||||
G4AssemblyTriplet::~G4AssemblyTriplet()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
G4LogicalVolume* G4AssemblyTriplet::GetVolume() const
|
||||
{
|
||||
return fVolume;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4AssemblyTriplet::SetVolume( G4LogicalVolume* pVolume )
|
||||
{
|
||||
fVolume = pVolume;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4AssemblyTriplet::GetTranslation() const
|
||||
{
|
||||
return fTranslation;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4AssemblyTriplet::SetTranslation( G4ThreeVector& translation )
|
||||
{
|
||||
fTranslation = translation;
|
||||
}
|
||||
|
||||
inline
|
||||
G4RotationMatrix* G4AssemblyTriplet::GetRotation() const
|
||||
{
|
||||
return fRotation;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4AssemblyTriplet::SetRotation( G4RotationMatrix* pRotation )
|
||||
{
|
||||
fRotation = pRotation;
|
||||
}
|
||||
|
||||
inline
|
||||
G4AssemblyTriplet&
|
||||
G4AssemblyTriplet::operator=( const G4AssemblyTriplet& second )
|
||||
{
|
||||
if( this != &second )
|
||||
{
|
||||
fVolume = second.GetVolume();
|
||||
fRotation = second.GetRotation();
|
||||
fTranslation = second.GetTranslation();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AssemblyVolume.hh,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Class G4AssemblyVolume
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4AssemblyVolume is a helper class to make the build process of geometry
|
||||
// easier. It allows to combine several volumes together in an arbitrary way
|
||||
// in 3D space and then work with the result as with a single logical volume
|
||||
// for placement.
|
||||
// The resulting objects are independent copies of each of the assembled
|
||||
// logical volumes. The placements are not, however, bound one to each other
|
||||
// when placement is done. They are seen as independent physical volumes in
|
||||
// space. This is the main difference when compared to the boolean solids or
|
||||
// parametrised physical volumes.
|
||||
|
||||
// Author: Radovan Chytracek, John Apostolakis, Gabriele Cosmo
|
||||
// Version: 1.0
|
||||
// Date: November 2000
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#ifndef G4_ASSEMBLYVOLUME_H
|
||||
#define G4_ASSEMBLYVOLUME_H
|
||||
|
||||
#include "g4std/vector"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4AssemblyTriplet.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4AssemblyVolume
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4AssemblyVolume();
|
||||
G4AssemblyVolume( G4LogicalVolume* volume,
|
||||
G4ThreeVector& translation,
|
||||
G4RotationMatrix* rotation);
|
||||
~G4AssemblyVolume();
|
||||
//
|
||||
// Constructors & destructor.
|
||||
// At destruction all the generated physical volumes and associated
|
||||
// rotation matrices of the imprints will be destroyed.
|
||||
|
||||
void AddPlacedVolume( G4LogicalVolume* pPlacedVolume,
|
||||
G4ThreeVector& translation,
|
||||
G4RotationMatrix* rotation);
|
||||
//
|
||||
// Place the given volume 'pPlacedVolume' inside the assembly.
|
||||
//
|
||||
// The taken approach:
|
||||
//
|
||||
// - Place it w.r.t. the assembly coordinate system.
|
||||
// This step is applied to each of the participating volumes.
|
||||
//
|
||||
// The other possible approaches:
|
||||
//
|
||||
// - Place w.r.t. the firstly added volume.
|
||||
// When placed the first, the virtual coordinate system becomes
|
||||
// the coordinate system of the first one.
|
||||
// Every next volume being added into the assembly will be placed
|
||||
// w.r.t to the first one.
|
||||
//
|
||||
// - Place w.r.t the last placed volume.
|
||||
// When placed the first, the virtual coordinate system becomes
|
||||
// the coordinate system of the first one.
|
||||
// Every next volume being added into the assembly will be placed
|
||||
// w.r.t to the previous one.
|
||||
|
||||
void AddPlacedVolume( G4LogicalVolume* pPlacedVolume,
|
||||
G4Transform3D& transformation);
|
||||
//
|
||||
// The same as previous but takes complete 3D transformation in space
|
||||
// as its argument.
|
||||
|
||||
void MakeImprint( G4LogicalVolume* pMotherLV,
|
||||
G4ThreeVector& translationInMother,
|
||||
G4RotationMatrix* pRotationInMother);
|
||||
//
|
||||
// Creates instance of an assembly volume inside the given mother volume.
|
||||
|
||||
void MakeImprint( G4LogicalVolume* pMotherLV,
|
||||
G4Transform3D& transformation);
|
||||
//
|
||||
// The same as previous but takes complete 3D transformation in space
|
||||
// as its argument.
|
||||
|
||||
private:
|
||||
|
||||
G4std::vector<G4AssemblyTriplet> fTriplets;
|
||||
//
|
||||
// Participating volumes represented as a vector of
|
||||
// <logical volume, translation, rotation>.
|
||||
|
||||
G4std::vector<G4VPhysicalVolume*> fPVStore;
|
||||
//
|
||||
// We need to keep list of physical volumes created by MakeImprint() method
|
||||
// in order to be able to cleanup the objects when not needed anymore.
|
||||
// This requires the user to keep assembly objects in memory during the
|
||||
// whole job or during the life-time of G4Navigator, log. vol store
|
||||
// and phys. vol. store may keep pointers to physical volumes generated by
|
||||
// the assembly volume.
|
||||
// When an assembly object is about to die it will destroy all its
|
||||
// generated physical volumes and rotation matrices as well !
|
||||
// This may affect validity of detector contruction !
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int GetImprintsCount() const;
|
||||
void SetImprintsCount( unsigned int value );
|
||||
void ImprintsCountPlus();
|
||||
void ImprintsCountMinus();
|
||||
//
|
||||
// Internal counting mechanism, used to compute unique the names of
|
||||
// phys. volumes created by MakeImprint(...) method(s).
|
||||
|
||||
private:
|
||||
|
||||
unsigned int fImprintsCounter;
|
||||
//
|
||||
// Number of imprints of the given assembly volume.
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int GetInstanceCount() const;
|
||||
void SetInstanceCount( unsigned int value );
|
||||
void InstanceCountPlus();
|
||||
void InstanceCountMinus();
|
||||
|
||||
private:
|
||||
|
||||
static unsigned int fsInstanceCounter;
|
||||
|
||||
};
|
||||
|
||||
#include "G4AssemblyVolume.icc"
|
||||
|
||||
#endif // G4_ASSEMBLYVOLUME_H
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AssemblyVolume.icc,v 1.2 2001/02/07 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Class G4AssemblyVolume - inline implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline
|
||||
unsigned int G4AssemblyVolume::GetImprintsCount() const
|
||||
{
|
||||
return fImprintsCounter;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4AssemblyVolume::SetImprintsCount( unsigned int value )
|
||||
{
|
||||
fImprintsCounter = value;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void G4AssemblyVolume::ImprintsCountPlus()
|
||||
{
|
||||
fImprintsCounter++;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4AssemblyVolume::ImprintsCountMinus()
|
||||
{
|
||||
fImprintsCounter--;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4DrawVoxels.hh,v 1.9 2000/06/06 13:18:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GeometryManager.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4GeometryManager
|
||||
//
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalSurface.hh,v 1.4 2000/11/01 15:39:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4LogicalSurface.hh,v 1.5 2000/12/04 09:36:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Class G4LogicalSurface
|
||||
@@ -92,17 +92,13 @@ class G4LogicalSurface
|
||||
public:
|
||||
virtual ~G4LogicalSurface();
|
||||
|
||||
private:
|
||||
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
public:
|
||||
G4int operator==(const G4LogicalSurface &right) const;
|
||||
G4int operator!=(const G4LogicalSurface &right) const;
|
||||
|
||||
private:
|
||||
|
||||
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
|
||||
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
|
||||
|
||||
// ------------------
|
||||
@@ -110,6 +106,7 @@ class G4LogicalSurface
|
||||
// ------------------
|
||||
|
||||
private:
|
||||
|
||||
G4String theName; // Surface name
|
||||
|
||||
G4OpticalSurface* theOpticalSurface;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalSurface.icc,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4LogicalSurface.icc,v 1.4 2000/12/04 09:36:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Surface Class Inline Methods
|
||||
@@ -69,7 +69,12 @@ G4LogicalSurface::SetTransitionRadiationSurface(G4TransitionRadiationSurface*
|
||||
inline const G4LogicalSurface &
|
||||
G4LogicalSurface::operator=(const G4LogicalSurface &right)
|
||||
{
|
||||
return right;
|
||||
if (&right == this) return *this;
|
||||
theName = right.theName;
|
||||
theOpticalSurface = right.theOpticalSurface;
|
||||
theTransRadSurface = right.theTransRadSurface;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline G4int
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalVolume.hh,v 1.6 2000/11/01 15:39:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4LogicalVolume
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalVolume.icc,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4LogicalVolume Inline Implementation file
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4LogicalVolumeStore
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVParameterised.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4PVParameterised
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVPlacement.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4PVPlacement.hh,v 1.5 2001/03/07 17:34:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4PVPlacement
|
||||
@@ -42,9 +42,8 @@ class G4PVPlacement : public G4VPhysicalVolume
|
||||
G4bool pMany,
|
||||
G4int pCopyNo);
|
||||
// Initialise a single volume, positioned in a frame which is rotated by
|
||||
// *pFrameRot, relative to the coordinate system of the mother volume
|
||||
// pMother. The center of the object is then placed at volumeCenterCrd
|
||||
// in the new coordinates.
|
||||
// *pRot and traslated by tlate, relative to the coordinate system of the
|
||||
// mother volume pMother.
|
||||
// If pRot=0 the volume is unrotated with respect to its mother.
|
||||
// The physical volume is added to the mother's logical volume.
|
||||
// (The above are exactly the arguments of G4VPhysicalVolume)
|
||||
@@ -63,12 +62,12 @@ class G4PVPlacement : public G4VPhysicalVolume
|
||||
// the direct rotation and translation of the solid (NOT of the frame).
|
||||
// The G4Transform3D argument should be constructed by:
|
||||
// i) First rotating it to align the solid to the system of
|
||||
// reference of its mother volume *pMother, and
|
||||
// reference of its mother volume *pMother, and
|
||||
// ii) Then placing the solid at the location Transform3D.getTranslation(),
|
||||
// with respect to the origin of the system of coordinates of the
|
||||
// mother volume.
|
||||
// with respect to the origin of the system of coordinates of the
|
||||
// mother volume.
|
||||
// [ This is useful for the people who prefer to think in terms
|
||||
// of moving objects in a given reference frame. ]
|
||||
// of moving objects in a given reference frame. ]
|
||||
// All other arguments are the same as for the previous constructor.
|
||||
|
||||
G4PVPlacement(G4RotationMatrix *pRot,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVReplica.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4PVReplica
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicalVolumeStore.hh,v 1.5 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4PhysicalVolume
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelHeader.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4SmartVoxelHeader
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelHeader.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4SmartVoxelHeader Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelNode.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4SmartVoxelNode
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelNode.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4SmartVoxelNode Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelProxy.hh,v 1.4 2000/11/20 17:31:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4SmartVoxelProxy
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SmartVoxelProxy.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4SmartVoxelProxy Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SolidStore.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4SolidStore
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VPVParameterisation.hh,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4VPVParamterisation
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VPhysicalVolume.hh,v 1.5 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VPhysicalVolume
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VPhysicalVolume.icc,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VPhysicalVolume Inline Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VSolid.hh,v 1.7 2000/11/01 15:39:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VSolid
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VSolid.icc,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4VSolid Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VTouchable.hh,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VTouchable
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VTouchable.icc,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VTouchable Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VoxelLimits.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// class G4VoxelLimits
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VoxelLimits.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4VoxelLimits Inline implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: meshdefs.hh,v 1.3 2000/04/20 16:49:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Tube/Cone Meshing constants for extent calculations
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: voxeldefs.hh,v 1.4 2000/04/20 16:49:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AssemblyVolume.cc,v 1.5 2001/02/08 12:33:56 radoone Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// Class G4AssemblyVolume - implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4AssemblyVolume.hh"
|
||||
|
||||
#include "g4std/strstream"
|
||||
|
||||
unsigned int G4AssemblyVolume::fsInstanceCounter = 0;
|
||||
|
||||
// Default constructor
|
||||
//
|
||||
G4AssemblyVolume::G4AssemblyVolume()
|
||||
{
|
||||
InstanceCountPlus();
|
||||
SetImprintsCount( 0 );
|
||||
}
|
||||
|
||||
// Destructor
|
||||
//
|
||||
G4AssemblyVolume::~G4AssemblyVolume()
|
||||
{
|
||||
fTriplets.clear();
|
||||
|
||||
unsigned int howmany = fPVStore.size();
|
||||
if( howmany != 0 )
|
||||
{
|
||||
for( unsigned int i = 0; i < howmany; i++ )
|
||||
{
|
||||
G4RotationMatrix* pRotToClean = fPVStore[i]->GetRotation();
|
||||
if( pRotToClean != 0 ) delete pRotToClean;
|
||||
delete fPVStore[i];
|
||||
}
|
||||
}
|
||||
|
||||
fPVStore.clear();
|
||||
InstanceCountMinus();
|
||||
}
|
||||
|
||||
// Add and place the given volume according to the specified
|
||||
// translation and rotation.
|
||||
//
|
||||
void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume,
|
||||
G4ThreeVector& translation,
|
||||
G4RotationMatrix* pRotation )
|
||||
{
|
||||
G4AssemblyTriplet toAdd( pVolume, translation, pRotation );
|
||||
fTriplets.push_back( toAdd );
|
||||
}
|
||||
|
||||
// Add and place the given volume according to the specified transformation
|
||||
//
|
||||
void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume,
|
||||
G4Transform3D& transformation )
|
||||
{
|
||||
G4ThreeVector v = transformation.getTranslation();
|
||||
G4RotationMatrix r = transformation.getRotation();
|
||||
G4AssemblyTriplet toAdd( pVolume, v, &r );
|
||||
fTriplets.push_back( toAdd );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of an assembly volume inside of the specified
|
||||
* mother volume. This works analogically to making stamp imprints.
|
||||
* This method makes use of the Geant4 affine transformation class.
|
||||
* The algorithm is defined as follows:
|
||||
*
|
||||
* Having rotation matrix Rm and translation vector Tm to be applied
|
||||
* inside the mother and rotation matrix Ra and translation vector Ta
|
||||
* to be applied inside the assembly itself for each of the participating
|
||||
* volumes the resulting transformation is
|
||||
*
|
||||
* Tfinal = Ta * Tm
|
||||
*
|
||||
* where Ta and Tm are constructed as
|
||||
*
|
||||
* -1 -1
|
||||
* Ta = Ra * Ta and Tm = Rm * Tm
|
||||
*
|
||||
* which in words means that we create first the affine transformations
|
||||
* by inverse rotation matrices and translations for mother and assembly.
|
||||
* The resulting final transformation to be applied to each of the
|
||||
* participating volumes is their product.
|
||||
* IMPORTANT NOTE!
|
||||
* The order of multiplication is reversed when comparing to CLHEP 3D
|
||||
* transformation matrix(G4Transform3D class).
|
||||
*/
|
||||
void G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV,
|
||||
G4ThreeVector& translationInMother,
|
||||
G4RotationMatrix* pRotationInMother )
|
||||
{
|
||||
unsigned int numberOfDaughters = pMotherLV->GetNoDaughters();
|
||||
|
||||
// We start from the first available index
|
||||
numberOfDaughters++;
|
||||
|
||||
ImprintsCountPlus();
|
||||
|
||||
for( unsigned int i = 0; i < fTriplets.size(); i++ )
|
||||
{
|
||||
// Generate the unique name for the next PV instance
|
||||
// The name has format:
|
||||
//
|
||||
// av_WWW_impr_XXX_YYY_ZZZ
|
||||
// where the fields mean:
|
||||
// WWW - assembly volume instance number
|
||||
// XXX - assembly volume imprint number
|
||||
// YYY - the name of a log. volume we want to make a placement of
|
||||
// ZZZ - the log. volume index inside the assembly volume
|
||||
G4std::strstream pvName;
|
||||
pvName << "av_"
|
||||
<< GetInstanceCount()
|
||||
<< "_impr_"
|
||||
<< GetImprintsCount()
|
||||
<< "_"
|
||||
<< fTriplets[i].GetVolume()->GetName().c_str()
|
||||
<< "_pv_"
|
||||
<< i
|
||||
<< G4std::ends;
|
||||
|
||||
// Create the transformation in this assembly volume
|
||||
G4AffineTransform Ta( fTriplets[i].GetRotation()->inverse(),
|
||||
fTriplets[i].GetTranslation() );
|
||||
// Create the transformation in a mother volume
|
||||
G4AffineTransform Tm( pRotationInMother->inverse(),
|
||||
translationInMother );
|
||||
|
||||
// Combine them together
|
||||
G4AffineTransform Tfinal = Ta * Tm;
|
||||
|
||||
// Extract the final absolute transformation inside a mother
|
||||
G4RotationMatrix* pFinalRotation = new G4RotationMatrix(
|
||||
Tfinal.NetRotation()
|
||||
);
|
||||
G4ThreeVector finalTranslation = Tfinal.NetTranslation();
|
||||
|
||||
// Generate a new physical volume instance inside a mother
|
||||
G4VPhysicalVolume* pPlaced = new G4PVPlacement(
|
||||
pFinalRotation
|
||||
,finalTranslation
|
||||
,fTriplets[i].GetVolume()
|
||||
,pvName.str()
|
||||
,pMotherLV
|
||||
,false
|
||||
,numberOfDaughters + i
|
||||
);
|
||||
|
||||
// Register the physical volume created by us so we can delete it later
|
||||
fPVStore.push_back( pPlaced );
|
||||
}
|
||||
}
|
||||
|
||||
void G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV,
|
||||
G4Transform3D& transformation )
|
||||
{
|
||||
unsigned int numberOfDaughters = pMotherLV->GetNoDaughters();
|
||||
|
||||
// We start from the first available index
|
||||
numberOfDaughters++;
|
||||
|
||||
for( unsigned int i = 0; i < fTriplets.size(); i++ )
|
||||
{
|
||||
// Generate the unique name for the next PV instance
|
||||
// The name has format:
|
||||
//
|
||||
// av_WWW_impr_XXX_YYY_ZZZ
|
||||
// where the fields mean:
|
||||
// WWW - assembly volume instance number
|
||||
// XXX - assembly volume imprint number
|
||||
// YYY - the name of a log. volume we want to make a placement of
|
||||
// ZZZ - the log. volume index inside the assembly volume
|
||||
G4std::strstream pvName;
|
||||
pvName << "av_"
|
||||
<< GetInstanceCount()
|
||||
<< "_impr_"
|
||||
<< GetImprintsCount()
|
||||
<< "_"
|
||||
<< fTriplets[i].GetVolume()->GetName().c_str()
|
||||
<< "_pv_"
|
||||
<< i
|
||||
<< G4std::ends;
|
||||
|
||||
G4Transform3D Ta( *(fTriplets[i].GetRotation()),
|
||||
fTriplets[i].GetTranslation()
|
||||
);
|
||||
|
||||
G4Transform3D Tfinal = transformation * Ta;
|
||||
|
||||
// G4RotationMatrix* pFinalRotation =
|
||||
// new G4RotationMatrix( Tfinal.getRotation().inverse() );
|
||||
// G4ThreeVector finalTranslation = Tfinal.getTranslation();
|
||||
|
||||
// Generate a new physical volume instance inside a mother
|
||||
G4VPhysicalVolume* pPlaced = new G4PVPlacement( Tfinal,
|
||||
fTriplets[i].GetVolume(),
|
||||
pvName.str(),
|
||||
pMotherLV,
|
||||
false,
|
||||
numberOfDaughters + i );
|
||||
|
||||
// Register the physical volume created by us so we can delete it later
|
||||
fPVStore.push_back( pPlaced );
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int G4AssemblyVolume::GetInstanceCount() const
|
||||
{
|
||||
return G4AssemblyVolume::fsInstanceCounter;
|
||||
}
|
||||
|
||||
void G4AssemblyVolume::SetInstanceCount( unsigned int value )
|
||||
{
|
||||
G4AssemblyVolume::fsInstanceCounter = value;
|
||||
}
|
||||
|
||||
void G4AssemblyVolume::InstanceCountPlus()
|
||||
{
|
||||
G4AssemblyVolume::fsInstanceCounter++;
|
||||
}
|
||||
|
||||
void G4AssemblyVolume::InstanceCountMinus()
|
||||
{
|
||||
G4AssemblyVolume::fsInstanceCounter--;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user