Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // 28 /// \file SDDData.hh 29 /// \brief Definition of the SDDData class 30 31 #ifndef SDDDATA_HH 32 #define SDDDATA_HH 33 34 #include <string> 35 #include <vector> 36 #include <sstream> 37 #include <map> 38 #include "Damage.hh" 39 40 class SDDData 41 { 42 public: 43 44 /** SDD header structure 45 * 46 * Define the content of SSD file header 47 */ 48 struct SDDHeader 49 { 50 std::string sdd_version{""}; 51 52 std::string software{""}; 53 54 std::string author{""}; 55 56 std::string sim_details{""}; 57 58 std::string src_details{""}; 59 int src_type{0}; 60 std::vector<int> src_pdg; 61 std::vector<double> src_energy; 62 std::string energy_dist{""}; 63 std::vector<double> part_fraction; 64 std::vector<double> dose; 65 double dose_rate{0}; 66 67 std::string target{""}; 68 std::vector<double> volumes; 69 std::vector<double> chromo_size; 70 double dna_density{0}; 71 72 std::vector<double> cell_cycle; 73 std::vector<int> dna_struct; 74 int vitro_vivo{0}; 75 std::string proliferation{""}; 76 std::vector<double> microenv; 77 78 std::vector<double> damage_def; 79 double time{0}; 80 std::vector<int> damage_prim_count; 81 82 std::vector<bool> entries; 83 84 std::string info{""}; 85 }; 86 87 /** SDD damage structure 88 * 89 * Define the content of a damage as stored in SDD file 90 */ 91 struct SDDDamage 92 { 93 std::vector<int> classification; 94 std::vector<double> coordinates; 95 std::vector<int> chromo_ID; 96 std::vector<double> chromo_position; 97 std::vector<int> cause; 98 std::vector<int> types; 99 100 std::vector<int> break_spec; 101 std::vector<int> dna_seq; 102 std::vector<double> lesion_time; 103 104 std::vector<int> particles; 105 std::vector<double> energy; 106 std::vector<double> translation; 107 std::vector<double> direction; 108 std::vector<double> particle_time; 109 }; 110 111 /** Constructor */ 112 SDDData(std::string /*p_name*/); 113 /** Destructor */ 114 ~SDDData() = default; 115 116 /** Read header 117 * Reads and returns the header of a SDD file 118 */ 119 SDDHeader ReadHeader(); 120 121 /** Chromosome sizes 122 * Returns the list of sizes of each chromosome in the cell geometry 123 */ 124 std::map<int,unsigned long long int> GetChromosomeBpSizesMap(double &sum); 125 126 /** Dose 127 * Returns the absorbed dose 128 */ 129 double GetDose(); 130 131 /** Parse data 132 * Parse data of SDD files and stores the data 133 * as SDDDamage in data_ 134 */ 135 void ParseData(); 136 /** Get SDD damage 137 * Returns all the SDD damage (i.e. data_) 138 */ 139 std::vector<SDDDamage>& GetSDDDamage(){return data_;}; 140 141 /** Get Damage 142 * Returns all the damage that have been converted into lighter object 143 * see Damage class 144 */ 145 std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > GetAllDamage(); 146 147 private: 148 149 std::string filename_; 150 SDDHeader header_; 151 std::vector<SDDDamage> data_; 152 153 void ParseLineData(std::string&); 154 155 void ReadString(std::ifstream&,std::string&); 156 void ReadInt(std::ifstream&,int&); 157 void ReadInts(std::ifstream&,std::vector<int>&); 158 void ReadDouble(std::ifstream&,double&); 159 void ReadDoubles(std::ifstream&,std::vector<double>&); 160 void ReadBools(std::ifstream&,std::vector<bool>&); 161 162 void ExtractInts(std::string&,int,std::vector<int>&); 163 void ExtractDoubles(std::string&,int,std::vector<double>&); 164 165 }; 166 167 #endif // SDDDATA_HH 168