]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnTarget.h
f3702db784af5cd61056016fe54a9a992a5d3377
[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 public:
24
25    enum ETargetType {
26       kDaughter,
27       kMother,
28       kEvent,
29       kTargetTypes
30    };
31
32    AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
33    AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
34    AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
35    AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fDaughter = 0x0; fMother = 0x0; fEvent = 0x0; return (*this); }
36    virtual ~AliRsnTarget() { /*nothing*/ }
37
38    Bool_t           IsAllNull()                       {return (!fDaughter && !fMother && !fEvent);}
39    Bool_t           IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
40    ETargetType      GetTargetType() const             {return fTargetType;}
41    Char_t           GetTargetTypeChar() const;
42    const char*      GetTargetTypeName() const;
43    void             SetTargetType(ETargetType type)   {fTargetType = type;}
44    Bool_t           TargetOK(TObject *object);
45    AliRsnDaughter*  GetTargetDaughter()               {return fDaughter;}
46    AliRsnMother*    GetTargetMother()                 {return fMother;}
47    AliRsnEvent*     GetTargetEvent()                  {return fEvent;}
48
49    static AliRsnEvent*  GetCurrentEvent()                   {return fgCurrentEvent;}
50    static void          SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;}
51    static void          SwitchToFirst()                     {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();}
52    static void          SwitchToSecond()                    {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();}
53
54 protected:
55
56    ETargetType         fTargetType;     //  target type selected for this object
57    static AliRsnEvent *fgCurrentEvent;  //! pointer to current event (useful in many cases)
58
59    AliRsnDaughter     *fDaughter;       //  utility pointer to target object (daughter)
60    AliRsnMother       *fMother;         //  utility pointer to target object (mother)
61    AliRsnEvent        *fEvent;          //  utility pointer to target object (event)
62
63    static const Double_t fgkVeryBig;    //  utility value for very large value
64    static const Double_t fgkVerySmall;  //  utility value for very small value
65
66    // ROOT dictionary
67    ClassDef(AliRsnTarget, 1)
68 };
69
70 typedef AliRsnTarget::ETargetType RSNTARGET;
71
72 #endif