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 {
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();
65  /// Only search for XU intersections
66  std::vector<HitTriplet> TripletsTwoView();
67 
68  protected:
70 
71  /// Helper for constructor
72  void FillHitMap(const detinfo::DetectorPropertiesData& clockData,
73  const std::vector<art::Ptr<recob::Hit>>& hits,
74  std::map<geo::TPCID, std::vector<HitOrChan>>& out);
75  /// Helper for constructor
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
raw::ChannelID_t chan
Definition: TripletFinder.h:30
geo::WireIDIntersection pt
Definition: TripletFinder.h:39
Reconstruction base classes.
TH3F * xpos
Definition: doAna.cpp:29
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
struct vector vector
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
HitOrChan(raw::ChannelID_t c)
Definition: TripletFinder.h:27
std::map< geo::TPCID, std::vector< HitOrChan > > fU_by_tpc
Definition: TripletFinder.h:95
const geo::GeometryCore * geom
Definition: TripletFinder.h:69
const double a
const recob::Hit * x
Definition: TripletFinder.h:47
p
Definition: test.py:223
General LArSoft Utilities.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
Description of geometry of one entire detector.
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
Declaration of signal hit object.
const recob::Hit * hit
Definition: TripletFinder.h:31
static bool * b
Definition: config.cpp:1043
list x
Definition: train.py:276
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
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
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc