Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
evd::TQPad Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/EventDisplay/TQPad.h"

Inheritance diagram for evd::TQPad:
evd::DrawingPad

Public Member Functions

 TQPad (const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
 
 ~TQPad ()
 
void Draw ()
 
void RangeChanged ()
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
GeometryDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 

Protected Attributes

TPad * fPad
 The ROOT graphics pad. More...
 
HeaderDrawerfHeaderDraw
 Drawer for event header info. More...
 
GeometryDrawerfGeometryDraw
 Drawer for detector geometry. More...
 
SimulationDrawerfSimulationDraw
 Drawer for simulation objects. More...
 
RawDataDrawerfRawDataDraw
 Drawer for raw data. More...
 
RecoBaseDrawerfRecoBaseDraw
 Drawer for recobase objects. More...
 

Private Member Functions

void BookHistogram ()
 

Private Attributes

int fTorQ
 0 = plot shows time, 1 = plot shows charge More...
 
TH1F * fHisto
 1-D Histogram of time or charge More...
 
evdb::View2DfView
 Superimpose scale on 1D histo. More...
 

Detailed Description

Definition at line 15 of file TQPad.h.

Constructor & Destructor Documentation

evd::TQPad::TQPad ( const char *  nm,
const char *  ti,
double  x1,
double  y1,
double  x2,
double  y2,
const char *  opt 
)

Definition at line 39 of file TQPad.cxx.

References BookHistogram(), fTorQ, fView, evd::kQPAD, evd::kTPAD, plot_validation_datamc::opts, evd::DrawingPad::Pad(), and string.

42  :
43  DrawingPad(nm, ti, x1, y1, x2, y2),
44  fHisto(0)
45  {
46  this->Pad()->cd();
47  this->Pad()->SetLogy();
48 
50  if (opts=="T") fTorQ = kTPAD;
51  if (opts=="Q") fTorQ = kQPAD;
52 
53  fView = new evdb::View2D();
54 
55  this->Pad()->Connect("RangeChanged()",
56  "evd::TQPad", this, "RangeChanged()");
57 
58  this->BookHistogram();
59  }
Float_t y1[n_points_granero]
Definition: compare.C:5
void BookHistogram()
Definition: TQPad.cxx:242
Float_t x1[n_points_granero]
Definition: compare.C:5
static constexpr Double_t nm
Definition: Munits.h:133
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:32
TPad * Pad()
Definition: DrawingPad.h:27
static const int kTPAD
Definition: TQPad.cxx:30
TH1F * fHisto
1-D Histogram of time or charge
Definition: TQPad.h:31
int fTorQ
0 = plot shows time, 1 = plot shows charge
Definition: TQPad.h:30
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:34
static const int kQPAD
Definition: TQPad.cxx:31
enum BeamMode string
evd::TQPad::~TQPad ( )

Definition at line 63 of file TQPad.cxx.

References fHisto, and fView.

64  {
65  if (fView) { delete fView; fView = 0; }
66  if (fHisto) { delete fHisto; fHisto = 0; }
67  }
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:32
TH1F * fHisto
1-D Histogram of time or charge
Definition: TQPad.h:31

Member Function Documentation

void evd::TQPad::BookHistogram ( )
private

Definition at line 242 of file TQPad.cxx.

References ana::assert(), colors, evd::RawDrawingOptions::fADCBinSize, evd::RawDrawingOptions::fADCRange, fHisto, evd::RawDrawingOptions::fTimeBinSize, evd::RawDrawingOptions::fTimeRange, fTorQ, evd::RawDrawingOptions::fWhichHits, hi(), evd::RawDrawingOptions::kCAL_HITS, evd::RawDrawingOptions::kRAW_HITS, lo(), std::max(), getGoodRuns4SAM::n, evdb::Colors::Scale(), and evdb::ColorScale::SetBounds().

Referenced by Draw(), and TQPad().

243  {
244  if (fHisto) {
245  delete fHisto;
246  fHisto = 0;
247  }
248 
252  float lo = drawopt->fTimeRange[0];
253  float hi = drawopt->fTimeRange[1];
254  int n = std::max(1, int(rint((hi-lo)/drawopt->fTimeBinSize)));
255  fHisto = new TH1F("fRAWTHisto",";t (#musec);hits",n,lo,hi);
256  colors->Scale("RawT").SetBounds(lo, hi);
257  }
259  float lo = drawopt->fTimeRange[0];
260  float hi = drawopt->fTimeRange[1];
261  int n = std::max(1, int(rint((hi-lo)/drawopt->fTimeBinSize)));
262  fHisto = new TH1F("fCALTHisto",";t (#musec);hits",n,lo,hi);
263  colors->Scale("CalT").SetBounds(lo, hi);
264  }
266  float lo = drawopt->fADCRange[0];
267  float hi = drawopt->fADCRange[1];
268  int n = std::max(1, int(rint((hi-lo)/drawopt->fADCBinSize)));
269  fHisto = new TH1F("fRAWQHisto",";q (ADC);hits",n,lo,hi);
270  }
272  // Even though this histo is filled with PE values, we can still use
273  // the values below so that the user can maintain control over how the
274  // histo is binned.
275  float lo = drawopt->fADCRange[0];
276  float hi = drawopt->fADCRange[1];
277  int n = std::max(1, int(rint((hi-lo)/drawopt->fADCBinSize)));
278  fHisto = new TH1F("fCALQHisto",";q (pe);hits",n,lo,hi);
279  }
280 
281  // By this time I must have a histogram booked
282  assert(fHisto);
283 
284  fHisto->SetLabelSize (0.180,"X");
285  fHisto->SetLabelOffset(0.002,"X");
286  fHisto->SetTitleSize (0.200,"X");
287  fHisto->SetTitleOffset(0.850,"X");
288 
289  fHisto->SetLabelSize (0.180,"Y");
290  fHisto->SetLabelOffset(0.002,"Y");
291  fHisto->SetTitleSize (0.200,"Y");
292  fHisto->SetTitleOffset(0.230,"Y");
293  }
std::vector< float > fTimeRange
T max(const caf::Proxy< T > &a, T b)
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
int colors[6]
Definition: tools.h:1
void SetBounds(double xlo, double xhi)
Definition: ColorScale.h:57
static const int kCAL_HITS
ColorScale & Scale(const std::string &nm)
static const int kTPAD
Definition: TQPad.cxx:30
TH1F * fHisto
1-D Histogram of time or charge
Definition: TQPad.h:31
assert(nhit_max >=nhit_nbins)
std::vector< float > fADCRange
int fTorQ
0 = plot shows time, 1 = plot shows charge
Definition: TQPad.h:30
static const int kRAW_HITS
static const int kQPAD
Definition: TQPad.cxx:31
void evd::TQPad::Draw ( )

