FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
00001 /*************************************************************************** 00002 greazio.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 // CP violatio //Ultima revisione 2-7-99 00014 #include "flyoh.h" 00015 00016 #define BEAM 0 00017 #define DECAY2 2 00018 #define DECAY3 3 00019 #define DECAY4 4 00020 #define DECAY5 5 00021 #define URTO2 8 00022 #define URTO3 9 00023 #define NOTDEFINED -999999. 00024 00025 int pattern; 00026 00027 using namespace std; 00028 //============================================================== 00029 // R E A Z I O N E Constructor 00030 //============================================================== 00035 Reazione::Reazione () 00036 00037 { 00038 00039 // Create a new Reaction with links. 00040 TotRea++; 00041 id = TotRea; 00042 if ( last_parz == 0 ) Reaction= this; 00043 else last_parz->next = this; 00044 up = last_parz; 00045 LastReaction=last_parz = this; 00046 this->next = 0; 00047 SelRea=this; 00048 // reset counters for special Reactions .... 00049 00050 00051 ss_done=-1; // for thre bodies decay ..partfase ss calculation... -1 == not done; 1 == ok 00052 Pair_done=Totpair=0; 00053 Gasint_Done=0; 00054 Dalitz_done=Totdltz=0; 00055 Tailsrt_done=Tailsrt=0; 00056 Tailong_done=Tailong=0; 00057 Brem_done=Totbrem=0; 00058 Pipev=Totpart=0; 00059 avo = Lastpart=0; 00060 header=""; 00061 rea_type=rea_pattern=0; 00062 // type =-1 beam, 0=decadimento (default) ,1=urto. che accade nelle cl derivate 00063 generati = veri = scrnt=trasmessi=ubeam=0; 00064 branch=prodrate=rate = prob = 0.0; 00065 Dnsudp=maxspettro=0.0; 00066 inc_pinc=vxb=vyb=vzb=inc_teta=0.0; 00067 slope=wpinc = 0.0; 00068 rtarg = dztarg = 0.0; 00069 rbers = dzbers = 0.0; 00070 ctau_avo_su_mass=0.0; 00071 00072 00073 if ( up!=0 ) 00074 { 00075 Ccoll=up->Ccoll; 00076 rcoll=up->rcoll; 00077 dzcoll=up->dzcoll; 00078 } 00079 00080 // controllo dello zero (bias) del sistema del lab. Tutti i rivelatori sono 00081 // spostati di conseguenza.. 00082 if ( Lab_Zero[0]==NOTDEFINED ) 00083 { 00084 Gout<<"\n \n *** System lab origin NOT defined.. forced to zero!!!"; 00085 Lab_Zero.setvn ( 0.,0.,0. ); 00086 } 00087 00088 00089 // legge le schede di definizione della reazione 00090 00091 Leggi_schede_rea(); 00092 00093 } 00094 //================= loop input cards === 00095 00096 // get the input Data-list from file 00097 void Reazione::Leggi_schede_rea() 00098 { 00099 char line[156]; 00100 string stringline,label; 00101 double a1,a2,a3,a4,a5,a6; 00102 00103 00104 Cardcur->getline ( line, 156 ); 00105 00106 while ( !Cardcur->eof() ) 00107 00108 { 00109 // Decodifico la linea 00110 stringline=line; 00111 stringstream scheda; 00112 scheda<<line; 00113 scheda>>label>>a1>>a2>>a3>>a4>>a5>>a6; 00114 00115 if ( Dbginput==1 ) 00116 { 00117 Gout<<"\n Reaction label: "<<label<<" Linea:"<<line<<std::endl; 00118 } 00119 00120 if ( label.size() <1 || 00121 label.find ( "**" ) ==0 || 00122 label.find ( "\\\\" ) ==0 || 00123 label.find ( "//" ) ==0 ) 00124 { 00125 Cardcur->getline ( line, 156 ); //line empty or comment ...read next line 00126 continue; 00127 } 00128 00129 // Decodifico la linea 00130 00131 if ( label.find ( "done" ) ==0||label.find ( "end" ) ==0 ) 00132 { 00133 type=id*100 + avo->Get_Idm(); 00134 if ( avo->Get_Massa() >0.0 ) ctau_avo_su_mass=avo->Get_Ctau() /avo->Get_Massa(); // reabeam... 00135 Gout<<"\n Done reazione <"<<id<<"> "<<header<<" Br.R."<<rate<<endl; 00136 return; 00137 } 00138 00139 if ( label.find ( "rate" ) ==0 ) branch=prodrate=rate = a1; 00140 else if ( label.find ( "slope" ) ==0 ) slope=a1; 00141 else if ( label.find ( "pinc" ) ==0||label.find ( "upinc" ) ==0 ) 00142 { 00143 // beam define by user as gaussian shape (p,wpinc) 00144 // P is the mean value, wpinc is the sigma. 00145 if ( label.find ( "upinc" ) ==0 ) ubeam=1; // set flag for user defined beam 00146 inc_pinc=400.; 00147 inc_teta=0.; 00148 Pinc.setvn ( a1,a2,a3 ); 00149 wpinc = a4; 00150 wpincq=wpinc*wpinc; 00151 if ( abs ( a5 ) >0.00001 ) inc_teta=a5; 00152 if ( a6>0.00001 ) inc_pinc=a6; 00153 Vinc_ppp.setvn ( sin ( inc_teta ), 0., cos ( inc_teta ) ); 00154 Pinc_ppp=Vinc_ppp*inc_pinc; 00155 } 00156 else if ( label.find ( "target" ) ==0 ) 00157 { 00158 Ctarg.setvn ( a1,a2,a3 ); 00159 Ctarg=Ctarg-Lab_Zero; 00160 Ctarg.Norma(); 00161 rtarg =a4; 00162 dztarg =a5; 00163 } 00164 else if ( label.find ( "coll" ) ==0 ) 00165 { 00166 Ccoll.setvn ( a1,a2,a3 ); 00167 Ccoll=Ccoll-Lab_Zero; 00168 Ccoll.Norma(); 00169 rcoll = a4; 00170 dzcoll = a5; 00171 } 00172 else if ( label.find ( "bersag" ) ==0 ) 00173 { 00174 Cbers.setvn ( a1,a2,a3 ); 00175 Cbers=Cbers-Lab_Zero; 00176 Cbers.Norma(); 00177 rbers = a4; 00178 dzbers= a5; 00179 } 00180 else if ( label.find ( "pbers" ) == 0 ) //particella inc da destra 00181 { 00182 Pbers.setvn ( a1,a2,a3 ); 00183 wpbers = a4; 00184 drbers = a5; 00185 } 00186 00187 00188 else if ( label.find ( "rea" ) == 0 ) 00189 { 00190 00191 header=stringline.substr ( label.size(),stringline.size() ); 00192 Gout<<"\n get header: "<< header; 00193 Makelist (); 00194 00195 Particella *pp, *pr=avo; 00196 // and Id setting 00197 while ( pr!=0 ) 00198 { 00199 pr->Set_Id(); 00200 pr=pr->next; 00201 } 00202 // define rea_patern only beam=0, n= n bodies decay 00203 if ( avo->dw!=0 ) 00204 { 00205 int nb=2; 00206 pp=avo->dw; 00207 if ( pp->Get_Type() ==Res ) nb++; 00208 if ( ( pp=avo->dw->rg ) !=0 && 00209 pp->Get_Type() ==Res ) nb++; 00210 if ( ( pp=avo->dw->lf ) !=0 && 00211 pp->Get_Type() ==Res ) nb++; 00212 rea_pattern=nb; 00213 } 00214 // compatibility test for four bodies decay 00215 if ( rea_pattern==4 ) 00216 { 00217 if ( avo->dw->Get_Nome() !=avo->dw->rg->Get_Nome() ) 00218 { 00219 Gout<<"\n Reaction list error:...<"<<avo->dw->Get_Nome() <<" "<<avo->dw->rg->Get_Nome(); 00220 Gout<<"\nIn four body decay the two res. must have the same names!"<<std::endl; 00221 exit ( 0 ); 00222 } 00223 } 00224 // save the particle describing the fix part of the reaction 00225 // for bremsstrhalung /Paiproduction or see...MkCluster.... 00226 avo->Save_Link(); 00227 LastpartSave=Lastpart; 00228 TotpartSave=Totpart; 00229 } 00230 00231 00232 else 00233 { 00234 Gout<<"\n Bad line: "<<line; 00235 exit ( 0 ); 00236 } 00237 00238 Cardcur->getline ( line, 156 ); 00239 } 00240 Gout<<"\n Warnign ... Reaction bad ending!!"<<std::endl; 00241 00242 } 00243 00244 00245 //===================================================================== 00246 // M a k e l i s t 00247 //==================================================================== 00251 void Reazione:: 00252 Makelist () 00253 { 00254 char line[156]; 00255 string label,a0,a1,a2,a3,a4,a5; 00256 00257 00258 00259 // possibili patterns di dati in input: 00260 // lb 0 1 2 3 4 5 indice di pattern 00261 // 0) pa solo beam 00262 // 2) pa = pb pc decadimento in due corpi 00263 // 3) pa = pb pc pd decadimento in tre corpi 00264 // 4) pa = pb pc pd pe decadimento in quattro corpi 00265 // 5) pa = pb pc pd pe pf decadimento in cinque corpi 00266 // 8) pa pb = pc pd urto in due corpi (solo nella prima linea) 00267 // 9) pa pb = pc pd pe urto in tre corpi (solo nella prima linea) 00268 00269 Cardcur->getline ( line, 156 ); // da rivedere....!!!!!!!!!! 00270 while ( !Cardcur->eof() ) 00271 { 00272 // Decodifico la linea 00273 00274 00275 a0=a1=a2=a3=a4=a5=""; 00276 stringstream scheda; 00277 scheda<<line; 00278 scheda>>label>>a0>>a1>>a2>>a3>>a4>>a5; 00279 00280 00281 00282 if ( Dbginput==1 ) Gout<<"\n\n Mklist reads: "<<line; 00283 00284 if ( label.size() ==0 || 00285 label.find ( "**" ) ==0 || 00286 label.find ( "\\\\" ) ==0 || 00287 label.find ( "//" ) ==0 ) 00288 { 00289 Cardcur->getline ( line, 156 ); //line empty or comment ...read next line 00290 continue; 00291 } 00292 00293 if ( ( a0.size() !=0 &&a1.size() !=0) && ( a0!= "="&& a1 != "=" ) ) 00294 00295 00296 { // check the = position.... 00297 cout<<"\n Input card error ...: "<<line<<" ......exit"; 00298 Gout<<"\n Input card error ...: "<<line<<" ......exit " 00299 << a0<< " "<<a0.size() << " " << a1<< " "<<a1.size() << " " << a2<< " "<<a2.size(); 00300 exit ( 0 ); 00301 } 00302 00303 if ( label.find ( "fine" ) ==0 || 00304 label.find ( "end" ) ==0 || 00305 label.find ( "done" ) ==0 ) 00306 { 00307 if ( Dbginput==1 ) Gout<<"\n "<<label; 00308 return; 00309 } 00310 00311 // extract particles 00312 const char *p0=0,*p1=0,*p2=0,*p3=0,*p4=0,*p5=0; 00313 00314 // beam particle 00315 p0= Matter->Ptbsdat ( label.c_str() ); 00316 if ( p0==0 ) 00317 { 00318 cout<<"\n Reaction card error ...: "<<line<<" ......exit"; 00319 Gout<<"\n Reaction card error ...: "<<line<<" ......exit"; 00320 exit ( 0 ); 00321 } 00322 00323 pattern=-1; 00324 // è solo un beam 00325 if ( a0.size() ==0 ) pattern = BEAM; 00326 00327 else if ( a0 == "=" ) // è un decadimento 00328 { 00329 p1 = Matter->Ptbsdat ( a1.c_str() ); 00330 p2 = Matter->Ptbsdat ( a2.c_str() ); 00331 p3 = Matter->Ptbsdat ( a3.c_str() ); 00332 p4 = Matter->Ptbsdat ( a4.c_str() ); 00333 p5 = Matter->Ptbsdat ( a5.c_str() ); 00334 if ( p1!=0 && p2!=0 ) pattern = DECAY2; 00335 if ( p1!=0 && p2!=0 && p3 !=0 ) pattern = DECAY3; 00336 if ( p1!=0 && p2!=0 && p3 !=0 && p4!=0 ) pattern = DECAY4; 00337 if ( p1!=0 && p2!=0 && p3 !=0 && p4!=0 && p5!=0 ) pattern = DECAY5; 00338 00339 00340 // Gout<<"\n "<<a0<<" "<<a1<<" "<<a2<<" "<<a3<<" "<<a4<<" "<<a5<<" "<<a5<<pattern<<endl; 00341 } 00342 00343 else if ( a1 == "=" ) // è un urto 00344 { 00345 p1 = Matter->Ptbsdat ( a0.c_str() ); 00346 p2 = Matter->Ptbsdat ( a2.c_str() ); 00347 p3 = Matter->Ptbsdat ( a3.c_str() ); 00348 p4 = Matter->Ptbsdat ( a4.c_str() ); 00349 if ( p1!=0 && p2!=0 && p3 !=0 ) pattern = URTO2; 00350 if ( p1!=0 && p2!=0 && p3 !=0 && p4!=0 ) pattern = URTO3; 00351 00352 } 00353 00354 if ( Dbginput==1 ) Gout<<"\n Pattern found = "<<pattern; 00355 Gout.flush(); 00356 00357 if ( pattern == -1 ) 00358 { 00359 Gout << "\n MakeLista: Pattern errore 2 ... exit"; 00360 exit ( 0 ); 00361 } 00362 00363 if ( ( pattern == 0 ) && avo != 0 ) 00364 { 00365 Gout << "\n MakeLista: avo errore 0,4,5... exit"; 00366 exit ( 0 ); 00367 } 00368 // definisco l'avo della lista se non gia' fatto. 00369 // altrimenti definisco il pontatore padre della decadimento... 00370 Particella *padre, *madre, *ccms; 00371 00372 if ( avo == 0 ) 00373 { 00374 if ( pattern==URTO2||pattern==URTO3 ) 00375 { 00376 rea_type=1; //urto 00377 avo = padre = NuovaBullet ( p0 ); //Type == Bullet 00378 } 00379 else //decay o beam 00380 { 00381 rea_type=0; 00382 avo = padre = NuovaPart ( p0 ); 00383 avo->Set_Type ( Beam ); // è la prima particella della lista... è il fascio. 00384 } 00385 00386 if ( pattern==BEAM ) 00387 { 00388 rea_type=-1; 00389 Cardcur->getline ( line, 156 ); 00390 continue; 00391 } 00392 } 00393 else padre = avo->Ptr_Particle ( p0 ); 00394 if ( padre == 0 ) 00395 { 00396 Gout << "\n MakeLista: Wrong name or chaining error < "<<p0<<" > ....exit. "<<endl; 00397 exit ( 0 ); 00398 } 00399 00400 //====================================== 00401 //====================================== 00402 if ( pattern == BEAM ); 00403 00404 else if ( pattern == DECAY2 ) padre->Decay_in_2 ( p1, p2 ); 00405 else if ( pattern == DECAY3 ) padre->Decay_in_3 ( p1,p2,p3 ); 00406 else if ( pattern == DECAY4 ) padre->Decay_in_4 ( p1,p2,p3,p4 ); 00407 else if ( pattern == DECAY5 ) padre->Decay_in_5 ( p1,p2,p3,p4,p5 ); 00408 00409 00410 00411 //************************************************************************** 00412 // Sezione urti da rivedere 00413 else if ( pattern == URTO2 ) // two bodies final status // da controllare....!!!!! 00414 { 00415 madre = NuovaPart ( p1 ); 00416 madre->Set_Type ( Bers ); 00417 padre->Aggiorna_link_Bullet ( madre ); 00418 // attenzione Cms deve essere definita meglio.... Anzi va ridefinita ad ogni interazione... 00419 ccms = NuovaPart ( Cms ); 00420 ccms->Set_Type ( Bari ); 00421 if ( Dbginput==1 ) Gout<<"\n Define dummy Res: "<<Cms; 00422 padre->Aggiorna_link ( 0, madre, 0, 0 ); 00423 madre->Aggiorna_link ( 0, 0,ccms, padre ); 00424 ccms->Decay_in_2 ( p2, p3 ); 00425 } 00426 else if ( pattern == URTO3 ) // three bodies final status 00427 00428 { 00429 madre = NuovaPart ( p1 ); 00430 madre->Set_Type ( Bers ); 00431 padre->Aggiorna_link_Bullet ( madre ); 00432 ccms = NuovaPart ( Cms ); 00433 ccms->Set_Type ( Bari ); 00434 if ( Dbginput==1 ) Gout<<"\n Define dummy Res: "<<Cms; 00435 padre->Aggiorna_link ( 0, madre, 0, 0 ); 00436 madre->Aggiorna_link ( 0, 0,ccms, padre ); 00437 ccms->Decay_in_3 ( p2,p3,p4 ); 00438 } 00439 00440 Cardcur->getline ( line, 156 ); 00441 } 00442 } 00443 00444 00445 // N u o v a p a r t 00446 Particella *Reazione::NuovaPart ( const char *pnome ) 00447 { 00448 00449 Partname=pnome; 00450 Particella *punta=0; 00451 00452 if ( pnome==Res ) punta = new PartFase(); // due corpi solo spazio fasi 00453 else if ( pnome==Res2 ) punta = new PartFase(); // per tre corpi solo spazio fasi 00454 else if ( pnome==Res3 ) punta = new Partres4; // per il decadimento a 4 00455 else if ( pnome==Res4 ) punta = new Partres5; // per il decadimento a 5 corpi secondo lo spazio delle fasi... 00456 else if ( pnome==Pic2 ) punta = new Part3pic ( slope ); // decadimento K in 3 pic 00457 else if ( pnome==Pi02 ) punta = new Part3pi0 ( slope ); // dec in tre pi0 00458 else if ( pnome==P00p ) punta = new Partp00p; //decadimento in pi0 pi0 pic 00459 else if ( pnome==Pvv ) punta = new PartPvv; //Risonanza nu nu per decadimento Kl->pi0 nu nu 00460 else if ( pnome==Dlz ) punta = new PartDltz; // dalitz 00461 else if ( pnome==Munu ) punta = new PartMunu; // munu in K3l 00462 else if ( Abilita_Brems>0 && 00463 ( pnome==Mum || pnome==Mup|| 00464 pnome==Elec|| pnome==Elep ) ) punta = new PartLepton(); // tiene conto del bremsstrhalung 00465 else if ( Abilita_Pair>0 && pnome==Gam ) punta = new PartGam(); //with pair production.. 00466 00467 else punta= new Particella(); 00468 00469 if ( Dbginput==1 ) Gout<<"\n Creato " << pnome; 00470 00471 00472 return punta; 00473 00474 00475 } 00476 Particella *Reazione::NuovaBullet ( const char *pnome ) 00477 { 00478 Partname=pnome; 00479 Particella *punta=0; 00480 punta= new PartBullet(); 00481 if ( Dbginput==1 ) Gout<<"\n Creato bullet " << pnome; 00482 return punta; 00483 } 00484 00485 00486 00487 //=============================================== 00491 void Reazione:: AddGen() 00492 { 00493 generati++; 00494 // remember the last event type... 00495 evento_.Gen.lastype=evento_.Gen.type; 00496 evento_.Gen.type =type; 00497 } 00498 00499 //=============================================================== 00500 // S t a m p a _ r e a z i o n i 00501 //=============================================================== 00505 void Reazione:: 00506 Stampa () 00507 { 00508 // using namespace std; 00509 Reazione *pts; 00510 pts = Reaction; 00511 while ( pts != 0 ) 00512 { 00513 Gout<<"\n\n[Stampa_reazioni] \n Reaction n. "<< setw ( 5 ) <<pts->id<<" [ "<<pts->header<<" ]"; 00514 Gout<<"\n Reaction pattern type: "<<pts->rea_pattern; 00515 Gout<<"\n Interaction parameter (slope): "<<pts->slope; 00516 Gout<<"\n Tipo di reazione: "<< pts->rea_type 00517 <<"\n Beam: "<< ( pts->ubeam?"Gaussian profile by user":"Standard" ); 00518 Gout<<"\n Tot.rate = " 00519 <<setprecision ( 4 ) <<fixed 00520 <<setw ( 8 ) << pts->rate; 00521 Gout<<"\n Prod target " 00522 <<setprecision ( 2 ) <<fixed 00523 <<setw ( 8 ) <<pts->Ctarg[0]<<" " 00524 <<setw ( 8 ) <<pts->Ctarg[1]<<" " 00525 <<setw ( 8 ) <<pts->Ctarg[2]<<" r=" 00526 <<setw ( 8 ) << pts->rtarg<<" dz=" 00527 <<setw ( 8 ) << pts->dztarg; 00528 00529 pts->avo->Stampa_particle ( this ); 00530 pts = pts->next; 00531 } 00532 00533 Gout<<endl; 00534 } 00535 //================================================================= 00536 void Reazione:: 00537 PrintPinc () 00538 { 00539 Gout<<" P =(" 00540 <<setprecision ( 3 ) <<fixed 00541 <<setw ( 8 ) <<Pinc[0]<<" " 00542 <<setw ( 8 ) <<Pinc[1]<<" " 00543 <<setw ( 8 ) <<Pinc[2]<<") dp=" 00544 <<setw ( 8 ) <<wpinc<<endl; 00545 Gout.setf ( ios::floatfield ); 00546 } 00547 00548 void Reazione:: 00549 PrintPbers () 00550 { 00551 Gout<<" P =(" 00552 <<setprecision ( 3 ) <<fixed 00553 <<setw ( 8 ) <<Pbers[0]<<" " 00554 <<setw ( 8 ) <<Pbers[1]<<" " 00555 <<setw ( 8 ) <<Pbers[2]<<") dp=" 00556 <<setw ( 8 ) <<wpbers<<" drad=" 00557 <<setw ( 8 ) <<drbers<<endl; 00558 Gout.setf ( ios::floatfield ); 00559 } 00560 //=============================================================== 00561 // F i n e _ r u n 00562 //=============================================================== 00567 void Reazione:: 00568 Fine_run () 00569 { 00570 int gen=0,totnt=0,Vtot=0,VTtot=0,Tpair=0,Tlsrt=0,Tlong=0, Totpipev=0 ; 00571 int tgasdone=0; 00572 int Tdlz=0,Tbrem=0; 00573 Reazione *pts; 00574 // calcolo dei protoni equivalenti su targhetta. 00575 // vedi nota 01/GmP Pisa 19.6.99 00576 double totime=TBurst->Get_TTempo(); 00577 Gout<<"\n\n ---------- F i n e _ R u n "<<evento_.Gen.Run<<" -----------\n"; 00578 Gout.setf ( ios::floatfield , ios::scientific ); 00579 Gout<<setprecision ( 5 ) 00580 <<"\n\nTot PPP "<<Protoni<<" in "<< totime <<" ns"<<endl; 00581 00582 00583 00584 Gout.setf ( ios::left, ios::adjustfield ); 00585 pts = Reaction; 00586 Gout<<"\nBeam type Id Gen Gas Dlz Pair Brem Hsr Hlg Piped Writ Titolo"; 00587 00588 while ( pts != 0 ) 00589 { 00590 Gout<<"\n <" 00591 <<setw ( 4 ) <<pts->avo->Get_Nome() <<" " 00592 <<setw ( 4 ) <<pts->type<<" " 00593 <<setw ( 3 ) <<pts->id<<"> " 00594 <<setw ( 8 ) <<pts->generati<<" " 00595 <<setw ( 8 ) <<pts->Gasint_Done<<" " 00596 <<setw ( 5 ) <<pts->Totdltz<<" " 00597 <<setw ( 5 ) <<pts->Totpair<<" " 00598 <<setw ( 5 ) <<pts->Totbrem<<" " 00599 <<setw ( 5 ) <<pts->Tailsrt<<" " 00600 <<setw ( 5 ) <<pts->Tailong<<" " 00601 <<setw ( 7 ) <<pts->Pipev<<" " 00602 <<setw ( 7 ) <<pts->scrnt<<" " 00603 <<setw ( 25 ) <<pts->header; 00604 00605 gen+= pts->generati; 00606 tgasdone+=pts->Gasint_Done; 00607 totnt+= pts->scrnt; 00608 Vtot+= pts->veri; 00609 VTtot+= pts->trasmessi; 00610 Tlsrt+= pts->Tailsrt; 00611 Tlong+= pts->Tailong; 00612 Tpair+= pts->Totpair; 00613 Tdlz+= pts->Totdltz; 00614 Tbrem+= pts->Totbrem; 00615 Totpipev+= pts->Pipev; 00616 pts = pts->next; 00617 } 00618 00619 Gout<<"\n T o t a l i : " 00620 <<setw ( 8 ) <<gen<<" " 00621 <<setw ( 8 ) <<tgasdone<<" " 00622 <<setw ( 5 ) <<Tdlz<<" " 00623 <<setw ( 5 ) <<Tpair<<" " 00624 <<setw ( 5 ) <<Tbrem<<" " 00625 <<setw ( 5 ) <<Tlsrt<<" " 00626 <<setw ( 5 ) <<Tlong<<" " 00627 <<setw ( 7 ) <<Totpipev<<" " 00628 <<setw ( 7 ) <<totnt<<" " 00629 <<" All Reactions"; 00630 Gout<<"\n\nTau per ppp produced "<<totime/Protoni<<" Tau per evento written "<< totime/totnt <<endl; 00631 Gout<<"\n\nLast event ="<<setw ( 8 ) <<evento_.Gen.Event<<" Normal end run....."<<std::endl; 00632 return; 00633 } 00634 00635 //=============================================================== 00636 // S e l e c t _ r e a t i o n 00637 //=============================================================== 00638 // Select a Reaction according to the rate. 00642 Reazione *Reazione:: 00643 Select_reation () 00644 { 00645 Reazione *pts; 00646 double prb = Pran(); 00647 00648 pts = Reaction; 00649 while ( pts != 0 ) 00650 { 00651 if ( prb <= pts->prob ) 00652 { 00653 return ( pts ); 00654 } 00655 pts = pts->next; 00656 } 00657 00658 return ( pts ); 00659 } 00660 //========================================================================== 00661 // N o r m a _ R a t e 00662 //=============================================================== 00663 // Normalizza i rate di decadimento. 00667 void Reazione:: 00668 Norma_Rate() 00669 { 00670 Reazione *pts; 00671 00672 double tprob=0.0,sigmat=0.0; 00673 Gout<<"\n\n Rates normalization...."; 00674 pts = Reaction; 00675 while ( pts != 0 ) 00676 { 00677 sigmat+=pts->prodrate; 00678 pts = pts->next; 00679 } 00680 pts=Reaction; 00681 00682 // rinormnalizzazione della sezione d'urto totale..... 00683 // sigmat*=10.; 00684 00685 while ( pts != 0 ) 00686 { 00687 00688 // calcolo del rate di produzione normalizzato 00689 pts->rate=pts->prodrate/sigmat; 00690 tprob+=pts->rate; 00691 pts->prob=tprob; // probabilita' integrale... per la generazione. 00692 00693 00694 00695 00696 00697 Gout.setf ( ios::floatfield , ios::scientific ); 00698 00699 Gout<<"\n Rea: " 00700 <<setprecision ( 3 ) <<setw ( 2 ) <<pts->id 00701 <<" Ev/PPP " <<setw ( 11 ) <<pts->prodrate 00702 <<" Normalizzato "<<setw ( 8 ) <<pts->rate 00703 <<" Integrale " <<setw ( 8 ) <<pts->prob 00704 <<" " <<setw ( 8 ) <<pts->header; 00705 pts = pts->next; 00706 00707 } 00708 // fattore di normalizzazione della sezione d'urto..... 00709 double Aggiusta_Protoni=0.05; 00710 Protoni=Aggiusta_Protoni*evento_.Mxev/sigmat; 00711 double tgen=TBurst->Get_Tburst() * ( Protoni/ppp ); 00712 double tmedio=tgen/evento_.Mxev; 00713 Gout<<"\n\n For all reactions: " 00714 <<setprecision ( 5 ) <<setw ( 2 ) 00715 <<" Ev/PPP " <<setw ( 11 ) <<sigmat 00716 <<"\n Needed Protons "<<setw ( 8 ) <<Protoni 00717 <<" for "<<setw ( 8 ) <<evento_.Mxev<<" Events " 00718 <<"\n Production time "<<setw ( 6 ) << tgen<<" ns with Tau " 00719 <<setw ( 6 ) << tmedio<<" ns between two events. " 00720 <<setw ( 6 ) << 1000000./tmedio<<" kfreq Eventi secondo\n-----------------------"; 00721 00722 //separazione temporale in ns tra due protoni no sterili..... 00723 00724 TBurst->Set_Tmed ( tmedio ); 00725 00726 } 00727 //================================================================ 00728 // R e s e t _ R e a z i o n e 00729 //================================================================= 00733 void Reazione:: 00734 Reset_Rea() 00735 { 00736 00737 Particella *pr= LastpartSave->next,*questa=0; 00738 Lastpart->next=0; 00739 Lastpart= LastpartSave; 00740 00741 LastpartSave->next=0; 00742 Totpart=TotpartSave; 00743 avo->Restore_Link(); 00744 avo->Reset_Stato(); 00745 00746 // free the memory.... or destroy the partucle.... 00747 while ( pr!=0 ) 00748 { 00749 questa=pr; 00750 pr=pr->next; 00751 delete questa; // here delete the particle 00752 } 00753 00754 ss_done=-1; //ss calculation in partfase for three bodies... 00755 Pair_done=0; 00756 Brem_done=0; 00757 Dalitz_done=0; 00758 Tailsrt_done=0; 00759 Tailong_done=0; 00760 mbrem=mdltz=mspair=eeb=eleb=edltz1=edltz2=0.0; 00761 GasIdo=0; 00762 } 00763 //--------------------------------------------------------------*/ 00764 // Particle simple list */ 00765 //--------------------------------------------------------------*/ 00766 00770 void Reazione:: 00771 Simple_List() 00772 { 00773 // itaration method ...do not use this procedura in the loop.... 00774 Particella *loopx; 00775 00776 00777 Gout<<"\n \nEV "<<Eventi_Fatti<<" Reaction particle list: "<< header; 00778 loopx = avo; 00779 Gout 00780 <<"\n n id idm nome type ch mas width t_life < G.Z Gp > < Dead at: X > path fato Ifato"; 00781 00782 while ( loopx != 0 ) 00783 { 00784 Gout<<"\n" 00785 <<setprecision ( 2 ) <<fixed 00786 <<setw ( 8 ) << loopx->Get_Ido() <<" " 00787 <<setw ( 8 ) << loopx->Get_Id() <<" " 00788 <<setw ( 3 ) << loopx->Get_Idm() <<" " 00789 <<setw ( 6 ) << loopx->Get_Nome() <<" " 00790 <<setw ( 6 ) << loopx->Get_Type() <<" " 00791 <<setw ( 6 ) << loopx->Get_Charg() <<" " 00792 <<setw ( 8 ) << loopx->Get_Massa() <<" " 00793 <<setw ( 8 ) << loopx->Get_Width() <<" " 00794 <<setw ( 8 ) << loopx->Get_Ctau() <<" " 00795 <<setw ( 9 ) << loopx->Get_Gx().z <<" " 00796 <<setw ( 9 ) << loopx->Get_Gp().norma<<" " 00797 <<setw ( 9 ) << loopx->X.x <<" " 00798 <<setw ( 9 ) << loopx->X.y <<" " 00799 <<setw ( 9 ) << loopx->X.z <<" " 00800 <<setw ( 9 ) << loopx->path_done<<" " 00801 <<setw ( 8 ) << loopx->Get_Fato() <<" " 00802 <<setw ( 6 ) << loopx->Get_Ifato(); 00803 loopx = loopx->next; 00804 } 00805 Gout<<endl; 00806 if ( next!=0 ) next->Simple_List(); //iterate... attention 00807 } 00808 00809