]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnTarget.h
Improved functionality of AliRsnDaughterDef::MatchesDaughter()
[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           IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
39    ETargetType      GetTargetType() const             {return fTargetType;}
40    Char_t           GetTargetTypeChar() const;
41    const char*      GetTargetTypeName() const;
42    void             SetTargetType(ETargetType type)   {fTargetType = type;}
43    Bool_t           TargetOK(TObject *object);
44    AliRsnDaughter*  GetTargetDaughter()               {return fDaughter;}
45    AliRsnMother*    GetTargetMother()                 {return fMother;}
46    AliRsnEvent*     GetTargetEvent()                  {return fEvent;}
47
48    static AliRsnEvent*  GetCurrentEvent()                   {return fgCurrentEvent;}
49    static void          SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;}
50    static void          SwitchToFirst()                     {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();}
51    static void          SwitchToSecond()                    {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();}
52
53 protected:
54
55    ETargetType         fTargetType;     //  target type selected for this object
56    static AliRsnEvent *fgCurrentEvent;  //! pointer to current event (useful in many cases)
57
58    AliRsnDaughter     *fDaughter;       //  utility pointer to target object (daughter)
59    AliRsnMother       *fMother;         //  utility pointer to target object (mother)
60    AliRsnEvent        *fEvent;          //  utility pointer to target object (event)
61
62    static const Double_t fgkVeryBig;    //  utility value for very large value
63    static const Double_t fgkVerySmall;  //  utility value for very small value
64
65    // ROOT dictionary
66    ClassDef(AliRsnTarget, 1)
67 };
68
69 typedef AliRsnTarget::ETargetType RSNTARGET;
70
71 #endif