FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
00001 /*************************************************************************** 00002 gdevmsct.cpp - description 00003 ------------------- 00004 begin : Sun Nov 26 2000 00005 copyright : (C) 2000 by Giuseppe m Pierazzini 00006 email : pierazzini@unipi.it 00007 *************************************************************************** 00008 * * 00009 * NA48 simulation program. * 00010 * * 00011 ***************************************************************************/ 00012 00013 00014 /*** 888 andrebbe messa con device.cpp !!! ***/ 00015 00016 00017 #define ESTERNO 1 00018 #define INTERNO 0 00019 #define INBUCO -1 00020 00021 #include "parm.h" 00022 #include "apparato.h" 00023 #include "particella.h" 00024 #include "evento.h" 00025 00026 using namespace std; 00027 00028 //------------------------------------------------- 00029 // M S C A T T E R 00030 //------------------------------------------------- 00031 00032 // ======= Multiple Scattering Routine ===== 00033 // at t e n z i o n e ... aggiustare per magnete e sfera!!! 00034 00035 int Device:: 00036 Mscatter (Particella * pr, double tratok) 00037 00038 { 00039 if(Scatter==0) return 0; // no multiple scattering required 00040 lrad=nowpos?lradb:lradi; 00041 00042 if (lrad <= 0.0 || // no multiscat. 00043 pr->charg == 0.0 || // no charge 00044 tratok < 0.001 ) // no crossed space 00045 return 0; 00046 00047 // qui lrad >0 00048 00049 // Cut on Energia minore di qualche mev....se troppo basso potrebbe dare problemi 00050 double ee=pr->P.e; 00051 double Te=ee-pr->massa; 00052 double zz= nowpos?Zbuc:Zint; 00053 double Ec= .8/(1.2 +zz); // Ec= 800 MeV/(Z+1.2) 00054 00055 if (ee <Ec) 00056 { 00057 // pr->P.print("P1"); 00058 // Gout<< " " <<zz<<" Te "<<Te<<" Ec "<< Ec; 00059 // 00060 pr->P.setqn(0.,0.,0.,pr->massa); // aggiorno il quadrivettore P 00061 Hits[nhit].e_rivela+=Te; // aggiorno l'energia persa... 00062 pr->Ifato=-17; 00063 return -17; 00064 } 00065 00066 // calcolo dle multiplescatterig 00067 nrad= tratok/lrad; 00068 double px,py,pz; 00069 px=pr->P.x; 00070 py=pr->P.y; 00071 pz=pr->P.z; 00072 double p = pr->P.norma; 00073 00074 // Gout<<"\n Ms: ev "<< setprecision(3)<<Eventi_Fatti << " "<<nome <<" " <<pr->nome 00075 // << " E "<< eq<<" tratok "<<tratok 00076 // << " rad. "<< lrad<< " Nrad. "<< nrad ; 00077 00078 // get the p direction angles 00079 double pt = sqrt (px*px+py*py); 00080 sint = pt / p; 00081 cost = pz /p; 00082 if (pt > 0.) 00083 { 00084 sinf = py / pt; 00085 cosf = px / pt; 00086 } 00087 else 00088 { 00089 sinf = 0.; 00090 cosf = 1.; 00091 } 00092 00093 00094 00095 00096 00097 // get rotation matrix (versors) to the p direction 00098 gvet Rx,Ry,Rz; 00099 Rx.setv(cosf * cost, -sinf , cosf * sint); 00100 Ry.setv(sinf * cost, cosf , sinf * sint); 00101 Rz.setv( -sint , 0. , cost); 00102 00103 00104 // get the teta scattering rms value (charge set to 1 by default) 00105 00106 double z=pr->charg; 00107 tet0 = 0.0136 * z*z*sqrt (nrad) * (1. + 0.038 * log(nrad)); 00108 if (pr->massa<0.001) tet0*=1./ee; // electrons.... 00109 else tet0*=ee/(p*p); 00110 00111 00112 00113 00114 gvet S,DPX; 00115 // generate scattering displacements and angles in x and y plane 00116 z1= Pgauss(1.,0.); 00117 z2= Pgauss(1.,0.); 00118 xplane=tratok*tet0*(z1*0.28867 + z2*0.5); 00119 txplane=p*z2*tet0; 00120 z1= Pgauss(1.,0.); 00121 z2= Pgauss(1.,0.); 00122 yplane=tratok*tet0*(z1*0.28867 + z2*0.5); 00123 typlane=p*z2*tet0; 00124 // teta nello spazio ==>teta=sqrt(txplane*txplane+typlane*typlane); 00125 // generate the scattered momentum vector taking as initial 00126 // direction the z axe ....... and... 00127 S.setv(txplane,typlane,0.0 ); 00128 // then Rotate to the final p direction 00129 DPX.setv(Rx%S,Ry%S,Rz%S); 00130 pr->P.x+=DPX.x; 00131 pr->P.y+=DPX.y; 00132 pr->P.z+=DPX.z; 00133 pr->Vers= pr->P.NVerso(); // memorizzo la nuova direzione. 00134 pr->P.setvn(p*pr->Vers, pr->massa); //correzione (infinitesima!!) impulso al valore originario: la perdita è dopo. 00135 // Coordinate corrections 00136 // rotate to the initial P direction and add to 00137 // the initial coordinates 00138 S.setv(xplane,yplane,0.0); 00139 DPX.setv(Rx%S,Ry%S,Rz%S); // multiple scatter disturb.. 00140 pr->X+=DPX; 00141 00142 //debug 00143 if (Debugon==1) 00144 { 00145 Gout<<"\nSctr " 00146 <<setprecision(3)<<fixed 00147 <<setw(5)<<Eventi_Fatti<<" " 00148 <<setw(5)<< nome<<" " 00149 <<setw(4)<< pr->nome 00150 <<" t "<<setw(6)<<tratok 00151 <<" dx "<<setw(6)<<xplane 00152 <<" dy "<<setw(6)<<yplane; 00153 00154 } 00155 //------------------------------------------------- 00156 // D e g r a d o 00157 00158 // ======= Multiple Scattering energy loss ===== 00159 00160 int crepa=0; 00161 // do nothing if .... 00162 if (Perdita ==0) return 0; // no action 00163 if ( (Dedx=nowpos?Dedxbuc:Dedxint)==0) return 0; // no loss 00164 00165 double persa= Dedx*tratok; //in GeV 00166 00167 // double ee=pr->P.e; Te=ee-pr->massa; vedi più su 00168 if (persa>=Te) 00169 { 00170 persa=Te; 00171 pr->P.setvn(0.,0.,0.,pr->massa); 00172 crepa=-16; 00173 } 00174 else 00175 { 00176 ee-=persa; 00177 p=sqrt(ee*ee-pr->massa*pr->massa); 00178 pr->P.setvn( pr->Vers*p ,pr->massa); 00179 00180 00181 } 00182 Hits[nhit].e_rivela+=persa; // aggiorno l'energia rivelata 00183 00184 // pr->P.print("P2"); 00185 // pr->X.print("X2"); 00186 // Gout<<"\n\n "<<Eventi_Fatti<<" " <<pr->ido<<" " <<pr->P.e<<" persa " <<persa<<" ee "<<ee<<" p "<<p<<" cr " <<crepa<<"\n" ; 00187 return crepa; 00188 } 00189 00190 00191 00192 00193 double Device:: 00194 Msperdita (double tratto) 00195 { 00196 if ( (Dedx=nowpos?Dedxbuc:Dedxint)==0) return 0; // no loss 00197 // si suppone sempre perdita al minimo 00198 return Dedx*tratto; 00199 } 00200 00201