Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

recobase::Cluster Class Reference

A collection of associated CellHits in either one or two views. More...

#include <Cluster.h>

List of all members.

Public Member Functions

 Cluster ()
 Cluster (vector< const recobase::CellHit * > &cellvec)
 ~Cluster ()
bool Add (const recobase::CellHit *cell)
int NPlane () const
int NXPlane () const
int NYPlane () const
int Plane (int i) const
int XPlane (int i) const
int YPlane (int i) const
int NCell () const
int NXCell () const
int NYCell () const
int NCell (geo::View_t view) const
bool Is3D () const
const recobase::CellHitXCell (int i) const
const recobase::CellHitYCell (int i) const
const recobase::CellHitCell (geo::View_t view, int i) const
const recobase::CellHitXCell (int icell, int iplane) const
const recobase::CellHitYCell (int icell, int iplane) const
const recobase::CellHitCell (geo::View_t view, int icell, int iplane) const
const double * XYZT () const
double Z () const
double dZ () const
double T () const
double dT () const
double X () const
double dX () const
double Y () const
double dY () const
double Q () const
double dQ () const
void SetQ (double q)
void SetdQ (double dq)
void SetXYZT (double x[])
void SetdXYZT (double dx[])
void Clear ()

Private Member Functions

 ClassDef (Cluster, 2)

Private Attributes

vector< const recobase::CellHit * > fXCell
vector< const recobase::CellHit * > fYCell
vector< int > fXPlane
 sorted vector of x-planes
vector< int > fYPlane
 sorted vector of y-planes
vector< int > fPlane
 sorted vector of planes
short fStatus
double f4Vec [4]
double fd4Vec [4]
double fQ
double fdQ


Detailed Description

A collection of associated CellHits in either one or two views.

Definition at line 23 of file Cluster.h.


Constructor & Destructor Documentation

Cluster::Cluster  ) 
 

Definition at line 25 of file Cluster.cxx.

References Clear().

00025                  : 
00026   fXPlane(0), fYPlane(0), fPlane(0), fStatus(0), 
00027   fQ(0), fdQ(0)
00028 {
00029   Clear();
00030 } 

Cluster::Cluster vector< const recobase::CellHit * > &  cellvec  ) 
 

Definition at line 63 of file Cluster.cxx.

References f4Vec, fd4Vec, fPlane, fXCell, fXPlane, fYCell, fYPlane, and Plane().

00063                                              : 
00064   fXPlane(0), 
00065   fYPlane(0),
00066   fPlane(0),
00067   fStatus(0), 
00068   fQ(0),
00069   fdQ(0)
00070 {
00071   for (int i=0; i<4; ++i) {
00072     f4Vec[i] = -1.e9;
00073     fd4Vec[i] = 0.;
00074   }
00075 
00076   for (unsigned int i=0; i<cell.size(); ++i) {
00077     if (cell[i]->View() == geo::kX) { // cell is in a x-plane
00078       fXCell.push_back(cell[i]);
00079       if (find(fXPlane.begin(),fXPlane.end(),cell[i]->Plane()) ==
00080           fXPlane.end()) fXPlane.push_back(cell[i]->Plane());
00081     }
00082     else { // cell is in a y-plane
00083       fYCell.push_back(cell[i]);
00084       if (find(fYPlane.begin(),fYPlane.end(),cell[i]->Plane()) ==
00085           fYPlane.end()) fYPlane.push_back(cell[i]->Plane());      
00086     }
00087 
00088     if (find(fPlane.begin(),fPlane.end(),cell[i]->Plane()) ==
00089         fPlane.end()) fPlane.push_back(cell[i]->Plane());
00090   }
00091 
00092   // sort planes
00093   sort(fXPlane.begin(),fXPlane.end());
00094   sort(fYPlane.begin(),fYPlane.end());
00095   sort(fPlane.begin(),fPlane.end());
00096 
00097 } 

Cluster::~Cluster  ) 
 

Definition at line 102 of file Cluster.cxx.

00103 {
00104 
00105 }


Member Function Documentation

bool Cluster::Add const recobase::CellHit cell  ) 
 

Definition at line 266 of file Cluster.cxx.

References recobase::CellHit::Cell(), fPlane, fXCell, fXPlane, fYCell, fYPlane, NXCell(), NYCell(), recobase::CellHit::Plane(), recobase::CellHit::View(), XCell(), and YCell().

Referenced by recobase::Prong::Add(), cluster::HitClusterFast::MakeCluster(), cluster::HitCluster::MakeClusters(), clusterss::MakeClusterSS::PruneCellList(), trk::DemoShell::Reco(), and clust::Clust2D::Reco().

