Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorFreeTrajParam.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// Holds the 5 independent variables of the trajectory for a
// G4ErrorFreeTrajState object. It is not used for anything but for
// printing, but anyhow it is updated everytime the position and
// momentum are updated.
// History:
// - Created: Pedro Arce, September 2004
// --------------------------------------------------------------------
#ifndef G4ErrorFreeTrajParam_hh
#define G4ErrorFreeTrajParam_hh
#include "G4Point3D.hh"
#include "G4Vector3D.hh"
#include "globals.hh"
#include "G4Track.hh"
class G4ErrorFreeTrajParam
{
public: // with description
G4ErrorFreeTrajParam(){}
G4ErrorFreeTrajParam( const G4Point3D& pos, const G4Vector3D& mom );
// build parameters from position and momentum
virtual ~G4ErrorFreeTrajParam(){}
void Update( const G4Track* aTrack );
// update parameters from G4Track
friend
std::ostream& operator<<(std::ostream&, const G4ErrorFreeTrajParam& ts);
// Set and Get methods
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom );
G4Vector3D GetDirection() const { return fDir;}
G4double GetInvP() const { return fInvP; }
G4double GetLambda() const { return fLambda; }
G4double GetPhi() const { return fPhi; }
G4double GetYPerp() const { return fYPerp; }
G4double GetZPerp() const { return fZPerp; }
private:
G4Vector3D fDir; //direction to which YPerp, ZPerp refer
G4double fInvP; // inverse of momentum
G4double fLambda; // 90 - theta angle of direction
G4double fPhi; // phi angle of direction
G4double fYPerp; // Y coordinate
G4double fZPerp; // Z coordinate
};
#endif
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorFreeTrajState.hh,v 1.4 2007/05/31 20:27:06 arce Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// Represents a free G4ErrorTrajState
// It can be represented by the 5 variables
// 1/p, lambda, phi, y_perp, z_perp
// where lambda and phi are the dip and azimuthal angles related
// to the momentum components in the following way:
// p_x = p cos(lambda) cos(phi) ! lambda = 90 - theta
// p_y = p cos(lambda) sin(phi)
// p_z = p sin(lambda)
// y_perp and z_perp are the coordinates of the trajectory in a
// local orthonormal reference frame with the x_perp axis along the
// particle direction, the y_perp being parallel to the x-y plane.
//
// This class also takes care of propagating the error associated to
// the trajectory
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorFreeTrajState_hh
#define G4ErrorFreeTrajState_hh
#include "globals.hh"
#include "G4ErrorMatrix.hh"
#include "G4ErrorTrajState.hh"
#include "G4ErrorFreeTrajParam.hh"
#include "G4Point3D.hh"
#include "G4Vector3D.hh"
class G4ErrorSurfaceTrajState;
class G4ErrorFreeTrajState : public G4ErrorTrajState
{
public: // with description
G4ErrorFreeTrajState(){}
G4ErrorFreeTrajState( const G4String& partType,
const G4Point3D& pos,
const G4Vector3D& mom,
const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5,0) );
// Constructor by providing particle, position and momentum
G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpOS );
// Constructor by providing G4ErrorSurfaceTrajState
~G4ErrorFreeTrajState(){}
virtual G4int Update( const G4Track* aTrack );
// update parameters from G4Track
virtual G4int PropagateError( const G4Track* aTrack );
// propagate the error along the step
virtual void Dump( std::ostream& out = G4cout ) const;
// dump TrajState parameters
friend
std::ostream& operator<<(std::ostream&, const G4ErrorFreeTrajState& ts);
// Set and Get methods
virtual void SetPosition( const G4Point3D pos )
{ SetParameters( pos, fMomentum ); }
virtual void SetMomentum( const G4Vector3D& mom )
{ SetParameters( fPosition, mom ); }
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom )
{
fPosition = pos;
fMomentum = mom;
fTrajParam.SetParameters( pos, mom );
}
G4ErrorFreeTrajParam GetParameters() const
{ return fTrajParam; }
private:
void Init();
// define TrajState type and build charge
G4int PropagateErrorMSC( const G4Track* aTrack );
// add the error associated to multiple scattering
void CalculateEffectiveZandA( const G4Material* mate, double& effZ, double& effA );
// calculate effective Z and A (needed by PropagateErrorMSC)
G4int PropagateErrorIoni( const G4Track* aTrack );
// add the error associated to ionization energy loss
private:
G4ErrorFreeTrajParam fTrajParam;
G4ErrorMatrix theTransfMat;
G4bool theFirstStep; // to count if transf mat is updated or initialized
};
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorGeomVolumeTarget.hh,v 1.3 2007/05/31 15:28:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// G4ErrorTarget class: limits step when volume is reached.
// History:
// - Created: P. Arce, September 2004
// --------------------------------------------------------------------
#ifndef G4ErrorGeomVolumeTarget_HH
#define G4ErrorGeomVolumeTarget_HH
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4ErrorTarget.hh"
#include "G4Plane3D.hh"
class G4Step;
class G4String;
class G4ErrorGeomVolumeTarget : public G4ErrorTarget
{
public: // with description
G4ErrorGeomVolumeTarget( const G4String& name );
virtual ~G4ErrorGeomVolumeTarget(){}
virtual G4bool TargetReached(const G4Step* aStep);
// return true when particle is entering the volume
virtual void Dump( const G4String& msg ) const;
private:
G4String theName;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorMagFieldLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class description:
//
// Limits the step length if change of magnetic field is too big
// (user defined limit).
// History:
// - Created: P. Arce, September 2004
//---------------------------------------------------------------------
#ifndef G4ErrorMagFieldLimitProcess_h
#define G4ErrorMagFieldLimitProcess_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ElementTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Step.hh"
#include "G4VErrorLimitProcess.hh"
//-----------------------------------------------------------------
class G4ErrorMagFieldLimitProcess : public G4VErrorLimitProcess
{
public: // with description
G4ErrorMagFieldLimitProcess(const G4String& processName
="G4ErrorMagFieldLimit");
~G4ErrorMagFieldLimitProcess();
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
// Returns the step length.
};
#endif
+315
View File
@@ -0,0 +1,315 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorMatrix.hh,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// Simplified version of CLHEP HepMatrix class
// History:
// - Imported from CLHEP and modified: P. Arce May 2007
// --------------------------------------------------------------------
#ifndef G4ErrorMatrix_hh
#define G4ErrorMatrix_hh
#include <vector>
class G4ErrorSymMatrix;
typedef std::vector<G4double >::iterator G4ErrorMatrixIter;
typedef std::vector<G4double >::const_iterator G4ErrorMatrixConstIter;
class G4ErrorMatrix
{
public: // with description
G4ErrorMatrix();
// Default constructor. Gives 0 x 0 matrix.
// Another G4ErrorMatrix can be assigned to it.
G4ErrorMatrix(G4int p, G4int q);
// Constructor. Gives an unitialized p x q matrix.
G4ErrorMatrix(G4int p, G4int q, G4int i);
// Constructor. Gives an initialized p x q matrix.
// If i=0, it is initialized to all 0. If i=1, the diagonal elements
// are set to 1.0.
G4ErrorMatrix(const G4ErrorMatrix &m1);
// Copy constructor.
G4ErrorMatrix(const G4ErrorSymMatrix &m1);
// Constructors from G4ErrorSymG4ErrorMatrix, DiagG4ErrorMatrix and Vector.
virtual ~G4ErrorMatrix();
// Destructor.
inline virtual G4int num_row() const;
// Returns the number of rows.
inline virtual G4int num_col() const;
// Returns the number of columns.
inline virtual const G4double & operator()(G4int row, G4int col) const;
inline virtual G4double & operator()(G4int row, G4int col);
// Read or write a matrix element.
// ** Note that the indexing starts from (1,1). **
G4ErrorMatrix & operator *= (G4double t);
// Multiply a G4ErrorMatrix by a floating number.
G4ErrorMatrix & operator /= (G4double t);
// Divide a G4ErrorMatrix by a floating number.
G4ErrorMatrix & operator += ( const G4ErrorMatrix &m2);
G4ErrorMatrix & operator += ( const G4ErrorSymMatrix &m2);
G4ErrorMatrix & operator -= ( const G4ErrorMatrix &m2);
G4ErrorMatrix & operator -= ( const G4ErrorSymMatrix &m2);
// Add or subtract a G4ErrorMatrix.
// When adding/subtracting Vector, G4ErrorMatrix must have num_col of one.
G4ErrorMatrix & operator = ( const G4ErrorMatrix &m2);
G4ErrorMatrix & operator = ( const G4ErrorSymMatrix &m2);
// Assignment operators.
G4ErrorMatrix operator- () const;
// unary minus, ie. flip the sign of each element.
G4ErrorMatrix apply(G4double (*f)(G4double, G4int, G4int)) const;
// Apply a function to all elements of the matrix.
G4ErrorMatrix T() const;
// Returns the transpose of a G4ErrorMatrix.
G4ErrorMatrix sub(G4int min_row, G4int max_row,
G4int min_col, G4int max_col) const;
// Returns a sub matrix of a G4ErrorMatrix.
// WARNING: rows and columns are numbered from 1
void sub(G4int row, G4int col, const G4ErrorMatrix &m1);
// Sub matrix of this G4ErrorMatrix is replaced with m1.
// WARNING: rows and columns are numbered from 1
inline G4ErrorMatrix inverse(G4int& ierr) const;
// Invert a G4ErrorMatrix. G4ErrorMatrix must be square and is not changed.
// Returns ierr = 0 (zero) when successful, otherwise non-zero.
virtual void invert(G4int& ierr);
// Invert a G4ErrorMatrix. G4ErrorMatrix must be square.
// N.B. the contents of the matrix are replaced by the inverse.
// Returns ierr = 0 (zero) when successful, otherwise non-zero.
// This method has less overhead then inverse().
G4double determinant() const;
// calculate the determinant of the matrix.
G4double trace() const;
// calculate the trace of the matrix (sum of diagonal elements).
class G4ErrorMatrix_row
{
typedef std::vector<G4double >::const_iterator G4ErrorMatrixConstIter;
public:
inline G4ErrorMatrix_row(G4ErrorMatrix&,G4int);
G4double & operator[](G4int);
private:
G4ErrorMatrix& _a;
G4int _r;
};
class G4ErrorMatrix_row_const
{
public:
inline G4ErrorMatrix_row_const (const G4ErrorMatrix&,G4int);
const G4double & operator[](G4int) const;
private:
const G4ErrorMatrix& _a;
G4int _r;
};
// helper classes for implementing m[i][j]
inline G4ErrorMatrix_row operator[] (G4int);
inline const G4ErrorMatrix_row_const operator[] (G4int) const;
// Read or write a matrix element.
// While it may not look like it, you simply do m[i][j] to get an element.
// ** Note that the indexing starts from [0][0]. **
protected:
virtual inline G4int num_size() const;
virtual void invertHaywood4(G4int& ierr);
virtual void invertHaywood5(G4int& ierr);
virtual void invertHaywood6(G4int& ierr);
public:
static void error(const char *s);
private:
friend class G4ErrorMatrix_row;
friend class G4ErrorMatrix_row_const;
friend class G4ErrorSymMatrix;
// Friend classes.
friend G4ErrorMatrix operator+(const G4ErrorMatrix &m1,
const G4ErrorMatrix &m2);
friend G4ErrorMatrix operator-(const G4ErrorMatrix &m1,
const G4ErrorMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorMatrix &m1,
const G4ErrorMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorMatrix &m1,
const G4ErrorSymMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorSymMatrix &m2);
// Multiply a G4ErrorMatrix by a G4ErrorMatrix or Vector.
// solve the system of linear eq
friend G4ErrorMatrix qr_solve(G4ErrorMatrix *, const G4ErrorMatrix &b);
friend void tridiagonal(G4ErrorSymMatrix *a,G4ErrorMatrix *hsm);
friend void row_house(G4ErrorMatrix *,const G4ErrorMatrix &, G4double,
G4int, G4int, G4int, G4int);
friend void back_solve(const G4ErrorMatrix &R, G4ErrorMatrix *b);
friend void col_givens(G4ErrorMatrix *A, G4double c,
G4double s, G4int k1, G4int k2,
G4int rowmin, G4int rowmax);
// Does a column Givens update.
friend void row_givens(G4ErrorMatrix *A, G4double c,
G4double s, G4int k1, G4int k2,
G4int colmin, G4int colmax);
friend void col_house(G4ErrorMatrix *,const G4ErrorMatrix &, G4double,
G4int, G4int, G4int, G4int);
friend void house_with_update(G4ErrorMatrix *a,G4int row,G4int col);
friend void house_with_update(G4ErrorMatrix *a,G4ErrorMatrix *v,
G4int row, G4int col);
friend void house_with_update2(G4ErrorSymMatrix *a,G4ErrorMatrix *v,
G4int row, G4int col);
G4int dfact_matrix(G4double &det, G4int *ir);
// factorize the matrix. If successful, the return code is 0. On
// return, det is the determinant and ir[] is row-interchange
// matrix. See CERNLIB's DFACT routine.
G4int dfinv_matrix(G4int *ir);
// invert the matrix. See CERNLIB DFINV.
std::vector<G4double > m;
G4int nrow, ncol;
G4int size;
};
// Operations other than member functions for G4ErrorMatrix
G4ErrorMatrix operator*(const G4ErrorMatrix &m1, const G4ErrorMatrix &m2);
G4ErrorMatrix operator*(G4double t, const G4ErrorMatrix &m1);
G4ErrorMatrix operator*(const G4ErrorMatrix &m1, G4double t);
// Multiplication operators
// Note that m *= m1 is always faster than m = m * m1.
G4ErrorMatrix operator/(const G4ErrorMatrix &m1, G4double t);
// m = m1 / t. (m /= t is faster if you can use it.)
G4ErrorMatrix operator+(const G4ErrorMatrix &m1, const G4ErrorMatrix &m2);
// m = m1 + m2;
// Note that m += m1 is always faster than m = m + m1.
G4ErrorMatrix operator-(const G4ErrorMatrix &m1, const G4ErrorMatrix &m2);
// m = m1 - m2;
// Note that m -= m1 is always faster than m = m - m1.
G4ErrorMatrix dsum(const G4ErrorMatrix&, const G4ErrorMatrix&);
// Direct sum of two matrices. The direct sum of A and B is the matrix
// A 0
// 0 B
std::ostream& operator<<(std::ostream &s, const G4ErrorMatrix &q);
// Read in, write out G4ErrorMatrix into a stream.
//
// Specialized linear algebra functions
//
G4ErrorMatrix qr_solve(const G4ErrorMatrix &A, const G4ErrorMatrix &b);
G4ErrorMatrix qr_solve(G4ErrorMatrix *A, const G4ErrorMatrix &b);
// Works like backsolve, except matrix does not need to be upper
// triangular. For nonsquare matrix, it solves in the least square sense.
G4ErrorMatrix qr_inverse(const G4ErrorMatrix &A);
G4ErrorMatrix qr_inverse(G4ErrorMatrix *A);
// Finds the inverse of a matrix using QR decomposition. Note, often what
// you really want is solve or backsolve, they can be much quicker than
// inverse in many calculations.
void qr_decomp(G4ErrorMatrix *A, G4ErrorMatrix *hsm);
G4ErrorMatrix qr_decomp(G4ErrorMatrix *A);
// Does a QR decomposition of a matrix.
void back_solve(const G4ErrorMatrix &R, G4ErrorMatrix *b);
// Solves R*x = b where R is upper triangular. Also has a variation that
// solves a number of equations of this form in one step, where b is a matrix
// with each column a different vector. See also solve.
void col_house(G4ErrorMatrix *a, const G4ErrorMatrix &v, G4double vnormsq,
G4int row, G4int col, G4int row_start, G4int col_start);
void col_house(G4ErrorMatrix *a, const G4ErrorMatrix &v, G4int row, G4int col,
G4int row_start, G4int col_start);
// Does a column Householder update.
void col_givens(G4ErrorMatrix *A, G4double c, G4double s,
G4int k1, G4int k2, G4int row_min=1, G4int row_max=0);
// do a column Givens update
void row_givens(G4ErrorMatrix *A, G4double c, G4double s,
G4int k1, G4int k2, G4int col_min=1, G4int col_max=0);
// do a row Givens update
void givens(G4double a, G4double b, G4double *c, G4double *s);
// algorithm 5.1.5 in Golub and Van Loan
// Returns a Householder vector to zero elements.
void house_with_update(G4ErrorMatrix *a, G4int row=1, G4int col=1);
void house_with_update(G4ErrorMatrix *a, G4ErrorMatrix *v,
G4int row=1, G4int col=1);
// Finds and does Householder reflection on matrix.
void row_house(G4ErrorMatrix *a, const G4ErrorMatrix &v, G4double vnormsq,
G4int row, G4int col, G4int row_start, G4int col_start);
void row_house(G4ErrorMatrix *a, const G4ErrorMatrix &v, G4int row, G4int col,
G4int row_start, G4int col_start);
// Does a row Householder update.
#include "G4ErrorMatrix.icc"
#endif
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorMatrix.icc,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ------------------------------------------------------------
// GEANT 4 class inline implementation
// ------------------------------------------------------------
inline G4ErrorMatrix::G4ErrorMatrix()
: m(0), nrow(0), ncol(0), size(0)
{
}
inline G4int G4ErrorMatrix::num_row() const
{
return nrow;
}
inline G4int G4ErrorMatrix::num_col() const
{
return ncol;
}
inline G4int G4ErrorMatrix::num_size() const
{
return size;
}
inline G4double & G4ErrorMatrix::operator()(G4int row, G4int col)
{
return *(m.begin()+(row-1)*ncol+col-1);
}
inline const G4double & G4ErrorMatrix::operator()(G4int row, G4int col) const
{
return *(m.begin()+(row-1)*ncol+col-1);
}
inline G4ErrorMatrix::G4ErrorMatrix_row G4ErrorMatrix::operator[] (G4int r)
{
G4ErrorMatrix_row b(*this,r);
return b;
}
inline const G4ErrorMatrix::G4ErrorMatrix_row_const
G4ErrorMatrix::operator[] (G4int r) const
{
G4ErrorMatrix_row_const b(*this,r);
return b;
}
inline G4double &G4ErrorMatrix::G4ErrorMatrix_row::operator[](G4int c)
{
return *(_a.m.begin()+_r*_a.ncol+c);
}
inline const G4double &
G4ErrorMatrix::G4ErrorMatrix_row_const::operator[](G4int c) const
{
return *(_a.m.begin()+_r*_a.ncol+c);
}
inline G4ErrorMatrix::
G4ErrorMatrix_row::G4ErrorMatrix_row(G4ErrorMatrix&a, G4int r)
: _a(a)
{
_r = r;
}
inline G4ErrorMatrix::G4ErrorMatrix_row_const::G4ErrorMatrix_row_const
(const G4ErrorMatrix&a, G4int r)
: _a(a)
{
_r = r;
}
inline G4ErrorMatrix G4ErrorMatrix::inverse(G4int &ierr) const
{
G4ErrorMatrix mTmp(*this);
mTmp.invert(ierr);
return mTmp;
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorMessenger.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// Messenger class for Geant4e processes limiting the step.
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorMessenger_hh
#define G4ErrorMessenger_hh
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithADouble;
class G4ErrorStepLengthLimitProcess;
class G4ErrorMagFieldLimitProcess;
class G4ErrorEnergyLoss;
//-----------------------------------------------------------------
class G4ErrorMessenger : public G4UImessenger
{
public: // with description
G4ErrorMessenger(G4ErrorStepLengthLimitProcess* lengthAct,
G4ErrorMagFieldLimitProcess* magAct,
G4ErrorEnergyLoss* elossAct);
~G4ErrorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
G4ErrorStepLengthLimitProcess* StepLengthAction;
G4ErrorMagFieldLimitProcess* MagFieldAction;
G4ErrorEnergyLoss* EnergyLossAction;
G4UIdirectory* myDir;
G4UIdirectory* myDirLimits;
G4UIcmdWithADoubleAndUnit* StepLengthLimitCmd;
G4UIcmdWithADouble* MagFieldLimitCmd;
G4UIcmdWithADouble* EnergyLossCmd;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorPhysicsList.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Default physics list for GEANT4e (should not be overridden, unless by
// experts). No multiple scattering and no production of secondaries.
// The energy loss process is G4eMuIonisation or G4EnergyLossForExtrapolator
// (depending on the value of the enviromental variable G4EELOSSEXTRAP)
// It also defines the geant4e processes to limit the step:
// G4eMagneticFieldLimitProcess, G4eStepLimitProcess.
// History:
// - Created: P. Arce
// ---------------------------------------------------------------------
#ifndef G4ErrorPhysicsList_hh
#define G4ErrorPhysicsList_hh
#include "globals.hh"
#include "G4VUserPhysicsList.hh"
class G4ErrorPhysicsList: public G4VUserPhysicsList
{
public: // with description
G4ErrorPhysicsList();
virtual ~G4ErrorPhysicsList();
protected:
virtual void ConstructParticle();
// constructs gamma, e+/-, mu+/- and stable hadrons
virtual void ConstructProcess();
// construct physical processes
virtual void SetCuts();
// SetCutsWithDefault
virtual void ConstructEM();
// constructs electromagnetic processes
};
#endif
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorPropagator.hh,v 1.3 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Manages the propagation of tracks. Creates a G4Track, asks to
// propagate it and takes also care to propagate the errors.
// Stops the track when GEANT4 stops it or a G4ErrorTarget is reached.
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorPropagator_hh
#define G4ErrorPropagator_hh
#include "globals.hh"
#include "G4ErrorPropagatorData.hh"
#include "G4SteppingManager.hh"
class G4eErrorMatrix;
class G4Track;
class G4ErrorTrajState;
class G4ErrorFreeTrajState;
class G4ErrorTarget;
#include "globals.hh"
class G4ErrorPropagator
{
public: // with description
G4ErrorPropagator();
~G4ErrorPropagator(){}
G4Track* InitG4Track( G4ErrorTrajState& initialTS );
// Creates a G4Track from a G4ErrorTrajState
G4int Propagate( G4ErrorTrajState* currentTS,
const G4ErrorTarget* target,
G4ErrorMode mode = G4ErrorMode_PropForwards);
// Steers the GEANT4 propagation of a track:
// the particle will be extrapolated until the Target is reached.
// The final G4Track parameters will be passed to theFinalTrajState
G4int PropagateOneStep( G4ErrorTrajState* currentTS );
// Propagates a G4Track by one step, and then returns control to the user
G4int MakeOneStep( G4ErrorFreeTrajState* currentTS_FREE );
// Advance one step
G4ErrorFreeTrajState* InitFreeTrajState( G4ErrorTrajState* currentTS );
// Creates theCurrentTS_FREE (transforms the user G4ErrorSurfaceTrajState
// or copies the G4ErrorFreeTrajState)
void GetFinalTrajState( G4ErrorTrajState* currentTS, G4ErrorFreeTrajState* currentTS_FREE, const G4ErrorTarget* target );
// After steps are done, convert the G4ErrorFreeTrajState used for error
// propagation to the class of origin (G4ErrorFreeTrajState or
// G4eTrajStatOnSurface)
void InvokePreUserTrackingAction( G4Track* fpTrack );
// Invoke the G4UserTrackingAction::PreUserTrackingAction
void InvokePostUserTrackingAction( G4Track* fpTrack );
// Invoke the G4UserTrackingAction::PostUserTrackingAction
G4bool CheckIfLastStep( G4Track* aTrack );
// Check if it is the last step for error propagation:
// - G4ErrorState is G4ErrorState_StoppedAtTarget
// - Track is OutOfWorld
// - G4TrackStatus is fStopAndKill
// Get and Set methods
const G4ErrorTrajState* GetInitialTrajState() const
{ return theInitialTrajState; }
G4double GetStepLength() const
{ return theStepLength; }
void SetStepLength( const G4double sl )
{ theStepLength = sl; }
void SetStepN( const G4int sn )
{ theStepN = sn; }
private:
G4int MakeSteps( G4ErrorFreeTrajState* currentTS_FREE );
// Advance steps until target is reached
private:
G4double theStepLength;
G4ErrorTrajState* theInitialTrajState;
G4ErrorTrajState* theFinalTrajState;
G4int theStepN;
G4Track* theG4Track;
G4SteppingManager* fpSteppingManager;
G4int verbose;
G4bool thePropIsInitialized;
};
#endif
@@ -0,0 +1,163 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorPropagatorManager.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// This is the class manager of the GEANT4e package.
// It is the main interface for the user to define the setup and
// start the propagation. Initializes GEANT4 for the propagation.
// History:
// - Created: Pedro Arce, February 2001
// --------------------------------------------------------------------
#ifndef G4ErrorPropagatorManager_hh
#define G4ErrorPropagatorManager_hh
#include "globals.hh"
#include "G4ErrorPropagatorData.hh"
#include "G4ErrorPropagator.hh"
#include "G4ApplicationState.hh"
class G4ErrorPropagationNavigator;
class G4ErrorRunManagerHelper;
class G4ErrorTarget;
class G4ErrorTrajState;
class G4VUserDetectorConstruction;
class G4VPhysicalVolume;
class G4VUserPhysicsList;
class G4UserRunAction;
class G4UserEventAction;
class G4UserStackingAction;
class G4UserTrackingAction;
class G4UserSteppingAction;
class G4Mag_UsualEqRhs;
class G4Track;
class G4ErrorPropagatorManager
{
public: // with description
G4ErrorPropagatorManager();
// Initialise data to 0. Starts the G4ErrorRunManagerHelper and
// G4ErrorPropagationNavigator.
~G4ErrorPropagatorManager();
static G4ErrorPropagatorManager* GetErrorPropagatorManager();
// Get only instance of G4ErrorPropagatorManager. If it does not exists,
// creates it
void EventTermination();
// Set state to G4ErrorState_Init
void RunTermination();
// Set state to G4ErrorState_Init and invoke
// G4ErrorRunManagerHelper::RunTermination()
void InitGeant4e();
// Initializes Geant4 and Geant4e
void InitTrackPropagation();
// Set the propagator step number to 0 and the G4ErrorState to Propagating
G4bool InitFieldForBackwards();
// Creates the G4ErrorMag_UsualEqRhs, that will control backwards tracking
G4int Propagate( G4ErrorTrajState* currentTS, const G4ErrorTarget* target, G4ErrorMode mode = G4ErrorMode_PropForwards );
// Inits track propagation, invokes G4ErrorPropagator::Propagate and
// terminates "event"
G4int PropagateOneStep( G4ErrorTrajState* currentTS,
G4ErrorMode mode = G4ErrorMode_PropForwards );
// Invokes G4ErrorPropagator::PropagateOneStep
G4bool CloseGeometry();
// Close Geant4 geometry
void SetUserInitialization(G4VUserDetectorConstruction* userInit);
// Invokes G4ErrorRunManagerHelper to construct detector and set
// world volume
void SetUserInitialization(G4VPhysicalVolume* userInit);
// Invokes G4ErrorRunManagerHelper to set world volume
void SetUserInitialization(G4VUserPhysicsList* userInit);
// Invokes G4ErrorRunManagerHelper to initialize physics
void SetUserAction(G4UserTrackingAction* userAction);
// Invokes G4EventManager to set a G4UserTrackingAction
void SetUserAction(G4UserSteppingAction* userAction);
// Invokes G4EventManager to set a G4UserSteppingAction
G4String PrintG4ErrorState();
G4String PrintG4ErrorState( G4ErrorState state );
// Print Geant4e state
G4String PrintG4State();
G4String PrintG4State( G4ApplicationState state );
// Print Geant4 state
// Set and Get methods
G4ErrorRunManagerHelper* GetErrorRunManagerHelper() const
{ return theG4ErrorRunManagerHelper; }
void SetSteppingManagerVerboseLevel();
G4ErrorPropagationNavigator* GetErrorPropagationNavigator() const
{ return theG4ErrorPropagationNavigator; }
G4ErrorPropagator* GetPropagator() const
{ return thePropagator; }
private:
void StartG4ErrorRunManagerHelper();
// Create a G4ErrorRunManagerHelper if it does not exist and set to it
// the G4ErrorPhysicsList
void StartNavigator();
// create a G4ErrorPropagationNavigator
private:
static G4ErrorPropagatorManager* theG4ErrorPropagatorManager;
G4ErrorRunManagerHelper* theG4ErrorRunManagerHelper;
G4ErrorPropagator* thePropagator;
G4Mag_UsualEqRhs* theEquationOfMotion;
G4ErrorPropagationNavigator* theG4ErrorPropagationNavigator;
};
#endif
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorRunManagerHelper.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// This class helps G4ErrorPropagatorManager with the initialization of
// geometry and physics, definition of actions and run termination
// (things done by G4RunManager in an standard GEANT4 run)
// It holds a pointer to G4RunManagerKernel
// History:
// - Created: Pedro Arce, January 2005
// --------------------------------------------------------------------
#ifndef G4ErrorRunManagerHelper_hh
#define G4ErrorRunManagerHelper_hh
class G4RunManagerKernel;
class G4VUserDetectorConstruction;
class G4VPhysicalVolume;
class G4VUserPhysicsList;
class G4UserTrackingAction;
class G4UserSteppingAction;
class G4ErrorRunManagerHelper
{
public: // with description
G4ErrorRunManagerHelper();
virtual ~G4ErrorRunManagerHelper();
static G4ErrorRunManagerHelper* GetRunManagerKernel();
// Static method which returns the singleton pointer of
// G4ErrorRunManagerHelper
void SetUserInitialization(G4VUserDetectorConstruction* userInit);
// Initialize geometry by passing a G4VUserDetectorConstruction
void SetUserInitialization(G4VPhysicalVolume* userInit);
// Initialize geometry by passing a G4VPhysicalVolume
void SetUserInitialization(G4VUserPhysicsList* userInit);
// Initializes physics
void SetUserAction(G4UserTrackingAction* userAction);
// Set the user tracking action
void SetUserAction(G4UserSteppingAction* userAction);
// Set the user stepping action
void RunInitialization();
// Invokes G4RunManagerKernel RunInitialization();
void InitializeGeometry();
// Initializes GEANT4 geometry
void InitializePhysics();
// Initializes GEANT4 physics
void RunTermination();
// Invokes G4RunManagerKernel RunTermination();
G4VUserPhysicsList* GetUserPhysicsList() const
{ return theUserPhysicsList; }
private:
static G4ErrorRunManagerHelper* fRunManagerKernel;
G4VUserPhysicsList* theUserPhysicsList;
G4VPhysicalVolume* theUserWorld;
G4RunManagerKernel* theG4RunManagerKernel;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorStepLengthLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Limits the step length if change of direction due to magnetic field
// is too big (user defined limit)
// History:
// - Created: P. Arce, September 2004
// --------------------------------------------------------------------
#ifndef G4ErrorStepLengthLimitProcess_hh
#define G4ErrorStepLengthLimitProcess_hh
#include "G4ios.hh"
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ElementTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Step.hh"
#include "G4VErrorLimitProcess.hh"
//-----------------------------------------------------------------
class G4ErrorStepLengthLimitProcess : public G4VErrorLimitProcess
{
public: // with description
G4ErrorStepLengthLimitProcess(const G4String& processName =
"G4ErrorStepLengthLimit");
~G4ErrorStepLengthLimitProcess();
virtual G4double
PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition );
// returns the step length
};
#endif
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorSurfaceTrajParam.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Holds the 5 independent variables of the trajectory for a
// G4ErrorSurfaceTrajState object. It is not used for anything but for
// printing, but anyhow it is updated everytime the position and momentum
// are updated
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorSurfaceTrajParam_hh
#define G4ErrorSurfaceTrajParam_hh
#include "G4Point3D.hh"
#include "G4Vector3D.hh"
#include "G4Plane3D.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "G4Track.hh"
class G4ErrorSurfaceTrajParam
{
public: // with description
G4ErrorSurfaceTrajParam(){}
G4ErrorSurfaceTrajParam( const G4Point3D& pos, const G4Vector3D& mom,
const G4Vector3D& vecV, const G4Vector3D& vecW );
G4ErrorSurfaceTrajParam( const G4Point3D& pos, const G4Vector3D& mom,
const G4Plane3D& plane );
virtual ~G4ErrorSurfaceTrajParam(){}
friend
std::ostream& operator<<(std::ostream&, const G4ErrorSurfaceTrajParam& ts);
// Get and Set methods
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
const G4Vector3D& vecV, const G4Vector3D& vecW );
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
const G4Plane3D& plane );
G4Vector3D GetDirection() const { return fDir; }
G4Vector3D GetPlaneNormal() const { return fVectorV.cross(fVectorW); }
G4Vector3D GetVectorV() const { return fVectorV; }
G4Vector3D GetVectorW() const { return fVectorW; }
G4double GetPV() const{ return fPV; }
G4double GetPW() const{ return fPW; }
G4double GetV() const{ return fV; }
G4double GetW() const{ return fW; }
private:
G4ThreeVector fDir;
G4Vector3D fVectorV; //one of the vectors defining the plane
G4Vector3D fVectorW; //one of the vectors defining the plane
G4double fInvP; // inverse of momentum
G4double fPV; // projection of momentum in one direction
G4double fPW; // projection of momentum in one direction
G4double fV; // projection of position in one direction
G4double fW; // projection of position in one direction
};
#endif
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorSurfaceTrajState.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class description:
//
// Represents a trajectory state on a surface.
// It can be represented by the 5 variables:
// 1/p, v', w', v, w
// where v'=dv/du and w'=dw/du in an orthonormal coordinate system
// with axis u, v and w.
// History:
//
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorSurfaceTrajState_hh
#define G4ErrorSurfaceTrajState_hh
#include "globals.hh"
#include "G4ErrorTrajState.hh"
#include "G4ErrorSurfaceTrajParam.hh"
#include "G4ErrorFreeTrajState.hh"
#include "G4Point3D.hh"
#include "G4Vector3D.hh"
#include "G4Plane3D.hh"
class G4ErrorSurfaceTrajState : public G4ErrorTrajState
{
public: // with description
G4ErrorSurfaceTrajState( const G4String& partType, const G4Point3D& pos,
const G4Vector3D& mom, const G4Plane3D& plane,
const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5,0) );
// Constructor by providing particle, position, momentum and
// G4Plane3D surface
G4ErrorSurfaceTrajState( const G4String& partType, const G4Point3D& pos,
const G4Vector3D& mom, const G4Vector3D& vecV,
const G4Vector3D& vecW,
const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5,0) );
// Constructor by providing particle, position, momentum and
// two vectors on surface
G4ErrorSurfaceTrajState( G4ErrorFreeTrajState& tpSC, const G4Plane3D& plane );
// Constructor by providing G4ErrorFreeTrajState and G4Plane3D surface
G4ErrorSurfaceTrajState( G4ErrorFreeTrajState& tpSC, const G4Vector3D& vecV,
const G4Vector3D& vecW );
// Constructor by providing G4ErrorFreeTrajState and two vectors on surface
~G4ErrorSurfaceTrajState(){}
void BuildErrorMatrix( G4ErrorFreeTrajState& tpSC, const G4Vector3D& vecV,
const G4Vector3D& vecW );
// Build the error matrix from a free state plus the vectors of the surface
virtual void Dump( std::ostream& out = G4cout ) const;
friend
std::ostream& operator<<(std::ostream&, const G4ErrorSurfaceTrajState& ts);
// Set and Get methods
G4ErrorSurfaceTrajParam GetParameters() const
{ return fTrajParam; }
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
const G4Vector3D& vecV, const G4Vector3D& vecW )
{
fPosition = pos;
fMomentum = mom;
fTrajParam.SetParameters( pos, mom, vecV, vecW );
}
void SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
const G4Plane3D& plane )
{
fPosition = pos;
fMomentum = mom;
fTrajParam.SetParameters( pos, mom, plane );
}
G4Vector3D GetVectorV() const
{ return fTrajParam.GetVectorV(); }
G4Vector3D GetVectorW() const
{ return fTrajParam.GetVectorW(); }
virtual void SetPosition( const G4Point3D pos )
{ SetParameters( pos, fMomentum, GetVectorV(), GetVectorW() ); }
virtual void SetMomentum( const G4Vector3D& mom )
{ SetParameters( fPosition, mom, GetVectorV(), GetVectorW() ); }
private:
void Init();
// Define Trajectory State type and build charge
private:
G4ErrorSurfaceTrajParam fTrajParam;
};
#endif
+301
View File
@@ -0,0 +1,301 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorSymMatrix.hh,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// Class Description:
//
// Simplified version of CLHEP HepSymMatrix class.
// History:
// - Imported from CLHEP and modified: P. Arce May 2007
// --------------------------------------------------------------------
#ifndef G4ErrorSymMatrix_hh
#define G4ErrorSymMatrix_hh
#include <vector>
class G4ErrorMatrix;
class G4ErrorSymMatrix
{
public: //with description
inline G4ErrorSymMatrix();
// Default constructor. Gives 0x0 symmetric matrix.
// Another G4ErrorSymMatrix can be assigned to it.
explicit G4ErrorSymMatrix(G4int p);
G4ErrorSymMatrix(G4int p, G4int);
// Constructor. Gives p x p symmetric matrix.
// With a second argument, the matrix is initialized. 0 means a zero
// matrix, 1 means the identity matrix.
G4ErrorSymMatrix(const G4ErrorSymMatrix &m1);
// Copy constructor.
// Constructor from DiagMatrix
virtual ~G4ErrorSymMatrix();
// Destructor.
inline G4int num_row() const;
inline G4int num_col() const;
// Returns number of rows/columns.
const G4double & operator()(G4int row, G4int col) const;
G4double & operator()(G4int row, G4int col);
// Read and write a G4ErrorSymMatrix element.
// ** Note that indexing starts from (1,1). **
const G4double & fast(G4int row, G4int col) const;
G4double & fast(G4int row, G4int col);
// fast element access.
// Must be row>=col;
// ** Note that indexing starts from (1,1). **
void assign(const G4ErrorMatrix &m2);
// Assigns m2 to s, assuming m2 is a symmetric matrix.
void assign(const G4ErrorSymMatrix &m2);
// Another form of assignment. For consistency.
G4ErrorSymMatrix & operator*=(G4double t);
// Multiply a G4ErrorSymMatrix by a floating number.
G4ErrorSymMatrix & operator/=(G4double t);
// Divide a G4ErrorSymMatrix by a floating number.
G4ErrorSymMatrix & operator+=( const G4ErrorSymMatrix &m2);
G4ErrorSymMatrix & operator-=( const G4ErrorSymMatrix &m2);
// Add or subtract a G4ErrorSymMatrix.
G4ErrorSymMatrix & operator=( const G4ErrorSymMatrix &m2);
// Assignment operators. Notice that there is no G4ErrorSymMatrix = Matrix.
G4ErrorSymMatrix operator- () const;
// unary minus, ie. flip the sign of each element.
G4ErrorSymMatrix T() const;
// Returns the transpose of a G4ErrorSymMatrix (which is itself).
G4ErrorSymMatrix apply(G4double (*f)(G4double, G4int, G4int)) const;
// Apply a function to all elements of the matrix.
G4ErrorSymMatrix similarity(const G4ErrorMatrix &m1) const;
G4ErrorSymMatrix similarity(const G4ErrorSymMatrix &m1) const;
// Returns m1*s*m1.T().
G4ErrorSymMatrix similarityT(const G4ErrorMatrix &m1) const;
// temporary. test of new similarity.
// Returns m1.T()*s*m1.
G4ErrorSymMatrix sub(G4int min_row, G4int max_row) const;
// Returns a sub matrix of a G4ErrorSymMatrix.
void sub(G4int row, const G4ErrorSymMatrix &m1);
// Sub matrix of this G4ErrorSymMatrix is replaced with m1.
G4ErrorSymMatrix sub(G4int min_row, G4int max_row);
// SGI CC bug. I have to have both with/without const. I should not need
// one without const.
inline G4ErrorSymMatrix inverse(G4int &ifail) const;
// Invert a Matrix. The matrix is not changed
// Returns 0 when successful, otherwise non-zero.
void invert(G4int &ifail);
// Invert a Matrix.
// N.B. the contents of the matrix are replaced by the inverse.
// Returns ierr = 0 when successful, otherwise non-zero.
// This method has less overhead then inverse().
G4double determinant() const;
// calculate the determinant of the matrix.
G4double trace() const;
// calculate the trace of the matrix (sum of diagonal elements).
class G4ErrorSymMatrix_row
{
public:
inline G4ErrorSymMatrix_row(G4ErrorSymMatrix&,G4int);
inline G4double & operator[](G4int);
private:
G4ErrorSymMatrix& _a;
G4int _r;
};
class G4ErrorSymMatrix_row_const
{
public:
inline G4ErrorSymMatrix_row_const(const G4ErrorSymMatrix&,G4int);
inline const G4double & operator[](G4int) const;
private:
const G4ErrorSymMatrix& _a;
G4int _r;
};
// helper class to implement m[i][j]
inline G4ErrorSymMatrix_row operator[] (G4int);
inline G4ErrorSymMatrix_row_const operator[] (G4int) const;
// Read or write a matrix element.
// While it may not look like it, you simply do m[i][j] to get an
// element.
// ** Note that the indexing starts from [0][0]. **
// Special-case inversions for 5x5 and 6x6 symmetric positive definite:
// These set ifail=0 and invert if the matrix was positive definite;
// otherwise ifail=1 and the matrix is left unaltered.
void invertCholesky5 (G4int &ifail);
void invertCholesky6 (G4int &ifail);
// Inversions for 5x5 and 6x6 forcing use of specific methods: The
// behavior (though not the speed) will be identical to invert(ifail).
void invertHaywood4 (G4int & ifail);
void invertHaywood5 (G4int &ifail);
void invertHaywood6 (G4int &ifail);
void invertBunchKaufman (G4int &ifail);
protected:
inline G4int num_size() const;
private:
friend class G4ErrorSymMatrix_row;
friend class G4ErrorSymMatrix_row_const;
friend class G4ErrorMatrix;
friend void tridiagonal(G4ErrorSymMatrix *a, G4ErrorMatrix *hsm);
friend G4double condition(const G4ErrorSymMatrix &m);
friend void diag_step(G4ErrorSymMatrix *t, G4int begin, G4int end);
friend void diag_step(G4ErrorSymMatrix *t, G4ErrorMatrix *u,
G4int begin, G4int end);
friend G4ErrorMatrix diagonalize(G4ErrorSymMatrix *s);
friend void house_with_update2(G4ErrorSymMatrix *a, G4ErrorMatrix *v,
G4int row, G4int col);
friend G4ErrorSymMatrix operator+(const G4ErrorSymMatrix &m1,
const G4ErrorSymMatrix &m2);
friend G4ErrorSymMatrix operator-(const G4ErrorSymMatrix &m1,
const G4ErrorSymMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorSymMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorMatrix &m2);
friend G4ErrorMatrix operator*(const G4ErrorMatrix &m1,
const G4ErrorSymMatrix &m2);
// Multiply a Matrix by a Matrix or Vector.
// Returns v * v.T();
std::vector<G4double > m;
G4int nrow;
G4int size; // total number of elements
static G4double posDefFraction5x5;
static G4double adjustment5x5;
static const G4double CHOLESKY_THRESHOLD_5x5;
static const G4double CHOLESKY_CREEP_5x5;
static G4double posDefFraction6x6;
static G4double adjustment6x6;
static const G4double CHOLESKY_THRESHOLD_6x6;
static const G4double CHOLESKY_CREEP_6x6;
void invert4 (G4int & ifail);
void invert5 (G4int & ifail);
void invert6 (G4int & ifail);
};
//
// Operations other than member functions for Matrix, G4ErrorSymMatrix,
// DiagMatrix and Vectors
//
std::ostream& operator<<(std::ostream &s, const G4ErrorSymMatrix &q);
// Write out Matrix, G4ErrorSymMatrix, DiagMatrix and Vector into ostream.
G4ErrorMatrix operator*(const G4ErrorMatrix &m1,
const G4ErrorSymMatrix &m2);
G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorMatrix &m2);
G4ErrorMatrix operator*(const G4ErrorSymMatrix &m1,
const G4ErrorSymMatrix &m2);
G4ErrorSymMatrix operator*(G4double t, const G4ErrorSymMatrix &s1);
G4ErrorSymMatrix operator*(const G4ErrorSymMatrix &s1, G4double t);
// Multiplication operators.
// Note that m *= m1 is always faster than m = m * m1
G4ErrorSymMatrix operator/(const G4ErrorSymMatrix &m1, G4double t);
// s = s1 / t. (s /= t is faster if you can use it.)
G4ErrorMatrix operator+(const G4ErrorMatrix &m1,
const G4ErrorSymMatrix &s2);
G4ErrorMatrix operator+(const G4ErrorSymMatrix &s1,
const G4ErrorMatrix &m2);
G4ErrorSymMatrix operator+(const G4ErrorSymMatrix &s1,
const G4ErrorSymMatrix &s2);
// Addition operators
G4ErrorMatrix operator-(const G4ErrorMatrix &m1,
const G4ErrorSymMatrix &s2);
G4ErrorMatrix operator-(const G4ErrorSymMatrix &m1,
const G4ErrorMatrix &m2);
G4ErrorSymMatrix operator-(const G4ErrorSymMatrix &s1,
const G4ErrorSymMatrix &s2);
// subtraction operators
G4ErrorSymMatrix dsum(const G4ErrorSymMatrix &s1,
const G4ErrorSymMatrix &s2);
// Direct sum of two symmetric matrices;
G4double condition(const G4ErrorSymMatrix &m);
// Find the conditon number of a symmetric matrix.
void diag_step(G4ErrorSymMatrix *t, G4int begin, G4int end);
void diag_step(G4ErrorSymMatrix *t, G4ErrorMatrix *u, G4int begin, G4int end);
// Implicit symmetric QR step with Wilkinson Shift
G4ErrorMatrix diagonalize(G4ErrorSymMatrix *s);
// Diagonalize a symmetric matrix.
// It returns the matrix U so that s_old = U * s_diag * U.T()
void house_with_update2(G4ErrorSymMatrix *a, G4ErrorMatrix *v,
G4int row=1, G4int col=1);
// Finds and does Householder reflection on matrix.
void tridiagonal(G4ErrorSymMatrix *a, G4ErrorMatrix *hsm);
G4ErrorMatrix tridiagonal(G4ErrorSymMatrix *a);
// Does a Householder tridiagonalization of a symmetric matrix.
#include "G4ErrorSymMatrix.icc"
#endif
+141
View File
@@ -0,0 +1,141 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ErrorSymMatrix.icc,v 1.2 2007/06/01 12:43:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ------------------------------------------------------------
// GEANT 4 class inline implementation
// ------------------------------------------------------------
inline G4ErrorSymMatrix::G4ErrorSymMatrix()
: m(0), nrow(0), size(0)
{
}
inline G4int G4ErrorSymMatrix::num_row() const
{
return nrow;
}
inline G4int G4ErrorSymMatrix::num_col() const
{
return nrow;
}
inline G4int G4ErrorSymMatrix::num_size() const
{
return size;
}
inline G4double & G4ErrorSymMatrix::fast(G4int row,G4int col)
{
return *(m.begin()+(row*(row-1))/2+(col-1));
}
inline const G4double & G4ErrorSymMatrix::fast(G4int row,G4int col) const
{
return *(m.begin()+(row*(row-1))/2+(col-1));
}
inline G4double &
G4ErrorSymMatrix::operator()(G4int row, G4int col)
{
return (row>=col? fast(row,col) : fast(col,row));
}
inline const G4double &
G4ErrorSymMatrix::operator()(G4int row, G4int col) const
{
return (row>=col? fast(row,col) : fast(col,row));
}
inline void G4ErrorSymMatrix::assign(const G4ErrorSymMatrix &m2)
{
(*this)=m2;
}
inline G4ErrorSymMatrix G4ErrorSymMatrix::T() const
{
return G4ErrorSymMatrix(*this);
}
inline G4ErrorSymMatrix::G4ErrorSymMatrix_row
G4ErrorSymMatrix::operator[] (G4int r)
{
G4ErrorSymMatrix_row b(*this,r);
return b;
}
inline G4ErrorSymMatrix::G4ErrorSymMatrix_row_const
G4ErrorSymMatrix::operator[] (G4int r) const
{
const G4ErrorSymMatrix_row_const b(*this,r);
return b;
}
inline G4double &G4ErrorSymMatrix::G4ErrorSymMatrix_row::operator[](G4int c)
{
if (_r >= c )
{
return *(_a.m.begin() + (_r+1)*_r/2 + c);
}
else
{
return *(_a.m.begin() + (c+1)*c/2 + _r);
}
}
inline const G4double &
G4ErrorSymMatrix::G4ErrorSymMatrix_row_const::operator[](G4int c) const
{
if (_r >= c )
{
return *(_a.m.begin() + (_r+1)*_r/2 + c);
}
else
{
return *(_a.m.begin() + (c+1)*c/2 + _r);
}
}
inline G4ErrorSymMatrix::
G4ErrorSymMatrix_row::G4ErrorSymMatrix_row(G4ErrorSymMatrix &a, G4int r)
: _a(a), _r(r)
{}
inline G4ErrorSymMatrix::
G4ErrorSymMatrix_row_const::G4ErrorSymMatrix_row_const
(const G4ErrorSymMatrix&a,G4int r)
: _a(a), _r(r)
{}
inline G4ErrorSymMatrix G4ErrorSymMatrix::inverse(G4int &ifail) const
{
G4ErrorSymMatrix mTmp(*this);
mTmp.invert(ifail);
return mTmp;
}
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorTrackLengthTarget.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// G4ErrorTarget class: limits step when track length is bigger than
// theMaximumTrackLength. It is a G4VDiscreteProcess: limits the step in
// PostStepGetPhysicalInteractionLength().
// History:
// - Created. P. Arce, September 2004
// --------------------------------------------------------------------
#ifndef G4ErrorTrackLengthTarget_hh
#define G4ErrorTrackLengthTarget_hh
#include "G4ios.hh"
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ElementTable.hh"
#include "G4Step.hh"
#include "G4ErrorTarget.hh"
//----------------------------------------------------------------------------
class G4ErrorTrackLengthTarget : public G4VDiscreteProcess,
public G4ErrorTarget
{
public: // with description
G4ErrorTrackLengthTarget(const G4double maxTrkLength );
// Constructs and add this process to G4ProcessManager of all particles
virtual ~G4ErrorTrackLengthTarget(){}
// These methods are dummy, as the step limitation is done in the
// PostStepGetPhysicalInteractionLength().
virtual G4double GetDistanceFromPoint( const G4ThreeVector&,
const G4ThreeVector& ) const
{ return DBL_MAX; }
virtual G4double GetDistanceFromPoint( const G4ThreeVector& ) const
{ return DBL_MAX; }
virtual G4double
PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition );
// Checks if the maximum track length has been reached
virtual G4double GetMeanFreePath(const class G4Track & track,
G4double, G4ForceCondition *);
// Mean free path = theMaximumTrackLength - track.GetTrackLength()
virtual G4VParticleChange* PostStepDoIt( const G4Track&, const G4Step& );
virtual void Dump( const G4String& msg ) const;
private:
G4double theMaximumTrackLength;
};
#endif
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorTrajErr.hh,v 1.3 2007/05/31 20:27:07 arce Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Trajectory error. Implemented for the moment as a CLHEP HepG4ErrorSymMatrix,
// until other possibly faster implementations are studied
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorTrajErr_hh
#define G4ErrorTrajErr_hh
#include "G4ErrorSymMatrix.hh"
typedef G4ErrorSymMatrix G4ErrorTrajErr;
#endif
@@ -0,0 +1,138 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ErrorTrajState.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class Description:
//
// Base class for the trajectory state
// History:
// - Created: P. Arce
// --------------------------------------------------------------------
#ifndef G4ErrorTrajState_hh
#define G4ErrorTrajState_hh
#include "globals.hh"
#include "G4Track.hh"
#include "G4Point3D.hh"
#include "G4Vector3D.hh"
#include "G4ErrorTrajErr.hh"
enum G4eTSType{ G4eTS_FREE, G4eTS_OS };
class G4ErrorTrajState
{
public: // with description
G4ErrorTrajState(){}
G4ErrorTrajState( const G4String& partType, const G4Point3D& pos,
const G4Vector3D& mom,
const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5,0) );
// Constructor by providing particle, position and momentum
virtual ~G4ErrorTrajState(){}
void SetData( const G4String& partType, const G4Point3D& pos,
const G4Vector3D& mom );
// Set particle, position and momentum
void BuildCharge();
// Build charge based on particle type
friend
std::ostream& operator<<(std::ostream&, const G4ErrorTrajState& ts);
virtual G4int PropagateError( const G4Track* );
// Propagate the error along the step
virtual G4int Update( const G4Track* ){ return -1; }
// Update parameters from G4Track
void UpdatePosMom( const G4Point3D& pos, const G4Vector3D& mom );
// Update position and momentum
void DumpPosMomError( std::ostream& out = G4cout ) const;
// Dump position, momentum and error
virtual void Dump( std::ostream& out = G4cout ) const = 0;
// Abstract method to dump all TrajState parameters
// Set and Get methods
const G4String& GetParticleType() const
{ return fParticleType;}
void SetParticleType( const G4String& partType )
{ fParticleType = partType;}
G4Point3D GetPosition() const
{ return fPosition; }
virtual void SetPosition( const G4Point3D pos )
{ fPosition = pos; }
G4Vector3D GetMomentum() const
{ return fMomentum; }
virtual void SetMomentum( const G4Vector3D& mom )
{ fMomentum = mom; }
G4ErrorTrajErr GetError() const
{ return fError; }
virtual void SetError( G4ErrorTrajErr em )
{ fError = em; }
G4Track* GetG4Track() const
{ return theG4Track; }
void SetG4Track( G4Track* trk )
{ theG4Track = trk; }
G4double GetCharge() const
{ return fCharge; }
void SetCharge( G4double ch )
{ fCharge = ch; }
virtual G4eTSType GetTSType() const
{ return theTSType; }
protected:
G4String fParticleType;
G4Point3D fPosition;
G4Vector3D fMomentum;
G4double fCharge;
G4ErrorTrajErr fError;
G4eTSType theTSType;
G4Track* theG4Track;
G4int iverbose;
};
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VErrorLimitProcess.hh,v 1.2 2007/05/29 14:41:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class description:
//
// Base class for classes limiting the step.
// History:
//
// Created: P.Arce May 2007
// --------------------------------------------------------------------
#ifndef G4VErrorLimitProcess_hh
#define G4VErrorLimitProcess_hh
#include "G4ios.hh"
#include "globals.hh"
#include "G4VDiscreteProcess.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ElementTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Step.hh"
class G4ErrorLimitsMessenger;
//-----------------------------------------------------------------
class G4VErrorLimitProcess : public G4VDiscreteProcess
{
public: // with description
G4VErrorLimitProcess(const G4String& processName);
~G4VErrorLimitProcess();
virtual G4double
PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) = 0;
// Returns the step limit
virtual G4double GetMeanFreePath(const class G4Track &, G4double,
enum G4ForceCondition *);
// Returns kInfinity
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
// No action but retrieving the G4VParticleChange
// extracted from the G4Track
// Get and Set methods
G4double GetStepLimit() const { return theStepLimit; }
void SetStepLimit( G4double val ) { theStepLimit = val; }
protected:
G4double theStepLimit; // limit set by the user
G4double theStepLength; // step length extracted from the user step limit,
// with the algorithms of each concrete class
};
#endif