]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCut.h
Made a general review to fix as possible most coding conventions violations.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCut.h
1 //
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)
16 //
17
18 #ifndef ALIRSNCUT_H
19 #define ALIRSNCUT_H
20
21 #include "TNamed.h"
22
23 class AliRsnDaughter;
24 class AliRsnPairParticle;
25 class AliRsnEvent;
26
27 class AliRsnCut : public TNamed
28 {
29   public:
30
31     // possible targets for a cut
32     enum ETarget {
33       kParticle = 0,
34       kPair,
35       kEvent,
36       kMixEvent,
37       kLastCutTarget
38     };
39
40     // data type for check
41     enum EVarType {
42       kInt = 0,
43       kULong,
44       kDouble
45     };
46
47     AliRsnCut();
48     AliRsnCut(const char *name, Int_t    min, Int_t    max = 0);
49     AliRsnCut(const char *name, ULong_t  min, ULong_t  max = 0);
50     AliRsnCut(const char *name, Double_t min, Double_t max = 0);
51     virtual ~AliRsnCut() {;};
52
53     void             SetRange(Int_t    min, Int_t    max) {fMinI = min; fMaxI = max; fVarType = kInt;}
54     void             SetRange(ULong_t  min, ULong_t  max) {fMinU = min; fMaxU = max; fVarType = kULong;}
55     void             SetRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max; fVarType = kDouble;}
56
57     void             SetValue(Int_t value)    {fMinI = value; fVarType = kInt;}
58     void             SetValue(ULong_t value)  {fMinU = value; fVarType = kULong;}
59     void             SetValue(Double_t value) {fMinD = value; fVarType = kDouble;}
60
61     virtual Bool_t   IsSelected(ETarget tgt, AliRsnDaughter *daughter);
62     virtual Bool_t   IsSelected(ETarget tgt, AliRsnPairParticle *pair);
63     virtual Bool_t   IsSelected(ETarget tgt, AliRsnEvent *event);
64     virtual Bool_t   IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2);
65
66   protected:
67
68     Bool_t  OkValue();
69     Bool_t  OkRange();
70
71     EVarType  fVarType;    // type of checked variable
72
73     Int_t     fMinI;       // lower edge of INT range or ref. value for INT CUT
74     Int_t     fMaxI;       // upper edge of INT range (not used for value cuts)
75     ULong_t   fMinU;       // lower edge of ULONG range or ref. value for INT CUT
76     ULong_t   fMaxU;       // upper edge of ULONG range (not used for value cuts)
77     Double_t  fMinD;       // lower edge of DOUBLE range or ref. value for INT CUT
78     Double_t  fMaxD;       // upper edge of DOUBLE range (not used for value cuts)
79
80     Int_t     fCutValueI;  // cut value
81     ULong_t   fCutValueU;  // cut value
82     Double_t  fCutValueD;  // cut value
83     Bool_t    fCutResult;  // tells if the cut is passed or not
84
85     ClassDef(AliRsnCut, 1)
86 };
87
88 #endif