00267 {
00268   bool foundDup = false;
00269 
00270   if (cell->View() == geo::kX) {
00271     for (int i=0; i<this->NXCell(); ++i) {
00272       const CellHit* c2 = this->XCell(i);
00273       if (c2->Plane() == cell->Plane() && c2->Cell() == cell->Cell()) {
00274         foundDup = true;
00275         break;
00276       }
00277     }
00278     if (!foundDup){
00279       fXCell.push_back(cell);
00280       fXPlane.push_back(cell->Plane());
00281       fPlane.push_back(cell->Plane()); 
00282       sort(fXPlane.begin(),fXPlane.end());
00283     }
00284   }
00285   else {
00286     for (int i=0; i<this->NYCell(); ++i) {
00287       const CellHit* c2 = this->YCell(i);
00288       if (c2->Plane() == cell->Plane() && c2->Cell() == cell->Cell()) {
00289         foundDup = true;
00290         break;
00291       }
00292     }
00293     if (!foundDup){ 
00294       fYCell.push_back(cell);
00295       fYPlane.push_back(cell->Plane());
00296       fPlane.push_back(cell->Plane());
00297       sort(fYPlane.begin(),fYPlane.end());
00298     }
00299 
00300   }
00301 
00302   if (!foundDup){
00303     sort(fPlane.begin(),fPlane.end());
00304   }
00305 
00306   return !foundDup;
00307 }

const CellHit * Cluster::Cell geo::View_t  view,
int  icell,
int  iplane
const
 

Definition at line 251 of file Cluster.cxx.

References XCell(), and YCell().

00252 {
00253 
00254   if(view==geo::kX){
00255     return this->XCell(icell,iplane);
00256   }
00257   else if(view==geo::kY){
00258     return this->YCell(icell,iplane);
00259   }
00260 
00261   return 0;
00262 
00263 }

const CellHit * Cluster::Cell geo::View_t  view,
int  i
const
 

Definition at line 235 of file Cluster.cxx.

References XCell(), and YCell().

Referenced by clusterss::MakeClusterSS::FindAllTransverseWindows(), and clusterss::CompareClusters::MatchCells().

00236 {
00237   if(view==geo::kX){
00238     return this->XCell(i);
00239   }
00240   else if(view==geo::kY){
00241     return this->YCell(i);
00242   }
00243 
00244   return 0;
00245 }

recobase::Cluster::ClassDef Cluster  ,
[private]
 

void Cluster::Clear  ) 
 

Definition at line 33 of file Cluster.cxx.

References f4Vec, fd4Vec, fdQ, fPlane, fQ, fStatus, fXCell, fXPlane, fYCell, and fYPlane.

Referenced by Cluster(), and cluster::HitClusterFast::MakeCluster().

00034 {
00035   fXPlane.clear();
00036   fYPlane.clear();
00037   fPlane.clear();
00038   fStatus=0;
00039   fQ=0;
00040   fdQ=0;  
00041 
00042 
00043   for (int i=0; i<4; ++i) {
00044     f4Vec[i] = -1.e9;
00045     fd4Vec[i] = 0.;
00046   }
00047 
00048   for (unsigned int i=0; i<fXCell.size(); ++i)
00049     delete fXCell[i];
00050 
00051   for (unsigned int i=0; i<fYCell.size(); ++i)
00052     delete fYCell[i];
00053 
00054   fXCell.clear();
00055   fYCell.clear();
00056 
00057 }

double recobase::Cluster::dQ  )  const [inline]
 

Definition at line 66 of file Cluster.h.

00066 {return fdQ;}

double recobase::Cluster::dT  )  const [inline]
 

Definition at line 60 of file Cluster.h.

Referenced by rpr::TrackReco::CalcChi2Ndof(), rpr::TrackReco::Connection(), and rpr::FindTrackSeg::DoView().

00060 {return fd4Vec[3];}

double recobase::Cluster::dX  )  const [inline]
 

Definition at line 62 of file Cluster.h.

00062 {return fd4Vec[0];}

double recobase::Cluster::dY  )  const [inline]
 

Definition at line 64 of file Cluster.h.

00064 {return fd4Vec[1];}

double recobase::Cluster::dZ  )  const [inline]
 

Definition at line 58 of file Cluster.h.

Referenced by rpr::FindTrackSeg::DoView().

00058 {return fd4Vec[2];}

bool recobase::Cluster::Is3D  )  const [inline]
 

Definition at line 46 of file Cluster.h.

00046 {return (this->NXPlane()>0 && this->NYPlane()>0); }

int Cluster::NCell geo::View_t  view  )  const
 

Definition at line 172 of file Cluster.cxx.

References NCell(), NXCell(), and NYCell().

00173 {
00174   if(view==geo::kX){
00175     return this->NXCell();
00176   }
00177   else if(view==geo::kY){
00178     return this->NYCell();
00179   }
00180   return this->NCell();
00181 }

int Cluster::NCell  )  const
 

