FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_dbs/mattpar.cpp

00001 /***************************************************************************
00002                           mattpar  -  description
00003                              -------------------
00004     begin                : Wed Aug 18 2004
00005     copyright            : (C) 2004 by gmp
00006     email                : peppe@newpeppe
00007   ***************************************************************************
00008   *                                                                         *
00009   *   NA48  simulation program.                                             *
00010   *                                                                         *
00011   ***************************************************************************/
00012 
00013 #include "parm.h"
00014 #include "mattpar.h"
00015 
00016 using namespace std;
00017 
00018 
00019 MattPar::~MattPar()
00020 {
00021 }
00022 
00023 MattPar::MattPar(const char *nnome,const char *sstatus, int zZ, double aA, double iIntl,double dDedx,double xX0, double rRo)
00024 {
00025     static MattPar *last = 0;
00026     static int totelem = 0;
00027     totelem++;
00028     id    = totelem;
00029 
00030     nome=nnome;
00031     status=sstatus;
00032     Z =   zZ;  //numero atomico
00033     A =   aA;  //numero atomico
00034     if(Z>0&&A>0) ZsuA=Z/A;
00035     else ZsuA=0.421;
00036     Intl= iIntl;  //interc length g/cm2
00037     Dedx= dDedx;  // de/dx Mev/g/cm2
00038     X0 =  xX0;  // rad length g/cm2
00039     Ro =  rRo;  // densita' g/cm3
00040     X0l=  Ro?X0/Ro:0.0;
00041 
00042 //  linking
00043     if (last == 0) Elemento= this;
00044     else              last->next = this;
00045     last = this;
00046     this->next = 0;     // end linking
00047 
00048 }
00049 
00050 
00051 
00052 //------------------------------------------------------------
00053 //                  S h o w m a t e r i a
00054 //------------------------------------------------------------
00055 
00056 void MattPar::
00057 Show()
00058 {
00059     MattPar *mp;
00060     mp = this;
00061     Gout<<"\n\n ------------------------------------------------";
00062     Gout<<"\n              M A T E R I A L I      list  \n";
00063     Gout<<"\n  id  nome  Stat  Z     A        Int      de/dx            X0           ro ";
00064     Gout<<"\n                               g/cm2    Mev/g/cm2   g/cm2       cm     g/cm3\n";
00065     while (mp != 0)
00066     {
00067 
00068 //     Gout.precision(3);
00069         Gout<<setfill(' ');
00070         Gout.setf(ios::right,ios::adjustfield);
00071         Gout.setf(ios::floatfield);
00072         Gout<<setprecision(6)
00073         <<setw(3)<<mp->id<<" "
00074         <<setw(5)<<mp->nome<<" "
00075         <<setw(6)<<mp->status<<" "
00076         <<setw(3)<<mp->Z<<" "
00077         <<setw(8)<<mp->A<<" "
00078         <<setw(8)<<mp->Intl<<" "
00079         <<setw(8)<<mp->Dedx<<" "
00080         <<setw(9)<<mp->X0<<" "
00081         <<setw(9)<<mp->X0l<<" "
00082         <<setw(8)<<mp->Ro<<endl;
00083         mp = mp->next;
00084     }
00085     Gout<<"\n              M A T E R I A L I      end ";
00086     Gout<<"\n ------------------------------------------------"<<endl;
00087 }
00088 
00089 //------------------------------------------------------------
00090 //                  P O I N T E R  to ...
00091 
00092 //------------------------------------------------------------
00093 MattPar * MattPar::
00094 PntElem (string mater)
00095 {
00096     MattPar *mp;
00097     mp = Elemento;
00098     while (mp != 0)  //Check  the list
00099     {
00100         if (mater.find(mp->nome) == 0) return mp;
00101         mp = mp->next;
00102     }
00103     Gout<<"\n Errore: Material - "<<mater<<" - not found or not yet defined... exit."<<std::endl;
00104     exit(0);
00105 }
00106 
00107 // ===============================================================
00108 //    D A T A B A SE  D E I  M A T E R I A L I
00109 
00110 //  Lista dei materiali per apparati sperimentali
00111 //  Ricordare di aggiornare secondo le necessità.
00112 //   nome  stato   Z    A      Intl    de/dx   X0     ro
00113 void  Crea_materiali_db()
00114 {
00115  MattPar *ptr;
00116 //                    nome       stato   Z    A        Intl    de/dx    X0       ro
00117     ptr = new MattPar ("Fe"   ,"solid" , 26  ,55.85    ,132.1 , 1.451 , 13.84 ,  7.87      );
00118     ptr = new MattPar ("H2lq" ,"liq"   ,  1  , 1.01    ,52.0  , 4.103 , 63.04 ,  0.071     );  // idrogeno liquido
00119     ptr = new MattPar ("H2gs" ,"gas"   ,  1  , 1.01    ,50.8  , 4.103 , 61.28 ,  0.000084  );  // idrogeno gas 1 bar
00120     ptr = new MattPar ("He"   ,"gas"   ,  2  , 4.0     ,65.1  , 1.937 , 94.32 ,  0.000166  );  // elio gas 1 bar
00121     ptr = new MattPar ("Ne"   ,"gas"   ,  10 , 20.18   ,99.0  , 1.724 , 28.94 ,  0.000839  );
00122     ptr = new MattPar ("W"    ,"solid" ,  74 , 183.85  ,191.9 , 1.145 ,  6.76 ,  19.3      );
00123     ptr = new MattPar ("Pb"   ,"solid" ,  82 , 207.2   ,194.  , 1.129 ,  6.54 ,  21.45     );
00124     ptr = new MattPar ("Cu"   ,"solid" ,  29 , 63.55   ,134.9 , 1.403 , 12.86 ,  8.96      );
00125     ptr = new MattPar ("Al"   ,"solid" ,  13 , 26.98   ,106.4 , 1.615 , 24.01 ,  2.70      );
00126     ptr = new MattPar ("Kr"   ,"liquid",  36 , 83.98   ,222.0 , 1.5   , 17.74 ,  3.7       );
00127     ptr = new MattPar ("Ckv"  ,"solid" ,  6  , 12.01   ,85.8  , 1.74  , 42.70 ,  19.40     );
00128     ptr = new MattPar ("Air"  ,"gas"   ,  7.8, 15.16   ,90.1  , 1.815 , 36.62 ,  0.001205  );  //aria controllare 7.8????
00129     ptr = new MattPar ("Str"  ,"solid" ,  0  ,  0.0    , 0.0  , 0.0   , 39.11 ,  0.040077  );  //definire ?????????
00130     ptr = new MattPar ("Ar"   ,"gas"   ,  18 , 39.948  ,117.2 , 1.519 , 19.55 ,  1.396     );
00131     ptr = new MattPar ("Gmw"  ,"gas"   ,  0  ,  0.0    , 0.0  , 1.5   ,  30.0 ,  0.006     );  //definire ?????????
00132     ptr = new MattPar ("Si"   ,"solid" ,  14 , 28.0855 ,106.0 , 1.664 , 21.82 ,  2.33      );
00133     ptr = new MattPar ("Scint","solid" ,  10 , 100.0   ,2.0   , 1.664 , 21.82 ,  2.33      );  //scintillatore plastico
00134     ptr = new MattPar ("Ldg"  ,"solid" ,  5. , 10.     ,100.0 , 2.0   , 7.87  ,  6.22      );
00135     ptr->Set_ZsuA(.42101);
00136     ptr = new MattPar ("none","none"   ,  0  ,  0.0    , 0.0  , 0.0   ,  0.0  ,  0.0       );
00137     ptr = new MattPar ("null" ,"none"  ,  0  ,  0.0    , 0.0  , 0.0   ,  0.0  ,  0.0       );
00138     ptr = new MattPar ("vuoto","vuoto" ,  0  ,  0.0    , 0.0  , 0.0   ,  0.0  ,  0.0       );
00139 }
00140 
 All Classes Namespaces Files Functions Variables