FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_uti48/flytrk.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Giuseppe Pierazzini          Pisa 20.02.05      *
00003  *   pierazzini@unipi.it                                                   * 
00004  *                                     F l y o                             *
00005  *   Epsi/NA48                                                             *
00006  ***************************************************************************/
00007 #include <math.h>
00008 #include "flyoh.h"
00009 
00010 //using namespace std;
00011 
00012 // procedura chiamata da Flyline per il calcolo dell'impulso della traccia
00013 
00014 Flytrk::Flytrk()
00015 {
00016   id=Le_Tracce->Tot_trk++;
00017   index=-1;
00018   tottrk=0;
00019   charge=0.;
00020   // linking
00021   if(Le_Tracce->First_trk==0)
00022     {
00023       Le_Tracce->First_trk=this;
00024       Le_Tracce->Last_trk=this;
00025       up=0;
00026     }
00027   else
00028     {
00029       up=Le_Tracce->Last_trk;
00030       up->next=this;
00031     }
00032   next=0;
00033   Le_Tracce->Last_trk=this;
00034 
00035 
00036 }
00037 
00038 
00039 
00040 Flytrk::~Flytrk()
00041 {}
00042 
00043 void  Flytrk::Get_Traccia()
00044 {
00045 
00046   index=Le_Tracce->indexsav;
00047   //  Gout<<"\n Get_Traccia!! "<<index<<endl;
00048   if(index<0)
00049     {
00050       Reset();
00051       Le_Tracce->Tot_trk--;
00052       return;
00053     }  // ner has to happened...
00054   //get space pints with its index...
00055   // if index==-1 point not found in the chamber 1 and 6
00056   if((i1=Le_Tracce->isv1)>-1)
00057     Pc1=Le_Tracce->xhit1[i1]; // devono esistere....
00058   if((i2=Le_Tracce->isv2)>-1)
00059     Pc2=Le_Tracce->xhit2[i2];
00060   if((i3=Le_Tracce->isv3)>-1)
00061     Pc3=Le_Tracce->xhit3[i3];
00062   if((i4=Le_Tracce->isv4)>-1)
00063     Pc4=Le_Tracce->xhit4[i4];
00064   X=Pc1;
00065   chiq=Le_Tracce->chiqsav;
00066 
00067   /*Gout<<setprecision(4)<<fixed<<
00068    "\n Ev "<<evento_.Event<<" Flytrk "<< id<<"  <"<<i1<<i2<<i3<<i4<<"> "<<
00069    " chiq "<<chiq<<endl;
00070   */
00071   //==================
00072   // procedure to get Momentum from spectrometer,
00073   // charge
00074   // position and Versus at chamber 1
00075   // now only test for four chamber of na48....
00076   // define the index of used space_points....
00077 
00078   V12=(Pc2-Pc1).NVerso();
00079   Verso=V12;
00080   cosdip=sqrt(V12[0]*V12[0]+V12[2]*V12[2]); // cos of dip angle...
00081   V12=V12.NxzVerso();
00082   V34 =(Pc4-Pc3).NxzVerso();
00083   bend1=Le_Tracce->Bsegno1*asin(V12[2]*V34[0]-V34[2]*V12[0]);
00084   if(bend1>0.0)
00085     charge=-1.;
00086   else if(bend1<0.0)
00087     charge=1.;
00088   else if(bend1==0.0)
00089     {
00090       Reset();
00091       Le_Tracce->Tot_trk--;
00092       return;
00093     } // just in the case....
00094   //
00095   ptrk=fabs(Le_Tracce->kick1/(2.*sin(bend1*0.5)*cosdip));    //impuls per charg...
00096 
00097   // quadrimomentum come pai....tuttavia lĂ­mpulso e'indipendente dalla massa...
00098   P.setvn(Verso*ptrk,Le_Tracce->mas_pip);     // attenzione a come si usa  nella analisi...
00099   //
00100   // Xlk  coordinate al calorimetro....
00101   double dlkrc1=lkry->Get_Cface().z-Pc4[2]; 
00102   V34 =(Pc4-Pc3).Verso();
00103   double t= dlkrc1/V34[2];
00104   Xlk=Pc4+V34*t;
00105 
00106   if(Debugon==1)
00107     {
00108       P.print(evento_.Gen.Event,"P_trk",0,"Trak");
00109       Gout<<" cs "<<cosdip<<" bend "<<bend1<<"  ptr "<<ptrk<<std::endl;
00110     }
00111 
00112   // save in paw_data
00113   Le_Tracce->index[id]=index;
00114   X.putv(Le_Tracce->xct[id],Le_Tracce->yct[id],Le_Tracce->zct[id]);
00115   Verso.putv(Le_Tracce->vxt[id],Le_Tracce->vyt[id],Le_Tracce->vzt[id]);
00116   Le_Tracce->ptrk[id]=ptrk;
00117   Le_Tracce->chiq[id]=chiq;
00118   Le_Tracce->charge[id]=charge;
00119   Le_Tracce->Tot_Charge+=charge;
00120   //   total
00121   tottrk++;
00122 }
00123 
00124 void  Flytrk::Spia_Trk()
00125 {
00126   // debug out...
00127   if(index>-1)
00128     {
00129       X.print("X");
00130       Gout<<" Ev "<<evento_.Gen.Event<<" <"<<i1<<i2<<i3<<i4<<"> chiq "<<chiq;
00131       P.print("P");
00132       Gout<<" bend "<<bend1<<" ch "<<charge<<std::endl;
00133     }
00134    if(next!=0)next->Spia_Trk();
00135 }
00136 
00137 void  Flytrk::Reset()
00138 {
00139   i1=i2=i3=i4=i5=i6=index=-1;
00140   charge=0.0;
00141 }
00142 
 All Classes Namespaces Files Functions Variables