Definition at line 165 of file Cluster.cxx.

References NXCell(), and NYCell().

Referenced by clusterss::CompareClusters::Ana(), clusterss::MakeClusterSS::FindAllTransverseWindows(), cluster::HitCluster::Fit3HitClust(), cluster::HitCluster::FitClust(), cluster::HitClusterFast::MakeCluster(), clusterss::CompareClusters::MatchCells(), NCell(), and clusterss::MakeClusterSS::PruneCellList().

00166 {
00167   return this->NXCell() + this->NYCell();
00168 }

int recobase::Cluster::NPlane  )  const [inline]
 

Definition at line 33 of file Cluster.h.

00033 {return fXPlane.size() + fYPlane.size(); }

int Cluster::NXCell  )  const
 

Definition at line 151 of file Cluster.cxx.

References fXCell.

Referenced by Add(), evd::RecoBaseDrawer::GetClusterOutlines(), NCell(), cluster::Clusterer::UpdateClusterStat(), and XCell().

00152 {
00153   return fXCell.size();
00154 }

int recobase::Cluster::NXPlane  )  const [inline]
 

Definition at line 34 of file Cluster.h.

00034 {return fXPlane.size(); }

int Cluster::NYCell  )  const
 

Definition at line 158 of file Cluster.cxx.

References fYCell.

Referenced by Add(), evd::RecoBaseDrawer::GetClusterOutlines(), NCell(), cluster::Clusterer::UpdateClusterStat(), and YCell().

00159 {
00160   return fYCell.size();
00161 }

int recobase::Cluster::NYPlane  )  const [inline]
 

Definition at line 35 of file Cluster.h.

00035 {return fYPlane.size(); }

int Cluster::Plane int  i  )  const
 

Definition at line 129 of file Cluster.cxx.

References assert_jobc, fPlane, fXPlane, fYPlane, XPlane(), and YPlane().

Referenced by rpr::TrackReco::CalcChi2Ndof(), Cluster(), rpr::TrackReco::Connection(), rpr::FindTrackSeg::DoView(), and cluster::Clusterer::UpdateClusterStat().

00130 {
00131   unsigned int j = i;
00132   
00133   if(!(i >= 0 && j < (fPlane.size()))) {
00134     
00135     cout << "error.. out of bound request " << i << " has " 
00136          << fYPlane.size() << ", " << fXPlane.size() << endl;
00137   
00138 }
00139 
00140   assert_jobc((i >= 0 && j < (fPlane.size())),
00141               "Cluster::Plane(): out of bounds exception!");
00142   
00143   if (fYPlane.empty()) return this->XPlane(i);
00144   if (fXPlane.empty()) return this->YPlane(i);
00145   
00146   return fPlane[j];
00147 }

double recobase::Cluster::Q  )  const [inline]
 

Definition at line 65 of file Cluster.h.

Referenced by clusterss::CompareClusters::Ana(), and clusterss::MakeClusterSS::PruneCellList().

00065 {return fQ;}

void recobase::Cluster::SetdQ double  dq  )  [inline]
 

Definition at line 69 of file Cluster.h.

00069 { fdQ = dq; }

void recobase::Cluster::SetdXYZT double  dx[]  )  [inline]
 

Definition at line 71 of file Cluster.h.

Referenced by cluster::Clusterer::UpdateClusterStat().

00071 { for (int i=0; i<4; ++i) fd4Vec[i] = dx[i]; }

void recobase::Cluster::SetQ double  q  )  [inline]
 

Definition at line 68 of file Cluster.h.

Referenced by clusterss::MakeClusterSS::PruneCellList(), and cluster::Clusterer::UpdateClusterStat().

00068 { fQ = q; }

void recobase::Cluster::SetXYZT double  x[]  )  [inline]
 

Definition at line 70 of file Cluster.h.

Referenced by cluster::Clusterer::UpdateClusterStat().

00070 { for (int i=0; i<4; ++i) f4Vec[i] = x[i]; }

double recobase::Cluster::T  )  const [inline]
 

Definition at line 59 of file Cluster.h.

Referenced by rpr::TrackReco::CalcChi2Ndof(), rpr::TrackReco::Connection(), and rpr::FindTrackSeg::DoView().

00059 {return f4Vec[3];}

double recobase::Cluster::X  )  const [inline]
 

Definition at line 61 of file Cluster.h.

00061 {return f4Vec[0];}

const CellHit * Cluster::XCell int  icell,
int  iplane
const
 

Definition at line 196 of file Cluster.cxx.

References recobase::CellHit::Cell(), NXCell(), recobase::CellHit::Plane(), and XCell().

00197 {
00198   for (int i=0; i<this->NXCell(); ++i) {
00199     const CellHit* c2 = this->XCell(i);
00200     if (c2->Plane() == iplane &&
00201         c2->Cell() == icell)
00202       return c2;
00203   }
00204 
00205   return 0;
00206 }

