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 #include <fstream>
00039 #include <iostream>
00040
00041 #include "mappings.hpp"
00042 #include "messaging.hpp"
00043
00044 using namespace std;
00045
00046
00047
00048 const bool Use_cm = false;
00049
00050
00051
00052 Pair::Pair()
00053 {
00054 E = 0.0;
00055 mu = 0.0;
00056 }
00057
00058 Pair::Pair(double energy, double cosine)
00059 {
00060 E = energy;
00061 mu = cosine;
00062 }
00063
00064 Pair::~Pair()
00065 {
00066 }
00067
00068 Pair operator-(const Pair& A, const Pair& B)
00069
00070 {
00071 Pair diff = Pair(A.E - B.E, A.mu - B.mu);
00072 return diff;
00073 }
00074
00075 double Pair_area(const Pair& A, const Pair& B)
00076
00077 {
00078
00079 double area = 0.5*(A.E*B.mu - B.E*A.mu);
00080 return area;
00081 }
00082
00083
00084
00085 mappings::mappings( )
00086 {
00087 _E_in = 0.0;
00088
00089 E_transl = 0.0;
00090 }
00091
00092 mappings::mappings(Target *target, Projectile *projectile,
00093 Product *ejectum, double E_in)
00094 {
00095 _target = target;
00096 _projectile = projectile;
00097 _ejectum = ejectum;
00098 _E_in = E_in;
00099
00100
00101
00102
00103 E_transl = ( Use_cm ) ? 0.0 :
00104 (projectile->AWR)*(ejectum->AWR)*E_in/
00105 ((projectile->AWR + target->AWR)*
00106 (projectile->AWR + target->AWR));
00107 }
00108
00109 mappings::~mappings()
00110 {
00111 }
00112
00113 void mappings::set_map(Target *target, Projectile *projectile,
00114 Product *ejectum, double E_in)
00115 {
00116 _target = target;
00117 _projectile = projectile;
00118 _ejectum = ejectum;
00119 _E_in = E_in;
00120
00121
00122
00123
00124 E_transl = ( Use_cm ) ? 0.0 :
00125 (projectile->AWR)*(ejectum->AWR)*E_in/
00126 ((projectile->AWR + target->AWR)*
00127 (projectile->AWR + target->AWR));
00128 }
00129
00130 Pair mappings::lab_to_cm(Pair& lab)
00131 {
00132
00133 const double Floor = 1.0e-8 * E_transl;
00134 if( Use_cm )
00135 {
00136 return lab;
00137 }
00138 else
00139 {
00140 Pair cm;
00141
00142 cm.E = lab.E + E_transl - 2*(lab.mu)*sqrt(E_transl*lab.E);
00143 if( cm.E < Floor )
00144 {
00145 cm.mu = 0.0;
00146 }
00147 else
00148 {
00149 cm.mu = (lab.mu)*sqrt(lab.E/cm.E) - sqrt(E_transl/cm.E);
00150 }
00151 return cm;
00152 }
00153 }
00154
00155 Pair mappings::cm_to_lab(Pair& cm)
00156
00157 {
00158 if( Use_cm )
00159 {
00160 return cm;
00161 }
00162 else
00163 {
00164 Pair lab;
00165
00166 lab.E = cm.E + E_transl + 2*(cm.mu)*sqrt(E_transl*cm.E);
00167
00168 if(lab.E == 0.0)
00169 {
00170 lab.mu = 0.0;
00171 }
00172 else
00173 {
00174 lab.mu = (cm.mu)*sqrt(cm.E/lab.E) + sqrt(E_transl/lab.E);
00175 }
00176 return lab;
00177 }
00178 }
00179
00180 double mappings::J_cm_to_lab( double E_cm, double E_lab )
00181
00182 {
00183 if( Use_cm )
00184 {
00185 return 1.0;
00186 }
00187 else
00188 {
00189 const double J_max = 1.0e7;
00190
00191
00192 double J = ( E_cm*J_max*J_max < E_lab )? J = J_max :
00193 sqrt( E_lab / E_cm );
00194
00195 return J;
00196 }
00197 }
00198
00199 double mappings::get_min_mu(double E_cm)
00200
00201 {
00202 double smallest;
00203
00204 if(E_cm > E_transl)
00205 {
00206 smallest = -1.0;
00207 }
00208 else if(E_cm == E_transl)
00209 {
00210 smallest = 0.0;
00211 }
00212 else
00213 {
00214 smallest = sqrt(1.0 - E_cm/E_transl);
00215 }
00216 return smallest;
00217 }
00218
00219
00220 void mappings::get_E_range(double E_cm, double mu, double *E_back,
00221 double *E_ahead)
00222
00223
00224
00225
00226
00227 {
00228 double V_1 = E_cm - (1 - mu*mu)*E_transl;
00229
00230 if(V_1 < 0.0)
00231 {
00232 Warning("mappings::get_E_range",pastenum("no particles with mu: ",mu));
00233 *E_back = -1.0;
00234 *E_ahead = -1.0;
00235 }
00236 else
00237 {
00238 V_1 = sqrt(V_1);
00239 double V_2 = mu*sqrt(E_transl);
00240 if(E_cm < E_transl)
00241 {
00242
00243 *E_back = (V_2 - V_1)*(V_2 - V_1);
00244 *E_ahead = (V_2 + V_1)*(V_2 + V_1);
00245 }
00246 else
00247 {
00248
00249 *E_back = -1.0;
00250 *E_ahead = (V_2 + V_1)*(V_2 + V_1);
00251 }
00252 }
00253 }
00254
00255
00256 double mappings::get_lab_E( double E_cm, double mu_lab, int sigma )
00257 {
00258
00259
00260
00261
00262
00263
00264 double E_lab;
00265
00266
00267 if( mu_lab == 0.0 )
00268 {
00269 E_lab = E_cm - E_transl;
00270 if( E_lab < 0.0 )
00271 {
00272 SevereError("mappings::lab_E_big", "negative E_lab");
00273 }
00274 }
00275 else
00276 {
00277 double alpha_sq = ( 1 - mu_lab*mu_lab ) / ( mu_lab*mu_lab );
00278 double alpha = sqrt( alpha_sq );
00279 if( mu_lab < 0.0 )
00280 {
00281 alpha *= -1.0;
00282 }
00283 double V_0 = sqrt( E_transl );
00284 double radical = alpha_sq*alpha_sq*E_transl +
00285 (1 + alpha_sq)*(E_cm - alpha_sq*E_transl);
00286 if( radical < 0.0 )
00287 {
00288 SevereError("mappings::get_lab_E", "no E_lab found");
00289 }
00290 double x = ( -alpha_sq*V_0 + sigma*sqrt( radical ) ) / ( 1 + alpha_sq );
00291 double y = alpha * ( x + V_0 );
00292 E_lab = ( x + V_0 )*( x + V_0 ) + y*y;
00293 }
00294 return E_lab;
00295 }
00296