Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClusterSBPoints Class Reference

define a cluster of SB Points More...

#include <ClusterSBPoints.hh>

Public Member Functions

 ClusterSBPoints (std::set< SBPoint * > pPoints)
 
 ~ClusterSBPoints ()
 
bool IsDSB () const
 
bool IsSSB () const
 
unsigned int GetSize () const
 
void AddSBPoint (SBPoint *pSBPoint)
 
G4ThreeVector GetBarycenter () const
 
G4double GetEdep () const
 
void FindAllPointsPossible (std::vector< SBPoint * > *ptToCheck, G4int minPts, G4double minDist)
 
void NoticeInternalPts ()
 will set to all store SBPoint they are part of this cluster More...
 
bool HasIn (const SBPoint *, G4double)
 
bool HasInBarycenter (const SBPoint *, G4double)
 
void MergeWith (ClusterSBPoints *)
 
std::set< SBPoint * > GetRegistredSBPoints () const
 
void Clear ()
 

Detailed Description

define a cluster of SB Points

Definition at line 48 of file ClusterSBPoints.hh.

Constructor & Destructor Documentation

ClusterSBPoints::ClusterSBPoints ( std::set< SBPoint * >  pPoints)

Definition at line 47 of file ClusterSBPoints.cc.

47  :
48  fpRegisteredSBPoints()
49 {
50  UpdateDoubleStrand();
51  std::set<SBPoint*>::iterator itPt;
52  for(itPt = pSBPoints.begin(); itPt != pSBPoints.end(); ++itPt)
53  {
54  AddSBPoint(*itPt);
55  }
56 }
void AddSBPoint(SBPoint *pSBPoint)

Here is the call graph for this function:

ClusterSBPoints::~ClusterSBPoints ( )

Definition at line 60 of file ClusterSBPoints.cc.

61 {
62  Clear();
63 }

Here is the call graph for this function:

Member Function Documentation

void ClusterSBPoints::AddSBPoint ( SBPoint pSBPoint)

Definition at line 79 of file ClusterSBPoints.cc.

80 {
81  assert(pSBPoint);
82  fpRegisteredSBPoints.insert(pSBPoint);
83  pSBPoint->SetCluster(this);
84 
85  UpdateDoubleStrand();
86 }
void SetCluster(ClusterSBPoints *pCluster)
Definition: SBPoint.hh:74

Here is the call graph for this function:

Here is the caller graph for this function:

void ClusterSBPoints::Clear ( )

Definition at line 65 of file ClusterSBPoints.cc.

66 {
67  std::set<SBPoint*>::iterator itPt;
68  for(itPt = fpRegisteredSBPoints.begin();
69  itPt != fpRegisteredSBPoints.end();
70  ++itPt)
71  {
72  (*itPt)->CleanCluster();
73  }
74  fpRegisteredSBPoints.clear();
75 }

Here is the caller graph for this function:

void ClusterSBPoints::FindAllPointsPossible ( std::vector< SBPoint * > *  ptToCheck,
G4int  minPts,
G4double  minDist 
)

Definition at line 192 of file ClusterSBPoints.cc.

194 {
195  assert((unsigned int)pMinPts > this->GetSize());
196  std::vector<SBPoint*>::iterator itPt = pPtsToCheck->begin();
197  while(itPt != pPtsToCheck->end() )
198  {
199 
200  // If 1- each SBpoint is part of only one cluster
201  // 2- the point isn't already in the cluster
202  // 3- the point is close enough of the barycenter
203  if( (!(*itPt)->HasCluster())
204  && (fpRegisteredSBPoints.find(*itPt) == fpRegisteredSBPoints.end())
205  && HasInBarycenter(*itPt, pMinDist)) // first version used HasIn method
206  {
207  // the point is added
208  this->AddSBPoint(*itPt);
209  if(this->GetSize() >= (unsigned int)pMinPts)
210  {
211  return;
212  }
213  // restart from scratch
214  itPt = pPtsToCheck->begin();
215  }else
216  {
217  ++itPt;
218  }
219  }
220 }
void AddSBPoint(SBPoint *pSBPoint)
unsigned int GetSize() const
bool HasInBarycenter(const SBPoint *, G4double)

Here is the call graph for this function:

G4ThreeVector ClusterSBPoints::GetBarycenter ( ) const

Definition at line 90 of file ClusterSBPoints.cc.

91 {
92  G4double x = 0;
93  G4double y = 0;
94  G4double z = 0;
95 
96  std::set<SBPoint* >::iterator itSDSPt;
97  for(itSDSPt = fpRegisteredSBPoints.begin();
98  itSDSPt != fpRegisteredSBPoints.end();
99  ++itSDSPt)
100  {
101  x+= (*itSDSPt)->GetPosition().x();
102  y+= (*itSDSPt)->GetPosition().y();
103  z+= (*itSDSPt)->GetPosition().z();
104  }
105 
106  return G4ThreeVector(
107  x/fpRegisteredSBPoints.size(),
108  y/fpRegisteredSBPoints.size(),
109  z/fpRegisteredSBPoints.size());
110 }
CLHEP::Hep3Vector G4ThreeVector
tuple x
Definition: test.py:50
tuple z
Definition: test.py:28
double G4double
Definition: G4Types.hh:76

