53 :fEps(pEps),fMinPts(pMinPts),
54 fSPointsProb(pSPointsProb),fEMinDamage(pEMinDamage),fEMaxDamage(pEMaxDamage)
64 delete fpClustAlgoMessenger;
71 G4bool ClusteringAlgo::IsInSensitiveArea()
86 else if(pEdep>fEMaxDamage)
93 (fEMaxDamage/
eV-fEMinDamage/
eV);
107 if(IsEdepSufficient(pEdep))
109 if(IsInSensitiveArea())
111 fpSetOfPoints.push_back(
new SBPoint(fNextSBPointID++, pPos, pEdep));
123 std::vector<SBPoint*>::iterator itVisitorPt, itObservedPt;
124 for(itVisitorPt = fpSetOfPoints.begin();
125 itVisitorPt != fpSetOfPoints.end();
128 itObservedPt = itVisitorPt;
130 while(itObservedPt != fpSetOfPoints.end() )
133 if(!((*itObservedPt)->HasCluster() && (*itVisitorPt)->HasCluster()))
135 if(AreOnTheSameCluster( (*itObservedPt)->GetPosition(),
136 (*itVisitorPt)->GetPosition(),fEps))
139 if(!(*itObservedPt)->HasCluster() && !(*itVisitorPt)->HasCluster())
142 set<SBPoint*> clusterPoints;
143 clusterPoints.insert((*itObservedPt));
144 clusterPoints.insert((*itVisitorPt));
147 fpClusters.push_back(lCluster);
151 (*itObservedPt)->SetCluster(lCluster);
153 (*itVisitorPt)->SetCluster(lCluster);
157 if((*itObservedPt)->HasCluster())
159 (*itObservedPt)->GetCluster()->AddSBPoint((*itVisitorPt));
160 (*itVisitorPt)->SetCluster((*itObservedPt)->GetCluster());
163 if((*itVisitorPt)->HasCluster())
165 (*itVisitorPt)->GetCluster()->AddSBPoint((*itObservedPt));
166 (*itObservedPt)->SetCluster((*itVisitorPt)->GetCluster());
176 IncludeUnassociatedPoints();
186 void ClusteringAlgo::MergeClusters()
188 std::vector<ClusterSBPoints*>::iterator itCluster1, itCluster2;
189 for(itCluster1 = fpClusters.begin();
190 itCluster1 != fpClusters.end();
193 G4ThreeVector baryCenterClust1 = (*itCluster1)->GetBarycenter();
194 itCluster2 = itCluster1;
196 while(itCluster2 != fpClusters.end())
198 G4ThreeVector baryCenterClust2 = (*itCluster2)->GetBarycenter();
200 if(AreOnTheSameCluster(baryCenterClust1, baryCenterClust2,fEps))
202 (*itCluster1)->MergeWith(*itCluster2);
204 fpClusters.erase(itCluster2);
205 return MergeClusters();
216 void ClusteringAlgo::IncludeUnassociatedPoints()
218 std::vector<SBPoint*>::iterator itVisitorPt;
219 int nbPtSansCluster = 0;
221 for(itVisitorPt = fpSetOfPoints.begin();
222 itVisitorPt != fpSetOfPoints.end();
225 if(!(*itVisitorPt)->HasCluster())
228 FindCluster(*itVisitorPt);
235 bool ClusteringAlgo::FindCluster(
SBPoint* pPt)
238 std::vector<ClusterSBPoints*>::iterator itCluster;
239 for(itCluster = fpClusters.begin();
240 itCluster != fpClusters.end();
244 if((*itCluster)->HasInBarycenter(pPt, fEps))
246 (*itCluster)->AddSBPoint(pPt);
267 if(((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2))<=
268 (pMinDist/
nm*pMinDist/
nm))
282 std::vector<SBPoint*>::const_iterator itSDSPt;
283 for(itSDSPt = fpSetOfPoints.begin();
284 itSDSPt != fpSetOfPoints.end();
287 if(!(*itSDSPt)->HasCluster())
300 std::vector<ClusterSBPoints*>::const_iterator itCluster;
301 for(itCluster = fpClusters.begin();
302 itCluster != fpClusters.end();
305 if((*itCluster)->IsSSB())
318 std::vector<ClusterSBPoints*>::const_iterator itCluster;
319 for(itCluster = fpClusters.begin();
320 itCluster != fpClusters.end();
323 if((*itCluster)->IsDSB())
335 std::map<G4int,G4int> sizeDistribution;
336 sizeDistribution[1]=
GetSSB();
337 std::vector<ClusterSBPoints*>::const_iterator itCluster;
338 for(itCluster = fpClusters.begin();
339 itCluster != fpClusters.end();
342 sizeDistribution[(*itCluster)->GetSize()]++;
344 return sizeDistribution;
352 std::vector<ClusterSBPoints*>::iterator itCluster;
353 for(itCluster = fpClusters.begin();
354 itCluster != fpClusters.end();
361 std::vector<SBPoint*>::iterator itPt;
362 for(itPt = fpSetOfPoints.begin();
363 itPt != fpSetOfPoints.end();
369 fpSetOfPoints.clear();
define a cluster of SB Points
G4int GetComplexSSB() const
std::map< G4int, G4int > RunClustering()
Definition of the ClusteringAlgoMessenger class.
ClusteringAlgo(G4double pEps, G4int pMinPts, G4double pSPointsProb, G4double pEMinDamage, G4double pEMaxDamage)
static constexpr double eV
std::map< G4int, G4int > GetClusterSizeDistribution()
void RegisterDamage(G4ThreeVector, G4double)
static constexpr double nm
defines a point of energy deposition which defines a damage to the DNA.
Definition of the ClustreringAlgo class.