Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file DamageClassifier.cc 28 /// \brief Implementation of the DamageClassif 29 30 #include "DamageClassifier.hh" 31 32 #include <iostream> 33 #include <algorithm> 34 35 //....oooOO0OOooo........oooOO0OOooo........oo 36 37 std::vector<ClassifiedDamage> DamageClassifier 38 std::vector<Damage>& pListDamage,unsigned in 39 { 40 unsigned long int copyNb; 41 unsigned long int lastCopyNb = -pDSBLength-1 42 43 // sort the list of damage by ascending bp 44 std::sort(pListDamage.begin(), pListDamage.e 45 [](const Damage& a, const Damage& b) { 46 return a.GetCopyNb() < b.GetCopyNb(); 47 }); 48 49 std::vector<ClassifiedDamage> listClassified 50 ClassifiedDamage classDamage; 51 52 for(auto it=pListDamage.begin();it!=pListDam 53 { 54 classDamage.SetIncludeBase(pBase); 55 Damage tempDamage = (*it); 56 57 if(tempDamage.GetDamageType()==Damage::Dam 58 { 59 60 copyNb=tempDamage.GetCopyNb(); 61 62 if(classDamage.GetNumDamage()<=0) 63 { 64 classDamage.AddDamage(tempDamage); 65 lastCopyNb = copyNb; 66 } 67 else 68 { 69 // New Damage 70 if(copyNb>lastCopyNb+pDSBLength) 71 { 72 classDamage.ComputeBp(); 73 classDamage.ComputeType(); 74 classDamage.ComputeComplexity(); 75 listClassifiedDamage.push_back(class 76 classDamage.Reset(); 77 } 78 79 classDamage.AddDamage(tempDamage); 80 lastCopyNb = copyNb; 81 } 82 } 83 } 84 85 if(classDamage.GetNumDamage()>0) 86 { 87 classDamage.ComputeBp(); 88 classDamage.ComputeType(); 89 classDamage.ComputeComplexity(); 90 listClassifiedDamage.push_back(classDamage 91 } 92 93 // TODO: include base damage if include base 94 95 return listClassifiedDamage; 96 } 97 98 //....oooOO0OOooo........oooOO0OOooo........oo 99 100 unsigned int DamageClassifier::GetNumSSB( 101 const std::vector<ClassifiedDamage>& pListCl 102 { 103 unsigned int numSSB = 0; 104 for(auto it=pListClassifiedDamage.begin();it 105 { 106 if(it->GetClassifiedDamageType()==Classifi 107 { 108 numSSB++; 109 } 110 } 111 return numSSB; 112 } 113 114 //....oooOO0OOooo........oooOO0OOooo........oo 115 116 unsigned int DamageClassifier::GetNumDSB( 117 const std::vector<ClassifiedDamage>& pListCl 118 { 119 unsigned int numDSB = 0; 120 for(auto it=pListClassifiedDamage.begin();it 121 { 122 if(it->GetClassifiedDamageType()==Classifi 123 { 124 numDSB++; 125 } 126 } 127 return numDSB; 128 } 129 130 //....oooOO0OOooo........oooOO0OOooo........oo 131 132 unsigned int DamageClassifier::GetNumComplexDS 133 const std::vector<ClassifiedDamage>& pListCl 134 { 135 unsigned int numComplexDSB = 0; 136 137 for(auto it=pListClassifiedDamage.begin();it 138 { 139 if(((it->GetClassifiedDamageType()==Classi 140 { 141 numComplexDSB++; 142 } 143 } 144 return numComplexDSB; 145 } 146 147 148 //....oooOO0OOooo........oooOO0OOooo........oo 149 150 std::map<unsigned int,std::map<unsigned int,st 151 const std::vector<Damage>& pListDamage) 152 { 153 std::map<unsigned int,std::map<unsigned int, 154 for(auto it=pListDamage.begin();it!=pListDam 155 { 156 mapDamage[it->GetEvt()][it->GetChromo()].p 157 } 158 return mapDamage; 159 } 160 161 //....oooOO0OOooo........oooOO0OOooo........oo 162 163 std::map<unsigned int,std::map<unsigned int,st 164 const std::vector<Damage>& pListDamage) 165 { 166 std::map<unsigned int,std::map<unsigned int, 167 for(auto it=pListDamage.begin();it!=pListDam 168 { 169 mapDamage[it->GetChromo()][it->GetEvt()].p 170 } 171 return mapDamage; 172 } 173 174 //....oooOO0OOooo........oooOO0OOooo........oo 175 176 unsigned int DamageClassifier::GetNumDSBwithDi 177 const std::vector<ClassifiedDamage>& pListCl 178 { 179 unsigned int numDSBwDir = 0; 180 for(auto it=pListClassifiedDamage.begin();it 181 { 182 if(it->GetClassifiedDamageType()==Classifi 183 it->GetIsThereDirectComponentContributio 184 { 185 numDSBwDir++; 186 } 187 } 188 return numDSBwDir; 189 } 190 191 //....oooOO0OOooo........oooOO0OOooo........oo 192 193 unsigned int DamageClassifier::GetNumDSBwithIn 194 const std::vector<ClassifiedDamage>& pListCl 195 { 196 unsigned int numDSBwIn = 0; 197 for(auto it=pListClassifiedDamage.begin();it 198 { 199 if(it->GetClassifiedDamageType()==Classifi 200 it->GetIsThereIndirectComponentContribut 201 { 202 numDSBwIn++; 203 } 204 } 205 return numDSBwIn; 206 } 207 208 //....oooOO0OOooo........oooOO0OOooo........oo 209 210 unsigned int DamageClassifier::GetNumDSBwithBo 211 const std::vector<ClassifiedDamage>& pListCl 212 { 213 unsigned int numDSBwDirIn = 0; 214 for(auto it=pListClassifiedDamage.begin();it 215 { 216 if(it->GetClassifiedDamageType()==Classifi 217 it->GetIsThereDirectComponentContributio 218 it->GetIsThereIndirectComponentContribut 219 { 220 numDSBwDirIn++; 221 } 222 } 223 return numDSBwDirIn; 224 } 225 226 //....oooOO0OOooo........oooOO0OOooo........oo