Here is the caller graph for this function:

G4double ClusterSBPoints::GetEdep ( ) const

Definition at line 114 of file ClusterSBPoints.cc.

115 {
116  G4double res = 0;
117  std::set<SBPoint* >::iterator itSDSPt;
118  for(itSDSPt = fpRegisteredSBPoints.begin();
119  itSDSPt != fpRegisteredSBPoints.end();
120  ++itSDSPt)
121  {
122  res += (*itSDSPt)->GetEdep();
123  }
124  return res;
125 }
double G4double
Definition: G4Types.hh:76
std::set<SBPoint* > ClusterSBPoints::GetRegistredSBPoints ( ) const
inline

Definition at line 85 of file ClusterSBPoints.hh.

86  {
87  return fpRegisteredSBPoints;
88  }

Here is the caller graph for this function:

unsigned int ClusterSBPoints::GetSize ( ) const
inline

Definition at line 64 of file ClusterSBPoints.hh.

65  {
66  return fpRegisteredSBPoints.size();
67  }

Here is the caller graph for this function:

bool ClusterSBPoints::HasIn ( const SBPoint pPtToCheck,
G4double  pMinDist 
)

Definition at line 224 of file ClusterSBPoints.cc.

225 {
226  // check if the given point is near one of the cluster's point
227  std::set<SBPoint*>::iterator itClusPt;
228  for(itClusPt = fpRegisteredSBPoints.begin();
229  itClusPt != fpRegisteredSBPoints.end();
230  ++itClusPt)
231  {
232  // if are two different pts
233  if((*pPtToCheck != *(*itClusPt)))
234  {
235  // if close enought of an include point of the cluster
236  if( AreOnTheSameCluster(pPtToCheck, *itClusPt, pMinDist) )
237  {
238  return true;
239  }
240  }
241  }
242  return false;
243 }
bool AreOnTheSameCluster(const SBPoint *pPt1, const SBPoint *pPt2, G4double pMinDist)

Here is the call graph for this function:

bool ClusterSBPoints::HasInBarycenter ( const SBPoint pPtToCheck,
G4double  pMinDist 
)

Definition at line 247 of file ClusterSBPoints.cc.

249 {
250 
251  G4double x1=pPtToCheck->GetPosition().x()/nm;
252  G4double y1=pPtToCheck->GetPosition().y()/nm;
253  G4double z1=pPtToCheck->GetPosition().z()/nm;
254 
255  G4double x2=this->GetBarycenter().x()/nm;
256  G4double y2=this->GetBarycenter().y()/nm;
257  G4double z2=this->GetBarycenter().z()/nm;
258 
259  // if the two points are closed enough
260  if(((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2))<=
261  (pMinDist/nm*pMinDist/nm))
262  {
263  return true;
264  }else
265  {
266  return false;
267  }
268 }
double x() const
double z() const
static constexpr double nm
Definition: G4SIunits.hh:112
double y() const
G4ThreeVector GetBarycenter() const
double G4double
Definition: G4Types.hh:76
G4ThreeVector GetPosition() const
Definition: SBPoint.hh:60

Here is the call graph for this function:

Here is the caller graph for this function:

bool ClusterSBPoints::IsDSB ( ) const
inline

Definition at line 54 of file ClusterSBPoints.hh.

55  {
56  return fIsDoubleSB;
57  }

Here is the caller graph for this function:

bool ClusterSBPoints::IsSSB ( ) const
inline

Definition at line 59 of file ClusterSBPoints.hh.

60  {
61  return ! IsDSB();
62  }
bool IsDSB() const

Here is the call graph for this function:

void ClusterSBPoints::MergeWith ( ClusterSBPoints pCluster)

this will insert all registredSBPoint from the given cluster to this cluster.

Definition at line 274 of file ClusterSBPoints.cc.

275 {
276  std::set<SBPoint*> points = pCluster->GetRegistredSBPoints();
277  pCluster->Clear();
278  std::set<SBPoint*>::iterator itPt;
279  for(itPt = points.begin(); itPt != points.end(); ++itPt)
280  {
281  this->AddSBPoint(*itPt);
282  }
283 }
void AddSBPoint(SBPoint *pSBPoint)
std::set< SBPoint * > GetRegistredSBPoints() const

Here is the call graph for this function:

void ClusterSBPoints::NoticeInternalPts ( )

will set to all store SBPoint they are part of this cluster


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