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 #ifndef MOLECULAR_ANALYSIS_MANAGER_HH 28 #define MOLECULAR_ANALYSIS_MANAGER_HH 29 30 #include "G4AnalysisManager.hh" 31 #include "G4Electron_aq.hh" 32 #include "G4Hydrogen.hh" 33 #include "G4OH.hh" 34 #include "G4RootAnalysisManager.hh" 35 #include "G4ThreeVector.hh" 36 #include "globals.hh" 37 38 #include <map> 39 #include <vector> 40 41 class ChromosomeHit; 42 43 class DNAHit; 44 45 class AnalysisMessenger; 46 47 class DNAGeometry; 48 49 struct BasePairDamageRecord 50 { 51 G4double fStrand1Energy = 0; 52 G4double fStrand2Energy = 0; 53 G4double fBp1Energy = 0; 54 G4double fBp2Energy = 0; 55 G4bool fBp1IndirectDmg = false; 56 G4bool fBp2IndirectDmg = false; 57 G4bool fStrand1IndirectDmg = false; 58 G4bool fStrand2IndirectDmg = false; 59 G4bool fBp1IndirectEvt = false; 60 G4bool fBp2IndirectEvt = false; 61 G4bool fStrand1IndirectEvt = false; 62 G4bool fStrand2IndirectEvt = false; 63 G4bool fbp1DirectDmg = false; 64 G4bool fbp2DirectDmg = false; 65 G4bool fStrand1DirectDmg = false; 66 G4bool fStrand2DirectDmg = false; 67 G4bool fbp1InducedBreak = false; 68 G4bool fbp2InducedBreak = false; 69 }; 70 71 // exp 72 enum complexityEnum 73 { 74 SSB, 75 SSBplus, 76 twoSSB, 77 DSB, 78 DSBplus, 79 DSBplusplus, 80 NoneComplexity 81 }; 82 83 enum sourceEnum 84 { 85 SSBd, 86 SSBi, 87 SSBm, 88 DSBh, 89 DSBm, 90 DSBd, 91 DSBi, 92 undefined 93 }; 94 // 95 96 struct DamageClassification 97 { 98 complexityEnum fComplexity = NoneComplexity; 99 sourceEnum fSource = undefined; 100 G4int fbaseDmg = 0; 101 G4int fStrandDmg = 0; 102 G4int fDirectBreaks = 0; 103 G4int fIndirectBreaks = 0; 104 G4int fInducedBreaks = 0; 105 }; 106 107 class DamageRecord 108 { 109 public: 110 DamageRecord(const G4String&, int64_t, G4int, G4int); // dousatsu 111 ~DamageRecord(); 112 113 void AddBasePairDamage(BasePairDamageRecord* bp, const G4ThreeVector& pos) 114 { 115 fDamageRecords.push_back(bp); 116 fPositions.push_back(pos); 117 }; 118 119 void AddEmptyBPDamage(int64_t ii); 120 121 void AddStrandHit(const G4MoleculeDefinition* mol); 122 123 void AddBaseHit(const G4MoleculeDefinition* mol); 124 125 void PrintRecord(const G4String&, const G4double& dsbDistance = 10); 126 127 DamageClassification* GetClassification(const G4double& dsbDistance = 10); 128 129 inline const G4String& GetName() const { return fName; }; 130 131 int64_t GetSize() const { return fDamageRecords.size(); }; // dousatsu 132 133 inline G4int GetOHBaseHits() const { return fOHBase; }; 134 135 inline G4int GetEaqBaseHits() const { return fEaqBase; }; 136 137 inline G4int GetHBaseHits() const { return fHBase; }; 138 139 inline G4int GetOHStrandHits() const { return fOHStrand; }; 140 141 inline G4int GetEaqStrandHits() const { return fEaqStrand; }; 142 143 inline G4int GetHStrandHits() const { return fHStrand; }; 144 145 inline G4int GetPlacementIdx() const { return fStartPlacement; }; 146 147 inline G4int GetChainIdx() const { return fChainIdx; }; 148 149 inline G4int GetStrandIdx() const { return fStrandIdx; }; 150 151 inline int64_t GetStartBPIdx() const { return fStartIndex; }; // dousatsu 152 void AddTestDamage(G4int, G4int, G4int, G4int); 153 154 G4ThreeVector GetMeanPosition() const; 155 156 G4double GetMeanDistance() const; 157 158 G4double GetEnergy() const; 159 160 private: 161 G4String fName; 162 int64_t fStartIndex; 163 G4int fStartPlacement, fChainIdx, fStrandIdx = 0; 164 G4int fOHBase = 0, fOHStrand = 0, fHBase = 0, fHStrand = 0, fEaqBase = 0, fEaqStrand = 0; 165 std::vector<BasePairDamageRecord*> fDamageRecords; 166 std::vector<G4ThreeVector> fPositions; 167 168 const G4MoleculeDefinition* fOH = G4OH::Definition(); 169 const G4MoleculeDefinition* fe_aq = G4Electron_aq::Definition(); 170 const G4MoleculeDefinition* fH = G4Hydrogen::Definition(); 171 172 static const char* fDirectDamageChar; 173 static const char* fIndirectDamageChar; 174 static const char* fHitNoDamageChar; 175 static const char* fNotHitChar; 176 static const char* fBothDamageChar; 177 178 const char* GetChar(const G4bool&, const G4bool&, const G4double&); 179 }; 180 181 struct Node 182 { 183 int64_t fkey; 184 DNAHit* fdata; 185 Node* fleft; 186 Node* fright; 187 Node* fparent; 188 }; 189 190 // A binary tree is used to order the DNA hit objects 191 // It creates internal copies of all DNA Hits passed to it and then 192 // deletes them 193 class BinaryTree 194 { 195 public: 196 BinaryTree(); 197 198 virtual ~BinaryTree(); 199 200 void Insert(const DNAHit*); 201 202 DNAHit* Search(int64_t); 203 204 void Destroy_tree(); 205 206 // return left-most node 207 DNAHit* First() const; 208 209 // Return next node with higher key 210 DNAHit* Next(const DNAHit*) const; 211 212 private: 213 void Destroy_tree_(Node*); 214 215 void Insert_(DNAHit*, Node*); 216 217 DNAHit* Search_(int64_t, Node*); 218 219 DNAHit* First_(Node*) const; 220 221 DNAHit* Next_(int64_t, Node*) const; 222 223 Node* fRoot; 224 }; 225 226 class AnalysisManager 227 { 228 public: 229 AnalysisManager(); 230 231 virtual ~AnalysisManager(); 232 233 void Initialize(); 234 235 void ProcessDNAHitsVector(const std::vector<const DNAHit*>&); 236 237 void ProcessChromosomeHitMap(const std::map<uint32_t, ChromosomeHit*>&); 238 239 void ProcessPrimary(const G4ThreeVector&, const G4double&, const G4double&); 240 241 void ProcessCellEdep(const G4double&); // dousatsu 242 void Close(); 243 244 inline void SetSaveStrands(const G4bool strand) { fSaveStrands = strand; }; 245 246 inline void SetStrandDirectory(const G4String& dir) { fStrandDirectory = dir; }; 247 248 inline void SetFragmentGap(G4int gap) { fFragmentGap = gap; }; 249 250 inline void SetDSBDistance(G4int gap) { fDSBDistance = gap; }; 251 252 inline void SetChainToSave(G4int i) { fChainToSave = i; }; 253 254 inline void SetFileName(const G4String& name) { fFileName = name; }; 255 256 void TestClassification(); 257 258 private: 259 G4AnalysisManager* fAnalysisManager; 260 G4bool fSaveStrands = false; 261 G4String fStrandDirectory = "./"; 262 G4String fFileName = "molecular-dna"; 263 G4int fFragmentGap = 100; 264 G4int fDSBDistance = 10; 265 G4int fChainToSave = -1; 266 DNAGeometry* fpDNAGeometry = nullptr; 267 AnalysisMessenger* fpAnalysisMessenger; 268 }; 269 270 #endif // MOLECULAR_ANALYSIS_MANAGER_HH 271