82 G4cout <<
"HadrontherapyMatrix: Memory space to store physical dose into " <<
84 " voxels has been allocated " <<
G4endl;
86 else G4Exception(
"HadrontherapyMatrix::HadrontherapyMatrix()",
"Hadrontherapy0005",
FatalException,
"Can't allocate memory to store physical dose!");
106 for (
size_t i=0; i<
ionStore.size(); i++)
131 for (
size_t i=0; i<
ionStore.size(); i++)
160 if ( (energyDeposit <=0. && !fluence) || !
secondary)
return false;
162 G4int PDGencoding = particleDef -> GetPDGEncoding();
163 PDGencoding -= PDGencoding%10;
166 for (
size_t l=0; l <
ionStore.size(); l++)
168 if (
ionStore[l].PDGencoding == PDGencoding )
170 if ( (trackID ==1 &&
ionStore[l].isPrimary) || (trackID !=1 && !
ionStore[l].isPrimary))
172 if (energyDeposit > 0.)
ionStore[l].dose[
Index(i, j, k)] += energyDeposit;
181 G4int Z = particleDef-> GetAtomicNumber();
182 G4int A = particleDef-> GetAtomicMass();
184 G4String fullName = particleDef -> GetParticleName();
185 G4String name = fullName.substr (0, fullName.find(
"[") );
189 (trackID == 1) ?
true:
false,
206 if (energyDeposit > 0.) newIon.
dose[
Index(i, j, k)] += energyDeposit;
238 ofs.open(file, std::ios::out);
247 if (psize ==
sizeof(
unsigned int))
249 unsigned int* pdata = (
unsigned int*)data;
250 if (pdata[n])
ofs << i <<
'\t' << j <<
'\t' <<
251 k <<
'\t' << pdata[
n] <<
G4endl;
256 if (pdata[n])
ofs << i <<
'\t' << j <<
'\t' <<
257 k <<
'\t' << pdata[
n] <<
G4endl;
268 for (
size_t i=0; i <
ionStore.size(); i++){
276 for (
size_t i=0; i <
ionStore.size(); i++){
298 ofs << std::setw(
width) <<
"Dose(Gy)";
301 for (
size_t l=0; l <
ionStore.size(); l++)
336 ofs << i <<
'\t' << j <<
'\t' << k <<
'\t';
341 for (
size_t l=0; l <
ionStore.size(); l++)
355 #ifdef G4ANALYSIS_USE_ROOT
356 void HadrontherapyMatrix::StoreDoseFluenceRoot()
359 if (analysis -> IsTheTFile())
366 for (
size_t l=0; l <
ionStore.size(); l++)
370 analysis -> FillVoxelFragmentTuple( i, j, k,
397 #ifdef G4ANALYSIS_USE_ROOT
407 #ifdef G4ANALYSIS_USE_ROOT
409 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
G4int * GetHitTrack(G4int i, G4int j, G4int k)
G4bool Fill(G4int, G4ParticleDefinition *particleDef, G4int i, G4int j, G4int k, G4double energyDeposit, G4bool fluence=false)
static const G4double A[nN]
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