LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
recob::Seed Class Reference

#include "Seed.h"

Public Member Functions

 Seed ()
 
 Seed (double *Pt, double *Dir, double *PtErr, double *DirErr)
 
void GetDirection (double *Dir, double *Err) const
 
void GetPoint (double *Pt, double *Err) const
 
double GetLength () const
 
void Print () const
 
void SetDirection (double *Dir, double *Err)
 
void SetPoint (double *Pt, double *Err)
 
double GetAngle (Seed const &AnotherSeed) const
 
double GetProjDiscrepancy (Seed const &AnotherSeed) const
 
double GetProjAngleDiscrepancy (Seed const &AnotherSeed) const
 
double GetDistance (Seed const &AnotherSeed) const
 
Seed Reverse ()
 
void GetVectorBetween (Seed const &AnotherSeed, double *xyz) const
 
double GetDistanceFrom (SpacePoint const &SomePoint) const
 
int GetPointingSign (Seed const &AnotherSeed) const
 
 Seed (double *Pt, double *Dir)
 
void SetDirection (double *Dir)
 
void SetPoint (double *Pt)
 
bool IsValid () const
 
void SetValidity (bool Validity)
 

Private Attributes

double fSeedPoint [3]
 
double fSeedDirection [3]
 
double fSeedPointError [3]
 
double fSeedDirectionError [3]
 
bool fIsValid
 

Friends

std::ostream & operator<< (std::ostream &stream, Seed const &a)
 
bool operator< (const Seed &a, const Seed &b)
 

Detailed Description

Definition at line 20 of file Seed.h.

Constructor & Destructor Documentation

recob::Seed::Seed ( )

Definition at line 25 of file Seed.cxx.

References fIsValid.

Referenced by Reverse().

26  {
27  fIsValid=false;
28  }
bool fIsValid
Definition: Seed.h:31
recob::Seed::Seed ( double *  Pt,
double *  Dir,
double *  PtErr,
double *  DirErr 
)

Definition at line 45 of file Seed.cxx.

References fIsValid, fSeedDirection, fSeedDirectionError, fSeedPoint, and fSeedPointError.

46  {
47  for(int i=0; i!=3; i++)
48  {
49  fSeedPoint[i] = Pt[i];
50  fSeedDirection[i] = Dir[i];
51  fSeedPointError[i] = PtErr[i];
52  fSeedDirectionError[i] = DirErr[i];
53  }
54  fIsValid=true;
55  }
double fSeedDirection[3]
Definition: Seed.h:28
bool fIsValid
Definition: Seed.h:31
double fSeedDirectionError[3]
Definition: Seed.h:30
double fSeedPoint[3]
Definition: Seed.h:27
double fSeedPointError[3]
Definition: Seed.h:29
recob::Seed::Seed ( double *  Pt,
double *  Dir 
)

Definition at line 32 of file Seed.cxx.

References fIsValid, fSeedDirection, fSeedDirectionError, fSeedPoint, and fSeedPointError.

33  {
34  for(int i=0; i!=3; i++)
35  {
36  fSeedPoint[i] = Pt[i];
37  fSeedDirection[i] = Dir[i];
38  fSeedPointError[i] = 0;
39  fSeedDirectionError[i] = 0;
40  }
41  fIsValid=true;
42  }
double fSeedDirection[3]
Definition: Seed.h:28
bool fIsValid
Definition: Seed.h:31
double fSeedDirectionError[3]
Definition: Seed.h:30
double fSeedPoint[3]
Definition: Seed.h:27
double fSeedPointError[3]
Definition: Seed.h:29

Member Function Documentation

double recob::Seed::GetAngle ( Seed const &  AnotherSeed) const

Definition at line 196 of file Seed.cxx.

References fSeedDirection, GetDirection(), and GetLength().

197  {
198  double OtherDir[3];
199  double OtherDirErr[3];
200  AnotherSeed.GetDirection(OtherDir,OtherDirErr);
201 
202  double OtherMag = AnotherSeed.GetLength();
203  double ThisMag = GetLength();
204 
205  /*
206  std::cout<<"Seed angle calc: " <<
207  OtherMag<< " " << ThisMag << " " <<
208  ( (OtherDir[0]*fSeedDirection[0] +
209  OtherDir[1]*fSeedDirection[1] +
210  OtherDir[2]*fSeedDirection[2] ) / (ThisMag*OtherMag)) <<
211  std::endl;
212  */
213 
214 
215  // Need a tiny offset, as acos(1.0) gives unpredictable results due to
216  // floating point precision
217  double eta = 0.00001;
218 
219  return std::acos( ( OtherDir[0]*fSeedDirection[0] +
220  OtherDir[1]*fSeedDirection[1] +
221  OtherDir[2]*fSeedDirection[2] - eta) / (ThisMag*OtherMag));
222  }
double fSeedDirection[3]
Definition: Seed.h:28
double GetLength() const
Definition: Seed.cxx:159
double recob::Seed::GetDistance ( Seed const &  AnotherSeed) const

