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