]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/PODs.h
Add Getters and Setters in TrackRnrStyle and TrackList to define rendering of path...
[u/mrichter/AliRoot.git] / EVE / Reve / PODs.h
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) {}
46   virtual ~Vector() {}
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   Float_t time;
92   Type_e type;
93
94   PathMark(Type_e t=Reference) : V(), P(), type(t) {}
95   virtual ~PathMark() {}
96
97   ClassDef(PathMark, 1);
98 };
99
100 /**************************************************************************/
101 // MCTrack
102 /**************************************************************************/
103
104 class MCTrack : public TParticle // ?? Copy stuff over ??
105 {
106 public:
107   Int_t   label;       // Label of the track
108   Int_t   index;       // Index of the track (in some source array)
109   Int_t   eva_label;   // Label of primary particle
110
111   Bool_t  decayed;     // True if decayed during tracking.
112   // ?? Perhaps end-of-tracking point/momentum would be better.
113   Float_t t_decay;     // Decay time
114   Vector  V_decay;     // Decay vertex
115   Vector  P_decay;     // Decay momentum
116
117   MCTrack() : label(-1), index(-1), eva_label(-1),
118               decayed(false), t_decay(0), V_decay(), P_decay() {}
119   virtual ~MCTrack() {}
120
121   MCTrack& operator=(const TParticle& p)
122   { *((TParticle*)this) = p; return *this; }
123
124   void ResetPdgCode() { fPdgCode = 0; }
125
126   ClassDef(MCTrack, 1);
127 };
128
129
130 /**************************************************************************/
131 // MCTrackRef
132 /**************************************************************************/
133
134 // Not used.
135
136 class MCTrackRef : public TObject
137 {
138 public:
139   Int_t   label;
140   Int_t   status;
141   Vector  V;
142   Vector  P;
143   Float_t length;
144   Float_t time;
145
146   MCTrackRef() : label(-1), status(-1), V(), P(), length(0), time(0) {}
147   virtual ~MCTrackRef() {}
148
149   ClassDef(MCTrackRef, 1)
150 };
151
152
153 /**************************************************************************/
154 // Hit
155 /**************************************************************************/
156
157 // Representation of a hit.
158
159 // Members det_id (and subdet_id) serve for cross-referencing into
160 // geometry. Hits should be stored in det_id (+some label ordering) in
161 // order to maximize branch compression.
162
163
164 class Hit : public TObject
165 {
166 public:
167   UShort_t det_id;    // Custom detector id
168   UShort_t subdet_id; // Custom sub-detector id
169   Int_t    label;     // Label of particle that produced the hit
170   Int_t    eva_label;
171   Vector   V;         // Vertex
172
173   // ?? Float_t charge. Probably specific.
174
175   Hit() : det_id(0), subdet_id(0), label(0), eva_label(0), V() {}
176   virtual ~Hit() {}
177
178   ClassDef(Hit, 1);
179 };
180
181
182 /**************************************************************************/
183 // Cluster
184 /**************************************************************************/
185
186 // Base class for reconstructed clusters
187
188 // ?? Should Hit and cluster have common base? No.
189
190 class Cluster : public TObject
191 {
192 public:
193   UShort_t det_id;    // Custom detector id
194   UShort_t subdet_id; // Custom sub-detector id
195   Int_t    label[3];  // Labels of particles that contributed hits
196   // ?? Should include reconstructed track using it? Rather not, separate.
197
198   Vector   V;         // Vertex
199   // Vector   W;         // Cluster widths
200   // ?? Coord system? Special variables Wz, Wy?
201
202   Cluster() : det_id(0), subdet_id(0), V() { label[0] = label[1] = label [2] = 0; }
203   virtual ~Cluster() {}
204
205   ClassDef(Cluster, 1);
206 };
207
208
209 /**************************************************************************/
210 // RecTrack
211 /**************************************************************************/
212
213 class RecTrack : public TObject
214 {
215 public:
216   Int_t   label;       // Label of the track
217   Int_t   index;       // Index of the track (in some source array)
218   Int_t   status;      // Status as exported from reconstruction
219   Int_t   sign;
220   Vector  V;           // Start vertex from reconstruction
221   Vector  P;           // Reconstructed momentum at start vertex
222   Float_t beta;
223
224   // PID data missing
225
226   RecTrack() : label(-1), index(-1), status(0), sign(0), V(), P(), beta(0) {}
227   virtual ~RecTrack() {}
228
229   Float_t Pt() { return P.Perp(); }
230
231   ClassDef(RecTrack, 1);
232 };
233
234 // Another class with specified points/clusters
235
236
237 /**************************************************************************/
238 // RecKink
239 /**************************************************************************/
240
241 class RecKink : public RecTrack
242 {
243 public:
244   Int_t   label_sec;  // Label of the secondary track
245   Vector  V_end;      // End vertex: last point on the primary track
246   Vector  V_kink;     // Kink vertex: reconstructed position of the kink
247   Vector  P_sec;      // Momentum of secondary track
248
249   RecKink() : RecTrack(), label_sec(0), V_end(), V_kink(), P_sec() {}
250   virtual ~RecKink() {}
251
252   ClassDef(RecKink, 1);
253 };
254
255
256 /**************************************************************************/
257 // RecV0
258 /**************************************************************************/
259
260 class RecV0 : public TObject
261 {
262 public:
263   Int_t  status;
264
265   Vector V_neg;       // Vertex of negative track
266   Vector P_neg;       // Momentum of negative track
267   Vector V_pos;       // Vertex of positive track
268   Vector P_pos;       // Momentum of positive track
269
270   Vector V_ca;        // Point of closest approach
271   Vector V0_birth;    // Reconstucted birth point of neutral particle
272
273   // ? Data from simulation.
274   Int_t label;        // Neutral mother label read from kinematics
275   Int_t pdg;          // PDG code of mother
276   Int_t d_label[2];   // Daughter labels ?? Rec labels present anyway.
277
278   RecV0() : status(), V_neg(), P_neg(), V_pos(), P_pos(),
279             V_ca(), V0_birth(), label(0), pdg(0)
280   { d_label[0] = d_label[1] = 0; }
281   virtual ~RecV0() {}
282
283   ClassDef(RecV0, 1);
284 };
285
286 /**************************************************************************/
287 /**************************************************************************/
288
289 // Missing primary vertex.
290
291 // Missing GenInfo, RecInfo.
292
293 class GenInfo : public TObject
294 {
295 public:
296   Bool_t       is_rec;   // is reconstructed
297   Bool_t       has_V0;
298   Bool_t       has_kink;
299   Int_t        label;
300   Int_t        n_hits;
301   Int_t        n_clus;
302
303   GenInfo() : is_rec(false), has_V0(false), has_kink(false),
304               label(0), n_hits(0), n_clus(0) {}
305   virtual ~GenInfo() {}
306
307   ClassDef(GenInfo, 1);
308 };
309
310 /**************************************************************************/
311 /**************************************************************************/
312
313 // This whole construction is highly embarrassing. It requires
314 // shameless copying of experiment data. What is good about this
315 // scheme:
316 //
317 // 1) Filters can be applied at copy time so that only part of the
318 // data is copied over.
319 //
320 // 2) Once the data is extracted it can be used without experiment
321 // software. Thus, external service can provide this data and local
322 // client can be really thin.
323 //
324 // 3) Some pretty advanced visualization schemes/selections can be
325 // implemented in a general framework by providing data extractors
326 // only. This is also good for PR or VIP displays.
327 //
328 // 4) These classes can be extended by particular implementations. The
329 // container classes will use TClonesArray with user-specified element
330 // class.
331
332 // The common behaviour could be implemented entirely without usage of
333 // a common base classes, by just specifying names of members that
334 // retrieve specific data. This is fine as long as one only uses tree
335 // selections but becomes painful for extraction of data into local
336 // structures (could a) use interpreter but this is an overkill and
337 // would cause serious trouble for multi-threaded environment; b) use
338 // member offsets and data-types from the dictionary).
339
340 }
341
342 #endif