Definition at line 123 of file TQPad.cxx.

References evdb::View2D::AddBox(), b, BookHistogram(), plot_validation_datamc::c, colors, e, evt, evd::RawDrawingOptions::fColor, fHisto, evd::RawDataDrawer::FillTQHisto(), evd::RecoBaseDrawer::FillTQHisto(), evd::RawDrawingOptions::fTHistogram, evd::RawDrawingOptions::fTimeAutoZoomTruth, fTorQ, fView, evd::RawDrawingOptions::fWhichHits, evdb::ColorScale::GetColor(), evdb::EventHolder::GetEvent(), evd::SimulationDrawer::GetTimeLimits(), GetXaxis(), MECModelEnuComparisons::i, evdb::EventHolder::Instance(), evd::RawDrawingOptions::kCAL_HITS, evd::RawDrawingOptions::kCOLOR_BY_CHARGE, evd::RawDrawingOptions::kCOLOR_BY_TIME, evd::RawDrawingOptions::kRAW_HITS, evd::DrawingPad::Pad(), RangeChanged(), evd::DrawingPad::RawDataDraw(), evd::DrawingPad::RecoBaseDraw(), evdb::Colors::Scale(), evd::DrawingPad::SimulationDraw(), x1, submit_syst::x2, y1, and submit_syst::y2.

Referenced by evd::HardwareView::Draw(), evd::XZYZProjectionsView::Draw(), evd::HardwareView::HardwareView(), and evd::XZYZProjectionsView::XZYZProjectionsView().

