#include <G4PhysicsTableHelper.hh>
Static Public Member Functions | |
static G4PhysicsTable * | PreparePhysicsTable (G4PhysicsTable *physTable) |
static G4bool | RetrievePhysicsTable (G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii) |
static void | SetPhysicsVector (G4PhysicsTable *physTable, size_t idx, G4PhysicsVector *vec) |
static void | SetVerboseLevel (G4int value) |
static G4int | GetVerboseLevel () |
Protected Member Functions | |
G4PhysicsTableHelper () | |
~G4PhysicsTableHelper () | |
G4PhysicsTableHelper (const G4PhysicsTableHelper &right) | |
G4PhysicsTableHelper & | operator= (const G4PhysicsTableHelper &) |
Static Protected Attributes | |
static G4int | verboseLevel = 1 |
Definition at line 52 of file G4PhysicsTableHelper.hh.
G4PhysicsTableHelper::G4PhysicsTableHelper | ( | ) | [protected] |
G4PhysicsTableHelper::~G4PhysicsTableHelper | ( | ) | [protected] |
G4PhysicsTableHelper::G4PhysicsTableHelper | ( | const G4PhysicsTableHelper & | right | ) | [protected] |
G4int G4PhysicsTableHelper::GetVerboseLevel | ( | ) | [inline, static] |
Definition at line 98 of file G4PhysicsTableHelper.hh.
References verboseLevel.
00099 { 00100 return verboseLevel; 00101 }
G4PhysicsTableHelper & G4PhysicsTableHelper::operator= | ( | const G4PhysicsTableHelper & | ) | [protected] |
G4PhysicsTable * G4PhysicsTableHelper::PreparePhysicsTable | ( | G4PhysicsTable * | physTable | ) | [static] |
Definition at line 64 of file G4PhysicsTableHelper.cc.
References G4PhysicsTable::ClearFlag(), FatalException, G4cerr, G4endl, G4Exception(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4ProductionCutsTable::GetProductionCutsTable(), G4ProductionCutsTable::GetTableSize(), G4PhysicsTable::ResetFlagArray(), G4PhysicsTable::resize(), and verboseLevel.
Referenced by G4VEnergyLossProcess::BuildDEDXTable(), G4LossTableBuilder::BuildTableForModel(), G4VEnergyLossProcess::PreparePhysicsTable(), G4VEmProcess::PreparePhysicsTable(), G4PolarizedCompton::PreparePhysicsTable(), and G4eplusPolarizedAnnihilation::PreparePhysicsTable().
00065 { 00066 G4ProductionCutsTable* cutTable = G4ProductionCutsTable::GetProductionCutsTable(); 00067 size_t numberOfMCC = cutTable->GetTableSize(); 00068 00069 if ( physTable !=0) { 00070 // compare size of physics table and number of material-cuts-couple 00071 if ( physTable->size() < numberOfMCC) { 00072 // enlarge physcis table 00073 physTable->resize(numberOfMCC, (G4PhysicsVector*)(0)); 00074 #ifdef G4VERBOSE 00075 if (verboseLevel>2) { 00076 G4cerr << "G4PhysicsTableHelper::PreparePhysicsTable "; 00077 G4cerr << "Physics Table "<< physTable ; 00078 G4cerr << " is resized to " << numberOfMCC << G4endl; 00079 } 00080 #endif 00081 } else if ( physTable->size() > numberOfMCC){ 00082 // ERROR: this situation should not occur 00083 // size of physics table is shorter than number of material-cuts-couple 00084 physTable->resize(numberOfMCC); 00085 #ifdef G4VERBOSE 00086 if (verboseLevel>0) { 00087 G4cerr << "G4PhysicsTableHelper::PreparePhysicsTable "; 00088 G4cerr << "Physics Table "<< physTable ; 00089 G4cerr << " is longer than number of material-cuts-couple " << G4endl; 00090 } 00091 #endif 00092 G4Exception( "G4PhysicsTableHelper::PreparePhysicsTable()", 00093 "ProcCuts001", FatalException, 00094 "Physics Table is inconsistent with material-cuts-couple"); 00095 } 00096 } else { 00097 // create PhysicsTable is given poitner is null 00098 physTable = new G4PhysicsTable(numberOfMCC); 00099 if (physTable!=0) { 00100 physTable->resize(numberOfMCC, (G4PhysicsVector*)(0)); 00101 } else { 00102 G4Exception( "G4PhysicsTableHelper::PreparePhysicsTable()", 00103 "ProcCuts002", FatalException, 00104 "Can't create Physics Table"); 00105 } 00106 } 00107 00108 #ifdef G4VERBOSE 00109 if (verboseLevel>2) { 00110 if ( physTable !=0) { 00111 G4cerr << "Physics Table size "<< physTable->size(); 00112 } else { 00113 G4cerr << "Physics Table does not exist "; 00114 } 00115 G4cerr << ": number of material-cuts-couple " << numberOfMCC << G4endl; 00116 } 00117 #endif 00118 00119 // Reset recal-needed flag for all physics vectors 00120 physTable->ResetFlagArray(); 00121 00122 for (size_t idx = 0; idx <numberOfMCC; idx +=1){ 00123 const G4MaterialCutsCouple* mcc = cutTable->GetMaterialCutsCouple(idx); 00124 //check if re-calculation of the physics vector is needed 00125 // MCC is not used 00126 if ( !mcc->IsUsed() ) physTable->ClearFlag(idx); 00127 00128 // RecalcNeeded flag of MCC is not asserted 00129 if ( !mcc->IsRecalcNeeded() ) physTable->ClearFlag(idx); 00130 } 00131 00132 return physTable; 00133 }
G4bool G4PhysicsTableHelper::RetrievePhysicsTable | ( | G4PhysicsTable * | physTable, | |
const G4String & | fileName, | |||
G4bool | ascii | |||
) | [static] |
Definition at line 137 of file G4PhysicsTableHelper.cc.
References G4PhysicsTable::ClearFlag(), G4cerr, G4endl, G4Exception(), G4MCCIndexConversionTable::GetIndex(), G4ProductionCutsTable::GetMCCIndexConversionTable(), G4ProductionCutsTable::GetProductionCutsTable(), G4MCCIndexConversionTable::IsUsed(), JustWarning, G4PhysicsTable::RetrievePhysicsTable(), G4MCCIndexConversionTable::size(), and verboseLevel.
Referenced by G4VEmProcess::RetrievePhysicsTable().
00140 { 00141 if (physTable == 0) return false; 00142 00143 // retrieve physics table from the given file 00144 G4PhysicsTable* tempTable = new G4PhysicsTable(); 00145 if (! tempTable->RetrievePhysicsTable(fileName,ascii) ){ 00146 #ifdef G4VERBOSE 00147 if (verboseLevel>1) { 00148 G4cerr << "G4PhysicsTableHelper::RetrievePhysicsTable "; 00149 G4cerr << "Fail to retreive from "<< fileName << G4endl; 00150 } 00151 #endif 00152 G4Exception( "G4ProductionCutsTable::RetrievePhysicsTable()", 00153 "ProcCuts105", 00154 JustWarning, "Can not retrieve physics tables from file"); 00155 delete tempTable; 00156 return false; 00157 } 00158 00159 G4ProductionCutsTable* cutTable = G4ProductionCutsTable::GetProductionCutsTable(); 00160 const G4MCCIndexConversionTable* converter = cutTable->GetMCCIndexConversionTable(); 00161 00162 // check physics table size 00163 if ( tempTable->size() != converter->size()){ 00164 #ifdef G4VERBOSE 00165 if (verboseLevel>0) { 00166 G4cerr << "G4PhysicsTableHelper::RetrievePhysicsTable "; 00167 G4cerr << "Size of the physics table in "<< fileName; 00168 G4cerr << "( size =" << tempTable->size() << ")"; 00169 G4cerr << " is inconsistent with material-cut info"; 00170 G4cerr << "( size =" << converter->size() << ")"; 00171 G4cerr << G4endl; 00172 } 00173 #endif 00174 G4Exception( "G4ProductionCutsTable::RetrievePhysicsTable()", 00175 "ProcCuts106", 00176 JustWarning, "Retrived file is inconsistent with current physics tables "); 00177 delete tempTable; 00178 return false; 00179 } 00180 00181 // fill the given physics table with retrived physics vectors 00182 for (size_t idx=0; idx<converter->size(); idx++){ 00183 if (converter->IsUsed(idx)){ 00184 if (converter->GetIndex(idx)<0) continue; 00185 size_t i = converter->GetIndex(idx); 00186 G4PhysicsVector* vec = (*physTable)[i]; 00187 if (vec !=0 ) delete vec; 00188 (*physTable)[i] = (*tempTable)[idx]; 00189 physTable->ClearFlag(i); 00190 } 00191 } 00192 tempTable->clear(); 00193 delete tempTable; 00194 00195 return true; 00196 }
void G4PhysicsTableHelper::SetPhysicsVector | ( | G4PhysicsTable * | physTable, | |
size_t | idx, | |||
G4PhysicsVector * | vec | |||
) | [static] |
Definition at line 199 of file G4PhysicsTableHelper.cc.
References G4PhysicsTable::ClearFlag(), G4cerr, G4endl, G4Exception(), JustWarning, and verboseLevel.
Referenced by G4PolarizedCompton::BuildAsymmetryTable(), G4eplusPolarizedAnnihilation::BuildAsymmetryTable(), G4VEnergyLossProcess::BuildDEDXTable(), G4LossTableBuilder::BuildDEDXTable(), G4LossTableBuilder::BuildInverseRangeTable(), G4VEnergyLossProcess::BuildLambdaTable(), G4LossTableBuilder::BuildRangeTable(), and G4LossTableBuilder::BuildTableForModel().
00202 { 00203 if ( physTable ==0) { return; } 00204 00205 if ( physTable->size() <= idx) { 00206 #ifdef G4VERBOSE 00207 if (verboseLevel>0) { 00208 G4cerr << "G4PhysicsTableHelper::SetPhysicsVector "; 00209 G4cerr << "Given index (" << idx << ") exceeds "; 00210 G4cerr << "size of the physics table "; 00211 G4cerr << "( size =" << physTable->size()<< ")"; 00212 G4cerr << G4endl; 00213 } 00214 #endif 00215 G4Exception( "G4ProductionCutsTable::SetPhysicsVector()", 00216 "ProcCuts107", 00217 JustWarning, "Illegal index "); 00218 return; 00219 } 00220 00221 // set physics vector 00222 (*physTable)[idx] = vec; 00223 // clear flag 00224 physTable->ClearFlag(idx); 00225 00226 00227 }
void G4PhysicsTableHelper::SetVerboseLevel | ( | G4int | value | ) | [inline, static] |
Definition at line 92 of file G4PhysicsTableHelper.hh.
References verboseLevel.
00093 { 00094 verboseLevel = value; 00095 }
G4int G4PhysicsTableHelper::verboseLevel = 1 [static, protected] |
Definition at line 87 of file G4PhysicsTableHelper.hh.
Referenced by GetVerboseLevel(), PreparePhysicsTable(), RetrievePhysicsTable(), SetPhysicsVector(), and SetVerboseLevel().