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),
37 // Default constructor.
41 //______________________________________________________________________________
43 (const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
44 AliRsnTarget(name, target),
55 // Constructor with arguments.
56 // This is provided to allow a quick setting of all data members.
60 //______________________________________________________________________________
62 (const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
63 AliRsnTarget(name, target),
74 // Constructor with arguments.
75 // This is provided to allow a quick setting of all data members.
79 //______________________________________________________________________________
80 AliRsnCut::AliRsnCut(const AliRsnCut& copy) :
86 fCutValueI(copy.fCutValueI),
87 fCutValueD(copy.fCutValueD),
88 fCutResult(copy.fCutResult),
93 // Don't duplicate memory occupancy for pointer
97 //______________________________________________________________________________
98 AliRsnCut& AliRsnCut::operator=(const AliRsnCut& copy)
101 // Assignment operator.
102 // Don't duplicate memory occupancy for pointer
105 AliRsnTarget::operator=(copy);
111 fCutValueI = copy.fCutValueI;
112 fCutValueD = copy.fCutValueD;
113 fCutResult = copy.fCutResult;
114 fEvent = copy.fEvent;
119 //______________________________________________________________________________
120 Bool_t AliRsnCut::IsSelected(TObject* /*object*/)
123 // Virtual cut-checking method.
124 // In this implementation, it does nothing, and all classes
125 // inheriting from this, should provide a proper implementation
126 // which must return kTRUE if the cut is passed, and kFALSE otherwise.
129 AliWarning("This virtual function must be implemented properly");
133 //______________________________________________________________________________
134 Bool_t AliRsnCut::OkValueI()
137 // This method is used when the cut consists in comparing the cut value
138 // with a reference integer value to which it must be equal.
142 fCutResult = (fCutValueI == fMinI);
144 // print debug message
145 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
146 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
147 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
148 AliDebug(AliLog::kDebug + 2, Form("Cut value : %d", fMinI));
149 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
150 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
155 //______________________________________________________________________________
156 Bool_t AliRsnCut::OkValueD()
159 // This method is used when the cut consists in comparing the cut value
160 // with a reference double value to which it must be equal (or at least, almost).
164 fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6);
166 // print debug message
167 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
168 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
169 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
170 AliDebug(AliLog::kDebug + 2, Form("Cut value : %f", fMinD));
171 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
172 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
177 //______________________________________________________________________________
178 Bool_t AliRsnCut::OkRangeI()
181 // This method is used when the cut consists in an allowed range
182 // where the cut value must be included to pass the cut.
183 // Then, the cut result is kTRUE if the cut value is inside this range.
187 fCutResult = ((fCutValueI >= fMinI) && (fCutValueI < fMaxI));
189 // print debug message
190 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
191 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
192 AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI));
193 AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI));
194 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
195 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
200 //______________________________________________________________________________
201 Bool_t AliRsnCut::OkRangeD()
204 // This method is used when the cut consists in an allowed range
205 // where the cut value must be included to pass the cut.
206 // Then, the cut result is kTRUE if the cut value is inside this range.
210 fCutResult = ((fCutValueD >= fMinD) && (fCutValueD < fMaxD));
212 // print debug message
213 AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
214 AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName()));
215 AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD));
216 AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD));
217 AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED")));
218 AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================");
223 //______________________________________________________________________________
224 void AliRsnCut::Print(Option_t*) const
227 // Override TObject::Print() method,
228 // and print some useful info about the cut general parameters.
231 AliInfo("=== CUT DETAILS ====================================");
232 AliInfo(Form("Cut name : [%s]", GetName()));
233 AliInfo(Form("Cut target : [%s]", GetTargetTypeName()));
234 AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD));
235 AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI));
236 AliInfo("====================================================");
239 //______________________________________________________________________________
240 void AliRsnCut::SetEvent(AliRsnEvent *event)
243 // Sets the reference event.
244 // When this requires some additional operation, this function
245 // should be overloaded by the specific cut implementation.
246 // For an example, see AliRsnCutESD2010 class.