124  {
125  static const double kHistoFloor = 0.3;
126  static const double kColorScaleLevel = 0.6;
127 
128  if (fHisto==0) return;
129 
131 
132  if ( !drawopt->fTHistogram && fTorQ == kTPAD ) {
133  this->Pad()->Clear();
134  return;
135  }
136 
137  //grab the singleton with the event
139  if (!evt) return;
140 
141  fView-> Clear();
142  this->BookHistogram();
143 
145  if (fTorQ == kTPAD) {
146  this->RawDataDraw()->FillTQHisto(*evt, fHisto, 0);
147  }
148  if (fTorQ == kQPAD) {
149  this->RawDataDraw()->FillTQHisto(*evt, 0, fHisto);
150  }
151  }
152 
154  if (fTorQ == kTPAD) {
155  this->RecoBaseDraw()->FillTQHisto(*evt, fHisto, 0);
156  }
157  if (fTorQ == kQPAD) {
158  this->RecoBaseDraw()->FillTQHisto(*evt, 0, fHisto);
159  }
160  }
161 
162  if (drawopt->fTimeAutoZoomTruth && fTorQ == kTPAD){
163  double tmin, tmax;
164  this->SimulationDraw()->GetTimeLimits(evt, tmin, tmax);
165  fHisto->GetXaxis()->SetRangeUser(tmin*1e-3-1, tmax*1e-3+2);
166  this->RangeChanged();
167  }
168 
169  this->Pad()->Clear();
170  this->Pad()->cd();
171 
172  //
173  // Play some defense against empty histograms
174  //
175  double hmax = 0.0;
176  for (int i=1; i<=fHisto->GetNbinsX(); ++i) {
177  double hc = fHisto->GetBinContent(i);
178  if (hc>hmax) hmax = hc;
179  }
180  if (hmax>kHistoFloor){
181  this->Pad()->SetLogy(kTRUE);
182  fHisto->SetMinimum(kHistoFloor);
183  fHisto->SetMaximum(2.0*hmax);
184  }
185  else {
186  fHisto->SetMinimum(0.0);
187  fHisto->SetMaximum(1.0);
188  this->Pad()->SetLogy(kFALSE);
189  }
190  if (fTorQ == kQPAD){
191  this->Pad()->SetLogx(kTRUE);
192  }
193  fHisto->Draw();
194 
195  //
196  // Use this to fill the histogram with colors from the color scale
197  //
199  for (int i=1; i<=fHisto->GetNbinsX(); ++i) {
200  if (i<fHisto->GetXaxis()->GetFirst()) continue;
201  if (i>fHisto->GetXaxis()->GetLast()) continue;
202 
203  double x1, x2, y1, y2;
204  x1 = fHisto->GetBinLowEdge(i);
205  x2 = x1 + fHisto->GetBinWidth(i);
206  y1 = 0.0;
207  y2 = fHisto->GetBinContent(i);
208  if (y2==0.0) y2 += kColorScaleLevel;
209  if (y2>y1) {
210  int c=1;
213  c = colors->Scale("RawT").GetColor(0.5*(x1+x2));
214  }
216  c = colors->Scale("CalT").GetColor(0.5*(x1+x2));
217  }
218  TBox& b = fView->AddBox(x1,y1,x2,y2);
219  b.SetFillStyle(1001);
220  b.SetFillColor(c);
221  b.Draw();
222  }
225  c = colors->Scale("RawQ").GetColor(0.5*(x1+x2));
226  }
228  c = colors->Scale("CalQ").GetColor(0.5*(x1+x2));
229  }
230  TBox& b = fView->AddBox(x1,y1,x2,y2);
231  b.SetFillStyle(1001);
232  b.SetFillColor(c);
233  b.Draw();
234  }
235  }
236  }
237  fHisto->Draw("same");
238  }
void FillTQHisto(art::Event const &evt, TH1F *thisto, TH1F *qhisto)
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
Float_t y1[n_points_granero]
Definition: compare.C:5
void BookHistogram()
Definition: TQPad.cxx:242
Float_t x1[n_points_granero]
Definition: compare.C:5
int GetColor(double x) const
Definition: ColorScale.cxx:126
void RangeChanged()
Definition: TQPad.cxx:70
void GetTimeLimits(const art::Event *evt, double &tmin, double &tmax)
static const int kCOLOR_BY_TIME
evdb::View2D * fView
Superimpose scale on 1D histo.
Definition: TQPad.h:32
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
int colors[6]
Definition: tools.h:1
static const int kCAL_HITS
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:91
static EventHolder * Instance()
Definition: EventHolder.cxx:15
correl_xv GetXaxis() -> SetDecimals()
ColorScale & Scale(const std::string &nm)
int evt
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:101
void FillTQHisto(const art::Event &evt, TH1F *thisto, TH1F *qhisto)
TPad * Pad()
Definition: DrawingPad.h:27
static const int kTPAD
Definition: TQPad.cxx:30
static const int kCOLOR_BY_CHARGE
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:82
TH1F * fHisto
1-D Histogram of time or charge
Definition: TQPad.h:31
const hit & b
Definition: hits.cxx:21
int fTorQ
0 = plot shows time, 1 = plot shows charge
Definition: TQPad.h:30
Float_t e
Definition: plot.C:35
static const int kRAW_HITS
static const int kQPAD
Definition: TQPad.cxx:31
GeometryDrawer * evd::DrawingPad::GeometryDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 73 of file DrawingPad.cxx.

