HistDisp Class Reference

HistDisp does some simple histogram based displays in a TCanvas. More...

#include <HistDisp.h>

List of all members.

Public Member Functions

 HistDisp (UgliGeomHandle ugh, TPad *pad=0)
 HistDisp (int nubins, double umin, double umax, int nvbins, double vmin, double vmax, int nzbins, double zmin, double zmaz)
 ~HistDisp ()
void FillU (double u, double z, double q, double t=0)
 Fill a U or V strip with charge.
void FillV (double v, double z, double q, double t=0)
void Clear ()
 Clear all histograms.
void Update ()
 Cause canvas to update.
void SetRotation (double deg_polar, double deg_azimuth)
 Set rotation angles (in degrees).
void AutoZoom ()
 Zoom to include a rectangular region bounding non-zero bins.
void Zoom (double umin, double umax, double vmin, double vmax, double zmin, double zmaz)
 Zoom to the given u,v,z bounds.
void Unzoom ()
 Show full detector.

Private Member Functions

void Init ()

Private Attributes

TH2D * fHquz [3]
TH2D * fHqvz [3]
TPad * fPad

Detailed Description

HistDisp does some simple histogram based displays in a TCanvas.

Definition at line 15 of file HistDisp.h.


Constructor & Destructor Documentation

HistDisp::HistDisp ( UgliGeomHandle  ugh,
TPad *  pad = 0 
)

Create a HistDisp. An UgliGeomHandle is needed to find the extents. If no TPad is given a newly created TCanvas is used.

Definition at line 14 of file HistDisp.cxx.

References fHquz, fHqvz, fPad, DataUtil::GetDetectorBinsUV(), DataUtil::GetDetectorBinsZ(), Init(), PlaneView::kU, and PlaneView::kV.

00015 {
00016     int nzbins=0, nwbins=0;
00017     double zmin=0,zmax=0,wmin=0,wmax=0;
00018 
00019     GetDetectorBinsZ(ugh,nzbins,zmin,zmax);
00020     cerr << nzbins << " " << zmin << " " << zmax << endl;
00021 
00022     GetDetectorBinsUV(ugh,PlaneView::kU,nwbins,wmin,wmax);
00023     cerr << nwbins << " " << wmin << " " << wmax << endl;
00024     fHquz[0] = new TH2D("quz","Charge/strip in U vs. Z",
00025                         nzbins,zmin,zmax,nwbins,wmin,wmax);
00026 
00027     GetDetectorBinsUV(ugh,PlaneView::kV,nwbins,wmin,wmax);
00028     cerr << nwbins << " " << wmin << " " << wmax << endl;
00029     fHqvz[0] = new TH2D("qvz","Charge/strip in V vs. Z",
00030                         nzbins,zmin,zmax,nwbins,wmin,wmax);
00031 
00032     if (pad) fPad = pad;
00033     else fPad = new TCanvas("hdc","HistDisp Canvas",800,800);
00034     this->Init();
00035 }

HistDisp::HistDisp ( int  nubins,
double  umin,
double  umax,
int  nvbins,
double  vmin,
double  vmax,
int  nzbins,
double  zmin,
double  zmaz 
)

Definition at line 37 of file HistDisp.cxx.

References fHquz, fHqvz, fPad, and Init().

00040 {
00041     fHquz[0] = new TH2D("quz","Charge in U vs. Z",
00042                         nzbins,zmin,zmax,nubins,umin,umax);
00043     fHquz[0]->SetXTitle("Z (meter)");
00044     fHquz[0]->SetYTitle("U (meter)");
00045     fHquz[0]->SetZTitle("Charge");
00046     fHquz[0]->SetStats(false);
00047 
00048     fHqvz[0] = new TH2D("qvz","Charge in V vs. Z",
00049                         nzbins,zmin,zmax,nvbins,vmin,vmax);
00050     fHqvz[0]->SetXTitle("Z (meter)");
00051     fHqvz[0]->SetYTitle("U (meter)");
00052     fHqvz[0]->SetZTitle("Charge");
00053     fHqvz[0]->SetStats(false);
00054 
00055     fPad = new TCanvas("hdc","HistDisp Canvas",800,800);
00056     this->Init();
00057 }

HistDisp::~HistDisp (  ) 

Definition at line 65 of file HistDisp.cxx.

References fHquz, and fHqvz.

00066 {
00067     if (fHquz[0]) delete fHquz[0]; fHquz[0]=0;
00068     if (fHqvz[0]) delete fHqvz[0]; fHqvz[0]=0;
00069 }


Member Function Documentation

void HistDisp::AutoZoom (  ) 

Zoom to include a rectangular region bounding non-zero bins.

Definition at line 140 of file HistDisp.cxx.

References fHquz, fHqvz, and find_bounds().

Referenced by HistPage::AutoZoom(), and HistPage::Update().

00141 {
00142     int umin=0,umax=0,zumin=0,zumax=0;
00143     find_bounds(fHquz[1],umin,umax,false);
00144     find_bounds(fHquz[1],zumin,zumax,true);
00145 
00146     int vmin=0,vmax=0,zvmin=0,zvmax=0;
00147     find_bounds(fHqvz[1],vmin,vmax,false);
00148     find_bounds(fHqvz[1],zvmin,zvmax,true);
00149 
00150     int zmin=zumin, zmax=zumax;
00151     if (zvmin < zmin) zmin = zvmin;
00152     if (zvmax > zmax) zmax = zvmax;
00153 
00154     for (int ind=1; ind<=2; ++ind) {
00155         fHquz[ind]->GetYaxis()->SetRange(umin,umax);
00156         fHqvz[ind]->GetYaxis()->SetRange(vmin,vmax);
00157 
00158         fHquz[ind]->GetXaxis()->SetRange(zmin,zmax);
00159         fHqvz[ind]->GetXaxis()->SetRange(zmin,zmax);
00160     }
00161         
00162 }

