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 "AliRsnDaughter.h"
17 #include "AliRsnMother.h"
18 #include "AliRsnEvent.h"
20 #include "AliRsnCut.h"
24 //______________________________________________________________________________
25 AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) :
26 AliRsnTarget(name, target),
36 // Default constructor.
40 //______________________________________________________________________________
42 (const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
43 AliRsnTarget(name, target),
53 // Constructor with arguments.
54 // This is provided to allow a quick setting of all data members.
58 //______________________________________________________________________________
60 (const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
61 AliRsnTarget(name, target),
71 // Constructor with arguments.
72 // This is provided to allow a quick setting of all data members.
76 //______________________________________________________________________________
77 AliRsnCut::AliRsnCut(const AliRsnCut& copy) :
83 fCutValueI(copy.fCutValueI),
84 fCutValueD(copy.fCutValueD),
85 fCutResult(copy.fCutResult)
89 // Don't duplicate memory occupancy for pointer
93 //______________________________________________________________________________
94 AliRsnCut& AliRsnCut::operator=(const AliRsnCut& copy)
97 // Assignment operator.
98 // Don't duplicate memory occupancy for pointer
101 AliRsnTarget::operator=(copy);
107 fCutValueI = copy.fCutValueI;
108 fCutValueD = copy.fCutValueD;
113 //______________________________________________________________________________
114 Bool_t AliRsnCut::IsSelected(TObject* /*object*/)
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.
123 AliWarning("This virtual function must be implemented properly");
127 //______________________________________________________________________________
128 Bool_t AliRsnCut::OkValueI()
131 // This method is used when the cut consists in comparing the cut value
132 // with a reference integer value to which it must be equal.
136 fCutResult = (fCutValueI == fMinI);
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 ================================");
149 //______________________________________________________________________________
150 Bool_t AliRsnCut::OkValueD()
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).
158 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
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 ================================");
171 //______________________________________________________________________________
172 Bool_t AliRsnCut::OkRangeI()
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.
181 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
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 ================================");
194 //______________________________________________________________________________
195 Bool_t AliRsnCut::OkRangeD()
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.
204 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
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 ================================");
217 //______________________________________________________________________________
218 void AliRsnCut::Print(Option_t*) const
221 // Override TObject::Print() method,
222 // and print some useful info about the cut general parameters.
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("====================================================");