]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughterDef.h
Where possible, replaced dynamic_cast with ROOT RTTI using TClass.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughterDef.h
1 //
2 // Class AliRsnDaughterDef
3 //
4 // Defines some requirements to select a good candidate daughter for a resonance
5 // among all available objects presend in each event (tracks, V0s, etc. ...).
6 // This includes:
7 // -- track type (charged track, V0, cascade)
8 // -- track charge
9 // -- track PID type and related mass (only for charged)
10 //
11 // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
12 //
13
14 #ifndef ALIRSNDAUGHTERDEF_H
15 #define ALIRSNDAUGHTERDEF_H
16
17 #include "AliPID.h"
18 #include "AliRsnDaughter.h"
19
20 class AliRsnDaughterDef : public TObject {
21 public:
22
23    AliRsnDaughterDef();
24    AliRsnDaughterDef(AliPID::EParticleType type, Char_t charge = 0);
25    AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t charge = 0);
26    AliRsnDaughterDef(const AliRsnDaughterDef &copy);
27    const AliRsnDaughterDef& operator= (const AliRsnDaughterDef &copy);
28    virtual ~AliRsnDaughterDef() { }
29
30    // getters
31    Double_t                 GetMass()         const {return fMass;}
32    Char_t                   GetCharge()       const {return fCharge;}
33    Short_t                  GetChargeShort()  const {if (fCharge == '+') return 1; else if (fCharge == '-') return -1; else return 0;}
34    AliPID::EParticleType    GetPID()          const {return fPID;}
35    AliRsnDaughter::ERefType GetDaughterType() const {return fDaughterType;}
36    virtual const char*      GetName()         const {return Form("%s%c", AliPID::ParticleShortName(fPID), fCharge);}
37
38    // setters
39    Bool_t SetDaughter(AliPID::EParticleType pid, Char_t charge);
40    void   SetDaughterType(AliRsnDaughter::ERefType type) {fDaughterType = type;}
41    
42    // checker
43    Bool_t MatchesDaughter(AliRsnDaughter *daughter, Bool_t truePID = kFALSE);
44    Bool_t MatchesPID(Int_t pdgCode, Short_t charge)  {return ((AliPID::ParticleCode(fPID) == pdgCode) && charge == GetChargeShort());}
45
46 private:
47
48    Double_t                  fMass;         // mass of particles
49    Char_t                    fCharge;       // charge of particles
50    AliPID::EParticleType     fPID;          // PID of particles
51    AliRsnDaughter::ERefType  fDaughterType; // object type (track/V0)
52
53    // ROOT dictionary
54    ClassDef(AliRsnDaughterDef, 1)
55 };
56
57 #endif