MCDisp Class Reference

#include <MCDisp.h>

Inheritance diagram for MCDisp:
CanvasPage PageABC

List of all members.

Public Member Functions

 MCDisp ()
virtual ~MCDisp ()
virtual TObject * Init (Mint *mint, PageDisplay *pd, GuiBox &box)
virtual void Clear ()
virtual void Update ()
 Implement to respond to a change in the data.

Private Attributes

MintfMint
TView * fView
TList * fUZlist
TList * fVZlist
TList * fXYlist
TList * f3Dlist

Detailed Description

Id
MCDisp.h,v 1.2 2003/04/09 21:14:01 bv Exp

Definition at line 25 of file MCDisp.h.


Constructor & Destructor Documentation

MCDisp::MCDisp (  ) 

Definition at line 33 of file MCDisp.cxx.

00034     : fView(0)
00035     , fUZlist(0)
00036     , fVZlist(0)
00037     , fXYlist(0)
00038     , f3Dlist(0)
00039 {
00040 }

MCDisp::~MCDisp (  )  [virtual]

Definition at line 41 of file MCDisp.cxx.

References f3Dlist, fUZlist, fVZlist, and fXYlist.

00042 {
00043     if (fUZlist) delete fUZlist;
00044     if (fVZlist) delete fVZlist;
00045     if (fXYlist) delete fXYlist;
00046     if (f3Dlist) delete f3Dlist;
00047 }


Member Function Documentation

void MCDisp::Clear ( void   )  [virtual]

Implement to respond to a new record read in, the actual record is accessible in the subsequent Update() call.

Reimplemented from PageABC.

Definition at line 64 of file MCDisp.cxx.

References clear_list(), f3Dlist, fUZlist, fView, fVZlist, fXYlist, and CanvasPage::GetCanvas().

Referenced by Init().

00065 {
00066     cerr << "MCDisp::Clear()\n";
00067     TCanvas& c = this->GetCanvas();
00068     c.cd();
00069 
00070     c.Clear();
00071     c.SetFillColor(1);
00072 
00073     clear_list(fUZlist);
00074     clear_list(fVZlist);
00075     clear_list(fXYlist);
00076     clear_list(f3Dlist);
00077 
00078     c.Divide(2,2);
00079     for (int i=1; i<=4; ++i) {
00080         c.cd(i);
00081         gPad->SetFillColor(0);
00082     }
00083 #if 0
00084 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,3)
00085     if (!fView) fView = new TView3D(1,0,0);
00086 #else
00087     if (!fView) fView = new TView(1);
00088 #endif
00089     c.GetPad(4)->SetView(fView);
00090 #endif
00091 }

TObject * MCDisp::Init ( Mint mint,
PageDisplay pd,
GuiBox box 
) [virtual]

Implement to fill box with whatever your page displays. If the page wishes to return a class to the initializer, then return an object which inherits from TObject, o.w. just return 0.

Reimplemented from CanvasPage.

Definition at line 49 of file MCDisp.cxx.

References Clear(), and fMint.

00050 {
00051     this->CanvasPage::Init(mint,pd,box);
00052     fMint = mint;
00053 
00054     this->Clear();
00055     return 0;
00056 }

void MCDisp::Update ( void   )  [virtual]

Implement to respond to a change in the data.

Reimplemented from PageABC.

Definition at line 93 of file MCDisp.cxx.

References f3Dlist, fMint, fUZlist, fVZlist, fXYlist, CanvasPage::GetCanvas(), Mint::GetMCint(), MCint::GetScintHits(), UgliGeomHandle::GetStripHandle(), Mint::GetUgliGeomHandle(), UgliGeomHandle::IsValid(), UgliStripHandle::LocalToGlobal(), max, min, DigiScintHit::StripEndId(), DigiScintHit::X1(), DigiScintHit::X2(), UgliGeomHandle::xy2uv(), DigiScintHit::Y1(), DigiScintHit::Y2(), DigiScintHit::Z1(), and DigiScintHit::Z2().