Definition at line 243 of file Seed.cxx.

References fSeedPoint, and GetPoint().

Referenced by trkf::BezierTrackerAlgorithm::EvaluateOccupancy().

244  {
245  double OtherPt[3];
246  double OtherPtErr[3];
247 
248  AnotherSeed.GetPoint( OtherPt, OtherPtErr );
249 
250  return pow( pow(OtherPt[0]-fSeedPoint[0],2)+
251  pow(OtherPt[1]-fSeedPoint[1],2)+
252  pow(OtherPt[2]-fSeedPoint[2],2), 0.5);
253  }
double fSeedPoint[3]
Definition: Seed.h:27
double recob::Seed::GetDistanceFrom ( recob::SpacePoint const &  SomePoint) const

Definition at line 257 of file Seed.cxx.

References recob::CrossProd(), fSeedDirection, fSeedPoint, and recob::SpacePoint::XYZ().

258  {
259  double SPxyz[3];
260  SPxyz[0]=SomePoint.XYZ()[0];
261  SPxyz[1]=SomePoint.XYZ()[1];
262  SPxyz[2]=SomePoint.XYZ()[2];
263 
264  // std::cout<<"Seed Dir Vec " << fSeedDirection[0]<<" " <<fSeedDirection[1]<< " " << fSeedDirection[2]<<std::endl;
265 
266  double ThisSeedLength =
267  pow( pow(fSeedDirection[0],2) +
268  pow(fSeedDirection[1],2) +
269  pow(fSeedDirection[2],2) , 0.5);
270 
271 
272  double SPProjOnSeed =
273  ( fSeedDirection[0] * ( SPxyz[0] - fSeedPoint[0] ) +
274  fSeedDirection[1] * ( SPxyz[1] - fSeedPoint[1] ) +
275  fSeedDirection[2] * ( SPxyz[2] - fSeedPoint[2] ) )
276  / ThisSeedLength;
277 
278  // std::cout<<"proj : " <<SPProjOnSeed<<std::endl;
279  // std::cout<<"Seed len :" << ThisSeedLength<<std::endl;
280 
281  if(SPProjOnSeed > (ThisSeedLength))
282  {
283  // std::cout<<"Seed over end"<<std::endl;
284  return
285  pow(pow(fSeedPoint[0] + fSeedDirection[0] - SPxyz[0], 2) +
286  pow(fSeedPoint[1] + fSeedDirection[1] - SPxyz[1], 2) +
287  pow(fSeedPoint[2] + fSeedDirection[2] - SPxyz[2], 2), 0.5);
288  }
289  else if(SPProjOnSeed<(0-ThisSeedLength))
290  {
291  // std::cout<<"Seed under end"<<std::endl;
292  return
293  pow(pow(fSeedPoint[0] - fSeedDirection[0] - SPxyz[0], 2) +
294  pow(fSeedPoint[1] - fSeedDirection[1] - SPxyz[1], 2) +
295  pow(fSeedPoint[2] - fSeedDirection[2] - SPxyz[2], 2), 0.5);
296 
297  }
298  else
299  {
300  // std::cout<<"Seed valid region"<<std::endl;
301  double crossprod[3];
302  CrossProd( fSeedPoint[0]+fSeedDirection[0]-SPxyz[0],
303  fSeedPoint[1]+fSeedDirection[1]-SPxyz[1],
304  fSeedPoint[2]+fSeedDirection[2]-SPxyz[2],
305  SPxyz[0]-fSeedPoint[0],
306  SPxyz[1]-fSeedPoint[1],
307  SPxyz[2]-fSeedPoint[2],
308  crossprod[0], crossprod[1], crossprod[2]);
309 
310  return
311  pow( pow(crossprod[0],2) +
312  pow(crossprod[1],2) +
313  pow(crossprod[2],2), 0.5) /
314  pow( pow(fSeedDirection[0],2) +
315  pow(fSeedDirection[1],2) +
316  pow(fSeedDirection[2],2), 0.5);
317 
318  }
319  }
double fSeedDirection[3]
Definition: Seed.h:28
void CrossProd(double x1, double x2, double x3, double y1, double y2, double y3, double &out1, double &out2, double &out3)
Definition: Seed.cxx:335
double fSeedPoint[3]
Definition: Seed.h:27
double recob::Seed::GetLength ( ) const

Definition at line 159 of file Seed.cxx.

References fSeedDirection.

Referenced by trkf::SeedFinderAlgorithm::FindSeeds(), and GetAngle().

