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

Midad/MultiPage/GfxTrackList.cxx

Go to the documentation of this file.
00001 #include "GfxTrackList.h"
00002 #include "GfxTrackListCfg.h"
00003 #include "GfxProxy.h"
00004 #include "ViewState.h"
00005 #include <Midad/MultiPage/GfxTrack.h>
00006 #include <Midad/Base/Mint.h>
00007 #include <RecoBase/CandTrackHandle.h>
00008 #include <RecoBase/CandTrackListHandle.h>
00009 
00010 #include <DataUtil/CDL2STL.h>
00011 using namespace DataUtil;
00012 
00013 #include <sigc++/sigc++.h>
00014 #include <sigc++/class_slot.h>
00015 using namespace SigC;
00016 
00017 
00018 #include <Buttons.h> // part of ROOT
00019 
00020 static GfxProxy<GfxTrackList> 
00021 gsGfxTrackListProxy("TrackList");
00022 
00023 GfxTrackList::GfxTrackList()
00024     :fCfg(0)
00025 {
00026     fCfg = new GfxTrackListCfg();
00027     fCfg->modified_signal.connect
00028         (SigC::slot_class(*this,&GfxTrackList::ReConfigure));
00029 
00030 } 
00031 
00032 GfxTrackList::~GfxTrackList()
00033 {
00034 }
00035 
00036 
00037 void GfxTrackList::Init(PageDisplay& /*pd*/, MultiPage& /*mp*/)
00038 {
00039     ViewState* vs = this->GetViewState();
00040     vs->spatial_metric.connect(slot_class(*this,&GfxTrackList::ReConfigure));
00041 }
00042 
00043 void GfxTrackList::Configure(Mint& mint)
00044 {
00045     const CandTrackListHandle* ctlh = mint.GetTracks();
00046     if (!ctlh) return;
00047 
00048     Mint::TrackVector_t tv = CDL2STLvector<CandTrackHandle>(*ctlh);
00049 
00050     if (fTracks.size()) this->ClearTrackList();
00051 
00052     int siz = tv.size();
00053     for (int ind = 0; ind < siz; ++ind) {
00054         fTracks.push_back(GfxTrack(*tv[ind], *this));
00055     }
00056     this->ReConfigure();
00057 
00058 }
00059 void GfxTrackList::ReConfigure()
00060 {
00061     for (TrackList_t::iterator it=fTracks.begin(); it != fTracks.end(); ++it) {
00062         it->Configure();
00063     }
00064 }
00065 
00066 void GfxTrackList::ClearTrackList() 
00067 {
00068     fTracks.clear();
00069 }
00070 
00071 void GfxTrackList::Draw(Option_t* option)
00072 {
00073 //    cerr << "GfxTrackList::Draw("<<option<<")\n";
00074     for (TrackList_t::iterator it=fTracks.begin(); it != fTracks.end(); ++it) {
00075         it->Draw(option);
00076     }
00077 }
00078 
00079 void GfxTrackList::ExecuteEventTrack(int event, int /*px*/, int /*py*/, 
00080                                      GfxTrack* track)
00081 {
00082     switch (event) {
00083     case kMouseEnter: {
00084         const CandTrackHandle& cth = track->GetTrack();
00085         text_info.emit(Form("%s: %d strips, P=%.1f",
00086                             "track", cth.GetNDaughters(),
00087                             cth.GetMomentum()));
00088         break;
00089     }
00090     default: // nothing
00091         break;
00092     }
00093     
00094 }
00095 

Generated on Mon Feb 15 11:06:46 2010 for loon by  doxygen 1.3.9.1