const CellHit * Cluster::XCell int  i  )  const
 

Definition at line 185 of file Cluster.cxx.

References assert_jobc, fXCell, and NXCell().

Referenced by Add(), Cell(), evd::RecoBaseDrawer::GetClusterOutlines(), cluster::Clusterer::UpdateClusterStat(), and XCell().

00186 {
00187   assert_jobc((i >= 0) && (i < this->NXCell()),
00188               "Cluster::XCell(): out of bounds exception!");
00189 
00190   unsigned int j = i;
00191   return fXCell[j];
00192 }

int Cluster::XPlane int  i  )  const
 

Definition at line 109 of file Cluster.cxx.

References assert_jobc, and fXPlane.

Referenced by Plane().

00110 {
00111   unsigned int j = i;
00112   assert_jobc((i >= 0 && j < fXPlane.size()),
00113               "Cluster::XPlane(): out of bounds exception!");
00114   return fXPlane[j];
00115 }

const double* recobase::Cluster::XYZT  )  const [inline]
 

Definition at line 56 of file Cluster.h.

00056 { return f4Vec; }

double recobase::Cluster::Y  )  const [inline]
 

Definition at line 63 of file Cluster.h.

00063 {return f4Vec[1];}

const CellHit * Cluster::YCell int  icell,
int  iplane
const
 

Definition at line 221 of file Cluster.cxx.

References recobase::CellHit::Cell(), NYCell(), recobase::CellHit::Plane(), and YCell().

00222 {
00223   for (int i=0; i<this->NYCell(); ++i) {
00224     const CellHit* c2 = this->YCell(i);
00225     if (c2->Plane() == iplane &&
00226         c2->Cell() == icell)
00227       return c2;
00228   }
00229   
00230   return 0;
00231 }

const CellHit * Cluster::YCell int  i  )  const
 

Definition at line 210 of file Cluster.cxx.

References assert_jobc, fYCell, and NYCell().

Referenced by Add(), Cell(), evd::RecoBaseDrawer::GetClusterOutlines(), cluster::Clusterer::UpdateClusterStat(), and YCell().

00211 {
00212   assert_jobc((i >= 0) && (i < this->NYCell()),
00213               "Cluster::YCell(): out of bounds exception!");
00214   
00215   unsigned int j = i;
00216   return fYCell[j];
00217 }

int Cluster::YPlane int  i  )  const
 

Definition at line 119 of file Cluster.cxx.

References assert_jobc, and fYPlane.

Referenced by Plane().

00120 {
00121   unsigned int j = i;
00122   assert_jobc((i >= 0 && j < fYPlane.size()),
00123               "Cluster::YPlane(): out of bounds exception!");
00124   return fYPlane[j];
00125 }

double recobase::Cluster::Z  )  const [inline]
 

Definition at line 57 of file Cluster.h.

Referenced by rpr::FindTrackSeg::DoView(), and zSort().

00057 {return f4Vec[2];}


Member Data Documentation

double recobase::Cluster::f4Vec[4] [private]
 

Definition at line 84 of file Cluster.h.

Referenced by Clear(), and Cluster().

double recobase::Cluster::fd4Vec[4] [private]
 

Definition at line 85 of file Cluster.h.

Referenced by Clear(), and Cluster().

double recobase::Cluster::fdQ [private]
 

Definition at line 86 of file Cluster.h.

Referenced by Clear().

vector<int> recobase::Cluster::fPlane [private]
 

sorted vector of planes

Definition at line 81 of file Cluster.h.

Referenced by Add(), Clear(), Cluster(), and Plane().

double recobase::Cluster::fQ [private]
 

Definition at line 86 of file Cluster.h.

Referenced by Clear().

short recobase::Cluster::fStatus [private]
 

Definition at line 83 of file Cluster.h.

Referenced by Clear().

vector<const recobase::CellHit*> recobase::Cluster::fXCell [private]
 

Definition at line 76 of file Cluster.h.

Referenced by Add(), Clear(), Cluster(), NXCell(), and XCell().

vector<int> recobase::Cluster::fXPlane [private]
 

sorted vector of x-planes

Definition at line 79 of file Cluster.h.

Referenced by Add(), Clear(), Cluster(), Plane(), and XPlane().

vector<const recobase::CellHit*> recobase::Cluster::fYCell [private]
 

Definition at line 77 of file Cluster.h.

Referenced by Add(), Clear(), Cluster(), NYCell(), and YCell().

vector<int> recobase::Cluster::fYPlane [private]
 

sorted vector of y-planes

Definition at line 80 of file Cluster.h.

Referenced by Add(), Clear(), Cluster(), Plane(), and YPlane().


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 04:45:32 2009 for NOvA Offline by  doxygen 1.3.9.1