00001 #ifndef RAD_TPhoton 00002 #define RAD_TPhoton 00003 00004 #include "TRandom.h" 00005 #include "TRadGlobal.h" 00006 00007 class TPhoton{ 00008 protected: 00009 double fNorm; // normalization factor 00010 double fP0; // auxilary parameter 0 00011 double fP1; // auxilary parameter 1 00012 double fP2; // auxilary parameter 2 00013 double fP3; // auxilary parameter 3 00014 double fxmin; // minimum emitted energy 00015 double fxmax; // maximum emitted energy 00016 double fX; // emitted energy 00017 double fCosTheta; // cosine of photon on a big angle 00018 double fLnD; // ln((1-beta*c1)/(1+beta*c1)) 00019 double fBetaI; // velocity of final particles 00020 double fiBetaI; // inverse velocity of final particles 00021 double fLnD_n; // ln((1-beta*c1)/(1+beta*c1)*(1+beta*c2)/(1-beta*c2)) 00022 double fBt; // (1+beta*c1)/(1-beta*c1) 00023 double fLnD_n2; // ln((1-beta*c1)/(1-beta*c2)) 00024 double fBt2; // (1-beta*c1) 00025 public: 00026 TPhoton(){Init();}; 00027 virtual ~TPhoton(){}; 00028 virtual void Init(){}; 00029 double GetMinimum(){return fxmin;} 00030 double GetMaximum(){return fxmax;} 00031 00032 virtual inline double GetCosTheta(){ 00033 double d = exp(fLnD*(2*gRandom->Rndm() - 1)); 00034 fCosTheta = (d - 1)/(fBetaI*(d + 1)); 00035 return fCosTheta; 00036 } 00037 virtual inline double GetThNorm(){ 00038 double k = fBetaI*fCosTheta; 00039 return fLnD*(1 - k*k); 00040 } 00041 00042 virtual inline double GetCosThetaF(){ 00043 double d = fBt*exp(fLnD_n*gRandom->Rndm()); 00044 fCosTheta = (d - 1)/(fBetaI*(d + 1)); 00045 return fCosTheta; 00046 } 00047 virtual inline double GetThNormF(){ 00048 double k = fBetaI*fCosTheta; 00049 return -0.5*fiBetaI*fLnD_n*(1 - k*k); 00050 } 00051 00052 virtual inline double GetCosThetaF2(){ 00053 double d = fBt2*exp(fLnD_n2*gRandom->Rndm()); 00054 fCosTheta = (1-d)*fiBetaI; 00055 return fCosTheta; 00056 } 00057 virtual inline double GetThNormF2(){ 00058 double k = fBetaI*fCosTheta; 00059 return fiBetaI*fLnD_n2*(1 - k); 00060 } 00061 00062 static double GetPhi(){ 00063 return 2*gRandom->Rndm()*M_PI; 00064 } 00065 static double GetPhiNorm(){return 2*M_PI;} 00066 00067 inline double GetPhE(){return fX;} 00068 inline double GetPhC(){return fCosTheta;} 00069 virtual inline double GetENorm(){return 1;}; 00070 virtual inline double GetEnergy(){return 0;}; 00071 00072 void SetCosTheta(const double& x){fCosTheta = x;} 00073 void SetEnergy(const double& x){fX = x;} 00074 }; 00075 00076 // photons in Initial state 00077 // by distribution 1/x/(1-x) 00078 class TPhotonI:public TPhoton{ 00079 public: 00080 TPhotonI():TPhoton(){}; 00081 void Init(); 00082 inline double GetEnergy(){ 00083 double d = fP0*exp(gRandom->Rndm()*fP1); 00084 fX = d/(1+d); 00085 return fX; 00086 } 00087 inline double GetENorm(){return fNorm*fX*(1-fX);} 00088 }; 00089 00090 // photons in final state 00091 // by distribution 1/x 00092 class TPhotonF:public TPhoton{ 00093 public: 00094 TPhotonF():TPhoton(){}; 00095 void Init(); 00096 inline double GetEnergy(){ 00097 fX = fP0*exp(gRandom->Rndm()*fP1); 00098 return fX; 00099 } 00100 inline double GetENorm(){return fNorm*fX;} 00101 }; 00102 00103 00104 // photons in final state 00105 // with uniform angle distribution 00106 class TPhotonFS:public TPhotonF{ 00107 protected: 00108 double fCosThetaMin; 00109 public: 00110 TPhotonFS():TPhotonF(){ 00111 fCosThetaMin = 0.995; 00112 }; 00113 inline double GetCosTheta(){ 00114 fCosTheta = (2*gRandom->Rndm()-1)*fCosThetaMin; 00115 return fCosTheta; 00116 } 00117 inline double GetThNorm(){ 00118 return 2*fCosThetaMin; 00119 } 00120 }; 00121 00122 00123 // soft and virtual photons 00124 // by distribution 1/x^b/2 from 0 to Delta_E 00125 class TPhotonS:public TPhoton{ 00126 protected: 00127 double fP2, fP3; 00128 public: 00129 TPhotonS():TPhoton(){}; 00130 void Init(); 00131 void Init(const double&, const double&); 00132 inline double GetEnergy(){return 0;}; 00133 inline void GetEnergy(double &x1, double &x2, double &x3, double &x4){ 00134 double t1 = log(gRandom->Rndm())*fP1; 00135 x1 = fP0*exp(t1); 00136 00137 double t2 = log(gRandom->Rndm())*fP1; 00138 x2 = fP0*exp(t2); 00139 00140 double t3 = log(gRandom->Rndm())*fP1; 00141 x3 = fP0*exp(t3); 00142 00143 double t4 = log(gRandom->Rndm())*fP1; 00144 x4 = fP0*exp(t4); 00145 00146 fX = t1 + t2 + t3 + t4; 00147 00148 } 00149 inline double GetENorm(){return fNorm;} 00150 inline double GetXNorm(){return fP2*exp(fP3*fX);} 00151 inline double GetX(){return fX;} 00152 }; 00153 00154 // soft and virtual photons 00155 // by distribution 1/x^b/2 from 0 to Delta_E 00156 class TPhotonD:public TPhoton{ 00157 public: 00158 TPhotonD():TPhoton(){}; 00159 void Init(); 00160 void Init(const double&, const double&); 00161 inline double GetEnergy(){ 00162 double t1 = log(gRandom->Rndm())*fP1; 00163 fX = fP0*exp(t1); 00164 return fX; 00165 } 00166 00167 inline double GetEnergy(const double &delta, const double &b2){ 00168 fNorm = pow(delta,b2); 00169 fX = delta*exp(log(gRandom->Rndm())/b2); 00170 return fX; 00171 } 00172 00173 inline double GetENorm(){return fNorm;} 00174 }; 00175 00176 #endif //#ifndef RAD_TPhoton