LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 20 of file Seed.cxx.

References fIsValid.

Referenced by Reverse().

21  {
22  fIsValid = false;
23  }
bool fIsValid
Definition: Seed.h:30
recob::Seed::Seed ( double *  Pt,
double *  Dir,
double *  PtErr,
double *  DirErr 
)

Definition at line 38 of file Seed.cxx.

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

39  {
40  for (int i = 0; i != 3; i++) {
41  fSeedPoint[i] = Pt[i];
42  fSeedDirection[i] = Dir[i];
43  fSeedPointError[i] = PtErr[i];
44  fSeedDirectionError[i] = DirErr[i];
45  }
46  fIsValid = true;
47  }
double fSeedDirection[3]
Definition: Seed.h:27
bool fIsValid
Definition: Seed.h:30
double fSeedDirectionError[3]
Definition: Seed.h:29
double fSeedPoint[3]
Definition: Seed.h:26
double fSeedPointError[3]
Definition: Seed.h:28
recob::Seed::Seed ( double *  Pt,
double *  Dir 
)

Definition at line 26 of file Seed.cxx.

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

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

Member Function Documentation

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

Definition at line 165 of file Seed.cxx.

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

166  {
167  double OtherDir[3];
168  double OtherDirErr[3];
169  AnotherSeed.GetDirection(OtherDir, OtherDirErr);
170 
171  double OtherMag = AnotherSeed.GetLength();
172  double ThisMag = GetLength();
173 
174  /*
175  std::cout<<"Seed angle calc: " <<
176  OtherMag<< " " << ThisMag << " " <<
177  ( (OtherDir[0]*fSeedDirection[0] +
178  OtherDir[1]*fSeedDirection[1] +
179  OtherDir[2]*fSeedDirection[2] ) / (ThisMag*OtherMag)) <<
180  std::endl;
181  */
182 
183  // Need a tiny offset, as acos(1.0) gives unpredictable results due to
184  // floating point precision
185  double eta = 0.00001;
186 
187  return std::acos((OtherDir[0] * fSeedDirection[0] + OtherDir[1] * fSeedDirection[1] +
188  OtherDir[2] * fSeedDirection[2] - eta) /
189  (ThisMag * OtherMag));
190  }
double fSeedDirection[3]
Definition: Seed.h:27
double GetLength() const
Definition: Seed.cxx:132
void recob::Seed::GetDirection ( double *  Dir,
double *  Err 
) const

Definition at line 80 of file Seed.cxx.

References fSeedDirection, and fSeedDirectionError.

Referenced by trkf::SeedAna::analyze(), trkf::SeedFinderAlgorithm::ConsolidateSeed(), trkf::SeedFinderAlgorithm::FindSeeds(), GetAngle(), trkf::SeedFinderAlgorithm::GetHitDistAndProj(), trkf::Track3DKalmanHitAlg::makeSurface(), and TrackProducerFromPFParticle::produce().

81  {
82  for (int i = 0; i != 3; i++) {
83  rDir[i] = fSeedDirection[i];
84  if (rDirErr) rDirErr[i] = fSeedDirectionError[i];
85  }
86  }
double fSeedDirection[3]
Definition: Seed.h:27
double fSeedDirectionError[3]
Definition: Seed.h:29
double recob::Seed::GetDistance ( Seed const &  AnotherSeed) const

Definition at line 209 of file Seed.cxx.

References fSeedPoint, and GetPoint().

210  {
211  double OtherPt[3];
212  double OtherPtErr[3];
213 
214  AnotherSeed.GetPoint(OtherPt, OtherPtErr);
215 
216  return pow(pow(OtherPt[0] - fSeedPoint[0], 2) + pow(OtherPt[1] - fSeedPoint[1], 2) +
217  pow(OtherPt[2] - fSeedPoint[2], 2),
218  0.5);
219  }
double fSeedPoint[3]
Definition: Seed.h:26
double recob::Seed::GetDistanceFrom ( recob::SpacePoint const &  SomePoint) const

