Classes | Functions
pizero Namespace Reference

Classes

class  Cone
 
class  PiZeroProcess
 
class  ShowerProcess
 

Functions

double ClosestDistanceToPoint (const TVector3 &p, const TVector3 &lineStart, const TVector3 &lineDir)
 
TVector3 ClosestPoint (const TVector3 &a, const TVector3 &adir, const TVector3 &b, const TVector3 &bdir)
 
TVector3 ClosestPoint (const recob::Shower *showerA, const recob::Shower *showerB)
 
double ClosestDistance (const TVector3 &a, const TVector3 &adir, const TVector3 &b, const TVector3 &bdir)
 
double ClosestDistance (const recob::Shower *showerA, const recob::Shower *showerB)
 
std::vector< PiZeroProcessfindPiZeros (const art::Event &evt, std::string showerLabel="pandoraShower", std::string trackLabel="pandoraTrack")
 

Function Documentation

double pizero::ClosestDistance ( const TVector3 &  a,
const TVector3 &  adir,
const TVector3 &  b,
const TVector3 &  bdir 
)
inline

Definition at line 67 of file PiZeroProcess.h.

68  {
69  // Find unit vector perpendicular to both a and b.
70  const TVector3 unit = adir.Cross(bdir) * (1.0 / adir.Cross(bdir).Mag());
71  // Project difference vector on perpendicular vector.
72  return abs((a - b).Dot(unit));
73 }
T abs(T value)
const double a
static bool * b
Definition: config.cpp:1043
double pizero::ClosestDistance ( const recob::Shower showerA,
const recob::Shower showerB 
)
inline

Definition at line 74 of file PiZeroProcess.h.

75  {
76  // Check whether the intersection is behind both showers.
77  const TVector3 candidate =
78  ClosestPoint(showerA->ShowerStart(), showerA->Direction(),
79  showerB->ShowerStart(), showerB->Direction());
80  const TVector3 startPlusDirA = showerA->ShowerStart() + showerA->Direction();
81  const TVector3 startPlusDirB = showerB->ShowerStart() + showerB->Direction();
82  const TVector3 startMinusDirA = showerA->ShowerStart() - showerA->Direction();
83  const TVector3 startMinusDirB = showerB->ShowerStart() - showerB->Direction();
84  if((startPlusDirA-candidate).Mag() < (startMinusDirA-candidate).Mag() ||
85  (startPlusDirB-candidate).Mag() < (startMinusDirB-candidate).Mag()) {
86  return -1;
87  }
88 
89  return ClosestDistance(showerA->ShowerStart(), showerA->Direction(),
90  showerB->ShowerStart(), showerB->Direction());
91 }
const TVector3 & ShowerStart() const
Definition: Shower.h:192
const TVector3 & Direction() const
Definition: Shower.h:189
double ClosestDistance(const recob::Shower *showerA, const recob::Shower *showerB)
Definition: PiZeroProcess.h:74
TVector3 ClosestPoint(const recob::Shower *showerA, const recob::Shower *showerB)
Definition: PiZeroProcess.h:57
double pizero::ClosestDistanceToPoint ( const TVector3 &  p,
const TVector3 &  lineStart,
const TVector3 &  lineDir 
)
inline

Definition at line 30 of file PiZeroProcess.h.

31  {
32  // Difference vector between line start and point.
33  const TVector3 diff = p - lineStart;
34  // Get line projection onto difference vector.
35  const TVector3 proj = lineDir * diff.Dot(lineDir) * (1.0 / lineDir.Mag2());
36  // The difference between the difference and projection vectors is
37  // called the rejection vector and returns the closest distance.
38  return (diff - proj).Mag();
39 }
p
Definition: test.py:223
TVector3 pizero::ClosestPoint ( const TVector3 &  a,
const TVector3 &  adir,
const TVector3 &  b,
const TVector3 &  bdir 
)
inline

Definition at line 42 of file PiZeroProcess.h.

43  {
44  TVector3 result(-99999., -99999., -99999.);
45  // Deal with both vectors being parallel.
46  if (adir != bdir) {
47  const TVector3 n1 = adir.Cross(bdir.Cross(adir));
48  const TVector3 n2 = bdir.Cross(adir.Cross(bdir));
49  const TVector3 c1 = a + adir * ((b - a).Dot(n2) / adir.Dot(n2));
50  const TVector3 c2 = b + bdir * ((a - b).Dot(n1) / bdir.Dot(n1));
51 
52  result = c1 + 0.5 * (c2 - c1);
53  }
54 
55  return result;
56 }
static QCString result
const double a
static bool * b
Definition: config.cpp:1043
TVector3 pizero::ClosestPoint ( const recob::Shower showerA,
const recob::Shower showerB 
)
inline

Definition at line 57 of file PiZeroProcess.h.

58  {
59  const TVector3 candidate =
60  ClosestPoint(showerA->ShowerStart(), showerA->Direction(),
61  showerB->ShowerStart(), showerB->Direction());
62 
63  return candidate;
64 }
const TVector3 & ShowerStart() const
Definition: Shower.h:192
const TVector3 & Direction() const
Definition: Shower.h:189
TVector3 ClosestPoint(const recob::Shower *showerA, const recob::Shower *showerB)
Definition: PiZeroProcess.h:57
std::vector<PiZeroProcess> pizero::findPiZeros ( const art::Event evt,
std::string  showerLabel = "pandoraShower",
std::string  trackLabel = "pandoraTrack" 
)

Definition at line 303 of file PiZeroProcess.h.

304  {
305  std::vector<PiZeroProcess> result;
306 
307  // Get the event's showers.
308  auto showerHandle = evt.getHandle<std::vector<recob::Shower>>(showerLabel);
309  if (!showerHandle || showerHandle->size() < 2) return result;
310 
311  // Find showers close to each other.
312  double showerDistThreshold = 50; // 50 cm is too far.
313  std::vector<std::pair<const recob::Shower*, const recob::Shower*>> showerPairs;
314  for(unsigned si = 0; si < showerHandle->size()-1; ++si) {
315  for(unsigned ssi = si+1; ssi < showerHandle->size(); ++ssi) {
316  const recob::Shower* shower1 = &showerHandle->at(si);
317  const recob::Shower* shower2 = &showerHandle->at(ssi);
318  if((shower1->ShowerStart() - shower2->ShowerStart()).Mag() < showerDistThreshold) {
319  showerPairs.push_back(std::make_pair(shower1, shower2));
320  }
321  }
322  }
323  std::cout << showerPairs.size() << " shower pairs.\n";
324 
325  // Of shower pairs in vicinity of each other, find those that point to a single vertex.
326 
327  // TODO: Finish this function. Place outside of class to make vector of all pizero candidates?
328 
329  return result;
330 }
const TVector3 & ShowerStart() const
Definition: Shower.h:192
static QCString result
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382