FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Giuseppe Pierazzini Pisa 19.12.2010 * 00003 * pierazzini@unipi.it * 00004 * F l y o * 00005 * MA62 * 00006 ***************************************************************************/ 00007 #include "parm.h" 00008 #include "apparato.h" 00009 #include "gvet.h" 00010 #include "evento.h" 00011 #include "reazione.h" 00012 #include "clusgmp.h" 00013 #include "gigabeam.h" 00014 using namespace GmpConst; 00015 using namespace std; 00016 00017 GigaBeam::GigaBeam() 00018 { 00019 if (giga1==0||giga2==0||giga3==0) 00020 { 00021 Gout<<"\n ERROR.... Giga pointer not defined ---> exit(0)"<<endl; 00022 cout<<"\n ERROR.... Giga pointer not defined ---> exit(0)"<<endl; 00023 exit(0); 00024 00025 } 00026 00027 if (mgb1==0||mgb2==0||mgb3==0||mgb4==0||mgb5==0) 00028 00029 { 00030 Gout<<"\n ERROR.... Giga pointer of magnet not defined ---> exit(0)"<<endl; 00031 cout<<"\n ERROR.... Giga pointer of magnet not defined ---> exit(0)"<<endl; 00032 exit(0); 00033 } 00034 00035 00038 00039 00040 // double ZG21,ZG32,ZG31,ZM21,ZG3M5; 00041 00042 00043 ZG21=giga2->Get_Cface().z-giga1->Get_Cface().z; 00044 ZG32=giga3->Get_Cface().z-giga2->Get_Cface().z; 00045 ZG31=giga3->Get_Cface().z-giga1->Get_Cface().z; 00046 ZM21 = mgb2->Get_Cface().z-mgb1->Get_Cface().z; //== ZM43 00047 ZG3M5=giga3->Get_Cface().z-mgb5->Get_Cface().z; 00048 Magkik1=mgb1->Get_Kik(); // lo stesso in valore assoluto per mgb2,mgb3,mgb4 00049 Magkik5=mgb5->Get_Kik(); 00050 00051 }; 00052 00053 int GigaBeam::GetCoordinate () 00054 { 00055 // g1,g2,g3 tutti >=0; 00056 // se pipeline è on si verificano i tempi degli hits 00057 // se non corrispondono al tempo del trigger si ritorna con errore -1 00058 if ( giga1->mhit<1|| giga2->mhit<1||giga3->mhit<1) return -1 ; 00059 00060 00061 00062 int g1,g2,g3; 00063 g1=g2=g3=0; 00064 00065 // test on pipeline....if not skip to the end with g_index zero 00066 if (Pipeline==1) 00067 { 00068 int ok=0; 00069 double Spread= giga1->Get_Res()*3.; // stesso valore per giga2 e giga3 00070 double t_ev = evento_.Gen.tempo; 00071 00072 for ( g1=0;g1<giga1->mhit;g1++) 00073 { 00074 for ( g2=0;g2<giga2->mhit;g2++) 00075 { 00076 for ( g3=0;g3<giga3->mhit;g3++) 00077 { 00078 00079 if (fabs(giga1->M_Hits[g1].tempo-t_ev) > Spread || 00080 fabs(giga2->M_Hits[g2].tempo-t_ev) > Spread || 00081 fabs(giga3->M_Hits[g3].tempo-t_ev) > Spread ) 00082 continue; 00083 //else 00084 ok=1; 00085 break; 00086 00087 } 00088 } 00089 } 00090 if (ok==0) return -1; // no good hits.... 00091 00092 } 00093 00094 xg1=giga1->M_Hits[g1].Xlab.x; 00095 xg2=giga2->M_Hits[g2].Xlab.x; 00096 xg3=giga3->M_Hits[g3].Xlab.x; 00097 00098 yg1=giga1->M_Hits[g1].Xlab.y; 00099 yg2=giga2->M_Hits[g2].Xlab.y; 00100 yg3=giga3->M_Hits[g3].Xlab.y; 00101 00102 return 0; 00103 00104 00105 }; 00106 gvet GigaBeam::Beam_Rec() 00107 { 00108 00109 gvet PBeam; 00110 PBeam.setvn(-0.09,0.,75.); 00111 00112 // Attenzione di solito si prende sempre il primo hits... nel caso di pipeline on 00113 // si fa una loop sugli hits disponibili: Vedi GetCoordinate() 00114 // GetCoordinate fa un test sulla compatibilità temporale e accetta 00115 // la tripletta che sta nella risoluzione temporale del Gigatrack 00116 // altrimenti ritorna con -1 00117 00118 if (GetCoordinate ()<0) return PBeam; 00119 //OK 00120 // calcolo l'impuso ppz 00121 double dydz=(yg2-yg1)/ZG21-(yg3-yg2)/ZG32; 00122 double dzmdz= ZM21*(1./ZG21+1./ZG32); 00123 double ppz= Magkik1 *dzmdz/dydz; 00124 00125 //calcolo di ppy 00126 double ppy = ppz*(yg3-yg1)/ZG31; 00127 //calcolo di ppx 00128 double ppx= ppz*(xg3-xg1)/ZG31 - Magkik5*ZG3M5/ZG31; 00129 ppx+=Magkik5; 00130 PBeam.setvn(ppx,ppy,ppz); 00131 return PBeam; 00132 }; 00133