00001 #include "HistPage.h"
00002 #include "HistDisp.h"
00003
00004 #include <Midad/Base/PageProxy.h>
00005 #include <Midad/Base/Mint.h>
00006
00007 #include <UgliGeometry/UgliGeomHandle.h>
00008 #include <UgliGeometry/UgliStripHandle.h>
00009
00010 #include <Plex/PlexSEIdAltL.h>
00011 #include <Plex/PlexStripEndId.h>
00012
00013 #include <CandDigit/CandDigitListHandle.h>
00014 #include <CandDigit/CandDigitHandle.h>
00015
00016 #include <Conventions/PlaneView.h>
00017
00018 #include <DataUtil/CDL2STL.h>
00019 using namespace DataUtil;
00020
00021 #include <TH2D.h>
00022 #include <TCanvas.h>
00023
00024 #include <vector>
00025 using namespace std;
00026
00027
00028 static PageProxy<HistPage> gsHistsPageProxy("Hists");
00029
00030
00031
00032 HistPage::HistPage()
00033 : fMint(0), fHistDisp(0)
00034 {
00035 }
00036 HistPage::~HistPage()
00037 {
00038 if (fHistDisp) delete fHistDisp; fHistDisp = 0;
00039 }
00040
00041 TObject* HistPage::Init(Mint* mint, PageDisplay* pd, GuiBox& box)
00042 {
00043 this->CanvasPage::Init(mint,pd,box);
00044 fMint = mint;
00045 return 0;
00046 }
00047
00048 void HistPage::Setup()
00049 {
00050 if (fHistDisp) return;
00051 TCanvas& can = this->GetCanvas();
00052 fHistDisp = new HistDisp(fMint->GetUgliGeomHandle(),&can);
00053 }
00054
00055 void HistPage::Clear()
00056 {
00057 this->Setup();
00058 fHistDisp->Clear();
00059 }
00060 void HistPage::Update()
00061 {
00062 const CandDigitListHandle* cdlh = fMint->GetDigits();
00063 vector<const CandDigitHandle*> dv =
00064 DataUtil::CDL2STLvector<CandDigitHandle>(*cdlh);
00065
00066
00067 for (size_t ind=0; ind < dv.size(); ++ind) {
00068 const CandDigitHandle& cdh = *dv[ind];
00069 float q = cdh.GetCharge();
00070 const PlexSEIdAltL &seidaltl = cdh.GetPlexSEIdAltL();
00071 UgliStripHandle ush =
00072 fMint->GetUgliGeomHandle().GetStripHandle(seidaltl.GetBestSEId());
00073 float w = ush.GetTPos();
00074 float z = ush.GlobalPos(0).Z();
00075 if (seidaltl.GetPlaneView() == PlaneView::kU)
00076 fHistDisp->FillU(w,z,q);
00077 else
00078 fHistDisp->FillV(w,z,q);
00079 }
00080
00081 fHistDisp->AutoZoom();
00082 fHistDisp->Update();
00083 }
00084
00085 void HistPage::Unzoom()
00086 {
00087 fHistDisp->Unzoom();
00088 fHistDisp->Update();
00089 }
00090 void HistPage::Rezoom()
00091 {
00092 }
00093 void HistPage::FullZoom()
00094 {
00095 fHistDisp->Unzoom();
00096 fHistDisp->Update();
00097 }
00098 void HistPage::AutoZoom()
00099 {
00100 fHistDisp->AutoZoom();
00101 fHistDisp->Update();
00102 }
00103
00104
00105