#include <EventDisplay.h>
Public Member Functions | |
| void | Add (EventTabPtr tab) |
| EventTabPtr | Add (const std::string &name) |
| void | Add (const Record &record) |
| void | Init () |
| void | Selected (int tab) |
| void | NextEvent () |
| void | PrevEvent () |
| void | NextSnarl () |
| void | PrevSnarl () |
| void | ZoomIn () |
| void | ZoomOut () |
| void | PrintTruth () |
| void | PrintData () |
| void | PrintTab () |
| void | CloseWindow () |
Static Public Member Functions | |
| EventDisplay & | Instance () |
Private Types | |
| typedef std::vector< Anp::EventTabPtr > | TabVec |
Private Member Functions | |
| EventDisplay (const EventDisplay &) | |
| const EventDisplay & | operator= (const EventDisplay &) |
| EventDisplay () | |
| ~EventDisplay () | |
| void | NewEvent () |
| void | InitTab (EventTabPtr tab) |
| EventTabPtr | GetCurrent () |
Private Attributes | |
| TGMainFrame * | fMain |
| TGTab * | fTab |
| TabVec | fTabs |
| RecordStore | fStore |
| bool | fZoom |
Static Private Attributes | |
| EventDisplay * | fgInstance = 0 |
|
|
Definition at line 61 of file EventDisplay.h. |
|
|
|
|
|
Definition at line 39 of file EventDisplay.cxx.
|
|
|
Definition at line 51 of file EventDisplay.h. 00051 {}
|
|
|
Definition at line 48 of file EventDisplay.cxx. References Anp::RecordStore::Add(), and fStore. 00049 {
00050 fStore.Add(record);
00051 }
|
|
|
Definition at line 70 of file EventDisplay.cxx. References Add(), Anp::EventTabPtr, and Anp::Handle< T >::valid(). 00071 {
00072 EventTabPtr tab = Factory<EventTab>::Instance().Create(name);
00073
00074 if(!tab.valid())
00075 {
00076 cerr << "EventDisplay::Init() - failed to create tab:" << name << endl;
00077 return EventTabPtr(0);
00078 }
00079
00080 tab -> SetName(name);
00081
00082 Add(tab);
00083
00084 return tab;
00085 }
|
|
|
Definition at line 54 of file EventDisplay.cxx. References Anp::EventTabPtr, fTab, fTabs, InitTab(), and Anp::Handle< T >::valid(). Referenced by Add(). 00055 {
00056 if(!tab.valid())
00057 {
00058 cerr << "EventDisplay::Add() - ignoring invalid tab" << endl;
00059 }
00060
00061 fTabs.push_back(tab);
00062
00063 if(fTab && fMain)
00064 {
00065 InitTab(tab);
00066 }
00067 }
|
|
|
Definition at line 389 of file EventDisplay.cxx. References fMain. 00390 {
00391 if(fMain)
00392 {
00393 fMain -> CloseWindow();
00394 }
00395 }
|
|
|
Definition at line 118 of file EventDisplay.cxx. References Anp::EventTabPtr, fTab, and fTabs. Referenced by NewEvent(), PrintTab(), ZoomIn(), and ZoomOut(). 00119 {
00120 const int current = fTab -> GetCurrent();
00121
00122 if(current < static_cast<int>(fTabs.size()))
00123 {
00124 return fTabs[current];
00125 }
00126 else
00127 {
00128 cerr << "EventDisplay::GetCurrent() - requested tab does not exists" << endl;
00129 }
00130
00131 return EventTabPtr(0);
00132 }
|
|
|
Definition at line 148 of file EventDisplay.cxx. References fMain, fTab, fTabs, InitTab(), main(), and Lit::Print(). Referenced by InitTab(). 00149 {
00150 TGWindow* main = const_cast<TGWindow*> (gClient->GetRoot());
00151 fMain = new TGMainFrame(main, 1000, 900, kHorizontalFrame);
00152 fMain -> SetWMSize(900, 700);
00153 fMain -> SetCleanup(kDeepCleanup);
00154 fMain -> Connect("CloseWindow()", "Anp::EventDisplay", this, "CloseWindow()");
00155
00156 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00157 // add tab frame
00158 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00159
00160 fTab = new TGTab(fMain, 900, 900);
00161 TGLayoutHints *thints = new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2);
00162 fTab -> Connect("Selected(Int_t)", "Anp::EventDisplay", this, "Selected(int)");
00163 fMain -> AddFrame(fTab, thints);
00164 cout<<"EventDisplay::Init() before for loop" <<endl;
00165 for(TabVec::const_iterator cit = fTabs.begin(); cit != fTabs.end(); ++cit)
00166 {
00167 InitTab(*cit);
00168 }
00169 cout<<" EventDisplay::Init() Add Buttons"<<endl;
00170 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00171 // add buttons
00172 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00173
00174 TGVerticalFrame *bframe = new TGVerticalFrame(fMain, 80, 1000);
00175 bframe -> SetHeight(1000);
00176 bframe -> SetWidth(80);
00177 TGLayoutHints *lh = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2);
00178
00179 TGTextButton *bnevent = new TGTextButton(bframe, "Next event", 0);
00180 TGTextButton *bpevent = new TGTextButton(bframe, "Prev event", 0);
00181 TGTextButton *bnsnarl = new TGTextButton(bframe, "Next snarl", 0);
00182 TGTextButton *bpsnarl = new TGTextButton(bframe, "Prev snarl", 0);
00183
00184 TGTextButton *bzoomi = new TGTextButton(bframe, "Zoom In", 0);
00185 TGTextButton *bzoomo = new TGTextButton(bframe, "Zoom Out", 0);
00186 TGTextButton *btruth = new TGTextButton(bframe, "Print truth", 0);
00187 TGTextButton *bdata = new TGTextButton(bframe, "Print data", 0);
00188 TGTextButton *bprint = new TGTextButton(bframe, "Print tab", 0);
00189 TGTextButton *bclose = new TGTextButton(bframe, "Close", 0);
00190
00191 TGLayoutHints *tloh = new TGLayoutHints(kLHintsTop);
00192
00193 bnevent -> Connect("Clicked()", "Anp::EventDisplay", this, "NextEvent()");
00194 bpevent -> Connect("Clicked()", "Anp::EventDisplay", this, "PrevEvent()");
00195 bnsnarl -> Connect("Clicked()", "Anp::EventDisplay", this, "NextSnarl()");
00196 bpsnarl -> Connect("Clicked()", "Anp::EventDisplay", this, "PrevSnarl()");
00197
00198 bzoomi -> Connect("Clicked()", "Anp::EventDisplay", this, "ZoomIn()");
00199 bzoomo -> Connect("Clicked()", "Anp::EventDisplay", this, "ZoomOut()");
00200 btruth -> Connect("Clicked()", "Anp::EventDisplay", this, "PrintTruth()");
00201 bdata -> Connect("Clicked()", "Anp::EventDisplay", this, "PrintData()");
00202 bprint -> Connect("Clicked()", "Anp::EventDisplay", this, "PrintTab()");
00203 bclose -> Connect("Clicked()", "Anp::EventDisplay", this, "CloseWindow()");
00204
00205 bframe -> AddFrame(bnevent, tloh);
00206 bframe -> AddFrame(bpevent, tloh);
00207 bframe -> AddFrame(bnsnarl, tloh);
00208 bframe -> AddFrame(bpsnarl, tloh);
00209 bframe -> AddFrame(bzoomi, tloh);
00210 bframe -> AddFrame(bzoomo, tloh);
00211 bframe -> AddFrame(btruth, tloh);
00212 bframe -> AddFrame(bprint, tloh);
00213 bframe -> AddFrame(bclose, tloh);
00214
00215 fMain -> AddFrame(bframe, lh);
00216
00217 fMain -> SetWindowName("Event display");
00218
00219 fMain -> MapSubwindows();
00220 fMain -> Resize(fMain -> GetDefaultSize());
00221 fMain -> MapWindow();
00222 fMain -> Layout();
00223 fMain -> Print();
00224 cout<<" Done with Event Display:: Init"<<endl;
00225 }
|
|
|
Definition at line 88 of file EventDisplay.cxx. References Anp::EventTabPtr, fTab, GetCanvas(), Nav::GetName(), and Init(). Referenced by Add(), and Init(). 00089 {
00090 if(!fTab || !fMain)
00091 {
00092 return;
00093 }
00094
00095 string label = tab -> GetLabel();
00096 if(label.empty())
00097 {
00098 label = tab -> GetName();
00099 tab -> SetLabel(label);
00100 }
00101
00102 TGCompositeFrame *tf = fTab -> AddTab(label.c_str());
00103
00104 TGLayoutHints* lh = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
00105 TRootEmbeddedCanvas *rec = new TRootEmbeddedCanvas(label.c_str(), tf, 700,700);
00106
00107 tf -> AddFrame(rec, lh);
00108
00109 tab -> Init(rec -> GetCanvas());
00110 tab -> SetEmbedded(rec);
00111
00112 fTab -> MapSubwindows();
00113 fTab -> Resize(fTab -> GetDefaultSize());
00114 fTab -> Layout();
00115 }
|
|
|
Definition at line 26 of file EventDisplay.cxx. References fgInstance. 00027 {
00028 if(!fgInstance)
00029 {
00030 fgInstance = new Anp::EventDisplay();
00031 }
00032
00033 return *fgInstance;
00034 }
|
|
|
Definition at line 282 of file EventDisplay.cxx. References Anp::RecordStore::CurrEvent(), Anp::RecordStore::CurrSnarl(), fStore, fTab, fTabs, GetCurrent(), Anp::RecordStore::IsValid(), Anp::Header::Run(), Selected(), Anp::Header::Snarl(), and ZoomIn(). Referenced by NextEvent(), NextSnarl(), PrevEvent(), and PrevSnarl(). 00283 {
00284 if(!fStore.IsValid())
00285 {
00286 cerr << "EventDisplay::NewEvent() - bad RecordStore status..." << endl;
00287 return;
00288 }
00289
00290 const Header &header = fStore.CurrSnarl() -> GetHeader();
00291
00292 cout << "Run = " << setw(6) << header.Run()
00293 << " snarl = " << setw(6) << header.Snarl()
00294 << " event = " << setw(2) << fStore.CurrEvent() -> EventIndex()
00295 << endl;
00296
00297 for(TabVec::const_iterator cit = fTabs.begin(); cit != fTabs.end(); ++cit)
00298 {
00299 (*cit) -> Set(*fStore.CurrEvent(), *fStore.CurrSnarl());
00300
00301 if(fZoom)
00302 {
00303 (*cit) -> ZoomIn();
00304 }
00305 }
00306
00307 Selected(fTab -> GetCurrent());
00308 }
|
|
|
Definition at line 228 of file EventDisplay.cxx. References fStore, NewEvent(), and Anp::RecordStore::NextEvent().
|
|
|
Definition at line 242 of file EventDisplay.cxx. References fStore, NewEvent(), and Anp::RecordStore::NextSnarl().
|
|
|
|
|
|
Definition at line 235 of file EventDisplay.cxx. References fStore, NewEvent(), and Anp::RecordStore::PrevEvent().
|
|
|
Definition at line 249 of file EventDisplay.cxx. References fStore, NewEvent(), and Anp::RecordStore::PrevSnarl().
|
|
|
Definition at line 319 of file EventDisplay.cxx. References fStore, Anp::RecordStore::IsValid(), and Anp::RecordStore::PrintData().
|
|
|
Definition at line 329 of file EventDisplay.cxx. References Anp::RecordStore::CurrEvent(), Anp::RecordStore::CurrSnarl(), Anp::RecordStore::EventEnd(), Anp::EventTabPtr, fStore, GetCanvas(), GetCurrent(), Nav::GetName(), Anp::RecordStore::IsValid(), Lit::Print(), Anp::Header::Run(), Anp::Header::Snarl(), Anp::RecordStore::SnarlEnd(), and Anp::Handle< T >::valid(). 00330 {
00331 if(!fTab)
00332 {
00333 cout << "PrintTab: no tabs exists" << endl;
00334 return;
00335 }
00336
00337 if(!fStore.IsValid())
00338 {
00339 cout << "PrintTab:: bad RecordStore" << endl;
00340 return;
00341 }
00342
00343 RecordStore::SnarlIter snarl = fStore.CurrSnarl();
00344 if(snarl == fStore.SnarlEnd())
00345 {
00346 cout << "PrintTab: no snarls found" << endl;
00347 return;
00348 }
00349
00350 RecordStore::EventIter event = fStore.CurrEvent();
00351 if(event == fStore.EventEnd())
00352 {
00353 cout << "PrintTab: no events found" << endl;
00354 return;
00355 }
00356
00357 EventTabPtr tab = GetCurrent();
00358 if(!tab.valid())
00359 {
00360 cout << "PrintTab: current tab is not valid" << endl;
00361 return;
00362 }
00363
00364 TRootEmbeddedCanvas *emcan = tab -> GetEmbedded();
00365 if(!emcan)
00366 {
00367 cout << "PrintTab: invalid pointer to TRootEmbeddedCanvas" << endl;
00368 return;
00369 }
00370
00371 TCanvas *canvas = emcan -> GetCanvas();
00372 if(!canvas)
00373 {
00374 cout << "PrintTab: TRootEmbeddedCanvas has invalid TCanvas" << endl;
00375 return;
00376 }
00377
00378 const Header &header = snarl -> GetHeader();
00379
00380 stringstream name;
00381 name << tab -> GetName() << "_run_" << header.Run()
00382 << "_snarl_" << header.Snarl() << "_event_" << event -> EventIndex()
00383 << ".eps";
00384
00385 canvas -> Print(name.str().c_str());
00386 }
|
|
|
Definition at line 311 of file EventDisplay.cxx. References fStore, Anp::RecordStore::IsValid(), and Anp::RecordStore::PrintTruth().
|
|
|
Definition at line 135 of file EventDisplay.cxx. References fTabs. Referenced by NewEvent(), ZoomIn(), and ZoomOut(). 00136 {
00137 if(tab < static_cast<int>(fTabs.size()))
00138 {
00139 fTabs[tab] -> Expose();
00140 }
00141 else
00142 {
00143 cerr << "EventDisplay::Selected() - tab index is out of range" << endl;
00144 }
00145 }
|
|
|
Definition at line 256 of file EventDisplay.cxx. References fTab, fTabs, fZoom, GetCurrent(), and Selected(). Referenced by NewEvent(). 00257 {
00258 fZoom = true;
00259
00260 for(TabVec::const_iterator cit = fTabs.begin(); cit != fTabs.end(); ++cit)
00261 {
00262 (*cit) -> ZoomIn();
00263 }
00264
00265 Selected(fTab -> GetCurrent());
00266 }
|
|
|
Definition at line 269 of file EventDisplay.cxx. References fTab, fTabs, fZoom, GetCurrent(), and Selected(). 00270 {
00271 fZoom = false;
00272
00273 for(TabVec::const_iterator cit = fTabs.begin(); cit != fTabs.end(); ++cit)
00274 {
00275 (*cit) -> ZoomOut();
00276 }
00277
00278 Selected(fTab -> GetCurrent());
00279 }
|
|
|
Definition at line 21 of file EventDisplay.cxx. Referenced by Instance(). |
|
|
Definition at line 67 of file EventDisplay.h. Referenced by CloseWindow(), and Init(). |
|
|
Definition at line 72 of file EventDisplay.h. Referenced by Add(), NewEvent(), NextEvent(), NextSnarl(), PrevEvent(), PrevSnarl(), PrintData(), PrintTab(), and PrintTruth(). |
|
|
Definition at line 68 of file EventDisplay.h. Referenced by Add(), GetCurrent(), Init(), InitTab(), NewEvent(), ZoomIn(), and ZoomOut(). |
|
|
Definition at line 70 of file EventDisplay.h. Referenced by Add(), GetCurrent(), Init(), NewEvent(), Selected(), ZoomIn(), and ZoomOut(). |
|
|
Definition at line 74 of file EventDisplay.h. |
1.3.9.1