LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
pma Namespace Reference

Classes

class  bDistCenterLess2D
 
class  bDistCenterLess3D
 
class  bSegmentProjLess
 
struct  bTrack3DLonger
 
struct  bTrajectory3DDistLess
 
struct  bTrajectory3DOrderLess
 
class  Element3D
 
class  Hit3D
 
class  Node3D
 
class  PMAlgCosmicTagger
 
class  PMAlgFitter
 
class  PMAlgStitching
 
class  PMAlgTracker
 
class  PMAlgTrackingBase
 
class  PMAlgVertexing
 
class  ProjectionMatchingAlg
 
class  Segment3D
 
class  SortedBranchBase
 
class  SortedObjectBase
 
class  Track3D
 
class  TrkCandidate
 
class  TrkCandidateColl
 
class  VtxCandidate
 

Typedefs

typedef std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > view_hitmap
 
typedef std::map< unsigned int, view_hitmaptpc_view_hitmap
 
typedef std::map< unsigned int, tpc_view_hitmapcryo_tpc_view_hitmap
 
typedef ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double > > Vector2D
 
typedef recob::tracking::Vector_t Vector3D
 
typedef std::map< size_t, std::vector< double > > dedx_map
 
typedef std::map< size_t, pma::TrkCandidateColltpc_track_map
 

Functions

double Dist2 (const TVector2 &v1, const TVector2 &v2)
 
double Dist2 (const Vector2D &v1, const Vector2D &v2)
 
template<typename T , typename U >
double Dist2 (const T &v1, const U &v2)
 
size_t GetHitsCount (const std::vector< pma::Hit3D * > &hits, unsigned int view)
 
double GetSummedADC (const std::vector< pma::Hit3D * > &hits, unsigned int view=geo::kUnknown)
 
double GetSummedAmpl (const std::vector< pma::Hit3D * > &hits, unsigned int view=geo::kUnknown)
 
double GetHitsRadius3D (const std::vector< pma::Hit3D * > &hits, bool exact=false)
 
double GetHitsRadius2D (const std::vector< pma::Hit3D * > &hits, bool exact=false)
 