Definition at line 222 of file Seed.cxx.

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

223  {
224  double SPxyz[3];
225  SPxyz[0] = SomePoint.XYZ()[0];
226  SPxyz[1] = SomePoint.XYZ()[1];
227  SPxyz[2] = SomePoint.XYZ()[2];
228 
229  // std::cout<<"Seed Dir Vec " << fSeedDirection[0]<<" " <<fSeedDirection[1]<< " " << fSeedDirection[2]<<std::endl;
230 
231  double ThisSeedLength =
232  pow(pow(fSeedDirection[0], 2) + pow(fSeedDirection[1], 2) + pow(fSeedDirection[2], 2), 0.5);
233 
234  double SPProjOnSeed = (fSeedDirection[0] * (SPxyz[0] - fSeedPoint[0]) +
235  fSeedDirection[1] * (SPxyz[1] - fSeedPoint[1]) +
236  fSeedDirection[2] * (SPxyz[2] - fSeedPoint[2])) /
237  ThisSeedLength;
238 
239  // std::cout<<"proj : " <<SPProjOnSeed<<std::endl;
240  // std::cout<<"Seed len :" << ThisSeedLength<<std::endl;
241 
242  if (SPProjOnSeed > (ThisSeedLength)) {
243  // std::cout<<"Seed over end"<<std::endl;
244  return pow(pow(fSeedPoint[0] + fSeedDirection[0] - SPxyz[0], 2) +
245  pow(fSeedPoint[1] + fSeedDirection[1] - SPxyz[1], 2) +
246  pow(fSeedPoint[2] + fSeedDirection[2] - SPxyz[2], 2),
247  0.5);
248  }
249  else if (SPProjOnSeed < (0 - ThisSeedLength)) {
250  // std::cout<<"Seed under end"<<std::endl;
251  return pow(pow(fSeedPoint[0] - fSeedDirection[0] - SPxyz[0], 2) +
252  pow(fSeedPoint[1] - fSeedDirection[1] - SPxyz[1], 2) +
253  pow(fSeedPoint[2] - fSeedDirection[2] - SPxyz[2], 2),
254  0.5);
255  }
256  else {
257  // std::cout<<"Seed valid region"<<std::endl;
258  double crossprod[3];
259  CrossProd(fSeedPoint[0] + fSeedDirection[0] - SPxyz[0],
260  fSeedPoint[1] + fSeedDirection[1] - SPxyz[1],
261  fSeedPoint[2] + fSeedDirection[2] - SPxyz[2],
262  SPxyz[0] - fSeedPoint[0],
263  SPxyz[1] - fSeedPoint[1],
264  SPxyz[2] - fSeedPoint[2],
265  crossprod[0],
266  crossprod[1],
267  crossprod[2]);
268 
269  return pow(pow(crossprod[0], 2) + pow(crossprod[1], 2) + pow(crossprod[2], 2), 0.5) /
270  pow(pow(fSeedDirection[0], 2) + pow(fSeedDirection[1], 2) + pow(fSeedDirection[2], 2),
271  0.5);
272  }
273  }
double fSeedDirection[3]
Definition: Seed.h:27
void CrossProd(double x1, double x2, double x3, double y1, double y2, double y3, double &out1, double &out2, double &out3)
Definition: Seed.cxx:287
double fSeedPoint[3]
Definition: Seed.h:26
double recob::Seed::GetLength ( ) const

Definition at line 132 of file Seed.cxx.

References fSeedDirection.

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

133  {
134  return pow(pow(fSeedDirection[0], 2) + pow(fSeedDirection[1], 2) + pow(fSeedDirection[2], 2),
135  0.5);
136  }
double fSeedDirection[3]
Definition: Seed.h:27
void recob::Seed::GetPoint ( double *  Pt,
double *  Err 
) const
int recob::Seed::GetPointingSign ( Seed const &  AnotherSeed) const

