]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnCut.cxx
Add task for Xi* analysis
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCut.cxx
CommitLineData
e2bafbbc 1//
32992791 2// *** Class AliRsnCut ***
06351446 3//
32992791 4// Cut base class: all other cuts inherit from it.
5// The 'core' of the class is the method "IsSelected()" which
6// must be overloaded by any specific cut implementation.
e2bafbbc 7//
32992791 8// This class provides some default instruments to check values
9// agains a reference or an allowed range, in order to permit
10// a unique way to execute such kind of checks.
06351446 11//
32992791 12// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
13// Martin Vala (martin.vala@cern.ch)
e2bafbbc 14//
06351446 15
5eb970a4 16#include "AliRsnCut.h"
06351446 17
aec0ec32 18ClassImp(AliRsnCut)
06351446 19
32992791 20//______________________________________________________________________________
21AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) :
2a1c7696 22 AliRsnTarget(name, target),
23 fMinI(0),
24 fMaxI(0),
25 fMinD(0.),
26 fMaxD(0.),
27 fCutValueI(0),
28 fCutValueD(0.0),
29 fCutResult(kTRUE)
06351446 30{
31//
5eb970a4 32// Default constructor.
06351446 33//
34}
35
32992791 36//______________________________________________________________________________
5eb970a4 37AliRsnCut::AliRsnCut
32992791 38(const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
2a1c7696 39 AliRsnTarget(name, target),
40 fMinI(imin),
41 fMaxI(imax),
42 fMinD(dmin),
43 fMaxD(dmax),
44 fCutValueI(0),
45 fCutValueD(0.0),
46 fCutResult(kTRUE)
06351446 47{
48//
32992791 49// Constructor with arguments.
50// This is provided to allow a quick setting of all data members.
06351446 51//
52}
53
32992791 54//______________________________________________________________________________
5eb970a4 55AliRsnCut::AliRsnCut
32992791 56(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
2a1c7696 57 AliRsnTarget(name, target),
58 fMinI(imin),
59 fMaxI(imax),
60 fMinD(dmin),
61 fMaxD(dmax),
62 fCutValueI(0),
63 fCutValueD(0.0),
64 fCutResult(kTRUE)
06351446 65{
66//
32992791 67// Constructor with arguments.
68// This is provided to allow a quick setting of all data members.
06351446 69//
70}
71
32992791 72//______________________________________________________________________________
61f275d1 73AliRsnCut::AliRsnCut(const AliRsnCut &copy) :
2a1c7696 74 AliRsnTarget(copy),
75 fMinI(copy.fMinI),
76 fMaxI(copy.fMaxI),
77 fMinD(copy.fMinD),
78 fMaxD(copy.fMaxD),
79 fCutValueI(copy.fCutValueI),
80 fCutValueD(copy.fCutValueD),
81 fCutResult(copy.fCutResult)
32992791 82{
83//
84// Copy constructor.
85// Don't duplicate memory occupancy for pointer
86//
87}
88
89//______________________________________________________________________________
61f275d1 90AliRsnCut &AliRsnCut::operator=(const AliRsnCut &copy)
413bbf44 91{
92//
32992791 93// Assignment operator.
94// Don't duplicate memory occupancy for pointer
413bbf44 95//
96
61f275d1 97 AliRsnTarget::operator=(copy);
e6f3a909 98 if (this == &copy)
61f275d1 99 return *this;
413bbf44 100
2a1c7696 101 fMinI = copy.fMinI;
102 fMaxI = copy.fMaxI;
103 fMinD = copy.fMinD;
104 fMaxD = copy.fMaxD;
105 fCutValueI = copy.fCutValueI;
106 fCutValueD = copy.fCutValueD;
eaa44581 107 fCutResult = copy.fCutResult;
2a1c7696 108
109 return (*this);
413bbf44 110}
111
32992791 112//______________________________________________________________________________
3da8cef7 113Bool_t AliRsnCut::IsSelected(TObject * /*object*/)
aec0ec32 114{
115//
32992791 116// Virtual cut-checking method.
117// In this implementation, it does nothing, and all classes
118// inheriting from this, should provide a proper implementation
119// which must return kTRUE if the cut is passed, and kFALSE otherwise.
aec0ec32 120//
aec0ec32 121
2a1c7696 122 AliWarning("This virtual function must be implemented properly");
123 return kTRUE;
06351446 124}
125
32992791 126//______________________________________________________________________________
2dab9030 127Bool_t AliRsnCut::OkValueI()
06351446 128{
129//
eaa44581 130// This method is used to compare a value with a reference.
131// In the case of integers, the equality must be exact.
06351446 132//
aec0ec32 133
2a1c7696 134 // eval result
135 fCutResult = (fCutValueI == fMinI);
136
137 // print debug message
eaa44581 138 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
2a1c7696 139 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
140 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
141 AliDebug(AliLog::kDebug + 2, Form("Cut value : %d", fMinI));
142 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
eaa44581 143 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
2a1c7696 144
145 return fCutResult;
2dab9030 146}
aec0ec32 147
32992791 148//______________________________________________________________________________
2dab9030 149Bool_t AliRsnCut::OkValueD()
150{
151//
eaa44581 152// This method is used to compare a value with a reference.
153// In the case of doubles, the equality consists in being very close.
2dab9030 154//
155
2a1c7696 156 // eval result
d7712d44 157 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
2a1c7696 158
159 // print debug message
eaa44581 160 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG =======================================================");
2a1c7696 161 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
162 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
163 AliDebug(AliLog::kDebug + 2, Form("Cut value : %f", fMinD));
164 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
eaa44581 165 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ===================================================");
2a1c7696 166
167 return fCutResult;
06351446 168}
169
32992791 170//______________________________________________________________________________
2dab9030 171Bool_t AliRsnCut::OkRangeI()
e0baff8c 172{
5eb970a4 173//
eaa44581 174// This method is used to compare a value with an integer range.
5eb970a4 175//
e0baff8c 176
2a1c7696 177 // eval result
178 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
179
180 // print debug message
eaa44581 181 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
2a1c7696 182 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
183 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
184 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI));
185 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
eaa44581 186 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
2a1c7696 187
188 return fCutResult;
2dab9030 189}
190
32992791 191//______________________________________________________________________________
2dab9030 192Bool_t AliRsnCut::OkRangeD()
193{
194//
eaa44581 195// This method is used to compare a value with a double-float range.
2dab9030 196//
197
2a1c7696 198 // eval result
199 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
200
201 // print debug message
eaa44581 202 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
2a1c7696 203 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
204 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
205 AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD));
206 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
eaa44581 207 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
e0baff8c 208
2a1c7696 209 return fCutResult;
e0baff8c 210}
211
32992791 212//______________________________________________________________________________
61f275d1 213void AliRsnCut::Print(Option_t *) const
2dab9030 214{
215//
32992791 216// Override TObject::Print() method,
217// and print some useful info about the cut general parameters.
2dab9030 218//
219
2a1c7696 220 AliInfo("=== CUT DETAILS ====================================");
221 AliInfo(Form("Cut name : [%s]", GetName()));
222 AliInfo(Form("Cut target : [%s]", GetTargetTypeName()));
223 AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD));
224 AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI));
225 AliInfo("====================================================");
2dab9030 226}