1 | // $Id: EEvent.hh 2847 2010-10-19 16:03:33Z fenu $ |
---|
2 | // Author: M. Pallavicini , 12 2002 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: EEvent * |
---|
8 | * Package: SimuEvent * |
---|
9 | * Coordinator: Alessandro.Thea * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | #ifndef __EEVENT_HH__ |
---|
14 | #define __EEVENT_HH__ |
---|
15 | |
---|
16 | #include "TObject.h" |
---|
17 | #include "TString.h" |
---|
18 | #include "TTree.h" |
---|
19 | #include "TRef.h" |
---|
20 | #include "TList.h" |
---|
21 | |
---|
22 | #include "EFillable.hh" |
---|
23 | |
---|
24 | class ETruth; |
---|
25 | class EHeader; |
---|
26 | class EGeometry; |
---|
27 | class EDetector; |
---|
28 | class ESimpleDetector; |
---|
29 | class EShower; |
---|
30 | class EAtmosphere; |
---|
31 | class EChipTrackTrigger; |
---|
32 | class ELblTrackTrigger; |
---|
33 | class ERunParameters; |
---|
34 | class EEvent; |
---|
35 | class EPTTTrigger; |
---|
36 | class ELTTTrigger; |
---|
37 | class ECCB_LTTTrigger; |
---|
38 | |
---|
39 | //////////////////////////////////////////////////////////////////////////////// |
---|
40 | // // |
---|
41 | // EEvTreeLink // |
---|
42 | // // |
---|
43 | // Link between tree and the event. Its aim is to control the objects shared // |
---|
44 | // between the event and the ree, like ERunParameters. An EEvTreeLink is // |
---|
45 | // added to TTree::fUserInfo when the tree is attached to the EEvent via // |
---|
46 | // EEvent::SetBranches. EEvTreeLink notifies the deletion of the tree and // |
---|
47 | // automatically removes the linking. // |
---|
48 | // // |
---|
49 | //////////////////////////////////////////////////////////////////////////////// |
---|
50 | |
---|
51 | class EEvTreeLink:public TObject |
---|
52 | { |
---|
53 | public: |
---|
54 | EEvTreeLink (); |
---|
55 | EEvTreeLink (TTree *); |
---|
56 | EEvTreeLink (TTree *, EEvent *); |
---|
57 | virtual ~ EEvTreeLink (); |
---|
58 | |
---|
59 | TTree *GetTree () const |
---|
60 | { |
---|
61 | return (TTree *) fTreeRef.GetObject (); |
---|
62 | } |
---|
63 | EEvent *GetEvent () const |
---|
64 | { |
---|
65 | return fEvent; |
---|
66 | } |
---|
67 | void SetEvent (EEvent * e) |
---|
68 | { |
---|
69 | fEvent = e; |
---|
70 | } |
---|
71 | |
---|
72 | TTree *operator () () const |
---|
73 | { |
---|
74 | return GetTree (); |
---|
75 | } |
---|
76 | |
---|
77 | private: |
---|
78 | TRef fTreeRef; // reference to the tree |
---|
79 | EEvent *fEvent; //! event pointer has not to be saved. |
---|
80 | |
---|
81 | ClassDef (EEvTreeLink, 1)}; |
---|
82 | |
---|
83 | //////////////////////////////////////////////////////////////////////////////// |
---|
84 | // // |
---|
85 | // EEvent // |
---|
86 | // // |
---|
87 | // Root Event description in Euso. It contains an event with all possible // |
---|
88 | // information It is the base for all root files (input and output) At each // |
---|
89 | // stage of the program the event is enriched with additional data // |
---|
90 | // // |
---|
91 | //////////////////////////////////////////////////////////////////////////////// |
---|
92 | |
---|
93 | class EEvent:public TObject |
---|
94 | { |
---|
95 | public: |
---|
96 | enum EActiveBranches |
---|
97 | { |
---|
98 | kShower = BIT (0), |
---|
99 | kAtmosphere = BIT (1), |
---|
100 | kDetector = BIT (2), |
---|
101 | kChipTrackTrigger = BIT (3), |
---|
102 | kLblTrackTrigger = BIT (4), |
---|
103 | kSimpleDetector = BIT (5), |
---|
104 | kPTTTrigger = BIT (6), |
---|
105 | kLTTTrigger = BIT (7), |
---|
106 | kCCB_LTTTrigger = BIT (8), |
---|
107 | kNone = 0, |
---|
108 | kAll = 0x1FF |
---|
109 | }; |
---|
110 | |
---|
111 | EEvent (Int_t = kAll); |
---|
112 | EEvent (const EEvent &); |
---|
113 | virtual ~ EEvent (); |
---|
114 | |
---|
115 | virtual void Copy (TObject &) const; |
---|
116 | virtual void Clear (Option_t * = ""); |
---|
117 | virtual void ClearAndShrink (Option_t * = ""); |
---|
118 | virtual void Delete (Option_t * = ""); |
---|
119 | |
---|
120 | Bool_t BranchTree (TTree *, Bool_t link = kTRUE); |
---|
121 | // setup EEvent structure in TTree. Returns 0 if something fails |
---|
122 | |
---|
123 | Bool_t SetBranches (TTree *, Bool_t clone = kFALSE); |
---|
124 | // set branches addresses for reading |
---|
125 | |
---|
126 | Bool_t Fill (EFiller & f); |
---|
127 | // any filling from external data is done through this visitor |
---|
128 | |
---|
129 | void Build (Int_t, Int_t, const char * = 0); |
---|
130 | // fill event header |
---|
131 | |
---|
132 | // getters |
---|
133 | inline EHeader *GetHeader () const |
---|
134 | { |
---|
135 | return fHeader; |
---|
136 | } |
---|
137 | inline EGeometry *GetGeometry () const |
---|
138 | { |
---|
139 | return fGeometry; |
---|
140 | } |
---|
141 | inline ETruth *GetTruth () const |
---|
142 | { |
---|
143 | return fTruth; |
---|
144 | } |
---|
145 | inline EShower *GetShower () const |
---|
146 | { |
---|
147 | return fShower; |
---|
148 | } |
---|
149 | inline EAtmosphere *GetAtmosphere () const |
---|
150 | { |
---|
151 | return fAtmosphere; |
---|
152 | } |
---|
153 | inline EDetector *GetDetector () const |
---|
154 | { |
---|
155 | return fDetector; |
---|
156 | } |
---|
157 | inline ESimpleDetector *GetSimpleDetector () const |
---|
158 | { |
---|
159 | return fSimpleDetector; |
---|
160 | } |
---|
161 | inline EChipTrackTrigger *GetChipTrackTrigger () const |
---|
162 | { |
---|
163 | return fChipTrackTrigger; |
---|
164 | } |
---|
165 | inline ELblTrackTrigger *GetLblTrackTrigger () const |
---|
166 | { |
---|
167 | return fLblTrackTrigger; |
---|
168 | } |
---|
169 | inline EPTTTrigger *GetPTTTrigger () const |
---|
170 | { |
---|
171 | return fPTTTrigger; |
---|
172 | } |
---|
173 | inline ELTTTrigger *GetLTTTrigger () const |
---|
174 | { |
---|
175 | return fLTTTrigger; |
---|
176 | } |
---|
177 | inline ECCB_LTTTrigger *GetCCB_LTTTrigger () const |
---|
178 | { |
---|
179 | return fCCB_LTTTrigger; |
---|
180 | } |
---|
181 | |
---|
182 | inline ERunParameters *GetRunPars () const |
---|
183 | { |
---|
184 | return fRunPars; |
---|
185 | } |
---|
186 | |
---|
187 | inline static EEvent *GetCurrent () |
---|
188 | { |
---|
189 | return fgCurrent; |
---|
190 | } |
---|
191 | inline static void SetCurrent (EEvent * ev) |
---|
192 | { |
---|
193 | fgCurrent = ev; |
---|
194 | } |
---|
195 | |
---|
196 | Bool_t IsLinked () const |
---|
197 | { |
---|
198 | return fTreeLink != 0; |
---|
199 | } |
---|
200 | void LinkTree (TTree *); |
---|
201 | void UnlinkTree (); |
---|
202 | |
---|
203 | protected: |
---|
204 | TTree * GetTree ()const |
---|
205 | { |
---|
206 | return fTreeLink ? fTreeLink->GetTree () : 0; |
---|
207 | } |
---|
208 | |
---|
209 | EHeader *fHeader; // event header |
---|
210 | ETruth *fTruth; // initial conditions |
---|
211 | EGeometry *fGeometry; // detector basic parameters |
---|
212 | |
---|
213 | EShower *fShower; // shower simulation |
---|
214 | EAtmosphere *fAtmosphere; // atmosphere simulation |
---|
215 | EDetector *fDetector; // euso detector simulation |
---|
216 | ESimpleDetector *fSimpleDetector; // simple detector simulation |
---|
217 | EChipTrackTrigger *fChipTrackTrigger; // chip track trigger simulation |
---|
218 | ELblTrackTrigger *fLblTrackTrigger; // Lbl track trigger simulation |
---|
219 | EPTTTrigger *fPTTTrigger; |
---|
220 | ELTTTrigger *fLTTTrigger; |
---|
221 | ECCB_LTTTrigger *fCCB_LTTTrigger; |
---|
222 | |
---|
223 | ERunParameters *fRunPars; // parameters of the detector |
---|
224 | |
---|
225 | EEvTreeLink *fTreeLink; //! link to the ttree the event is attached to, if any |
---|
226 | |
---|
227 | // TList fBranches; |
---|
228 | // TList fPars; |
---|
229 | private: |
---|
230 | |
---|
231 | static EEvent *fgCurrent; |
---|
232 | |
---|
233 | ClassDef (EEvent, 1)}; |
---|
234 | #endif /* __EEVENT_HH__ */ |
---|