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