File indexing completed on 2025-01-31 09:21:59
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 "ClassifiedDamage.hh"
0031
0032
0033
0034 ClassifiedDamage::ClassifiedDamage()
0035 {
0036 fType = fNA;
0037 fDamage.clear();
0038 fBp_begin = 0;
0039 fBp_end = 0;
0040 fComplexity = -1;
0041 fIncludeBase = false;
0042 }
0043
0044
0045
0046 void ClassifiedDamage::AddDamage(Damage pDmg)
0047 {
0048 fDamage.push_back(pDmg);
0049 }
0050
0051
0052
0053 void ClassifiedDamage::ComputeBp()
0054 {
0055 fBp_begin = fDamage[0].GetCopyNb();
0056 fBp_end = fDamage[fDamage.size()-1].GetCopyNb();
0057
0058 fBp_barycenter=0;
0059 for(auto it=fDamage.begin();it!=fDamage.end();it++)
0060 {
0061 fBp_barycenter+=it->GetCopyNb();
0062 }
0063 fBp_barycenter = fBp_barycenter/fDamage.size();
0064 }
0065
0066
0067
0068 void ClassifiedDamage::ComputePosition()
0069 {
0070
0071 }
0072
0073
0074
0075 void ClassifiedDamage::ComputeComplexity()
0076 {
0077 if(fDamage.size()==0)
0078 {
0079 fComplexity = -1;
0080 }
0081 else
0082 {
0083 fComplexity = -1;
0084 for(auto it=fDamage.begin();it!=fDamage.end();it++)
0085 {
0086 if((it->GetDamageType()==Damage::DamageType::fBackbone))
0087 {
0088 fComplexity++;
0089 }
0090 else
0091 {
0092 if(fIncludeBase)
0093 {
0094 fComplexity++;
0095 }
0096 }
0097 }
0098 }
0099 }
0100
0101
0102
0103 void ClassifiedDamage::ComputeType()
0104 {
0105 bool firstStrandTouched = false;
0106 bool secondStrandTouched = false;
0107
0108 if(fDamage.size()==0)
0109 {
0110 fType = fNA;
0111 }
0112 else
0113 {
0114 for(auto it=fDamage.begin();it!=fDamage.end();it++)
0115 {
0116 if((it->GetDamageType()==Damage::DamageType::fBackbone))
0117 {
0118 int strand = it->GetStrand();
0119 if(strand == 1)
0120 {
0121 firstStrandTouched = true;
0122 }
0123 if(strand == 2)
0124 {
0125 secondStrandTouched = true;
0126 }
0127 }
0128
0129 if (it->GetCause() == Damage::DamageCause::fDirect) {
0130 fIsThereDirectContribution = true;
0131 }
0132
0133 if (it->GetCause() == Damage::DamageCause::fIndirect) {
0134 fIsThereIndirectContribution = true;
0135 }
0136 }
0137
0138 if(firstStrandTouched && secondStrandTouched)
0139 {
0140 fType = fDSB;
0141 }
0142 else
0143 {
0144 fType = fSSB;
0145 }
0146 }
0147 }
0148
0149
0150
0151 void ClassifiedDamage::Reset()
0152 {
0153 fType = fNA;
0154 fDamage.clear();
0155 fBp_begin = 0;
0156 fBp_end = 0;
0157 fComplexity = -1;
0158 }