Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

evd::TZProjPad Class Reference

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

#include <TZProjPad.h>

Inheritance diagram for evd::TZProjPad:

evd::DrawingPad List of all members.

Public Member Functions

 TZProjPad (const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
 ~TZProjPad ()
void Draw ()

Private Member Functions

void AutoZoom ()

Private Attributes

int fXorY
 0 = X vs. Z, 1 = Y vs. Z
TH2F * fHisto
 Histogram to draw object on.
evdb::View2DfView
 Collection of graphics objects to render.

Detailed Description

A drawing pad for an XZ or ZY.

Definition at line 18 of file TZProjPad.h.


Constructor & Destructor Documentation

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 31 of file TZProjPad.cxx.

References geo::Geometry::DetHalfHeight(), geo::Geometry::DetHalfWidth(), geo::Geometry::DetLength(), fHisto, fView, fXorY, evd::DrawingPad::Geometry(), and evd::DrawingPad::Pad().

00035                                       :
00036   DrawingPad(nm, ti, x1, x2, y1, y2)
00037 {
00038   this->Pad()->cd();
00039 
00040   if (std::string(opt)=="x") fXorY = kX;
00041   if (std::string(opt)=="y") fXorY = kY;
00042   if (fXorY==kX) {
00043     this->Pad()->SetLeftMargin  (0.050);
00044     this->Pad()->SetRightMargin (0.010);
00045     this->Pad()->SetTopMargin   (0.110);
00046     this->Pad()->SetBottomMargin(0.005);
00047     fHisto = new TH2F("fTZXHisto",";z (cm); x (cm)",
00048                       140, 
00049                       -0.05*this->Geometry().DetLength()-200.0,
00050                       +1.05*this->Geometry().DetLength(),
00051                       64,
00052                       -1.05*this->Geometry().DetHalfWidth(),
00053                       +1.05*this->Geometry().DetHalfWidth());
00054     fHisto->SetTitleOffset(0.5,"Y");
00055     fHisto->Draw("AB");
00056   }
00057   if (fXorY==kY) {
00058     this->Pad()->SetLeftMargin  (0.050);
00059     this->Pad()->SetRightMargin (0.010);
00060     this->Pad()->SetTopMargin   (0.005);
00061     this->Pad()->SetBottomMargin(0.120);
00062     fHisto = new TH2F("fTZYHisto",";z (cm); y (cm)",
00063                       140, 
00064                       -0.05*this->Geometry().DetLength()-200.0,
00065                       +1.05*this->Geometry().DetLength(),
00066                       64,
00067                       -1.05*this->Geometry().DetHalfHeight(),
00068                       +1.05*this->Geometry().DetHalfHeight());
00069     fHisto->SetTitleOffset(0.5,"Y");
00070     fHisto->Draw("AB");
00071   }
00072   fView = new evdb::View2D();
00073 }

TZProjPad::~TZProjPad  ) 
 

Definition at line 77 of file TZProjPad.cxx.

References fHisto, and fView.

00078 {
00079   if (fHisto) { delete fHisto; fHisto = 0; }
00080   if (fView)  { delete fView;  fView  = 0; }
00081 }


Member Function Documentation

void 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 122 of file TZProjPad.cxx.

References fHisto, fXorY, evd::RawDataDrawer::GetLimits(), and evd::DrawingPad::RawDataDraw().

Referenced by Draw().

00123 {
00124   double xmin, ymin, zmin;
00125   double xmax, ymax, zmax;
00126   this->RawDataDraw()->GetLimits(&xmin, &xmax, 
00127                                  &ymin, &ymax, 
00128                                  &zmin, &zmax);
00129   double dx = xmax-xmin;
00130   double dy = ymax-ymin;
00131   double dz = zmax-zmin;
00132   
00133   if (dx<dy) dx = dy;
00134   else       dy = dx;
00135   xmin = 0.5*(xmin+xmax)-0.6*dx;
00136   xmax = 0.5*(xmin+xmax)+0.6*dx;
00137   ymin = 0.5*(ymin+ymax)-0.6*dy;
00138   ymax = 0.5*(ymin+ymax)+0.6*dy;
00139   zmin -= 0.1*dz;
00140   zmax += 0.1*dz;
00141   
00142   fHisto->GetXaxis()->SetRangeUser(zmin,zmax);
00143   if (fXorY==kX) fHisto->GetYaxis()->SetRangeUser(xmin,xmax);
00144   else           fHisto->GetYaxis()->SetRangeUser(ymin,ymax);
00145 }

void TZProjPad::Draw  ) 
 

Definition at line 85 of file TZProjPad.cxx.

References AutoZoom(), evdb::View2D::Clear(), evdb::View2D::Draw(), evd::DrawingPad::EventHandle(), fHisto, evd::SimulationDrawer::FLSHit2D(), fView, fXorY, evd::DrawingPad::Geometry(), evd::SimulationDrawer::MCTruthVectors2D(), evd::DrawingPad::RawDataDraw(), evd::DrawingPad::RecoBaseDraw(), and evd::DrawingPad::SimulationDraw().

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

00086 {
00087   fView->Clear();
00088   
00089   evdb::View2D* vx = 0;
00090   evdb::View2D* vy = 0;
00091   if (fXorY==kX) vx = fView; // fView is an XZ projection
00092   if (fXorY==kY) vy = fView; // fView is a  YZ projection
00093 
00094   const edm::EventHandle& evd = this->EventHandle();
00095   const geo::Geometry&    geo = this->Geometry();
00096   this->RecoBaseDraw()->  Cluster2D       (evd, geo, vx, vy);
00097   this->SimulationDraw()->MCTruthVectors2D(evd, vx, vy);
00098   this->SimulationDraw()->FLSHit2D        (evd, geo, vx, vy);
00099   this->RawDataDraw()->   RawDigit2D      (evd, "./", geo, vx, vy);
00100   this->RecoBaseDraw()->  CellHit2D       (evd, geo, vx, vy);
00101 
00102   fPad->cd();
00103   fPad->SetGridx();
00104   fPad->SetGridy();
00105   if (fXorY==kX) fHisto->Draw("X+");
00106   else           fHisto->Draw("");
00107 
00108   // Should eventually be a configuration option
00109   int fAutoZoom = 1;
00110   if (fAutoZoom) this->AutoZoom();
00111 
00112   fView->Draw();
00113 }


Member Data Documentation

TH2F* evd::TZProjPad::fHisto [private]
 

Histogram to draw object on.

Definition at line 30 of file TZProjPad.h.

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

evdb::View2D* evd::TZProjPad::fView [private]
 

Collection of graphics objects to render.

Definition at line 31 of file TZProjPad.h.

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

int evd::TZProjPad::fXorY [private]
 

0 = X vs. Z, 1 = Y vs. Z

Definition at line 29 of file TZProjPad.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:45:31 2009 for NOvA Offline by  doxygen 1.3.9.1