Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorFreeTrajParam.cc 69014 2013-04-15 09:42:51Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -48,8 +48,8 @@ G4ErrorFreeTrajParam::G4ErrorFreeTrajParam( const G4Point3D& pos,
|
||||
void G4ErrorFreeTrajParam::SetParameters( const G4Point3D& pos,
|
||||
const G4Vector3D& mom )
|
||||
{
|
||||
fDir = mom;
|
||||
fInvP = 1./mom.mag();
|
||||
fDir = mom*fInvP;
|
||||
fLambda = 90.*deg - mom.theta();
|
||||
fPhi = mom.phi();
|
||||
G4Vector3D vxPerp(0.,0.,0.);
|
||||
@@ -64,8 +64,11 @@ void G4ErrorFreeTrajParam::SetParameters( const G4Point3D& pos,
|
||||
// fXPerp = pos.proj( mom );
|
||||
G4ThreeVector posv(pos);
|
||||
if( vyPerp.mag() != 0. ) {
|
||||
fYPerp = posv.project( vyPerp ).mag();
|
||||
fZPerp = posv.project( vzPerp ).mag();
|
||||
// now all 2 scalar memeber variables retain the signs
|
||||
// fYPerp = posv.project( vyPerp ).mag();
|
||||
// fZPerp = posv.project( vzPerp ).mag();
|
||||
fYPerp = posv.dot( vyPerp );
|
||||
fZPerp = posv.dot( vzPerp );
|
||||
} else {
|
||||
fYPerp = 0.;
|
||||
fZPerp = 0.;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorFreeTrajState.cc 71874 2013-06-27 13:39:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -56,10 +56,10 @@ G4ErrorFreeTrajState::G4ErrorFreeTrajState( const G4String& partName, const G4Po
|
||||
//------------------------------------------------------------------------
|
||||
G4ErrorFreeTrajState::G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpSD ) : G4ErrorTrajState( tpSD.GetParticleType(), tpSD.GetPosition(), tpSD.GetMomentum() )
|
||||
{
|
||||
// G4ThreeVector planeNormal = tpSD.GetPlaneNormal();
|
||||
// G4ThreeVector planeNormal = tpSD.GetPlaneNormal();
|
||||
// G4double fPt = tpSD.GetMomentum()*planeNormal;//mom projected on normal to plane
|
||||
// G4ErrorSurfaceTrajParam tpSDparam = tpSD.GetParameters();
|
||||
// G4ThreeVector Psc = fPt * planeNormal + tpSDparam.GetPU()*tpSDparam.GetVectorU() + tpSD.GetPV()*tpSD.GetVectorW();
|
||||
// G4ErrorSurfaceTrajParam tpSDparam = tpSD.GetParameters();
|
||||
// G4ThreeVector Psc = fPt * planeNormal + tpSDparam.GetPU()*tpSDparam.GetVectorU() + tpSD.GetPV()*tpSD.GetVectorW();
|
||||
|
||||
fTrajParam = G4ErrorFreeTrajParam( fPosition, fMomentum );
|
||||
Init();
|
||||
@@ -68,7 +68,7 @@ G4ErrorFreeTrajState::G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpSD
|
||||
G4ErrorSurfaceTrajParam tpSDparam = tpSD.GetParameters();
|
||||
G4double mom = fMomentum.mag();
|
||||
G4double mom2 = fMomentum.mag2();
|
||||
G4double TVW1 = std::sqrt( mom2 / ( mom2 + tpSDparam.GetPV()*tpSDparam.GetPV() + tpSDparam.GetPV()*tpSDparam.GetPV()) );
|
||||
G4double TVW1 = std::sqrt( mom2 / ( mom2 + tpSDparam.GetPV()*tpSDparam.GetPV() + tpSDparam.GetPW()*tpSDparam.GetPW()) );
|
||||
G4ThreeVector vTVW( TVW1, tpSDparam.GetPV()/mom * TVW1, tpSDparam.GetPW()/mom * TVW1 );
|
||||
G4Vector3D vectorU = tpSDparam.GetVectorV().cross( tpSDparam.GetVectorW() );
|
||||
G4Vector3D vTN = vTVW.x()*vectorU + vTVW.y()*tpSDparam.GetVectorV() + vTVW.z()*tpSDparam.GetVectorW();
|
||||
@@ -96,7 +96,7 @@ G4ErrorFreeTrajState::G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpSD
|
||||
vVperp *= 1./vVperp.mag();
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 5){
|
||||
if( iverbose >= 5 ){
|
||||
G4cout << " CHECK: vUN " << vUN << " = " << vUperp << " diff " << (vUN-vUperp).mag() << G4endl;
|
||||
G4cout << " CHECK: vVN " << vVN << " = " << vVperp << " diff " << (vVN-vVperp).mag() << G4endl;
|
||||
}
|
||||
@@ -108,16 +108,15 @@ G4ErrorFreeTrajState::G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpSD
|
||||
G4double dVU = vVperp * tpSD.GetVectorV();
|
||||
G4double dVV = vVperp * tpSD.GetVectorW();
|
||||
|
||||
|
||||
//--- Get transformation first
|
||||
G4ErrorMatrix transfM(5, 5, 1 );
|
||||
//--- Get magnetic field
|
||||
const G4Field* field = G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField();
|
||||
G4ThreeVector dir = fTrajParam.GetDirection();
|
||||
G4double invCosTheta = 1./std::cos( dir.theta() );
|
||||
G4cout << " dir="<<dir<<" invCosTheta "<<invCosTheta << G4endl;
|
||||
|
||||
if( fCharge != 0
|
||||
&& field ) {
|
||||
if( fCharge != 0 && field ) {
|
||||
G4double pos1[3]; pos1[0] = fPosition.x()*cm; pos1[1] = fPosition.y()*cm; pos1[2] = fPosition.z()*cm;
|
||||
G4double h1[3];
|
||||
field->GetFieldValue( pos1, h1 );
|
||||
@@ -212,6 +211,7 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 )G4cout << " G4ErrorFreeTrajState::PropagateError " << G4endl;
|
||||
G4cout << "G4EP: iverbose="<< iverbose << G4endl;
|
||||
#endif
|
||||
|
||||
// * *** ERROR PROPAGATION ON A HELIX ASSUMING SC VARIABLES
|
||||
@@ -242,10 +242,12 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
G4double pInvPre = 1./pPre;
|
||||
G4double pInvPost = 1./pPost;
|
||||
G4double deltaPInv = pInvPost - pInvPre;
|
||||
if( iverbose >= 2 ) G4cout << "G4EP: pInvPre" << pInvPre<< " pInvPost:" << pInvPost<<" deltaPInv:" << deltaPInv<< G4endl;
|
||||
|
||||
|
||||
G4Vector3D vpPreNorm = vpPre * pInvPre;
|
||||
G4Vector3D vpPostNorm = vpPost * pInvPost;
|
||||
// if( iverbose >= 2 ) G4cout << "G4EP: vpPreNorm " << vpPreNorm << " vpPostNorm " << vpPostNorm << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << "G4EP: vpPreNorm " << vpPreNorm << " vpPostNorm " << vpPostNorm << G4endl;
|
||||
//return if propagation along Z??
|
||||
if( 1. - std::fabs(vpPostNorm.z()) < kCarTolerance ) return 4;
|
||||
G4double sinpPre = std::sin( vpPreNorm.theta() ); //cosine perpendicular to pPre = sine pPre
|
||||
@@ -281,25 +283,36 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
// check if the magnetic field is = 0.
|
||||
|
||||
//position is from geant4, it is assumed to be in mm (for debugging, eventually it will not be transformed)
|
||||
//it is assumed vposPre[] is in cm and pos1[] is in mm.
|
||||
G4double pos1[3]; pos1[0] = vposPre.x()*cm; pos1[1] = vposPre.y()*cm; pos1[2] = vposPre.z()*cm;
|
||||
G4double pos2[3]; pos2[0] = vposPost.x()*cm; pos2[1] = vposPost.y()*cm; pos2[2] = vposPost.z()*cm;
|
||||
G4double h1[3], h2[3];
|
||||
|
||||
const G4Field* field = G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField();
|
||||
if( !field ) return 0; //goto 45
|
||||
|
||||
|
||||
|
||||
|
||||
// calculate transformation except it NEUTRAL PARTICLE OR FIELDFREE REGION
|
||||
if( charge != 0. && field ) {
|
||||
|
||||
field->GetFieldValue( pos1, h1 );
|
||||
field->GetFieldValue( pos1, h1 ); //here pos1[], pos2[] are in mm, not changed
|
||||
field->GetFieldValue( pos2, h2 );
|
||||
G4ThreeVector HPre = G4ThreeVector( h1[0], h1[1], h1[2] ) / tesla *10.; //10. is to get same dimensions as GEANT3 (kilogauss)
|
||||
G4ThreeVector HPost= G4ThreeVector( h2[0], h2[1], h2[2] ) / tesla *10.;
|
||||
G4double magHPre = HPre.mag();
|
||||
G4double magHPost = HPost.mag();
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ) G4cout << "G4EP: HPre " << HPre << G4endl
|
||||
<< "G4EP: HPost " << HPost << G4endl;
|
||||
if( iverbose >= 2 ) {
|
||||
G4cout << "G4EP: h1 = "
|
||||
<< h1[0] << ", " << h1[1] << ", " << h1[2] << G4endl;
|
||||
G4cout << "G4EP: pos1/mm = "
|
||||
<< pos1[0] << ", " << pos1[1] << ", " << pos1[2] << G4endl;
|
||||
G4cout << "G4EP: pos2/mm = "
|
||||
<< pos2[0] << ", " << pos2[1] << ", " << pos2[2] << G4endl;
|
||||
G4cout << "G4EP: B-filed in KGauss HPre " << HPre << G4endl
|
||||
<< "G4EP: in KGauss HPost " << HPost << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( magHPre + magHPost != 0. ) {
|
||||
@@ -317,7 +330,11 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
G4double diffHSqr = ( HPre * pInvPre - HPost * pInvPost ).mag2();
|
||||
G4double delhp6Sqr = 300.*300.;
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ) G4cout << " G4EP: gam " << gam << " alphaSqr " << alphaSqr << " diffHSqr " << diffHSqr << G4endl;
|
||||
if( iverbose >= 2 ) {
|
||||
G4cout << " G4EP: gam " << gam << " alphaSqr " << alphaSqr
|
||||
<< " diffHSqr " << diffHSqr << G4endl;
|
||||
G4cout << " alpha= " << std::sqrt(alphaSqr) << G4endl;
|
||||
}
|
||||
#endif
|
||||
if( diffHSqr * alphaSqr > delhp6Sqr ) return 3;
|
||||
|
||||
@@ -343,7 +360,7 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
G4ThreeVector AN2 = vHAverNorm.cross( vpPostNorm );
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ) G4cout << " G4EP: AN2 " << AN2 << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << " G4EP: AN2 " << AN2 << " gamma:"<<gamma<< " theta="<< thetaAver<<G4endl;
|
||||
#endif
|
||||
G4double AU = 1./vpPreNorm.perp();
|
||||
//t G4ThreeVector vU( vpPreNorm.cross( G4ThreeVector(0.,0.,1.) ) * AU );
|
||||
@@ -364,7 +381,7 @@ G4int G4ErrorFreeTrajState::PropagateError( const G4Track* aTrack )
|
||||
vpPostNorm.z()*vUPost.x(),
|
||||
vpPostNorm.x()*vUPost.y() - vpPostNorm.y()*vUPost.x() );
|
||||
#ifdef G4EVERBOSE
|
||||
//- G4cout << " vpPostNorm " << vpPostNorm << G4endl;
|
||||
G4cout << " vpPostNorm " << vpPostNorm << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << " G4EP: AU " << AU << " vUPre " << vUPre << " vVPre " << vVPre << " vUPost " << vUPost << " vVPost " << vVPost << G4endl;
|
||||
#endif
|
||||
G4Point3D deltaPos( vposPre - vposPost );
|
||||
@@ -596,13 +613,13 @@ G4int G4ErrorFreeTrajState::PropagateErrorMSC( const G4Track* aTrack )
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 4 ) G4cout << "material " << mate->GetName()
|
||||
//<< " " << mate->GetZ() << " " << mate->GetA()
|
||||
<< " " << effZ << " " << effA
|
||||
<< " " << mate->GetDensity()/g*mole << " " << mate->GetRadlen()/cm << " " << mate->GetNuclearInterLength()/cm << G4endl;
|
||||
<< " effZ:" << effZ << " effA:" << effA
|
||||
<< " dens(g/mole):" << mate->GetDensity()/g*mole << " Radlen/cm:" << mate->GetRadlen()/cm << " nuclLen/cm" << mate->GetNuclearInterLength()/cm << G4endl;
|
||||
#endif
|
||||
|
||||
G4double RI = stepLengthCm / (mate->GetRadlen()/cm);
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 4 ) G4cout << std::setprecision(6) << std::setw(6) << "G4EP:MSC: RI " << RI << " stepLengthCm " << stepLengthCm << " radlen " << (mate->GetRadlen()/cm) << " " << RI*1.e10 << G4endl;
|
||||
if( iverbose >= 4 ) G4cout << std::setprecision(6) << std::setw(6) << "G4EP:MSC: RI=X/X0 " << RI << " stepLengthCm " << stepLengthCm << " radlen/cm " << (mate->GetRadlen()/cm) << " RI*1.e10:" << RI*1.e10 << G4endl;
|
||||
#endif
|
||||
G4double charge = aTrack->GetDynamicParticle()->GetCharge();
|
||||
G4double DD = 1.8496E-4*RI*(charge/pBeta * charge/pBeta );
|
||||
@@ -667,13 +684,13 @@ G4int G4ErrorFreeTrajState::PropagateErrorIoni( const G4Track* aTrack )
|
||||
G4double mass = aTrack->GetDynamicParticle()->GetMass() / GeV;
|
||||
G4double gamma = Etot / mass;
|
||||
|
||||
// * Calculate xi factor (KeV).
|
||||
// * Calculate xi factor (keV).
|
||||
G4double XI = 153.5*effZ*stepLengthCm*(mate->GetDensity()/mg*mole) /
|
||||
(effA*beta*beta);
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ){
|
||||
G4cout << "G4EP:IONI: XI " << XI << " beta " << beta << " gamma " << gamma << G4endl;
|
||||
G4cout << "G4EP:IONI: XI/keV " << XI << " beta " << beta << " gamma " << gamma << G4endl;
|
||||
G4cout << " density " << (mate->GetDensity()/mg*mole) << " effA " << effA << " step " << stepLengthCm << G4endl;
|
||||
}
|
||||
#endif
|
||||
@@ -684,12 +701,26 @@ G4int G4ErrorFreeTrajState::PropagateErrorIoni( const G4Track* aTrack )
|
||||
G4double massRatio = eMass / mass;
|
||||
G4double F1 = 2*eMass*etasq;
|
||||
G4double F2 = 1. + 2. * massRatio * gamma + massRatio * massRatio;
|
||||
G4double Emax = 1.E+6*F1/F2;
|
||||
G4double Emax = 1.E+6*F1/F2; // now in keV
|
||||
|
||||
// * *** and now sigma**2 in GeV
|
||||
G4double dedxSq = XI*Emax*(1.-(beta*beta/2.))*1.E-12;
|
||||
G4double dedxSq = XI*Emax*(1.-(beta*beta/2.))*1.E-12; // now in GeV^2
|
||||
/*The above formula for var(1/p) good for dens scatterers. However, for MIPS passing
|
||||
through a gas it leads to overestimation. Further more for incident electrons
|
||||
the Emax is almost equal to incident energy.
|
||||
This leads to k=Xi/Emax as small as e-6 and gradually the cov matrix explodes.
|
||||
|
||||
http://www2.pv.infn.it/~rotondi/kalman_1.pdf
|
||||
|
||||
Since I do not have enough info at the moment to implement Landau & sub-Landau models for k=Xi/Emax <0.01 I'll saturate k at this value for now
|
||||
*/
|
||||
|
||||
if (XI/Emax<0.01) dedxSq *=XI/Emax*100 ;// Quench for low Elos, see above: newVar=odVar *k/0.01
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ) G4cout << "G4EP:IONI: DEDX2 " << dedxSq << " emass " << eMass << " Emax " << Emax << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << "G4EP:IONI: DEDX^2(GeV^2) " << dedxSq << " emass/GeV: " << eMass << " Emax/keV: " << Emax
|
||||
<<" k=Xi/Emax="<< XI/Emax<< G4endl;
|
||||
|
||||
#endif
|
||||
|
||||
G4double pPre6 = (aTrack->GetStep()->GetPreStepPoint()->GetMomentum()/GeV).mag();
|
||||
@@ -697,10 +728,9 @@ G4int G4ErrorFreeTrajState::PropagateErrorIoni( const G4Track* aTrack )
|
||||
//Apply it to error
|
||||
fError[0][0] += Etot*Etot*dedxSq / pPre6;
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 2 ) G4cout << "G4:IONI getot " << Etot << " dedx2 " << dedxSq << " p " << pPre6 << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << "G4EP:IONI: error_from_ionisation " << (Etot*Etot*dedxSq) / pPre6 << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << "G4:IONI Etot/GeV: " << Etot << " err_dedx^2/GeV^2: " << dedxSq << " p^6: " << pPre6 << G4endl;
|
||||
if( iverbose >= 2 ) G4cout << "G4EP:IONI: error2_from_ionisation " << (Etot*Etot*dedxSq) / pPre6 << G4endl;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorGeomVolumeTarget.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorMagFieldLimitProcess.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorMatrix.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -647,8 +647,8 @@ void G4ErrorMatrix::invert(G4int &ierr)
|
||||
if(ncol != nrow)
|
||||
{ error("G4ErrorMatrix::invert: G4ErrorMatrix is not NxN"); }
|
||||
|
||||
static G4int max_array = 20;
|
||||
static G4int *ir = new G4int [max_array+1];
|
||||
static G4ThreadLocal G4int max_array = 20;
|
||||
static G4ThreadLocal G4int *ir = 0 ; if (!ir) ir= new G4int [max_array+1];
|
||||
|
||||
if (ncol > max_array)
|
||||
{
|
||||
@@ -775,8 +775,8 @@ void G4ErrorMatrix::invert(G4int &ierr)
|
||||
|
||||
G4double G4ErrorMatrix::determinant() const
|
||||
{
|
||||
static G4int max_array = 20;
|
||||
static G4int *ir = new G4int [max_array+1];
|
||||
static G4ThreadLocal G4int max_array = 20;
|
||||
static G4ThreadLocal G4int *ir = 0 ; if (!ir) ir= new G4int [max_array+1];
|
||||
if(ncol != nrow)
|
||||
{ error("G4ErrorMatrix::determinant: G4ErrorMatrix is not NxN"); }
|
||||
if (ncol > max_array)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorMessenger.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorPhysicsList.cc 69014 2013-04-15 09:42:51Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -158,8 +158,6 @@ void G4ErrorPhysicsList::ConstructProcess()
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
|
||||
#include "G4VEnergyLoss.hh"
|
||||
|
||||
#include "G4MuIonisation.hh"
|
||||
|
||||
#include "G4ErrorStepLengthLimitProcess.hh"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorPropagator.cc 69836 2013-05-16 08:13:10Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -55,8 +55,7 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
G4ErrorPropagator::G4ErrorPropagator()
|
||||
: theStepLength(0.), theInitialTrajState(0),
|
||||
theFinalTrajState(0), theStepN(0), theG4Track(0)
|
||||
: theStepLength(0.), theInitialTrajState(0), theStepN(0), theG4Track(0)
|
||||
{
|
||||
verbose = G4ErrorPropagatorData::verbose();
|
||||
#ifdef G4EVERBOSE
|
||||
@@ -186,14 +185,11 @@ G4int G4ErrorPropagator::PropagateOneStep( G4ErrorTrajState* currentTS )
|
||||
|| (G4StateManager::GetStateManager()->GetCurrentState()
|
||||
!= G4State_GeomClosed) )
|
||||
{
|
||||
G4cout << "ERROR - G4ErrorPropagator::PropagateOneStep()" << G4endl
|
||||
<< " Called before initialization is done for this track."
|
||||
<< G4endl
|
||||
<< " Please call G4ErrorPropagatorManager::InitGeant4e()."
|
||||
<< G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Called before initialization is done for this track!";
|
||||
G4Exception("G4ErrorPropagator::PropagateOneStep()",
|
||||
"InvalidCall", FatalException,
|
||||
"Called before initialization is done for this track!");
|
||||
"InvalidCall", FatalException, message,
|
||||
"Please call G4ErrorPropagatorManager::InitGeant4e().");
|
||||
}
|
||||
|
||||
// to start ierror is set to 0 (= OK)
|
||||
@@ -226,7 +222,11 @@ G4int G4ErrorPropagator::PropagateOneStep( G4ErrorTrajState* currentTS )
|
||||
|
||||
//----- If it is the first step, create a track
|
||||
//
|
||||
if( theStepN == 0 ) { theG4Track = InitG4Track( *currentTS ); }
|
||||
if( theStepN == 0 )
|
||||
{
|
||||
if( theG4Track != 0 ) { delete theG4Track; }
|
||||
theG4Track = InitG4Track( *currentTS );
|
||||
}
|
||||
// set to 0 by the initialization in G4ErrorPropagatorManager
|
||||
theStepN++;
|
||||
|
||||
@@ -258,10 +258,10 @@ G4Track* G4ErrorPropagator::InitG4Track( G4ErrorTrajState& initialTS )
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle(partType);
|
||||
if( particle == 0)
|
||||
{
|
||||
G4cerr << "ERROR - G4ErrorPropagator::InitG4Track()" << G4endl
|
||||
<< " Particle type not defined " + partType << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Particle type not defined: " << partType;
|
||||
G4Exception( "G4ErrorPropagator::InitG4Track()", "InvalidSetup",
|
||||
FatalException, "Particle type not defined !" );
|
||||
FatalException, message );
|
||||
}
|
||||
|
||||
G4DynamicParticle* DP =
|
||||
@@ -461,10 +461,10 @@ G4ErrorPropagator::InitFreeTrajState( G4ErrorTrajState* currentTS )
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4ErrorPropagator::InitFreeTrajState()" << G4endl
|
||||
<< "WRONG TrajState " + currentTS->GetTSType() << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Wrong trajectory state: " << currentTS->GetTSType();
|
||||
G4Exception("G4ErrorPropagator::InitFreeTrajState()", "InvalidState",
|
||||
FatalException, "WRONG trajectory state !");
|
||||
FatalException, message);
|
||||
}
|
||||
return currentTS_FREE;
|
||||
}
|
||||
@@ -554,12 +554,11 @@ G4bool G4ErrorPropagator::CheckIfLastStep( G4Track* aTrack )
|
||||
lastG4eStep = true;
|
||||
if( exception )
|
||||
{
|
||||
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
|
||||
<< " Track extrapolated until end of World" << G4endl
|
||||
<< " without finding the defined target " << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Track extrapolated until end of World" << G4endl
|
||||
<< "without finding the defined target!";
|
||||
G4Exception("G4ErrorPropagator::CheckIfLastStep()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Track extrapolated without finding the defined target.");
|
||||
"InvalidSetup", FatalException, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -575,12 +574,11 @@ G4bool G4ErrorPropagator::CheckIfLastStep( G4Track* aTrack )
|
||||
{
|
||||
if( exception )
|
||||
{
|
||||
G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
|
||||
<< " Track extrapolated until energy is exhausted" << G4endl
|
||||
<< " without finding the defined target !" << G4endl;
|
||||
std::ostringstream message;
|
||||
message << "Track extrapolated until energy is exhausted" << G4endl
|
||||
<< "without finding the defined target!";
|
||||
G4Exception("G4ErrorPropagator::CheckIfLastStep()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Track extrapolated without finding the defined target.");
|
||||
"InvalidSetup", FatalException, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorPropagatorManager.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
G4ErrorPropagatorManager*
|
||||
G4ThreadLocal G4ErrorPropagatorManager*
|
||||
G4ErrorPropagatorManager::theG4ErrorPropagatorManager = 0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorRunManagerHelper.cc 69014 2013-04-15 09:42:51Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -44,7 +44,8 @@
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
G4ErrorRunManagerHelper* G4ErrorRunManagerHelper::fRunManagerKernel = 0;
|
||||
G4ThreadLocal G4ErrorRunManagerHelper*
|
||||
G4ErrorRunManagerHelper::fRunManagerKernel = 0;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
G4ErrorRunManagerHelper* G4ErrorRunManagerHelper::GetRunManagerKernel()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorStepLengthLimitProcess.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorSurfaceTrajParam.cc 69014 2013-04-15 09:42:51Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -95,12 +95,18 @@ SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
|
||||
G4ThreeVector momv(mom);
|
||||
//check 3 vectors are ortogonal and right handed
|
||||
|
||||
fPV = momv.project( vecV ).mag();
|
||||
fPW = momv.project( vecW ).mag();
|
||||
// now all 4 scalar memeber variables retain the signs
|
||||
// fPV = momv.project( vecV ).mag();
|
||||
// fPW = momv.project( vecW ).mag();
|
||||
fPV = momv.dot( vecV );
|
||||
fPW = momv.dot( vecW );
|
||||
|
||||
|
||||
G4ThreeVector posv(pos);
|
||||
fV = posv.project( vecV ).mag();
|
||||
fW = posv.project( vecW ).mag();
|
||||
// fV = posv.project( vecV ).mag();
|
||||
// fW = posv.project( vecW ).mag();
|
||||
fV = posv.dot( vecV );
|
||||
fW = posv.dot( vecW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorSurfaceTrajState.cc 69014 2013-04-15 09:42:51Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -43,7 +43,6 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4ErrorSurfaceTrajState::
|
||||
G4ErrorSurfaceTrajState( const G4String& partType, const G4Point3D& pos,
|
||||
@@ -84,24 +83,24 @@ G4ErrorSurfaceTrajState( G4ErrorFreeTrajState& tpSC, const G4Plane3D& plane )
|
||||
//----- Get the error matrix in SC coordinates
|
||||
BuildErrorMatrix( tpSC, GetVectorV(), GetVectorW() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4ErrorSurfaceTrajState::
|
||||
G4ErrorSurfaceTrajState( G4ErrorFreeTrajState& tpSC, const G4Vector3D& vecU,
|
||||
const G4Vector3D& vecV )
|
||||
const G4Vector3D& vecV , G4ErrorMatrix &transfM)
|
||||
: G4ErrorTrajState( tpSC.GetParticleType(), tpSC.GetPosition(),
|
||||
tpSC.GetMomentum() )
|
||||
{
|
||||
Init(); // needed to define charge sign
|
||||
fTrajParam = G4ErrorSurfaceTrajParam( fPosition, fMomentum, vecU, vecV );
|
||||
theTSType = G4eTS_OS;
|
||||
//----- Get the error matrix in SC coordinates
|
||||
BuildErrorMatrix( tpSC, vecU, vecV );
|
||||
transfM= BuildErrorMatrix( tpSC, vecU, vecV );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void G4ErrorSurfaceTrajState::
|
||||
G4ErrorMatrix G4ErrorSurfaceTrajState::
|
||||
BuildErrorMatrix( G4ErrorFreeTrajState& tpSC, const G4Vector3D&,
|
||||
const G4Vector3D& )
|
||||
{
|
||||
@@ -139,11 +138,12 @@ BuildErrorMatrix( G4ErrorFreeTrajState& tpSC, const G4Vector3D&,
|
||||
const G4Field* field = G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField();
|
||||
|
||||
G4Vector3D vectorU = GetVectorV().cross( GetVectorW() );
|
||||
G4double T1R = 1. / ( vTN * vectorU );
|
||||
|
||||
#ifdef G4EVERBOSE
|
||||
if( iverbose >= 4) G4cout << "vectors " << vectorU << " " << GetVectorV() << " " << GetVectorW() << G4endl;
|
||||
if( iverbose >= 4) G4cout << "surf vectors:U,V,W " << vectorU << " " << GetVectorV() << " " << GetVectorW() << " T1R:"<<T1R<<G4endl;
|
||||
#endif
|
||||
G4double T1R = 1. / ( vTN * vectorU );
|
||||
|
||||
|
||||
if( fCharge != 0 && field ) {
|
||||
G4double pos[3]; pos[0] = fPosition.x()*cm; pos[1] = fPosition.y()*cm; pos[2] = fPosition.z()*cm;
|
||||
@@ -202,6 +202,7 @@ BuildErrorMatrix( G4ErrorFreeTrajState& tpSC, const G4Vector3D&,
|
||||
if( iverbose >= 4) G4cout << "G4ErrorSurfaceTrajState from SC " << *this << G4endl;
|
||||
#endif
|
||||
|
||||
return transfM; // want to use trasnfM for the reverse transform
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorSymMatrix.cc 68739 2013-04-05 09:55:11Z gcosmo $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -844,18 +844,20 @@ void G4ErrorSymMatrix::invertBunchKaufman(G4int &ifail)
|
||||
// by having a new without a delete that is only done once.
|
||||
|
||||
static const G4int max_array = 25;
|
||||
static std::vector<G4double> xvec (max_array);
|
||||
static std::vector<G4int> pivv (max_array);
|
||||
static G4ThreadLocal std::vector<G4double> *xvec = 0;
|
||||
if (!xvec) xvec = new std::vector<G4double> (max_array) ;
|
||||
static G4ThreadLocal std::vector<G4int> *pivv = 0;
|
||||
if (!pivv) pivv = new std::vector<G4int> (max_array) ;
|
||||
typedef std::vector<G4int>::iterator pivIter;
|
||||
if (xvec.size() < static_cast<unsigned int>(nrow)) xvec.resize(nrow);
|
||||
if (pivv.size() < static_cast<unsigned int>(nrow)) pivv.resize(nrow);
|
||||
if (xvec->size() < static_cast<unsigned int>(nrow)) xvec->resize(nrow);
|
||||
if (pivv->size() < static_cast<unsigned int>(nrow)) pivv->resize(nrow);
|
||||
// Note - resize should do nothing if the size is already larger than nrow,
|
||||
// but on VC++ there are indications that it does so we check.
|
||||
// Note - the data elements in a vector are guaranteed to be contiguous,
|
||||
// so x[i] and piv[i] are optimally fast.
|
||||
G4ErrorMatrixIter x = xvec.begin();
|
||||
G4ErrorMatrixIter x = xvec->begin();
|
||||
// x[i] is used as helper storage, needs to have at least size nrow.
|
||||
pivIter piv = pivv.begin();
|
||||
pivIter piv = pivv->begin();
|
||||
// piv[i] is used to store details of exchanges
|
||||
|
||||
G4double temp1, temp2;
|
||||
@@ -1236,10 +1238,10 @@ void G4ErrorSymMatrix::invertBunchKaufman(G4int &ifail)
|
||||
return; // inversion successful
|
||||
}
|
||||
|
||||
G4double G4ErrorSymMatrix::posDefFraction5x5 = 1.0;
|
||||
G4double G4ErrorSymMatrix::posDefFraction6x6 = 1.0;
|
||||
G4double G4ErrorSymMatrix::adjustment5x5 = 0.0;
|
||||
G4double G4ErrorSymMatrix::adjustment6x6 = 0.0;
|
||||
G4ThreadLocal G4double G4ErrorSymMatrix::posDefFraction5x5 = 1.0;
|
||||
G4ThreadLocal G4double G4ErrorSymMatrix::posDefFraction6x6 = 1.0;
|
||||
G4ThreadLocal G4double G4ErrorSymMatrix::adjustment5x5 = 0.0;
|
||||
G4ThreadLocal G4double G4ErrorSymMatrix::adjustment6x6 = 0.0;
|
||||
const G4double G4ErrorSymMatrix::CHOLESKY_THRESHOLD_5x5 = .5;
|
||||
const G4double G4ErrorSymMatrix::CHOLESKY_THRESHOLD_6x6 = .2;
|
||||
const G4double G4ErrorSymMatrix::CHOLESKY_CREEP_5x5 = .005;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorTrackLengthTarget.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4ErrorTrajState.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4VErrorLimitProcess.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
|
||||
Reference in New Issue
Block a user