References evd::DrawingPad::fGeometryDraw.

Referenced by evd::Display3DPad::Draw(), evd::TZProjPad::Draw(), and evd::DrawingPad::Pad().

74  {
75  if (fGeometryDraw==0) fGeometryDraw = new GeometryDrawer();
76  return fGeometryDraw;
77  }
GeometryDrawer * fGeometryDraw
Drawer for detector geometry.
Definition: DrawingPad.h:39
HeaderDrawer * evd::DrawingPad::HeaderDraw ( )
inherited

Provide access to the drawer for the event header

Definition at line 64 of file DrawingPad.cxx.

References evd::DrawingPad::fHeaderDraw.

Referenced by evd::HeaderPad::Draw(), evd::Display3DPad::Draw(), and evd::DrawingPad::Pad().

65  {
66  if (fHeaderDraw==0) fHeaderDraw = new HeaderDrawer();
67  return fHeaderDraw;
68  }
HeaderDrawer * fHeaderDraw
Drawer for event header info.
Definition: DrawingPad.h:38
TPad* evd::DrawingPad::Pad ( )
inlineinherited
void evd::TQPad::RangeChanged ( )
Todo:
what to do with colors when axis zooms? switch (drawopt->fWhichHits) { case evd::RawDrawingOptions::kRAW_HITS: ColorScaleTable::MakeRawQ(lo, hi); break; case evd::RawDrawingOptions::kCAL_HITS: ColorScaleTable::MakeCalQ(lo, hi); break; default: break; }

Definition at line 70 of file TQPad.cxx.

References colors, fHisto, fTorQ, evd::RawDrawingOptions::fWhichHits, hi(), evd::RawDrawingOptions::kCAL_HITS, evd::RawDrawingOptions::kRAW_HITS, lo(), evdb::Colors::Scale(), and evdb::ColorScale::SetBounds().

Referenced by Draw().

