Splitted the PID cuts into three classes for ITS, TPC and TOF, and added the possibil...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutValue.cxx
CommitLineData
69fbb331 1//
32992791 2// *** Class AliRsnCutValue ***
69fbb331 3//
32992791 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
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
25ClassImp(AliRsnCutValue)
26
27//_________________________________________________________________________________________________
28AliRsnCutValue::AliRsnCutValue() :
29 AliRsnCut(),
30 fValue(),
31 fPairDef(0x0)
32{
33//
34// Default constructor.
35//
32992791 36
37 SetTargetType(fValue.GetTargetType());
69fbb331 38}
39
40//_________________________________________________________________________________________________
41AliRsnCutValue::AliRsnCutValue
32992791 42(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd) :
43 AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max),
44 fValue(Form("val_%s", name), type),
69fbb331 45 fPairDef(pd)
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
53 SetTargetType(fValue.GetTargetType());
69fbb331 54}
55
56//_________________________________________________________________________________________________
57AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) :
58 AliRsnCut(copy),
59 fValue(copy.fValue),
60 fPairDef(copy.fPairDef)
61{
62//
32992791 63// Copy constructor.
64// Does not duplicate memory allocation.
69fbb331 65//
32992791 66
67 SetTargetType(fValue.GetTargetType());
69fbb331 68}
69
70//_________________________________________________________________________________________________
71AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy)
72{
73//
32992791 74// Assignment operator.
75// Does not duplicate memory allocation.
69fbb331 76//
77
32992791 78 AliRsnCut::operator=(copy);
79
69fbb331 80 fValue = copy.fValue;
81 fPairDef = copy.fPairDef;
32992791 82 SetTargetType(fValue.GetTargetType());
69fbb331 83
84 return (*this);
85}
86
87//_________________________________________________________________________________________________
32992791 88Bool_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
32992791 95 // make sure that target of this object matches that
96 // of the inserted value object
97 SetTargetType(fValue.GetTargetType());
32992791 98
99 // try to compute values
100 Bool_t success = fValue.Eval(object);
101
102 // check success
103 if (!success)
69fbb331 104 {
32992791 105 AliWarning(Form("[%s] Failed to compute value", GetName()));
106 return kFALSE;
69fbb331 107 }
108
32992791 109 // check in range
110 fCutValueD = fValue.GetComputedValue();
69fbb331 111 return OkRangeD();
112}
aa24e021 113
114//_________________________________________________________________________________________________
115void AliRsnCutValue::Print(const Option_t *) const
116{
117//
118// Print information on this cut
119//
120
121 AliInfo(Form("Cut name : %s", GetName()));
122 AliInfo(Form("Cut value : %s", fValue.GetValueTypeName()));
123 AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD));
124}