All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DrawWireData_tool.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file DrawWireData_tool.cc
3 /// \author T. Usher
4 ////////////////////////////////////////////////////////////////////////
5 
9 
10 #include "nuevdb/EventDisplayBase/EventHolder.h"
11 #include "nuevdb/EventDisplayBase/View2D.h"
12 
13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "art/Framework/Principal/Handle.h"
15 
16 #include "art/Utilities/ToolMacros.h"
17 
18 #include "TPolyLine.h"
19 
20 namespace evdb_tool
21 {
22 
24 {
25 public:
26  explicit DrawWireData(const fhicl::ParameterSet& pset);
27 
28  ~DrawWireData();
29 
30  void configure(const fhicl::ParameterSet& pset) override;
31  void Fill(evdb::View2D&, raw::ChannelID_t&, float, float) override;
32  void Draw(const std::string&, float, float) override;
33 
34  float getMaximum() const override {return fMaximum;};
35  float getMinimum() const override {return fMinimum;};
36 
37 private:
38 
39  float fMaximum;
40  float fMinimum;
41 
42  std::vector<int> fColorMap;
43 };
44 
45 //----------------------------------------------------------------------
46 // Constructor.
47 DrawWireData::DrawWireData(const fhicl::ParameterSet& pset)
48 {
49  configure(pset);
50 }
51 
53 {
54 }
55 
56 void DrawWireData::configure(const fhicl::ParameterSet& pset)
57 {
58  fColorMap.push_back(kBlue);
59  fColorMap.push_back(kMagenta);
60  fColorMap.push_back(kBlack);
61  fColorMap.push_back(kRed);
62 
63  return;
64 }
65 
66 
67 void DrawWireData::Fill(evdb::View2D& view2D,
68  raw::ChannelID_t& channel,
69  float lowBin,
70  float hiBin)
71 {
72  art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
73 
74  //grab the singleton with the event
75  const art::Event* event = evdb::EventHolder::Instance()->GetEvent();
76  if(!event) return;
77 
78  for (size_t imod = 0; imod < recoOpt->fWireLabels.size(); ++imod)
79  {
80  // Step one is to recover the hits for this label that match the input channel
81  art::InputTag const which = recoOpt->fWireLabels[imod];
82 
83  art::Handle< std::vector<recob::Wire> > wireVecHandle;
84  event->getByLabel(which, wireVecHandle);
85 
86  for(size_t wireIdx = 0; wireIdx < wireVecHandle->size(); wireIdx++)
87  {
88  art::Ptr<recob::Wire> wire(wireVecHandle, wireIdx);
89 
90  if (wire->Channel() != channel) continue;
91 
92  // Recover a full wire version of the deconvolved wire data
93  // (the ROIs don't tend to display well)
94  std::vector<float> signal = wire->Signal();
95 
96  TPolyLine& wireWaveform = view2D.AddPolyLine(signal.size(), fColorMap[imod % fColorMap.size()], 2, 1);
97 
98  for(size_t idx = 0; idx < signal.size(); idx++)
99  {
100  float bin = float(idx) + 0.5;
101 
102  if (bin >= lowBin && bin <= hiBin) wireWaveform.SetPoint(idx,bin,signal[idx]);
103  }
104 
105  wireWaveform.Draw("same");
106  }
107  }//end loop over HitFinding modules
108 
109  return;
110 }
111 
112 void DrawWireData::Draw(const std::string&,float,float)
113 {
114  return;
115 }
116 
117 DEFINE_ART_CLASS_TOOL(DrawWireData)
118 }
void Fill(evdb::View2D &, raw::ChannelID_t &, float, float) override
float getMinimum() const override
float getMaximum() const override
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
This provides an interface for tools which are tasked with drawing the &quot;wire&quot; data (deconvolved wavef...
DrawWireData(const fhicl::ParameterSet &pset)
void Draw(const std::string &, float, float) override
std::vector< int > fColorMap
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