HardwarePad.cxx
Go to the documentation of this file.
1 ///
2 /// \file HardwarePad.cxx
3 /// \brief Drawing pad for X-Z or Y-Z projections of events
4 /// \author messier@indiana.edu
5 /// \version $Id: HardwarePad.cxx,v 1.2 2011-10-21 20:37:50 gsdavies Exp $
6 ///
7 #include "TBox.h"
8 #include "TH2F.h"
9 #include "TPad.h"
10 #include "TText.h"
12 #include "DAQChannelMap/HardwareDisplay.h"
13 #include "Geometry/Geometry.h"
18 
19 // Numeric flags for the XZ or ZY views
20 // static const int kX = 0;
21 // static const int kY = 1;
22 
23 namespace evd
24 {
25  ///
26  /// Create a pad showing a single X-Z or Y-Z projection of the detector
27  /// \param nm : Name of the pad
28  /// \param ti : Title of the pad
29  /// \param x1 : Location of left edge of pad (0-1)
30  /// \param x2 : Location of right edge of pad (0-1)
31  /// \param y1 : Location of bottom edge of pad (0-1)
32  /// \param y2 : Location of top edge of pad (0-1)
33  /// \param opt : Options. Include 'x', 'y' for xz or yz projections
34  ///
36  const char* ti,
37  double x1, double x2,
38  double y1, double y2,
39  const char* /*opt*/) :
40  DrawingPad(nm, ti, x1, x2, y1, y2),
41  fDetId(0),
42  fHisto(0)
43  {
44  this->Pad()->SetTopMargin (0.01);
45  this->Pad()->SetBottomMargin(0.11);
46  this->Pad()->SetLeftMargin (0.11);
47  this->Pad()->SetRightMargin (0.01);
48 
49  this->Pad()->SetBit(kCannotPick);
50  this->Pad()->SetBit(TPad::kCannotMove);
51 
52  fView = new evdb::View2D();
53  }
54 
55  //......................................................................
56 
57  void HardwarePad::Config(int detid)
58  {
59  if (fDetId == detid) return;
60  fDetId = detid;
61 
62  if (fHisto) { delete fHisto; fHisto = 0; }
63 
65  hd.SetupDet(detid);
66 
67  unsigned int nx = hd.fXmax;
68  unsigned int ny = hd.fYmax;
69 
70  this->Pad()->cd();
71  fHisto = new TH2F("fHisto","",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
72  fHisto->Draw("AB");
73  }
74 
75  //......................................................................
76 
78  {
79  if (fHisto) { delete fHisto; fHisto = 0; }
80  if (fView) { delete fView; fView = 0; }
81  }
82 
83  //......................................................................
84 
85  void HardwarePad::Draw(const char* /*opt*/)
86  {
87  fView->Clear();
89  if (evt==0) return;
90 
91  //
92  // Make sure we are configured for the right detector
93  //
95  this->Config(geo->DetId());
96  this->RawDataDraw()->RawDigitHardware(*evt, fView);
97 
98  fPad->Clear();
99  fPad->cd();
100  fHisto->Draw("AB");
101 
102  fView->Draw();
103  }
104 
105 } // end namespace evd
106 ////////////////////////////////////////////////////////////////////////
void RawDigitHardware(const art::Event &evt, evdb::View2D *view)
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
unsigned int fXmax
Width of entire view.
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
static constexpr Double_t nm
Definition: Munits.h:133
A collection of drawable 2-D objects.
HardwarePad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
Definition: HardwarePad.cxx:35
void Clear()
Definition: View2D.cxx:109
Singleton to hold the current art::Event for the event display.
nova event display
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:91
void Draw()
Definition: View2D.cxx:89
static EventHolder * Instance()
Definition: EventHolder.cxx:15
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
int evt
Base class for event display drawing pads.
Definition: DrawingPad.h:20
TPad * Pad()
Definition: DrawingPad.h:27
Drawing pad showing hits by hardware address.
void Config(int detid)
Definition: HardwarePad.cxx:57
Class to aid in the rendering of RawData objects.
unsigned int fYmax
Height of entire view.
evdb::View2D * fView
Collection of graphics objects to render.
Definition: HardwarePad.h:30
TH2F * fHisto
Histogram to draw object on.
Definition: HardwarePad.h:29
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:37
void Draw(const char *opt=0)
Definition: HardwarePad.cxx:85
int fDetId
Which detector are we configured for?
Definition: HardwarePad.h:28
Helper for AttenCurve.
Definition: Path.h:10
TH1F * hd
Definition: Xdiff_gwt.C:57
Encapsulate the geometry of one entire detector (near, far, ndos)