LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
TripletFinder.h
Go to the documentation of this file.
1 // Christopher Backhouse - bckhouse@fnal.gov
2 
3 #ifndef RECO3D_TRIPLETFINDER_H
4 #define RECO3D_TRIPLETFINDER_H
5 
7 
9 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
12 namespace detinfo {
13  class DetectorPropertiesData;
14 }
15 
16 #include <map>
17 #include <vector>
18 
19 namespace recob {
20  class Hit;
21 }
22 
23 namespace reco3d {
24  struct HitOrChan {
25  HitOrChan(raw::ChannelID_t c) : chan(c), hit(0), xpos(0) {}
26  HitOrChan(const recob::Hit* h, double x) : chan(h->Channel()), hit(h), xpos(x) {}
27 
29  const recob::Hit* hit; // null for bad channel
30  double xpos; // Only set if hit is set
31  };
32 
33  struct ChannelDoublet {
34  ChannelDoublet(HitOrChan a_, HitOrChan b_, geo::WireIDIntersection p) : a(a_), b(b_), pt(p) {}
35 
38  };
39 
40  struct XYZ {
41  double x, y, z;
42  };
43 
44  struct HitTriplet {
45  const recob::Hit *x, *u, *v;
47  };
48 
49  class TripletFinder {
50  public:
52  const std::vector<art::Ptr<recob::Hit>>& xhits,
53  const std::vector<art::Ptr<recob::Hit>>& uhits,
54  const std::vector<art::Ptr<recob::Hit>>& vhits,
55  const std::vector<raw::ChannelID_t>& xbad,
56  const std::vector<raw::ChannelID_t>& ubad,
57  const std::vector<raw::ChannelID_t>& vbad,
58  double distThresh,
59  double distThreshDrift,
60  double xhitOffset,
61  int maxTriplets = 0);
62 
63  std::vector<HitTriplet> Triplets();
65  std::vector<HitTriplet> TripletsTwoView();
66 
67  protected:
70 
72  void FillHitMap(const detinfo::DetectorPropertiesData& clockData,
74  std::map<geo::TPCID, std::vector<HitOrChan>>& out);
76  void FillBadMap(const std::vector<raw::ChannelID_t>& bads,
77  std::map<geo::TPCID, std::vector<raw::ChannelID_t>>& out);
78 
79  bool CloseDrift(double xa, double xb) const;
80  bool CloseSpace(geo::WireIDIntersection ra, geo::WireIDIntersection rb) const;
81 
82  std::vector<ChannelDoublet> DoubletsXU(geo::TPCID tpc);
83  std::vector<ChannelDoublet> DoubletsXV(geo::TPCID tpc);
84 
85  std::vector<ChannelDoublet> DoubletHelper(geo::TPCID tpc,
86  const std::vector<HitOrChan>& ahits,
87  const std::vector<HitOrChan>& bhits,
88  const std::vector<raw::ChannelID_t>& bbads) const;
89 
90  double fDistThresh;
92  double fXHitOffset;
94 
95  std::map<geo::TPCID, std::vector<HitOrChan>> fX_by_tpc;
96  std::map<geo::TPCID, std::vector<HitOrChan>> fU_by_tpc;
97  std::map<geo::TPCID, std::vector<HitOrChan>> fV_by_tpc;
98 
99  // TODO initialize
100  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fXbad_by_tpc;
101  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fUbad_by_tpc;
102  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fVbad_by_tpc;
103  };
104 }
105 
106 #endif
Float_t x
Definition: compare.C:6
raw::ChannelID_t chan
Definition: TripletFinder.h:28
geo::WireIDIntersection pt
Definition: TripletFinder.h:37
Reconstruction base classes.
Declaration of signal hit object.
Float_t y
Definition: compare.C:6
ChannelDoublet(HitOrChan a_, HitOrChan b_, geo::WireIDIntersection p)
Definition: TripletFinder.h:34
std::map< geo::TPCID, std::vector< HitOrChan > > fX_by_tpc
Definition: TripletFinder.h:95
const geo::WireReadoutGeom * wireReadoutGeom
Definition: TripletFinder.h:69
HitOrChan(const recob::Hit *h, double x)
Definition: TripletFinder.h:26
std::map< geo::TPCID, std::vector< HitOrChan > > fV_by_tpc
Definition: TripletFinder.h:97
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fXbad_by_tpc
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
HitOrChan(raw::ChannelID_t c)
Definition: TripletFinder.h:25
void hits()
Definition: readHits.C:15
std::map< geo::TPCID, std::vector< HitOrChan > > fU_by_tpc
Definition: TripletFinder.h:96
const geo::GeometryCore * geom
Definition: TripletFinder.h:68
Interface for a class providing readout channel mapping to geometry.
const recob::Hit * x
Definition: TripletFinder.h:45
TMarker * pt
Definition: egs.C:25
General LArSoft Utilities.
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
Description of the physical geometry of one entire detector.
Definition: GeometryCore.h:91
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
const recob::Hit * hit
Definition: TripletFinder.h:29
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fUbad_by_tpc
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc