Geant4  10.02.p03
ClusteringAlgo Class Reference

#include <ClusteringAlgo.hh>

Collaboration diagram for ClusteringAlgo:

Public Member Functions

 ClusteringAlgo (G4double pEps, G4int pMinPts, G4double pSPointsProb, G4double pEMinDamage, G4double pEMaxDamage)
 
 ~ClusteringAlgo ()
 
G4double GetEps ()
 
void SetEps (G4double val)
 
G4int GetMinPts ()
 
void SetMinPts (G4int val)
 
G4double GetSPointsProb ()
 
void SetSPointsProb (G4double val)
 
G4double GetEMinDamage ()
 
void SetEMinDamage (G4double val)
 
G4double GetEMaxDamage ()
 
void SetEMaxDamage (G4double val)
 
void RegisterDamage (G4ThreeVector, G4double)
 
std::map< G4int, G4intRunClustering ()
 
void Purge ()
 
G4int GetSSB () const
 
G4int GetComplexSSB () const
 
G4int GetDSB () const
 
std::map< G4int, G4intGetClusterSizeDistribution ()
 

Private Member Functions

G4bool IsInSensitiveArea ()
 
G4bool IsEdepSufficient (G4double)
 
bool FindCluster (SBPoint *pPt)
 
bool AreOnTheSameCluster (G4ThreeVector, G4ThreeVector, G4double)
 
void MergeClusters ()
 
void IncludeUnassociatedPoints ()
 

Private Attributes

G4double fEps
 
G4int fMinPts
 
G4double fSPointsProb
 
G4double fEMinDamage
 
G4double fEMaxDamage
 
std::vector< SBPoint * > fpSetOfPoints
 
std::vector< ClusterSBPoints * > fpClusters
 
unsigned int fNextSBPointID
 
ClusteringAlgoMessengerfpClustAlgoMessenger
 

Detailed Description

Definition at line 49 of file ClusteringAlgo.hh.

Constructor & Destructor Documentation

◆ ClusteringAlgo()

ClusteringAlgo::ClusteringAlgo ( G4double  pEps,
G4int  pMinPts,
G4double  pSPointsProb,
G4double  pEMinDamage,
G4double  pEMaxDamage 
)

Definition at line 51 of file ClusteringAlgo.cc.

53 :fEps(pEps),fMinPts(pMinPts),
54  fSPointsProb(pSPointsProb),fEMinDamage(pEMinDamage),fEMaxDamage(pEMaxDamage)
55 {
56  fNextSBPointID = 0;
58 }
G4double fSPointsProb
ClusteringAlgoMessenger * fpClustAlgoMessenger
unsigned int fNextSBPointID
G4double fEMinDamage
G4double fEMaxDamage

◆ ~ClusteringAlgo()

ClusteringAlgo::~ClusteringAlgo ( )

Definition at line 62 of file ClusteringAlgo.cc.

63 {
64  delete fpClustAlgoMessenger;
65  Purge();
66 }
ClusteringAlgoMessenger * fpClustAlgoMessenger
Here is the call graph for this function:

Member Function Documentation

◆ AreOnTheSameCluster()

bool ClusteringAlgo::AreOnTheSameCluster ( G4ThreeVector  pPt1,
G4ThreeVector  pPt2,
G4double  pMinDist 
)
private

Definition at line 255 of file ClusteringAlgo.cc.

257 {
258  G4double x1=pPt1.x()/nm;
259  G4double y1=pPt1.y()/nm;
260  G4double z1=pPt1.z()/nm;
261 
262  G4double x2=pPt2.x()/nm;
263  G4double y2=pPt2.y()/nm;
264  G4double z2=pPt2.z()/nm;
265 
266  // if the two points are closed enough
267  if(((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2))<=
268  (pMinDist/nm*pMinDist/nm))
269  {
270  return true;
271  }else
272  {
273  return false;
274  }
275 }
Double_t y2[nxs]
Double_t y1[nxs]
Double_t x2[nxs]
static const double nm
Definition: G4SIunits.hh:111
Double_t x1[nxs]
double x() const
double y() const
double z() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindCluster()

bool ClusteringAlgo::FindCluster ( SBPoint pPt)
private

Definition at line 235 of file ClusteringAlgo.cc.

236 {
237  assert(!pPt->HasCluster());
238  std::vector<ClusterSBPoints*>::iterator itCluster;
239  for(itCluster = fpClusters.begin();
240  itCluster != fpClusters.end();
241  ++itCluster)
242  {
243  //if((*itCluster)->hasIn(pPt, fEps))
244  if((*itCluster)->HasInBarycenter(pPt, fEps))
245  {
246  (*itCluster)->AddSBPoint(pPt);
247  return true;
248  }
249  }
250  return false;
251 }
std::vector< ClusterSBPoints * > fpClusters
bool HasCluster() const
Definition: SBPoint.hh:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetClusterSizeDistribution()

map< G4int, G4int > ClusteringAlgo::GetClusterSizeDistribution ( )

Definition at line 333 of file ClusteringAlgo.cc.

334 {
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();
340  itCluster++)
341  {
342  sizeDistribution[(*itCluster)->GetSize()]++;
343  }
344  return sizeDistribution;
345 }
std::vector< ClusterSBPoints * > fpClusters
G4int GetSSB() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetComplexSSB()

G4int ClusteringAlgo::GetComplexSSB ( ) const

Definition at line 297 of file ClusteringAlgo.cc.

298 {
299  G4int nbSSB = 0;
300  std::vector<ClusterSBPoints*>::const_iterator itCluster;
301  for(itCluster = fpClusters.begin();
302  itCluster != fpClusters.end();
303  ++itCluster)
304  {
305  if((*itCluster)->IsSSB())
306  {
307  nbSSB ++;
308  }
309  }
310  return nbSSB;
311 }
std::vector< ClusterSBPoints * > fpClusters
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ GetDSB()

G4int ClusteringAlgo::GetDSB ( ) const

Definition at line 315 of file ClusteringAlgo.cc.

316 {
317  G4int nbDSB = 0;
318  std::vector<ClusterSBPoints*>::const_iterator itCluster;
319  for(itCluster = fpClusters.begin();
320  itCluster != fpClusters.end();
321  ++itCluster)
322  {
323  if((*itCluster)->IsDSB())
324  {
325  nbDSB ++;
326  }
327  }
328  return nbDSB;
329 }
std::vector< ClusterSBPoints * > fpClusters
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ GetEMaxDamage()

G4double ClusteringAlgo::GetEMaxDamage ( )
inline

Definition at line 90 of file ClusteringAlgo.hh.

91  {
92  return fEMaxDamage;
93  };
G4double fEMaxDamage

◆ GetEMinDamage()

G4double ClusteringAlgo::GetEMinDamage ( )
inline

Definition at line 82 of file ClusteringAlgo.hh.

83  {
84  return fEMinDamage;
85  };
G4double fEMinDamage

◆ GetEps()

G4double ClusteringAlgo::GetEps ( )
inline

Definition at line 58 of file ClusteringAlgo.hh.

59  {
60  return fEps;
61  };

◆ GetMinPts()

G4int ClusteringAlgo::GetMinPts ( )
inline

Definition at line 66 of file ClusteringAlgo.hh.

67  {
68  return fMinPts;
69  };

◆ GetSPointsProb()

G4double ClusteringAlgo::GetSPointsProb ( )
inline

Definition at line 74 of file ClusteringAlgo.hh.

75  {
76  return fSPointsProb;
77  };
G4double fSPointsProb

◆ GetSSB()

G4int ClusteringAlgo::GetSSB ( ) const

Definition at line 279 of file ClusteringAlgo.cc.

280 {
281  G4int nbSSB = 0;
282  std::vector<SBPoint*>::const_iterator itSDSPt;
283  for(itSDSPt = fpSetOfPoints.begin();
284  itSDSPt != fpSetOfPoints.end();
285  ++itSDSPt)
286  {
287  if(!(*itSDSPt)->HasCluster())
288  {
289  nbSSB++;
290  }
291  }
292  return nbSSB;
293 }
int G4int
Definition: G4Types.hh:78
std::vector< SBPoint * > fpSetOfPoints
Here is the caller graph for this function:

◆ IncludeUnassociatedPoints()

void ClusteringAlgo::IncludeUnassociatedPoints ( )
private

Definition at line 216 of file ClusteringAlgo.cc.

217 {
218  std::vector<SBPoint*>::iterator itVisitorPt;
219  int nbPtSansCluster = 0;
220  // Associate all point not in a cluster if possible ( to the first found cluster)
221  for(itVisitorPt = fpSetOfPoints.begin();
222  itVisitorPt != fpSetOfPoints.end();
223  ++itVisitorPt)
224  {
225  if(!(*itVisitorPt)->HasCluster())
226  {
227  nbPtSansCluster ++;
228  FindCluster(*itVisitorPt);
229  }
230  }
231 }
std::vector< SBPoint * > fpSetOfPoints
bool FindCluster(SBPoint *pPt)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsEdepSufficient()

G4bool ClusteringAlgo::IsEdepSufficient ( G4double  pEdep)
private

Definition at line 79 of file ClusteringAlgo.cc.

