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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 /// \file PhysGeoImport.hh
 28 /// \brief Definition of the PhysGeoImport class
 29 
 30 #ifndef GEOIMPORT_HH
 31 #define GEOIMPORT_HH
 32 
 33 #include <map>
 34 #include <fstream>
 35 #include <algorithm>
 36 #include <array>
 37 #include "G4String.hh"
 38 #include "G4ThreeVector.hh"
 39 #include "G4Orb.hh"
 40 #include "G4Ellipsoid.hh"
 41 #include "G4EllipticalTube.hh"
 42 #include "G4VSolid.hh"
 43 #include "G4Box.hh"
 44 #include "G4SystemOfUnits.hh"
 45 #include "G4SubtractionSolid.hh"
 46 #include "G4LogicalVolume.hh"
 47 #include "G4PVPlacement.hh"
 48 #include "G4NistManager.hh"
 49 #include "G4VisAttributes.hh"
 50 #include "G4IntersectionSolid.hh"
 51 
 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 53 
 54 struct Molecule
 55 {
 56     Molecule(G4String name, G4int copyNumber, G4ThreeVector position, 
 57     G4double radius, G4double waterRadius, G4String material, G4int strand)
 58     {
 59         fName = name;
 60         fMaterial = material;
 61         fCopyNumber = copyNumber;
 62         fPosition = position;
 63         fRadius = radius;
 64         fRadiusWater = waterRadius;
 65         fStrand = strand;
 66     }
 67 
 68     G4String fName{""};
 69     G4String fMaterial{""};
 70 
 71     G4int fCopyNumber{-1};
 72     G4int fStrand{-1};
 73 
 74     G4ThreeVector fPosition;
 75 
 76     G4double fRadius{0.};
 77     G4double fRadiusWater{0.};
 78 
 79     // To sort the molecules in function of their z coordinate
 80     G4bool operator<(const Molecule& str) const
 81     {
 82         return (fPosition.z() < str.fPosition.z() );
 83     }
 84 };
 85 
 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 87 
 88 struct Voxel
 89 {
 90     enum VoxelType
 91     {
 92   Straight,
 93         Left,
 94         Right,
 95         Up,
 96         Down,
 97         Straight2,
 98         Left2,
 99         Right2,
100         Up2,
101         Down2,
102         Other
103     };
104 
105     Voxel(G4int copyNumber, G4int chromoNum, G4int domainNum, 
106     VoxelType type, const G4ThreeVector& pos, G4RotationMatrix* rot)
107     {
108         fCopyNumber = copyNumber;
109         fChromoNum = chromoNum;
110         fDomainNum = domainNum;
111         fType = type;
112         fPos = pos;
113         fpRot = rot;
114     }
115 
116     G4int fCopyNumber{0};
117     G4int fChromoNum{0};
118     G4int fDomainNum{0};
119     G4ThreeVector fPos;
120     G4RotationMatrix* fpRot{nullptr};
121     VoxelType fType{VoxelType::Other};
122 };
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
126 enum ChromatinType{
127     fUnspecified = 0,
128     fHeterochromatin = 1,
129     fEuchromatin = 2,
130 };
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133 
134 class PhysGeoImport
135 {
136 public:
137     PhysGeoImport();
138     PhysGeoImport(G4bool isVisu);
139     ~PhysGeoImport() = default;
140 
141     void SetFactor(G4double factor){fFactor=factor;}
142 
143     G4double GetFactor() const {return fFactor;}
144 
145     G4String GetGeoName() const {return fGeoName;}
146 
147     // This method will trigger the parse of the file and the build of the geometry
148     G4LogicalVolume* CreateLogicVolume(const G4String& fileName, G4String& voxelName);
149 
150     G4LogicalVolume* CreateNucleusLogicVolume(const G4String& fileName);
151 
152     std::vector<Voxel>* CreateVoxelsData(const G4String& fileName);
153     std::map<G4String, G4int> GetVoxelNbHistoneMap() {return fVoxelNbHistoneMap;}
154     std::map<G4String, G4int> GetVoxelNbBpMap() {return fVoxelNbBpMap;}
155     unsigned long long GetTotalNbBpPlacedInGeo() {return fTotalNbBpPlacedInGeo;}
156     unsigned long long GetTotalNbHistonePlacedInGeo() {return fTotalNbHistonePlacedInGeo;}
157     G4double GetNucleusVolume() {return fNucleusVolume;}
158     G4double GetVoxelFullSize() {return fSize;}
159     std::map<G4String, G4double> GetNucleusSizeData() {return fNucleusData;}
160     std::map<ChromatinType, unsigned long long> GetChromatinTypeCountMap() {return fChromatinTypeCount;}
161 private:
162 
163     G4bool fIsVisu{false};
164 
165     // Factor to scale the geometry
166     G4double fFactor{1.};
167 
168     G4double fSize{0.};
169     G4double fNucleusVolume{0.};
170     unsigned long long fTotalNbBpPlacedInGeo = 0;
171     unsigned long long fTotalNbHistonePlacedInGeo = 0;
172     G4String fGeoName="";
173 
174     G4String fNucleusName="CellNucleus";
175     G4String fNucleusType="";
176     std::map<G4String, G4double> fNucleusData;
177 
178     std::map<G4String, G4double> fRadiusMap;
179     std::map<G4String, G4double> fWaterRadiusMap;
180     std::map<G4String, G4int> fVoxelNbBpMap;
181     std::map<G4String, G4int> fVoxelNbHistoneMap;
182 
183     // Vector to contain all the molecule structures listed within the imput file
184     std::vector<Molecule> fMolecules;
185 
186     // To check if this is the first voxel of the chromosome
187     std::map<G4int, G4bool> fFirstMap;
188 
189     // Materials
190     std::vector<G4Material*> fMaterialVect;
191     G4Material* fpWater{nullptr};
192     G4Material* fTHF{nullptr};
193     G4Material* fPY{nullptr};
194     G4Material* fPU{nullptr};
195     G4Material* fTMP{nullptr};
196     G4Material* fSugarMixt{nullptr};
197     G4Material* fDeoxyribose{nullptr};
198     G4Material* fPhosphate{nullptr};
199     G4Material* fCytosine_PY{nullptr};
200     G4Material* fThymine_PY{nullptr};
201     G4Material* fGuanine_PU{nullptr};
202     G4Material* fAdenine_PU{nullptr};
203     G4Material* fHomogeneous_dna{nullptr};
204     G4Material* fVacuum{nullptr};
205     G4String  ParseFile(const G4String& fileName);
206     G4VSolid* CreateCutSolid(G4Orb *solidOrbRef,
207                              Molecule &molRef,
208                              std::vector<Molecule> &molList,
209                              G4bool in);
210     void DefineMaterial();
211 
212     std::map<ChromatinType, unsigned long long> fChromatinTypeCount;
213 };
214 
215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216 
217 #endif // GEOIMPORT_HH
218