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 [--> IsEqual() ]
7 // In all cases, the reference value(s) is (are) given as data members
8 // and each kind of cut requires a given value type (Int, UInt, Double),
9 // but the cut check procedure is then automatized and chosen thanks to
10 // an enumeration of the implemented cut types.
11 // At the end, the user (or any other point which uses this object) has
12 // to use the method IsSelected() to check if this cut has been passed.
14 // authors: Martin Vala (martin.vala@cern.ch)
15 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
25 class AliRsnCut : public TNamed
29 // possible targets for a cut
39 // data type for check
47 AliRsnCut(ETarget target = kLastCutTarget);
48 AliRsnCut(const AliRsnCut& copy);
49 AliRsnCut& operator=(const AliRsnCut& copy);
50 AliRsnCut(const char *name, ETarget target, Int_t min, Int_t max = 0 );
51 AliRsnCut(const char *name, ETarget target, Double_t min, Double_t max = 0.);
52 virtual ~AliRsnCut() { /*nothing*/ };
54 EVarType GetVarTypeEnum() {return fVarType;}
55 Char_t GetVarTypeChar() {if (fVarType == kInt) return 'I'; else if (fVarType == kDouble) return 'D'; else return 'X';}
56 ETarget GetTargetEnum() {return fTarget;}
57 Char_t GetTargetChar() {if (fTarget == kDaughter) return 'D'; else if (fTarget == kMother) return 'M'; else if (fTarget == kEvent) return 'E'; else return 'X';}
58 Bool_t IsTarget(ETarget target) {return (fTarget == target);}
59 Bool_t TargetOK(TObject *obj1, TObject *obj2 = 0x0);
60 Int_t GetMinI() {return fMinI;}
61 Int_t GetMaxI() {return fMaxI;}
62 Double_t GetMinD() {return fMinD;}
63 Double_t GetMaxD() {return fMaxD;}
64 Int_t GetCutValueI() {return fCutValueI;}
65 Double_t GetCutValueD() {return fCutValueD;}
66 Bool_t GetCutResult() {return fCutResult;}
68 void SetRange(Int_t min, Int_t max) {fMinI = min; fMaxI = max; fVarType = kInt;}
69 void SetRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max; fVarType = kDouble;}
71 void SetValue(Int_t value) {fMinI = value; fVarType = kInt;}
72 void SetValue(Double_t value) {fMinD = value; fVarType = kDouble;}
81 virtual void SetEvent(AliRsnEvent *event);
82 AliRsnEvent* GetEvent() {return fEvent;}
84 virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
85 virtual void Print(Option_t *opt = "") const;
89 EVarType fVarType; // type of checked variable
90 ETarget fTarget; // type of object on which the cut is checked
92 Int_t fMinI; // lower edge of INT range or ref. value for INT CUT
93 Int_t fMaxI; // upper edge of INT range (not used for value cuts)
94 Double_t fMinD; // lower edge of DOUBLE range or ref. value for INT CUT
95 Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts)
97 Int_t fCutValueI; // cut value INT
98 Double_t fCutValueD; // cut value DOUBLE
100 Bool_t fCutResult; // tells if the cut is passed or not
102 AliRsnEvent *fEvent; //! pointer to current event (can be needed sometimes, but never streamed)
104 ClassDef(AliRsnCut, 1)