G4StokesVector Class Reference

#include <G4StokesVector.hh>


Public Member Functions

 G4StokesVector ()
 G4StokesVector (const G4ThreeVector &v)
virtual ~G4StokesVector ()
G4double p1 () const
G4double p2 () const
G4double p3 () const
G4bool IsZero () const
G4double Transverse () const
G4ThreeVector PolSqr () const
G4ThreeVector PolSqrt () const
G4ThreeVector PolError (const G4StokesVector &sum2, long n)
G4ThreeVector PolDiv (const G4StokesVector &)
void SetPhoton ()
void RotateAz (G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void InvRotateAz (G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void RotateAz (G4double cosphi, G4double sinphi)
G4double GetBeta ()
void DiceUniform ()
void DiceP1 ()
void DiceP2 ()
void DiceP3 ()
void FlipP3 ()

Static Public Attributes

static const G4StokesVector ZERO = G4ThreeVector(0.,0.,0.)
static const G4StokesVector P1 = G4ThreeVector(1.,0.,0.)
static const G4StokesVector P2 = G4ThreeVector(0.,1.,0.)
static const G4StokesVector P3 = G4ThreeVector(0.,0.,1.)
static const G4StokesVector M1 = G4ThreeVector(-1.,0.,0.)
static const G4StokesVector M2 = G4ThreeVector(0.,-1.,0.)
static const G4StokesVector M3 = G4ThreeVector(0.,0.,-1.)


Detailed Description

Definition at line 58 of file G4StokesVector.hh.


Constructor & Destructor Documentation

G4StokesVector::G4StokesVector (  ) 

Definition at line 57 of file G4StokesVector.cc.

Referenced by PolError().

00058   : G4ThreeVector(),isPhoton(false)
00059 {
00060 }

G4StokesVector::G4StokesVector ( const G4ThreeVector v  ) 

Definition at line 62 of file G4StokesVector.cc.

00063   : G4ThreeVector(v),isPhoton(false)
00064 {
00065 }

G4StokesVector::~G4StokesVector (  )  [virtual]

Definition at line 67 of file G4StokesVector.cc.

00068 {
00069 }


Member Function Documentation

void G4StokesVector::DiceP1 (  ) 

Definition at line 168 of file G4StokesVector.cc.

References G4UniformRand.

00169 {
00170   if (G4UniformRand()>0.5) setX(1.);
00171   else setX(-1.);
00172   setY(0.);
00173   setZ(0.);
00174 }

void G4StokesVector::DiceP2 (  ) 

Definition at line 176 of file G4StokesVector.cc.

References G4UniformRand.

00177 {
00178   setX(0.);
00179   if (G4UniformRand()>0.5) setY(1.);
00180   else setY(-1.);
00181   setZ(0.);
00182 }

void G4StokesVector::DiceP3 (  ) 

Definition at line 184 of file G4StokesVector.cc.

References G4UniformRand.

00185 {
00186   setX(0.);
00187   setY(0.);
00188   if (G4UniformRand()>0.5) setZ(1.);
00189   else setZ(-1.);
00190 }

void G4StokesVector::DiceUniform (  ) 

Definition at line 158 of file G4StokesVector.cc.

References G4UniformRand, and G4INCL::Math::pi.

00159 {
00160   G4double costheta=2.*G4UniformRand()-1.;
00161   G4double sintheta=std::sqrt(1.-costheta*costheta);
00162   G4double aphi     =2.*pi*G4UniformRand();
00163   setX(std::sin(aphi)*sintheta);
00164   setY(std::cos(aphi)*sintheta);
00165   setZ(costheta);
00166 }

void G4StokesVector::FlipP3 (  ) 

Definition at line 192 of file G4StokesVector.cc.

00193 {
00194   setZ(-z());
00195 }

G4double G4StokesVector::GetBeta (  ) 

Definition at line 151 of file G4StokesVector.cc.

00152 {
00153   G4double bet=getPhi();
00154   if (isPhoton) { bet *= 0.5; }
00155   return bet;
00156 }

void G4StokesVector::InvRotateAz ( G4ThreeVector  nInteractionFrame,
G4ThreeVector  particleDirection 
)

Definition at line 108 of file G4StokesVector.cc.

References G4cout, G4PolarizationHelper::GetParticleFrameY(), and RotateAz().

Referenced by G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedMollerBhabhaModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4PolarizedAnnihilationModel::SampleSecondaries(), and G4ePolarizedBremsstrahlungModel::SampleSecondaries().

00110 {
00111   // note if incomming particle is on z-axis, 
00112   // we might encounter some nummerical problems, since
00113   // nInteratonFrame and yParticleFrame are actually (almost) the same momentum
00114   // and the normalization is only good to 10^-12 !
00115 
00116   G4ThreeVector  yParticleFrame = 
00117     G4PolarizationHelper::GetParticleFrameY(particleDirection);
00118   G4double cosphi=yParticleFrame*nInteractionFrame;
00119 
00120   if (cosphi>1.+1.e-8 || cosphi<-1.-1.e-8) {
00121         G4cout<<" warning G4StokesVector::RotateAz  cosphi>1 or cosphi<-1\n";
00122   }
00123   if (cosphi>1) cosphi=1.;
00124   else if (cosphi<-1)cosphi=-1.;
00125 
00126   // check sign once more!
00127   G4double hel=(yParticleFrame.cross(nInteractionFrame)*particleDirection)>0?1.:-1.;
00128   G4double sinphi=hel*std::sqrt(std::fabs(1.-cosphi*cosphi));
00129   RotateAz(cosphi,-sinphi);
00130 }

G4bool G4StokesVector::IsZero (  )  const [inline]

Definition at line 78 of file G4StokesVector.hh.

References ZERO.

Referenced by G4ePolarizedIonisation::GetMeanFreePath(), G4PolarizedMollerCrossSection::Initialize(), G4PolarizedBhabhaCrossSection::Initialize(), G4ePolarizedIonisation::PostStepGetPhysicalInteractionLength(), G4PolarizedMollerCrossSection::XSection(), and G4PolarizedBhabhaCrossSection::XSection().

00078 { return *this==ZERO; } 

G4double G4StokesVector::p1 (  )  const [inline]

Definition at line 74 of file G4StokesVector.hh.

Referenced by RotateAz(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), and G4PolarizedAnnihilationModel::SampleSecondaries().

00074 { return x(); }

G4double G4StokesVector::p2 (  )  const [inline]

Definition at line 75 of file G4StokesVector.hh.

Referenced by RotateAz(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), and G4PolarizedAnnihilationModel::SampleSecondaries().

00075 { return y(); }

G4double G4StokesVector::p3 (  )  const [inline]

Definition at line 76 of file G4StokesVector.hh.

Referenced by G4PolarizedComptonModel::ComputeCrossSectionPerAtom(), G4PolarizedCompton::GetMeanFreePath(), G4PolarizedCompton::PostStepGetPhysicalInteractionLength(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4PolarizedAnnihilationModel::SampleSecondaries(), and G4PolarizedComptonCrossSection::TotalXSection().

00076 { return z(); }

G4ThreeVector G4StokesVector::PolDiv ( const G4StokesVector  ) 

Definition at line 204 of file G4StokesVector.cc.

00205   {return G4ThreeVector(b.x()!=0. ? x()/b.x() : 11111.,
00206                         b.y()!=0. ? y()/b.y() : 11111., 
00207                         b.z()!=0. ? z()/b.z() : 11111.);}

G4ThreeVector G4StokesVector::PolError ( const G4StokesVector sum2,
long  n 
)

Definition at line 197 of file G4StokesVector.cc.

References G4StokesVector(), PolSqr(), and PolSqrt().

00198 {
00199   // delta x = sqrt[ ( <x^2> - <x>^2 )/(n-1) ]
00200   G4StokesVector mean=(1./n)*(*this);
00201   return G4StokesVector((1./(n-1.)*((1./n)*sum2 - mean.PolSqr()))).PolSqrt();
00202 }

G4ThreeVector G4StokesVector::PolSqr (  )  const [inline]

Definition at line 81 of file G4StokesVector.hh.

Referenced by PolError().

00081                                       { 
00082     return G4ThreeVector(x()*x(),y()*y(),z()*z()); 
00083   }

G4ThreeVector G4StokesVector::PolSqrt (  )  const [inline]

Definition at line 84 of file G4StokesVector.hh.

Referenced by PolError().

00084                                        { 
00085     return G4ThreeVector(std::sqrt(x()),std::sqrt(y()),std::sqrt(z())); 
00086   }

void G4StokesVector::RotateAz ( G4double  cosphi,
G4double  sinphi 
)

Definition at line 132 of file G4StokesVector.cc.

References p1(), and p2().

00133 {
00134   if (!isPhoton) {
00135     G4double xsi1=  cosphi*p1() + sinphi*p2();
00136     G4double xsi2= -sinphi*p1() + cosphi*p2();
00137     setX(xsi1);
00138     setY(xsi2);
00139     return;
00140   }
00141 
00142   G4double sin2phi=2.*cosphi*sinphi;
00143   G4double cos2phi=cosphi*cosphi-sinphi*sinphi;
00144 
00145   G4double xsi1=  cos2phi*p1() + sin2phi*p2();
00146   G4double xsi2= -sin2phi*p1() + cos2phi*p2();
00147   setX(xsi1);
00148   setY(xsi2);
00149 }

void G4StokesVector::RotateAz ( G4ThreeVector  nInteractionFrame,
G4ThreeVector  particleDirection 
)

Definition at line 71 of file G4StokesVector.cc.

References G4cout, G4endl, and G4PolarizationHelper::GetParticleFrameY().

Referenced by InvRotateAz(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedMollerBhabhaModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4PolarizedAnnihilationModel::SampleSecondaries(), and G4ePolarizedBremsstrahlungModel::SampleSecondaries().

00073 {
00074   G4ThreeVector  yParticleFrame = 
00075     G4PolarizationHelper::GetParticleFrameY(particleDirection);
00076 
00077 
00078   G4double cosphi=yParticleFrame*nInteractionFrame;
00079   if (cosphi>(1.+1.e-8) || cosphi<(-1.-1.e-8)) {
00080     G4cout<<" warning G4StokesVector::RotateAz  cosphi>1 or cosphi<-1\n"
00081           <<" cosphi="<<cosphi<<"\n"
00082           <<" zAxis="<<particleDirection<<" ("<<particleDirection.mag()<<")\n"
00083           <<" yAxis="<<yParticleFrame<<" ("<<yParticleFrame.mag()<<")\n"
00084           <<" nAxis="<<nInteractionFrame<<" ("
00085           <<nInteractionFrame.mag()<<")"<<G4endl;
00086   }
00087   if (cosphi>1.) cosphi=1.;
00088   else if (cosphi<-1.) cosphi=-1.;
00089 
00090 //     G4cout<<" cosphi="<<cosphi<<"\n"
00091 //        <<" zAxis="<<particleDirection<<" ("<<particleDirection.mag()<<")\n"
00092 //        <<" yAxis="<<yParticleFrame<<" ("<<yParticleFrame.mag()<<","<<(yParticleFrame*particleDirection)<<")\n"
00093 //        <<" nAxis="<<nInteractionFrame<<" ("
00094 //        <<nInteractionFrame.mag()<<")"<<G4endl;
00095 
00096   //  G4double hel=sgn(cross(yParticleFrame*nInteractionFrame)*zInteractionFrame);
00097   // Why not particleDirection instead of zInteractionFrame ???!!!
00098   // -> is the same, since SYSIN is called with p1, and p2 as first parameter!
00099   G4double hel=(yParticleFrame.cross(nInteractionFrame)*particleDirection)>0?1.:-1.;
00100 
00101   G4double sinphi=hel*std::sqrt(1.-cosphi*cosphi);
00102   //  G4cout<<" sin2 + cos2 -1 = "<<(sinphi*sinphi+cosphi*cosphi-1)<<"\n";
00103 
00104   RotateAz(cosphi,sinphi);
00105 }

void G4StokesVector::SetPhoton (  )  [inline]

Definition at line 92 of file G4StokesVector.hh.

Referenced by G4PolarizedPairProductionCrossSection::Initialize(), G4PolarizedBremsstrahlungCrossSection::Initialize(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4PolarizedAnnihilationModel::SampleSecondaries(), and G4ePolarizedBremsstrahlungModel::SampleSecondaries().

00092 { isPhoton=true; }

G4double G4StokesVector::Transverse (  )  const [inline]

Definition at line 79 of file G4StokesVector.hh.

00079 { return perp(); } 


Field Documentation

const G4StokesVector G4StokesVector::M1 = G4ThreeVector(-1.,0.,0.) [static]

Definition at line 66 of file G4StokesVector.hh.

const G4StokesVector G4StokesVector::M2 = G4ThreeVector(0.,-1.,0.) [static]

Definition at line 67 of file G4StokesVector.hh.

const G4StokesVector G4StokesVector::M3 = G4ThreeVector(0.,0.,-1.) [static]

Definition at line 68 of file G4StokesVector.hh.

const G4StokesVector G4StokesVector::P1 = G4ThreeVector(1.,0.,0.) [static]

Definition at line 63 of file G4StokesVector.hh.

Referenced by G4PolarizedAnnihilationModel::ComputeAsymmetriesPerElectron(), G4VPolarizedCrossSection::GetPol2(), and G4VPolarizedCrossSection::GetPol3().

const G4StokesVector G4StokesVector::P2 = G4ThreeVector(0.,1.,0.) [static]

Definition at line 64 of file G4StokesVector.hh.

Referenced by G4PolarizedAnnihilationModel::ComputeAsymmetriesPerElectron(), G4VPolarizedCrossSection::GetPol2(), and G4VPolarizedCrossSection::GetPol3().

const G4StokesVector G4StokesVector::P3 = G4ThreeVector(0.,0.,1.) [static]

Definition at line 65 of file G4StokesVector.hh.

Referenced by G4PolarizedAnnihilationModel::ComputeAsymmetriesPerElectron(), G4VPolarizedCrossSection::GetPol2(), and G4VPolarizedCrossSection::GetPol3().

const G4StokesVector G4StokesVector::ZERO = G4ThreeVector(0.,0.,0.) [static]

Definition at line 62 of file G4StokesVector.hh.

Referenced by G4PolarizedAnnihilationModel::ComputeAsymmetriesPerElectron(), G4PolarizedMollerBhabhaModel::ComputeCrossSectionPerElectron(), G4VPolarizedCrossSection::GetPol2(), G4VPolarizedCrossSection::GetPol3(), IsZero(), G4PolarizedPEEffectModel::SampleSecondaries(), G4PolarizedMollerBhabhaModel::SampleSecondaries(), G4PolarizedGammaConversionModel::SampleSecondaries(), G4ePolarizedBremsstrahlungModel::SampleSecondaries(), and G4PolarizedComptonCrossSection::XSection().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:27 2013 for Geant4 by  doxygen 1.4.7