00094 {
00095     cerr << "\nMCDisp::Update()\n";
00096     MCint& mcint = fMint->GetMCint();
00097     const vector<DigiScintHit*> hits = mcint.GetScintHits();
00098     
00099     UgliGeomHandle ugh = fMint->GetUgliGeomHandle();
00100     if (! ugh.IsValid()) {
00101         cerr << "MCDisp: bad UGH\n";
00102         return;
00103     }
00104 
00105     unsigned int siz = hits.size();
00106 
00107     float min[5],max[5];
00108 
00109     cerr << "Processing " << siz << " hits\n";
00110 
00111     for (unsigned int ind = 0; ind < siz; ++ind) {
00112         DigiScintHit* hit = hits[ind];
00113         PlexStripEndId seid = hit->StripEndId();
00114         UgliStripHandle ush = ugh.GetStripHandle(seid);
00115 
00116         TVector3 local1(hit->X1(),hit->Y1(),hit->Z1());
00117         TVector3 local2(hit->X2(),hit->Y2(),hit->Z2());
00118         
00119         TVector3 global1 = ush.LocalToGlobal(local1);
00120         TVector3 global2 = ush.LocalToGlobal(local2);
00121 
00122         double u1=0, v1=0, u2=0, v2=0;
00123         ugh.xy2uv(global1[0],global1[1],u1,v1);
00124         ugh.xy2uv(global2[0],global2[1],u2,v2);
00125         TLine* line = 0;
00126         
00127         line = new TLine(global1[2],u1,global2[2],u2);
00128         fUZlist->Add(line);
00129 
00130         line = new TLine(global1[2],v1,global2[2],v2);
00131         fVZlist->Add(line);
00132 
00133         line = new TLine(global1[0],global1[1],global2[0],global2[1]);
00134         fXYlist->Add(line);
00135 
00136         TPolyLine3D *p3d = new TPolyLine3D;
00137         p3d->SetNextPoint(global1[0],global1[1],global1[2]);
00138         p3d->SetNextPoint(global2[0],global2[1],global2[2]);
00139         f3Dlist->Add(p3d);
00140         
00141         if (!ind) {
00142             for (int i=0;i<3;++i) max[i] = min[i] = global1[i];
00143             max[3] = min[3] = u1;
00144             max[4] = min[4] = v1;
00145         }
00146         for (int i=0; i<3; ++i) {
00147             if (max[i] < global1[i]) max[i] = global1[i];
00148             if (max[i] < global2[i]) max[i] = global2[i];
00149             if (min[i] > global1[i]) min[i] = global1[i];
00150             if (min[i] > global2[i]) min[i] = global2[i];
00151         }
00152         if (max[3] < u1) max[3] = u1;
00153         if (max[3] < u2) max[3] = u2;
00154         if (max[4] < v1) max[4] = v1;
00155         if (max[4] < v2) max[4] = v2;
00156         if (min[3] > u1) min[3] = u1;
00157         if (min[3] > u2) min[3] = u2;
00158         if (min[4] > v1) min[4] = v1;
00159         if (min[4] > v2) min[4] = v2;
00160 
00161     }
00162 
00163 #if 0
00164     for (int i=0; i<5; ++i) 
00165         cerr << min[i] << " " << max[i] << endl;
00166 
00167     cerr << "uzlist: " << fUZlist->GetSize() << endl;
00168     cerr << "vzlist: " << fVZlist->GetSize() << endl;
00169     cerr << "xylist: " << fXYlist->GetSize() << endl;
00170     cerr << "tdlist: " << f3Dlist->GetSize() << endl;
00171 #endif
00172 
00173     TCanvas& c = this->GetCanvas();
00174     c.cd(1);
00175     c.GetPad(1)->Range(min[2],min[3],max[2],max[3]);
00176     fUZlist->Draw();
00177 
00178     c.cd(3);
00179     c.GetPad(3)->Range(min[2],min[4],max[2],max[4]);
00180     fVZlist->Draw();
00181 
00182     c.cd(2);
00183     c.GetPad(2)->Range(min[0],min[1],max[0],max[1]);
00184     fXYlist->Draw();
00185 
00186     c.cd(4);
00187     f3Dlist->Draw();
00188 
00189     TVirtualPad* pad3d = c.GetPad(4);
00190     TView* view = pad3d->GetView();
00191 
00192     if (!view) {
00193 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,3)
00194         new TView3D(1,0,0);
00195 #else
00196         new TView(1);
00197 #endif
00198         view = pad3d->GetView();
00199     }
00200     assert(view);
00201 
00202 //    cerr << (void*)view << " " << (void*) fView << endl;
00203 
00204 //    fView->SetRange(min[0],min[1],min[2],max[0],max[1],max[2]);
00205 //    fView->SetPerspective();
00206 //    fView->SideView();
00207 
00208     view->SetRange(min[0],min[1],min[2],max[0],max[1],max[2]);
00209     view->SetPerspective();
00210     view->SideView();
00211     pad3d->Update();
00212 
00213     c.cd();
00214 
00215     c.Modified();
00216     c.Update();
00217 }


Member Data Documentation

TList * MCDisp::f3Dlist [private]

Definition at line 41 of file MCDisp.h.

Referenced by Clear(), Update(), and ~MCDisp().

Mint* MCDisp::fMint [private]

Definition at line 38 of file MCDisp.h.

Referenced by Init(), and Update().

TList* MCDisp::fUZlist [private]

Definition at line 41 of file MCDisp.h.

Referenced by Clear(), Update(), and ~MCDisp().

TView* MCDisp::fView [private]

Definition at line 40 of file MCDisp.h.

Referenced by Clear().

TList * MCDisp::fVZlist [private]

Definition at line 41 of file MCDisp.h.

Referenced by Clear(), Update(), and ~MCDisp().

TList * MCDisp::fXYlist [private]

Definition at line 41 of file MCDisp.h.

Referenced by Clear(), Update(), and ~MCDisp().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1