Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/hadrontherapy/include/HadrontherapyLet.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Hadrontherapy advanced example for Geant4
0027 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
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;        // True if particle is primary
0043     G4int PDGencoding;      // Particle data group id for the particle
0044     G4String fullName;      // AZ[excitation energy]: like He3[1277.4], He4[0.0], Li7[231.4], ...
0045     G4String name;          // simple name without excitation energy: He3, He4, Li7, ...
0046     G4int Z;                // atomic number
0047     G4int A;            // mass number
0048     G4double *letDN , *letDD, *letTN , *letTD; // Track averaged LET and Dose averaged LET
0049     //friend G4bool operator<(const ionLet& a, const ionLet& b) {return (a.Z == b.Z) ? b.A < a.A : b.Z < a.Z ;}
0050     G4bool operator<(const ionLet& a) const{return (this->Z == a.Z) ? this-> A < a.A : this->Z < a.Z ;}
0051     // For isotopes sort by the mass number, else sort by the atomic one.
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     // Detector material
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 };