FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_dev/devrt.cpp

00001 /***************************************************************************
00002                           devrt.cpp  -  description
00003                              -------------------
00004     begin                : Sat May 26 2001
00005     copyright            : (C) 2001 by Giuseppe Pierazzini
00006     email                : peppe@unipi.it
00007   ***************************************************************************
00008   *                                                                         *
00009   *   NA48  simulation program.                                             *
00010   *                                                                         *
00011   ***************************************************************************/
00012 #include "flyoh.h"
00013 #include "devrt.h"
00014 
00015 //using namespace std;
00016 
00017 
00018 DevRt::~DevRt()
00019 {
00020 }
00021 void DevRt::Prgeom()
00022 {
00023   Gout<<"==================  R i v e l a t o r e =================";
00024   Gout<<"\n --> < "<<nome <<" >  [ "<<fun
00025   <<" ]  rettangolare senza buco ";
00026   Device::Prgeom();
00027 
00028 }
00029 //----------------- -----P o s i z i o n e ---
00030 int DevRt::Posizione()
00031 {
00032 // Distanze dai piani pari in Doutd.
00033 // dist dal piano x=Nx%(P-Lout) etcc...
00034 // le distanze di un punto interno dai piani del
00035 // rivelatore sono tutte negative o nulle data
00036 // la definizione delle normali ai piani ( verso l'esterno)
00037 // Le distanze di un punto esterno sono sia positive che negative:
00038 // ma almeno  una distanza e' positiva.
00039 
00040   Doutd=X_dev-Lout;     Doutd.Norma();
00041   Douts=- ( Lout+X_dev );  Douts.Norma();
00042 
00043   int posto=0;
00044 
00045   if ( X_dev.normaq>Rqsize ) posto=1;
00046 
00047   else if ( Douts[2]>0.0 || Doutd[2]>0.0 || Douts[0]>0.0 ||
00048             Doutd[0]>0.0 || Douts[1]>0.0 || Doutd[1]>0.0 ) posto =1;
00049   // 0 se interno, 1 se esterno.
00050 
00051   return posto;
00052 
00053 }
00054 //----------------------------------------------------------
00055 //----------------------C a m E s t e r --------------------
00056 // calcola il cammino esterno per raggiungere il rivelatore...
00057 // Pp punto di partenza in dev frame
00058 // Vv versore del moto
00059 // da chiamrsi sempre dopo Posizione....
00060 
00061 double DevRt::CamEster()
00062 {
00063   double nv,t=0.;
00064   camm=-1.;
00065   // calcolo il cammino verso le sei superfici. Per dist>0
00066   // scelgo il cammino maggiore.
00067   // camm resta negativo se il dev non puo' essere colpito.
00068 
00069   /*****************  standar version ****/
00070 
00071   if ( ( nv=V_dev[0] ) >0.0 && Douts[0]>0.0 )  // piani x
00072     {t=Douts[0]/nv; if ( t>camm ) camm=t;}
00073   else if ( nv<0.0 && Doutd[0]>0.0 )
00074     {t=-Doutd[0]/nv;if ( t>camm ) camm=t;}
00075 
00076   if ( ( nv=V_dev[1] ) >0.0 && Douts[1]>0.0 )  // piani y
00077     {t=Douts[1]/nv;if ( t>camm ) camm=t;}
00078   else if ( nv<0.0 && Doutd[1]>0.0 )
00079     {t=-Doutd[1]/nv;if ( t>camm ) camm=t;}
00080 
00081   if ( ( nv=V_dev[2] ) >0.0 && Douts[2]>0.0 )  // piani z
00082     {t=Douts[2]/nv;if ( t>camm ) camm=t;}
00083   else if ( nv<0.0 && Doutd[2]>0.0 )
00084     {t=-Doutd[2]/nv;if ( t>camm ) camm=t;}
00085 
00086 /*
00087 // test if hit inside the side surface
00088 // dannazione a questo... se il device รจ spostato dal centro crea danni..
00089  if(camm>0.)
00090 {
00091   gvet Xpos= X_dev+V_dev*t;
00092   if ( fabs ( Xpos.x ) >Lout.x ) camm=-1;
00093   if ( fabs ( Xpos.y ) >Lout.y ) camm=-1;
00094 }
00095  */
00096 //if(pr_dev->Get_Idm()==14 && idev==49)
00097 //  {X_dev.print("XdR");V_dev.print("vdR");Gout<<"\n cammino Ret "<<camm;}
00098 
00099   return camm;
00100 }
00101 
00102 //----------------------C a m I n t e r --------------------
00103 // calcola il cammino interno per uscire dal rivelatore...
00104 // Pp punto di partenza in dev frame
00105 // Vv versore del moto
00106 // da chiamrsi sempre dopo Posizione....
00107 
00108 double DevRt::CamInter()
00109 {
00110   double nv,t;
00111   camm=1.0e+10;
00112   // calcolo il cammino verso le sei superfici
00113   // le distanze sono per definizione negative...
00114   // e scelgo il cammino positivo  maggiore
00115   // camm in uscita e' sempre definito
00116 
00117   if ( ( nv=V_dev[0] ) >0.0 )  // piani x
00118     {t=-Doutd[0]/nv; if ( t<camm ) camm=t; }
00119   else if ( nv<0.0 )
00120     {t=Douts[0]/nv;  if ( t<camm ) camm=t; }
00121 
00122   if ( ( nv=V_dev[1] ) >0.0 )  // piani y
00123     {t=-Doutd[1]/nv; if ( t<camm ) camm=t; }
00124   else if ( nv<0.0 )
00125     {t=Douts[1]/nv;  if ( t<camm ) camm=t; }
00126 
00127   if ( ( nv=V_dev[2] ) >0.0 )  // piani z
00128     {t=-Doutd[2]/nv; if ( t<camm ) camm=t; }
00129   else if ( nv<0.0 )
00130     {t=Douts[2]/nv;  if ( t<camm ) camm=t; }
00131   return camm;
00132 }
00133 
00134 
 All Classes Namespaces Files Functions Variables