]>
Commit | Line | Data |
---|---|---|
69fbb331 | 1 | // |
32992791 | 2 | // *** Class AliRsnCutValue *** |
69fbb331 | 3 | // |
2a1c7696 | 4 | // This cut implementation can be used to cut generically on |
32992791 | 5 | // any value which can be computed from AliRsnValue class. |
6 | // Since that value is implemented always as a Double_t one, | |
7 | // then this cut operates only with the Double_t data members | |
8 | // of the AliRsnCut base class. | |
9 | // It allows to cusomize the reference AliRsnValue object by | |
10 | // means of a getter that returns a pointer to it. | |
11 | // This cut can apply to any kind of object, but the type of | |
12 | // target must be one of those for which the chosen value type | |
13 | // makes sense to be computed | |
69fbb331 | 14 | // |
32992791 | 15 | // author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) |
69fbb331 | 16 | // |
69fbb331 | 17 | |
b63357a0 | 18 | #include "AliRsnValue.h" |
69fbb331 | 19 | #include "AliRsnDaughter.h" |
20 | #include "AliRsnMother.h" | |
21 | #include "AliRsnEvent.h" | |
32992791 | 22 | #include "AliRsnPairDef.h" |
69fbb331 | 23 | |
24 | #include "AliRsnCutValue.h" | |
25 | ||
26 | ClassImp(AliRsnCutValue) | |
27 | ||
28 | //_________________________________________________________________________________________________ | |
29 | AliRsnCutValue::AliRsnCutValue() : | |
2a1c7696 | 30 | AliRsnCut(), |
c865cb1d | 31 | fValue(0x0) |
69fbb331 | 32 | { |
33 | // | |
34 | // Default constructor. | |
35 | // | |
36 | } | |
37 | ||
38 | //_________________________________________________________________________________________________ | |
39 | AliRsnCutValue::AliRsnCutValue | |
f34f960b | 40 | (const char *name, Double_t min, Double_t max) : |
c865cb1d | 41 | AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max), |
c865cb1d | 42 | fValue(0x0) |
69fbb331 | 43 | { |
44 | // | |
45 | // Main constructor. | |
07d7c31d | 46 | // Sets the AliRsnValue data member accordingly to arguments passed here. |
47 | // NOTE: if the value needs a support object, it must be passed separately | |
48 | // using the GetValueObje() of this class | |
69fbb331 | 49 | // |
50 | } | |
51 | ||
52 | //_________________________________________________________________________________________________ | |
53 | AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) : | |
2a1c7696 | 54 | AliRsnCut(copy), |
07d7c31d | 55 | fValue(copy.fValue) |
69fbb331 | 56 | { |
57 | // | |
32992791 | 58 | // Copy constructor. |
59 | // Does not duplicate memory allocation. | |
69fbb331 | 60 | // |
61 | } | |
62 | ||
63 | //_________________________________________________________________________________________________ | |
64 | AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy) | |
65 | { | |
66 | // | |
32992791 | 67 | // Assignment operator. |
68 | // Does not duplicate memory allocation. | |
69fbb331 | 69 | // |
70 | ||
2a1c7696 | 71 | AliRsnCut::operator=(copy); |
07d7c31d | 72 | fValue = copy.fValue; |
2a1c7696 | 73 | |
74 | return (*this); | |
69fbb331 | 75 | } |
76 | ||
77 | //_________________________________________________________________________________________________ | |
32992791 | 78 | Bool_t AliRsnCutValue::IsSelected(TObject *object) |
69fbb331 | 79 | { |
80 | // | |
81 | // Checks the cut. | |
32992791 | 82 | // Calls the AliRsnValue::Eval() method and then checks its output. |
69fbb331 | 83 | // |
84 | ||
c865cb1d | 85 | // skip cut if value is not initialized |
86 | if (!fValue) return kTRUE; | |
87 | ||
88 | // match target types | |
89 | SetTargetType(fValue->GetTargetType()); | |
90 | ||
2a1c7696 | 91 | // try to compute values |
f34f960b | 92 | Bool_t success = fValue->Eval(object); |
2a1c7696 | 93 | |
94 | // check success | |
95 | if (!success) { | |
96 | AliWarning(Form("[%s] Failed to compute value", GetName())); | |
97 | return kFALSE; | |
98 | } | |
99 | ||
100 | // check in range | |
c865cb1d | 101 | fCutValueD = fValue->GetComputedValue(); |
2a1c7696 | 102 | return OkRangeD(); |
69fbb331 | 103 | } |
aa24e021 | 104 | |
105 | //_________________________________________________________________________________________________ | |
106 | void AliRsnCutValue::Print(const Option_t *) const | |
107 | { | |
108 | // | |
109 | // Print information on this cut | |
110 | // | |
111 | ||
2a1c7696 | 112 | AliInfo(Form("Cut name : %s", GetName())); |
c865cb1d | 113 | AliInfo(Form("Cut value : %s", fValue->GetName())); |
2a1c7696 | 114 | AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD)); |
aa24e021 | 115 | } |