]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnTarget.h
AliRsnCutManager:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnTarget.h
1 //
2 // *** Class AliRsnTarget ***
3 //
4 // Base class used wherever it is needed to check the class type of 
5 // an object (daughter, mother, event) which could be used for 
6 // cut checking or value computing.
7 // Since most of these operation are implemented into classes that 
8 // operate on any of such objects, then this class helps in making sure
9 // that the object being processed corresponds to what is expected.
10 //
11
12 #ifndef ALIRSNTARGET_H
13 #define ALIRSNTARGET_H
14
15 #include "TNamed.h"
16
17 #include "AliRsnEvent.h"
18
19 class AliRsnDaughter;
20 class AliRsnMother;
21
22 class AliRsnTarget : public TNamed
23 {
24   public:
25   
26     enum ETargetType
27     {
28       kDaughter,
29       kMother,
30       kEvent,
31       kTargetTypes
32     };
33
34     AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
35     AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
36     AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
37     AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fDaughter = 0x0; fMother = 0x0; fEvent = 0x0; return (*this); }
38     virtual ~AliRsnTarget() { /*nothing*/ }
39     
40     Bool_t           IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
41     ETargetType      GetTargetType() const             {return fTargetType;}
42     Char_t           GetTargetTypeChar() const;
43     const char*      GetTargetTypeName() const;
44     void             SetTargetType(ETargetType type)   {fTargetType = type;}
45     Bool_t           TargetOK(TObject *object);
46     AliRsnDaughter*  GetTargetDaughter()               {return fDaughter;}
47     AliRsnMother*    GetTargetMother()                 {return fMother;}
48     AliRsnEvent*     GetTargetEvent()                  {return fEvent;}
49     
50     static AliRsnEvent*  GetCurrentEvent()                   {return fgCurrentEvent;}
51     static void          SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;}
52     static void          SwitchToFirst()                     {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();}
53     static void          SwitchToSecond()                    {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();}
54
55   protected:
56   
57     ETargetType         fTargetType;     //  target type selected for this object
58     static AliRsnEvent *fgCurrentEvent;  //! pointer to current event (useful in many cases)
59     
60     AliRsnDaughter     *fDaughter;       //  utility pointer to target object (daughter)
61     AliRsnMother       *fMother;         //  utility pointer to target object (mother)
62     AliRsnEvent        *fEvent;          //  utility pointer to target object (event)
63     
64     static const Double_t fgkVeryBig;    //  utility value for very large value
65     static const Double_t fgkVerySmall;  //  utility value for very small value
66     
67     // ROOT dictionary
68     ClassDef(AliRsnTarget, 1)
69 };
70
71 typedef AliRsnTarget::ETargetType RSNTARGET;
72
73 #endif