4 // General implementation of a single cut strategy, which can be:
5 // - a value contained in a given interval [--> IsBetween() ]
6 // - a value equal to a given reference [--> MatchesValue()]
8 // In all cases, the reference value(s) is (are) given as data members
9 // and each kind of cut requires a given value type (Int, UInt, Double),
10 // but the cut check procedure is then automatized and chosen thanks to
11 // an enumeration of the implemented cut types.
12 // At the end, the user (or any other point which uses this object) has
13 // to use the method IsSelected() to check if this cut has been passed.
15 // authors: Martin Vala (martin.vala@cern.ch)
16 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
20 #include "AliRsnDaughter.h"
21 #include "AliRsnPairParticle.h"
22 #include "AliRsnEvent.h"
24 #include "AliRsnCut.h"
28 //_________________________________________________________________________________________________
29 AliRsnCut::AliRsnCut() :
44 // Default constructor.
48 //_________________________________________________________________________________________________
50 (const char *name, Int_t min, Int_t max) :
66 // If the cut must check values inside a range,
67 // both 'value' arguments must be used, and they are, in the order,
68 // the minimum and maximum of the allowed range.
69 // If the cut must check a value, the second 'value' argument will never be used.
73 //_________________________________________________________________________________________________
75 (const char *name, ULong_t min, ULong_t max) :
91 // If the cut must check values inside a range,
92 // both 'value' arguments must be used, and they are, in the order,
93 // the minimum and maximum of the allowed range.
94 // If the cut must check a value, the second 'value' argument will never be used.
98 //_________________________________________________________________________________________________
100 (const char *name, Double_t min, Double_t max) :
116 // If the cut must check values inside a range,
117 // both 'value' arguments must be used, and they are, in the order,
118 // the minimum and maximum of the allowed range.
119 // If the cut must check a value, the second 'value' argument will never be used.
123 //_________________________________________________________________________________________________
124 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnDaughter* /*track*/)
127 // Virtual cut-checking method.
128 // In base class, these methods compare the argument type
129 // with the defined target, in order to detect a mismatch
135 //_________________________________________________________________________________________________
136 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
139 // Virtual cut-checking method.
140 // In base class, these methods compare the argument type
141 // with the defined target, in order to detect a mismatch
147 //_________________________________________________________________________________________________
148 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
151 // Virtual cut-checking method.
152 // In base class, these methods compare the argument type
153 // with the defined target, in order to detect a mismatch
159 //_________________________________________________________________________________________________
160 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
163 // Virtual cut-checking method.
164 // In base class, these methods compare the argument type
165 // with the defined target, in order to detect a mismatch
171 //_________________________________________________________________________________________________
172 Bool_t AliRsnCut::OkValue()
175 // This method is used when the cut consists in comparing the cut value
176 // with a reference value to which it must be equal (in case of doubles, 'almost' equal).
177 // Then, the cut result is kTRUE if the cut value is equal to this reference value.
184 fCutResult = (fCutValueI == fMinI);
185 // print debug message
186 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
187 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
188 AliDebug(AliLog::kDebug + 3, Form("Checked value: %d", fCutValueI));
189 AliDebug(AliLog::kDebug + 3, Form("Cut value : %d", fMinI));
190 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
191 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
195 fCutResult = (fCutValueU == fMinU);
196 // print debug message
197 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
198 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
199 AliDebug(AliLog::kDebug + 3, Form("Checked value: %d", fCutValueU));
200 AliDebug(AliLog::kDebug + 3, Form("Cut value : %d", fMinU));
201 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
202 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
206 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
207 // print debug message
208 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
209 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
210 AliDebug(AliLog::kDebug + 3, Form("Checked value: %f", fCutValueD));
211 AliDebug(AliLog::kDebug + 3, Form("Cut value : %f", fMinD));
212 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
213 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
216 AliError(Form("fVarType = %d --> not allowed", fVarType));
223 //_________________________________________________________________________________________________
224 Bool_t AliRsnCut::OkRange()
227 // This method is used when the cut consists in an allowed range
228 // where the cut value must be included to pass the cut.
229 // Then, the cut result is kTRUE if the cut value is inside this range.
236 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
237 // print debug message
238 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
239 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
240 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
241 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI));
242 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
243 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
247 fCutResult = ((fCutValueU >= fMinU) && (fCutValueU <= fMaxU));
248 // print debug message
249 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
250 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
251 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueU));
252 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinU, fMaxU));
253 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
254 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
258 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
259 // print debug message
260 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
261 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
262 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
263 AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD));
264 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
265 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
268 AliError(Form("fVarType = %d --> not allowed", fVarType));