FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_ana/anakpip0ee.cpp

00001 /***************************************************************************
00002                           anak2pi.cpp  -  description
00003    GMP 27-11-2010
00004   
00005   ***************************************************************************/
00006   // #define MIN(x,y,z) ((x)<(y)?(x)<(z)?(x):(z):(y)<(z)?(y):(z))
00007   
00008 #include "flyoh.h"
00009 #include "anakpip0ee.h"
00010 using namespace std;
00011 
00012 //-------------------------------------------------------------
00013 //-------------------------------------------------------------
00014 
00015  AnaKpip0ee::AnaKpip0ee()
00016    {tipo=31;nfit=2;titol="K--> pipi0ee";nome="Kpip0ee";
00017     ntrk=good=0;
00018      mas_pip=ptr_Pip->Get_Massa();
00019      mas_Kp=ptr_Kapp->Get_Massa();
00020      mas_pi0=ptr_Pi0->Get_Massa();
00021      mas_ele=ptr_Elec->Get_Massa();
00022     Gout<<"\n Attivato il fit di "<<titol;
00023     Pk_ric=new GigaBeam();
00024    }                  
00025                                                 
00026   AnaKpip0ee::~AnaKpip0ee(){};
00027 
00028  //=============== C h a r g e  2 pions    F i t ========
00029 
00030 int AnaKpip0ee::Fisica()
00031   {
00032 //     int good;
00033 //     float chiq_vert,xvtx,yvtx,zvtx, mqinv,mqgg,mqee;
00034 //     float Pk_mom,pxkp,pykp,pzkp,pxpip,pypip,pzpip,pxelec,pyelec,pzelec,pxelep,pyelep,pzelep;
00035   count_call++;
00036 //  
00037   good=0;;
00038   chiq_vert=xvtx=yvtx=zvtx=mqinv=mqgg=mqee=0.0;
00039    momk=pxkp=pykp=pzkp=pxpip=pypip=pzpip=pxelec=pyelec=pzelec=pxelep=pyelep=pzelep=0.0;
00040  
00041     //taglio sul vertice generato (taglia solo gli eventi che finiscono sul collimatore)da togliere!!!
00042     if (evento_.Gen.zv < 10000.) {
00043         getta_cog++;
00044         return -1;
00045     }
00046 
00047     count_decay++;
00048  
00049     
00050     if (Trkstraw==0) { cout<<"\n Tracce non attivato!!! exit "<<endl;exit(0);}
00051     if( Trkstraw->ntrk_done<3)
00052     {
00053         getta_trk++;
00054         return -1;
00055     }
00056 
00057 //*****************************************
00058     
00059     Track  Trk0=Trkstraw->Traccia[0];
00060     Track  Trk1=Trkstraw->Traccia[1];    
00061     Track  Trk2=Trkstraw->Traccia[2];     
00062 
00063     if((Trk0.charge+Trk1.charge+Trk2.charge) != 1)
00064     {// wrong charge!!!!
00065          getta_char++;
00066         return -1;     
00067     }
00068 
00069 
00070     // ricavo l'impulso del K dal gigatrak
00071     Pk_mom=Pk_ric->Beam_Rec();   // impulso del beam dal gigatrack
00072     Pkin.setvn ( Pk_mom,mas_Kp ); // definizione del quadrimomento
00073     Pkin.putvn( pxkp,pykp,pzkp,momk );  // salvo per root
00074 
00075 //    double mas_Kp, mas_pip, mas_pi0, mas_ele;
00076 //    qvet  Pkin, Ppi, Ppi0, Pelec, Pelep,Pgam1,Pgam2;
00077 
00078 // calcolo del vertice  
00079     Vtxstruct Xdecay(4);   
00080     Xdecay.P[3].setvn(0.,0.,10240.); // beam at G3 (0.,0.,10240.); Fare meglio
00081     Xdecay.V[3]=Pkin.NVerso();       //  versore del beam...    
00082     Xdecay.P[0]=Trkstraw->Traccia[0].Xmg; // coordinate della traccia 0 al centro del magnete 
00083     Xdecay.V[0]=Trkstraw->Traccia[0].P_in.NVerso(); // versore della traccia 0     
00084     Xdecay.P[1]=Trkstraw->Traccia[1].Xmg; // coordinate della traccia 1 al centro del magnete 
00085     Xdecay.V[1]=Trkstraw->Traccia[1].P_in.NVerso(); // versore della traccia 1     
00086     Xdecay.P[2]=Trkstraw->Traccia[2].Xmg; // coordinate della traccia 2 al centro del magnete 
00087     Xdecay.V[2]=Trkstraw->Traccia[2].P_in.NVerso(); // versore della traccia 2
00088     Xdecay.Vertice();
00089     chiq_vert=Xdecay.chiq;
00090     Xdecay.Vtx.putv( xvtx,yvtx,zvtx );   
00091     
00092     if(chiq_vert>100.)
00093     {// wrong fit!!!!
00094         getta_fit++;
00095         return -1;     
00096     }
00097     
00098 // cinematica     
00099 // seleziono l'indice dell'elettrone
00100     if(lkry->mhit<5)
00101       {// not enough hits in lkr
00102         getta_ch++;
00103         return -1;     
00104     }
00105     
00106 // matching  lkr-tracks
00107 int Copp[3]={-1,-1,-1};
00108 int Copg[2]={-1,-1};
00109 int ig=0,ipip=-1;
00110 
00111 for(int i=0;i<5;i++)
00112 {
00113   gvet Xl=lkry->M_Hits[i].Xlab;  
00114   for (int j=0;j<3;j++)
00115   {
00116     gvet Xdl= Xl-Trkstraw->Traccia[j].Xlkr;
00117     if( Xdl.XYNorma()<2.5)
00118     {
00119       Copp[j]=i;   
00120       if(lkry->me[i]/Trkstraw->Traccia[j].P_in.mom<.85) ipip=i; // รจ il pip
00121       break;
00122     }   
00123   }
00124   if(ig<2)Copg[ig]=i;
00125   ig++;
00126  } 
00127   
00128   if(Copp[0]==-1||Copp[1]==-1||Copp[2]==-1||
00129      Copg[0]==-1||Copg[1]==-1||ipip==-1)
00130   {
00131     getta_gg++;
00132     return -1;
00133   }
00134 
00135 
00136 
00137 
00138 
00139     int elect=0;
00140     if(Trk1.charge<0)elect=1;
00141     if(Trk2.charge<0)elect=2;
00142     
00143     
00144     
00145      
00146 //     
00147     
00148     
00149     count_wnt++;
00150     good=1;
00151    return 1;
00152 
00153 }
00154 
00155 //======================================================================================
00156  
00157 
00158  //----------------------------------------------------
00159    void AnaKpip0ee::print_scale()
00160     {
00161 
00162      Gout<<"\n -----> "<<titol<<"   Analysis Summary. <-------\n";
00163      Gout<<"\n Fit entries          "<<count_call;
00164      Gout<<"\n Z cut                "<<getta_cog;
00165      Gout<<"\n no tracks            "<<getta_trk;
00166      Gout<<"\n Wrong charge         "<<getta_char;
00167      Gout<<"\n No good vertex       "<<getta_fit;
00168      Gout<<"\n Not enough lkr hits  "<<getta_ch;
00169      Gout<<"\n Tracks-Lkr no match  "<<getta_gg;
00170      Gout<<"\n Good events          "<<count_wnt;
00171      Gout<<"\n\n ======>           d o n e     <============ ";
00172     }
00173 //-------------------------------------------
 All Classes Namespaces Files Functions Variables