double GetSegmentProjVector (const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
 
double GetSegmentProjVector (const Vector2D &p, const Vector2D &p0, const Vector2D &p1)
 
double GetSegmentProjVector (const TVector3 &p, const TVector3 &p0, const TVector3 &p1)
 
double GetSegmentProjVector (const Vector3D &p, const Vector3D &p0, const Vector3D &p1)
 
TVector2 GetProjectionToSegment (const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
 
TVector3 GetProjectionToSegment (const TVector3 &p, const TVector3 &p0, const TVector3 &p1)
 
double SolveLeastSquares3D (const std::vector< std::pair< TVector3, TVector3 > > &lines, TVector3 &result)
 
TVector2 GetProjectionToPlane (const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
TVector2 GetVectorProjectionToPlane (const TVector3 &v, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
TVector2 WireDriftToCm (unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
TVector2 CmToWireDrift (float xw, float yd, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
recob::Track convertFrom (const pma::Track3D &src, unsigned int tidx, int pdg=0)
 

Typedef Documentation

typedef std::map< unsigned int, tpc_view_hitmap > pma::cryo_tpc_view_hitmap

Definition at line 22 of file PmaTrkCandidate.h.

typedef std::map< size_t, std::vector<double> > pma::dedx_map

Definition at line 31 of file Utilities.h.

typedef std::map< size_t, pma::TrkCandidateColl > pma::tpc_track_map

Definition at line 46 of file PMAlgTracking.h.

typedef std::map< unsigned int, view_hitmap > pma::tpc_view_hitmap

Definition at line 21 of file PmaTrkCandidate.h.

typedef ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D<double> > pma::Vector2D

Definition at line 28 of file Utilities.h.

Definition at line 29 of file Utilities.h.

typedef std::map< unsigned int, std::vector< art::Ptr<recob::Hit> > > pma::view_hitmap

Definition at line 20 of file PmaTrkCandidate.h.

Function Documentation

TVector2 pma::CmToWireDrift ( float  xw,
float  yd,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 307 of file Utilities.cxx.

References detinfo::DetectorProperties::ConvertXToTicks(), geo::TPCGeo::Plane(), geo::GeometryCore::TPC(), and geo::PlaneGeo::WirePitch().

Referenced by Dist2(), pma::Track3D::DriftsOfWireIntersection(), and pma::Track3D::WireDriftRange().

308 {
310  const detinfo::DetectorProperties* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
311 
312  return TVector2(
313  xw / geom->TPC(tpc, cryo).Plane(plane).WirePitch(),
314  detprop->ConvertXToTicks(yd, plane, tpc, cryo)
315  );
316 }
virtual double ConvertXToTicks(double X, int p, int t, int c) const =0
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:367
recob::Track pma::convertFrom ( const pma::Track3D src,
unsigned int  tidx,
int  pdg = 0 
)

Definition at line 21 of file PMAlgTracking.cxx.

References pma::Track3D::GetDirection3D(), recob::TrajectoryPointFlags::makeMask(), and pma::Track3D::size().

Referenced by trkf::PMAlgTrajFitter::produce(), and trkf::PMAlgTrackMaker::produce().

22 {
23  std::vector<Point_t> positions; positions.reserve(src.size());
24  std::vector<Vector_t> momenta; momenta.reserve(src.size());
25  std::vector<recob::TrajectoryPointFlags> outFlags; outFlags.reserve(src.size());
26 
27  for (size_t i = 0, h = 0; i < src.size(); i++)
28  if (src[i]->IsEnabled())
29  {
30  auto const & point3d = src[i]->Point3D();
31  positions.emplace_back(point3d.X(), point3d.Y(), point3d.Z());
32  momenta.push_back(src.GetDirection3D(i));
33  outFlags.emplace_back(h++, recob::TrajectoryPointFlags::makeMask());
34  }
35 
36  int ndof = 0;
37  float totChi2 = 0;
38 
39  SMatrixSym55 covStart, covEnd;
40  return recob::Track(
41  recob::TrackTrajectory(std::move(positions), std::move(momenta), std::move(outFlags), false),
42  pdg, totChi2, ndof, covStart, covEnd, tidx);
43 }
static constexpr Mask_t makeMask(Flags...flags)
Returns a bit mask with only the specified bit set.
pma::Vector3D GetDirection3D(size_t index) const
Get trajectory direction at given hit index.
Definition: PmaTrack3D.cxx:373
A trajectory in space reconstructed from hits.
recob::tracking::SMatrixSym55 SMatrixSym55
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1035
size_t size() const
Definition: PmaTrack3D.h:76
double pma::Dist2 ( const TVector2 &  v1,
const TVector2 &  v2 
)

Definition at line 19 of file Utilities.cxx.

Referenced by pma::ProjectionMatchingAlg::alignTracks(), ems::MultiEMShowers::analyze(), pma::PMAlgTracker::areCoLinear(), pma::Track3D::AttachTo(), pma::ProjectionMatchingAlg::buildMultiTPCTrack(), tss::Segmentation2D::buildSegment(), pma::ProjectionMatchingAlg::buildSegment(), tss::Cluster2D::closest(), ems::MergeEMShower3D::collectshowers(), pma::PMAlgTracker::collectSingleViewEnd(), pma::PMAlgTracker::collectSingleViewFront(), ems::DirOfGamma::ComputeMaxDist(), tss::Cluster2D::dist2(), pma::ProjectionMatchingAlg::FilterOutSmallParts(), ems::DirOfGamma::FindCandidates(), ems::DirOfGamma::FindInitialPart(), ems::MergeEMShower3D::getBestPoint(), ems::EMShower3D::GetCloseHits(), pma::ProjectionMatchingAlg::GetCloseHits(), ems::MergeEMShower3D::getCos3D(), pma::Hit3D::GetDist2ToProj(), pma::Node3D::GetDistance2To(), GetHitsRadius2D(), GetHitsRadius3D(), ems::Bin2D::GetIniHits(), ems::MultiEMShowers::getMinDist(), pma::Track3D::HitDxByView(), pma::Element3D::HitsRadius3D(), pma::Track3D::InitFromHits(), pma::VtxCandidate::JoinTracks(), pma::Track3D::Length(), tss::Cluster2D::length2(), pma::Segment3D::Length2(), pma::PMAlgVertexing::makeVertices(), pma::PMAlgTracker::mergeCoLinear(), tss::Segmentation2D::mergeDenseParts(), pma::ProjectionMatchingAlg::mergeTracks(), pma::VtxCandidate::MergeWith(), tss::bDistToPointLess::operator()(), pma::bTrack3DLonger::operator()(), pma::bDistCenterLess2D::operator()(), pma::bDistCenterLess3D::operator()(), tss::Cluster2D::outermost(), ems::MergeEMShower3D::produce(), ems::EMShower3D::Reoptimize(), tss::Segmentation2D::run(), tss::Segmentation2D::selectRing(), ems::ShowerInfo::SetP0Dist(), pma::ProjectionMatchingAlg::ShortenSeg(), tss::Segmentation2D::splitHitsNaive(), pma::Node3D::SumDist2Hits(), tss::Segmentation2D::tagDenseEnds(), pma::ProjectionMatchingAlg::TestTrk(), ems::EMShower3D::Validate(), pma::ProjectionMatchingAlg::validate(), and pma::ProjectionMatchingAlg::validate_on_adc_test().

20 {
21  double dx = v1.X() - v2.X(), dy = v1.Y() - v2.Y();
22  return dx * dx + dy * dy;
23 }
double pma::Dist2 ( const Vector2D v1,
const Vector2D v2 
)

Definition at line 24 of file Utilities.cxx.

25 {
26  double dx = v1.X() - v2.X(), dy = v1.Y() - v2.Y();
27  return dx * dx + dy * dy;
28 }
template<typename T , typename U >
double pma::Dist2 ( const T &  v1,
const U &  v2 
)

Definition at line 45 of file Utilities.h.

References CmToWireDrift(), GetHitsCount(), GetHitsRadius2D(), GetHitsRadius3D(), GetProjectionToPlane(), GetProjectionToSegment(), GetSegmentProjVector(), GetSummedADC(), GetSummedAmpl(), GetVectorProjectionToPlane(), hits(), geo::kUnknown, SolveLeastSquares3D(), lar::dump::vector(), and WireDriftToCm().

45  {
46  double dx = v1.X() - v2.X(), dy = v1.Y() - v2.Y(), dz = v1.Z() - v2.Z();
47  return dx * dx + dy * dy + dz * dz;
48  }
size_t pma::GetHitsCount ( const std::vector< pma::Hit3D * > &  hits,
unsigned int  view 
)

Definition at line 30 of file Utilities.cxx.

References geo::kUnknown, and n.

Referenced by Dist2().

31 {
32  size_t n = 0;
33  for (auto const& hit : hits)
34  if ((view == geo::kUnknown) || (view == hit->View2D())) n++;
35  return n;
36 }
Unknown view.
Definition: geo_types.h:83
Detector simulation of raw signals on wires.
Char_t n[5]
double pma::GetHitsRadius2D ( const std::vector< pma::Hit3D * > &  hits,
bool  exact = false 
)

Definition at line 78 of file Utilities.cxx.

References Dist2(), and pmtana::mean().

Referenced by Dist2(), pma::Element3D::UpdateHitParams(), and pma::Track3D::UpdateHitsRadius().

79 {
80  if (!exact && (hits.size() < 5)) return 0.0;
81 
82  if (hits.size() == 0) return 0.0;
83 
84  TVector2 mean(0, 0);
85  for (size_t i = 0; i < hits.size(); i++)
86  {
87  mean += hits[i]->Point2D();
88  }
89  mean *= (1.0 / hits.size());
90 
91  double r2, max_r2 = pma::Dist2(hits.front()->Point2D(), mean);
92  for (size_t i = 1; i < hits.size(); i++)
93  {
94  r2 = pma::Dist2(hits[i]->Point2D(), mean);
95  if (r2 > max_r2) max_r2 = r2;
96  }
97  return sqrt(max_r2);
98 }
double Dist2(const TVector2 &v1, const TVector2 &v2)
Definition: Utilities.cxx:19
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:15
double pma::GetHitsRadius3D ( const std::vector< pma::Hit3D * > &  hits,
bool  exact = false 
)

Definition at line 56 of file Utilities.cxx.

References Dist2(), and pmtana::mean().

Referenced by Dist2().

57 {
58  if (!exact && (hits.size() < 5)) return 0.0;
59 
60  if (hits.size() == 0) return 0.0;
61 
62  TVector3 mean(0, 0, 0);
63  for (size_t i = 0; i < hits.size(); i++)
64  {
65  mean += hits[i]->Point3D();
66  }
67  mean *= (1.0 / hits.size());
68 
69  double r2, max_r2 = pma::Dist2(hits.front()->Point3D(), mean);
70  for (size_t i = 1; i < hits.size(); i++)
71  {
72  r2 = pma::Dist2(hits[i]->Point3D(), mean);
73  if (r2 > max_r2) max_r2 = r2;
74  }
75  return sqrt(max_r2);
76 }
double Dist2(const TVector2 &v1, const TVector2 &v2)
Definition: Utilities.cxx:19
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:15
TVector2 pma::GetProjectionToPlane ( const TVector3 &  p,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 280 of file Utilities.cxx.

References geo::TPCGeo::Plane(), geo::PlaneGeo::PlaneCoordinate(), and geo::GeometryCore::TPC().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), pma::VtxCandidate::ComputeMse2D(), Dist2(), ems::MultiEMShowers::getMinDist(), GetVectorProjectionToPlane(), and ems::EMShower3D::Validate().

281 {
283 
284  return TVector2(geom->TPC(tpc, cryo).Plane(plane).PlaneCoordinate(p), p.X());
285 }
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
double PlaneCoordinate(geo::Point_t const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:704
TVector2 pma::GetProjectionToSegment ( const TVector2 &  p,
const TVector2 &  p0,
const TVector2 &  p1 
)

Definition at line 156 of file Utilities.cxx.

References GetSegmentProjVector().

Referenced by pma::PMAlgTracker::areCoLinear(), tss::Segmentation2D::buildSegment(), ems::MergeEMShower3D::collectshowers(), pma::VtxCandidate::Compute(), Dist2(), pma::VtxCandidate::JoinTracks(), ems::ShowerInfo::Pointsto(), and SolveLeastSquares3D().

157 {
158  TVector2 v1(p1); v1 -= p0;
159 
160  double b = GetSegmentProjVector(p, p0, p1);
161  TVector2 r(p0);
162  r += (v1 * b);
163  return r;
164 }
double GetSegmentProjVector(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
Definition: Utilities.cxx:100
TVector3 pma::GetProjectionToSegment ( const TVector3 &  p,
const TVector3 &  p0,
const TVector3 &  p1 
)

Definition at line 166 of file Utilities.cxx.

References GetSegmentProjVector().

167 {
168  TVector3 v1(p1); v1 -= p0;
169 
170  double b = GetSegmentProjVector(p, p0, p1);
171  TVector3 r(p0);
172  r += (v1 * b);
173  return r;
174 }
double GetSegmentProjVector(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
Definition: Utilities.cxx:100
double pma::GetSegmentProjVector ( const TVector2 &  p,
const TVector2 &  p0,
const TVector2 &  p1 
)

Definition at line 100 of file Utilities.cxx.

Referenced by Dist2(), GetProjectionToSegment(), pma::VtxCandidate::JoinTracks(), pma::bSegmentProjLess::operator()(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().

101 {
102  TVector2 v0(p); v0 -= p0;
103  TVector2 v1(p1); v1 -= p0;
104 
105  double v0Norm = v0.Mod();
106  double v1Norm = v1.Mod();
107  double mag = v0Norm * v1Norm;
108  double cosine = 0.0;
109  if (mag != 0.0) cosine = v0 * v1 / mag;
110 
111  return v0Norm * cosine / v1Norm;
112 }
double pma::GetSegmentProjVector ( const Vector2D p,
const Vector2D p0,
const Vector2D p1 
)

Definition at line 114 of file Utilities.cxx.

115 {
116  pma::Vector2D v0(p); v0 -= p0;
117  pma::Vector2D v1(p1); v1 -= p0;
118 
119  double v0Norm = v0.R();
120  double v1Norm = v1.R();
121  double mag = v0Norm * v1Norm;
122  double cosine = 0.0;
123  if (mag != 0.0) cosine = v0.Dot(v1) / mag;
124 
125  return v0Norm * cosine / v1Norm;
126 }
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double > > Vector2D
Definition: Utilities.h:28
double pma::GetSegmentProjVector ( const TVector3 &  p,
const TVector3 &  p0,
const TVector3 &  p1 
)

Definition at line 128 of file Utilities.cxx.

129 {
130  TVector3 v0(p); v0 -= p0;
131  TVector3 v1(p1); v1 -= p0;
132 
133  double v0Norm = v0.Mag();
134  double v1Norm = v1.Mag();
135  double mag = v0Norm * v1Norm;
136  double cosine = 0.0;
137  if (mag != 0.0) cosine = v0 * v1 / mag;
138 
139  return v0Norm * cosine / v1Norm;
140 }
double pma::GetSegmentProjVector ( const Vector3D p,
const Vector3D p0,
const Vector3D p1 
)

Definition at line 142 of file Utilities.cxx.

143 {
144  pma::Vector3D v0(p); v0 -= p0;
145  pma::Vector3D v1(p1); v1 -= p0;
146 
147  double v0Norm = v0.R();
148  double v1Norm = v1.R();
149  double mag = v0Norm * v1Norm;
150  double cosine = 0.0;
151  if (mag != 0.0) cosine = v0.Dot(v1) / mag;
152 
153  return v0Norm * cosine / v1Norm;
154 }
recob::tracking::Vector_t Vector3D
Definition: Utilities.h:29
double pma::GetSummedADC ( const std::vector< pma::Hit3D * > &  hits,
unsigned int  view = geo::kUnknown 
)

Definition at line 38 of file Utilities.cxx.

References geo::kUnknown.

Referenced by Dist2().

39 {
40  double sum = 0.0;
41  for (auto const& hit : hits)
42  if ((view == geo::kUnknown) || (view == hit->View2D()))
43  sum += hit->SummedADC();
44  return sum;
45 }
Unknown view.
Definition: geo_types.h:83
Detector simulation of raw signals on wires.
double pma::GetSummedAmpl ( const std::vector< pma::Hit3D * > &  hits,
unsigned int  view = geo::kUnknown 
)

Definition at line 47 of file Utilities.cxx.

References geo::kUnknown.

Referenced by Dist2().

48 {
49  double sum = 0.0;
50  for (auto const& hit : hits)
51  if ((view == geo::kUnknown) || (view == hit->View2D()))
52  sum += hit->GetAmplitude();
53  return sum;
54 }
Unknown view.
Definition: geo_types.h:83
Detector simulation of raw signals on wires.
TVector2 pma::GetVectorProjectionToPlane ( const TVector3 &  v,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 287 of file Utilities.cxx.

References GetProjectionToPlane().

Referenced by Dist2().

288 {
289  TVector3 v0_3d(0., 0., 0.);
290  TVector2 v0_2d = GetProjectionToPlane(v0_3d, plane, tpc, cryo);
291  TVector2 v1_2d = GetProjectionToPlane(v, plane, tpc, cryo);
292 
293  return v1_2d - v0_2d;
294 }
TVector2 GetProjectionToPlane(const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
Definition: Utilities.cxx:280
double pma::SolveLeastSquares3D ( const std::vector< std::pair< TVector3, TVector3 > > &  lines,
TVector3 &  result 
)

Definition at line 176 of file Utilities.cxx.

References dir, GetProjectionToSegment(), w, x, and y.

Referenced by ems::MultiEMShowers::analyze(), ems::MergeEMShower3D::collectshowers(), pma::VtxCandidate::Compute(), Dist2(), and ems::ShowerInfo::Pointsto().

177 {
178  // RS: please, ask me if you need examples/explanation of formulas as they
179  // are not easy to derive from the code solely; I have Mathcad sources that
180  // were used to test the solving method, weighting, etc.
181 
182  result.SetXYZ(0., 0., 0.);
183  if (lines.size() < 2)
184  {
185  mf::LogError("pma::SolveLeastSquares3D") << "Need min. two lines.";
186  return -1.0;
187  }
188 
189  double m;
190  std::vector< TVectorT<double> > U, P;
191  for (size_t v = 0; v < lines.size(); v++)
192  {
193  TVector3 point = lines[v].first;
194  TVector3 dir = lines[v].second;
195  dir -= point; m = dir.Mag();
196  if (m > 0.0)
197  {
198  dir *= 1.0 / m;
199 
200  P.push_back(TVectorT<double>(3));
201  P.back()[0] = point.X(); P.back()[1] = point.Y(); P.back()[2] = point.Z();
202 
203  U.push_back(TVectorT<double>(3));
204  U.back()[0] = dir.X(); U.back()[1] = dir.Y(); U.back()[2] = dir.Z();
205  }
206  else mf::LogWarning("pma::SolveLeastSquares3D") << "Line undefined.";
207  }
208  if (P.size() < 2)
209  {
210  mf::LogError("pma::SolveLeastSquares3D") << "Need min. two lines.";
211  return -1.0;
212  }
213 
214  TVectorT<double> x(3), y(3), w(3);
215  TMatrixT<double> A(3, 3);
216  double ur, uc, pc;
217  double s_uc2[3], s_ur_uc[3];
218  double s_p_uc2[3], s_p_ur_uc[3];
219 
220  w[0] = 1.0; w[1] = 1.0; w[2] = 1.0;
221  for (size_t r = 0; r < 3; r++)
222  {
223  y[r] = 0.0;
224  for (size_t c = 0; c < 3; c++)
225  {
226  s_uc2[c] = 0.0; s_ur_uc[c] = 0.0;
227  s_p_uc2[c] = 0.0; s_p_ur_uc[c] = 0.0;
228 
229  for (size_t v = 0; v < P.size(); v++)
230  {
231  //w[1] = fWeights[v]; // to remember that individual coordinates can be supressed...
232  //w[2] = fWeights[v];
233 
234  ur = U[v][r];
235  uc = U[v][c];
236  pc = P[v][c];
237 
238  s_uc2[c] += w[r] * w[c] * (1 - uc * uc);
239  s_p_uc2[c] += w[r] * w[r] * pc * (1 - uc * uc);
240 
241  s_ur_uc[c] += w[r] * w[c] * ur * uc;
242  s_p_ur_uc[c] += w[r] * w[r] * pc * ur * uc;
243  }
244 
245  if (r == c)
246  {
247  y[r] += s_p_uc2[c];
248  A(r, c) = s_uc2[c];
249  }
250  else
251  {
252  y[r] -= s_p_ur_uc[c];
253  A(r, c) = -s_ur_uc[c];
254  }
255  }
256  }
257  try { x = A.InvertFast() * y; }
258  catch (...)
259  {
260  result.SetXYZ(0., 0., 0.); return 1.0e12;
261  }
262 
263  result.SetXYZ(x[0], x[1], x[2]);
264 
265  TVector3 pproj;
266  double dx, dy, dz, mse = 0.0;
267  for (size_t v = 0; v < lines.size(); v++)
268  {
269  pproj = pma::GetProjectionToSegment(result, lines[v].first, lines[v].second);
270 
271  dx = result.X() - pproj.X(); // dx, dy, dz and the result point can be weighted
272  dy = result.Y() - pproj.Y(); // here (linearly) by each line uncertainty
273  dz = result.Z() - pproj.Z();
274 
275  mse += dx * dx + dy * dy + dz * dz;
276  }
277  return mse / lines.size();
278 }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
TVector2 GetProjectionToSegment(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
Definition: Utilities.cxx:156
TDirectory * dir
Definition: macro.C:5
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Float_t w
Definition: plot.C:23
TVector2 pma::WireDriftToCm ( unsigned int  wire,
float  drift,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 296 of file Utilities.cxx.

References detinfo::DetectorProperties::ConvertTicksToX(), geo::TPCGeo::Plane(), geo::GeometryCore::TPC(), and geo::PlaneGeo::WirePitch().

Referenced by Dist2(), pma::ProjectionMatchingAlg::FilterOutSmallParts(), ems::EMShower3D::GetCloseHits(), ems::MultiEMShowers::getMinDist(), pma::Track3D::GetUnconstrainedProj3D(), tss::Hit2D::Hit2D(), pma::Hit3D::Hit3D(), pma::Track3D::TestHitsMse(), and pma::ProjectionMatchingAlg::validate().

297 {
299  const detinfo::DetectorProperties* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
300 
301  return TVector2(
302  geom->TPC(tpc, cryo).Plane(plane).WirePitch() * wire,
303  detprop->ConvertTicksToX(drift, plane, tpc, cryo)
304  );
305 }
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:367