160  {
161  return pow(pow(fSeedDirection[0],2)+
162  pow(fSeedDirection[1],2)+
163  pow(fSeedDirection[2],2),0.5);
164  }
double fSeedDirection[3]
Definition: Seed.h:28
int recob::Seed::GetPointingSign ( Seed const &  AnotherSeed) const

Definition at line 322 of file Seed.cxx.

References tca::DotProd(), fSeedDirection, fSeedPoint, and GetPoint().

323  {
324  double OtherPos[3], OtherErr[3];
325  AnotherSeed.GetPoint(OtherPos,OtherErr);
326  double DotProd =
327  (OtherPos[0]-fSeedPoint[0])*fSeedDirection[0]+
328  (OtherPos[1]-fSeedPoint[1])*fSeedDirection[1]+
329  (OtherPos[2]-fSeedPoint[2])*fSeedDirection[2];
330  return ((DotProd>0)-(DotProd<0));
331  }
double fSeedDirection[3]
Definition: Seed.h:28
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:59
double fSeedPoint[3]
Definition: Seed.h:27
double recob::Seed::GetProjAngleDiscrepancy ( Seed const &  AnotherSeed) const

Definition at line 168 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

169  {
170  double OtherPt[3];
171  double OtherPtErr[3];
172 
173  AnotherSeed.GetPoint( OtherPt, OtherPtErr );
174 
175  TVector3 OtherPtV( OtherPt[0], OtherPt[1], OtherPt[2] );
176  TVector3 ThisDirV( fSeedDirection[0], fSeedDirection[1], fSeedDirection[2] );
177  TVector3 ThisPtV( fSeedPoint[0], fSeedPoint[1], fSeedPoint[2] );
178 
179  return (OtherPtV-ThisPtV).Angle(ThisDirV.Unit());
180  }
double fSeedDirection[3]
Definition: Seed.h:28
double fSeedPoint[3]
Definition: Seed.h:27
double recob::Seed::GetProjDiscrepancy ( Seed const &  AnotherSeed) const

Definition at line 226 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

227  {
228  double OtherPt[3];
229  double OtherPtErr[3];
230 
231  AnotherSeed.GetPoint( OtherPt, OtherPtErr );
232 
233  TVector3 OtherPtV( OtherPt[0], OtherPt[1], OtherPt[2] );
234  TVector3 ThisDirV( fSeedDirection[0], fSeedDirection[1], fSeedDirection[2] );
235  TVector3 ThisPtV( fSeedPoint[0], fSeedPoint[1], fSeedPoint[2] );
236 
237 
238  return ((OtherPtV-ThisPtV) - ThisDirV.Unit()*(ThisDirV.Unit().Dot(OtherPtV-ThisPtV))).Mag();
239  }
double fSeedDirection[3]
Definition: Seed.h:28
double fSeedPoint[3]
Definition: Seed.h:27
void recob::Seed::GetVectorBetween ( Seed const &  AnotherSeed,
double *  xyz 
) const

Definition at line 183 of file Seed.cxx.

References fSeedPoint, and GetPoint().

184  {
185  double xyzother[3], err[3];
186  AnotherSeed.GetPoint(xyzother,err);
187 
188  xyz[0] = xyzother[0]-fSeedPoint[0];
189  xyz[1] = xyzother[1]-fSeedPoint[1];
190  xyz[2] = xyzother[2]-fSeedPoint[2];
191 
192  }
double fSeedPoint[3]
Definition: Seed.h:27
bool recob::Seed::IsValid ( ) const

Definition at line 74 of file Seed.cxx.

References fIsValid.

Referenced by trkf::SeedFinderAlgorithm::FindSeeds().

75  {
76  return fIsValid;
77  }
bool fIsValid
Definition: Seed.h:31
void recob::Seed::Print ( ) const

Definition at line 59 of file Seed.cxx.

References fSeedDirection, and fSeedPoint.

60  {
61  std::cout<<"Printing seed contents : "
62  << fSeedPoint[0]<<" "
63  <<fSeedPoint[1]<< " "
64  <<fSeedPoint[2]<<", "
65  << fSeedDirection[0]
66  <<" " <<fSeedDirection[1]
67  <<" " << fSeedDirection[2]
68  <<std::endl;
69 
70  }
double fSeedDirection[3]
Definition: Seed.h:28
double fSeedPoint[3]
Definition: Seed.h:27
Seed recob::Seed::Reverse ( )

Definition at line 81 of file Seed.cxx.

References fSeedDirection, fSeedDirectionError, fSeedPoint, fSeedPointError, n, and Seed().

