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