2 // *** Class AliRsnCut ***
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.
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.
12 // authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
13 // Martin Vala (martin.vala@cern.ch)
16 #include "AliRsnCut.h"
20 //______________________________________________________________________________
21 AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) :
22 AliRsnTarget(name, target),
32 // Default constructor.
36 //______________________________________________________________________________
38 (const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
39 AliRsnTarget(name, target),
49 // Constructor with arguments.
50 // This is provided to allow a quick setting of all data members.
54 //______________________________________________________________________________
56 (const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
57 AliRsnTarget(name, target),
67 // Constructor with arguments.
68 // This is provided to allow a quick setting of all data members.
72 //______________________________________________________________________________
73 AliRsnCut::AliRsnCut(const AliRsnCut ©) :
79 fCutValueI(copy.fCutValueI),
80 fCutValueD(copy.fCutValueD),
81 fCutResult(copy.fCutResult)
85 // Don't duplicate memory occupancy for pointer
89 //______________________________________________________________________________
90 AliRsnCut &AliRsnCut::operator=(const AliRsnCut ©)
93 // Assignment operator.
94 // Don't duplicate memory occupancy for pointer
97 AliRsnTarget::operator=(copy);
105 fCutValueI = copy.fCutValueI;
106 fCutValueD = copy.fCutValueD;
107 fCutResult = copy.fCutResult;
112 //______________________________________________________________________________
113 Bool_t AliRsnCut::IsSelected(TObject * /*object*/)
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.
122 AliWarning("This virtual function must be implemented properly");
126 //______________________________________________________________________________
127 Bool_t AliRsnCut::OkValueI()
130 // This method is used to compare a value with a reference.
131 // In the case of integers, the equality must be exact.
135 fCutResult = (fCutValueI == fMinI);
137 // print debug message
138 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
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")));
143 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
148 //______________________________________________________________________________
149 Bool_t AliRsnCut::OkValueD()
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.
157 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
159 // print debug message
160 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG =======================================================");
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")));
165 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ===================================================");
170 //______________________________________________________________________________
171 Bool_t AliRsnCut::OkRangeI()
174 // This method is used to compare a value with an integer range.
178 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
180 // print debug message
181 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
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")));
186 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
191 //______________________________________________________________________________
192 Bool_t AliRsnCut::OkRangeD()
195 // This method is used to compare a value with a double-float range.
199 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
201 // print debug message
202 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ========================================================");
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")));
207 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ====================================================");
212 //______________________________________________________________________________
213 void AliRsnCut::Print(Option_t *) const
216 // Override TObject::Print() method,
217 // and print some useful info about the cut general parameters.
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("====================================================");