71  {
73 
74  static int iloqlast = -1;
75  static int ihiqlast = -1;
76  static int ilotlast = -1;
77  static int ihitlast = -1;
78 
79  int ilo = fHisto->GetXaxis()->GetFirst();
80  int ihi = fHisto->GetXaxis()->GetLast();
81  double lo = fHisto->GetXaxis()->GetBinLowEdge(ilo);
82  double hi = fHisto->GetXaxis()->GetBinUpEdge(ihi);
83 
84  if (fTorQ==kTPAD) {
85  if ((ilo==ilotlast) && (ihi==ihitlast)) return;
86  ilotlast = ilo;
87  ihitlast = ihi;
89  switch (drawopt->fWhichHits) {
91  colors->Scale("RawT").SetBounds(lo, hi);
92  break;
94  colors->Scale("CawT").SetBounds(lo, hi);
95  break;
96  default: break;
97  }
98 
99  ilotlast = ilo;
100  ihitlast = ihi;
101  }
102 
103  if (fTorQ == kQPAD) {
104  if ((ilo==iloqlast) && (ihi==ihiqlast)) return;
105  /** \todo what to do with colors when axis zooms?
106  switch (drawopt->fWhichHits) {
107  case evd::RawDrawingOptions::kRAW_HITS:
108  ColorScaleTable::MakeRawQ(lo, hi);
109  break;
110  case evd::RawDrawingOptions::kCAL_HITS:
111  ColorScaleTable::MakeCalQ(lo, hi);
112  break;
113  default: break;
114  }
115  */
116  iloqlast = ilo;
117  ihiqlast = ihi;
118  }
119  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
int colors[6]
Definition: tools.h:1
void SetBounds(double xlo, double xhi)
Definition: ColorScale.h:57
static const int kCAL_HITS
ColorScale & Scale(const std::string &nm)
static const int kTPAD
Definition: TQPad.cxx:30
TH1F * fHisto
1-D Histogram of time or charge
Definition: TQPad.h:31
int fTorQ
0 = plot shows time, 1 = plot shows charge
Definition: TQPad.h:30
static const int kRAW_HITS
static const int kQPAD
Definition: TQPad.cxx:31
RawDataDrawer * evd::DrawingPad::RawDataDraw ( )
inherited

Provide access to the drawer for the RawData classes

Definition at line 91 of file DrawingPad.cxx.

References evd::DrawingPad::fRawDataDraw.

Referenced by evd::TZProjPad::AutoZoom(), Draw(), evd::HardwarePad::Draw(), evd::Display3DPad::Draw(), evd::TZProjPad::Draw(), and evd::DrawingPad::Pad().

92  {
93  if (fRawDataDraw==0) fRawDataDraw = new RawDataDrawer();
94  return fRawDataDraw;
95  }
RawDataDrawer * fRawDataDraw
Drawer for raw data.
Definition: DrawingPad.h:41
RecoBaseDrawer * evd::DrawingPad::RecoBaseDraw ( )
inherited

Provide access to the drawer for RecoBase classes

Definition at line 101 of file DrawingPad.cxx.

References evd::DrawingPad::fRecoBaseDraw.

Referenced by Draw(), evd::Display3DPad::Draw(), evd::TZProjPad::Draw(), and evd::DrawingPad::Pad().

102  {
103  if (fRecoBaseDraw==0) fRecoBaseDraw = new RecoBaseDrawer();
104  return fRecoBaseDraw;
105  }
RecoBaseDrawer * fRecoBaseDraw
Drawer for recobase objects.
Definition: DrawingPad.h:42
SimulationDrawer * evd::DrawingPad::SimulationDraw ( )
inherited

Provide access to the drawer for the Simulation classes

Definition at line 82 of file DrawingPad.cxx.

References evd::DrawingPad::fSimulationDraw.

Referenced by evd::TZProjPad::AutoZoomTruth(), evd::MCBriefPad::Draw(), Draw(), evd::Display3DPad::Draw(), evd::TZProjPad::Draw(), and evd::DrawingPad::Pad().

83  {
84  if (fSimulationDraw==0) fSimulationDraw = new SimulationDrawer();
85  return fSimulationDraw;
86  }
SimulationDrawer * fSimulationDraw
Drawer for simulation objects.
Definition: DrawingPad.h:40

Member Data Documentation

GeometryDrawer* evd::DrawingPad::fGeometryDraw
protectedinherited

Drawer for detector geometry.

Definition at line 39 of file DrawingPad.h.

Referenced by evd::DrawingPad::GeometryDraw(), and evd::DrawingPad::~DrawingPad().

HeaderDrawer* evd::DrawingPad::fHeaderDraw
protectedinherited

Drawer for event header info.

Definition at line 38 of file DrawingPad.h.

Referenced by evd::DrawingPad::HeaderDraw(), and evd::DrawingPad::~DrawingPad().

TH1F* evd::TQPad::fHisto
private

1-D Histogram of time or charge

Definition at line 31 of file TQPad.h.

Referenced by BookHistogram(), Draw(), RangeChanged(), and ~TQPad().

TPad* evd::DrawingPad::fPad
protectedinherited
RawDataDrawer* evd::DrawingPad::fRawDataDraw
protectedinherited

Drawer for raw data.

Definition at line 41 of file DrawingPad.h.

Referenced by evd::DrawingPad::RawDataDraw(), and evd::DrawingPad::~DrawingPad().

RecoBaseDrawer* evd::DrawingPad::fRecoBaseDraw
protectedinherited

Drawer for recobase objects.

Definition at line 42 of file DrawingPad.h.

Referenced by evd::DrawingPad::RecoBaseDraw(), and evd::DrawingPad::~DrawingPad().

SimulationDrawer* evd::DrawingPad::fSimulationDraw
protectedinherited

Drawer for simulation objects.

Definition at line 40 of file DrawingPad.h.

Referenced by evd::DrawingPad::SimulationDraw(), and evd::DrawingPad::~DrawingPad().

int evd::TQPad::fTorQ
private

0 = plot shows time, 1 = plot shows charge

Definition at line 30 of file TQPad.h.

Referenced by BookHistogram(), Draw(), RangeChanged(), and TQPad().

evdb::View2D* evd::TQPad::fView
private

Superimpose scale on 1D histo.

Definition at line 32 of file TQPad.h.

Referenced by Draw(), TQPad(), and ~TQPad().


The documentation for this class was generated from the following files: