Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:27

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 // 
0027 // Author: Haegin Han
0028 // Reference: ICRP Publication 145. Ann. ICRP 49(3), 2020.
0029 // Geant4 Contributors: J. Allison and S. Guatelli
0030 //
0031 #ifndef TETModelImport_h
0032 #define TETModelImport_h 1
0033 
0034 #include <stdlib.h>
0035 #include <fstream>
0036 #include <sstream>
0037 #include <iomanip>
0038 #include <vector>
0039 #include <map>
0040 
0041 #include "G4UIExecutive.hh"
0042 #include "G4SystemOfUnits.hh"
0043 #include "G4PhysicalConstants.hh"
0044 #include "G4ThreeVector.hh"
0045 #include "G4String.hh"
0046 #include "G4Tet.hh"
0047 #include "G4NistManager.hh"
0048 #include "G4Material.hh"
0049 #include "G4Colour.hh"
0050 
0051 // *********************************************************************
0052 // This class imports the phantom data from *.ele, *.node, and
0053 // *.material files.
0054 // -- DataRead: Construct G4Tet by reading data from *.ele and *.node
0055 //              files
0056 // -- MaterialRead: Construct G4Material by reading material data from
0057 //                  *.material file
0058 // -- ColourRead: Construct std::map that contains G4Colour data
0059 //                according to data in colour.dat file
0060 // -- PrintMaterialInformation: Print a table that contains organ ID,
0061 //                              number of tetrahedrons, volume, density,
0062 //                              mass, and name for each organ
0063 // *********************************************************************
0064 
0065 class TETModelImport
0066 {
0067 public:
0068  TETModelImport(G4bool isAF, G4UIExecutive* ui);
0069  virtual ~TETModelImport() {};
0070  
0071  // get methods
0072  G4String      GetPhantomName()           { return fPhantomName; };
0073  G4Material*   GetMaterial(G4int idx)     { return fMaterialMap[idx];}
0074  G4int         GetNumTetrahedron()        { return fTetVector.size();}
0075  G4int         GetMaterialIndex(G4int idx){ return fMaterialVector[idx]; }
0076  G4Tet*        GetTetrahedron(G4int idx)  { return fTetVector[idx]; }
0077  G4double      GetVolume(G4int idx)       { return fVolumeMap[idx]; }
0078  std::map<G4int, G4double> GetMassMap()   { return fMassMap; }
0079  std::map<G4int, G4Colour> GetColourMap() { return fColourMap; }
0080  G4ThreeVector GetPhantomSize()           { return fPhantomSize; }
0081  G4ThreeVector GetPhantomBoxMin()         { return fBoundingBox_Min; }
0082  G4ThreeVector GetPhantomBoxMax()         { return fBoundingBox_Max; }
0083 
0084 private:
0085  // private methods
0086  void DataRead(G4String, G4String);
0087  void MaterialRead(G4String);
0088  void ColourRead();
0089  void PrintMaterialInfomation();
0090 
0091  G4String fPhantomDataPath;
0092  G4String fPhantomName;
0093 
0094  G4ThreeVector fBoundingBox_Min;
0095  G4ThreeVector fBoundingBox_Max;
0096  G4ThreeVector fPhantomSize;
0097 
0098  std::vector<G4ThreeVector> fVertexVector;
0099  std::vector<G4Tet*>        fTetVector;
0100  std::vector<G4int*>        fEleVector;
0101  std::vector<G4int>         fMaterialVector;
0102  std::map<G4int, G4int>     fNumTetMap;
0103  std::map<G4int, G4double>  fVolumeMap;
0104  std::map<G4int, G4double>  fMassMap;
0105  std::map<G4int, G4Colour>  fColourMap;
0106 
0107  std::map<G4int, std::vector<std::pair<G4int, G4double>>> fMaterialIndexMap;
0108  std::vector<G4int>                                       fMaterialIndex;
0109  std::map<G4int, G4Material*>                             fMaterialMap;
0110  std::map<G4int, G4double>                                fDensityMap;
0111  std::map<G4int, G4String>                                fOrganNameMap;
0112 };
0113 
0114 #endif