Definition at line 276 of file Seed.cxx.

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

277  {
278  double OtherPos[3], OtherErr[3];
279  AnotherSeed.GetPoint(OtherPos, OtherErr);
280  double DotProd = (OtherPos[0] - fSeedPoint[0]) * fSeedDirection[0] +
281  (OtherPos[1] - fSeedPoint[1]) * fSeedDirection[1] +
282  (OtherPos[2] - fSeedPoint[2]) * fSeedDirection[2];
283  return ((DotProd > 0) - (DotProd < 0));
284  }
double fSeedDirection[3]
Definition: Seed.h:27
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
Definition: PFPUtils.h:126
double fSeedPoint[3]
Definition: Seed.h:26
double recob::Seed::GetProjAngleDiscrepancy ( Seed const &  AnotherSeed) const

Definition at line 139 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

140  {
141  double OtherPt[3];
142  double OtherPtErr[3];
143 
144  AnotherSeed.GetPoint(OtherPt, OtherPtErr);
145 
146  TVector3 OtherPtV(OtherPt[0], OtherPt[1], OtherPt[2]);
147  TVector3 ThisDirV(fSeedDirection[0], fSeedDirection[1], fSeedDirection[2]);
148  TVector3 ThisPtV(fSeedPoint[0], fSeedPoint[1], fSeedPoint[2]);
149 
150  return (OtherPtV - ThisPtV).Angle(ThisDirV.Unit());
151  }
double fSeedDirection[3]
Definition: Seed.h:27
double fSeedPoint[3]
Definition: Seed.h:26
double recob::Seed::GetProjDiscrepancy ( Seed const &  AnotherSeed) const

Definition at line 193 of file Seed.cxx.

References fSeedDirection, fSeedPoint, and GetPoint().

194  {
195  double OtherPt[3];
196  double OtherPtErr[3];
197 
198  AnotherSeed.GetPoint(OtherPt, OtherPtErr);
199 
200  TVector3 OtherPtV(OtherPt[0], OtherPt[1], OtherPt[2]);
201  TVector3 ThisDirV(fSeedDirection[0], fSeedDirection[1], fSeedDirection[2]);
202  TVector3 ThisPtV(fSeedPoint[0], fSeedPoint[1], fSeedPoint[2]);
203 
204  return ((OtherPtV - ThisPtV) - ThisDirV.Unit() * (ThisDirV.Unit().Dot(OtherPtV - ThisPtV)))
205  .Mag();
206  }
double fSeedDirection[3]
Definition: Seed.h:27
double fSeedPoint[3]
Definition: Seed.h:26
void recob::Seed::GetVectorBetween ( Seed const &  AnotherSeed,
double *  xyz 
) const

Definition at line 154 of file Seed.cxx.

References fSeedPoint, and GetPoint().

155  {
156  double xyzother[3], err[3];
157  AnotherSeed.GetPoint(xyzother, err);
158 
159  xyz[0] = xyzother[0] - fSeedPoint[0];
160  xyz[1] = xyzother[1] - fSeedPoint[1];
161  xyz[2] = xyzother[2] - fSeedPoint[2];
162  }
double fSeedPoint[3]
Definition: Seed.h:26
bool recob::Seed::IsValid ( ) const

Definition at line 58 of file Seed.cxx.

References fIsValid.

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

59  {
60  return fIsValid;
61  }
bool fIsValid
Definition: Seed.h:30
void recob::Seed::Print ( ) const

Definition at line 50 of file Seed.cxx.

References fSeedDirection, and fSeedPoint.

51  {
52  std::cout << "Printing seed contents : " << fSeedPoint[0] << " " << fSeedPoint[1] << " "
53  << fSeedPoint[2] << ", " << fSeedDirection[0] << " " << fSeedDirection[1] << " "
54  << fSeedDirection[2] << std::endl;
55  }
double fSeedDirection[3]
Definition: Seed.h:27
double fSeedPoint[3]
Definition: Seed.h:26
Seed recob::Seed::Reverse ( )

