]>
Commit | Line | Data |
---|---|---|
450e0b36 | 1 | #ifndef ALIHLTMUONDECISION_H |
2 | #define ALIHLTMUONDECISION_H | |
3 | /* This file is property of and copyright by the ALICE HLT Project * | |
4 | * ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id: $ */ | |
8 | ||
9 | /// | |
10 | /// @file AliHLTMUONDecision.h | |
11 | /// @author Artur Szostak <artursz@iafrica.com> | |
12 | /// @date 12 May 2008 | |
13 | /// @brief Declaration of a dHLT decision object in ROOT object format. | |
14 | /// | |
15 | ||
16 | #include "TObject.h" | |
17 | #include "TClonesArray.h" | |
18 | ||
19 | class AliHLTMUONMansoTrack; | |
20 | ||
21 | /** | |
22 | * AliHLTMUONDecision stores converted dHLT raw trigger decision data as a ROOT object. | |
23 | * Both AliHLTMUONSinglesDecisionBlockStruct and AliHLTMUONPairsDecisionBlockStruct | |
24 | * data blocks are converted into this class by the AliHLTMUONRootifierComponent. | |
25 | * This class is mainly for testing or as a helper object for dHLT specific analysis, | |
26 | * since it is sometimes easier to store and handle ROOT objects. | |
27 | */ | |
28 | class AliHLTMUONDecision : public TObject | |
29 | { | |
30 | /** | |
31 | * Stream operator for usage with std::ostream classes. | |
32 | * Allows usage such as: | |
33 | * AliHLTMUONDecision t; std::cout << t; | |
34 | */ | |
35 | friend std::ostream& operator << ( | |
36 | std::ostream& stream, | |
37 | const AliHLTMUONDecision& decision | |
38 | ); | |
39 | ||
40 | public: | |
41 | ||
42 | /** | |
43 | * The AliTrackDecision class stores per track trigger information. | |
44 | */ | |
45 | class AliTrackDecision : public TObject | |
46 | { | |
47 | /** | |
48 | * Stream operator for usage with std::ostream classes. | |
49 | */ | |
50 | friend std::ostream& operator << (std::ostream& stream, const AliTrackDecision& decision); | |
51 | ||
52 | public: | |
53 | ||
54 | /** | |
55 | * Constructor for new single track trigger decision object. | |
56 | * \param pt The calculated pT value used for the trigger decision. | |
57 | * \param passedLowCut Flag indicating if the track passed the low pT cut. | |
58 | * \param passedHighCut Flag indicating if the track passed the high pT cut. | |
59 | * \param track Pointer to the associated track object. | |
60 | */ | |
61 | AliTrackDecision( | |
62 | Float_t pt = -1, | |
63 | Bool_t passedLowCut = kFALSE, | |
64 | Bool_t passedHighCut = kFALSE, | |
65 | const AliHLTMUONMansoTrack* track = NULL | |
66 | ) : | |
67 | TObject(), fTrack(track), fPt(pt), | |
68 | fPassedLowCut(passedLowCut), fPassedHighCut(passedHighCut) | |
69 | {} | |
70 | ||
71 | /** | |
72 | * Copy constructor performs shallow copy of object since we | |
73 | * do not take ownership of the track object. | |
74 | */ | |
75 | AliTrackDecision(const AliTrackDecision& obj) : | |
76 | TObject(), fTrack(obj.fTrack), fPt(obj.fPt), | |
77 | fPassedLowCut(obj.fPassedLowCut), fPassedHighCut(obj.fPassedHighCut) | |
78 | {} | |
79 | ||
80 | /** | |
81 | * Asignment operators performs shallow copy of object since we | |
82 | * do not take ownership of the track object. | |
83 | */ | |
84 | const AliTrackDecision& operator = (const AliTrackDecision& obj) | |
85 | { | |
86 | memcpy(this, &obj, sizeof(AliTrackDecision)); | |
87 | return *this; | |
88 | } | |
89 | ||
90 | /** | |
91 | * Default destructor. | |
92 | */ | |
93 | virtual ~AliTrackDecision() {} | |
94 | ||
95 | /** | |
96 | * Returns the track associated with the trigger decision or NULL if none found. | |
97 | */ | |
98 | const AliHLTMUONMansoTrack* Track() const { return fTrack; } | |
99 | ||
100 | /** | |
101 | * Returns the calculated pT value used for the trigger decision. | |
102 | */ | |
103 | Float_t Pt() const { return fPt; } | |
104 | ||
105 | /** | |
106 | * Returns kTRUE if the track passed the low pT cut, else kFALSE. | |
107 | */ | |
108 | Bool_t PassedLowPtCut() const { return fPassedLowCut; } | |
109 | ||
110 | /** | |
111 | * Returns kTRUE if the track passed the high pT cut, else kFALSE. | |
112 | */ | |
113 | Bool_t PassedHighPtCut() const { return fPassedHighCut; } | |
114 | ||
115 | /// Print method inherited from TObject. | |
116 | virtual void Print(Option_t* option = NULL) const; | |
117 | ||
118 | // Methods inherited from TObject | |
119 | virtual Bool_t IsSortable() const { return kTRUE; } | |
120 | Int_t Compare(const TObject* obj) const; | |
121 | ||
122 | // Implement comparison operators. | |
123 | bool operator == (const AliTrackDecision& d) const | |
124 | { | |
125 | return fTrack == d.fTrack and fPt == d.fPt | |
126 | and fPassedLowCut == d.fPassedLowCut | |
127 | and fPassedHighCut == d.fPassedHighCut; | |
128 | } | |
129 | ||
130 | bool operator != (const AliTrackDecision& d) const | |
131 | { | |
132 | return not this->operator == (d); | |
133 | } | |
134 | ||
135 | private: | |
136 | ||
137 | const AliHLTMUONMansoTrack* fTrack; ///< Track associated with this decision. | |
138 | Float_t fPt; ///< Calculated pT value used for decision (GeV/c). | |
139 | Bool_t fPassedLowCut; ///< Indicates if the track passed the low pT cut. | |
140 | Bool_t fPassedHighCut; ///< Indicates if the track passed the high pT cut. | |
141 | ||
142 | ClassDef(AliHLTMUONDecision::AliTrackDecision, 2); // A single track dHLT trigger decision object. | |
143 | }; | |
144 | ||
145 | /** | |
146 | * The AliPairDecision class stores trigger information about a track pair. | |
147 | */ | |
148 | class AliPairDecision : public TObject | |
149 | { | |
150 | /** | |
151 | * Stream operator for usage with std::ostream classes. | |
152 | */ | |
153 | friend std::ostream& operator << (std::ostream& stream, const AliPairDecision& decision); | |
154 | ||
155 | public: | |
156 | ||
157 | /** | |
158 | * Constructor for new track pair trigger decision object. | |
159 | * \param mass The invariant mass of the track pair. | |
160 | * \param passedLowCut Indicates if the pair passed the low mass cut. | |
161 | * \param passedHighCut Indicates if the pair passed the high mass cut. | |
162 | * \param unlike Indicates if the tracks have opposite sign. | |
163 | * \param lowPtCount The number of tracks in the pair that passed the low pT cut. | |
164 | * Should be in the range [0..2]. | |
165 | * \param highPtCount The number of tracks in the pair that passed the high pT cut. | |
166 | * Should be in the range [0..2]. | |
167 | * \param trackA Pointer to the first associated track object. | |
168 | * \param trackB Pointer to the second associated track object. | |
169 | */ | |
170 | AliPairDecision( | |
171 | Float_t mass = -1, Bool_t passedLowCut = kFALSE, | |
172 | Bool_t passedHighCut = kFALSE, Bool_t unlike = kFALSE, | |
173 | UChar_t lowPtCount = 0, UChar_t highPtCount = 0, | |
174 | const AliHLTMUONMansoTrack* trackA = NULL, | |
175 | const AliHLTMUONMansoTrack* trackB = NULL | |
176 | ) : | |
177 | TObject(), fTrackA(trackA), fTrackB(trackB), fMass(mass), | |
178 | fPassedLowCut(passedLowCut), fPassedHighCut(passedHighCut), | |
179 | fUnlike(unlike), fLowPtCount(lowPtCount), fHighPtCount(highPtCount) | |
180 | {} | |
181 | ||
182 | /** | |
183 | * Copy constructor performs shallow copy of object since we | |
184 | * do not take ownership of the track objects. | |
185 | */ | |
186 | AliPairDecision(const AliPairDecision& obj) : | |
187 | TObject(), fTrackA(obj.fTrackA), fTrackB(obj.fTrackB), fMass(obj.fMass), | |
188 | fPassedLowCut(obj.fPassedLowCut), fPassedHighCut(obj.fPassedHighCut), | |
189 | fUnlike(obj.fUnlike), fLowPtCount(obj.fLowPtCount), fHighPtCount(obj.fHighPtCount) | |
190 | {} | |
191 | ||
192 | /** | |
193 | * Asignment operators performs shallow copy of object since we | |
194 | * do not take ownership of the track objects. | |
195 | */ | |
196 | const AliPairDecision& operator = (const AliPairDecision& obj) | |
197 | { | |
198 | memcpy(this, &obj, sizeof(AliPairDecision)); | |
199 | return *this; | |
200 | } | |
201 | ||
202 | /** | |
203 | * Default destructor. | |
204 | */ | |
205 | virtual ~AliPairDecision() {} | |
206 | ||
207 | /** | |
208 | * Returns the first track associated with the track pair trigger decision | |
209 | * or NULL if none found. | |
210 | */ | |
211 | const AliHLTMUONMansoTrack* TrackA() const { return fTrackA; } | |
212 | ||
213 | /** | |
214 | * Returns the second track associated with the track pair trigger decision | |
215 | * or NULL if none found. | |
216 | */ | |
217 | const AliHLTMUONMansoTrack* TrackB() const { return fTrackB; } | |
218 | ||
219 | /** | |
220 | * Returns the calculated invariant mass value used for the trigger decision. | |
221 | */ | |
222 | Float_t Mass() const { return fMass; } | |
223 | ||
224 | /** | |
225 | * Returns kTRUE if the track pair passed the low invariant mass cut, else kFALSE. | |
226 | */ | |
227 | Bool_t PassedLowMassCut() const { return fPassedLowCut; } | |
228 | ||
229 | /** | |
230 | * Returns kTRUE if the track pair passed the high invariant mass cut, else kFALSE. | |
231 | */ | |
232 | Bool_t PassedHighMassCut() const { return fPassedHighCut; } | |
233 | ||
234 | /** | |
235 | * Returns kTRUE if the track pair has unlike sign, else kFALSE. | |
236 | */ | |
237 | Bool_t UnlikeSign() const { return fUnlike; } | |
238 | ||
239 | /** | |
240 | * Returns kTRUE if the track pair has like sign, else kFALSE. | |
241 | */ | |
242 | Bool_t LikeSign() const { return not fUnlike; } | |
243 | ||
244 | /** | |
245 | * Returns the number of tracks in the pair that passed the low pT cut. | |
246 | * Can be one of 0, 1 or 2. | |
247 | */ | |
248 | UChar_t NumberPassedLowPtCut() const { return fLowPtCount; } | |
249 | ||
250 | /** | |
251 | * Returns the number of tracks in the pair that passed the high pT cut. | |
252 | * Can be one of 0, 1 or 2. | |
253 | */ | |
254 | UChar_t NumberPassedHighPtCut() const { return fHighPtCount; } | |
255 | ||
256 | /** | |
257 | * Returns kTRUE if both tracks passed the low pT cut, else kFALSE. | |
258 | */ | |
259 | Bool_t BothPassedLowPtCut() const { return NumberPassedLowPtCut() == 2; } | |
260 | ||
261 | /** | |
262 | * Returns kTRUE if both tracks passed the high pT cut, else kFALSE. | |
263 | */ | |
264 | Bool_t BothPassedHighPtCut() const { return NumberPassedHighPtCut() == 2; } | |
265 | ||
266 | /// Print method inherited from TObject. | |
267 | virtual void Print(Option_t* option = NULL) const; | |
268 | ||
269 | // Methods inherited from TObject | |
270 | virtual Bool_t IsSortable() const { return kTRUE; } | |
271 | Int_t Compare(const TObject* obj) const; | |
272 | ||
273 | // Implement comparison operators. | |
274 | bool operator == (const AliPairDecision& d) const | |
275 | { | |
276 | return fTrackA == d.fTrackA and fTrackB == d.fTrackB and fMass == d.fMass | |
277 | and fPassedLowCut == d.fPassedLowCut and fPassedHighCut == d.fPassedHighCut | |
278 | and fUnlike == d.fUnlike and fLowPtCount == d.fLowPtCount and fHighPtCount == d.fHighPtCount; | |
279 | } | |
280 | ||
281 | bool operator != (const AliPairDecision& d) const | |
282 | { | |
283 | return not this->operator == (d); | |
284 | } | |
285 | ||
286 | private: | |
287 | ||
288 | const AliHLTMUONMansoTrack* fTrackA; ///< The first track associated with this pair decision. | |
289 | const AliHLTMUONMansoTrack* fTrackB; ///< The second track associated with this pair decision. | |
290 | Float_t fMass; ///< The invariant mass used for the trigger decision. (GeV/c^2) | |
291 | Bool_t fPassedLowCut; ///< Indicates if the track passed the low mass cut. | |
292 | Bool_t fPassedHighCut; ///< Indicates if the track passed the high mass cut. | |
293 | Bool_t fUnlike; ///< Indicates if the track pair has unlike sign. | |
294 | UChar_t fLowPtCount; ///< The number of tracks in the pair that passed the low pT cut. | |
295 | UChar_t fHighPtCount; ///< The number of tracks in the pair that passed the high pT cut. | |
296 | ||
297 | ClassDef(AliHLTMUONDecision::AliPairDecision, 2); // A track pair dHLT trigger decision object. | |
298 | }; | |
299 | ||
300 | /** | |
301 | * Constructor for creating a dHLT decision object. | |
302 | * \param nLowPt Number of tracks above low pT cut. | |
303 | * \param nHiPt Number of tracks above high pT cut. | |
304 | * \param nUnlikeAnyPt Number of track pairs with unlike sign. | |
305 | * \param nUnlikeLowPt Number of unlike sign track pairs with pT > low cut. | |
306 | * \param nUnlikeHighPt Number of unlike sign track pairs with pT > high cut. | |
307 | * \param nLikeAnyPt Number of track pairs with like sign. | |
308 | * \param nLikeLowPt Number of like sign track pairs with pT > low cut. | |
309 | * \param nLikeHighPt Number of like sign track pairs with pT > high cut. | |
310 | * \param nMassAny Number of unlike sign track pairs with invariant mass > low cut. | |
311 | * \param nMassLow Number of unlike sign track pairs with invariant mass > low mass cut and pT > low pT cut. | |
312 | * \param nMassHigh Number of unlike sign track pairs with invariant mass > high mass cut and pT > high pT cut. | |
313 | */ | |
314 | AliHLTMUONDecision( | |
315 | UInt_t nLowPt = 0, UInt_t nHiPt = 0, | |
316 | UInt_t nUnlikeAnyPt = 0, UInt_t nUnlikeLowPt = 0, UInt_t nUnlikeHighPt = 0, | |
317 | UInt_t nLikeAnyPt = 0, UInt_t nLikeLowPt = 0, UInt_t nLikeHighPt = 0, | |
318 | UInt_t nMassAny = 0, UInt_t nMassLow = 0, UInt_t nMassHigh = 0 | |
319 | ); | |
320 | ||
321 | /** | |
322 | * Default destructor. | |
323 | */ | |
324 | virtual ~AliHLTMUONDecision() {} | |
325 | ||
326 | /** | |
327 | * Returns the number of single low pT triggers. | |
328 | */ | |
329 | UInt_t NumberOfLowPtTriggers() const { return fNlowPt; } | |
330 | ||
331 | /** | |
332 | * Returns the number of single high pT triggers. | |
333 | */ | |
334 | UInt_t NumberOfHighPtTriggers() const { return fNhighPt; } | |
335 | ||
336 | /** | |
337 | * Returns the number of unlike sign pt triggers. | |
338 | */ | |
339 | UInt_t NumberOfUnlikePairs() const { return fNunlikeAnyPt; } | |
340 | ||
341 | /** | |
342 | * Returns the number of unlike sign pT triggers, where both tracks have pT > low cut. | |
343 | */ | |
344 | UInt_t NumberOfUnlikeLowPtPairs() const { return fNunlikeLowPt; } | |
345 | ||
346 | /** | |
347 | * Returns the number of unlike sign pT triggers, where both tracks have pT > high cut. | |
348 | */ | |
349 | UInt_t NumberOfUnlikeHighPtPairs() const { return fNunlikeHighPt; } | |
350 | ||
351 | /** | |
352 | * Returns the number of like sign pt triggers. | |
353 | */ | |
354 | UInt_t NumberOfLikePairs() const { return fNlikeAnyPt; } | |
355 | ||
356 | /** | |
357 | * Returns the number of like sign pT triggers, where both tracks have pT > low cut. | |
358 | */ | |
359 | UInt_t NumberOfLikeLowPtPairs() const { return fNlikeLowPt; } | |
360 | ||
361 | /** | |
362 | * Returns the number of like sign pT triggers, where both tracks have pT > high cut. | |
363 | */ | |
364 | UInt_t NumberOfLikeHighPtPairs() const { return fNlikeHighPt; } | |
365 | ||
366 | /** | |
367 | * Returns the number of invariant mass triggers. | |
368 | */ | |
369 | UInt_t NumberOfMassTriggers() const { return fNmassAny; } | |
370 | ||
371 | /** | |
372 | * Returns the number of invariant mass triggers, | |
373 | * where invariant mass > low cut and both tracks have pT > low cut. | |
374 | */ | |
375 | UInt_t NumberOfLowMassTriggers() const { return fNmassLow; } | |
376 | ||
377 | /** | |
378 | * Returns the number of invariant mass triggers, | |
379 | * where invariant mass > high cut and both tracks have pT > high cut. | |
380 | */ | |
381 | UInt_t NumberOfHighMassTriggers() const { return fNmassHigh; } | |
382 | ||
383 | /** | |
384 | * Returns the total number of single tracks that formed part of this trigger decision. | |
385 | */ | |
386 | Int_t NumberOfTracks() const { return fTrackDecisions.GetEntriesFast(); } | |
387 | ||
388 | /** | |
389 | * Returns the i'th trigger decision for a single track. | |
390 | * \param i Should be in the range [0 .. NumberOfTracks()-1] | |
391 | */ | |
392 | const AliTrackDecision* SingleTrackDecision(Int_t i) const | |
393 | { | |
394 | return static_cast<const AliTrackDecision*>(fTrackDecisions.At(i)); | |
395 | } | |
396 | ||
397 | /** | |
398 | * Returns the total number of track pairs that formed part of this trigger decision. | |
399 | */ | |
400 | Int_t NumberOfPairs() const { return fPairDecisions.GetEntriesFast(); } | |
401 | ||
402 | /** | |
403 | * Returns the i'th trigger decision for a track pair. | |
404 | * \param i Should be in the range [0 .. NumberOfPairs()-1] | |
405 | */ | |
406 | const AliPairDecision* TrackPairDecision(Int_t i) const | |
407 | { | |
408 | return static_cast<const AliPairDecision*>(fPairDecisions.At(i)); | |
409 | } | |
410 | ||
411 | /// Add a single track decision to the dHLT trigger. | |
412 | void AddDecision(const AliTrackDecision* decision); | |
413 | ||
414 | /// Add a single track decision to the dHLT trigger. | |
415 | void AddDecision( | |
416 | Float_t pt, Bool_t passedLowCut, Bool_t passedHighCut, | |
417 | const AliHLTMUONMansoTrack* track | |
418 | ); | |
419 | ||
420 | /// Add a track pair decision to the dHLT trigger. | |
421 | void AddDecision(const AliPairDecision* decision); | |
422 | ||
423 | /// Add a track pair decision to the dHLT trigger. | |
424 | void AddDecision( | |
425 | Float_t mass, Bool_t passedLowCut, | |
426 | Bool_t passedHighCut, Bool_t unlike, | |
427 | UChar_t lowPtCount, UChar_t highPtCount, | |
428 | const AliHLTMUONMansoTrack* trackA, | |
429 | const AliHLTMUONMansoTrack* trackB | |
430 | ); | |
431 | ||
432 | /** | |
433 | * Prints the details of the dHLT decision to screen. | |
434 | * @param option A case sensitive string that can contain one of the | |
435 | * following strings: | |
436 | * "compact" - Prints just the trigger scalars. | |
437 | * "detail" - Prints also the track decision list in a compact format. | |
438 | * "all" - Prints all decision information and also the track decision details. | |
439 | * If the string contains an empty option or NULL then the default is | |
440 | * to print compactly. | |
441 | */ | |
442 | virtual void Print(Option_t* option = NULL) const; | |
443 | ||
444 | // Methods inherited from TObject | |
445 | virtual Bool_t IsSortable() const { return kTRUE; } | |
446 | Int_t Compare(const TObject* obj) const; | |
447 | ||
448 | // Implement comparison operators. | |
449 | bool operator == (const AliHLTMUONDecision& track) const; | |
450 | ||
451 | bool operator != (const AliHLTMUONDecision& track) const | |
452 | { | |
453 | return not this->operator == (track); | |
454 | } | |
455 | ||
456 | private: | |
457 | ||
458 | // Do not allow copying of this class. | |
459 | AliHLTMUONDecision(const AliHLTMUONDecision& track); | |
460 | AliHLTMUONDecision& operator = (const AliHLTMUONDecision& track); | |
461 | ||
462 | UInt_t fNlowPt; ///< Number of low pt triggers. | |
463 | UInt_t fNhighPt; ///< Number of high pt triggers. | |
464 | ||
465 | /// Number of unlike sign pt triggers for both tracks having any pt. | |
466 | UInt_t fNunlikeAnyPt; | |
467 | ||
468 | /// Number of unlike sign low pt triggers where both tracks have pt > low cut. | |
469 | UInt_t fNunlikeLowPt; | |
470 | ||
471 | /// Number of unlike sign high pt triggers where both tracks have pt > high cut. | |
472 | UInt_t fNunlikeHighPt; | |
473 | ||
474 | /// Number of like sign pt triggers where both tracks have any pt. | |
475 | UInt_t fNlikeAnyPt; | |
476 | ||
477 | /// Number of like sign low pt triggers where both tracks have pt > low cut. | |
478 | UInt_t fNlikeLowPt; | |
479 | ||
480 | /// Number of like sign high pt triggers where both tracks have pt > high cut. | |
481 | UInt_t fNlikeHighPt; | |
482 | ||
483 | /// Number of pairs that have invariant mass > low mass cut, any pt and unlike sign. | |
484 | UInt_t fNmassAny; | |
485 | ||
486 | /// Number of pairs that have invariant mass > low mass cut, pt > low pt cut and unlike sign. | |
487 | UInt_t fNmassLow; | |
488 | ||
489 | /// Number of pairs that have invariant mass > high mass cut, pt > high pt cut and unlike sign. | |
490 | UInt_t fNmassHigh; | |
491 | ||
492 | TClonesArray fTrackDecisions; ///< Array of single track decision objects. | |
493 | TClonesArray fPairDecisions; ///< Array of track pair decision objects. | |
494 | ||
495 | ClassDef(AliHLTMUONDecision, 2); // Decision object containing data converted from raw internal dHLT data structures. | |
496 | }; | |
497 | ||
498 | #endif // ALIHLTMUONDECISION_H |