File indexing completed on 2025-11-03 09:03:15
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 #ifndef HadrontherapyLet_h
0030 #define HadrontherapyLet_h 1
0031 #endif
0032 
0033 #include "G4ParticleDefinition.hh"
0034 #include "globals.hh"
0035 #include <fstream>
0036 #include <vector>
0037 #include <string>
0038 
0039 #include "HadrontherapyMatrix.hh"
0040 struct ionLet
0041 {
0042     G4bool isPrimary;        
0043     G4int PDGencoding;      
0044     G4String fullName;      
0045     G4String name;          
0046     G4int Z;                
0047     G4int A;            
0048     G4double *letDN , *letDD, *letTN , *letTD; 
0049     
0050     G4bool operator<(const ionLet& a) const{return (this->Z == a.Z) ? this-> A < a.A : this->Z < a.Z ;}
0051     
0052 };
0053 
0054 class G4Material;
0055 class HadrontherapyMatrix;
0056 class HadrontherapyPrimaryGeneratorAction;
0057 class HadrontherapyInteractionParameters;
0058 class HadrontherapyDetectorConstruction;
0059 
0060 class HadrontherapyLet
0061 {
0062 private:
0063     HadrontherapyLet(HadrontherapyDetectorConstruction*);
0064     
0065 public:
0066     ~HadrontherapyLet();
0067     static HadrontherapyLet* GetInstance(HadrontherapyDetectorConstruction*);
0068     static HadrontherapyLet* GetInstance();
0069     static G4bool doCalculation;
0070     void Initialize();
0071     void Clear();
0072     
0073     void Fill(G4int i, G4int j, G4int k, G4double DE, G4double DX);
0074     void FillEnergySpectrum (G4int trackID,
0075                              G4ParticleDefinition* particleDef,
0076                              G4double ekinMean,
0077                              const G4Material* mat,
0078                              G4double DE,
0079                              G4double DEEletrons,
0080                              G4double DX,
0081                              G4int i, G4int j, G4int k);
0082     void LetOutput();
0083     void StoreLetAscii();
0084     
0085     
0086 private:
0087     static HadrontherapyLet *instance;
0088     HadrontherapyPrimaryGeneratorAction* pPGA;
0089     
0090     G4Material* detectorMat;
0091     G4double density;
0092     G4String filename;
0093     
0094     std::ofstream ofs;
0095     std::ofstream stopFile;
0096     HadrontherapyMatrix *matrix;
0097     G4int nVoxels, numberOfVoxelAlongX, numberOfVoxelAlongY, numberOfVoxelAlongZ ;
0098     G4double primaryEnergy, energyLimit, binWidth;
0099     G4int nBins;
0100     G4double  nT, dT, nD, dD;
0101     G4double  nSecondaryT, nSecondaryD, dSecondaryT, dSecondaryD;
0102     G4double  nPrimaryT, nPrimaryD, dPrimaryT, dPrimaryD ;
0103     G4double *secondaryLetT,  *secondaryLetD, *totalLetT, *DtotalLetT , *DtotalLetD, *totalLetD;
0104     G4String nome_file;
0105     
0106     std::vector<ionLet> ionLetStore;
0107 };