]>
Commit | Line | Data |
---|---|---|
e6f0d8f7 | 1 | // $Header$ |
2 | ||
3 | #include "VSDEvent.h" | |
4 | ||
5 | #include <TClass.h> | |
6 | ||
7 | using namespace Reve; | |
8 | ||
9 | //______________________________________________________________________ | |
10 | // VSDEvent | |
11 | // | |
12 | ||
13 | ClassImp(VSDEvent) | |
14 | ||
15 | /**************************************************************************/ | |
16 | ||
17 | const TString VSDEvent::sVSDHeaderName("VSDheader"); | |
18 | ||
19 | VSDEvent::VSDEvent() : | |
20 | EventBase("VSDEvent"), | |
265ecb21 | 21 | fRun(0), fEvent(0), fUrl(), |
22 | fTags(), | |
e6f0d8f7 | 23 | fDirectory(0), fCreator(0), fSelector(0) |
24 | {} | |
25 | ||
26 | VSDEvent::VSDEvent(Int_t run, Int_t evt, const TString& url) : | |
27 | EventBase("VSDEvent"), | |
28 | fRun(run), fEvent(evt), fUrl(url), | |
265ecb21 | 29 | fTags(), |
e6f0d8f7 | 30 | fDirectory(0), fCreator(0), fSelector(0) |
31 | {} | |
32 | ||
33 | VSDEvent::VSDEvent(const TString& url) : | |
34 | EventBase("VSDEvent"), | |
35 | fRun(0), fEvent(0), fUrl(url), | |
265ecb21 | 36 | fTags(), |
e6f0d8f7 | 37 | fDirectory(0), fCreator(0), fSelector(0) |
38 | {} | |
39 | ||
40 | /**************************************************************************/ | |
41 | ||
42 | VSDEvent* VSDEvent::OpenDirectory(const TString& dir_name) | |
43 | { | |
44 | static const Exc_t eH("VSDEvent::OpenDirectory "); | |
45 | ||
46 | TDirectory* dir = dynamic_cast<TDirectory*>(gDirectory->Get(dir_name)); | |
47 | if (!dir) | |
48 | throw(eH + "direcotry '" + dir_name + "' not found."); | |
49 | return OpenDirectory(dir); | |
50 | } | |
51 | ||
52 | VSDEvent* VSDEvent::OpenDirectory(TDirectory* dir) | |
53 | { | |
54 | static const Exc_t eH("VSDEvent::OpenDirectory "); | |
55 | ||
56 | VSDEvent* evt = dynamic_cast<VSDEvent*>(dir->Get(sVSDHeaderName)); | |
57 | if (!evt) | |
58 | throw(eH + "VSD header '" + sVSDHeaderName + "' not found."); | |
59 | evt->fDirectory = dir; | |
60 | return evt; | |
61 | } | |
62 | ||
63 | /**************************************************************************/ | |
64 | /**************************************************************************/ | |
65 | ||
66 | void VSDEvent::SetDirectory(TDirectory* dir) | |
67 | { | |
68 | if(fDirectory) | |
69 | fDirectory->RecursiveRemove(this); | |
70 | fDirectory = dir; | |
71 | if(fDirectory) | |
72 | fDirectory->Append(this); | |
73 | } | |
74 | ||
75 | TDirectory* VSDEvent::MakeDirectory(const Text_t* name, const Text_t* title) | |
76 | { | |
77 | TDirectory* dir = new TDirectory(name, title); | |
78 | SetDirectory(dir); | |
79 | return fDirectory; | |
80 | } | |
81 | ||
82 | /**************************************************************************/ | |
83 | ||
84 | void VSDEvent::Print(Option_t* ) const | |
85 | { | |
86 | printf("%s: '%s', '%s'\n", IsA()->GetName(), GetName(), GetTitle()); | |
87 | printf(" run=%d, event=%d, url='%s'\n", fRun, fEvent, fUrl.Data()); | |
88 | if(fDirectory) | |
89 | printf(" directory: '%s', '%s'\n", fDirectory->GetName(), fDirectory->GetTitle()); | |
90 | } | |
91 | ||
92 | /**************************************************************************/ | |
93 | /**************************************************************************/ | |
94 | /**************************************************************************/ | |
95 | /**************************************************************************/ | |
96 | ||
97 | #include <TBrowser.h> | |
98 | ||
99 | void EvTree::Browse(TBrowser* b) | |
100 | { | |
101 | // fFolder.Browse(b); // This adds all elements to top-level. | |
102 | b->Add(&fFolder); | |
103 | TTree::Browse(b); | |
104 | } |