105 G4cout <<
"HadrontherapyMatrix: Memory space to store physical dose into " <<
107 " voxels has been allocated " <<
G4endl;
111 else G4Exception(
"HadrontherapyMatrix::HadrontherapyMatrix()",
"Hadrontherapy0005",
FatalException,
"Can't allocate memory to store physical dose!");
133 for (
size_t i=0; i<
ionStore.size(); i++)
161 for (
size_t i=0; i<
ionStore.size(); i++)
198 if ( (energyDeposit <=0. && !fluence) || !
secondary)
return false;
201 G4int PDGencoding = particleDef -> GetPDGEncoding();
202 PDGencoding -= PDGencoding%10;
205 for (
size_t l=0; l <
ionStore.size(); l++)
207 if (
ionStore[l].PDGencoding == PDGencoding )
210 if ( (trackID ==1 &&
ionStore[l].isPrimary) || (trackID !=1 && !
ionStore[l].isPrimary))
212 if (energyDeposit > 0.)
224 G4int Z = particleDef-> GetAtomicNumber();
225 G4int A = particleDef-> GetAtomicMass();
226 G4String fullName = particleDef -> GetParticleName();
227 G4String name = fullName.substr (0, fullName.find(
"[") );
234 (trackID == 1) ?
true:
false,
254 if (energyDeposit > 0.) newIon.
dose[
Index(i, j, k)] += energyDeposit;
282 ofs.open(file, std::ios::out);
291 if (psize ==
sizeof(
unsigned int))
293 unsigned int* pdata = (
unsigned int*)data;
297 ofs << i <<
'\t' << j <<
'\t' << k <<
'\t' << pdata[
n] <<
G4endl;
305 if (pdata[n])
ofs << i <<
'\t' << j <<
'\t' << k <<
'\t' << pdata[
n] <<
G4endl;
317 for (
size_t i=0; i <
ionStore.size(); i++){
325 for (
size_t i=0; i <
ionStore.size(); i++){
360 ofs << std::setw(
width) <<
"Dose(Gy)";
365 for (
size_t l=0; l <
ionStore.size(); l++)
414 ofs << i <<
'\t' << j <<
'\t' << k <<
'\t';
422 for (
size_t l=0; l <
ionStore.size(); l++)
std::vector< ExP01TrackerHit * > a
static HadrontherapyAnalysisManager * instance
static HadrontherapyMatrix * GetInstance()
G4int numberOfVoxelAlongZ
G4bool SetFirstHistoId(G4int firstId)
G4bool OpenFile(const G4String &fileName="")
G4int Index(G4int i, G4int j, G4int k)
static constexpr double gray
G4bool FillNtupleIColumn(G4int id, G4int value)
G4int numberOfVoxelAlongX
G4int CreateNtupleIColumn(const G4String &name)
G4bool FillNtupleDColumn(G4int id, G4double value)
std::vector< ion > ionStore
const XML_Char const XML_Char * data
~HadrontherapyAnalysisManager()
G4bool Fill(G4int, G4ParticleDefinition *particleDef, G4int i, G4int j, G4int k, G4double energyDeposit, G4bool fluence=false)
void StoreDoseFluenceAscii(G4String filename="")
double A(double temperature)
G4int numberOfVoxelAlongY
G4int CreateNtupleDColumn(const G4String &name)
HadrontherapyAnalysisFileMessenger * fMess
void SetVerboseLevel(G4int verboseLevel)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static HadrontherapyMatrix * instance
G4GLOB_DLL std::ostream G4cout
G4int CreateNtuple(const G4String &name, const G4String &title)
G4int * GetHitTrack(G4int i, G4int j, G4int k)
static HadrontherapyAnalysisManager * GetInstance()
void StoreMatrix(G4String file, void *data, size_t psize)
HadrontherapyMatrix(G4int numberOfVoxelAlongX, G4int numberOfVoxelAlongY, G4int numberOfVoxelAlongZ, G4double massOfVoxel)
G4bool SetFirstNtupleId(G4int firstId)
HadrontherapyAnalysisManager()