80 {
81  if(pEdep<fEMinDamage)
82  {
83  return false;
84  }
85 
86  else if(pEdep>fEMaxDamage)
87  {
88  return true;
89  }
90  else
91  {
92  G4double proba = (pEdep/eV - fEMinDamage/eV)/
94  return (proba>G4UniformRand());
95  }
96 
97 }
#define G4UniformRand()
Definition: Randomize.hh:97
static const double eV
Definition: G4SIunits.hh:212
G4double fEMinDamage
G4double fEMaxDamage
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ IsInSensitiveArea()

G4bool ClusteringAlgo::IsInSensitiveArea ( )
private

Definition at line 71 of file ClusteringAlgo.cc.

72 {
73  return fSPointsProb > G4UniformRand();
74 }
G4double fSPointsProb
#define G4UniformRand()
Definition: Randomize.hh:97
Here is the caller graph for this function:

◆ MergeClusters()

void ClusteringAlgo::MergeClusters ( )
private

Definition at line 186 of file ClusteringAlgo.cc.

187 {
188  std::vector<ClusterSBPoints*>::iterator itCluster1, itCluster2;
189  for(itCluster1 = fpClusters.begin();
190  itCluster1 != fpClusters.end();
191  ++itCluster1)
192  {
193  G4ThreeVector baryCenterClust1 = (*itCluster1)->GetBarycenter();
194  itCluster2 = itCluster1;
195  itCluster2++;
196  while(itCluster2 != fpClusters.end())
197  {
198  G4ThreeVector baryCenterClust2 = (*itCluster2)->GetBarycenter();
199  // if we can merge both cluster
200  if(AreOnTheSameCluster(baryCenterClust1, baryCenterClust2,fEps))
201  {
202  (*itCluster1)->MergeWith(*itCluster2);
203  delete *itCluster2;
204  fpClusters.erase(itCluster2);
205  return MergeClusters();
206  }else
207  {
208  itCluster2++;
209  }
210  }
211  }
212 }
std::vector< ClusterSBPoints * > fpClusters
bool AreOnTheSameCluster(G4ThreeVector, G4ThreeVector, G4double)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Purge()

void ClusteringAlgo::Purge ( )

Definition at line 349 of file ClusteringAlgo.cc.

350 {
351  fNextSBPointID = 0;
352  std::vector<ClusterSBPoints*>::iterator itCluster;
353  for(itCluster = fpClusters.begin();
354  itCluster != fpClusters.end();
355  ++itCluster)
356  {
357  delete *itCluster;
358  *itCluster = NULL;
359  }
360  fpClusters.clear();
361  std::vector<SBPoint*>::iterator itPt;
362  for(itPt = fpSetOfPoints.begin();
363  itPt != fpSetOfPoints.end();
364  ++itPt)
365  {
366  delete *itPt;
367  *itPt = NULL;
368  }
369  fpSetOfPoints.clear();
370 }
std::vector< ClusterSBPoints * > fpClusters
unsigned int fNextSBPointID
std::vector< SBPoint * > fpSetOfPoints
Here is the caller graph for this function:

◆ RegisterDamage()

void ClusteringAlgo::RegisterDamage ( G4ThreeVector  pPos,
G4double  pEdep 
)

Definition at line 105 of file ClusteringAlgo.cc.

106 {
107  if(IsEdepSufficient(pEdep))
108  {
109  if(IsInSensitiveArea())
110  {
111  fpSetOfPoints.push_back( new SBPoint(fNextSBPointID++, pPos, pEdep));
112  }
113  }
114 }
unsigned int fNextSBPointID
std::vector< SBPoint * > fpSetOfPoints
G4bool IsEdepSufficient(G4double)
G4bool IsInSensitiveArea()
defines a point of energy deposition which defines a damage to the DNA.
Definition: SBPoint.hh:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RunClustering()

map< G4int, G4int > ClusteringAlgo::RunClustering ( )

Definition at line 118 of file ClusteringAlgo.cc.

