FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
00001 /*************************************************************************** 00002 part_db.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 00013 00014 00015 00016 // CP violation program...... in Obj!! Start il 23.6.92 00017 // Data Base routine 00018 // Data_base classe 00019 #include "parm.h" 00020 #include "part_db.h" 00021 #include "particella.h" 00022 static Part_db *last_db = 0; 00023 static int totpart_db = 0; 00024 using namespace std; 00025 00026 //-------------------------------------------------------------- 00027 // Particelle data base Constructor 00028 //-------------------------------------------------------------- 00029 // This roputine gets the input Data_Base by iteration! 00030 Part_db::~Part_db () {}; 00031 00032 // Nome vis carica massa width ctau(cm) 00033 Part_db::Part_db (const char *ptrnome, int vis, int ch, double ms, double wd,double ct) 00034 { 00035 // virtual particles.... 00036 totpart_db++; 00037 id = totpart_db; 00038 // 00039 nome=ptrnome; 00040 see = vis; 00041 charg = ch; 00042 massa = ms; 00043 width = wd; 00044 ctau = ct; 00045 ncan=0; 00046 Canale=0; 00047 // linking 00048 if (last_db == 0) Matter= this; 00049 else last_db->next = this; 00050 last_db = this; 00051 this->next = 0; // end linking 00052 00053 00054 } 00055 00056 //------------------------------------------------------------ 00057 // S h o w p a r t _ d b 00058 //------------------------------------------------------------ 00059 00060 void Part_db:: 00061 Show() 00062 { 00063 00064 Part_db *mp; 00065 mp = Matter; 00066 Gout<<"\n --------------------------------------------"; 00067 Gout<<"\n Part Data base \n\n"; 00068 Gout<<" n. nome see cha massa width ctau\n"; 00069 while (mp != 0) 00070 { 00071 Gout<<setw(3)<<mp->id<<" "<<setw(7)<<mp->nome<<" "<<setw(3)<<(mp->see?"y":"n") 00072 <<setw(3)<<mp->charg<<" "<<setw(10)<<mp->massa<<" "<<setw(10)<<mp->width<<" "<<setw(10)<<mp->ctau<<endl; 00073 mp = mp->next; 00074 } 00075 Gout<<"\n Part Data base End list"; 00076 Gout<<"\n --------------------------------------------"<<endl; 00077 00078 } 00079 //------------------------------------------------------------ 00080 // G e t p a r t _ d b 00081 //------------------------------------------------------------ 00082 Part_db *Part_db:: 00083 Get_matter ( const char *nom, Particella *pp) 00084 00085 { 00086 Part_db *mp; 00087 mp = Matter; 00088 while (mp != 0) 00089 { 00090 if (strcmp (nom, mp->nome) == 0) 00091 { 00092 pp->nome = mp->nome; 00093 pp->idm = mp->id; 00094 pp->see = mp->see; 00095 pp->charg = mp->charg; 00096 pp->massa = mp->massa; 00097 pp->width = mp->width; 00098 pp->ctau = mp->ctau; 00099 return mp; 00100 } 00101 mp = mp->next; 00102 } 00103 Gout<<"\n Get p a r t _ d b : Particella non trovata... errore\n"<<std::endl; 00104 return (0); 00105 } 00106 00107 //------------------------------------------------------------ 00108 // N O T S E E N 00109 //------------------------------------------------------------ 00110 void Part_db:: 00111 Notseen (const char *word) 00112 00113 { 00114 Part_db *mp; 00115 mp = Matter; 00116 while (mp != 0) 00117 { 00118 if (strcmp (word, mp->nome) == 0) 00119 { 00120 mp->see = 0; 00121 00122 return; 00123 } 00124 mp = mp->next; 00125 } 00126 Gout<<"\n In Notseen: Particella " << word<<" non trovata... errore\n"<<std::endl; 00127 exit (0); 00128 } 00129 //------------------------------------------------------------ 00130 // P T B S D A T 00131 //------------------------------------------------------------ 00132 const char *Part_db:: 00133 Ptbsdat (const char *word) 00134 00135 { 00136 Part_db *mp; 00137 mp = Matter; 00138 while (mp != 0) 00139 { 00140 if (strcmp (word, mp->nome) == 0) 00141 return (mp->nome); 00142 mp = mp->next; 00143 } 00144 return (0); 00145 } 00146 00147 00148 const char *Part_db:: 00149 Idm_Nome (int idm) 00150 00151 { 00152 Part_db *mp; 00153 mp = Matter; 00154 while (mp != 0) 00155 { 00156 if (idm==mp->id) 00157 return (mp->nome); 00158 mp = mp->next; 00159 } 00160 return (0); 00161 } 00162 00163 00164 00165 00166 00167 00168 //------------------------------------------------------------ 00169 // P N T M A T T E R 00170 //------------------------------------------------------------ 00171 Part_db * Part_db:: 00172 Pntmatter(const char *word) 00173 00174 { 00175 00176 // string simbolo; 00177 // simbolo=word; 00178 Part_db *mp; 00179 mp = Matter; 00180 while (mp != 0) 00181 { 00182 if (strcmp (word, mp->nome) == 0) 00183 // if (simbolo==mp->nome) 00184 return mp; 00185 mp = mp->next; 00186 } 00187 // return mp; 00188 return ptr_boo; 00189 }