DOCAInfo.cxx
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////
2 /// \brief
3 /// \author ricken@fnal.gov
4 /// \date Sept. 2012
5 /////////////////////////////////////////////////////////////////////
7 
8 #include "RecoBase/Track.h"
9 
10 #include <cmath>
11 
12 namespace vf
13 {
14  //...................................................................
16  {
17  TVector3 end1 = track1.Start() + track1.Dir();
18  TVector3 end2 = track2.Start() + track2.Dir();
19 
20  DoCalculation(track1.Start(), track2.Start(), end1, end2);
21  }
22 
23  //...................................................................
24  void DOCAInfo::DoCalculation(TVector3 I1, TVector3 I2,
25  TVector3 F1, TVector3 F2)
26  {
27  TVector3 anyV, A, B, alpha, beta, ratio;
28  double sigma1, sigma2;
29 
30  delta1_ = F1 - I1;
31  delta2_ = F2 - I2;
32  anyV = I2 - I1;
33 
34  ratio = (delta1_.Cross(delta2_)).Unit();
35 
36  // Distance of closest approach:
37  doca_ = fabs(anyV * ratio);
38 
39  alpha = delta1_.Cross(ratio);
40  beta = delta2_.Cross(ratio);
41 
42  sigma1 = -(alpha * anyV) / (alpha * delta2_);
43  sigma2 = (beta * anyV) / (beta * delta1_);
44 
45  A = I1 + sigma2 * delta1_;
46  B = I2 + sigma1 * delta2_;
47 
48  // Reconstructed Vertex:
49  vertex_reco_ = (A + B) * 0.5;
50  }
51 
52  //.....................................................................
53  TVector3 DOCAInfo::VertexReco() const
54  {
55  return vertex_reco_;
56  }
57 
58  //...................................................................
59  double DOCAInfo::Doca() const
60  {
61  return doca_;
62  }
63 
64  //...................................................................
65  double DOCAInfo::AngleReco() const
66  {
67  return (delta1_ * delta2_) / (delta1_.Mag() * delta2_.Mag());
68  }
69 
70 } // end namespace vf
71 //////////////////////////////////////////////////////////////////////////////
This is the version 2, works for multi-track event.
void DoCalculation(TVector3 I1, TVector3 I2, TVector3 F1, TVector3 F2)
Definition: DOCAInfo.cxx:24
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
TVector3 delta2_
Definition: DOCAInfo.h:35
TH1 * ratio(TH1 *h1, TH1 *h2)
double AngleReco() const
Definition: DOCAInfo.cxx:65
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
TVector3 delta1_
Definition: DOCAInfo.h:35
Double_t beta
virtual TVector3 Start() const
Definition: Prong.h:73
DOCAInfo(rb::Track track1, rb::Track track2)
Definition: DOCAInfo.cxx:15
virtual TVector3 Dir() const
Unit vector describing prong direction.
Definition: Prong.h:77
TVector3 Unit() const
double Doca() const
Definition: DOCAInfo.cxx:59
static const double A
Definition: Units.h:82
TVector3 vertex_reco_
Definition: DOCAInfo.h:34
double doca_
Definition: DOCAInfo.h:36
TVector3 VertexReco() const
Definition: DOCAInfo.cxx:53