All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
pma Namespace Reference

Classes

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

Typedefs

typedef std::map< unsigned int,
std::vector< art::Ptr
< recob::Hit > > > 
view_hitmap
 
typedef std::map< unsigned int,
view_hitmap
tpc_view_hitmap
 
typedef std::map< unsigned int,
tpc_view_hitmap
cryo_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::TrkCandidateColl
tpc_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 (detinfo::DetectorPropertiesData const &detProp, unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
TVector2 CmToWireDrift (detinfo::DetectorPropertiesData const &detProp, 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 28 of file PmaTrkCandidate.h.

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

Definition at line 36 of file larreco/larreco/RecoAlg/PMAlg/Utilities.h.

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

Definition at line 54 of file PMAlgTracking.h.

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

Definition at line 27 of file PmaTrkCandidate.h.

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

Definition at line 33 of file larreco/larreco/RecoAlg/PMAlg/Utilities.h.

Definition at line 34 of file larreco/larreco/RecoAlg/PMAlg/Utilities.h.

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

Definition at line 26 of file PmaTrkCandidate.h.

Function Documentation

TVector2 pma::CmToWireDrift ( detinfo::DetectorPropertiesData const &  detProp,
float  xw,
float  yd,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 310 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

316 {
317  art::ServiceHandle<geo::Geometry const> geom;
318  return TVector2(xw / geom->TPC(tpc, cryo).Plane(plane).WirePitch(),
319  detProp.ConvertXToTicks(yd, plane, tpc, cryo));
320 }
auto const detProp
recob::Track pma::convertFrom ( const pma::Track3D src,
unsigned int  tidx,
int  pdg = 0 
)

Definition at line 25 of file PMAlgTracking.cxx.

26 {
27  std::vector<Point_t> positions;
28  positions.reserve(src.size());
29  std::vector<Vector_t> momenta;
30  momenta.reserve(src.size());
31  std::vector<recob::TrajectoryPointFlags> outFlags;
32  outFlags.reserve(src.size());
33 
34  for (size_t i = 0, h = 0; i < src.size(); i++)
35  if (src[i]->IsEnabled()) {
36  auto const& point3d = src[i]->Point3D();
37  positions.emplace_back(point3d.X(), point3d.Y(), point3d.Z());
38  momenta.push_back(src.GetDirection3D(i));
39  outFlags.emplace_back(h++, recob::TrajectoryPointFlags::makeMask());
40  }
41 
42  int ndof = 0;
43  float totChi2 = 0;
44 
45  SMatrixSym55 covStart, covEnd;
46  return recob::Track(
47  recob::TrackTrajectory(std::move(positions), std::move(momenta), std::move(outFlags), false),
48  pdg,
49  totChi2,
50  ndof,
51  covStart,
52  covEnd,
53  tidx);
54 }
var pdg
Definition: selectors.fcl:14
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:379
while getopts h
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.
size_t size() const
Definition: PmaTrack3D.h:111
double pma::Dist2 ( const TVector2 &  v1,
const TVector2 &  v2 
)

Definition at line 40 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

41 {
42  double const dx = v1.X() - v2.X(), dy = v1.Y() - v2.Y();
43  return cet::sum_of_squares(dx, dy);
44 }
double pma::Dist2 ( const Vector2D &  v1,
const Vector2D &  v2 
)

Definition at line 46 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

47 {
48  double const dx = v1.X() - v2.X(), dy = v1.Y() - v2.Y();
49  return cet::sum_of_squares(dx, dy);
50 }
template<typename T , typename U >
double pma::Dist2 ( const T &  v1,
const U &  v2 
)

Definition at line 52 of file larreco/larreco/RecoAlg/PMAlg/Utilities.h.

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

Definition at line 53 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

54 {
55  if (view == geo::kUnknown) { return hits.size(); }
56  return ranges::count_if(hits, [view](auto hit) { return view == hit->View2D(); });
57 }
Unknown view.
Definition: geo_types.h:136
process_name hit
Definition: cheaterreco.fcl:51
double pma::GetHitsRadius2D ( const std::vector< pma::Hit3D * > &  hits,
bool  exact = false 
)

Definition at line 101 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

102 {
103  if (hits.empty()) return 0.0;
104 
105  if (!exact && (hits.size() < 5)) return 0.0;
106 
107  using namespace ranges;
108  auto to_2d_point = [](auto hit) -> decltype(auto) { return hit->Point2D(); };
109  auto const mean_point =
110  accumulate(hits | views::transform(to_2d_point), TVector2{}) * (1. / hits.size());
111 
112  auto to_dist2_from_mean = [&mean_point](auto hit) {
113  return pma::Dist2(hit->Point2D(), mean_point);
114  };
115  auto const max_r2 = max(hits | views::transform(to_dist2_from_mean));
116  return sqrt(max_r2);
117 }
static constexpr Sample_t transform(Sample_t sample)
double Dist2(const TVector2 &v1, const TVector2 &v2)
process_name hit
Definition: cheaterreco.fcl:51
double pma::GetHitsRadius3D ( const std::vector< pma::Hit3D * > &  hits,
bool  exact = false 
)

Definition at line 82 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

83 {
84  if (hits.empty()) return 0.0;
85 
86  if (!exact && (hits.size() < 5)) return 0.0;
87 
88  using namespace ranges;
89  auto to_3d_point = [](auto hit) -> decltype(auto) { return hit->Point3D(); };
90  auto const mean_point =
91  accumulate(hits | views::transform(to_3d_point), TVector3{}) * (1. / hits.size());
92 
93  auto to_dist2_from_mean = [&mean_point](auto hit) {
94  return pma::Dist2(hit->Point3D(), mean_point);
95  };
96  auto const max_r2 = max(hits | views::transform(to_dist2_from_mean));
97  return sqrt(max_r2);
98 }
static constexpr Sample_t transform(Sample_t sample)
double Dist2(const TVector2 &v1, const TVector2 &v2)
process_name hit
Definition: cheaterreco.fcl:51
TVector2 pma::GetProjectionToPlane ( const TVector3 &  p,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 273 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

277 {
278  art::ServiceHandle<geo::Geometry const> geom;
279 
280  return TVector2(geom->TPC(tpc, cryo).Plane(plane).PlaneCoordinate(p), p.X());
281 }
pdgs p
Definition: selectors.fcl:22
TVector2 pma::GetProjectionToSegment ( const TVector2 &  p,
const TVector2 &  p0,
const TVector2 &  p1 
)

Definition at line 152 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

153 {
154  TVector2 const v1(p1 - p0);
155  double const b = GetSegmentProjVector(p, p0, p1);
156  return p0 + v1 * b;
157 }
pdgs p
Definition: selectors.fcl:22
double GetSegmentProjVector(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
physics associatedGroupsWithLeft p1
TVector3 pma::GetProjectionToSegment ( const TVector3 &  p,
const TVector3 &  p0,
const TVector3 &  p1 
)

Definition at line 160 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

161 {
162  TVector3 const v1(p1 - p0);
163  double const b = GetSegmentProjVector(p, p0, p1);
164  return p0 + v1 * b;
165 }
pdgs p
Definition: selectors.fcl:22
double GetSegmentProjVector(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
physics associatedGroupsWithLeft p1
double pma::GetSegmentProjVector ( const TVector2 &  p,
const TVector2 &  p0,
const TVector2 &  p1 
)

Definition at line 120 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

121 {
122  TVector2 const v0(p - p0);
123  TVector2 const v1(p1 - p0);
124  return v0 * v1 / v1.Mod2();
125 }
pdgs p
Definition: selectors.fcl:22
physics associatedGroupsWithLeft p1
double pma::GetSegmentProjVector ( const Vector2D &  p,
const Vector2D &  p0,
const Vector2D &  p1 
)

Definition at line 128 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

129 {
130  pma::Vector2D const v0(p - p0);
131  pma::Vector2D const v1(p1 - p0);
132  return v0.Dot(v1) / v1.Mag2();
133 }
pdgs p
Definition: selectors.fcl:22
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double > > Vector2D
physics associatedGroupsWithLeft p1
double pma::GetSegmentProjVector ( const TVector3 &  p,
const TVector3 &  p0,
const TVector3 &  p1 
)

Definition at line 136 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

137 {
138  TVector3 const v0(p - p0);
139  TVector3 const v1(p1 - p0);
140  return v0.Dot(v1) / v1.Mag2();
141 }
pdgs p
Definition: selectors.fcl:22
physics associatedGroupsWithLeft p1
double pma::GetSegmentProjVector ( const Vector3D &  p,
const Vector3D &  p0,
const Vector3D &  p1 
)

Definition at line 144 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

145 {
146  pma::Vector3D const v0(p - p0);
147  pma::Vector3D const v1(p1 - p0);
148  return v0.Dot(v1) / v1.Mag2();
149 }
pdgs p
Definition: selectors.fcl:22
recob::tracking::Vector_t Vector3D
physics associatedGroupsWithLeft p1
double pma::GetSummedADC ( const std::vector< pma::Hit3D * > &  hits,
unsigned int  view = geo::kUnknown 
)

Definition at line 60 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

61 {
62  using namespace ranges;
63  auto to_summed_adc = [](auto hit) { return hit->SummedADC(); };
64  if (view == geo::kUnknown) { return accumulate(hits | views::transform(to_summed_adc), 0.); }
65  return accumulate(hits | views::filter([view](auto hit) { return view == hit->View2D(); }) |
66  views::transform(to_summed_adc),
67  0.);
68 }
static constexpr Sample_t transform(Sample_t sample)
Unknown view.
Definition: geo_types.h:136
process_name hit
Definition: cheaterreco.fcl:51
physics filters filter
double pma::GetSummedAmpl ( const std::vector< pma::Hit3D * > &  hits,
unsigned int  view = geo::kUnknown 
)

Definition at line 71 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

72 {
73  using namespace ranges;
74  auto to_amplitude = [](auto hit) { return hit->GetAmplitude(); };
75  if (view == geo::kUnknown) { return accumulate(hits | views::transform(to_amplitude), 0.); }
76  return accumulate(hits | views::filter([view](auto hit) { return view == hit->View2D(); }) |
77  views::transform(to_amplitude),
78  0.);
79 }
static constexpr Sample_t transform(Sample_t sample)
Unknown view.
Definition: geo_types.h:136
process_name hit
Definition: cheaterreco.fcl:51
physics filters filter
TVector2 pma::GetVectorProjectionToPlane ( const TVector3 &  v,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 284 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

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)
double pma::SolveLeastSquares3D ( const std::vector< std::pair< TVector3, TVector3 >> &  lines,
TVector3 &  result 
)

Definition at line 168 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

169 {
170  // RS: please, ask me if you need examples/explanation of formulas as they
171  // are not easy to derive from the code solely; I have Mathcad sources that
172  // were used to test the solving method, weighting, etc.
173 
174  result.SetXYZ(0., 0., 0.);
175  if (lines.size() < 2) {
176  mf::LogError("pma::SolveLeastSquares3D") << "Need min. two lines.";
177  return -1.0;
178  }
179 
180  double m;
181  std::vector<TVectorT<double>> U, P;
182  for (size_t v = 0; v < lines.size(); v++) {
183  TVector3 point = lines[v].first;
184  TVector3 dir = lines[v].second;
185  dir -= point;
186  m = dir.Mag();
187  if (m > 0.0) {
188  dir *= 1.0 / m;
189 
190  P.push_back(TVectorT<double>(3));
191  P.back()[0] = point.X();
192  P.back()[1] = point.Y();
193  P.back()[2] = point.Z();
194 
195  U.push_back(TVectorT<double>(3));
196  U.back()[0] = dir.X();
197  U.back()[1] = dir.Y();
198  U.back()[2] = dir.Z();
199  }
200  else
201  mf::LogWarning("pma::SolveLeastSquares3D") << "Line undefined.";
202  }
203  if (P.size() < 2) {
204  mf::LogError("pma::SolveLeastSquares3D") << "Need min. two lines.";
205  return -1.0;
206  }
207 
208  TVectorT<double> x(3), y(3), w(3);
209  TMatrixT<double> A(3, 3);
210  double ur, uc, pc;
211  double s_uc2[3], s_ur_uc[3];
212  double s_p_uc2[3], s_p_ur_uc[3];
213 
214  w[0] = 1.0;
215  w[1] = 1.0;
216  w[2] = 1.0;
217  for (size_t r = 0; r < 3; r++) {
218  y[r] = 0.0;
219  for (size_t c = 0; c < 3; c++) {
220  s_uc2[c] = 0.0;
221  s_ur_uc[c] = 0.0;
222  s_p_uc2[c] = 0.0;
223  s_p_ur_uc[c] = 0.0;
224 
225  for (size_t v = 0; v < P.size(); v++) {
226  //w[1] = fWeights[v]; // to remember that individual coordinates can be supressed...
227  //w[2] = fWeights[v];
228 
229  ur = U[v][r];
230  uc = U[v][c];
231  pc = P[v][c];
232 
233  s_uc2[c] += w[r] * w[c] * (1 - uc * uc);
234  s_p_uc2[c] += w[r] * w[r] * pc * (1 - uc * uc);
235 
236  s_ur_uc[c] += w[r] * w[c] * ur * uc;
237  s_p_ur_uc[c] += w[r] * w[r] * pc * ur * uc;
238  }
239 
240  if (r == c) {
241  y[r] += s_p_uc2[c];
242  A(r, c) = s_uc2[c];
243  }
244  else {
245  y[r] -= s_p_ur_uc[c];
246  A(r, c) = -s_ur_uc[c];
247  }
248  }
249  }
250  try {
251  x = A.InvertFast() * y;
252  }
253  catch (...) {
254  result.SetXYZ(0., 0., 0.);
255  return 1.0e12;
256  }
257 
258  result.SetXYZ(x[0], x[1], x[2]);
259 
260  double mse = 0.0;
261  for (size_t v = 0; v < lines.size(); v++) {
262  TVector3 const pproj = pma::GetProjectionToSegment(result, lines[v].first, lines[v].second);
263 
264  double const dx = result.X() - pproj.X(); // dx, dy, dz and the result point can be weighted
265  double const dy = result.Y() - pproj.Y(); // here (linearly) by each line uncertainty
266  double const dz = result.Z() - pproj.Z();
267  mse += cet::sum_of_squares(dx, dy, dz);
268  }
269  return mse / lines.size();
270 }
process_name opflash particleana ie x
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
process_name opflash particleana ie ie y
TVector2 GetProjectionToSegment(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
tuple dir
Definition: dropbox.py:28
float A
Definition: dedx.py:137
esac echo uname r
TVector2 pma::WireDriftToCm ( detinfo::DetectorPropertiesData const &  detProp,
unsigned int  wire,
float  drift,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 297 of file larreco/larreco/RecoAlg/PMAlg/Utilities.cxx.

303 {
304  art::ServiceHandle<geo::Geometry const> geom;
305  return TVector2(geom->TPC(tpc, cryo).Plane(plane).WirePitch() * wire,
306  detProp.ConvertTicksToX(drift, plane, tpc, cryo));
307 }
auto const detProp