#include <PTGuiRollG3.h>
Public Member Functions | |
| PTGuiRollG3 () | |
| virtual | ~PTGuiRollG3 () |
| TClonesArray * | GetMaterials () const |
| TClonesArray * | GetMedia () const |
Private Member Functions | |
| PTGuiRollG3 (const PTGuiRollG3 &that) | |
| PTGuiRollG3 & | operator= (const PTGuiRollG3 &that) |
| void | RollMaterials () |
| void | RollMedia () |
| Double_t | Cut (Int_t imed, Int_t icut) |
Private Attributes | |
| TClonesArray * | fMaterials |
| TClonesArray * | fMedia |
| TGeant3 * | fGeant3 |
Definition at line 28 of file PTGuiRollG3.h.
| PTGuiRollG3::PTGuiRollG3 | ( | ) |
Definition at line 36 of file PTGuiRollG3.cxx.
00036 : fMaterials(0), fMedia(0), fGeant3(0) { 00037 // Normal Constructor 00038 00039 fMaterials = new TClonesArray("PTGuiMaterial",100); 00040 fMedia = new TClonesArray("PTGuiMedium",100); 00041 00042 if ( gMC ) fGeant3 = (TGeant3*) gMC; 00043 if ( !fGeant3 ) { 00044 cerr << "PTGuiRollG3 ctor. Null TGeant3 global ptr. Abort." << endl; 00045 abort(); 00046 } 00047 00048 // Convert Geant3 objects to PTGui objects 00049 RollMaterials(); 00050 RollMedia(); 00051 00052 }
| PTGuiRollG3::~PTGuiRollG3 | ( | ) | [virtual] |
Definition at line 55 of file PTGuiRollG3.cxx.
References fMaterials, and fMedia.
00055 { 00056 // Destructor 00057 00058 // Delete TClonesArrays and contained objects 00059 if ( fMaterials ) { fMaterials->Delete(); delete fMaterials; } 00060 if ( fMedia ) { fMedia -> Delete(); delete fMedia; } 00061 00062 // fGeant3 is not owned 00063 00064 }
| PTGuiRollG3::PTGuiRollG3 | ( | const PTGuiRollG3 & | that | ) | [private] |
| Double_t PTGuiRollG3::Cut | ( | Int_t | imed, | |
| Int_t | icut | |||
| ) | [private] |
Definition at line 169 of file PTGuiRollG3.cxx.
References fGeant3, TGeant3::Gclink(), Gclink_t::jtmed, TGeant3::Lq(), and TGeant3::Q().
Referenced by RollMedia().
00169 { 00170 // Return cut value for cut icut, for medium idmed 00171 // "Cut" energy thresholds and physics process flags can be customized 00172 // by medium. Check here for such customization or otherwise apply defaults. 00173 // As described in the G3 GSTPAR documentation, valid icuts are in the 00174 // range 1-22,26-29,and 31-33 00175 00176 Gclink_t* gclink = fGeant3->Gclink(); // pointer to GCLINK common block 00177 Int_t* zlq = fGeant3->Lq(); // pointer to Zebra bank lq 00178 Float_t* zq = fGeant3->Q(); // pointer to Zebra bank q 00179 00180 Int_t jtm = zlq[gclink->jtmed-imed]; 00181 Int_t jtmn = zlq[jtm]; 00182 if ( jtmn > 0 ) { 00183 // the cuts for this medium have been specialized 00184 jtm = jtmn; 00185 } 00186 else { 00187 jtm = gclink -> jtmed; 00188 } 00189 00190 return Double_t(zq[jtm+icut]); 00191 00192 }
| TClonesArray* PTGuiRollG3::GetMaterials | ( | ) | const [inline] |
Definition at line 36 of file PTGuiRollG3.h.
References fMaterials.
Referenced by PTGuiMainFrame::UpdateMaterialList().
00036 {return fMaterials;}
| TClonesArray* PTGuiRollG3::GetMedia | ( | ) | const [inline] |
Definition at line 37 of file PTGuiRollG3.h.
References fMedia.
Referenced by PTGuiMainFrame::AddComboMedia(), and PTGuiMainFrame::ProcessMessage().
00037 {return fMedia;}
| PTGuiRollG3& PTGuiRollG3::operator= | ( | const PTGuiRollG3 & | that | ) | [private] |
| void PTGuiRollG3::RollMaterials | ( | ) | [private] |
Definition at line 67 of file PTGuiRollG3.cxx.
References MuELoss::a, fGeant3, TGeant3::Gclink(), TGeant3::Gcnum(), TGeant3::Gfmate(), TGeant3::Iq(), Gclink_t::jmate, TGeant3::Lq(), nentries, Gcnum_t::nmate, and Lit::Print().
00067 { 00068 // Read materials from G3 banks using TGeant3 interface, and store 00069 // in fMaterials array of PTGuiMaterial objects. 00070 // 00071 00072 char namate[21]; 00073 Float_t a, z, dens, radl, absl; 00074 Int_t npar = 0; 00075 Float_t* par = 0; 00076 00077 // Loop over materials 00078 Int_t nmat = fGeant3->Gcnum()->nmate; 00079 00080 Int_t nentries = 0; // number of array entries 00081 // Start at 1 instead of 0 because G3 fortran indexes from 1 00082 for ( Int_t imat = 1; imat < nmat; imat++ ) { 00083 // Get material parameters 00084 fGeant3->Gfmate(imat,namate,a,z,dens,radl,absl,par,npar); 00085 if ( a < 0. ) continue; // this is used to indicate non-existent material 00086 // How odd that this is necessary, but namate returned by Gfmate is 00087 // incomplete 00088 Int_t* zlq = fGeant3->Lq(); 00089 Int_t* ziq = fGeant3->Iq(); 00090 Int_t jma = Int_t(zlq[fGeant3->Gclink()->jmate-imat]); 00091 strncpy(namate,(char*)&ziq[jma+1],20); 00092 namate[20] = '\0'; 00093 00094 // Fuss with the material name to remove trailing spaces 00095 std::string matname = namate; 00096 00097 int pos(matname.size()); 00098 for ( ; pos && matname[pos-1]==' '; --pos ); 00099 matname.erase(pos,matname.size()-pos); 00100 00101 // Create new material object 00102 PTGuiMaterial* material=new PTGuiMaterial(matname,imat,a,z,dens,radl,absl); 00103 (*fMaterials)[nentries++] = material; 00104 material -> Print(); 00105 } 00106 00107 }
| void PTGuiRollG3::RollMedia | ( | ) | [private] |
Definition at line 110 of file PTGuiRollG3.cxx.
References Cut(), fGeant3, TGeant3::Gcnum(), TGeant3::Gftmed(), nentries, Gcnum_t::ntmed, and Lit::Print().
00110 { 00111 // Read media from G3 banks using TGeant3 interface, and store 00112 // in fMedia array of PTGuiMedium objects. 00113 // Cuts (e.g. CUTGAM) and physics process flags (e.g. LOSS), can 00114 // be specified on a medium by medium basis (although the default 00115 // is to apply one set to all media), so are store here as 00116 // part of the PTGuiMedium object. 00117 00118 char named[21]; 00119 Int_t imat, isvol, ifield; 00120 Float_t fieldm, tmaxfd, stemax, deemax, epsil, stmin; 00121 Int_t nwbuf = 0; 00122 Float_t* ubuf = 0; 00123 00124 // Loop over media 00125 Int_t nmed = fGeant3->Gcnum()->ntmed; 00126 00127 Int_t nentries = 0; // number of array entries 00128 00129 // Start at 1 instead of 0 because G3 fortran indexes from 1 00130 for ( Int_t imed = 1; imed < nmed; imed++ ) { 00131 00132 fGeant3->Gftmed (imed,named,imat,isvol,ifield,fieldm,tmaxfd, 00133 stemax,deemax,epsil,stmin,ubuf,&nwbuf); 00134 00135 named[20] = '\0'; 00136 00137 if ( imat <= 0 ) continue; // this is used to indicate non-existent medium 00138 00139 // Fuss with the medium name to remove trailing spaces 00140 std::string medname = named; 00141 int pos(medname.size()); 00142 for ( ; pos && medname[pos-1]==' '; --pos ); 00143 medname.erase(pos,medname.size()-pos); 00144 00145 // Create new medium object 00146 PTGuiMedium* medium = new PTGuiMedium(medname,imed,imat,isvol,ifield, 00147 fieldm,tmaxfd,stemax,deemax,epsil,stmin); 00148 (*fMedia)[nentries++] = medium; 00149 00150 // Store cut/physic process flags associated with medium in 00151 // medium parameters array 00152 00153 // Valid medium associated cuts are described in the GSTPAR documentation 00154 for ( int icut = 0; icut < 10; icut++ ) 00155 medium -> SetCut(icut,Cut(imed,icut+1)); 00156 00157 // Valid medium associated physics process flags are described in the 00158 // GSTPar documention 00159 for ( int ip = 0; ip < 12; ip++ ) 00160 medium -> SetProcess(ip,(Int_t)Cut(imed,ip+11)); 00161 00162 medium -> Print(); 00163 00164 } 00165 00166 }
TGeant3* PTGuiRollG3::fGeant3 [private] |
TClonesArray* PTGuiRollG3::fMaterials [private] |
TClonesArray* PTGuiRollG3::fMedia [private] |
1.4.7