2 // Class AliRsnCutMomentumComparison
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 "AliRsnMother.h"
22 #include "AliRsnCutMomentumComparison.h"
24 ClassImp(AliRsnCutMomentumComparison)
26 //_________________________________________________________________________________________________
27 AliRsnCutMomentumComparison::AliRsnCutMomentumComparison(const char *name, EMode mode) :
28 AliRsnCut(name, AliRsnCut::kMother),
32 // Default constructor.
36 //_________________________________________________________________________________________________
37 AliRsnCutMomentumComparison::AliRsnCutMomentumComparison(const AliRsnCutMomentumComparison& copy) :
46 //_________________________________________________________________________________________________
47 AliRsnCutMomentumComparison& AliRsnCutMomentumComparison::operator=(const AliRsnCutMomentumComparison& copy)
50 // Assignment operator
53 AliRsnCut::operator=(copy);
61 //_________________________________________________________________________________________________
62 Bool_t AliRsnCutMomentumComparison::IsSelected(TObject *object)
68 // convert the object into the unique correct type
69 if (!TargetOK(object)) return kFALSE;
72 Double_t p1 = fMother->GetDaughter(0)->GetRef()->P();
73 Double_t p2 = fMother->GetDaughter(1)->GetRef()->P();
74 Double_t pt1 = fMother->GetDaughter(0)->GetRef()->Pt();
75 Double_t pt2 = fMother->GetDaughter(1)->GetRef()->Pt();
79 case kFirstLargerP : return (p1 > p2);
80 case kFirstSmallerP : return (p1 < p2);
81 case kFirstLargerPt : return (pt1 > pt2);
82 case kFirstSmallerPt: return (pt1 < pt2);
84 AliError("Invalid mode selected. Cut is skipped");