]>
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 | |
69fbb331 | 18 | #include "AliRsnDaughter.h" |
19 | #include "AliRsnMother.h" | |
20 | #include "AliRsnEvent.h" | |
32992791 | 21 | #include "AliRsnPairDef.h" |
69fbb331 | 22 | |
23 | #include "AliRsnCutValue.h" | |
24 | ||
25 | ClassImp(AliRsnCutValue) | |
26 | ||
27 | //_________________________________________________________________________________________________ | |
28 | AliRsnCutValue::AliRsnCutValue() : | |
2a1c7696 | 29 | AliRsnCut(), |
30 | fValue(), | |
31 | fPairDef(0x0) | |
69fbb331 | 32 | { |
33 | // | |
34 | // Default constructor. | |
35 | // | |
32992791 | 36 | |
2a1c7696 | 37 | SetTargetType(fValue.GetTargetType()); |
69fbb331 | 38 | } |
39 | ||
40 | //_________________________________________________________________________________________________ | |
41 | AliRsnCutValue::AliRsnCutValue | |
32992791 | 42 | (const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd) : |
2a1c7696 | 43 | AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max), |
44 | fValue(Form("val_%s", name), type), | |
45 | fPairDef(pd) | |
69fbb331 | 46 | { |
47 | // | |
48 | // Main constructor. | |
32992791 | 49 | // Recalls the setter for the value type of the AliRsnValue data member, |
50 | // which determines also the type of target to be expected | |
69fbb331 | 51 | // |
32992791 | 52 | |
2a1c7696 | 53 | SetTargetType(fValue.GetTargetType()); |
69fbb331 | 54 | } |
55 | ||
56 | //_________________________________________________________________________________________________ | |
57 | AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) : | |
2a1c7696 | 58 | AliRsnCut(copy), |
59 | fValue(copy.fValue), | |
60 | fPairDef(copy.fPairDef) | |
69fbb331 | 61 | { |
62 | // | |
32992791 | 63 | // Copy constructor. |
64 | // Does not duplicate memory allocation. | |
69fbb331 | 65 | // |
32992791 | 66 | |
2a1c7696 | 67 | SetTargetType(fValue.GetTargetType()); |
69fbb331 | 68 | } |
69 | ||
70 | //_________________________________________________________________________________________________ | |
71 | AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy) | |
72 | { | |
73 | // | |
32992791 | 74 | // Assignment operator. |
75 | // Does not duplicate memory allocation. | |
69fbb331 | 76 | // |
77 | ||
2a1c7696 | 78 | AliRsnCut::operator=(copy); |
79 | ||
80 | fValue = copy.fValue; | |
81 | fPairDef = copy.fPairDef; | |
82 | SetTargetType(fValue.GetTargetType()); | |
83 | ||
84 | return (*this); | |
69fbb331 | 85 | } |
86 | ||
87 | //_________________________________________________________________________________________________ | |
32992791 | 88 | Bool_t AliRsnCutValue::IsSelected(TObject *object) |
69fbb331 | 89 | { |
90 | // | |
91 | // Checks the cut. | |
32992791 | 92 | // Calls the AliRsnValue::Eval() method and then checks its output. |
69fbb331 | 93 | // |
94 | ||
2a1c7696 | 95 | // make sure that target of this object matches that |
96 | // of the inserted value object | |
97 | SetTargetType(fValue.GetTargetType()); | |
98 | ||
99 | // try to compute values | |
100 | Bool_t success = fValue.Eval(object); | |
101 | ||
102 | // check success | |
103 | if (!success) { | |
104 | AliWarning(Form("[%s] Failed to compute value", GetName())); | |
105 | return kFALSE; | |
106 | } | |
107 | ||
108 | // check in range | |
109 | fCutValueD = fValue.GetComputedValue(); | |
110 | return OkRangeD(); | |
69fbb331 | 111 | } |
aa24e021 | 112 | |
113 | //_________________________________________________________________________________________________ | |
114 | void AliRsnCutValue::Print(const Option_t *) const | |
115 | { | |
116 | // | |
117 | // Print information on this cut | |
118 | // | |
119 | ||
2a1c7696 | 120 | AliInfo(Form("Cut name : %s", GetName())); |
121 | AliInfo(Form("Cut value : %s", fValue.GetValueTypeName())); | |
122 | AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD)); | |
aa24e021 | 123 | } |