]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnTarget.h
bd9d524fb3e23530ee40daa8b11e2b7e22d30b84
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnTarget.h
1 #ifndef ALIRSNTARGET_H
2 #define ALIRSNTARGET_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6  
7 ////////////////////////////////////////////////////////////////////////////////
8 //
9 //  General class for cut/computation target objects (daughter/pair/event).
10 //
11 ////////////////////////////////////////////////////////////////////////////////
12
13 #include "TNamed.h"
14
15 #include "AliRsnEvent.h"
16
17 class AliRsnDaughter;
18 class AliRsnMother;
19
20 class AliRsnTarget : public TNamed {
21 public:
22
23    enum ETargetType {
24       kDaughter,
25       kMother,
26       kEvent,
27       kTargetTypes
28    };
29
30    AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
31    AliRsnTarget(const char *name, ETargetType type = kTargetTypes) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
32    AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
33    AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; return (*this); }
34    virtual ~AliRsnTarget() { /*nothing*/ }
35
36    Bool_t           IsAllNull()                       {return (!fDaughter && !fMother && !fEvent);}
37    Bool_t           IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
38    Bool_t           TargetOK(TObject *object);
39    
40    void             SetTargetType(ETargetType type)   {fTargetType = type;}
41    ETargetType      GetTargetType() const             {return fTargetType;}
42    Char_t           GetTargetTypeChar() const;
43    const char*      GetTargetTypeName() const;
44    
45    AliRsnDaughter*  GetTargetDaughter()               {return fDaughter;}
46    AliRsnMother*    GetTargetMother()                 {return fMother;}
47    AliRsnEvent*     GetTargetEvent()                  {return fEvent;}
48
49 protected:
50
51    ETargetType     fTargetType;  //  target type selected for this object
52    AliRsnDaughter *fDaughter;    //! internal pointer to which any checked object is cast if it matches expected type
53    AliRsnMother   *fMother;      //! internal pointer to which any checked object is cast if it matches expected type
54    AliRsnEvent    *fEvent;       //! internal pointer to which any checked object is cast if it matches expected type
55
56    // ROOT dictionary
57    ClassDef(AliRsnTarget, 2)
58 };
59
60 typedef AliRsnTarget::ETargetType RSNTARGET;
61
62 #endif