]>
Commit | Line | Data |
---|---|---|
cb0f5af6 | 1 | // |
2 | // Class AliRsnCutMomentumComparison | |
3 | // | |
4 | // General implementation of a single cut strategy, which can be: | |
5 | // - a value contained in a given interval [--> IsBetween() ] | |
6 | // - a value equal to a given reference [--> MatchesValue()] | |
7 | // | |
8 | // In all cases, the reference value(s) is (are) given as data members | |
9 | // and each kind of cut requires a given value type (Int, UInt, Double), | |
10 | // but the cut check procedure is then automatized and chosen thanks to | |
11 | // an enumeration of the implemented cut types. | |
12 | // At the end, the user (or any other point which uses this object) has | |
13 | // to use the method IsSelected() to check if this cut has been passed. | |
14 | // | |
15 | // authors: Martin Vala (martin.vala@cern.ch) | |
16 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
17 | // | |
18 | #include "TMath.h" | |
19 | ||
20 | #include "AliRsnDaughter.h" | |
21 | #include "AliRsnMother.h" | |
22 | #include "AliRsnCutMomentumComparison.h" | |
23 | ||
24 | ClassImp(AliRsnCutMomentumComparison) | |
25 | ||
26 | //_________________________________________________________________________________________________ | |
27 | AliRsnCutMomentumComparison::AliRsnCutMomentumComparison(const char *name, EMode mode) : | |
28 | AliRsnCut(name, AliRsnCut::kMother), | |
29 | fMode(mode) | |
30 | { | |
31 | // | |
32 | // Default constructor. | |
33 | // | |
34 | } | |
35 | ||
36 | //_________________________________________________________________________________________________ | |
37 | AliRsnCutMomentumComparison::AliRsnCutMomentumComparison(const AliRsnCutMomentumComparison& copy) : | |
38 | AliRsnCut(copy), | |
39 | fMode(copy.fMode) | |
40 | { | |
41 | // | |
42 | // Copy constructor | |
43 | // | |
44 | } | |
45 | ||
46 | //_________________________________________________________________________________________________ | |
47 | AliRsnCutMomentumComparison& AliRsnCutMomentumComparison::operator=(const AliRsnCutMomentumComparison& copy) | |
48 | { | |
49 | // | |
50 | // Assignment operator | |
51 | // | |
52 | ||
53 | AliRsnCut::operator=(copy); | |
54 | fMode = copy.fMode; | |
bfe5cdb3 | 55 | |
56 | return (*this); | |
cb0f5af6 | 57 | } |
58 | ||
59 | //_________________________________________________________________________________________________ | |
60 | Bool_t AliRsnCutMomentumComparison::IsSelected(TObject *object) | |
61 | { | |
62 | // | |
63 | // Cut checker. | |
64 | // | |
65 | ||
66 | // convert the object into the unique correct type | |
99261e24 | 67 | if (!TargetOK(object)) return kFALSE; |
cb0f5af6 | 68 | |
69 | // compare momenta | |
99261e24 | 70 | Double_t p1 = fMother->GetDaughter(0)->GetRef()->P(); |
71 | Double_t p2 = fMother->GetDaughter(1)->GetRef()->P(); | |
72 | Double_t pt1 = fMother->GetDaughter(0)->GetRef()->Pt(); | |
73 | Double_t pt2 = fMother->GetDaughter(1)->GetRef()->Pt(); | |
cb0f5af6 | 74 | |
75 | switch (fMode) | |
76 | { | |
77 | case kFirstLargerP : return (p1 > p2); | |
78 | case kFirstSmallerP : return (p1 < p2); | |
79 | case kFirstLargerPt : return (pt1 > pt2); | |
80 | case kFirstSmallerPt: return (pt1 < pt2); | |
81 | default: | |
82 | AliError("Invalid mode selected. Cut is skipped"); | |
83 | return kTRUE; | |
84 | } | |
85 | } |