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