RecoBaseDrawer.h
Go to the documentation of this file.
1 /// \file RecoBaseDrawer.h
2 /// \brief Class to aid in the rendering of RecoBase objects
3 /// \author messier@indiana.edu
4 #ifndef EVD_RECOBASEDRAWER_H
5 #define EVD_RECOBASEDRAWER_H
6 
7 #include <vector>
8 
12 #include "canvas/Persistency/Common/FindMany.h"
13 #include "canvas/Persistency/Common/FindManyP.h"
15 
19 namespace detinfo {
20  class DetectorClocksData;
21  class DetectorPropertiesData;
22 }
23 
24 class TVector3;
25 class TH1F;
26 namespace evdb {
27  class View2D;
28  class View3D;
29 }
30 
31 namespace recob {
32  class Edge;
33  class Hit;
34  class Cluster;
35  class PCAxis;
36  class PFParticle;
37  class EndPoint2D;
38  class Prong;
39  class Track;
40  class Shower;
41  class Wire;
42  class Vertex;
43  class Seed;
44  class Event;
45  class OpFlash;
46 }
47 
48 namespace anab {
49  class CosmicTag;
50 }
51 
52 namespace evdb_tool {
53  class ISpacePoints3D;
54 }
55 
56 namespace evd {
57 
58  /// Aid in the rendering of RecoBase objects
60  public:
62  ~RecoBaseDrawer();
63 
64  public:
65  void Wire2D(const art::Event& evt, evdb::View2D* view, unsigned int plane);
66  int Hit2D(const art::Event& evt,
67  detinfo::DetectorPropertiesData const& detProp,
68  evdb::View2D* view,
69  unsigned int plane);
70  int Hit2D(std::vector<const recob::Hit*> hits,
71  int color,
72  evdb::View2D* view,
73  bool allWireIds,
74  bool drawConnectingLines = false,
75  int lineWidth = 1);
76  int Hit2D(std::vector<const recob::Hit*> hits, evdb::View2D* view, float cosmicscore);
77 
78  void EndPoint2D(const art::Event& evt, evdb::View2D* view, unsigned int plane);
79  void OpFlash2D(const art::Event& evt,
80  detinfo::DetectorClocksData const& clockData,
81  detinfo::DetectorPropertiesData const& detProp,
82  evdb::View2D* view,
83  unsigned int plane);
84 
85  void Seed2D(const art::Event& evt,
86  detinfo::DetectorPropertiesData const& detProp,
87  evdb::View2D* view,
88  unsigned int plane);
89 
90  void Draw2DSlopeEndPoints(double xStart,
91  double yStart,
92  double xEnd,
93  double yEnd,
94  double slope,
95  int color,
96  evdb::View2D* view);
97  void Draw2DSlopeEndPoints(double x, double y, double slope, int color, evdb::View2D* view);
98  void Draw2DSlopeEndPoints(double x,
99  double y,
100  double cosx,
101  double cosy,
102  int color,
103  evdb::View2D* view);
104  void Slice2D(const art::Event& evt,
105  detinfo::DetectorPropertiesData const& detProp,
106  evdb::View2D* view,
107  unsigned int plane);
108  void Cluster2D(const art::Event& evt,
109  detinfo::DetectorClocksData const& clockData,
110  detinfo::DetectorPropertiesData const& detProp,
111  evdb::View2D* view,
112  unsigned int plane);
113  void Prong2D(const art::Event& evt,
114  detinfo::DetectorClocksData const& clockData,
115  detinfo::DetectorPropertiesData const& detProp,
116  evdb::View2D* view,
117  unsigned int plane);
118  void DrawTrackVertexAssns2D(const art::Event& evt,
119  detinfo::DetectorClocksData const& clockData,
120  detinfo::DetectorPropertiesData const& detProp,
121  evdb::View2D* view,
122  unsigned int plane);
123  void DrawProng2D(detinfo::DetectorPropertiesData const& detProp,
124  std::vector<const recob::Hit*>& hits,
125  evdb::View2D* view,
126  unsigned int plane,
127  TVector3 const& startPos,
128  TVector3 const& startDir,
129  int id,
130  float cscore = -5);
131  void DrawTrack2D(detinfo::DetectorClocksData const& clockData,
132  detinfo::DetectorPropertiesData const& detProp,
133  std::vector<const recob::Hit*>& hits,
134  evdb::View2D* view,
135  unsigned int plane,
136  const recob::Track* track,
137  int color,
138  int lineWidth);
139  void Vertex2D(const art::Event& evt,
140  detinfo::DetectorPropertiesData const& detProp,
141  evdb::View2D* view,
142  unsigned int plane);
143 
144  void Event2D(const art::Event& evt, evdb::View2D* view, unsigned int plane);
145 
146  void SpacePoint3D(const art::Event& evt, evdb::View3D* view);
147  void PFParticle3D(const art::Event& evt, evdb::View3D* view);
148  void DrawPFParticle3D(const art::Ptr<recob::PFParticle>& pfPart,
149  const art::PtrVector<recob::PFParticle>& pfParticleVec,
150  const std::vector<art::Ptr<recob::SpacePoint>>& spacePointVec,
151  const art::FindManyP<recob::Edge>& edgeAssnsVec,
152  const art::FindManyP<recob::SpacePoint>& spacePointAssnsVec,
153  const art::FindManyP<recob::SpacePoint>& edgeSPAssnVec,
154  const art::FindManyP<recob::Hit>& spHitAssnVec,
155  const art::FindMany<recob::Track>& trackAssnVec,
156  const art::FindMany<recob::PCAxis>& pcAxisAssnVec,
157  const art::FindMany<anab::CosmicTag>& cosmicTagAssnVec,
158  int depth,
159  evdb::View3D* view);
160  void Edge3D(const art::Event& evt, evdb::View3D* view);
161  void Prong3D(const art::Event& evt, evdb::View3D* view);
162  void DrawTrack3D(const recob::Track& track,
163  evdb::View3D* view,
164  int color,
165  int marker = 1,
166  float size = 2.);
167  void DrawShower3D(const recob::Shower& shower, int color, evdb::View3D* view);
168  void Seed3D(const art::Event& evt, evdb::View3D* view);
169  void Vertex3D(const art::Event& evt, evdb::View3D* view);
170  void Event3D(const art::Event& evt, evdb::View3D* view);
171  void Slice3D(const art::Event& evt, evdb::View3D* view);
172  void OpFlashOrtho(const art::Event& evt,
173  detinfo::DetectorClocksData const& clockData,
174  detinfo::DetectorPropertiesData const& detProp,
175  evd::OrthoProj_t proj,
176  evdb::View2D* view);
177  void VertexOrtho(const art::PtrVector<recob::Vertex>& vertex,
178  evd::OrthoProj_t proj,
179  evdb::View2D* view,
180  int marker);
181  void VertexOrtho(const art::Event& evt, evd::OrthoProj_t proj, evdb::View2D* view);
182  void SpacePointOrtho(const art::Event& evt,
183  evd::OrthoProj_t proj,
184  double msize,
185  evdb::View2D* view);
186  void PFParticleOrtho(const art::Event& evt,
187  evd::OrthoProj_t proj,
188  double msize,
189  evdb::View2D* view);
190  void DrawPFParticleOrtho(const art::Ptr<recob::PFParticle>& pfPart,
191  const art::PtrVector<recob::PFParticle>& pfParticleVec,
192  const art::FindMany<recob::SpacePoint>& spacePointAssnsVec,
193  const art::FindMany<recob::PCAxis>& pcAxisAssnVec,
194  int depth,
195  evd::OrthoProj_t proj,
196  evdb::View2D* view);
197  void ProngOrtho(const art::Event& evt, evd::OrthoProj_t proj, double msize, evdb::View2D* view);
198  void DrawSpacePointOrtho(std::vector<art::Ptr<recob::SpacePoint>>& spts,
199  int color,
200  evd::OrthoProj_t proj,
201  double msize,
202  evdb::View2D* view,
203  int mode = 0); ///< 0: track, 1: shower
204  void DrawProngOrtho(const recob::Prong& prong,
205  int color,
206  evd::OrthoProj_t proj,
207  double msize,
208  evdb::View2D* view);
209  void DrawTrackOrtho(const recob::Track& track,
210  int color,
211  evd::OrthoProj_t proj,
212  double msize,
213  evdb::View2D* view);
214  void DrawShowerOrtho(const recob::Shower& shower,
215  int color,
216  evd::OrthoProj_t proj,
217  double msize,
218  evdb::View2D* view);
219  void SeedOrtho(const art::Event& evt, evd::OrthoProj_t proj, evdb::View2D* view);
220 
221  void FillTQHisto(const art::Event& evt, unsigned int plane, unsigned int wire, TH1F* histo);
222 
223  void FillQHisto(const art::Event& evt, unsigned int plane, TH1F* histo);
224 
225  void FillTQHistoDP(const art::Event& evt,
226  unsigned int plane,
227  unsigned int wire,
228  TH1F* histo,
229  std::vector<double>& htau1,
230  std::vector<double>& htau2,
231  std::vector<double>& hitamplitudes,
232  std::vector<double>& hpeaktimes,
233  std::vector<int>& hstartT,
234  std::vector<int>& hendT,
235  std::vector<int>& hNMultiHit,
236  std::vector<int>& hLocalHitIndex);
237 
238  int GetRegionOfInterest(int plane, int& minw, int& maxw, int& mint, int& maxt);
239 
240  void GetChargeSum(int plane, double& charge, double& convcharge);
241 
242  //double EvalExpoFit(double x,
243  // double tau1,
244  // double tau2,
245  // double amplitude,
246  // double peaktime);
247 
248  //double EvalMultiExpoFit(double x,
249  // int HitNumber,
250  // int NHits,
251  // std::vector<double> tau1,
252  // std::vector<double> tau2,
253  // std::vector<double> amplitude,
254  // std::vector<double> peaktime);
255 
256  private:
257  void GetClusterOutlines(std::vector<const recob::Hit*>& hits,
258  std::vector<double>& tpts,
259  std::vector<double>& wpts,
260  unsigned int plane);
261  int GetWires(const art::Event& evt,
262  const art::InputTag& which,
264  int GetHits(const art::Event& evt,
265  const art::InputTag& which,
266  std::vector<const recob::Hit*>& hits,
267  unsigned int plane);
268  int GetSlices(const art::Event& evt,
269  const art::InputTag& which,
271  int GetClusters(const art::Event& evt,
272  const art::InputTag& which,
274  int GetPFParticles(const art::Event& evt,
275  const art::InputTag& which,
277  int GetEndPoint2D(const art::Event& evt,
278  const art::InputTag& which,
280  int GetSpacePoints(const art::Event& evt,
281  const art::InputTag& which,
283  int GetEdges(const art::Event& evt,
284  const art::InputTag& which,
286 
287  int GetTracks(const art::Event& evt,
288  const art::InputTag& which,
289  art::View<recob::Track>& track);
290 
291  int GetShowers(const art::Event& evt,
292  const art::InputTag& which,
293  art::View<recob::Shower>& shower);
294 
295  int GetVertices(const art::Event& evt,
296  const art::InputTag& which,
298 
299  int GetSeeds(const art::Event& evt,
300  const art::InputTag& which,
302 
303  int GetOpFlashes(const art::Event& evt,
304  const art::InputTag& which,
306 
307  int GetEvents(const art::Event& evt,
308  const art::InputTag& which,
310 
311  float SpacePointChiSq(const std::vector<art::Ptr<recob::Hit>>&) const;
312 
313  std::vector<std::array<double, 3>> Circle3D(const TVector3& pos,
314  const TVector3& axisDir,
315  const double& radius);
316 
317  int CountHits(const art::Event& evt,
318  const art::InputTag& which,
319  unsigned int cryostat,
320  unsigned int tpc,
321  unsigned int plane);
322 
323  private:
324  using ISpacePointDrawerPtr = std::unique_ptr<evdb_tool::ISpacePoints3D>;
325 
328 
329  std::vector<int> fWireMin; ///< lowest wire in interesting region for each plane
330  std::vector<int> fWireMax; ///< highest wire in interesting region for each plane
331  std::vector<int> fTimeMin; ///< lowest time in interesting region for each plane
332  std::vector<int> fTimeMax; ///< highest time in interesting region for each plane
333 
334  std::vector<double> fRawCharge; ///< Sum of Raw Charge
335  std::vector<double> fConvertedCharge; ///< Sum of Charge Converted using Birks' formula
336  };
337 }
338 
339 #endif
340 ////////////////////////////////////////////////////////////////////////
ISpacePointDrawerPtr fSpacePointDrawer
std::vector< double > fRawCharge
Sum of Raw Charge.
Reconstruction base classes.
ISpacePointDrawerPtr fAllSpacePointDrawer
Define OrthoProj_t enum for selecting orthographic view.
Aid in the rendering of RecoBase objects.
struct vector vector
boost::graph_traits< ModuleGraph >::edge_descriptor Edge
Definition: ModuleGraph.h:24
OrthoProj_t
Definition: OrthoProj.h:12
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks&#39; formula.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::unique_ptr< evdb_tool::ISpacePoints3D > ISpacePointDrawerPtr
LArSoft includes.
Definition: InfoTransfer.h:33
std::vector< int > fWireMax
highest wire in interesting region for each plane
Definition: fwd.h:46
General LArSoft Utilities.
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
std::size_t color(std::string const &procname)
Contains all timing reference information for the detector.
Definition: types.h:32
list x
Definition: train.py:276
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1036
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< int > fTimeMax
highest time in interesting region for each plane
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
Event finding and building.
std::vector< int > fTimeMin
lowest time in interesting region for each plane
vertex reconstruction