Public Member Functions | Private Attributes | List of all members
ClusterHitsInTime Class Reference

#include <DAQQuickClustering_module.h>

Public Member Functions

 ClusterHitsInTime (double TimeWindow)
 
void DoIt (std::vector< recoHit > cHitVector)
 
double GetTimeWindow () const
 
int getNClusters () const
 
std::vector< clustergetClusterVector () const
 
void SetTimeWindow (double inTimeWindow=1)
 

Private Attributes

int fNClusters = 0
 
double fTimeWindow = 0
 
std::vector< recoHitfHitVector
 
std::vector< clusterfVecClusters
 

Detailed Description

Definition at line 170 of file DAQQuickClustering_module.h.

Constructor & Destructor Documentation

ClusterHitsInTime::ClusterHitsInTime ( double  TimeWindow)
inline

Definition at line 173 of file DAQQuickClustering_module.h.

173  : fNClusters(0),
174  fTimeWindow(TimeWindow),
175  fHitVector(),
176  fVecClusters(){};
std::vector< cluster > fVecClusters
std::vector< recoHit > fHitVector

Member Function Documentation

void ClusterHitsInTime::DoIt ( std::vector< recoHit cHitVector)

Definition at line 3 of file DAQQuickClustering_module.cc.

4 {
5  fHitVector.clear();
6  fHitVector = cHitVector;
7 
8  //ORDER IN THE HIT VECTOR BY TIME.
9  std::sort(fHitVector.begin(), fHitVector.end(),
10  [](const recoHit& lhs, const recoHit& rhs){return lhs<rhs;});
11 
12  for(unsigned int i = 0; i < fHitVector.size()-1; i++)
13  {
14  //std::cout << "fHitVector.at(" << i << ").getHitTime() " << fHitVector.at(i).getHitTime()
15  // << std::endl;
16  std::vector<recoHit> vec_TempHits;
17  if(std::abs(fHitVector.at(i).getHitTime()-fHitVector.at(i+1).getHitTime())<=fTimeWindow)
18  {
19  int timeCount = 1;
20 
21  vec_TempHits.push_back(fHitVector.at(i));
22  vec_TempHits.push_back(fHitVector.at(i+1));
23 
24  while((i+timeCount+1)<fHitVector.size() &&
25  std::abs(fHitVector.at(i+timeCount).getHitTime()-fHitVector.at(i+timeCount+1).getHitTime()) <= fTimeWindow)
26  {
27  vec_TempHits.push_back(fHitVector.at(i + timeCount + 1));
28  timeCount++;
29  }
30 
31  i = i + timeCount;
32  cluster temp(fHitVector.at(0).getEvent(), vec_TempHits);
33  fVecClusters.push_back(temp);
34  }
35  }
36 
37  fNClusters = fVecClusters.size();
38 }
Cluster finding and building.
T abs(T value)
std::vector< cluster > fVecClusters
std::vector< recoHit > fHitVector
std::vector<cluster> ClusterHitsInTime::getClusterVector ( ) const
inline

Definition at line 181 of file DAQQuickClustering_module.h.

181 { return fVecClusters; };
std::vector< cluster > fVecClusters
int ClusterHitsInTime::getNClusters ( ) const
inline

Definition at line 180 of file DAQQuickClustering_module.h.

double ClusterHitsInTime::GetTimeWindow ( ) const
inline

Definition at line 179 of file DAQQuickClustering_module.h.

179 { return fTimeWindow; };
void ClusterHitsInTime::SetTimeWindow ( double  inTimeWindow = 1)
inline

Definition at line 183 of file DAQQuickClustering_module.h.

183 { fTimeWindow = inTimeWindow; };

Member Data Documentation

std::vector<recoHit> ClusterHitsInTime::fHitVector
private

Definition at line 188 of file DAQQuickClustering_module.h.

int ClusterHitsInTime::fNClusters = 0
private

Definition at line 186 of file DAQQuickClustering_module.h.

double ClusterHitsInTime::fTimeWindow = 0
private

Definition at line 187 of file DAQQuickClustering_module.h.

std::vector<cluster> ClusterHitsInTime::fVecClusters
private

Definition at line 189 of file DAQQuickClustering_module.h.


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