]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutValue.cxx
Macro to add the energy distribution task to the train
[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());
98
99 // check target coherence
100 if (!TargetOK(object))
69fbb331 101 {
32992791 102 AliWarning("Returning kFALSE");
103 return kFALSE;
69fbb331 104 }
32992791 105
106 // try to compute values
107 Bool_t success = fValue.Eval(object);
108
109 // check success
110 if (!success)
69fbb331 111 {
32992791 112 AliWarning(Form("[%s] Failed to compute value", GetName()));
113 return kFALSE;
69fbb331 114 }
115
32992791 116 // check in range
117 fCutValueD = fValue.GetComputedValue();
69fbb331 118 return OkRangeD();
119}
aa24e021 120
121//_________________________________________________________________________________________________
122void AliRsnCutValue::Print(const Option_t *) const
123{
124//
125// Print information on this cut
126//
127
128 AliInfo(Form("Cut name : %s", GetName()));
129 AliInfo(Form("Cut value : %s", fValue.GetValueTypeName()));
130 AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD));
131}