LArSoft  v08_16_00
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 23 of file Seed.cxx.

References fIsValid.

Referenced by Reverse().

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

Definition at line 43 of file Seed.cxx.

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

44  {
45  for(int i=0; i!=3; i++)
46  {
47  fSeedPoint[i] = Pt[i];
48  fSeedDirection[i] = Dir[i];
49  fSeedPointError[i] = PtErr[i];
50  fSeedDirectionError[i] = DirErr[i];
51  }
52  fIsValid=true;
53  }
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 30 of file Seed.cxx.

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

31  {
32  for(int i=0; i!=3; i++)
33  {
34  fSeedPoint[i] = Pt[i];
35  fSeedDirection[i] = Dir[i];
36  fSeedPointError[i] = 0;
37  fSeedDirectionError[i] = 0;
38  }
39  fIsValid=true;
40  }
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 194 of file Seed.cxx.

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

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

Definition at line 241 of file Seed.cxx.

References fSeedPoint, and GetPoint().

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

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

Definition at line 255 of file Seed.cxx.

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

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

Definition at line 157 of file Seed.cxx.

References fSeedDirection.

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

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

Definition at line 320 of file Seed.cxx.

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

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

Definition at line 166 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

167  {
168  double OtherPt[3];
169  double OtherPtErr[3];
170 
171  AnotherSeed.GetPoint( OtherPt, OtherPtErr );
172 
173  TVector3 OtherPtV( OtherPt[0], OtherPt[1], OtherPt[2] );
174  TVector3 ThisDirV( fSeedDirection[0], fSeedDirection[1], fSeedDirection[2] );
175  TVector3 ThisPtV( fSeedPoint[0], fSeedPoint[1], fSeedPoint[2] );
176 
177  return (OtherPtV-ThisPtV).Angle(ThisDirV.Unit());
178  }
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 224 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

225  {
226  double OtherPt[3];
227  double OtherPtErr[3];
228 
229  AnotherSeed.GetPoint( OtherPt, OtherPtErr );
230 
231  TVector3 OtherPtV( OtherPt[0], OtherPt[1], OtherPt[2] );
232  TVector3 ThisDirV( fSeedDirection[0], fSeedDirection[1], fSeedDirection[2] );
233  TVector3 ThisPtV( fSeedPoint[0], fSeedPoint[1], fSeedPoint[2] );
234 
235 
236  return ((OtherPtV-ThisPtV) - ThisDirV.Unit()*(ThisDirV.Unit().Dot(OtherPtV-ThisPtV))).Mag();
237  }
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 181 of file Seed.cxx.

References fSeedPoint, and GetPoint().

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

Definition at line 72 of file Seed.cxx.

References fIsValid.

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

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

Definition at line 57 of file Seed.cxx.

References fSeedDirection, and fSeedPoint.

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

Definition at line 79 of file Seed.cxx.

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

80  {
81  double NewSeedDir[3];
82  for(size_t n=0; n!=3; ++n)
83  {
84  NewSeedDir[n]=-fSeedDirection[n];
85  }
86  return Seed(fSeedPoint, NewSeedDir, fSeedPointError, fSeedDirectionError);
87 
88  }
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 135 of file Seed.cxx.

References fIsValid, fSeedDirection, and fSeedDirectionError.

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

136  {
137  for(int i=0; i!=3; i++)
138  {
139  fSeedDirection[i] = Dir[i];
140  fSeedDirectionError[i] = Err[i];
141  }
142  fIsValid=true;
143  }
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 121 of file Seed.cxx.

References SetDirection().

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

Definition at line 146 of file Seed.cxx.

References fIsValid, fSeedPoint, and fSeedPointError.

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

147  {
148  for(int i=0; i!=3; i++)
149  {
150  fSeedPoint[i] = Pt[i];
151  fSeedPointError[i] = Err[i];
152  }
153  fIsValid=true;
154  }
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 128 of file Seed.cxx.

References SetPoint().

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

Definition at line 92 of file Seed.cxx.

References fIsValid.

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

93  {
94  fIsValid=Validity;
95  }
bool fIsValid
Definition: Seed.h:31

Friends And Related Function Documentation

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

Definition at line 359 of file Seed.cxx.

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

Definition at line 343 of file Seed.cxx.

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

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: