File indexing completed on 2025-02-23 09:21:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef MOLECULAR_ANALYSIS_MANAGER_HH
0028 #define MOLECULAR_ANALYSIS_MANAGER_HH
0029
0030 #include "G4AnalysisManager.hh"
0031 #include "G4Electron_aq.hh"
0032 #include "G4Hydrogen.hh"
0033 #include "G4OH.hh"
0034 #include "G4RootAnalysisManager.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "globals.hh"
0037
0038 #include <map>
0039 #include <vector>
0040
0041 class ChromosomeHit;
0042
0043 class DNAHit;
0044
0045 class AnalysisMessenger;
0046
0047 class DNAGeometry;
0048
0049 struct BasePairDamageRecord
0050 {
0051 G4double fStrand1Energy = 0;
0052 G4double fStrand2Energy = 0;
0053 G4double fBp1Energy = 0;
0054 G4double fBp2Energy = 0;
0055 G4bool fBp1IndirectDmg = false;
0056 G4bool fBp2IndirectDmg = false;
0057 G4bool fStrand1IndirectDmg = false;
0058 G4bool fStrand2IndirectDmg = false;
0059 G4bool fBp1IndirectEvt = false;
0060 G4bool fBp2IndirectEvt = false;
0061 G4bool fStrand1IndirectEvt = false;
0062 G4bool fStrand2IndirectEvt = false;
0063 G4bool fbp1DirectDmg = false;
0064 G4bool fbp2DirectDmg = false;
0065 G4bool fStrand1DirectDmg = false;
0066 G4bool fStrand2DirectDmg = false;
0067 G4bool fbp1InducedBreak = false;
0068 G4bool fbp2InducedBreak = false;
0069 };
0070
0071
0072 enum complexityEnum
0073 {
0074 SSB,
0075 SSBplus,
0076 twoSSB,
0077 DSB,
0078 DSBplus,
0079 DSBplusplus,
0080 NoneComplexity
0081 };
0082
0083 enum sourceEnum
0084 {
0085 SSBd,
0086 SSBi,
0087 SSBm,
0088 DSBh,
0089 DSBm,
0090 DSBd,
0091 DSBi,
0092 undefined
0093 };
0094
0095
0096 struct DamageClassification
0097 {
0098 complexityEnum fComplexity = NoneComplexity;
0099 sourceEnum fSource = undefined;
0100 G4int fbaseDmg = 0;
0101 G4int fStrandDmg = 0;
0102 G4int fDirectBreaks = 0;
0103 G4int fIndirectBreaks = 0;
0104 G4int fInducedBreaks = 0;
0105 };
0106
0107 class DamageRecord
0108 {
0109 public:
0110 DamageRecord(const G4String&, int64_t, G4int, G4int);
0111 ~DamageRecord();
0112
0113 void AddBasePairDamage(BasePairDamageRecord* bp, const G4ThreeVector& pos)
0114 {
0115 fDamageRecords.push_back(bp);
0116 fPositions.push_back(pos);
0117 };
0118
0119 void AddEmptyBPDamage(int64_t ii);
0120
0121 void AddStrandHit(const G4MoleculeDefinition* mol);
0122
0123 void AddBaseHit(const G4MoleculeDefinition* mol);
0124
0125 void PrintRecord(const G4String&, const G4double& dsbDistance = 10);
0126
0127 DamageClassification* GetClassification(const G4double& dsbDistance = 10);
0128
0129 inline const G4String& GetName() const { return fName; };
0130
0131 int64_t GetSize() const { return fDamageRecords.size(); };
0132
0133 inline G4int GetOHBaseHits() const { return fOHBase; };
0134
0135 inline G4int GetEaqBaseHits() const { return fEaqBase; };
0136
0137 inline G4int GetHBaseHits() const { return fHBase; };
0138
0139 inline G4int GetOHStrandHits() const { return fOHStrand; };
0140
0141 inline G4int GetEaqStrandHits() const { return fEaqStrand; };
0142
0143 inline G4int GetHStrandHits() const { return fHStrand; };
0144
0145 inline G4int GetPlacementIdx() const { return fStartPlacement; };
0146
0147 inline G4int GetChainIdx() const { return fChainIdx; };
0148
0149 inline G4int GetStrandIdx() const { return fStrandIdx; };
0150
0151 inline int64_t GetStartBPIdx() const { return fStartIndex; };
0152 void AddTestDamage(G4int, G4int, G4int, G4int);
0153
0154 G4ThreeVector GetMeanPosition() const;
0155
0156 G4double GetMeanDistance() const;
0157
0158 G4double GetEnergy() const;
0159
0160 private:
0161 G4String fName;
0162 int64_t fStartIndex;
0163 G4int fStartPlacement, fChainIdx, fStrandIdx = 0;
0164 G4int fOHBase = 0, fOHStrand = 0, fHBase = 0, fHStrand = 0, fEaqBase = 0, fEaqStrand = 0;
0165 std::vector<BasePairDamageRecord*> fDamageRecords;
0166 std::vector<G4ThreeVector> fPositions;
0167
0168 const G4MoleculeDefinition* fOH = G4OH::Definition();
0169 const G4MoleculeDefinition* fe_aq = G4Electron_aq::Definition();
0170 const G4MoleculeDefinition* fH = G4Hydrogen::Definition();
0171
0172 static const char* fDirectDamageChar;
0173 static const char* fIndirectDamageChar;
0174 static const char* fHitNoDamageChar;
0175 static const char* fNotHitChar;
0176 static const char* fBothDamageChar;
0177
0178 const char* GetChar(const G4bool&, const G4bool&, const G4double&);
0179 };
0180
0181 struct Node
0182 {
0183 int64_t fkey;
0184 DNAHit* fdata;
0185 Node* fleft;
0186 Node* fright;
0187 Node* fparent;
0188 };
0189
0190
0191
0192
0193 class BinaryTree
0194 {
0195 public:
0196 BinaryTree();
0197
0198 virtual ~BinaryTree();
0199
0200 void Insert(const DNAHit*);
0201
0202 DNAHit* Search(int64_t);
0203
0204 void Destroy_tree();
0205
0206
0207 DNAHit* First() const;
0208
0209
0210 DNAHit* Next(const DNAHit*) const;
0211
0212 private:
0213 void Destroy_tree_(Node*);
0214
0215 void Insert_(DNAHit*, Node*);
0216
0217 DNAHit* Search_(int64_t, Node*);
0218
0219 DNAHit* First_(Node*) const;
0220
0221 DNAHit* Next_(int64_t, Node*) const;
0222
0223 Node* fRoot;
0224 };
0225
0226 class AnalysisManager
0227 {
0228 public:
0229 AnalysisManager();
0230
0231 virtual ~AnalysisManager();
0232
0233 void Initialize();
0234
0235 void ProcessDNAHitsVector(const std::vector<const DNAHit*>&);
0236
0237 void ProcessChromosomeHitMap(const std::map<uint32_t, ChromosomeHit*>&);
0238
0239 void ProcessPrimary(const G4ThreeVector&, const G4double&, const G4double&);
0240
0241 void ProcessCellEdep(const G4double&);
0242 void Close();
0243
0244 inline void SetSaveStrands(const G4bool strand) { fSaveStrands = strand; };
0245
0246 inline void SetStrandDirectory(const G4String& dir) { fStrandDirectory = dir; };
0247
0248 inline void SetFragmentGap(G4int gap) { fFragmentGap = gap; };
0249
0250 inline void SetDSBDistance(G4int gap) { fDSBDistance = gap; };
0251
0252 inline void SetChainToSave(G4int i) { fChainToSave = i; };
0253
0254 inline void SetFileName(const G4String& name) { fFileName = name; };
0255
0256 void TestClassification();
0257
0258 private:
0259 G4AnalysisManager* fAnalysisManager;
0260 G4bool fSaveStrands = false;
0261 G4String fStrandDirectory = "./";
0262 G4String fFileName = "molecular-dna";
0263 G4int fFragmentGap = 100;
0264 G4int fDSBDistance = 10;
0265 G4int fChainToSave = -1;
0266 DNAGeometry* fpDNAGeometry = nullptr;
0267 AnalysisMessenger* fpAnalysisMessenger;
0268 };
0269
0270 #endif