42     if (instance) 
delete instance;
 
   58     if (!matrix) 
G4Exception(
"HadrontherapyLet::HadrontherapyLet",
"Hadrontherapy0005", 
FatalException, 
"HadrontherapyMatrix not found. Firstly create an instance of it.");
 
   60     nVoxels = matrix -> GetNvoxel();
 
   62     numberOfVoxelAlongX = matrix -> GetNumberOfVoxelAlongX();
 
   63     numberOfVoxelAlongY = matrix -> GetNumberOfVoxelAlongY();
 
   64     numberOfVoxelAlongZ = matrix -> GetNumberOfVoxelAlongZ();
 
   69     detectorMat = pDet -> GetDetectorLogicalVolume() -> GetMaterial();
 
   70     density = detectorMat -> GetDensity();
 
   86     for(
G4int v=0; 
v < nVoxels; 
v++) totalLetD[
v] = DtotalLetD[
v] = 0.;
 
   94     for (
size_t i=0; i < ionLetStore.size(); i++)
 
   96         delete [] ionLetStore[i].letDN;
 
   97         delete [] ionLetStore[i].letDD;
 
  108     if (DE <= 0. || DX <=0.) 
return;
 
  110     G4int Z = particleDef -> GetAtomicNumber();
 
  113     G4int PDGencoding = particleDef -> GetPDGEncoding();
 
  114     PDGencoding -= PDGencoding%10;
 
  116     G4int voxel = matrix -> Index(i,j,k);
 
  118     totalLetD[voxel]  += DE*(DE/DX);
 
  119     DtotalLetD[voxel] += DE;
 
  125         for (l=0; l < ionLetStore.size(); l++) 
 
  127             if (ionLetStore[l].PDGencoding == PDGencoding) 
 
  128               if ( ((trackID ==1) && (ionLetStore[l].isPrimary)) || ((trackID !=1) && (!ionLetStore[l].isPrimary)))
 
  132         if (l == ionLetStore.size()) 
 
  135             G4int A = particleDef -> GetAtomicMass();
 
  137             G4String fullName = particleDef -> GetParticleName();
 
  138             G4String name = fullName.substr (0, fullName.find(
"[") ); 
 
  142                 (trackID == 1) ? 
true:
false, 
 
  154             ionLetStore.push_back(ion);
 
  158         ionLetStore[l].letDN[voxel] += DE*(DE/DX);
 
  159         ionLetStore[l].letDD[voxel] += DE;
 
  168     for(
G4int v=0; v < nVoxels; v++) if (DtotalLetD[v]>0.) totalLetD[
v] = totalLetD[
v]/DtotalLetD[
v];
 
  170     std::sort(ionLetStore.begin(), ionLetStore.end());
 
  175         for (
size_t ion=0; 
ion < ionLetStore.size(); 
ion++)
 
  177             if (ionLetStore[
ion].letDD[
v] >0.) ionLetStore[
ion].letDN[
v] = ionLetStore[
ion].letDN[
v] / ionLetStore[
ion].letDD[
v];
 
  187     if(ionLetStore.size())
 
  189         ofs.open(filename, std::ios::out);
 
  194             ofs << std::setprecision(6) << 
std::left <<
 
  196             ofs <<  std::setw(
width) << 
"LDT"; 
 
  197             for (
size_t l=0; l < ionLetStore.size(); l++)
 
  199                 G4String a = (ionLetStore[l].isPrimary) ? 
"_1":
"";
 
  200                 ofs << std::setw(
width) << ionLetStore[l].name  + 
a ;
 
  205             for(
G4int i = 0; i < numberOfVoxelAlongX; i++) 
 
  206                 for(
G4int j = 0; j < numberOfVoxelAlongY; j++) 
 
  207                     for(
G4int k = 0; k < numberOfVoxelAlongZ; k++) 
 
  209                         G4int v = matrix -> Index(i, j, k);
 
  211                         for (
size_t l=0; l < ionLetStore.size(); l++)
 
  214                             if(ionLetStore[l].letDN)
 
  217                                 ofs << i << 
'\t' << j << 
'\t' << k << 
'\t';
 
  219                                 ofs << std::setw(
width) << totalLetD[
v]/(
keV/um); 
 
  220                                 for (
size_t ll=0; ll < ionLetStore.size(); ll++)
 
  222                                     ofs << std::setw(
width) << ionLetStore[ll].letDN[
v]/(
keV/um) ; 
 
  229                         G4cout << 
"Let is being written to " << filename << 
G4endl;
 
  237 #ifdef G4ANALYSIS_USE_ROOT 
  241     for(
G4int i = 0; i < numberOfVoxelAlongX; i++) 
 
  242     for(
G4int j = 0; j < numberOfVoxelAlongY; j++) 
 
  243         for(
G4int k = 0; k < numberOfVoxelAlongZ; k++) 
 
  245         G4int v = matrix -> Index(i, j, k);
 
  246         for (
size_t ion=0; 
ion < ionLetStore.size(); 
ion++)
 
  249             analysis -> FillLetFragmentTuple( i, j, k, ionLetStore[
ion].A, ionLetStore[
ion].Z, ionLetStore[
ion].letDN[v]);
 
static G4bool doCalculation
 
void FillEnergySpectrum(G4int trackID, G4ParticleDefinition *particleDef, G4double DE, G4double DX, G4int i, G4int j, G4int k)
 
static HadrontherapyAnalysisManager * GetInstance()
 
static HadrontherapyLet * GetInstance()
 
static HadrontherapyMatrix * GetInstance()
 
G4GLOB_DLL std::ostream G4cout
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
static G4RunManager * GetRunManager()