13 /**************************************************************************/
15 /**************************************************************************/
17 // Basic structures for Reve. Design criteria:
19 // * provide basic cross-referencing functionality;
21 // * small memory/disk footprint (floats / count on compression in
24 // * simple usage from tree selections;
26 // * placement in TClonesArray (composites are TObject derived);
28 // * minimal member-naming (impossible to make everybody happy).
30 void DisablePODTObjectStreamers();
32 /**************************************************************************/
34 /**************************************************************************/
36 // Minimal Float_t copy of TVector3.
37 // Used to represent points and momenta.
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) {}
48 Vector operator + (const Vector &);
49 Vector operator - (const Vector &);
50 Vector operator * (Float_t a);
52 Float_t* c_vec() { return &x; }
53 Float_t& operator [] (Int_t indx);
54 Float_t operator [] (Int_t indx) const;
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(); }
61 void Set(const Vector& v) { x=v.x; y=v.y; z=v.z; }
64 Float_t Theta() const;
65 Float_t CosTheta() const;
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;}
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(); }
75 Float_t Distance(const Vector& v) const;
76 Float_t SquareDistance(const Vector& v) const;
77 Float_t Dot(const Vector&a) const;
79 Vector& Mult(const Vector&a, Float_t af) { x = a.x*af; y = a.y*af; z = a.z*af; return *this; }
85 inline Float_t Vector::Phi() const
86 { return x == 0.0 && y == 0.0 ? 0.0 : TMath::ATan2(y,x); }
88 inline Float_t Vector::Theta() const
89 { return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : TMath::ATan2(Perp(),z); }
91 inline Float_t Vector::CosTheta() const
92 { Float_t ptot = Mag(); return ptot == 0.0 ? 1.0 : z/ptot; }
94 inline Float_t Vector::Distance( const Vector& b) const
96 return TMath::Sqrt((x - b.x)*(x - b.x) + (y - b.y)*(y - b.y) + (z - b.z)*(z - b.z));
98 inline Float_t Vector::SquareDistance(const Vector& b) const
100 return ((x - b.x)*(x - b.x) + (y - b.y)*(y - b.y) + (z - b.z)*(z - b.z));
103 inline Float_t Vector::Dot(const Vector& a) const
105 return a.x*x + a.y*y + a.z*z;
108 inline Float_t& Vector::operator [] (Int_t idx)
109 { return (&x)[idx]; }
111 inline Float_t Vector::operator [] (Int_t idx) const
112 { return (&x)[idx]; }
114 /**************************************************************************/
116 /**************************************************************************/
121 enum Type_e { Reference, Daughter, Decay };
124 Vector P; // momentum
125 Float_t time; // time
126 Type_e type; // mark-type
128 PathMark(Type_e t=Reference) : V(), P(), time(0), type(t) {}
129 virtual ~PathMark() {}
131 const char* type_name();
133 ClassDef(PathMark, 1);
136 /**************************************************************************/
138 /**************************************************************************/
140 class MCTrack : public TParticle // ?? Copy stuff over ??
143 Int_t label; // Label of the track
144 Int_t index; // Index of the track (in some source array)
145 Int_t eva_label; // Label of primary particle
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
153 MCTrack() : label(-1), index(-1), eva_label(-1),
154 decayed(false), t_decay(0), V_decay(), P_decay() {}
155 virtual ~MCTrack() {}
157 MCTrack& operator=(const TParticle& p)
158 { *((TParticle*)this) = p; return *this; }
160 void ResetPdgCode() { fPdgCode = 0; }
162 ClassDef(MCTrack, 1);
166 /**************************************************************************/
168 /**************************************************************************/
172 class MCTrackRef : public TObject
182 MCTrackRef() : label(-1), status(-1), V(), P(), length(0), time(0) {}
183 virtual ~MCTrackRef() {}
185 ClassDef(MCTrackRef, 1)
189 /**************************************************************************/
191 /**************************************************************************/
193 // Representation of a hit.
195 // Members det_id (and subdet_id) serve for cross-referencing into
196 // geometry. Hits should be stored in det_id (+some label ordering) in
197 // order to maximize branch compression.
200 class Hit : public TObject
203 UShort_t det_id; // Custom detector id
204 UShort_t subdet_id; // Custom sub-detector id
205 Int_t label; // Label of particle that produced the hit
209 // ?? Float_t charge. Probably specific.
211 Hit() : det_id(0), subdet_id(0), label(0), eva_label(0), V() {}
218 /**************************************************************************/
220 /**************************************************************************/
222 // Base class for reconstructed clusters
224 // ?? Should Hit and cluster have common base? No.
226 class Cluster : public TObject
229 UShort_t det_id; // Custom detector id
230 UShort_t subdet_id; // Custom sub-detector id
231 Int_t label[3]; // Labels of particles that contributed hits
232 // ?? Should include reconstructed track using it? Rather not, separate.
235 // Vector W; // Cluster widths
236 // ?? Coord system? Special variables Wz, Wy?
238 Cluster() : det_id(0), subdet_id(0), V() { label[0] = label[1] = label [2] = 0; }
239 virtual ~Cluster() {}
241 ClassDef(Cluster, 1);
245 /**************************************************************************/
247 /**************************************************************************/
249 class RecTrack : public TObject
252 Int_t label; // Label of the track
253 Int_t index; // Index of the track (in some source array)
254 Int_t status; // Status as exported from reconstruction
256 Vector V; // Start vertex from reconstruction
257 Vector P; // Reconstructed momentum at start vertex
262 RecTrack() : label(-1), index(-1), status(0), sign(0), V(), P(), beta(0) {}
263 virtual ~RecTrack() {}
265 Float_t Pt() { return P.Perp(); }
267 ClassDef(RecTrack, 1);
270 // Another class with specified points/clusters
273 /**************************************************************************/
275 /**************************************************************************/
277 class RecKink : public RecTrack
280 Int_t label_sec; // Label of the secondary track
281 Vector V_end; // End vertex: last point on the primary track
282 Vector V_kink; // Kink vertex: reconstructed position of the kink
283 Vector P_sec; // Momentum of secondary track
285 RecKink() : RecTrack(), label_sec(0), V_end(), V_kink(), P_sec() {}
286 virtual ~RecKink() {}
288 ClassDef(RecKink, 1);
292 /**************************************************************************/
294 /**************************************************************************/
296 class RecV0 : public TObject
301 Vector V_neg; // Vertex of negative track
302 Vector P_neg; // Momentum of negative track
303 Vector V_pos; // Vertex of positive track
304 Vector P_pos; // Momentum of positive track
306 Vector V_ca; // Point of closest approach
307 Vector V0_birth; // Reconstucted birth point of neutral particle
309 // ? Data from simulation.
310 Int_t label; // Neutral mother label read from kinematics
311 Int_t pdg; // PDG code of mother
312 Int_t d_label[2]; // Daughter labels ?? Rec labels present anyway.
314 RecV0() : status(), V_neg(), P_neg(), V_pos(), P_pos(),
315 V_ca(), V0_birth(), label(0), pdg(0)
316 { d_label[0] = d_label[1] = 0; }
322 /**************************************************************************/
323 /**************************************************************************/
325 // Missing primary vertex.
327 // Missing GenInfo, RecInfo.
329 class GenInfo : public TObject
332 Bool_t is_rec; // is reconstructed
339 GenInfo() : is_rec(false), has_V0(false), has_kink(false),
340 label(0), n_hits(0), n_clus(0) {}
341 virtual ~GenInfo() {}
343 ClassDef(GenInfo, 1);
346 /**************************************************************************/
347 /**************************************************************************/
349 // This whole construction is highly embarrassing. It requires
350 // shameless copying of experiment data. What is good about this
353 // 1) Filters can be applied at copy time so that only part of the
354 // data is copied over.
356 // 2) Once the data is extracted it can be used without experiment
357 // software. Thus, external service can provide this data and local
358 // client can be really thin.
360 // 3) Some pretty advanced visualization schemes/selections can be
361 // implemented in a general framework by providing data extractors
362 // only. This is also good for PR or VIP displays.
364 // 4) These classes can be extended by particular implementations. The
365 // container classes will use TClonesArray with user-specified element
368 // The common behaviour could be implemented entirely without usage of
369 // a common base classes, by just specifying names of members that
370 // retrieve specific data. This is fine as long as one only uses tree
371 // selections but becomes painful for extraction of data into local
372 // structures (could a) use interpreter but this is an overkill and
373 // would cause serious trouble for multi-threaded environment; b) use
374 // member offsets and data-types from the dictionary).