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 "AliRsnCut.h"
24 //_________________________________________________________________________________________________
25 AliRsnCut::AliRsnCut() :
40 // Default constructor.
44 //_________________________________________________________________________________________________
46 (const char *name, Int_t min, Int_t max) :
62 // If the cut must check values inside a range,
63 // both 'value' arguments must be used, and they are, in the order,
64 // the minimum and maximum of the allowed range.
65 // If the cut must check a value, the second 'value' argument will never be used.
69 //_________________________________________________________________________________________________
71 (const char *name, ULong_t min, ULong_t max) :
87 // If the cut must check values inside a range,
88 // both 'value' arguments must be used, and they are, in the order,
89 // the minimum and maximum of the allowed range.
90 // If the cut must check a value, the second 'value' argument will never be used.
94 //_________________________________________________________________________________________________
96 (const char *name, Double_t min, Double_t max) :
112 // If the cut must check values inside a range,
113 // both 'value' arguments must be used, and they are, in the order,
114 // the minimum and maximum of the allowed range.
115 // If the cut must check a value, the second 'value' argument will never be used.
119 //_________________________________________________________________________________________________
120 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnDaughter* /*track*/)
123 // Virtual cut-checking method.
124 // In base class, these methods compare the argument type
125 // with the defined target, in order to detect a mismatch
128 AliWarning("This cut does not provide checks on AliRsnDaughter. This function will return kTRUE");
132 //_________________________________________________________________________________________________
133 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
136 // Virtual cut-checking method.
137 // In base class, these methods compare the argument type
138 // with the defined target, in order to detect a mismatch
141 AliWarning("This cut does not provide checks on AliRsnPairParticle. This function will return kTRUE");
145 //_________________________________________________________________________________________________
146 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
149 // Virtual cut-checking method.
150 // In base class, these methods compare the argument type
151 // with the defined target, in order to detect a mismatch
154 AliWarning("This cut does not provide checks on AliRsnEvent. This function will return kTRUE");
158 //_________________________________________________________________________________________________
159 Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
162 // Virtual cut-checking method.
163 // In base class, these methods compare the argument type
164 // with the defined target, in order to detect a mismatch
167 AliWarning("This cut does not provide checks on two AliRsnEvent's. This function will return kTRUE");
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.
183 fCutResult = (fCutValueI == fMinI);
184 // print debug message
185 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
186 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
187 AliDebug(AliLog::kDebug + 3, Form("Checked value: %d", fCutValueI));
188 AliDebug(AliLog::kDebug + 3, Form("Cut value : %d", fMinI));
189 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
190 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
194 fCutResult = (fCutValueU == fMinU);
195 // print debug message
196 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
197 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
198 AliDebug(AliLog::kDebug + 3, Form("Checked value: %d", fCutValueU));
199 AliDebug(AliLog::kDebug + 3, Form("Cut value : %d", fMinU));
200 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
201 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
205 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
206 // print debug message
207 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
208 AliDebug(AliLog::kDebug + 3, Form("Cut name : %s", GetName()));
209 AliDebug(AliLog::kDebug + 3, Form("Checked value: %f", fCutValueD));
210 AliDebug(AliLog::kDebug + 3, Form("Cut value : %f", fMinD));
211 AliDebug(AliLog::kDebug + 3, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
212 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
215 AliError(Form("fVarType = %d --> not allowed", fVarType));
222 //_________________________________________________________________________________________________
223 Bool_t AliRsnCut::OkRange()
226 // This method is used when the cut consists in an allowed range
227 // where the cut value must be included to pass the cut.
228 // Then, the cut result is kTRUE if the cut value is inside this range.
234 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
235 // print debug message
236 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
237 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
238 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
239 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI));
240 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
241 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
245 fCutResult = ((fCutValueU >= fMinU) && (fCutValueU <= fMaxU));
246 // print debug message
247 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
248 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
249 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueU));
250 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinU, fMaxU));
251 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
252 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
256 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
257 // print debug message
258 AliDebug(AliLog::kDebug + 3, "=== CUT DEBUG ====================================");
259 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
260 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
261 AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD));
262 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
263 AliDebug(AliLog::kDebug + 3, "=== END CUT DEBUG ================================");
266 AliError(Form("fVarType = %d --> not allowed", fVarType));