Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:59

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 //
0028 /// \file SDDData.hh
0029 /// \brief Definition of the SDDData class
0030 
0031 #ifndef SDDDATA_HH
0032 #define SDDDATA_HH
0033 
0034 #include <string>
0035 #include <vector>
0036 #include <sstream>
0037 #include <map>
0038 #include "Damage.hh"
0039 
0040 class SDDData
0041 {
0042 public:
0043 
0044 /** SDD header structure
0045  *
0046  *  Define the content of SSD file header
0047  */
0048     struct SDDHeader 
0049     {  
0050         std::string        sdd_version{""};
0051 
0052         std::string         software{""};
0053 
0054         std::string         author{""};
0055 
0056         std::string         sim_details{""};
0057 
0058         std::string         src_details{""};
0059         int                 src_type{0};
0060         std::vector<int>    src_pdg;
0061         std::vector<double> src_energy;
0062         std::string         energy_dist{""};
0063         std::vector<double> part_fraction;
0064         std::vector<double> dose;
0065         double              dose_rate{0};
0066 
0067         std::string         target{""};
0068         std::vector<double> volumes;
0069         std::vector<double> chromo_size;
0070         double              dna_density{0};
0071 
0072         std::vector<double> cell_cycle;
0073         std::vector<int>    dna_struct;
0074         int                 vitro_vivo{0};
0075         std::string         proliferation{""};
0076         std::vector<double> microenv;
0077 
0078         std::vector<double> damage_def;
0079         double              time{0};
0080         std::vector<int>    damage_prim_count;
0081 
0082         std::vector<bool>   entries;
0083 
0084         std::string         info{""};
0085     }; 
0086 
0087 /** SDD damage structure
0088  *
0089  *  Define the content of a damage as stored in SDD file
0090  */
0091     struct SDDDamage
0092     {
0093         std::vector<int>        classification;
0094         std::vector<double>     coordinates;
0095         std::vector<int>        chromo_ID;
0096         std::vector<double>     chromo_position;
0097         std::vector<int>        cause;
0098         std::vector<int>        types;
0099 
0100         std::vector<int>        break_spec;
0101         std::vector<int>        dna_seq;
0102         std::vector<double>     lesion_time;
0103 
0104         std::vector<int>        particles;
0105         std::vector<double>     energy;
0106         std::vector<double>     translation;
0107         std::vector<double>     direction;
0108         std::vector<double>     particle_time;
0109     }; 
0110 
0111     /** Constructor */
0112     SDDData(std::string /*p_name*/);
0113     /** Destructor */
0114     ~SDDData() = default;
0115 
0116     /** Read header
0117     *   Reads and returns the header of a SDD file
0118     */
0119     SDDHeader ReadHeader();
0120 
0121     /** Chromosome sizes
0122     * Returns the list of sizes of each chromosome in the cell geometry
0123     */
0124     std::map<int,unsigned long long int> GetChromosomeBpSizesMap(double &sum);
0125 
0126     /** Dose
0127     * Returns the absorbed dose
0128     */
0129     double GetDose();
0130 
0131     /** Parse data
0132     *   Parse data of SDD files and stores the data
0133     *   as SDDDamage in data_
0134     */
0135     void ParseData();
0136     /** Get SDD damage
0137     *   Returns all the SDD damage (i.e. data_)
0138     */
0139     std::vector<SDDDamage>& GetSDDDamage(){return data_;};
0140 
0141     /** Get Damage
0142     *   Returns all the damage that have been converted into lighter object
0143     *   see Damage class
0144     */
0145     std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > GetAllDamage();
0146 
0147 private:
0148 
0149     std::string filename_;
0150     SDDHeader header_;
0151     std::vector<SDDDamage> data_;
0152 
0153     void ParseLineData(std::string&);
0154 
0155     void ReadString(std::ifstream&,std::string&);
0156     void ReadInt(std::ifstream&,int&);
0157     void ReadInts(std::ifstream&,std::vector<int>&);
0158     void ReadDouble(std::ifstream&,double&);
0159     void ReadDoubles(std::ifstream&,std::vector<double>&);
0160     void ReadBools(std::ifstream&,std::vector<bool>&);
0161 
0162     void ExtractInts(std::string&,int,std::vector<int>&);
0163     void ExtractDoubles(std::string&,int,std::vector<double>&);
0164 
0165 };
0166 
0167 #endif // SDDDATA_HH