LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DrawWireData_tool.cc
Go to the documentation of this file.
1 
9 
12 
17 
18 #include "TPolyLine.h"
19 
20 namespace evdb_tool {
21 
22  class DrawWireData : public IWaveformDrawer {
23  public:
24  explicit DrawWireData(const fhicl::ParameterSet& pset);
25 
26  ~DrawWireData();
27 
28  void configure(const fhicl::ParameterSet& pset) override;
29  void Fill(evdb::View2D&, raw::ChannelID_t&, float, float) override;
30  void Draw(const std::string&, float, float) override;
31 
32  float getMaximum() const override { return fMaximum; };
33  float getMinimum() const override { return fMinimum; };
34 
35  private:
36  float fMaximum;
37  float fMinimum;
38 
39  std::vector<int> fColorMap;
40  };
41 
42  //----------------------------------------------------------------------
43  // Constructor.
45  {
46  configure(pset);
47  }
48 
50 
52  {
53  fColorMap.push_back(kBlue);
54  fColorMap.push_back(kMagenta);
55  fColorMap.push_back(kBlack);
56  fColorMap.push_back(kRed);
57 
58  return;
59  }
60 
62  raw::ChannelID_t& channel,
63  float lowBin,
64  float hiBin)
65  {
67 
68  //grab the singleton with the event
70  if (!event) return;
71 
72  for (size_t imod = 0; imod < recoOpt->fWireLabels.size(); ++imod) {
73  // Step one is to recover the hits for this label that match the input channel
74  art::InputTag const which = recoOpt->fWireLabels[imod];
75 
77  event->getByLabel(which, wireVecHandle);
78 
79  for (size_t wireIdx = 0; wireIdx < wireVecHandle->size(); wireIdx++) {
80  art::Ptr<recob::Wire> wire(wireVecHandle, wireIdx);
81 
82  if (wire->Channel() != channel) continue;
83 
84  // Recover a full wire version of the deconvolved wire data
85  // (the ROIs don't tend to display well)
86  std::vector<float> signal = wire->Signal();
87 
88  TPolyLine& wireWaveform =
89  view2D.AddPolyLine(signal.size(), fColorMap[imod % fColorMap.size()], 2, 1);
90 
91  for (size_t idx = 0; idx < signal.size(); idx++) {
92  float bin = float(idx) + 0.5;
93 
94  if (bin >= lowBin && bin <= hiBin) wireWaveform.SetPoint(idx, bin, signal[idx]);
95  }
96 
97  wireWaveform.Draw("same");
98  }
99  } //end loop over HitFinding modules
100 
101  return;
102  }
103 
104  void DrawWireData::Draw(const std::string&, float, float)
105  {
106  return;
107  }
108 
110 }
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
void Fill(evdb::View2D &, raw::ChannelID_t &, float, float) override
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
float getMaximum() const override
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
A collection of drawable 2-D objects.
Singleton to hold the current art::Event for the event display.
std::vector< art::InputTag > fWireLabels
module labels that produced wires
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
Definition: Wire.h:223
static EventHolder * Instance()
Definition: EventHolder.cxx:15
This provides an interface for tools which are tasked with drawing the "wire" data (deconvolved wavef...
DrawWireData(const fhicl::ParameterSet &pset)
void Draw(const std::string &, float, float) override
float bin[41]
Definition: plottest35.C:14
std::vector< float > Signal() const
Return a zero-padded full length vector filled with RoI signal.
Definition: Wire.cxx:30
std::vector< int > fColorMap
float getMinimum() const override
void configure(const fhicl::ParameterSet &pset) override
Declaration of basic channel signal object.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Definition: fwd.h:26
Event finding and building.