LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Boundary.cxx
Go to the documentation of this file.
1 
7 #include <cassert>
8 #include <iostream>
9 #include <ostream>
10 #include <utility>
11 
13 
14 namespace lcvn {
15 
16  Boundary::Boundary(const int nWire,
17  const double tRes,
18  const int minWireX,
19  const int minWireY,
20  const int minWireZ,
21  const double centerTDCX,
22  const double centerTDCY,
23  const double centerTDCZ)
24  : fFirstWire{minWireX, minWireY, minWireZ}
25  , fLastWire{minWireX + nWire - 1, minWireY + nWire - 1, minWireZ + nWire - 1}
26  , fFirstTDC{centerTDCX - tRes, // For odd nTDC, we will truncate 0.5,
27  centerTDCY - tRes,
28  centerTDCZ - tRes}
29  , // but get it back in LastTDC
30  fLastTDC{centerTDCX + tRes, // Recover the trucated 0.5
31  centerTDCY + tRes,
32  centerTDCZ + tRes} // with nTDC % 2
33 
34  {
35  assert(fLastWire[0] - fFirstWire[0] == nWire - 1);
36  assert(fLastWire[1] - fFirstWire[1] == nWire - 1);
37  assert(fLastWire[2] - fFirstWire[2] == nWire - 1);
38  }
39 
40  bool Boundary::IsWithin(const unsigned int wire, const double cell, const unsigned int view)
41  {
42  bool inWireRcvne = (int)wire >= fFirstWire[view] && (int)wire <= fLastWire[view];
43  bool inTDCRcvne = (double)cell >= fFirstTDC[view] && (double)cell <= fLastTDC[view];
44  return inWireRcvne && inTDCRcvne;
45  }
46 
47  std::ostream& operator<<(std::ostream& os, const Boundary& b)
48  {
49  os << "Boundary with "
50  << "(first,last) wire X: (" << b.FirstWire(0) << ", " << b.LastWire(0)
51  << "(first,last) wire Y: (" << b.FirstWire(1) << ", " << b.LastWire(1)
52  << "(first,last) wire Z: (" << b.FirstWire(2) << ", " << b.LastWire(2)
53  << "), (first,last) tdc X: (" << b.FirstTDC(0) << ", " << b.LastTDC(0) << ")"
54  << "), (first,last) tdc Y: (" << b.FirstTDC(1) << ", " << b.LastTDC(1) << ")"
55  << "), (first,last) tdc Z: (" << b.FirstTDC(2) << ", " << b.LastTDC(2) << ")";
56 
57  return os;
58  }
59 }
int fFirstWire[3]
Minimum wire, inclusive.
Definition: Boundary.h:40
int LastWire(const unsigned int view) const
Definition: Boundary.h:38
Utility class for truth labels.
int FirstWire(const unsigned int view) const
Definition: Boundary.h:37
double fLastTDC[3]
Maximum cell in each view, inclusive.
Definition: Boundary.h:46
double fFirstTDC[3]
Minimum cell in each view, inclusive.
Definition: Boundary.h:45
double FirstTDC(const unsigned int view) const
Definition: Boundary.h:39
double LastTDC(const unsigned int view) const
Definition: Boundary.h:40
std::ostream & operator<<(std::ostream &os, const Boundary &b)
Definition: Boundary.cxx:47
int fLastWire[3]
Maximum wire, inclusive.
Definition: Boundary.h:44
bool IsWithin(const unsigned int wire, const double cell, const unsigned int view)
Definition: Boundary.cxx:40
Boundary for CVN PixelMap.