]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutValue.cxx
Some bug fixes, removal of some duplicates and clarified the logic of some pieces...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutValue.cxx
1 //
2 // *** Class AliRsnCutValue ***
3 //
4 // This cut implementation can be used to cut generically on
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
14 //
15 // author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
16 //
17
18 #include "AliRsnDaughter.h"
19 #include "AliRsnMother.h"
20 #include "AliRsnEvent.h"
21 #include "AliRsnPairDef.h"
22
23 #include "AliRsnCutValue.h"
24
25 ClassImp(AliRsnCutValue)
26
27 //_________________________________________________________________________________________________
28 AliRsnCutValue::AliRsnCutValue() :
29    AliRsnCut(),
30    fValue(0x0)
31 {
32 //
33 // Default constructor.
34 //
35 }
36
37 //_________________________________________________________________________________________________
38 AliRsnCutValue::AliRsnCutValue
39 (const char *name, Double_t min, Double_t max) :
40    AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max),
41    fValue(0x0)
42 {
43 //
44 // Main constructor.
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
48 //
49 }
50
51 //_________________________________________________________________________________________________
52 AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) :
53    AliRsnCut(copy),
54    fValue(copy.fValue)
55 {
56 //
57 // Copy constructor.
58 // Does not duplicate memory allocation.
59 //
60 }
61
62 //_________________________________________________________________________________________________
63 AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy)
64 {
65 //
66 // Assignment operator.
67 // Does not duplicate memory allocation.
68 //
69
70    AliRsnCut::operator=(copy);
71    fValue = copy.fValue;
72
73    return (*this);
74 }
75
76 //_________________________________________________________________________________________________
77 Bool_t AliRsnCutValue::IsSelected(TObject *object)
78 {
79 //
80 // Checks the cut.
81 // Calls the AliRsnValue::Eval() method and then checks its output.
82 //
83
84    // skip cut if value is not initialized
85    if (!fValue) return kTRUE;
86    
87    // match target types
88    SetTargetType(fValue->GetTargetType());
89
90    // try to compute values
91    Bool_t success = fValue->Eval(object);
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
100    fCutValueD = fValue->GetComputedValue();
101    return OkRangeD();
102 }
103
104 //_________________________________________________________________________________________________
105 void AliRsnCutValue::Print(const Option_t *) const
106 {
107 //
108 // Print information on this cut
109 //
110
111    AliInfo(Form("Cut name   : %s", GetName()));
112    AliInfo(Form("Cut value  : %s", fValue->GetName()));
113    AliInfo(Form("Cut range  : %f - %f", fMinD, fMaxD));
114 }