SpaceView.h
Go to the documentation of this file.
1 //File: SpaceView.h
2 //Brief: A SpaceView is a ChannelView (mapping from (module, channel) pairs to histogram bins)
3 // that draws x coordinate on one axis and y coordinate on another.
4 //Author: Andrew Olivier aolivier@ur.rochester.edu
5 
6 //Include header
7 #include "plot/ChannelView.h"
8 
9 //ROOT includes
10 #include "TH2D.h"
11 
12 namespace CRT
13 {
14  class SpaceView: public ChannelView
15  {
16  public:
17  //Axis labels are automatically generated for x and y axes
18  SpaceView(const std::string& name="CRTEvd", const std::string& title="CRT Event Display", const std::string& zTitle="Hits");
19  SpaceView(TPad* pad, const std::string& name="CRTEvd", const std::string& title="CRT Event Display", const std::string& zTitle="Hits");
20 
21  //Automatic axis labels with maximum z value. Useful for ADCs
22  SpaceView(const double zMax, const std::string& name="CRTEvd", const std::string& title="CRT Event Display", const std::string& zTitle="Hits");
23  SpaceView(TPad* pad, const double zMax, const std::string& name="CRTEvd", const std::string& title="CRT Event Display", const std::string& zTitle="Hits");
24 
25  //Public interface is defined in base class
26  protected:
27  virtual void doFill(const size_t module, const size_t channel, const double weight) override;
28  virtual void doSetValue(const size_t module, const size_t channel, const double value) override;
29  virtual void doDraw(const char* option) override;
30  virtual void doReset(const char* option) override;
31 
32  private:
33  TH2D fUpstream; //Cartoon of upstream hit positions
34  TH2D fDownstream; //Cartoon of downstream hit positions
35 
36  //Concentrate code for deciding which histogram to fill in one place
37  template <class FUNC> //FUNC is a callable object that takes a TH2& and two bin numbers and uses them to
38  //update the values in a histogram.
39  void doSomething(TH2& hist, const size_t channel, const size_t module, FUNC&& func);
40  void ConfigHistogram(TH2& hist);
41  void SetupPads();
42  };
43 }
static QCString name
Definition: declinfo.cpp:673
TH2D fDownstream
Definition: SpaceView.h:34
void ConfigHistogram(TH2 &hist)
Definition: SpaceView.cpp:19
std::string string
Definition: nybbler.cc:12
virtual void doFill(const size_t module, const size_t channel, const double weight) override
Definition: SpaceView.cpp:77
virtual void doDraw(const char *option) override
Definition: SpaceView.cpp:156
uint8_t channel
Definition: CRTFragment.hh:201
weight
Definition: test.py:257
void SetupPads()
Definition: SpaceView.cpp:26
void doSomething(TH2 &hist, const size_t channel, const size_t module, FUNC &&func)
Definition: SpaceView.cpp:84
TH2D fUpstream
Definition: SpaceView.h:33
SpaceView(const std::string &name="CRTEvd", const std::string &title="CRT Event Display", const std::string &zTitle="Hits")
Definition: SpaceView.cpp:40
def func()
Definition: docstring.py:7
virtual void doReset(const char *option) override
Definition: SpaceView.cpp:172
virtual void doSetValue(const size_t module, const size_t channel, const double value) override
Definition: SpaceView.cpp:150