]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutValue.cxx
Added pass1 and pass2 directories
[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()
31 {
32 //
33 // Default constructor.
34 //
35 }
36
37 //_________________________________________________________________________________________________
38 AliRsnCutValue::AliRsnCutValue
39 (const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max) :
40    AliRsnCut(name, AliRsnValue::TargetType(type), min, max),
41    fValue(Form("val_%s", name), type)
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    // try to compute values
85    Bool_t success = fValue.Eval(object);
86
87    // check success
88    if (!success) {
89       AliWarning(Form("[%s] Failed to compute value", GetName()));
90       return kFALSE;
91    }
92
93    // check in range
94    fCutValueD = fValue.GetComputedValue();
95    return OkRangeD();
96 }
97
98 //_________________________________________________________________________________________________
99 void AliRsnCutValue::Print(const Option_t *) const
100 {
101 //
102 // Print information on this cut
103 //
104
105    AliInfo(Form("Cut name   : %s", GetName()));
106    AliInfo(Form("Cut value  : %s", fValue.GetValueTypeName()));
107    AliInfo(Form("Cut range  : %f - %f", fMinD, fMaxD));
108 }