82  {
83  double NewSeedDir[3];
84  for(size_t n=0; n!=3; ++n)
85  {
86  NewSeedDir[n]=-fSeedDirection[n];
87  }
88  return Seed(fSeedPoint, NewSeedDir, fSeedPointError, fSeedDirectionError);
89 
90  }
double fSeedDirection[3]
Definition: Seed.h:28
double fSeedDirectionError[3]
Definition: Seed.h:30
double fSeedPoint[3]
Definition: Seed.h:27
Char_t n[5]
double fSeedPointError[3]
Definition: Seed.h:29
void recob::Seed::SetDirection ( double *  Dir,
double *  Err 
)

Definition at line 137 of file Seed.cxx.

References fIsValid, fSeedDirection, and fSeedDirectionError.

Referenced by trkf::SeedFinderAlgorithm::ConsolidateSeed(), trkf::FeatureTracker::ExtendSeed(), trkf::SeedFinderAlgorithm::FindSeeds(), and SetDirection().

138  {
139  for(int i=0; i!=3; i++)
140  {
141  fSeedDirection[i] = Dir[i];
142  fSeedDirectionError[i] = Err[i];
143  }
144  fIsValid=true;
145  }
double fSeedDirection[3]
Definition: Seed.h:28
bool fIsValid
Definition: Seed.h:31
double fSeedDirectionError[3]
Definition: Seed.h:30
void recob::Seed::SetDirection ( double *  Dir)

Definition at line 123 of file Seed.cxx.

References SetDirection().

124  {
125  double Empty[3]={0,0,0};
126  SetDirection(Dir, Empty);
127  }
void SetDirection(double *Dir, double *Err)
Definition: Seed.cxx:137
void recob::Seed::SetPoint ( double *  Pt,
double *  Err 
)

Definition at line 148 of file Seed.cxx.

References fIsValid, fSeedPoint, and fSeedPointError.

Referenced by trkf::SeedFinderAlgorithm::ConsolidateSeed(), trkf::FeatureTracker::ExtendSeed(), trkf::SeedFinderAlgorithm::FindSeeds(), and SetPoint().

149  {
150  for(int i=0; i!=3; i++)
151  {
152  fSeedPoint[i] = Pt[i];
153  fSeedPointError[i] = Err[i];
154  }
155  fIsValid=true;
156  }
bool fIsValid
Definition: Seed.h:31
double fSeedPoint[3]
Definition: Seed.h:27
double fSeedPointError[3]
Definition: Seed.h:29
void recob::Seed::SetPoint ( double *  Pt)

Definition at line 130 of file Seed.cxx.

References SetPoint().

131  {
132  double Empty[3]={0,0,0};
133  SetPoint(Pt, Empty);
134  }
void SetPoint(double *Pt, double *Err)
Definition: Seed.cxx:148
void recob::Seed::SetValidity ( bool  Validity)

Definition at line 94 of file Seed.cxx.

References fIsValid.

Referenced by trkf::SeedFinderAlgorithm::ConsolidateSeed(), and trkf::SeedFinderAlgorithm::FindSeeds().

95  {
96  fIsValid=Validity;
97  }
bool fIsValid
Definition: Seed.h:31

Friends And Related Function Documentation

bool operator< ( const Seed a,
const Seed b 
)
friend

Definition at line 361 of file Seed.cxx.

362  {
363  if (a.fSeedPoint[2] != b.fSeedPoint[2])
364  { return a.fSeedPoint[2] < b.fSeedPoint[2]; }
365  else if (a.fSeedPoint[1] != b.fSeedPoint[1])
366  { return a.fSeedPoint[1] < b.fSeedPoint[1]; }
367 
368  return a.fSeedPoint[0] < b.fSeedPoint[0];
369 
370  }
std::ostream& operator<< ( std::ostream &  stream,
Seed const &  a 
)
friend

Definition at line 345 of file Seed.cxx.

346  {
347  o << "Printing seed contents : "
348  << a.fSeedPoint[0] << " "
349  << a.fSeedPoint[1] << " "
350  << a.fSeedPoint[2] << ", "
351  << a.fSeedDirection[0] << " "
352  << a.fSeedDirection[1] << " "
353  << a.fSeedDirection[2];
354 
355  return o;
356  }

Member Data Documentation

bool recob::Seed::fIsValid
private

Definition at line 31 of file Seed.h.

Referenced by IsValid(), Seed(), SetDirection(), SetPoint(), and SetValidity().

double recob::Seed::fSeedDirection[3]
private
double recob::Seed::fSeedDirectionError[3]
private

Definition at line 30 of file Seed.h.

Referenced by GetDirection(), Reverse(), Seed(), and SetDirection().

double recob::Seed::fSeedPointError[3]
private

Definition at line 29 of file Seed.h.

Referenced by GetPoint(), Reverse(), Seed(), and SetPoint().


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