119 {
120 
121  // quick sort style
122  // create cluster
123  std::vector<SBPoint*>::iterator itVisitorPt, itObservedPt;
124  for(itVisitorPt = fpSetOfPoints.begin();
125  itVisitorPt != fpSetOfPoints.end();
126  ++itVisitorPt )
127  {
128  itObservedPt = itVisitorPt;
129  itObservedPt ++;
130  while(itObservedPt != fpSetOfPoints.end() )
131  {
132  // if at least one of the two points has not a cluster
133  if(!((*itObservedPt)->HasCluster() && (*itVisitorPt)->HasCluster()))
134  {
135  if(AreOnTheSameCluster( (*itObservedPt)->GetPosition(),
136  (*itVisitorPt)->GetPosition(),fEps))
137  {
138  // if none has a cluster. Create a new one
139  if(!(*itObservedPt)->HasCluster() && !(*itVisitorPt)->HasCluster())
140  {
141  // create the new cluster
142  set<SBPoint*> clusterPoints;
143  clusterPoints.insert((*itObservedPt));
144  clusterPoints.insert((*itVisitorPt));
145  ClusterSBPoints* lCluster = new ClusterSBPoints(clusterPoints);
146  assert(lCluster);
147  fpClusters.push_back(lCluster);
148  assert(lCluster);
149  // inform SB point that they are part of a cluster now
150  assert(lCluster);
151  (*itObservedPt)->SetCluster(lCluster);
152  assert(lCluster);
153  (*itVisitorPt)->SetCluster(lCluster);
154  }else
155  {
156  // add the point to the existing cluster
157  if((*itObservedPt)->HasCluster())
158  {
159  (*itObservedPt)->GetCluster()->AddSBPoint((*itVisitorPt));
160  (*itVisitorPt)->SetCluster((*itObservedPt)->GetCluster());
161  }
162 
163  if((*itVisitorPt)->HasCluster())
164  {
165  (*itVisitorPt)->GetCluster()->AddSBPoint((*itObservedPt));
166  (*itObservedPt)->SetCluster((*itVisitorPt)->GetCluster());
167  }
168  }
169  }
170  }
171  ++itObservedPt;
172  }
173  }
174 
175  // associate isolated points and merge clusters
177  MergeClusters();
178 
179  // return cluster size distribution
181 }
define a cluster of SB Points
void IncludeUnassociatedPoints()
std::vector< ClusterSBPoints * > fpClusters
bool AreOnTheSameCluster(G4ThreeVector, G4ThreeVector, G4double)
std::map< G4int, G4int > GetClusterSizeDistribution()
std::vector< SBPoint * > fpSetOfPoints
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEMaxDamage()

void ClusteringAlgo::SetEMaxDamage ( G4double  val)
inline

Definition at line 94 of file ClusteringAlgo.hh.

95  {
96  fEMaxDamage=val;
97  };
G4double fEMaxDamage
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEMinDamage()

void ClusteringAlgo::SetEMinDamage ( G4double  val)
inline

Definition at line 86 of file ClusteringAlgo.hh.

87  {
88  fEMinDamage=val;
89  };
G4double fEMinDamage
Here is the caller graph for this function:

◆ SetEps()

void ClusteringAlgo::SetEps ( G4double  val)
inline

Definition at line 62 of file ClusteringAlgo.hh.

63  {
64  fEps=val;
65  };
Here is the caller graph for this function:

◆ SetMinPts()

void ClusteringAlgo::SetMinPts ( G4int  val)
inline

Definition at line 70 of file ClusteringAlgo.hh.

71  {
72  fMinPts=val;
73  };
Here is the caller graph for this function:

◆ SetSPointsProb()

void ClusteringAlgo::SetSPointsProb ( G4double  val)
inline

Definition at line 78 of file ClusteringAlgo.hh.

79  {
80  fSPointsProb=val;
81  };
G4double fSPointsProb
Here is the caller graph for this function:

Member Data Documentation

◆ fEMaxDamage

G4double ClusteringAlgo::fEMaxDamage
private

Definition at line 138 of file ClusteringAlgo.hh.

◆ fEMinDamage

G4double ClusteringAlgo::fEMinDamage
private

Definition at line 137 of file ClusteringAlgo.hh.

◆ fEps

G4double ClusteringAlgo::fEps
private

Definition at line 134 of file ClusteringAlgo.hh.

◆ fMinPts

G4int ClusteringAlgo::fMinPts
private

Definition at line 135 of file ClusteringAlgo.hh.

◆ fNextSBPointID

unsigned int ClusteringAlgo::fNextSBPointID
private

Definition at line 145 of file ClusteringAlgo.hh.

◆ fpClustAlgoMessenger

ClusteringAlgoMessenger* ClusteringAlgo::fpClustAlgoMessenger
private

Definition at line 147 of file ClusteringAlgo.hh.

◆ fpClusters

std::vector<ClusterSBPoints*> ClusteringAlgo::fpClusters
private

Definition at line 143 of file ClusteringAlgo.hh.

◆ fpSetOfPoints

std::vector<SBPoint*> ClusteringAlgo::fpSetOfPoints
private

Definition at line 141 of file ClusteringAlgo.hh.

◆ fSPointsProb

G4double ClusteringAlgo::fSPointsProb
private

Definition at line 136 of file ClusteringAlgo.hh.


The documentation for this class was generated from the following files: