]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCut.cxx
Removed old ME classes, since the nex event mixing has been introduced and is integra...
[u/mrichter/AliRoot.git] / PWG2 / 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
2dab9030 16#include "AliRsnDaughter.h"
17#include "AliRsnMother.h"
18#include "AliRsnEvent.h"
19
5eb970a4 20#include "AliRsnCut.h"
06351446 21
aec0ec32 22ClassImp(AliRsnCut)
06351446 23
32992791 24//______________________________________________________________________________
25AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) :
2a1c7696 26 AliRsnTarget(name, target),
27 fMinI(0),
28 fMaxI(0),
29 fMinD(0.),
30 fMaxD(0.),
31 fCutValueI(0),
32 fCutValueD(0.0),
33 fCutResult(kTRUE)
06351446 34{
35//
5eb970a4 36// Default constructor.
06351446 37//
38}
39
32992791 40//______________________________________________________________________________
5eb970a4 41AliRsnCut::AliRsnCut
32992791 42(const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
2a1c7696 43 AliRsnTarget(name, target),
44 fMinI(imin),
45 fMaxI(imax),
46 fMinD(dmin),
47 fMaxD(dmax),
48 fCutValueI(0),
49 fCutValueD(0.0),
50 fCutResult(kTRUE)
06351446 51{
52//
32992791 53// Constructor with arguments.
54// This is provided to allow a quick setting of all data members.
06351446 55//
56}
57
32992791 58//______________________________________________________________________________
5eb970a4 59AliRsnCut::AliRsnCut
32992791 60(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
2a1c7696 61 AliRsnTarget(name, target),
62 fMinI(imin),
63 fMaxI(imax),
64 fMinD(dmin),
65 fMaxD(dmax),
66 fCutValueI(0),
67 fCutValueD(0.0),
68 fCutResult(kTRUE)
06351446 69{
70//
32992791 71// Constructor with arguments.
72// This is provided to allow a quick setting of all data members.
06351446 73//
74}
75
32992791 76//______________________________________________________________________________
77AliRsnCut::AliRsnCut(const AliRsnCut& copy) :
2a1c7696 78 AliRsnTarget(copy),
79 fMinI(copy.fMinI),
80 fMaxI(copy.fMaxI),
81 fMinD(copy.fMinD),
82 fMaxD(copy.fMaxD),
83 fCutValueI(copy.fCutValueI),
84 fCutValueD(copy.fCutValueD),
85 fCutResult(copy.fCutResult)
32992791 86{
87//
88// Copy constructor.
89// Don't duplicate memory occupancy for pointer
90//
91}
92
93//______________________________________________________________________________
413bbf44 94AliRsnCut& AliRsnCut::operator=(const AliRsnCut& copy)
95{
96//
32992791 97// Assignment operator.
98// Don't duplicate memory occupancy for pointer
413bbf44 99//
100
2a1c7696 101 AliRsnTarget::operator=(copy);
413bbf44 102
2a1c7696 103 fMinI = copy.fMinI;
104 fMaxI = copy.fMaxI;
105 fMinD = copy.fMinD;
106 fMaxD = copy.fMaxD;
107 fCutValueI = copy.fCutValueI;
108 fCutValueD = copy.fCutValueD;
109
110 return (*this);
413bbf44 111}
112
32992791 113//______________________________________________________________________________
114Bool_t AliRsnCut::IsSelected(TObject* /*object*/)
aec0ec32 115{
116//
32992791 117// Virtual cut-checking method.
118// In this implementation, it does nothing, and all classes
119// inheriting from this, should provide a proper implementation
120// which must return kTRUE if the cut is passed, and kFALSE otherwise.
aec0ec32 121//
aec0ec32 122
2a1c7696 123 AliWarning("This virtual function must be implemented properly");
124 return kTRUE;
06351446 125}
126
32992791 127//______________________________________________________________________________
2dab9030 128Bool_t AliRsnCut::OkValueI()
06351446 129{
130//
5eb970a4 131// This method is used when the cut consists in comparing the cut value
2dab9030 132// with a reference integer value to which it must be equal.
06351446 133//
aec0ec32 134
2a1c7696 135 // eval result
136 fCutResult = (fCutValueI == fMinI);
137
138 // print debug message
139 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
140 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
141 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
142 AliDebug(AliLog::kDebug + 2, Form("Cut value : %d", fMinI));
143 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
144 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
145
146 return fCutResult;
2dab9030 147}
aec0ec32 148
32992791 149//______________________________________________________________________________
2dab9030 150Bool_t AliRsnCut::OkValueD()
151{
152//
153// This method is used when the cut consists in comparing the cut value
154// with a reference double value to which it must be equal (or at least, almost).
155//
156
2a1c7696 157 // eval result
158 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
159
160 // print debug message
161 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
162 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
163 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
164 AliDebug(AliLog::kDebug + 2, Form("Cut value : %f", fMinD));
165 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
166 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
167
168 return fCutResult;
06351446 169}
170
32992791 171//______________________________________________________________________________
2dab9030 172Bool_t AliRsnCut::OkRangeI()
e0baff8c 173{
5eb970a4 174//
175// This method is used when the cut consists in an allowed range
176// where the cut value must be included to pass the cut.
177// Then, the cut result is kTRUE if the cut value is inside this range.
178//
e0baff8c 179
2a1c7696 180 // eval result
181 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
182
183 // print debug message
184 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
185 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
186 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
187 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI));
188 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
189 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
190
191 return fCutResult;
2dab9030 192}
193
32992791 194//______________________________________________________________________________
2dab9030 195Bool_t AliRsnCut::OkRangeD()
196{
197//
198// This method is used when the cut consists in an allowed range
199// where the cut value must be included to pass the cut.
200// Then, the cut result is kTRUE if the cut value is inside this range.
201//
202
2a1c7696 203 // eval result
204 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
205
206 // print debug message
207 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
208 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
209 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
210 AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD));
211 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
212 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
e0baff8c 213
2a1c7696 214 return fCutResult;
e0baff8c 215}
216
32992791 217//______________________________________________________________________________
2dab9030 218void AliRsnCut::Print(Option_t*) const
219{
220//
32992791 221// Override TObject::Print() method,
222// and print some useful info about the cut general parameters.
2dab9030 223//
224
2a1c7696 225 AliInfo("=== CUT DETAILS ====================================");
226 AliInfo(Form("Cut name : [%s]", GetName()));
227 AliInfo(Form("Cut target : [%s]", GetTargetTypeName()));
228 AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD));
229 AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI));
230 AliInfo("====================================================");
2dab9030 231}