FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_dev62/devlav.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2009 by giuseppe Pierazzini                                      *
00003  *   giuseppe@pierazzini.it                                                               *
00004  *                                                                         *
00005  *                                                                         *
00006  *   This program is distributed in the hope that it will be useful,       *
00007  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00008  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  *
00009  *                                                                         *
00010  *  Dipartimento di Fisica  E.Fermi / INFN Pisa Italy                      *
00011  ***************************************************************************/
00012 #include "parm.h"
00013 #include "devlav.h"
00014 #include "part_db.h"
00015 
00021 using namespace std;
00022 
00023 DevLav::DevLav()
00024         : DevCrn()
00025 {
00026     devtype=TypDevLav;
00027     devclass="Large Angle Veto";         
00028 Gout<<"\n\n < "<<nome <<" > Dev Id "<<idev<<" Device type <"<<devclass<<"> typ "<<devtype; 
00029 }
00030 
00031 DevLav::~DevLav()
00032 {
00033 }
00034 
00035 int DevLav::SimulaDev()
00036 {
00037     if(mhit<1) return 0;
00038     double Thres_gam=.100; 
00039     double Thres_mu=.300; //threshold in p!
00040     //double Thres_mu=0.1; //prova per vedere se cambia molto l'efficienza
00041     double RefIndx=1.3;  // leadglass EFFECTIVE refraction index (cherenkov threshold != real threshold!)
00042     //double RefIndx=2.; //prova per vedere se cambia molto l'efficienza
00043     double beta=0.;
00044 
00045 // loop sulle particelle viste;
00046     qvet Eimp;
00047     int loop=0;
00048     const char *Part_nome;
00049     while (loop<mhit)
00050     {
00051         Eimp=M_Hits[loop].Pdev;
00052         Part_nome= M_Hits[loop].pnome;
00053 
00054         if ( Part_nome==Gam|| Part_nome==Elec|| Part_nome==Elep)
00055         {
00056             if (M_Hits[loop].Pdev.e <Thres_gam)
00057                 M_Hits[loop].idead=-99999;
00058             /*uccido la particella*/
00059         }
00060 
00061         else if ( Part_nome==Mup|| Part_nome==Mum)
00062         {
00063             if (M_Hits[loop].Pdev.mom <Thres_mu)
00064                 M_Hits[loop].idead=-99999;
00065             /*uccido la particella*/
00066         }
00067 
00068         else if ( Part_nome==Neutrone|| Part_nome==A_Neutrone)
00069         {
00070           if ( Eff_Neutron(Part_nome,Eimp)==0) M_Hits[loop].idead=-99999;
00071             /*uccido la particella*/
00072         }
00073         
00074         
00075         else if(M_Hits[loop].Pr->Get_Charg()!=0)
00076         {
00077           beta =Eimp.mom/Eimp.e;
00078 //        Eimp.print("Pvet"); Gout<<" "<<M_Hits[loop].pnome<<" beta "<< beta ;
00079           if(beta <1./RefIndx)  M_Hits[loop].idead=-99999;
00080           /* attenzione  atomi inclusi..*/
00081         
00082         }
00083         
00084           else if ( M_Hits[loop].Pr->Get_Charg()==0)
00085         {
00086           if ( Eff_Neutron(Part_nome,Eimp)==0) M_Hits[loop].idead=-99999;
00087             /* per il momento trattatano come i neutroni....*/
00088         }
00089         
00090           loop++;
00091         
00092     }
00093 //==============  La parte che segue รจ fissa!
00094 // elimino le paricelle morte, compattizzo i dati e  ridefinisco nhit e mhit;
00095 //  Gout<<"\n Prima  del coppattamento..."<<nome<<" "<< nhit<<" " <<mhit<< "  "<<M_Hits[nhit].pnome;
00096 
00097     loop =0;
00098     int newhit=mhit;
00099     while (loop<newhit)
00100     {
00101         if (M_Hits[loop].idead!=-99999)loop++;
00102         else if (newhit==1)newhit=0;
00103         else {
00104             newhit--;
00105             for (int i=loop;i<newhit;i++)
00106             {
00107                 M_Hits[i]=M_Hits[i+1];
00108             }
00109         }
00110     }
00111     mhit=newhit;
00112     nhit=mhit-1;
00113 //     Gout<<"\n Dopo il coppattamento..."<<nome<<" "<<nhit<<" " <<mhit;
00114 //     if (nhit>-1)  Gout<<"  "<<M_Hits[nhit].pnome;
00115     return 0;
00116 }
00117 int DevLav::Eff_Neutron( const char *Nome,qvet Eimp)
00118 {
00119     // attenzione qui si deve arrivare solo con i neutroni... altrimenti con gli atomi....Axy ...
00120     double eff=.70;
00121     if (Eimp.mom<0.1) eff=0.05;
00122     else if (Eimp.mom<1.) eff=.50;
00123     if (Pran()<eff)return 1;
00124     return 0;
00125 }
00126 //===============
00127 int DevLav::Get_Structinfo()
00128 {
00129 // ritorna in gradi la posizione nel veto  system
00130     double x = M_Hits[nhit].Xdev.x;
00131     double y = M_Hits[nhit].Xdev.y;
00132     int gradi= atan2(y,x)*57.30;
00133     return gradi;
00134 }
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
 All Classes Namespaces Files Functions Variables