Warning, file /geant4/examples/advanced/dna/moleculardna/src/DNAHit.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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
0028
0029
0030 #include "DNAHit.hh"
0031
0032 #include <utility>
0033
0034 G4ThreadLocal G4Allocator<DNAHit>* MolecularDNAHitAllocator = nullptr;
0035
0036
0037
0038 DNAHit::DNAHit(const molecule& mol, G4int placement_idx,
0039 G4int chain, G4int strand,
0040 int64_t bp, const G4ThreeVector& pos,
0041 const G4ThreeVector& localpos,
0042 const G4double& energy, const G4double& d, const G4String& chromo,
0043 const G4MolecularConfiguration* radical)
0044 : fMoleculeEnum(mol),
0045 fPlacementIdx(placement_idx),
0046 fChainIdx(chain),
0047 fStrandIdx(strand),
0048 fBasePairIdx(bp),
0049 fPosition(pos),
0050 fLocalPosition(localpos),
0051 fEnergy(energy),
0052 fDistance(d),
0053 fChromosome(chromo),
0054 fRadical(radical)
0055 {
0056
0057 if (fStrandIdx == 0) {
0058 if ((fMoleculeEnum == SUGAR) || (fMoleculeEnum == PHOSPHATE)) {
0059 fStrand1Rad = fRadical;
0060 fStrand1Energy = fEnergy;
0061 }
0062 else if ((fMoleculeEnum == CYTOSINE) || (fMoleculeEnum == GUANINE) || (fMoleculeEnum == ADENINE)
0063 || (fMoleculeEnum == THYMINE))
0064 {
0065 fBase1Rad = fRadical;
0066 fBP1Energy = fEnergy;
0067 }
0068 else {
0069 G4Exception("DNAHit", "ERR_UNKNOWN_MOLECULE", JustWarning,
0070 "Chemical Reaction with unknown molecule");
0071 }
0072 }
0073 else if (fStrandIdx == 1) {
0074 if ((fMoleculeEnum == SUGAR) || (fMoleculeEnum == PHOSPHATE)) {
0075 fStrand2Rad = fRadical;
0076 fStrand2Energy = fEnergy;
0077 }
0078 else if ((fMoleculeEnum == CYTOSINE) || (fMoleculeEnum == GUANINE) || (fMoleculeEnum == ADENINE)
0079 || (fMoleculeEnum == THYMINE))
0080 {
0081 fBase2Rad = fRadical;
0082 fBP2Energy = fEnergy;
0083 }
0084 else {
0085 G4Exception("DNAHit", "ERR_UNKNOWN_MOLECULE", JustWarning, "Hit with unknown molecule");
0086 }
0087 }
0088 }
0089
0090
0091
0092
0093
0094
0095
0096 void DNAHit::AddHit(const DNAHit& right)
0097 {
0098 this->fStrand1Energy += right.GetStrand1Energy();
0099 this->fStrand2Energy += right.GetStrand2Energy();
0100 this->fBP1Energy += right.GetBP1Energy();
0101 this->fBP2Energy += right.GetBP2Energy();
0102 if (right.GetStrand1Rad() != nullptr) {
0103 this->fStrand1Rad = right.GetStrand1Rad();
0104 }
0105 if (right.GetBase1Rad() != nullptr) {
0106 this->fBase1Rad = right.GetBase1Rad();
0107 }
0108 if (right.GetStrand2Rad() != nullptr) {
0109 this->fStrand2Rad = right.GetStrand2Rad();
0110 }
0111 if (right.GetBase2Rad() != nullptr) {
0112 this->fBase2Rad = right.GetBase2Rad();
0113 }
0114 }
0115
0116 DNAHit::DNAHit(const DNAHit& right)
0117 {
0118 this->SetPlacementIdx(right.GetPlacementIdx());
0119 this->SetMolecule(right.GetMolecule());
0120 this->SetChainIdx(right.GetChainIdx());
0121 this->SetStrandIdx(right.GetStrandIdx());
0122 this->SetBasePairIdx(right.GetBasePairIdx());
0123 this->SetPosition(right.GetPosition());
0124 this->SetLocalPosition(right.GetLocalPosition());
0125 this->SetEnergy(right.GetEnergy());
0126 this->SetDistance(right.GetDistance());
0127 this->SetChromosome(right.GetChromosome());
0128 this->SetRadical(right.GetRadical());
0129
0130
0131 this->fStrand1Energy = right.GetStrand1Energy();
0132 this->fStrand2Energy = right.GetStrand2Energy();
0133 this->fBP1Energy = right.GetBP1Energy();
0134 this->fBP2Energy = right.GetBP2Energy();
0135 this->fStrand1Rad = right.GetStrand1Rad();
0136 this->fBase1Rad = right.GetBase1Rad();
0137 this->fStrand2Rad = right.GetStrand2Rad();
0138 this->fBase2Rad = right.GetBase2Rad();
0139 }
0140
0141
0142
0143 const DNAHit& DNAHit::operator=(const DNAHit& right)
0144 {
0145 this->SetMolecule(right.GetMolecule());
0146 this->SetPlacementIdx(right.GetPlacementIdx());
0147 this->SetChainIdx(right.GetChainIdx());
0148 this->SetStrandIdx(right.GetStrandIdx());
0149 this->SetBasePairIdx(right.GetBasePairIdx());
0150 this->SetPosition(right.GetPosition());
0151 this->SetLocalPosition(right.GetLocalPosition());
0152 this->SetEnergy(right.GetEnergy());
0153 this->SetDistance(right.GetDistance());
0154 this->SetChromosome(right.GetChromosome());
0155 this->SetRadical(right.GetRadical());
0156
0157 this->fStrand1Energy = right.GetStrand1Energy();
0158 this->fStrand2Energy = right.GetStrand2Energy();
0159 this->fBP1Energy = right.GetBP1Energy();
0160 this->fBP2Energy = right.GetBP2Energy();
0161 this->fStrand1Rad = right.GetStrand1Rad();
0162 this->fBase1Rad = right.GetBase1Rad();
0163 this->fStrand2Rad = right.GetStrand2Rad();
0164 this->fBase2Rad = right.GetBase2Rad();
0165 return *this;
0166 }
0167
0168
0169
0170 G4int DNAHit::operator==(const DNAHit& right) const
0171 {
0172 return (this == &right) ? 1 : 0;
0173 }
0174