]>
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(), |
c865cb1d | 30 | fValue(0x0) |
69fbb331 | 31 | { |
32 | // | |
33 | // Default constructor. | |
34 | // | |
35 | } | |
36 | ||
37 | //_________________________________________________________________________________________________ | |
38 | AliRsnCutValue::AliRsnCutValue | |
f34f960b | 39 | (const char *name, Double_t min, Double_t max) : |
c865cb1d | 40 | AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max), |
c865cb1d | 41 | fValue(0x0) |
69fbb331 | 42 | { |
43 | // | |
44 | // Main constructor. | |
07d7c31d | 45 | // Sets the AliRsnValue data member accordingly to arguments passed here. |
46 | // NOTE: if the value needs a support object, it must be passed separately | |
47 | // using the GetValueObje() of this class | |
69fbb331 | 48 | // |
49 | } | |
50 | ||
51 | //_________________________________________________________________________________________________ | |
52 | AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) : | |
2a1c7696 | 53 | AliRsnCut(copy), |
07d7c31d | 54 | fValue(copy.fValue) |
69fbb331 | 55 | { |
56 | // | |
32992791 | 57 | // Copy constructor. |
58 | // Does not duplicate memory allocation. | |
69fbb331 | 59 | // |
60 | } | |
61 | ||
62 | //_________________________________________________________________________________________________ | |
63 | AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy) | |
64 | { | |
65 | // | |
32992791 | 66 | // Assignment operator. |
67 | // Does not duplicate memory allocation. | |
69fbb331 | 68 | // |
69 | ||
2a1c7696 | 70 | AliRsnCut::operator=(copy); |
07d7c31d | 71 | fValue = copy.fValue; |
2a1c7696 | 72 | |
73 | return (*this); | |
69fbb331 | 74 | } |
75 | ||
76 | //_________________________________________________________________________________________________ | |
32992791 | 77 | Bool_t AliRsnCutValue::IsSelected(TObject *object) |
69fbb331 | 78 | { |
79 | // | |
80 | // Checks the cut. | |
32992791 | 81 | // Calls the AliRsnValue::Eval() method and then checks its output. |
69fbb331 | 82 | // |
83 | ||
c865cb1d | 84 | // skip cut if value is not initialized |
85 | if (!fValue) return kTRUE; | |
86 | ||
87 | // match target types | |
88 | SetTargetType(fValue->GetTargetType()); | |
89 | ||
2a1c7696 | 90 | // try to compute values |
f34f960b | 91 | Bool_t success = fValue->Eval(object); |
2a1c7696 | 92 | |
93 | // check success | |
94 | if (!success) { | |
95 | AliWarning(Form("[%s] Failed to compute value", GetName())); | |
96 | return kFALSE; | |
97 | } | |
98 | ||
99 | // check in range | |
c865cb1d | 100 | fCutValueD = fValue->GetComputedValue(); |
2a1c7696 | 101 | return OkRangeD(); |
69fbb331 | 102 | } |
aa24e021 | 103 | |
104 | //_________________________________________________________________________________________________ | |
105 | void AliRsnCutValue::Print(const Option_t *) const | |
106 | { | |
107 | // | |
108 | // Print information on this cut | |
109 | // | |
110 | ||
2a1c7696 | 111 | AliInfo(Form("Cut name : %s", GetName())); |
c865cb1d | 112 | AliInfo(Form("Cut value : %s", fValue->GetName())); |
2a1c7696 | 113 | AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD)); |
aa24e021 | 114 | } |