Definition at line 64 of file Seed.cxx.

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

65  {
66  double NewSeedDir[3];
67  for (size_t n = 0; n != 3; ++n) {
68  NewSeedDir[n] = -fSeedDirection[n];
69  }
70  return Seed(fSeedPoint, NewSeedDir, fSeedPointError, fSeedDirectionError);
71  }
double fSeedDirection[3]
Definition: Seed.h:27
double fSeedDirectionError[3]
Definition: Seed.h:29
double fSeedPoint[3]
Definition: Seed.h:26
Char_t n[5]
double fSeedPointError[3]
Definition: Seed.h:28
void recob::Seed::SetDirection ( double *  Dir,
double *  Err 
)

Definition at line 112 of file Seed.cxx.

References fIsValid, fSeedDirection, and fSeedDirectionError.

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

113  {
114  for (int i = 0; i != 3; i++) {
115  fSeedDirection[i] = Dir[i];
116  fSeedDirectionError[i] = Err[i];
117  }
118  fIsValid = true;
119  }
double fSeedDirection[3]
Definition: Seed.h:27
bool fIsValid
Definition: Seed.h:30
double fSeedDirectionError[3]
Definition: Seed.h:29
void recob::Seed::SetDirection ( double *  Dir)

Definition at line 98 of file Seed.cxx.

References SetDirection().

99  {
100  double Empty[3] = {0, 0, 0};
101  SetDirection(Dir, Empty);
102  }
void SetDirection(double *Dir, double *Err)
Definition: Seed.cxx:112
void recob::Seed::SetPoint ( double *  Pt,
double *  Err 
)

Definition at line 122 of file Seed.cxx.

References fIsValid, fSeedPoint, and fSeedPointError.

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

123  {
124  for (int i = 0; i != 3; i++) {
125  fSeedPoint[i] = Pt[i];
126  fSeedPointError[i] = Err[i];
127  }
128  fIsValid = true;
129  }
bool fIsValid
Definition: Seed.h:30
double fSeedPoint[3]
Definition: Seed.h:26
double fSeedPointError[3]
Definition: Seed.h:28
void recob::Seed::SetPoint ( double *  Pt)

Definition at line 105 of file Seed.cxx.

References SetPoint().

106  {
107  double Empty[3] = {0, 0, 0};
108  SetPoint(Pt, Empty);
109  }
void SetPoint(double *Pt, double *Err)
Definition: Seed.cxx:122
void recob::Seed::SetValidity ( bool  Validity)

Definition at line 74 of file Seed.cxx.

References fIsValid.

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

75  {
76  fIsValid = Validity;
77  }
bool fIsValid
Definition: Seed.h:30

Friends And Related Function Documentation

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

Definition at line 315 of file Seed.cxx.

316  {
317  if (a.fSeedPoint[2] != b.fSeedPoint[2]) { return a.fSeedPoint[2] < b.fSeedPoint[2]; }
318  else if (a.fSeedPoint[1] != b.fSeedPoint[1]) {
319  return a.fSeedPoint[1] < b.fSeedPoint[1];
320  }
321 
322  return a.fSeedPoint[0] < b.fSeedPoint[0];
323  }
std::ostream& operator<< ( std::ostream &  stream,
Seed const &  a 
)
friend

Definition at line 303 of file Seed.cxx.

304  {
305  o << "Printing seed contents : " << a.fSeedPoint[0] << " " << a.fSeedPoint[1] << " "
306  << a.fSeedPoint[2] << ", " << a.fSeedDirection[0] << " " << a.fSeedDirection[1] << " "
307  << a.fSeedDirection[2];
308 
309  return o;
310  }

Member Data Documentation

bool recob::Seed::fIsValid
private

Definition at line 30 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 29 of file Seed.h.

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

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

Definition at line 28 of file Seed.h.

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


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