]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCut.h
Modified some standards, added a cut in pseudo-rapidity
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCut.h
CommitLineData
e2bafbbc 1//
06351446 2// Class AliRsnCut
3//
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.
13//
14// authors: Martin Vala (martin.vala@cern.ch)
15// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
e2bafbbc 16//
06351446 17
18#ifndef ALIRSNCUT_H
19#define ALIRSNCUT_H
20
21#include "TNamed.h"
22
e2bafbbc 23class AliRsnEvent;
06351446 24
25class AliRsnCut : public TNamed
26{
5eb970a4 27 public:
28
29 // possible targets for a cut
2dab9030 30 enum ETarget
31 {
32 kDaughter = 0,
33 kMother,
5eb970a4 34 kEvent,
35 kMixEvent,
36 kLastCutTarget
37 };
38
39 // data type for check
2dab9030 40 enum EVarType
41 {
42 kNoVar = 0,
43 kInt,
5eb970a4 44 kDouble
45 };
46
2dab9030 47 AliRsnCut(ETarget target = kLastCutTarget);
413bbf44 48 AliRsnCut(const AliRsnCut& copy);
49 AliRsnCut& operator=(const AliRsnCut& copy);
2dab9030 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*/ };
69fbb331 53
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;}
67
5eb970a4 68 void SetRange(Int_t min, Int_t max) {fMinI = min; fMaxI = max; fVarType = kInt;}
5eb970a4 69 void SetRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max; fVarType = kDouble;}
70
71 void SetValue(Int_t value) {fMinI = value; fVarType = kInt;}
5eb970a4 72 void SetValue(Double_t value) {fMinD = value; fVarType = kDouble;}
69fbb331 73
74 Bool_t OkValue();
75 Bool_t OkRange();
76 Bool_t OkValueI();
77 Bool_t OkRangeI();
78 Bool_t OkValueD();
79 Bool_t OkRangeD();
5eb970a4 80
2dab9030 81 virtual void SetEvent(AliRsnEvent *event);
69fbb331 82 AliRsnEvent* GetEvent() {return fEvent;}
2dab9030 83
2dab9030 84 virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
85 virtual void Print(Option_t *opt = "") const;
5eb970a4 86
4fbb2459 87 protected:
5eb970a4 88
69fbb331 89 EVarType fVarType; // type of checked variable
90 ETarget fTarget; // type of object on which the cut is checked
5eb970a4 91
69fbb331 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)
5eb970a4 96
69fbb331 97 Int_t fCutValueI; // cut value INT
98 Double_t fCutValueD; // cut value DOUBLE
2dab9030 99
69fbb331 100 Bool_t fCutResult; // tells if the cut is passed or not
5eb970a4 101
69fbb331 102 AliRsnEvent *fEvent; //! pointer to current event (can be needed sometimes, but never streamed)
413bbf44 103
5eb970a4 104 ClassDef(AliRsnCut, 1)
06351446 105};
106
107#endif