LArSoft  v09_90_00
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 
8 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
11 namespace detinfo {
12  class DetectorPropertiesData;
13 }
14 namespace geo {
15  class GeometryCore;
16 }
17 
18 #include <map>
19 #include <vector>
20 
21 namespace recob {
22  class Hit;
23 }
24 
25 namespace reco3d {
26  struct HitOrChan {
27  HitOrChan(raw::ChannelID_t c) : chan(c), hit(0), xpos(0) {}
28  HitOrChan(const recob::Hit* h, double x) : chan(h->Channel()), hit(h), xpos(x) {}
29 
31  const recob::Hit* hit; // null for bad channel
32  double xpos; // Only set if hit is set
33  };
34 
35  struct ChannelDoublet {
36  ChannelDoublet(HitOrChan a_, HitOrChan b_, geo::WireIDIntersection p) : a(a_), b(b_), pt(p) {}
37 
40  };
41 
42  struct XYZ {
43  double x, y, z;
44  };
45 
46  struct HitTriplet {
47  const recob::Hit *x, *u, *v;
49  };
50 
51  class TripletFinder {
52  public:
54  const std::vector<art::Ptr<recob::Hit>>& xhits,
55  const std::vector<art::Ptr<recob::Hit>>& uhits,
56  const std::vector<art::Ptr<recob::Hit>>& vhits,
57  const std::vector<raw::ChannelID_t>& xbad,
58  const std::vector<raw::ChannelID_t>& ubad,
59  const std::vector<raw::ChannelID_t>& vbad,
60  double distThresh,
61  double distThreshDrift,
62  double xhitOffset);
63 
64  std::vector<HitTriplet> Triplets();
66  std::vector<HitTriplet> TripletsTwoView();
67 
68  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;
93 
94  std::map<geo::TPCID, std::vector<HitOrChan>> fX_by_tpc;
95  std::map<geo::TPCID, std::vector<HitOrChan>> fU_by_tpc;
96  std::map<geo::TPCID, std::vector<HitOrChan>> fV_by_tpc;
97 
98  // TODO initialize
99  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fXbad_by_tpc;
100  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fUbad_by_tpc;
101  std::map<geo::TPCID, std::vector<raw::ChannelID_t>> fVbad_by_tpc;
102  };
103 }
104 
105 #endif
Float_t x
Definition: compare.C:6
raw::ChannelID_t chan
Definition: TripletFinder.h:30
geo::WireIDIntersection pt
Definition: TripletFinder.h:39
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:36
std::map< geo::TPCID, std::vector< HitOrChan > > fX_by_tpc
Definition: TripletFinder.h:94
HitOrChan(const recob::Hit *h, double x)
Definition: TripletFinder.h:28
std::map< geo::TPCID, std::vector< HitOrChan > > fV_by_tpc
Definition: TripletFinder.h:96
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fXbad_by_tpc
Definition: TripletFinder.h:99
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:27
void hits()
Definition: readHits.C:15
std::map< geo::TPCID, std::vector< HitOrChan > > fU_by_tpc
Definition: TripletFinder.h:95
const geo::GeometryCore * geom
Definition: TripletFinder.h:69
const recob::Hit * x
Definition: TripletFinder.h:47
TMarker * pt
Definition: egs.C:25
General LArSoft Utilities.
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
Description of geometry of one entire detector.
Definition: GeometryCore.h:119
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
const recob::Hit * hit
Definition: TripletFinder.h:31
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
Namespace collecting geometry-related classes utilities.
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc