FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_par/partfase.cpp

00001 /***************************************************************************
00002                           partfase.cpp  -  description
00003                              -------------------
00004     begin                : Mon Dec 25 2000
00005     copyright            : (C) 2000 by Giuseppe M Pierazzini
00006     email                : pierazzini@unipi.it
00007  ***************************************************************************/
00008 
00009 #define ESTERNO  1
00010 #define INTERNO  0
00011 #define INBUCO   -1
00012 
00013 #define EPSR     1.0E-200
00014 #include "flyoh.h"
00015 #include "flyoana.h"
00016 #include "fase3max.h"
00017 using namespace GmpConst;
00018 
00019 //using namespace std;
00020 
00021 
00022 //-------------------------------------------------
00023 
00024 //--------------------------------------------------------------
00025 //             F s p a c e
00026 //--------------------------------------------------------------
00027 //  Fspace    routine
00028 
00029 double
00030 Fspace ( double res, double rm1, double rm2 )
00031 {
00032   double dm,sm;
00033   sm = ( rm1 + rm2 ) ;
00034   if ( sm==0.0 )  return 1.0;
00035   if ( sm>res )   return 0.0;
00036   sm/=res;
00037   dm = ( rm1 - rm2 ) /res ;
00038   return  sqrt ( ( 1.0 - dm * dm ) * ( 1.0 - sm*sm ) );
00039 }
00040 //-----------------------------------------------------
00041 //-----------------------------------------------------
00042 PartFase::PartFase()
00043 {
00044   type=Res;
00045   this->res_next =0;
00046   mpadre=0.;
00047   p1=p2=p3=p4=p5=0;
00048 
00049   if ( evento_.Gen.Event< 1 ) Gout<<"\n Classe PartFase  : "<<nome<<" done!"<<flush;
00050 
00051 }
00052 
00053 //--------------------------------------------------------------*/
00054 //                  D e c P a r m                               */
00055 //--------------------------------------------------------------*/
00056 // Get the resonance mass   and decay angles                     Get_mass       */
00057 //
00058 
00059 void PartFase::
00060 DecParm()
00061 {
00064 // K -> mfrate mres
00065 //                 ->   mchd1 mchd2
00066 // solo spazio fasi.....
00067 
00068   if ( p1==0 )  // inizialization... only first time
00069     {
00070       Get_PhaseParm();   // initialize links and phase parms
00071       Get_MatrixParm();  // Matrix parms if needed
00072 
00073     }
00074 // -------------------------------
00075 
00076 // qui sempre...
00077 // get the fase_space point: e0,e1,e2,mres,mresq,cst
00078   int itermtr=0;
00079   while ( itermtr++<200 )
00080     {
00081 // nota: normalmente in Get_PhaseSpace ci sono 1...6 iterazioni!
00082       Get_PhaseSpace(); //  Attenzione!  qui ora hai dipsonibili e0,e1,e2, mres,mresq,cst
00083 //   if the matrix prob is ok break to iter !!
00084       if ( Get_MatrixValue() ) break;  // get matrix value if needed ... here does nothing.
00085     }
00086   if ( itermtr>100 )
00087     Gout<<"\n Ev "<< evento_.Gen.Event
00088     <<"  Matrix warning: too many iters... chek!  "<<itermtr<<"  "<< SelRea->Get_Titolo();
00089 
00090 
00091 //-----------------------------------------------------
00092 
00093 // define the mass and the quadrimomentum (qvet) of the decay particle.(mres)...
00094   Set_Massa ( mres );
00095   P.Riposo ( mres );  //Definizione di P a riposo nel cm di mres
00096 
00097 // calcolo la direzione di decadimento dei figli.
00098 // uso i puntatori definiti in Get_PhaseParm() per non sbagliare le particelle...
00099   fi = DuePiGreco * Pran();
00100   p2->cstar=cst;
00101   p2->fistar=fi;
00102   p3->cstar=-cst;
00103   p3->fistar=fi+PiGreco;
00104 
00105 }
00106 
00107 // ---------------------------------
00108 
00109 void  PartFase::Get_PhaseSpace()
00110 {
00111   iterfs=0;
00112 
00113 // attenzione nel caso di un urto con produzione di tre corpi, per esempio
00114 // cms -> Kl res2 ; con res2 ->pip pip
00115 // la massa del centro di massa può variare (anche se di poco.. dipende dallo spettro del beam)
00116 // quindi il limte superiore della risonanza   res2 va ricalcolata!
00117 // attenzione  wfase_max, calcolato inizialmente per un valore  della massa invariante di cms,viene via via aggiornato.....
00118 
00119   if ( up->Get_Nome() ==Cms ) //C'è stato un urto!
00120     {
00121       mpadre=up->Get_Massa();
00122       mmax=mpadre-mfrate;
00123       mmaxq =mmax*mmax;
00124       dmq =mmaxq-mminq;
00125     }
00126 //---
00127 
00128   while ( iterfs++<155 )
00129     {
00130       // resonance mass selection...
00131       mres=sqrt ( ( mresq =mminq+Pran() *dmq ) );
00132       if ( mres+mfrate>mpadre )  continue;
00133       w= Fspace ( mres, mchd2, mchd3 ) * Fspace ( mpadre, mfrate, mres );
00134       if ( w >wfase_max )
00135         {
00136           Gout<<setprecision ( 5 ) <<"\nEv "<<evento_.Gen.Event<<" iter="<<iterfs<<" W-Ph.Sp. off: prb="<<w
00137           <<" prbmax="<<wfase_max<<" "<<SelRea->Get_Titolo();
00138           wfase_max=w+0.000001;
00139           // aggiorna  wfase_max memorizzato nella lista
00140           int p_id[6]= {up->Get_Idm(),p1->Get_Idm(),p2->Get_Idm(),p3->Get_Idm(), 0,0};
00141           Fasemx->Set_Wmax ( p_id, wfase_max );
00142         }
00143       if ( Pran() <w/wfase_max ) break;
00144     }
00145   if ( iterfs>150 ) Gout<<"\nPh.Sp. warning: Too many iters...="<<iterfs<<" Res2  "<<mres;
00146 // byproduct  mresq,mres,eres,e0,e1,e2,cstù
00147 // Attenzione: remapping 1,2,3 == 0,1,2 ATTENZIONE...
00148 
00149   e0=0.5* ( mpadreq+mfrateq-mresq ) /mpadre;
00150   cst= 1.0 -  2.0 * Pran();
00151   eres=mpadre-e0;
00152   gam = eres/mres;
00153   eta=sqrt ( e0*e0-mfrateq ) /mres;
00154   estar1 =0.5* ( mresq+mchd2q-mchd3q ) /mres;
00155   pstar1=sqrt ( estar1*estar1-mchd2q );
00156   e1 = gam*estar1 + eta*pstar1*cst;
00157   e2=eres-e1;
00158 
00159 // memorizzo i valori cinematici per decadimenti a tre corpi
00160 // se la particella padre è il beam
00161 
00162   if ( up==SelRea->avo )   Svalues();
00163 
00164 
00165 }
00166 //---------------------------------------------------
00167 
00168 void PartFase::Get_PhaseParm()
00169 {
00170   /*-------------------------------------------
00171    Three bodies decay  k -> a b c   in phase space..
00172    the decay is  via the Res2 resonance
00173    generated in the decay chain automatilly...see Make_list
00174   -----
00175    the chain is K->a Res2
00176                       ->b c
00177 
00178   -----
00179    Phase space weight
00180    w = F(padre,Res2,a)*F(Res2,b,c)
00181   ------------
00182   Note: imput pattern like  K = a b c
00183   gives the following pointer matching
00184    p1->a, p2->b, p3->c
00185    note this corrisonde a Res2
00186 
00187    if you change the pattern the chain changes automatically...
00188 
00189    -------- here
00190    -define the pointers to the  particles;
00191    -the decay parameters
00192    -the wfase_max
00193   --------------------------------------------------*/
00194 
00195   if ( p1!=0 ) return;
00196   if ( rg !=0 ) p1=rg;
00197   else p1=lf;   //Gout<<"\n PartFase: "<<p1->Get_Nome()<<endl;
00198   p2=dw;        //Gout<<"\n PartFase: "<<p2->Get_Nome()<<endl;
00199   p3=dw->rg;    //Gout<<"\n PartFase: "<<p3->Get_Nome()<<endl;
00200 
00201 //resonances... generate come particelle
00202 //     pr1=this;
00203 // particle parameters
00204   mpadre=up->Get_Massa();
00205   mpadreq=mpadre*mpadre;
00206   mfrate=p1->Get_Massa();
00207   mfrateq=mfrate*mfrate;
00208   mchd1=mfrate;
00209   mchd2 =p2->Get_Massa();
00210   mchd2q=mchd2*mchd2;
00211   mchd3 =p3->Get_Massa();
00212   mchd3q=mchd3*mchd3;
00213 
00214 // massimi e minimi valori della risonanza
00215   mmin     =mchd2+mchd3;
00216   mminq =mmin*mmin;
00217   mmax=mpadre-mfrate;
00218   mmaxq =mmax*mmax;
00219   dmq =mmaxq-mminq;
00220 
00221 // controlla se wfase_max è già stato calcolato
00222   int p_id[6]= {up->Get_Idm(),p1->Get_Idm(),p2->Get_Idm(),p3->Get_Idm(), 0,0};
00223 
00224   if ( Fasemx!=0 )
00225     {
00226       double  wmx=Fasemx->Get_Wmax ( p_id );
00227       if ( wmx>0. )
00228         {
00229           wfase_max=wmx;
00230 //      Gout<<"\n Ev "<<Eventi_Fatti<<" F.S. trovato "<<up->Get_Nome() <<" "<<nome<<"=> "<<p1->Get_Nome()
00231 //      <<" "<<p2->Get_Nome() <<" "<<p3->Get_Nome();
00232           return;
00233         }
00234     }
00235   double pass1=dmq/500.;
00236 //     double w1;
00237   // define the wfase_max for p.s.  normalizazion
00238   wfase_max=0.0;
00239   for ( mresq=mminq; mresq<mmaxq; mresq+=pass1 )
00240     {
00241       mres=sqrt ( mresq );
00242       w=Fspace ( mpadre,mres,mfrate ) *Fspace ( mres,mchd2,mchd3 );
00243       if ( w>wfase_max ) wfase_max=w;
00244     }
00245 
00246 //  Gout<<"\n Ev "<<Eventi_Fatti<<" ***** Ph.S3: "<<setprecision ( 3 ) <<up->Get_Nome() <<" ["<< nome <<"]->  "
00247 //  <<p1->Get_Nome() <<" "<<p2->Get_Nome() <<" "<<p3->Get_Nome() <<" "<<setw ( 8 ) <<wfase_max;
00248   Gout<<"\n Phase-Space:w="<<wfase_max<<" done for " <<up->Get_Nome() <<" ==> "<<p1->Get_Nome() <<" "<<p2->Get_Nome()
00249   <<"  "<<p3->Get_Nome() <<"  Masse range: "<<sqrt ( mminq ) <<" " <<sqrt ( mmaxq );
00250 
00251   new Fase3Max ( p_id,wfase_max );
00252 
00253 }
00254 
00255 
00256 //----------------------------------------------------
00257 //----------- Svalues -----
00258 int PartFase:: Svalues()
00259 {
00260 
00261   // solo nel caso del decadimento a tre corpi...
00262 // get the sister pointers
00263   Pt=0.0;
00264   if ( p1!=0 && p1->Get_Nata() !=0 )
00265     {
00266       // calcolo il Ptq della particella p1
00267       //(spesso quella di carica opposta.. attenzione nella posizione in epc)
00268       gvet Vk=SelRea->avo->Get_Gp().Verso();
00269       P1=p1->Get_Gp();
00270       P1.Norma();
00271       double pro=P1%Vk;
00272       Pt=sqrt ( P1.normaq-pro*pro );
00273     }
00274 // Attenzione: remapping 1,2,3 == 0,1,2 ATTENZIONE...
00275 // e0,e1,e2=e0 , s0=msq12,s1=msq20,s2=msq01
00276 // and ... save data in reaction class
00277   s0=SelRea->ss0=mresq;  //==mpadreq+mchd1q-2.*mpadre*e0;
00278   s1=SelRea->ss1=mpadreq+mchd2q-2.*mpadre*e1;
00279   s2=SelRea->ss2=mpadreq+mchd3q-2.*mpadre*e2;
00280   SelRea->ss_done=1;
00281 // definizione di u,v generati nella struttura evento
00282 //per futura memoria in case of Pipeline on
00283 
00284   evento_.Gen.gss0=s0;
00285   evento_.Gen.gss1=s1;
00286   evento_.Gen.gss2=s2;
00287 
00288   evento_.Gen.gvss0=fabs ( s1-s2 ) *0.577350269;//1./sqrt(3.)
00289   evento_.Gen.gvss1=fabs ( s2-s0 ) *0.577350269;
00290   evento_.Gen.gvss2=fabs ( s0-s1 ) *0.577350269;
00291 
00292   // randomizzazione degli u,v   ========
00293   int Irand=int ( 3*Pran() ) %3;
00294   evento_.Gen.Irand_ss=Irand;
00295 
00296   if ( Irand==0 )
00297     {
00298       evento_.Gen.gss_sort=s0;
00299       evento_.Gen.gvss_sort= evento_.Gen.gvss0;
00300     }
00301   else if ( Irand==1 )
00302     {
00303       evento_.Gen.gss_sort=s1;
00304       evento_.Gen.gvss_sort=evento_.Gen.gvss1;
00305     }
00306   else if ( Irand==2 )
00307     {
00308       evento_.Gen.gss_sort=s2;
00309       evento_.Gen.gvss_sort=evento_.Gen.gvss2;
00310     }
00311 
00312   Scrivi_Dati ( 3 );
00313   return 1;
00314 }
00315 
00316 
00317 
 All Classes Namespaces Files Functions Variables