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