void HistDisp::Clear ( void   ) 

Clear all histograms.

Definition at line 83 of file HistDisp.cxx.

References fHquz, fHqvz, and fPad.

Referenced by HistPage::Clear(), and Init().

00084 {
00085     fPad->cd(1);
00086     fHquz[1] = (TH2D*)fHquz[0]->DrawCopy("lego2");
00087     fPad->cd(2);
00088     fHqvz[1] = (TH2D*)fHqvz[0]->DrawCopy("lego2");
00089     fPad->cd(3);
00090     fHquz[2] = (TH2D*)fHquz[0]->DrawCopy("colz");
00091     fPad->cd(4);
00092     fHqvz[2] = (TH2D*)fHqvz[0]->DrawCopy("colz");
00093 }

void HistDisp::FillU ( double  u,
double  z,
double  q,
double  t = 0 
)

Fill a U or V strip with charge.

Definition at line 72 of file HistDisp.cxx.

References fHquz.

Referenced by HistPage::Update().

00073 {
00074     t=0;                        // unused warning
00075     for (int ind=1;ind<=2; ++ind) fHquz[ind]->Fill(z,u,q);
00076 }

void HistDisp::FillV ( double  v,
double  z,
double  q,
double  t = 0 
)

Definition at line 77 of file HistDisp.cxx.

References fHqvz.

Referenced by HistPage::Update().

00078 {
00079     t=0;                        // unused warning
00080     for (int ind=1;ind<=2; ++ind) fHqvz[ind]->Fill(z,v,q);
00081 }

void HistDisp::Init ( void   )  [private]

Definition at line 59 of file HistDisp.cxx.

References Clear(), and fPad.

Referenced by HistDisp().

00060 {
00061     fPad->Divide(2,2);
00062     this->Clear();
00063 }

void HistDisp::SetRotation ( double  deg_polar,
double  deg_azimuth 
)

Set rotation angles (in degrees).

Definition at line 103 of file HistDisp.cxx.

References fPad.

00104 {
00105     for (int ind=1;ind<=2;++ind) {
00106         fPad->cd(ind);          // ROOT has 
00107         TVirtualPad* p = gPad;  // the weirdest 
00108         TView* v = p->GetView(); // fuckin API
00109         v->RotateView(deg_polar,deg_azimuth,p);
00110     }
00111 }

void HistDisp::Unzoom ( void   ) 

Show full detector.

Definition at line 179 of file HistDisp.cxx.

References fHquz, and fHqvz.

Referenced by HistPage::FullZoom(), and HistPage::Unzoom().

00180 {
00181     for (int ind=1; ind<=2; ++ind) {
00182         fHquz[ind]->GetYaxis()->SetRange(1,fHquz[ind]->GetNbinsY());
00183         fHqvz[ind]->GetYaxis()->SetRange(1,fHqvz[ind]->GetNbinsY());
00184 
00185         fHquz[ind]->GetXaxis()->SetRange(1,fHquz[ind]->GetNbinsX());
00186         fHqvz[ind]->GetXaxis()->SetRange(1,fHqvz[ind]->GetNbinsX());
00187     }
00188 }

void HistDisp::Update ( void   ) 

Cause canvas to update.

Definition at line 95 of file HistDisp.cxx.

References fPad.

Referenced by HistPage::AutoZoom(), HistPage::FullZoom(), HistPage::Unzoom(), and HistPage::Update().

00096 {
00097     for (int ind=1; ind<=4; ++ind) fPad->cd(ind)->Modified();
00098     fPad->cd();
00099     fPad->Modified();
00100     fPad->Update();
00101 }

void HistDisp::Zoom ( double  umin,
double  umax,
double  vmin,
double  vmax,
double  zmin,
double  zmaz 
)

Zoom to the given u,v,z bounds.

Definition at line 164 of file HistDisp.cxx.

References fHquz, and fHqvz.

00167 {
00168     
00169 
00170     for (int ind=1; ind<=2; ++ind) {
00171         fHquz[ind]->SetAxisRange(umin,umax,"Y");
00172         fHqvz[ind]->SetAxisRange(vmin,vmax,"Y");
00173 
00174         fHquz[ind]->SetAxisRange(zmin,zmax,"X");
00175         fHqvz[ind]->SetAxisRange(zmin,zmax,"X");
00176     }
00177 }


Member Data Documentation

TH2D* HistDisp::fHquz[3] [private]

Definition at line 16 of file HistDisp.h.

Referenced by AutoZoom(), Clear(), FillU(), HistDisp(), Unzoom(), Zoom(), and ~HistDisp().

TH2D * HistDisp::fHqvz[3] [private]

Definition at line 16 of file HistDisp.h.

Referenced by AutoZoom(), Clear(), FillV(), HistDisp(), Unzoom(), Zoom(), and ~HistDisp().

TPad* HistDisp::fPad [private]

Definition at line 17 of file HistDisp.h.

Referenced by Clear(), HistDisp(), Init(), SetRotation(), and Update().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1