All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
6 #include "canvas/Persistency/Common/Ptr.h"
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;
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
const recob::Hit * v
Definition: TripletFinder.h:47
bool CloseSpace(geo::WireIDIntersection ra, geo::WireIDIntersection rb) const
raw::ChannelID_t chan
Definition: TripletFinder.h:30
geo::WireIDIntersection pt
Definition: TripletFinder.h:39
process_name opflash particleana ie x
std::vector< ChannelDoublet > DoubletHelper(geo::TPCID tpc, const std::vector< HitOrChan > &ahits, const std::vector< HitOrChan > &bhits, const std::vector< raw::ChannelID_t > &bbads) const
Declaration of signal hit object.
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
pdgs p
Definition: selectors.fcl:22
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
while getopts h
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
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 recob::Hit * x
Definition: TripletFinder.h:47
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.
TripletFinder(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &xhits, const std::vector< art::Ptr< recob::Hit >> &uhits, const std::vector< art::Ptr< recob::Hit >> &vhits, const std::vector< raw::ChannelID_t > &xbad, const std::vector< raw::ChannelID_t > &ubad, const std::vector< raw::ChannelID_t > &vbad, double distThresh, double distThreshDrift, double xhitOffset)
std::vector< HitTriplet > TripletsTwoView()
Only search for XU intersections.
const recob::Hit * u
Definition: TripletFinder.h:47
const recob::Hit * hit
Definition: TripletFinder.h:31
std::vector< ChannelDoublet > DoubletsXV(geo::TPCID tpc)
std::vector< ChannelDoublet > DoubletsXU(geo::TPCID tpc)
bool CloseDrift(double xa, double xb) const
std::vector< HitTriplet > Triplets()
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
void FillBadMap(const std::vector< raw::ChannelID_t > &bads, std::map< geo::TPCID, std::vector< raw::ChannelID_t >> &out)
Helper for constructor.
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc
auto const detProp
void FillHitMap(const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits, std::map< geo::TPCID, std::vector< HitOrChan >> &out)
Helper for constructor.