ChannelView.cpp
Go to the documentation of this file.
1 //File: ChannelView.cpp
2 //Brief: Implementation of common interface utilities for classes that map (module, channel)
3 // pairs to a 2D histogram on a TPad. Derive from ChannelView to use it.
4 //Author: Andrew Olivier aolivier@ur.rochester.edu
5 
6 //Include header
7 #include "plot/ChannelView.h"
8 
9 namespace CRT
10 {
11  //I own fPad. Delete it in destructor.
12  ChannelView::ChannelView(): fPad(new TPad("ChannelViewDefault", "CRT::ChannelView Default Pad", 0, 0, 1, 1), MaybeDeleter<TPad>(true))
13  {
14  }
15 
16  //Someone else owns fPad. Don't delete it in destructor.
17  ChannelView::ChannelView(TPad* pad): fPad(pad, MaybeDeleter<TPad>(false))
18  {
19  }
20 
21  //Implement default destructor so that class templates that want class to only be declared in header will be happy.
23  {
24  }
25 
26  void ChannelView::Fill(const size_t module, const size_t channel, const double weight)
27  {
28  //I could add "utility" processing here so that all derived classes benefit from it
29  doFill(module, channel, weight);
30  }
31 
32  void ChannelView::SetValue(const size_t module, const size_t channel, const double value)
33  {
34  //I could add "utility" processing here so that all derived classes benefit from it
35  doSetValue(module, channel, value);
36  }
37 
38  void ChannelView::Draw(const char* option)
39  {
40  fPad->cd();
41  doDraw(option);
42  }
43 
44  void ChannelView::Reset(const char* option)
45  {
46  doReset(option);
47  }
48 }
virtual ~ChannelView()
Definition: ChannelView.cpp:22
std::unique_ptr< TPad, MaybeDeleter< TPad > > fPad
Definition: ChannelView.h:66
uint8_t channel
Definition: CRTFragment.hh:201
weight
Definition: test.py:257
virtual void doDraw(const char *option)=0
virtual void doFill(const size_t module, const size_t channel, const double weight)=0
void Reset(const char *option)
Definition: ChannelView.cpp:44
void SetValue(const size_t module, const size_t channel, const double value)
Definition: ChannelView.cpp:32
virtual void doSetValue(const size_t module, const size_t channel, const double value)=0
virtual void doReset(const char *option)=0
void Draw(const char *option)
Definition: ChannelView.cpp:38
void Fill(const size_t module, const size_t channel, const double weight=1.0)
Definition: ChannelView.cpp:26