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

A drawing pad for an XZ or ZY. More...

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

Inheritance diagram for evd::TZProjPad:
evd::DrawingPad

Public Member Functions

 TZProjPad (const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
 
 ~TZProjPad ()
 
void Draw (const char *opt=0, bool *rezoom=0)
 
void GetWrange (int *i1, int *i2) const
 
void GetZrange (int *i1, int *i2) const
 
void GetWrangeCm (float *i1, float *i2) const
 
void GetZrangeCm (float *i1, float *i2) const
 
void GetZBoundCm (float *i1, float *i2) const
 
void GetWBoundCm (float *i1, float *i2) const
 
void SetZrange (int i1, int i2)
 
void SetWrange (int i1, int i2)
 
void SetZrangeCm (float i1, float i2)
 
void SetWrangeCm (float i1, float i2)
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
GeometryDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 

Public Attributes

unsigned int fLastRun
 Last run number shown. More...
 
unsigned int fLastEvt
 Last event number shown. More...
 
int fLastSlice
 Last slice number shown. More...
 
int fLastZoom
 Last zoom option applied. More...
 
int fDetId
 Detector display is configured for. More...
 
int fXorY
 Which view? 0 = X vs. Z, 1 = Y vs. Z. More...
 
TH2F * fHisto
 Histogram to draw objects on. More...
 
evdb::View2DfView
 Collection of graphics objects to render. More...
 

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 AutoZoom ()
 
void AutoZoomTruth (const art::Event *evt)
 
void AutoZoomSlice (const art::Event *evt)
 
void AutoZoomBox (const art::Event *evt)
 
void AutoZoomHelper (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double safety)
 
void ShowFull ()
 
void ShowPartial ()
 
void LayoutHisto ()
 

Detailed Description

A drawing pad for an XZ or ZY.

Definition at line 32 of file TZProjPad.h.

Constructor & Destructor Documentation

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

Create a pad showing a single X-Z or Y-Z projection of the detector

Parameters
nm: Name of the pad
ti: Title of the pad
x1: Location of left edge of pad (0-1)
x2: Location of right edge of pad (0-1)
y1: Location of bottom edge of pad (0-1)
y2: Location of top edge of pad (0-1)
opt: Options. Include 'x', 'y' for xz or yz projections

Definition at line 66 of file TZProjPad.cxx.

References geo::GeometryBase::DetId(), fDetId, fHisto, fView, fXorY, evd::kX, evd::kY, LayoutHisto(), evd::DrawingPad::Pad(), and string.

70  :
71  DrawingPad(nm, ti, x1, x2, y1, y2),
72  fLastRun(999999),
73  fLastEvt(999999),
74  fLastSlice(999999),
75  fLastZoom(999999)
76  {
77 
79 
80  fDetId = geo->DetId();
81 
82  this->Pad()->SetBit(TPad::kCannotMove);
83  this->Pad()->cd();
84 
85  if (std::string(opt)=="x") fXorY = kX;
86  if (std::string(opt)=="y") fXorY = kY;
87  if (fXorY==kX) {
88  this->Pad()->SetLeftMargin (0.050);
89  this->Pad()->SetRightMargin (0.010);
90  this->Pad()->SetTopMargin (0.110);
91  this->Pad()->SetBottomMargin(0.005);
92  }
93  if (fXorY==kY) {
94  this->Pad()->SetLeftMargin (0.050);
95  this->Pad()->SetRightMargin (0.010);
96  this->Pad()->SetTopMargin (0.005);
97  this->Pad()->SetBottomMargin(0.120);
98  }
99 
100  fHisto = 0; // Force function to create us a new histogram
101  this->LayoutHisto();
102 
103  fView = new evdb::View2D();
104  }
void LayoutHisto()
Definition: TZProjPad.cxx:436
Float_t y1[n_points_granero]
Definition: compare.C:5
unsigned int fLastRun
Last run number shown.
Definition: TZProjPad.h:67
Float_t x1[n_points_granero]
Definition: compare.C:5
static constexpr Double_t nm
Definition: Munits.h:133
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
TPad * Pad()
Definition: DrawingPad.h:27
unsigned int fLastEvt
Last event number shown.
Definition: TZProjPad.h:68
static const int kX
Definition: TZProjPad.cxx:50
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
int fLastSlice
Last slice number shown.
Definition: TZProjPad.h:69
static const int kY
Definition: TZProjPad.cxx:51
int fLastZoom
Last zoom option applied.
Definition: TZProjPad.h:70
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TZProjPad.h:74
Helper for AttenCurve.
Definition: Path.h:10
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:34
int fDetId
Detector display is configured for.
Definition: TZProjPad.h:71
enum BeamMode string
evd::TZProjPad::~TZProjPad ( )

Definition at line 108 of file TZProjPad.cxx.

References fHisto, and fView.

109  {
110  if (fHisto) { delete fHisto; fHisto = 0; }
111  if (fView) { delete fView; fView = 0; }
112  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TZProjPad.h:74

Member Function Documentation

void evd::TZProjPad::AutoZoom ( )
private

Automatically zoom the view to a size just larger than the events. Also ensures that the aspect ratio is the same for the XZ and YZ projections.

Definition at line 224 of file TZProjPad.cxx.

References AutoZoomHelper(), evd::RawDataDrawer::GetLimits(), evd::DrawingPad::RawDataDraw(), xmax, make_mec_shifts_plots::xmin, ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

225  {
226  double xmin, ymin, zmin;
227  double xmax, ymax, zmax;
228  this->RawDataDraw()->GetLimits(&xmin, &xmax,
229  &ymin, &ymax,
230  &zmin, &zmax);
231 
232  AutoZoomHelper(xmin, xmax, ymin, ymax, zmin, zmax, .1);
233  }
std::map< std::string, double > xmax
void GetLimits(double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
void AutoZoomHelper(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double safety)
Definition: TZProjPad.cxx:288
Double_t ymax
Definition: plot.C:25
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:91
Double_t ymin
Definition: plot.C:24
void evd::TZProjPad::AutoZoomBox ( const art::Event evt)
private

Definition at line 273 of file TZProjPad.cxx.

References ana::assert(), AutoZoomHelper(), evd::SliceNavigator::GetBox(), xmax, make_mec_shifts_plots::xmin, ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

274  {
275  assert(evt);
276 
278  double xmin, xmax, ymin, ymax, zmin, zmax;
279  // Drop 10% of outlier hits from each axis
280  nav->GetBox(*evt, xmin, xmax, ymin, ymax, zmin, zmax, .1);
281 
282  // But then add in 20% of padding to compensate
283  AutoZoomHelper(xmin, xmax, ymin, ymax, zmin, zmax, .2);
284  }
std::map< std::string, double > xmax
void GetBox(const art::Event &evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, double trimfrac=0)
void AutoZoomHelper(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double safety)
Definition: TZProjPad.cxx:288
Double_t ymax
Definition: plot.C:25
assert(nhit_max >=nhit_nbins)
Double_t ymin
Definition: plot.C:24
void evd::TZProjPad::AutoZoomHelper ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax,
double  safety 
)
private

Definition at line 288 of file TZProjPad.cxx.

References dz, fHisto, fXorY, std::max(), xmax, and ymax.

Referenced by AutoZoom(), AutoZoomBox(), AutoZoomSlice(), and AutoZoomTruth().

291  {
292  const double dxy = std::max(xmax-xmin, ymax-ymin);
293  const double dz = zmax-zmin;
294 
295  const double xavg = (xmin+xmax)/2;
296  const double yavg = (ymin+ymax)/2;
297 
298  xmin = xavg-(.5+safety)*dxy;
299  xmax = xavg+(.5+safety)*dxy;
300  ymin = yavg-(.5+safety)*dxy;
301  ymax = yavg+(.5+safety)*dxy;
302  zmin -= safety*dz;
303  zmax += safety*dz;
304 
305  fHisto->GetXaxis()->SetRangeUser(zmin, zmax);
306  if(fXorY == kX) fHisto->GetYaxis()->SetRangeUser(xmin, xmax);
307  else fHisto->GetYaxis()->SetRangeUser(ymin, ymax);
308  }
T max(const caf::Proxy< T > &a, T b)
std::map< std::string, double > xmax
Double_t ymax
Definition: plot.C:25
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
double dz[NP][NC]
static const int kX
Definition: TZProjPad.cxx:50
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
Double_t ymin
Definition: plot.C:24
void evd::TZProjPad::AutoZoomSlice ( const art::Event evt)
private

Definition at line 260 of file TZProjPad.cxx.

References ana::assert(), AutoZoomHelper(), evd::SliceNavigator::GetBounds(), xmax, make_mec_shifts_plots::xmin, ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

261  {
262  assert(evt);
263 
265  double xmin, xmax, ymin, ymax, zmin, zmax;
266  // Drop 10% of outlier hits from each axis
267  nav->GetBounds(*evt, xmin, xmax, ymin, ymax, zmin, zmax, .1);
268 
269  // But then add in 20% of padding to compensate
270  AutoZoomHelper(xmin, xmax, ymin, ymax, zmin, zmax, .2);
271  }
std::map< std::string, double > xmax
void GetBounds(const art::Event &evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, double trimfrac=0)
void AutoZoomHelper(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double safety)
Definition: TZProjPad.cxx:288
Double_t ymax
Definition: plot.C:25
assert(nhit_max >=nhit_nbins)
Double_t ymin
Definition: plot.C:24
void evd::TZProjPad::AutoZoomTruth ( const art::Event evt)
private

Definition at line 237 of file TZProjPad.cxx.

References ana::assert(), AutoZoomHelper(), rb::CellHit::Cell(), evd::SimulationDrawer::GetLimits(), art::DataViewImpl::getManyByType(), MECModelEnuComparisons::i, calib::j, rb::CellHit::Plane(), evd::DrawingPad::SimulationDraw(), xmax, make_mec_shifts_plots::xmin, ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

238  {
239  assert(evt);
240 
241  std::vector<art::Handle<std::vector<rb::CellHit>>> chits;
242  evt->getManyByType(chits);
243 
244  std::set<geo::OfflineChan> hmap;
245  for(unsigned int i = 0; i < chits.size(); ++i){
246  for(unsigned int j = 0; j < chits[i]->size(); ++j){
247  const art::Ptr<rb::CellHit> chit(chits[i], j);
248  hmap.insert(geo::OfflineChan(chit->Plane(), chit->Cell()));
249  }
250  }
251 
252  double xmin, xmax, ymin, ymax, zmin, zmax;
253  SimulationDraw()->GetLimits(evt, xmin, xmax, ymin, ymax, zmin, zmax, hmap);
254 
255  AutoZoomHelper(xmin, xmax, ymin, ymax, zmin, zmax, .05);
256  }
std::map< std::string, double > xmax
void AutoZoomHelper(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double safety)
Definition: TZProjPad.cxx:288
Double_t ymax
Definition: plot.C:25
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
const double j
Definition: BetheBloch.cxx:29
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:82
void GetLimits(const art::Event *evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, const std::set< geo::OfflineChan > &hmap={})
A (plane, cell) pair.
Definition: OfflineChan.h:17
assert(nhit_max >=nhit_nbins)
Double_t ymin
Definition: plot.C:24
void evd::TZProjPad::Draw ( const char *  opt = 0,
bool *  rezoom = 0 
)

Definition at line 116 of file TZProjPad.cxx.

References AutoZoom(), AutoZoomBox(), AutoZoomSlice(), AutoZoomTruth(), evdb::View2D::Clear(), evdb::View2D::Draw(), art::EventID::event(), evt, fHisto, fLastEvt, fLastRun, fLastSlice, fLastZoom, evd::SimulationDrawer::FLSHit2D(), evd::GeometryDrawingOptions::fOutline, evd::DrawingPad::fPad, fView, fXorY, evd::GeometryDrawingOptions::fZoom, evd::DrawingPad::GeometryDraw(), evdb::EventHolder::GetEvent(), galleryMaker::grid, art::Event::id(), evdb::EventHolder::Instance(), evd::GeometryDrawingOptions::kOUTLINE_GRID, evd::GeometryDrawingOptions::kZOOM_HITS, evd::GeometryDrawingOptions::kZOOM_PARTIAL, evd::GeometryDrawingOptions::kZOOM_SLICE, evd::GeometryDrawingOptions::kZOOM_SLICEBOX, evd::GeometryDrawingOptions::kZOOM_TRUTH, LayoutHisto(), evd::SimulationDrawer::MCTruthTrajectories2D(), evd::SimulationDrawer::MCTruthVectors2D(), evd::SimulationDrawer::MCTruthVertices2D(), evd::DrawingPad::RawDataDraw(), evd::DrawingPad::RecoBaseDraw(), art::Event::run(), ShowFull(), ShowPartial(), evd::DrawingPad::SimulationDraw(), and APDHVSetting::temp.

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

117  {
118  bool temp;
119  if(!rezoom) rezoom = &temp;
120 
121  fView->Clear();
122 
123  evdb::View2D* vx = 0;
124  evdb::View2D* vy = 0;
125  if (fXorY==kX) vx = fView; // fView is an XZ projection
126  if (fXorY==kY) vy = fView; // fView is a YZ projection
127 
128  // grab the singleton holding the art::Event
130  this->LayoutHisto();
131 
132  if (evt) {
133  this->GeometryDraw()-> DetOutline2D (*evt, vx, vy);
134  this->GeometryDraw()-> DrawCells2D (*evt, vx, vy);
135  this->GeometryDraw()-> DrawDCMBoxes (*evt, vx, vy);
136  this->GeometryDraw()-> FiducialVolumeUser2D (*evt, vx, vy);
137  this->GeometryDraw()-> DrawBadBoxesPretty (*evt, vx, vy); // nice looking badboxes but not quite exact
138  // this->GeometryDraw()-> DrawBadBoxesExact (*evt, vx, vy); // switch in to see exactly where the bad boxes are
139  this->SimulationDraw()->FLSHit2D (*evt, vx, vy);
140  this->SimulationDraw()->MCTruthVertices2D (*evt, vx, vy);
141  this->SimulationDraw()->MCTruthVectors2D (*evt, vx, vy);
142  this->SimulationDraw()->MCTruthTrajectories2D(*evt, vx, vy);
143  this->RawDataDraw()-> RawDigit2D (*evt, vx, vy);
144  this->RecoBaseDraw()-> CellHit2D (*evt, vx, vy);
145  this->GeometryDraw()-> DrawHighlightCell (*evt, vx, vy);
146  this->RecoBaseDraw()-> Cluster2D (*evt, vx, vy);
147  this->RecoBaseDraw()-> OfflineChans2D (*evt, vx, vy);
148  this->RecoBaseDraw()-> HoughResult2D (*evt, vx, vy);
149  this->RecoBaseDraw()-> Prong2D (*evt, vx, vy);
150  this->RecoBaseDraw()-> Track2D (*evt, vx, vy);
151  this->RecoBaseDraw()-> Vertex2D (*evt, vx, vy);
152  }
153 
156  fPad->cd();
157  fPad->Clear();
158 
159  int grid = ((drawopt->fOutline &
161  fPad->SetGridx(grid);
162  fPad->SetGridy(grid);
163 
164  this->LayoutHisto();
165  if (!fHisto) return;
166 
167  if (fXorY==kX) fHisto->Draw("X+");
168  else fHisto->Draw("");
169 
170  // Check if we should zoom the displays
171  *rezoom = false;
172  if(evt){
173  if (fLastRun != evt->run()) *rezoom = true;
174  if (fLastEvt != evt->id().event()) *rezoom = true;
175  if (fLastSlice != nav->CurrentSlice()) *rezoom = true;
176  }
177  if (fLastZoom != drawopt->fZoom) *rezoom = true;
179  int(fLastSlice) != nav->CurrentSlice())
180  *rezoom = true;
181 
182  if (*rezoom) {
183  switch (drawopt->fZoom) {
185  if (evt) AutoZoomTruth(evt);
186  break;
188  if (evt) AutoZoomSlice(evt);
189  break;
191  AutoZoom();
192  break;
194  ShowPartial();
195  break;
197  AutoZoomBox(evt);
198  break;
199  default:
200  ShowFull();
201  }
202  }
203 
204  if(evt){
205  fLastRun = evt->run();
206  fLastEvt = evt->id().event();
207  }
208  fLastSlice = nav->CurrentSlice();
209  fLastZoom = drawopt->fZoom;
210 
211  fView->Draw();
212  // Axes can get overdrawn by pad objects
213  // This somehow causes an infinite loop in the FD, comment out for now.
214  // fHisto->Draw("axis same");
215  }
void LayoutHisto()
Definition: TZProjPad.cxx:436
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
void FLSHit2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
unsigned int fLastRun
Last run number shown.
Definition: TZProjPad.h:67
GeometryDrawer * GeometryDraw()
Definition: DrawingPad.cxx:73
void AutoZoomSlice(const art::Event *evt)
Definition: TZProjPad.cxx:260
void ShowPartial()
Definition: TZProjPad.cxx:312
void MCTruthVectors2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
void Clear()
Definition: View2D.cxx:109
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
void MCTruthTrajectories2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:91
void Draw()
Definition: View2D.cxx:89
static EventHolder * Instance()
Definition: EventHolder.cxx:15
int evt
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:101
int fZoom
How to zoom the display.
void MCTruthVertices2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:82
unsigned int fLastEvt
Last event number shown.
Definition: TZProjPad.h:68
static const int kX
Definition: TZProjPad.cxx:50
EventNumber_t event() const
Definition: EventID.h:116
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
int fLastSlice
Last slice number shown.
Definition: TZProjPad.h:69
void AutoZoomTruth(const art::Event *evt)
Definition: TZProjPad.cxx:237
static const int kY
Definition: TZProjPad.cxx:51
int fLastZoom
Last zoom option applied.
Definition: TZProjPad.h:70
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:37
evdb::View2D * fView
Collection of graphics objects to render.
Definition: TZProjPad.h:74
RunNumber_t run() const
Definition: Event.h:77
EventID id() const
Definition: Event.h:56
void AutoZoomBox(const art::Event *evt)
Definition: TZProjPad.cxx:273
int fOutline
Which outlines to draw.
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(), 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
void evd::TZProjPad::GetWBoundCm ( float *  i1,
float *  i2 
) const

Definition at line 396 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

397  {
398  TAxis *axis = fHisto->GetYaxis();
399  *i1 = axis->GetXmin();
400  *i2 = axis->GetXmax();
401  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::GetWrange ( int i1,
int i2 
) const

Definition at line 354 of file TZProjPad.cxx.

References fHisto.

355  {
356  *i1 = fHisto->GetYaxis()->GetFirst();
357  *i2 = fHisto->GetYaxis()->GetLast();
358  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::GetWrangeCm ( float *  i1,
float *  i2 
) const

Definition at line 369 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

370  {
371  TAxis *axis = fHisto->GetYaxis();
372  *i1 = axis->GetBinCenter( axis->GetFirst() );
373  *i2 = axis->GetBinCenter( axis->GetLast() );
374  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::GetZBoundCm ( float *  i1,
float *  i2 
) const

Definition at line 387 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

388  {
389  TAxis *axis = fHisto->GetXaxis();
390  *i1 = axis->GetXmin();
391  *i2 = axis->GetXmax();
392  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::GetZrange ( int i1,
int i2 
) const

Definition at line 362 of file TZProjPad.cxx.

References fHisto.

Referenced by evd::XZYZProjectionsView::RangeChanged().

363  {
364  *i1 = fHisto->GetXaxis()->GetFirst();
365  *i2 = fHisto->GetXaxis()->GetLast();
366  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::GetZrangeCm ( float *  i1,
float *  i2 
) const

Definition at line 378 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

379  {
380  TAxis *axis = fHisto->GetXaxis();
381  *i1 = axis->GetBinCenter( axis->GetFirst() );
382  *i2 = axis->GetBinCenter( axis->GetLast() );
383  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
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
void evd::TZProjPad::LayoutHisto ( )
private

Definition at line 436 of file TZProjPad.cxx.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetId(), geo::GeometryBase::DetLength(), fDetId, evd::GeometryDrawingOptions::fFlip, fHisto, evd::GeometryDrawingOptions::fLabel, fXorY, evd::GeometryDrawingOptions::kFLIP_X, evd::GeometryDrawingOptions::kFLIP_Z, evd::GeometryDrawingOptions::kLABEL_COMPASS, novadaq::cnv::kUNKNOWN_DET, evd::kZsf, and evd::GeoTransform::Z().

Referenced by Draw(), and TZProjPad().

437  {
438  //
439  // Check if the current layout is correct. That is, we have a
440  // histogram and the detector ID matches the detector ID for the
441  // current geometry.
442  //
444  if (fHisto && geo->DetId() == fDetId) return;
445  fDetId = geo->DetId();
446 
447  if (geo->DetId() == novadaq::cnv::kUNKNOWN_DET) return;
448 
449  //
450  // Figure out the z range for axis. The z-range may optionally run
451  // from north to south or from south to north.
452  //
453  double zlo = -(kZsf-1.0)*geo->DetLength();
454  double zhi = (kZsf )*geo->DetLength();
455  GeoTransform::Z(&zlo);
456  GeoTransform::Z(&zhi);
457  if (zlo>zhi) { double ztmp = zlo; zlo = zhi; zhi = ztmp; }
458 
459  //
460  // Figure out how to label the axes. We may be asked to label
461  // compass directions and have to account for axis flips
462  //
464  bool flipx = geoopt->fFlip & evd::GeometryDrawingOptions::kFLIP_X;
465  bool flipz = geoopt->fFlip & evd::GeometryDrawingOptions::kFLIP_Z;
466  const char* xlabel = ";;x (cm)";
467  const char* ylabel = ";z (cm);y (cm)";
469  if (flipx) xlabel = ";;#leftarrow west x (cm) east #rightarrow";
470  else xlabel = ";;#leftarrow east x (cm) west #rightarrow";
471  if (flipz) ylabel = ";#leftarrow north z (cm) south #rightarrow;y (cm)";
472  else ylabel = ";#leftarrow south z (cm) north #rightarrow;y (cm)";
473  }
474 
475  delete fHisto; fHisto = 0;
476  if (fXorY == kX){
477  fHisto = new THUnZoomable("fTZXHisto",
478  xlabel,
479  2000,
480  zlo,
481  zhi,
482  1000,
483  -kTsf*geo->DetHalfWidth(),
484  +kTsf*geo->DetHalfWidth());
485  }
486  if (fXorY == kY){
487  fHisto = new THUnZoomable("fTZYHisto",
488  ylabel,
489  2000,
490  zlo,
491  zhi,
492  1000,
493  -kTsf*geo->DetHalfHeight(),
494  +kTsf*geo->DetHalfHeight());
495  }
496 
497  fHisto->GetYaxis()->CenterTitle();
498  fHisto->GetYaxis()->SetNdivisions(505);
499  fHisto->SetTitleOffset(0.5, "Y");
500 
501  fHisto->GetXaxis()->SetNoExponent();
502  }
static const double kTsf
Definition: TZProjPad.cxx:54
int fLabel
Which labels to draw?
static const double kZsf
Definition: TZProjPad.cxx:53
double DetLength() const
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
double DetHalfHeight() const
static const int kX
Definition: TZProjPad.cxx:50
double DetHalfWidth() const
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
static void Z(double *z)
static const int kY
Definition: TZProjPad.cxx:51
Helper for AttenCurve.
Definition: Path.h:10
int fFlip
Reverse the sense of any of the coordinate axes?
int fDetId
Detector display is configured for.
Definition: TZProjPad.h:71
TPad* evd::DrawingPad::Pad ( )
inlineinherited
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 AutoZoom(), evd::TQPad::Draw(), evd::HardwarePad::Draw(), evd::Display3DPad::Draw(), 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 evd::TQPad::Draw(), evd::Display3DPad::Draw(), 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
void evd::TZProjPad::SetWrange ( int  i1,
int  i2 
)

Definition at line 421 of file TZProjPad.cxx.

References fHisto.

422  {
423  fHisto->GetYaxis()->SetRange(i1,i2);
424  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::SetWrangeCm ( float  i1,
float  i2 
)

Definition at line 428 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

429  {
430  TAxis *axis = fHisto->GetYaxis();
431  axis->SetRange( axis->FindBin(i1) , axis->FindBin(i2) );
432  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::SetZrange ( int  i1,
int  i2 
)

Definition at line 406 of file TZProjPad.cxx.

References fHisto.

Referenced by evd::XZYZProjectionsView::RangeChanged().

407  {
408  fHisto->GetXaxis()->SetRange(i1,i2);
409  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::SetZrangeCm ( float  i1,
float  i2 
)

Definition at line 413 of file TZProjPad.cxx.

References allInOneTrainingPlots::axis, and fHisto.

Referenced by evd::XZYZProjectionsView::FixAspectRatio().

414  {
415  TAxis *axis = fHisto->GetXaxis();
416  axis->SetRange( axis->FindBin(i1) , axis->FindBin(i2) );
417  }
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
void evd::TZProjPad::ShowFull ( )
private

Definition at line 334 of file TZProjPad.cxx.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), fHisto, fXorY, MECModelEnuComparisons::g, evd::kZsf, xmax, make_mec_shifts_plots::xmin, evd::GeoTransform::XYZ(), ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

335  {
337 
338  double xmin = -kTsf*g->DetHalfWidth();
339  double xmax = +kTsf*g->DetHalfWidth();
340  double ymin = -kTsf*g->DetHalfHeight();
341  double ymax = +kTsf*g->DetHalfHeight();
342  double zmin = -(kZsf-1.0)*g->DetLength();
343  double zmax = +(kZsf )*g->DetLength();
344 
345  GeoTransform::XYZ(&xmin, &ymin, &zmin);
346  GeoTransform::XYZ(&xmax, &ymax, &zmax);
347 
348  fHisto->GetXaxis()->SetRangeUser(zmin,zmax);
349  if (fXorY==kX) fHisto->GetYaxis()->SetRangeUser(xmin,xmax);
350  else fHisto->GetYaxis()->SetRangeUser(ymin,ymax);
351  }
static const double kTsf
Definition: TZProjPad.cxx:54
std::map< std::string, double > xmax
static const double kZsf
Definition: TZProjPad.cxx:53
double DetLength() const
Double_t ymax
Definition: plot.C:25
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
double DetHalfHeight() const
static const int kX
Definition: TZProjPad.cxx:50
double DetHalfWidth() const
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
Double_t ymin
Definition: plot.C:24
static void XYZ(double *xyz)
void evd::TZProjPad::ShowPartial ( )
private

Definition at line 312 of file TZProjPad.cxx.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), fHisto, fXorY, evd::GeometryDrawingOptions::fZRange, MECModelEnuComparisons::g, evd::kZsf, xmax, make_mec_shifts_plots::xmin, evd::GeoTransform::XYZ(), ymax, ymin, and make_true_q0q3_plots::zmax.

Referenced by Draw().

313  {
316 
317  double xmin = -kTsf*g->DetHalfWidth();
318  double xmax = +kTsf*g->DetHalfWidth();
319  double ymin = -kTsf*g->DetHalfHeight();
320  double ymax = +kTsf*g->DetHalfHeight();
321  double zmin = -(kZsf-1.0)*g->DetLength();
322  double zmax = +(kZsf )* drawopt->fZRange;
323 
324  GeoTransform::XYZ(&xmin, &ymin, &zmin);
325  GeoTransform::XYZ(&xmax, &ymax, &zmax);
326 
327  fHisto->GetXaxis()->SetRangeUser(zmin,zmax);
328  if (fXorY==kX) fHisto->GetYaxis()->SetRangeUser(xmin,xmax);
329  else fHisto->GetYaxis()->SetRangeUser(ymin,ymax);
330  }
static const double kTsf
Definition: TZProjPad.cxx:54
std::map< std::string, double > xmax
static const double kZsf
Definition: TZProjPad.cxx:53
double DetLength() const
Double_t ymax
Definition: plot.C:25
int fXorY
Which view? 0 = X vs. Z, 1 = Y vs. Z.
Definition: TZProjPad.h:72
double DetHalfHeight() const
static const int kX
Definition: TZProjPad.cxx:50
double DetHalfWidth() const
TH2F * fHisto
Histogram to draw objects on.
Definition: TZProjPad.h:73
Double_t ymin
Definition: plot.C:24
static void XYZ(double *xyz)
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 AutoZoomTruth(), evd::MCBriefPad::Draw(), evd::TQPad::Draw(), evd::Display3DPad::Draw(), 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

int evd::TZProjPad::fDetId

Detector display is configured for.

Definition at line 71 of file TZProjPad.h.

Referenced by LayoutHisto(), and TZProjPad().

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().

TH2F* evd::TZProjPad::fHisto
unsigned int evd::TZProjPad::fLastEvt

Last event number shown.

Definition at line 68 of file TZProjPad.h.

Referenced by Draw().

unsigned int evd::TZProjPad::fLastRun

Last run number shown.

Definition at line 67 of file TZProjPad.h.

Referenced by Draw().

int evd::TZProjPad::fLastSlice

Last slice number shown.

Definition at line 69 of file TZProjPad.h.

Referenced by Draw().

int evd::TZProjPad::fLastZoom

Last zoom option applied.

Definition at line 70 of file TZProjPad.h.

Referenced by Draw().

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().

evdb::View2D* evd::TZProjPad::fView

Collection of graphics objects to render.

Definition at line 74 of file TZProjPad.h.

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

int evd::TZProjPad::fXorY

Which view? 0 = X vs. Z, 1 = Y vs. Z.

Definition at line 72 of file TZProjPad.h.

Referenced by AutoZoomHelper(), Draw(), LayoutHisto(), ShowFull(), ShowPartial(), and TZProjPad().


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