Line data Source code
1 : /**************************************************************************
2 : * This file is property of and copyright by the ALICE HLT Project *
3 : * All rights reserved. *
4 : * *
5 : * Primary Authors: *
6 : * Artur Szostak <artursz@iafrica.com> *
7 : * *
8 : * Permission to use, copy, modify and distribute this software and its *
9 : * documentation strictly for non-commercial purposes is hereby granted *
10 : * without fee, provided that the above copyright notice appears in all *
11 : * copies and that both the copyright notice and this permission notice *
12 : * appear in the supporting documentation. The authors make no claims *
13 : * about the suitability of this software for any purpose. It is *
14 : * provided "as is" without express or implied warranty. *
15 : **************************************************************************/
16 :
17 : // $Id: $
18 :
19 : ///
20 : /// @file AliHLTMUONDecision.cxx
21 : /// @author Artur Szostak <artursz@iafrica.com>
22 : /// @date 12 May 2008
23 : /// @brief Implementation of the AliHLTMUONDecision class.
24 : ///
25 : /// The class is used to store the dHLT decision in a more convenient ROOT
26 : /// object format for testing and analysis.
27 : ///
28 :
29 : #include "AliHLTMUONDecision.h"
30 : #include "AliHLTMUONTrack.h"
31 : #include "AliHLTMUONMansoTrack.h"
32 : #include "AliLog.h"
33 : #include <cstring>
34 : #include <iostream>
35 : #include <iomanip>
36 :
37 6 : ClassImp(AliHLTMUONDecision);
38 6 : ClassImp(AliHLTMUONDecision::AliTrackDecision);
39 6 : ClassImp(AliHLTMUONDecision::AliPairDecision);
40 :
41 :
42 : std::ostream& operator << (
43 : std::ostream& stream,
44 : const AliHLTMUONDecision& decision
45 : )
46 : {
47 : /// Stream operator for std::ostream classes.
48 : /// \param stream The output stream object being written to.
49 : /// \param track The dHLT decision object to print to the stream.
50 : /// \returns Returns 'stream'.
51 :
52 0 : stream << "No. low/high pT: [" << decision.fNlowPt
53 0 : << ", " << decision.fNhighPt
54 0 : << "]; No. any/low/high unlike: [" << decision.fNunlikeAnyPt
55 0 : << ", " << decision.fNunlikeLowPt
56 0 : << ", " << decision.fNunlikeHighPt
57 0 : << "]; No. any/low/high like = " << decision.fNlikeAnyPt
58 0 : << ", " << decision.fNlikeLowPt
59 0 : << ", " << decision.fNlikeHighPt
60 0 : << "]; No. any/low/high mass = " << decision.fNmassAny
61 0 : << ", " << decision.fNmassLow
62 0 : << ", " << decision.fNmassHigh
63 0 : << "]";
64 0 : return stream;
65 : }
66 :
67 :
68 : AliHLTMUONDecision::AliHLTMUONDecision(
69 : UInt_t nLowPt, UInt_t nHiPt,
70 : UInt_t nUnlikeAnyPt, UInt_t nUnlikeLowPt, UInt_t nUnlikeHighPt,
71 : UInt_t nLikeAnyPt, UInt_t nLikeLowPt, UInt_t nLikeHighPt,
72 : UInt_t nMassAny, UInt_t nMassLow, UInt_t nMassHigh
73 : ) :
74 0 : TObject(),
75 0 : fNlowPt(nLowPt),
76 0 : fNhighPt(nHiPt),
77 0 : fNunlikeAnyPt(nUnlikeAnyPt),
78 0 : fNunlikeLowPt(nUnlikeLowPt),
79 0 : fNunlikeHighPt(nUnlikeHighPt),
80 0 : fNlikeAnyPt(nLikeAnyPt),
81 0 : fNlikeLowPt(nLikeLowPt),
82 0 : fNlikeHighPt(nLikeHighPt),
83 0 : fNmassAny(nMassAny),
84 0 : fNmassLow(nMassLow),
85 0 : fNmassHigh(nMassHigh),
86 0 : fTrackDecisions("AliHLTMUONDecision::AliTrackDecision"),
87 0 : fPairDecisions("AliHLTMUONDecision::AliPairDecision")
88 0 : {
89 : /// Constructor for creating a dHLT decision object.
90 : /// \param nLowPt Number of tracks above low pT cut.
91 : /// \param nHiPt Number of tracks above high pT cut.
92 : /// \param nUnlikeAnyPt Number of track pairs with unlike sign.
93 : /// \param nUnlikeLowPt Number of unlike sign track pairs with pT > low cut.
94 : /// \param nUnlikeHighPt Number of unlike sign track pairs with pT > high cut.
95 : /// \param nLikeAnyPt Number of track pairs with like sign.
96 : /// \param nLikeLowPt Number of like sign track pairs with pT > low cut.
97 : /// \param nLikeHighPt Number of like sign track pairs with pT > high cut.
98 : /// \param nMassAny Number of unlike sign track pairs with invariant mass > low cut.
99 : /// \param nMassLow Number of unlike sign track pairs with invariant mass > low mass cut and pT > low pT cut.
100 : /// \param nMassHigh Number of unlike sign track pairs with invariant mass > high mass cut and pT > high pT cut.
101 0 : }
102 :
103 :
104 : void AliHLTMUONDecision::AddDecision(
105 : Float_t pt, Bool_t passedLowCut, Bool_t passedHighCut,
106 : const TObject* track
107 : )
108 : {
109 : /// Add a single track decision to the dHLT trigger.
110 : /// \param pt The calculated pT value used for the trigger decision.
111 : /// \param passedLowCut Flag indicating if the track passed the low pT cut.
112 : /// \param passedHighCut Flag indicating if the track passed the high pT cut.
113 : /// \param track Pointer to the associated track object.
114 :
115 0 : new (fTrackDecisions[fTrackDecisions.GetEntriesFast()])
116 0 : AliTrackDecision(
117 0 : pt, passedLowCut, passedHighCut, track
118 : );
119 0 : }
120 :
121 :
122 : void AliHLTMUONDecision::AddDecision(const AliTrackDecision* decision)
123 : {
124 : /// Add a single track decision to the dHLT trigger.
125 :
126 0 : new (fTrackDecisions[fTrackDecisions.GetEntriesFast()])
127 0 : AliTrackDecision(*decision);
128 0 : }
129 :
130 :
131 : void AliHLTMUONDecision::AddDecision(
132 : Float_t mass, Bool_t passedLowCut,
133 : Bool_t passedHighCut, Bool_t unlike,
134 : UChar_t lowPtCount, UChar_t highPtCount,
135 : const TObject* trackA, const TObject* trackB
136 : )
137 : {
138 : /// Add a track pair decision to the dHLT trigger.
139 : /// \param mass The invariant mass of the track pair.
140 : /// \param passedLowCut Indicates if the pair passed the low mass cut.
141 : /// \param passedHighCut Indicates if the pair passed the high mass cut.
142 : /// \param unlike Indicates if the tracks have opposite sign.
143 : /// \param lowPtCount The number of tracks in the pair that passed the low pT cut.
144 : /// Should be in the range [0..2].
145 : /// \param highPtCount The number of tracks in the pair that passed the high pT cut.
146 : /// Should be in the range [0..2].
147 : /// \param trackA Pointer to the first associated track object.
148 : /// \param trackB Pointer to the second associated track object.
149 :
150 0 : new (fPairDecisions[fPairDecisions.GetEntriesFast()])
151 0 : AliPairDecision(
152 0 : mass, passedLowCut, passedHighCut, unlike,
153 : lowPtCount, highPtCount, trackA, trackB
154 : );
155 0 : }
156 :
157 :
158 : void AliHLTMUONDecision::AddDecision(const AliPairDecision* decision)
159 : {
160 : /// Add a track pair decision to the dHLT trigger.
161 :
162 0 : new (fPairDecisions[fPairDecisions.GetEntriesFast()])
163 0 : AliPairDecision(*decision);
164 0 : }
165 :
166 :
167 : void AliHLTMUONDecision::Print(Option_t* option) const
168 : {
169 : /// Prints the trigger decision information to standard output (screen).
170 : /// \param option Can be one of the following:
171 : /// - "compact" - prints in a compact format.
172 : /// - "detail" - prints trigger information in a more detailed format.
173 : /// - "all" - prints a full dump of the trigger object.
174 :
175 : using namespace std;
176 :
177 0 : if (option == NULL or strcmp(option, "") == 0 or
178 0 : strcmp(option, "compact") == 0
179 : )
180 : {
181 0 : cout << *this << endl;
182 0 : }
183 0 : else if (strcmp(option, "detail") == 0)
184 : {
185 0 : cout << "dHLT trigger decision scalars:" << endl;
186 0 : cout << "No. tracks passed pT cut," << endl;
187 0 : cout << " low = " << fNlowPt << endl;
188 0 : cout << " high = " << fNhighPt << endl;
189 0 : cout << "No. unlike sign pairs," << endl;
190 0 : cout << " total = " << fNunlikeAnyPt << endl;
191 0 : cout << " pT > low cut = " << fNunlikeLowPt << endl;
192 0 : cout << " pT > high cut = " << fNunlikeHighPt << endl;
193 0 : cout << "No. like sign pairs," << endl;
194 0 : cout << " total = " << fNlikeAnyPt << endl;
195 0 : cout << " pT > low cut = " << fNlikeLowPt << endl;
196 0 : cout << " pT > high cut = " << fNlikeHighPt << endl;
197 0 : cout << "No. pairs with," << endl;
198 0 : cout << " invariant mass > low cut = " << fNmassAny << endl;
199 0 : cout << " invariant mass and pT > low cut = " << fNmassLow << endl;
200 0 : cout << " invariant mass and pT > high cut = " << fNmassHigh << endl;
201 :
202 0 : streamsize w = cout.width();
203 0 : ios::fmtflags f = cout.flags();
204 0 : cout << "Triggers for single tracks:" << endl;
205 0 : cout << setw(10) << "" << setw(12) << "pT " << setw(15) << "Passed pT cut" << endl;
206 0 : cout << setw(10) << "Track" << setw(12) << "(GeV/c)" << setw(6) << "low "
207 0 : << setw(3) << " | " << setw(6) << "high" << endl;
208 0 : for (Int_t i = 0; i < NumberOfTracks(); i++)
209 : {
210 0 : const AliTrackDecision* decision = SingleTrackDecision(i);
211 0 : if (decision == NULL) continue;
212 :
213 0 : if (decision->MansoTrack() != NULL)
214 : {
215 0 : cout << setw(10) << decision->MansoTrack()->Id();
216 0 : }
217 0 : else if (decision->FullTrack() != NULL)
218 : {
219 0 : cout << setw(10) << decision->FullTrack()->Id();
220 0 : }
221 : else
222 : {
223 0 : cout << setw(10) << "-";
224 : }
225 :
226 0 : cout << setw(12) << decision->Pt()
227 0 : << setw(6) << (decision->PassedLowPtCut() ? "yes" : "no")
228 0 : << setw(3) << " "
229 0 : << setw(6) << (decision->PassedHighPtCut() ? "yes" : "no")
230 0 : << endl;
231 0 : }
232 0 : cout << "Triggers for track pairs:" << endl;
233 0 : cout << setw(20) << "Track pair" << setw(6) << "Like" << setw(12) << "mass "
234 0 : << setw(17) << "Passed mass cut"
235 0 : << setw(20) << "No. with pT > than" << endl;
236 0 : cout << setw(10) << "track A" << setw(10) << "track B"
237 0 : << setw(6) << "sign" << setw(12) << "(GeV/c^2)"
238 0 : << setw(8) << "low " << setw(3) << " | " << setw(6) << "high"
239 0 : << setw(11) << "low " << setw(3) << " | " << setw(6) << "high" << endl;
240 0 : for (Int_t j = 0; j < NumberOfPairs(); j++)
241 : {
242 0 : const AliPairDecision* decision = TrackPairDecision(j);
243 0 : if (decision == NULL) continue;
244 :
245 0 : if (decision->MansoTrackA() != NULL)
246 : {
247 0 : cout << setw(10) << decision->MansoTrackA()->Id();
248 0 : }
249 0 : else if (decision->FullTrackA() != NULL)
250 : {
251 0 : cout << setw(10) << decision->FullTrackA()->Id();
252 0 : }
253 : else
254 : {
255 0 : cout << setw(10) << "-";
256 : }
257 :
258 0 : if (decision->MansoTrackB() != NULL)
259 : {
260 0 : cout << setw(10) << decision->MansoTrackB()->Id();
261 0 : }
262 0 : else if (decision->FullTrackB() != NULL)
263 : {
264 0 : cout << setw(10) << decision->FullTrackB()->Id();
265 0 : }
266 : else
267 : {
268 0 : cout << setw(10) << "-";
269 : }
270 :
271 0 : cout << setw(6) << (decision->LikeSign() ? "yes" : "no")
272 0 : << setw(12) << decision->Mass()
273 0 : << setw(8) << (decision->PassedLowMassCut() ? "yes" : "no")
274 0 : << setw(3) << " "
275 0 : << setw(6) << (decision->PassedHighMassCut() ? "yes" : "no")
276 0 : << setw(11) << Int_t(decision->NumberPassedLowPtCut())
277 0 : << setw(3) << " "
278 0 : << setw(6) << Int_t(decision->NumberPassedHighPtCut())
279 0 : << endl;
280 0 : }
281 0 : cout.width(w); // reset the field width to previous value.
282 0 : cout.flags(f); // reset the flags to previous values.
283 0 : }
284 0 : else if (strcmp(option, "all") == 0)
285 : {
286 0 : cout << "dHLT trigger decision scalars:" << endl;
287 0 : cout << "No. tracks passed pT cut," << endl;
288 0 : cout << " low = " << fNlowPt << endl;
289 0 : cout << " high = " << fNhighPt << endl;
290 0 : cout << "No. unlike sign pairs," << endl;
291 0 : cout << " total = " << fNunlikeAnyPt << endl;
292 0 : cout << " pT > low cut = " << fNunlikeLowPt << endl;
293 0 : cout << " pT > high cut = " << fNunlikeHighPt << endl;
294 0 : cout << "No. like sign pairs," << endl;
295 0 : cout << " total = " << fNlikeAnyPt << endl;
296 0 : cout << " pT > low cut = " << fNlikeLowPt << endl;
297 0 : cout << " pT > high cut = " << fNlikeHighPt << endl;
298 0 : cout << "No. pairs with," << endl;
299 0 : cout << " invariant mass > low cut = " << fNmassAny << endl;
300 0 : cout << " invariant mass and pT > low cut = " << fNmassLow << endl;
301 0 : cout << " invariant mass and pT > high cut = " << fNmassHigh << endl;
302 :
303 0 : cout << "===============================================" << endl;
304 0 : cout << "========== Triggers for single tracks: ========" << endl;
305 0 : for (Int_t i = 0; i < NumberOfTracks(); i++)
306 : {
307 0 : const AliTrackDecision* decision = SingleTrackDecision(i);
308 0 : if (decision == NULL) continue;
309 0 : decision->Print("all");
310 0 : }
311 0 : if (NumberOfTracks() == 0) cout << "(None)" << endl;
312 0 : cout << "===============================================" << endl;
313 0 : cout << "========== Triggers for track pairs: ==========" << endl;
314 0 : for (Int_t j = 0; j < NumberOfPairs(); j++)
315 : {
316 0 : const AliPairDecision* decision = TrackPairDecision(j);
317 0 : if (decision == NULL) continue;
318 0 : decision->Print("all");
319 0 : }
320 0 : if (NumberOfPairs() == 0) cout << "(None)" << endl;
321 : }
322 : else
323 : {
324 0 : AliError("Unknown option specified. Can only be one of 'compact',"
325 : " 'detail' or 'all'."
326 : );
327 : }
328 0 : }
329 :
330 :
331 : Int_t AliHLTMUONDecision::Compare(const TObject* obj) const
332 : {
333 : /// We compare this object with 'obj' first by the trigger scalars and then
334 : /// by the signle track and track pair decision lists.
335 : /// \param obj This is the object to compare to. It must be of type AliHLTMUONDecision.
336 : /// \returns -1 if 'this' is smaller than 'obj', 1 if greater and zero if both
337 : /// objects are the same.
338 :
339 0 : if (obj->IsA() == AliHLTMUONDecision::Class())
340 : {
341 : const AliHLTMUONDecision* d =
342 0 : static_cast<const AliHLTMUONDecision*>(obj);
343 0 : if (fNlowPt < d->fNlowPt) return -1;
344 0 : if (fNlowPt > d->fNlowPt) return 1;
345 0 : if (fNhighPt < d->fNhighPt) return -1;
346 0 : if (fNhighPt > d->fNhighPt) return 1;
347 0 : if (fNunlikeAnyPt < d->fNunlikeAnyPt) return -1;
348 0 : if (fNunlikeAnyPt > d->fNunlikeAnyPt) return 1;
349 0 : if (fNunlikeLowPt < d->fNunlikeLowPt) return -1;
350 0 : if (fNunlikeLowPt > d->fNunlikeLowPt) return 1;
351 0 : if (fNunlikeHighPt < d->fNunlikeHighPt) return -1;
352 0 : if (fNunlikeHighPt > d->fNunlikeHighPt) return 1;
353 0 : if (fNlikeAnyPt < d->fNlikeAnyPt) return -1;
354 0 : if (fNlikeAnyPt > d->fNlikeAnyPt) return 1;
355 0 : if (fNlikeLowPt < d->fNlikeLowPt) return -1;
356 0 : if (fNlikeLowPt > d->fNlikeLowPt) return 1;
357 0 : if (fNlikeHighPt < d->fNlikeHighPt) return -1;
358 0 : if (fNlikeHighPt > d->fNlikeHighPt) return 1;
359 0 : if (fNmassAny < d->fNmassAny) return -1;
360 0 : if (fNmassAny > d->fNmassAny) return 1;
361 0 : if (fNmassLow < d->fNmassLow) return -1;
362 0 : if (fNmassLow > d->fNmassLow) return 1;
363 0 : if (fNmassHigh < d->fNmassHigh) return -1;
364 0 : if (fNmassHigh > d->fNmassHigh) return 1;
365 :
366 : // Now check the track decision arrays.
367 0 : if (NumberOfTracks() < d->NumberOfTracks()) return -1;
368 0 : if (NumberOfTracks() > d->NumberOfTracks()) return 1;
369 0 : for (Int_t i = 0; i < NumberOfTracks(); i++)
370 : {
371 0 : Int_t result = SingleTrackDecision(i)->Compare( d->SingleTrackDecision(i) );
372 0 : if (result != 0) return result;
373 0 : }
374 0 : if (NumberOfPairs() < d->NumberOfPairs()) return -1;
375 0 : if (NumberOfPairs() > d->NumberOfPairs()) return 1;
376 0 : for (Int_t j = 0; j < NumberOfPairs(); j++)
377 : {
378 0 : Int_t result = TrackPairDecision(j)->Compare( d->TrackPairDecision(j) );
379 0 : if (result != 0) return result;
380 0 : }
381 :
382 : // At this point everything was equal so return 0 to indicate this fact.
383 0 : return 0;
384 : }
385 : else
386 : {
387 0 : AliError(Form("Do not know how to compare %s to %s.",
388 : this->ClassName(),
389 : obj->ClassName()
390 : ));
391 0 : return -999;
392 : }
393 0 : }
394 :
395 :
396 : bool AliHLTMUONDecision::operator == (const AliHLTMUONDecision& decision) const
397 : {
398 : /// Comparison operator just compares if the scalars are the same.
399 : /// \param decision The trigger decision object to compare to.
400 : /// \returns true if 'this' object has the same scalars as 'decision', else false.
401 :
402 0 : return fNlowPt == decision.fNlowPt
403 0 : and fNhighPt == decision.fNhighPt
404 0 : and fNunlikeAnyPt == decision.fNunlikeAnyPt
405 0 : and fNunlikeLowPt == decision.fNunlikeLowPt
406 0 : and fNunlikeHighPt == decision.fNunlikeHighPt
407 0 : and fNlikeAnyPt == decision.fNlikeAnyPt
408 0 : and fNlikeLowPt == decision.fNlikeLowPt
409 0 : and fNlikeHighPt == decision.fNlikeHighPt
410 0 : and fNmassAny == decision.fNmassAny
411 0 : and fNmassLow == decision.fNmassLow
412 0 : and fNmassHigh == decision.fNmassHigh;
413 : }
414 :
415 :
416 : std::ostream& operator << (
417 : std::ostream& stream,
418 : const AliHLTMUONDecision::AliTrackDecision& decision
419 : )
420 : {
421 : /// Stream operator for std::ostream classes.
422 : /// \param stream The output stream object being written to.
423 : /// \param track The dHLT decision object to print to the stream.
424 : /// \returns Returns 'stream'.
425 :
426 0 : stream << "Passed low/high pT cut: [" << (decision.fPassedLowCut ? "yes" : "no")
427 0 : << ", " << (decision.fPassedHighCut ? "yes" : "no")
428 0 : << "]; with pT = " << decision.fPt;
429 0 : return stream;
430 : }
431 :
432 :
433 : const AliHLTMUONMansoTrack* AliHLTMUONDecision::AliTrackDecision::MansoTrack() const
434 : {
435 : /// Returns the associated track as a Manso track object and NULL if the track
436 : /// object is missing or not a Manso track object.
437 :
438 0 : if (fTrack == NULL) return NULL;
439 0 : return dynamic_cast<const AliHLTMUONMansoTrack*>(fTrack);
440 0 : }
441 :
442 :
443 : const AliHLTMUONTrack* AliHLTMUONDecision::AliTrackDecision::FullTrack() const
444 : {
445 : /// Returns the associated track as a full track object and NULL if the track
446 : /// object is missing or not a full track object.
447 :
448 0 : if (fTrack == NULL) return NULL;
449 0 : return dynamic_cast<const AliHLTMUONTrack*>(fTrack);
450 0 : }
451 :
452 :
453 : void AliHLTMUONDecision::AliTrackDecision::Print(Option_t* option) const
454 : {
455 : /// Prints the trigger decision to standard output (screen).
456 : /// \param option Can be one of the following:
457 : /// - "compact" - prints in a compact format.
458 : /// - "detail" - prints trigger information in a more detailed format.
459 : /// - "all" - prints a full dump of the trigger object.
460 :
461 : using namespace std;
462 :
463 0 : if (option == NULL or strcmp(option, "") == 0 or
464 0 : strcmp(option, "compact") == 0
465 : )
466 : {
467 0 : cout << *this << endl;
468 0 : }
469 0 : else if (strcmp(option, "detail") == 0)
470 : {
471 : Int_t id = -1;
472 0 : if (MansoTrack() != NULL) id = MansoTrack()->Id();
473 0 : else if (FullTrack() != NULL) id = FullTrack()->Id();
474 0 : cout << "Trigger decision for track: " << id << endl;
475 0 : cout << "pT = " << fPt << " GeV/c" << endl;
476 0 : cout << "pT cut | passed" << endl;
477 0 : cout << "-------+--------" << endl;
478 0 : cout << " low | " << (fPassedLowCut ? "yes" : "no") << endl;
479 0 : cout << " high | " << (fPassedHighCut ? "yes" : "no") << endl;
480 0 : }
481 0 : else if (strcmp(option, "all") == 0)
482 : {
483 : Int_t id = -1;
484 0 : if (MansoTrack() != NULL) id = MansoTrack()->Id();
485 0 : else if (FullTrack() != NULL) id = FullTrack()->Id();
486 0 : cout << "Trigger decision for track: " << id << endl;
487 0 : cout << "pT = " << fPt << " GeV/c" << endl;
488 0 : cout << "pT cut | passed" << endl;
489 0 : cout << "-------+--------" << endl;
490 0 : cout << " low | " << (fPassedLowCut ? "yes" : "no") << endl;
491 0 : cout << " high | " << (fPassedHighCut ? "yes" : "no") << endl;
492 0 : cout << "===== Track details =====" << endl;
493 0 : fTrack->Print("all");
494 0 : }
495 : else
496 : {
497 0 : AliError("Unknown option specified. Can only be one of 'compact',"
498 : " 'detail' or 'all'."
499 : );
500 : }
501 0 : }
502 :
503 :
504 : Int_t AliHLTMUONDecision::AliTrackDecision::Compare(const TObject* obj) const
505 : {
506 : /// We compare this object with 'obj' field by field.
507 : /// \param obj This is the object to compare to. It must be of type
508 : /// AliHLTMUONDecision::AliTrackDecision.
509 : /// \returns -1 if 'this' is smaller than 'obj', 1 if greater and zero if both
510 : /// objects are the same.
511 :
512 0 : if (obj->IsA() == AliHLTMUONDecision::Class())
513 : {
514 : const AliHLTMUONDecision::AliTrackDecision* d =
515 0 : static_cast<const AliHLTMUONDecision::AliTrackDecision*>(obj);
516 0 : if (fPt < d->fPt) return -1;
517 0 : if (fPt > d->fPt) return 1;
518 0 : if (fPassedLowCut < d->fPassedLowCut) return -1;
519 0 : if (fPassedLowCut > d->fPassedLowCut) return 1;
520 0 : if (fPassedHighCut < d->fPassedHighCut) return -1;
521 0 : if (fPassedHighCut > d->fPassedHighCut) return 1;
522 0 : return fTrack->Compare(d->fTrack);
523 : }
524 : else
525 : {
526 0 : AliError(Form("Do not know how to compare %s to %s.",
527 : this->ClassName(),
528 : obj->ClassName()
529 : ));
530 0 : return -999;
531 : }
532 0 : }
533 :
534 :
535 : std::ostream& operator << (
536 : std::ostream& stream,
537 : const AliHLTMUONDecision::AliPairDecision& decision
538 : )
539 : {
540 : /// Stream operator for std::ostream classes.
541 : /// \param stream The output stream object being written to.
542 : /// \param track The dHLT decision object to print to the stream.
543 : /// \returns Returns 'stream'.
544 :
545 0 : stream << (decision.fUnlike ? "Unlike" : "Like")
546 0 : << " sign pair passed low/high mass cut: [" << (decision.fPassedLowCut ? "yes" : "no")
547 0 : << ", " << (decision.fPassedHighCut ? "yes" : "no")
548 0 : << "]; with mass = " << decision.fMass;
549 0 : return stream;
550 : }
551 :
552 :
553 : const AliHLTMUONMansoTrack* AliHLTMUONDecision::AliPairDecision::MansoTrackA() const
554 : {
555 : /// Returns the first associated track as a Manso track object and NULL if the
556 : /// track object is missing or not a Manso track object.
557 :
558 0 : if (fTrackA == NULL) return NULL;
559 0 : return dynamic_cast<const AliHLTMUONMansoTrack*>(fTrackA);
560 0 : }
561 :
562 :
563 : const AliHLTMUONTrack* AliHLTMUONDecision::AliPairDecision::FullTrackA() const
564 : {
565 : /// Returns the first associated track as a full track object and NULL if the
566 : /// track object is missing or not a full track object.
567 :
568 0 : if (fTrackA == NULL) return NULL;
569 0 : return dynamic_cast<const AliHLTMUONTrack*>(fTrackA);
570 0 : }
571 :
572 :
573 : const AliHLTMUONMansoTrack* AliHLTMUONDecision::AliPairDecision::MansoTrackB() const
574 : {
575 : /// Returns the second associated track as a Manso track object and NULL if the
576 : /// track object is missing or not a Manso track object.
577 :
578 0 : if (fTrackB == NULL) return NULL;
579 0 : return dynamic_cast<const AliHLTMUONMansoTrack*>(fTrackB);
580 0 : }
581 :
582 :
583 : const AliHLTMUONTrack* AliHLTMUONDecision::AliPairDecision::FullTrackB() const
584 : {
585 : /// Returns the second associated track as a full track object and NULL if the
586 : /// track object is missing or not a full track object.
587 :
588 0 : if (fTrackB == NULL) return NULL;
589 0 : return dynamic_cast<const AliHLTMUONTrack*>(fTrackB);
590 0 : }
591 :
592 :
593 : void AliHLTMUONDecision::AliPairDecision::Print(Option_t* option) const
594 : {
595 : /// Prints the trigger decision to standard output (screen).
596 : /// \param option Can be one of the following:
597 : /// - "compact" - prints in a compact format.
598 : /// - "detail" - prints trigger information in a more detailed format.
599 : /// - "all" - prints a full dump of the trigger object.
600 :
601 : using namespace std;
602 :
603 0 : if (option == NULL or strcmp(option, "") == 0 or
604 0 : strcmp(option, "compact") == 0
605 : )
606 : {
607 0 : cout << *this << endl;
608 0 : }
609 0 : else if (strcmp(option, "detail") == 0)
610 : {
611 : Int_t id1 = -1;
612 0 : if (MansoTrackA() != NULL) id1 = MansoTrackA()->Id();
613 0 : else if (FullTrackA() != NULL) id1 = FullTrackA()->Id();
614 : Int_t id2 = -1;
615 0 : if (MansoTrackB() != NULL) id2 = MansoTrackB()->Id();
616 0 : else if (FullTrackB() != NULL) id2 = FullTrackB()->Id();
617 0 : cout << "Trigger decision for track pair: {" << id1
618 0 : << ", " << id2 << "}" << endl;
619 0 : cout << "Invariant mass = " << fMass << " GeV/c^2" << endl;
620 0 : cout << "mass cut | passed" << endl;
621 0 : cout << "---------+--------" << endl;
622 0 : cout << " low | " << (fPassedLowCut ? "yes" : "no") << endl;
623 0 : cout << " high | " << (fPassedHighCut ? "yes" : "no") << endl;
624 0 : cout << "Number of tracks in pair that passed," << endl;
625 0 : cout << " low pT cut = " << Int_t(fLowPtCount) << endl;
626 0 : cout << " high pT cut = " << Int_t(fHighPtCount) << endl;
627 0 : }
628 0 : else if (strcmp(option, "all") == 0)
629 : {
630 : Int_t id1 = -1;
631 0 : if (MansoTrackA() != NULL) id1 = MansoTrackA()->Id();
632 0 : else if (FullTrackA() != NULL) id1 = FullTrackA()->Id();
633 : Int_t id2 = -1;
634 0 : if (MansoTrackB() != NULL) id2 = MansoTrackB()->Id();
635 0 : else if (FullTrackB() != NULL) id2 = FullTrackB()->Id();
636 0 : cout << "Trigger decision for track pair: {" << id1
637 0 : << ", " << id2 << "}" << endl;
638 0 : cout << "Invariant mass = " << fMass << " GeV/c^2" << endl;
639 0 : cout << "mass cut | passed" << endl;
640 0 : cout << "---------+--------" << endl;
641 0 : cout << " low | " << (fPassedLowCut ? "yes" : "no") << endl;
642 0 : cout << " high | " << (fPassedHighCut ? "yes" : "no") << endl;
643 0 : cout << "Number of tracks in pair that passed," << endl;
644 0 : cout << " low pT cut = " << Int_t(fLowPtCount) << endl;
645 0 : cout << " high pT cut = " << Int_t(fHighPtCount) << endl;
646 0 : cout << "===== First track details =====" << endl;
647 0 : fTrackA->Print("all");
648 0 : cout << "===== Second track details =====" << endl;
649 0 : fTrackB->Print("all");
650 0 : }
651 : else
652 : {
653 0 : AliError("Unknown option specified. Can only be one of 'compact',"
654 : " 'detail' or 'all'."
655 : );
656 : }
657 0 : }
658 :
659 :
660 : Int_t AliHLTMUONDecision::AliPairDecision::Compare(const TObject* obj) const
661 : {
662 : /// We compare this object with 'obj' field by field.
663 : /// \param obj This is the object to compare to. It must be of type
664 : /// AliHLTMUONDecision::AliPairDecision.
665 : /// \returns -1 if 'this' is smaller than 'obj', 1 if greater and zero if both
666 : /// objects are the same.
667 :
668 0 : if (obj->IsA() == AliHLTMUONDecision::Class())
669 : {
670 : const AliHLTMUONDecision::AliPairDecision* d =
671 0 : static_cast<const AliHLTMUONDecision::AliPairDecision*>(obj);
672 0 : if (fMass < d->fMass) return -1;
673 0 : if (fMass > d->fMass) return 1;
674 0 : if (fPassedLowCut < d->fPassedLowCut) return -1;
675 0 : if (fPassedLowCut > d->fPassedLowCut) return 1;
676 0 : if (fPassedHighCut < d->fPassedHighCut) return -1;
677 0 : if (fPassedHighCut > d->fPassedHighCut) return 1;
678 0 : if (fUnlike < d->fUnlike) return -1;
679 0 : if (fUnlike > d->fUnlike) return 1;
680 0 : if (fLowPtCount < d->fLowPtCount) return -1;
681 0 : if (fLowPtCount > d->fLowPtCount) return 1;
682 0 : if (fHighPtCount < d->fHighPtCount) return -1;
683 0 : if (fHighPtCount > d->fHighPtCount) return 1;
684 0 : Int_t result = fTrackA->Compare(d->fTrackA);
685 0 : if (result != 0) return result;
686 0 : return fTrackB->Compare(d->fTrackB);
687 : }
688 : else
689 : {
690 0 : AliError(Form("Do not know how to compare %s to %s.",
691 : this->ClassName(),
692 : obj->ClassName()
693 : ));
694 0 : return -999;
695 : }
696 0 : }
697 :
|