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