00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef G4MuonRadiativeDecayChannelWithSpin_h
00052 #define G4MuonRadiativeDecayChannelWithSpin_h 1
00053
00054 #include <CLHEP/Units/PhysicalConstants.h>
00055
00056 #include "globals.hh"
00057 #include "Randomize.hh"
00058 #include "G4ThreeVector.hh"
00059 #include "G4VDecayChannel.hh"
00060
00061 class G4MuonRadiativeDecayChannelWithSpin : public G4VDecayChannel
00062 {
00063
00064
00065
00066
00067 public:
00068
00069
00070 G4MuonRadiativeDecayChannelWithSpin(const G4String& theParentName,
00071 G4double theBR);
00072
00073 virtual ~G4MuonRadiativeDecayChannelWithSpin();
00074
00075 protected:
00076
00077 G4MuonRadiativeDecayChannelWithSpin(const G4MuonRadiativeDecayChannelWithSpin &);
00078 G4MuonRadiativeDecayChannelWithSpin & operator=(const G4MuonRadiativeDecayChannelWithSpin &);
00079
00080 private:
00081 G4MuonRadiativeDecayChannelWithSpin();
00082
00083 public:
00084
00085 virtual G4DecayProducts *DecayIt(G4double);
00086
00087 void SetPolarization(G4ThreeVector);
00088 const G4ThreeVector& GetPolarization() const;
00089
00090 private:
00091
00092 G4ThreeVector parent_polarization;
00093
00094 G4double fron(G4double Pmu, G4double x, G4double y,
00095 G4double cthetaE, G4double cthetaG, G4double cthetaEG);
00096
00097
00098
00099
00100
00101 void rn3dim(G4double& x, G4double& y, G4double& z, G4double xlong);
00102
00103 G4double atan4(G4double x, G4double y);
00104
00105 };
00106
00107 inline void G4MuonRadiativeDecayChannelWithSpin::
00108 SetPolarization(G4ThreeVector polar)
00109 {
00110 parent_polarization = polar;
00111 }
00112
00113 inline const G4ThreeVector& G4MuonRadiativeDecayChannelWithSpin::
00114 GetPolarization() const
00115 {
00116 return parent_polarization;
00117 }
00118
00119 inline void G4MuonRadiativeDecayChannelWithSpin::rn3dim(G4double& x,
00120 G4double& y,
00121 G4double& z,
00122 G4double xlong)
00123 {
00124 G4double a = 0.; G4double b = 0.; G4double c = 0.; G4double r = 0.;
00125
00126 do {
00127 a = G4UniformRand() - 0.5;
00128 b = G4UniformRand() - 0.5;
00129 c = G4UniformRand() - 0.5;
00130 r = a*a + b*b + c*c;
00131 } while (r > 0.25);
00132
00133 G4double rinv = xlong/(std::sqrt(r));
00134 x = a * rinv;
00135 y = b * rinv;
00136 z = c * rinv;
00137
00138 return;
00139 }
00140
00141 inline G4double G4MuonRadiativeDecayChannelWithSpin::atan4(G4double x,
00142 G4double y)
00143 {
00144 G4double phi = 0.;
00145
00146 if (x==0. && y>0.){
00147 phi = 0.5*CLHEP::pi;
00148 } else if (x==0. && y<0.){
00149 phi = 1.5*CLHEP::pi;
00150 } else if (y==0. && x>0.){
00151 phi = 0.;
00152 } else if (y==0. && x<0.){
00153 phi = CLHEP::pi;
00154 } else if (x>0. ){
00155 phi = std::atan(y/x);
00156 } else if (x<0. ){
00157 phi = std::atan(y/x) + CLHEP::pi;
00158 }
00159
00160 return phi;
00161 }
00162
00163 #endif