DrawWireData_tool.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file DrawWireData_tool.cc
3 /// \author T. Usher
4 ////////////////////////////////////////////////////////////////////////
5 
9 #include "nuevdb/EventDisplayBase/EventHolder.h"
10 
12 
13 #include "TPolyLine.h"
14 
15 namespace evdb_tool
16 {
17 
19 {
20 public:
21  explicit DrawWireData(const fhicl::ParameterSet& pset);
22 
23  ~DrawWireData();
24 
25  void configure(const fhicl::ParameterSet& pset) override;
26  void Fill(evdb::View2D&, raw::ChannelID_t&, float, float) override;
27  void Draw(const std::string&, float, float) override;
28 
29  float getMaximum() const override {return fMaximum;};
30  float getMinimum() const override {return fMinimum;};
31 
32 private:
33 
34  float fMaximum;
35  float fMinimum;
36 
37  std::vector<int> fColorMap;
38 };
39 
40 //----------------------------------------------------------------------
41 // Constructor.
43 {
44  configure(pset);
45 }
46 
48 {
49 }
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 
61 
62 void DrawWireData::Fill(evdb::View2D& view2D,
64  float lowBin,
65  float hiBin)
66 {
68 
69  //grab the singleton with the event
70  const art::Event* event = evdb::EventHolder::Instance()->GetEvent();
71  if(!event) return;
72 
73  for (size_t imod = 0; imod < recoOpt->fWireLabels.size(); ++imod)
74  {
75  // Step one is to recover the hits for this label that match the input channel
76  art::InputTag const which = recoOpt->fWireLabels[imod];
77 
79  event->getByLabel(which, wireVecHandle);
80 
81  for(size_t wireIdx = 0; wireIdx < wireVecHandle->size(); wireIdx++)
82  {
83  art::Ptr<recob::Wire> wire(wireVecHandle, wireIdx);
84 
85  if (wire->Channel() != channel) continue;
86 
87  // Recover a full wire version of the deconvolved wire data
88  // (the ROIs don't tend to display well)
89  std::vector<float> signal = wire->Signal();
90 
91  TPolyLine& wireWaveform = view2D.AddPolyLine(signal.size(), fColorMap[imod % fColorMap.size()], 2, 1);
92 
93  for(size_t idx = 0; idx < signal.size(); idx++)
94  {
95  float bin = float(idx) + 0.5;
96 
97  if (bin >= lowBin && bin <= hiBin) wireWaveform.SetPoint(idx,bin,signal[idx]);
98  }
99 
100  wireWaveform.Draw("same");
101  }
102  }//end loop over HitFinding modules
103 
104  return;
105 }
106 
107 void DrawWireData::Draw(const std::string&,float,float)
108 {
109  return;
110 }
111 
113 }
void Fill(evdb::View2D &, raw::ChannelID_t &, float, float) override
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
float getMaximum() const override
std::string string
Definition: nybbler.cc:12
uint8_t channel
Definition: CRTFragment.hh:201
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:231
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
std::vector< float > Signal() const
Return a zero-padded full length vector filled with RoI signal.
Definition: Wire.cxx:47
std::vector< int > fColorMap
float getMinimum() const override
void configure(const fhicl::ParameterSet &pset) override
QTextStream & bin(QTextStream &s)
Declaration of basic channel signal object.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Event finding and building.