]>
Commit | Line | Data |
---|---|---|
5a5a1232 | 1 | // $Header$ |
2 | ||
3 | #ifndef REVE_PODs_H | |
4 | #define REVE_PODs_H | |
5 | ||
6 | #include <TObject.h> | |
7 | #include <TMath.h> | |
8 | ||
9 | #include <TParticle.h> | |
10 | ||
11 | namespace Reve { | |
12 | ||
13 | /**************************************************************************/ | |
14 | // PODs.h | |
15 | /**************************************************************************/ | |
16 | ||
17 | // Basic structures for Reve. Design criteria: | |
18 | // | |
19 | // * provide basic cross-referencing functionality; | |
20 | // | |
21 | // * small memory/disk footprint (floats / count on compression in | |
22 | // split mode); | |
23 | // | |
24 | // * simple usage from tree selections; | |
25 | // | |
26 | // * placement in TClonesArray (composites are TObject derived); | |
27 | // | |
28 | // * minimal member-naming (impossible to make everybody happy). | |
29 | ||
30 | void DisablePODTObjectStreamers(); | |
31 | ||
32 | /**************************************************************************/ | |
33 | // Vector | |
34 | /**************************************************************************/ | |
35 | ||
36 | // Minimal Float_t copy of TVector3. | |
37 | // Used to represent points and momenta. | |
38 | ||
39 | class Vector | |
40 | { | |
41 | public: | |
42 | Float_t x, y, z; | |
43 | ||
44 | Vector() : x(0), y(0), z(0) {} | |
45 | Vector(Float_t _x, Float_t _y, Float_t _z) : x(_x), y(_y), z(_z) {} | |
a8b53f69 | 46 | virtual ~Vector() {} |
5a5a1232 | 47 | |
48 | Float_t* c_vec() { return &x; } | |
49 | void Set(Float_t* v) { x=v[0]; y=v[1]; z=v[2]; } | |
50 | void Set(Double_t* v) { x=v[0]; y=v[1]; z=v[2]; } | |
51 | void Set(Float_t _x, Float_t _y, Float_t _z) { x=_x; y=_y; z=_z; } | |
52 | void Set(Double_t _x, Double_t _y, Double_t _z) { x=_x; y=_y; z=_z; } | |
53 | void Set(const TVector3& v) { x=v.x(); y=v.y(); z=v.z(); } | |
54 | ||
55 | Float_t Phi() const; | |
56 | Float_t Theta() const; | |
57 | Float_t CosTheta() const; | |
58 | Float_t Eta() const; | |
59 | ||
60 | Float_t Mag() const { return TMath::Sqrt(x*x+y*y+z*z);} | |
61 | Float_t Mag2() const { return x*x+y*y+z*z;} | |
62 | ||
63 | Float_t Perp() const { return TMath::Sqrt(x*x+y*y);} | |
64 | Float_t Perp2() const { return x*x+y*y;} | |
65 | Float_t R() const { return Perp(); } | |
66 | ||
67 | // need operator +,-,Dot | |
68 | ||
69 | ClassDef(Vector, 1); | |
70 | }; | |
71 | ||
72 | inline Float_t Vector::Phi() const | |
73 | { return x == 0.0 && y == 0.0 ? 0.0 : TMath::ATan2(y,x); } | |
74 | ||
75 | inline Float_t Vector::Theta() const | |
76 | { return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : TMath::ATan2(Perp(),z); } | |
77 | ||
78 | inline Float_t Vector::CosTheta() const | |
79 | { Float_t ptot = Mag(); return ptot == 0.0 ? 1.0 : z/ptot; } | |
80 | ||
81 | /**************************************************************************/ | |
82 | // PathMark | |
83 | /**************************************************************************/ | |
84 | ||
85 | class PathMark | |
86 | { | |
87 | public: | |
88 | enum Type_e { Reference, Daughter, Decay }; | |
89 | ||
90 | Vector V, P; | |
91 | Type_e type; | |
92 | ||
265ecb21 | 93 | PathMark(Type_e t=Reference) : V(), P(), type(t) {} |
a8b53f69 | 94 | virtual ~PathMark() {} |
5a5a1232 | 95 | |
96 | ClassDef(PathMark, 1); | |
97 | }; | |
98 | ||
99 | /**************************************************************************/ | |
100 | // MCTrack | |
101 | /**************************************************************************/ | |
102 | ||
103 | class MCTrack : public TParticle // ?? Copy stuff over ?? | |
104 | { | |
105 | public: | |
106 | Int_t label; // Label of the track | |
107 | Int_t eva_label; // Label of primary particle | |
108 | ||
109 | Bool_t decayed; // True if decayed during tracking. | |
110 | // ?? Perhaps end-of-tracking point/momentum would be better. | |
111 | Float_t t_decay; // Decay time | |
112 | Vector V_decay; // Decay vertex | |
113 | Vector P_decay; // Decay momentum | |
114 | ||
265ecb21 | 115 | MCTrack() : label(0), eva_label(0), |
116 | decayed(false), t_decay(0), V_decay(), P_decay() {} | |
a8b53f69 | 117 | virtual ~MCTrack() {} |
5a5a1232 | 118 | |
119 | MCTrack& operator=(const TParticle& p) | |
120 | { *((TParticle*)this) = p; return *this; } | |
121 | ||
122 | void ResetPdgCode() { fPdgCode = 0; } | |
123 | ||
124 | ClassDef(MCTrack, 1); | |
125 | }; | |
126 | ||
127 | ||
128 | /**************************************************************************/ | |
129 | // MCTrackRef | |
130 | /**************************************************************************/ | |
131 | ||
132 | // Not used. | |
133 | ||
134 | class MCTrackRef : public TObject | |
135 | { | |
136 | public: | |
137 | Int_t label; | |
138 | Int_t status; | |
139 | Vector V; | |
140 | Vector P; | |
141 | Float_t length; | |
142 | Float_t time; | |
143 | ||
265ecb21 | 144 | MCTrackRef() : label(0), status(0), V(), P(), length(0), time(0) {} |
a8b53f69 | 145 | virtual ~MCTrackRef() {} |
5a5a1232 | 146 | |
147 | ClassDef(MCTrackRef, 1) | |
148 | }; | |
149 | ||
150 | ||
151 | /**************************************************************************/ | |
152 | // Hit | |
153 | /**************************************************************************/ | |
154 | ||
155 | // Representation of a hit. | |
156 | ||
157 | // Members det_id (and subdet_id) serve for cross-referencing into | |
158 | // geometry. Hits should be stored in det_id (+some label ordering) in | |
159 | // order to maximize branch compression. | |
160 | ||
161 | ||
162 | class Hit : public TObject | |
163 | { | |
164 | public: | |
165 | UShort_t det_id; // Custom detector id | |
166 | UShort_t subdet_id; // Custom sub-detector id | |
167 | Int_t label; // Label of particle that produced the hit | |
168 | Int_t eva_label; | |
169 | Vector V; // Vertex | |
170 | ||
171 | // ?? Float_t charge. Probably specific. | |
172 | ||
265ecb21 | 173 | Hit() : det_id(0), subdet_id(0), label(0), eva_label(0), V() {} |
a8b53f69 | 174 | virtual ~Hit() {} |
5a5a1232 | 175 | |
176 | ClassDef(Hit, 1); | |
177 | }; | |
178 | ||
179 | ||
180 | /**************************************************************************/ | |
181 | // Cluster | |
182 | /**************************************************************************/ | |
183 | ||
184 | // Base class for reconstructed clusters | |
185 | ||
186 | // ?? Should Hit and cluster have common base? No. | |
187 | ||
188 | class Cluster : public TObject | |
189 | { | |
190 | public: | |
191 | UShort_t det_id; // Custom detector id | |
192 | UShort_t subdet_id; // Custom sub-detector id | |
193 | Int_t label[3]; // Labels of particles that contributed hits | |
194 | // ?? Should include reconstructed track using it? Rather not, separate. | |
195 | ||
196 | Vector V; // Vertex | |
197 | // Vector W; // Cluster widths | |
198 | // ?? Coord system? Special variables Wz, Wy? | |
199 | ||
265ecb21 | 200 | Cluster() : det_id(0), subdet_id(0), V() { label[0] = label[1] = label [2] = 0; } |
a8b53f69 | 201 | virtual ~Cluster() {} |
5a5a1232 | 202 | |
203 | ClassDef(Cluster, 1); | |
204 | }; | |
205 | ||
206 | ||
207 | /**************************************************************************/ | |
208 | // RecTrack | |
209 | /**************************************************************************/ | |
210 | ||
211 | class RecTrack : public TObject | |
212 | { | |
213 | public: | |
214 | Int_t label; // Label of the track | |
215 | Int_t status; // Status as exported from reconstruction | |
216 | Int_t sign; | |
217 | Vector V; // Start vertex from reconstruction | |
218 | Vector P; // Reconstructed momentum at start vertex | |
219 | Float_t beta; | |
220 | ||
221 | // PID data missing | |
222 | ||
265ecb21 | 223 | RecTrack() : label(0), status(0), sign(0), V(), P(), beta(0) {} |
a8b53f69 | 224 | virtual ~RecTrack() {} |
5a5a1232 | 225 | |
226 | Float_t Pt() { return P.Perp(); } | |
227 | ||
228 | ClassDef(RecTrack, 1); | |
229 | }; | |
230 | ||
231 | // Another class with specified points/clusters | |
232 | ||
233 | ||
234 | /**************************************************************************/ | |
235 | // RecKink | |
236 | /**************************************************************************/ | |
237 | ||
238 | class RecKink : public RecTrack | |
239 | { | |
240 | public: | |
241 | Int_t label_sec; // Label of the secondary track | |
242 | Vector V_end; // End vertex: last point on the primary track | |
243 | Vector V_kink; // Kink vertex: reconstructed position of the kink | |
244 | Vector P_sec; // Momentum of secondary track | |
245 | ||
265ecb21 | 246 | RecKink() : RecTrack(), label_sec(0), V_end(), V_kink(), P_sec() {} |
a8b53f69 | 247 | virtual ~RecKink() {} |
248 | ||
5a5a1232 | 249 | ClassDef(RecKink, 1); |
250 | }; | |
251 | ||
252 | ||
253 | /**************************************************************************/ | |
254 | // RecV0 | |
255 | /**************************************************************************/ | |
256 | ||
257 | class RecV0 : public TObject | |
258 | { | |
259 | public: | |
260 | Int_t status; | |
261 | ||
262 | Vector V_neg; // Vertex of negative track | |
263 | Vector P_neg; // Momentum of negative track | |
264 | Vector V_pos; // Vertex of positive track | |
265 | Vector P_pos; // Momentum of positive track | |
266 | ||
267 | Vector V_ca; // Point of closest approach | |
268 | Vector V0_birth; // Reconstucted birth point of neutral particle | |
269 | ||
270 | // ? Data from simulation. | |
271 | Int_t label; // Neutral mother label read from kinematics | |
272 | Int_t pdg; // PDG code of mother | |
273 | Int_t d_label[2]; // Daughter labels ?? Rec labels present anyway. | |
274 | ||
265ecb21 | 275 | RecV0() : status(), V_neg(), P_neg(), V_pos(), P_pos(), |
276 | V_ca(), V0_birth(), label(0), pdg(0) | |
277 | { d_label[0] = d_label[1] = 0; } | |
a8b53f69 | 278 | virtual ~RecV0() {} |
279 | ||
5a5a1232 | 280 | ClassDef(RecV0, 1); |
281 | }; | |
282 | ||
283 | /**************************************************************************/ | |
284 | /**************************************************************************/ | |
285 | ||
286 | // Missing primary vertex. | |
287 | ||
288 | // Missing GenInfo, RecInfo. | |
289 | ||
290 | class GenInfo : public TObject | |
291 | { | |
292 | public: | |
293 | Bool_t is_rec; // is reconstructed | |
294 | Bool_t has_V0; | |
295 | Bool_t has_kink; | |
296 | Int_t label; | |
297 | Int_t n_hits; | |
298 | Int_t n_clus; | |
299 | ||
265ecb21 | 300 | GenInfo() : is_rec(false), has_V0(false), has_kink(false), |
301 | label(0), n_hits(0), n_clus(0) {} | |
a8b53f69 | 302 | virtual ~GenInfo() {} |
5a5a1232 | 303 | |
304 | ClassDef(GenInfo, 1); | |
305 | }; | |
306 | ||
307 | /**************************************************************************/ | |
308 | /**************************************************************************/ | |
309 | ||
310 | // This whole construction is highly embarrassing. It requires | |
311 | // shameless copying of experiment data. What is good about this | |
312 | // scheme: | |
313 | // | |
314 | // 1) Filters can be applied at copy time so that only part of the | |
315 | // data is copied over. | |
316 | // | |
317 | // 2) Once the data is extracted it can be used without experiment | |
318 | // software. Thus, external service can provide this data and local | |
319 | // client can be really thin. | |
320 | // | |
321 | // 3) Some pretty advanced visualization schemes/selections can be | |
322 | // implemented in a general framework by providing data extractors | |
323 | // only. This is also good for PR or VIP displays. | |
324 | // | |
325 | // 4) These classes can be extended by particular implementations. The | |
326 | // container classes will use TClonesArray with user-specified element | |
327 | // class. | |
328 | ||
329 | // The common behaviour could be implemented entirely without usage of | |
330 | // a common base classes, by just specifying names of members that | |
331 | // retrieve specific data. This is fine as long as one only uses tree | |
332 | // selections but becomes painful for extraction of data into local | |
333 | // structures (could a) use interpreter but this is an overkill and | |
334 | // would cause serious trouble for multi-threaded environment; b) use | |
335 | // member offsets and data-types from the dictionary). | |
336 | ||
337 | } | |
338 | ||
339 | #endif |