76 G4cout <<
"HadrontherapyMatrix: Memory space to store physical dose into " <<
78 " voxels has been allocated " <<
G4endl;
80 else G4Exception(
"HadrontherapyMatrix::HadrontherapyMatrix()",
"Hadrontherapy0005",
FatalException,
"Can't allocate memory to store physical dose!");
100 for (
size_t i=0; i<
ionStore.size(); i++)
125 for (
size_t i=0; i<
ionStore.size(); i++)
154 if ( (energyDeposit <=0. && !fluence) || !
secondary)
return false;
156 G4int PDGencoding = particleDef -> GetPDGEncoding();
157 PDGencoding -= PDGencoding%10;
160 for (
size_t l=0; l <
ionStore.size(); l++)
162 if (
ionStore[l].PDGencoding == PDGencoding )
164 if ( (trackID ==1 &&
ionStore[l].isPrimary) || (trackID !=1 && !
ionStore[l].isPrimary))
166 if (energyDeposit > 0.)
ionStore[l].dose[
Index(i, j, k)] += energyDeposit;
175 G4int Z = particleDef-> GetAtomicNumber();
176 G4int A = particleDef-> GetAtomicMass();
178 G4String fullName = particleDef -> GetParticleName();
179 G4String name = fullName.substr (0, fullName.find(
"[") );
183 (trackID == 1) ?
true:
false,
200 if (energyDeposit > 0.) newIon.
dose[
Index(i, j, k)] += energyDeposit;
232 ofs.open(file, std::ios::out);
241 if (psize ==
sizeof(
unsigned int))
243 unsigned int* pdata = (
unsigned int*)data;
244 if (pdata[n])
ofs << i <<
'\t' << j <<
'\t' <<
245 k <<
'\t' << pdata[
n] <<
G4endl;
250 if (pdata[n])
ofs << i <<
'\t' << j <<
'\t' <<
251 k <<
'\t' << pdata[
n] <<
G4endl;
262 for (
size_t i=0; i <
ionStore.size(); i++){
270 for (
size_t i=0; i <
ionStore.size(); i++){
292 ofs << std::setw(
width) <<
"Dose(Gy)";
295 for (
size_t l=0; l <
ionStore.size(); l++)
330 ofs << i <<
'\t' << j <<
'\t' << k <<
'\t';
335 for (
size_t l=0; l <
ionStore.size(); l++)
349 #ifdef G4ANALYSIS_USE_ROOT
350 void HadrontherapyMatrix::StoreDoseFluenceRoot()
353 if (analysis -> IsTheTFile())
360 for (
size_t l=0; l <
ionStore.size(); l++)
364 analysis -> FillVoxelFragmentTuple( i, j, k,
391 #ifdef G4ANALYSIS_USE_ROOT
401 #ifdef G4ANALYSIS_USE_ROOT
403 if (analysis -> IsTheTFile() )
static HadrontherapyAnalysisManager * GetInstance()
Get the pointer to the analysis manager.
G4int Index(G4int i, G4int j, G4int k)
void StoreDoseFluenceAscii(G4String filename="")
G4int numberOfVoxelAlongY
G4int numberOfVoxelAlongZ
static HadrontherapyMatrix * GetInstance()
void StoreMatrix(G4String file, void *data, size_t psize)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
G4int * GetHitTrack(G4int i, G4int j, G4int k)
G4bool Fill(G4int, G4ParticleDefinition *particleDef, G4int i, G4int j, G4int k, G4double energyDeposit, G4bool fluence=false)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
HadrontherapyMatrix(G4int numberOfVoxelAlongX, G4int numberOfVoxelAlongY, G4int numberOfVoxelAlongZ, G4double massOfVoxel)
void TotalEnergyDeposit()
A class for connecting the simulation to an analysis package.
static HadrontherapyMatrix * instance
std::vector< ion > ionStore
G4int numberOfVoxelAlongX