]>
Commit | Line | Data |
---|---|---|
465f48b2 | 1 | #ifndef ALIRSNDAUGHTERDEF_H |
2 | #define ALIRSNDAUGHTERDEF_H | |
3 | ||
7356f978 | 4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | //////////////////////////////////////////////////////////////////////////////// | |
8 | // | |
9 | // Single daughter definitions. | |
10 | // | |
11 | //////////////////////////////////////////////////////////////////////////////// | |
12 | ||
465f48b2 | 13 | #include "AliRsnDaughter.h" |
14 | ||
15 | class AliRsnDaughterDef : public TObject { | |
16 | public: | |
17 | ||
3a15c861 | 18 | AliRsnDaughterDef(); |
7356f978 | 19 | AliRsnDaughterDef(EPARTYPE type, Char_t charge = 0); |
20 | AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t charge = 0); | |
3a15c861 | 21 | AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t charge = 0); |
465f48b2 | 22 | AliRsnDaughterDef(const AliRsnDaughterDef ©); |
23 | const AliRsnDaughterDef& operator= (const AliRsnDaughterDef ©); | |
24 | virtual ~AliRsnDaughterDef() { } | |
25 | ||
26 | // getters | |
7356f978 | 27 | Double_t GetMass() const {return fMass;} |
28 | Char_t GetChargeC() const {return fCharge;} | |
29 | Short_t GetChargeS() const {if (fCharge == '+') return 1; else if (fCharge == '-') return -1; else return 0;} | |
30 | AliRsnDaughter::ESpecies GetPID() const {return fPID;} | |
31 | AliRsnDaughter::ERefType GetRefType() const {return fRefType;} | |
32 | virtual const char* GetName() const {return Form("%s%c", AliRsnDaughter::SpeciesName(fPID), fCharge);} | |
465f48b2 | 33 | |
34 | // setters | |
7356f978 | 35 | void SetPID(AliRsnDaughter::ESpecies pid = AliRsnDaughter::kUnknown) {fPID = pid; fRefType = AliRsnDaughter::RefType(pid);} |
36 | void SetCharge(Char_t charge = 0) {fCharge = charge;} | |
37 | void SetRefType(AliRsnDaughter::ERefType type = AliRsnDaughter::kNoType) {fRefType = type;} | |
465f48b2 | 38 | |
39 | // checker | |
7356f978 | 40 | Bool_t MatchesPID(AliRsnDaughter *daughter); |
41 | Bool_t MatchesCharge(AliRsnDaughter *daughter); | |
42 | Bool_t MatchesRefType(AliRsnDaughter *daughter); | |
465f48b2 | 43 | Bool_t MatchesDaughter(AliRsnDaughter *daughter, Bool_t truePID = kFALSE); |
7356f978 | 44 | |
45 | // external checker | |
46 | Bool_t MatchesPDG(Int_t pdgCode) {return (AliRsnDaughter::SpeciesPDG(fPID) == pdgCode);} | |
47 | Bool_t MatchesCharge(Short_t charge) {return (GetChargeS() == charge);} | |
465f48b2 | 48 | |
49 | private: | |
50 | ||
7356f978 | 51 | AliRsnDaughter::ESpecies fPID; // PID of particles |
52 | Double_t fMass; // mass of particles (subordinate to fPID) | |
53 | Char_t fCharge; // charge of particles | |
54 | AliRsnDaughter::ERefType fRefType; // object reference type (track/V0/cascade) | |
465f48b2 | 55 | |
56 | // ROOT dictionary | |
57 | ClassDef(AliRsnDaughterDef, 1) | |
58 | }; | |
59 | ||
7356f978 | 60 | //__________________________________________________________________________________________________ |
61 | inline Bool_t AliRsnDaughterDef::MatchesPID(AliRsnDaughter *daughter) | |
62 | { | |
63 | // | |
64 | // Checks if the daughter true PID (taken from MC) matches | |
65 | // that expected by this object. | |
66 | // Works only if an MC is present and the fPID data member | |
67 | // is set to something different from 'kUnknown'. | |
68 | // If above conditions are not satisfied, it returns always kTRUE. | |
69 | // | |
70 | ||
71 | if (fPID == AliRsnDaughter::kUnknown || daughter->GetRefMC() == 0x0) | |
72 | return kTRUE; | |
73 | else | |
74 | return (AliRsnDaughter::SpeciesPDG(fPID) == daughter->GetPDG()); | |
75 | } | |
76 | ||
77 | //__________________________________________________________________________________________________ | |
78 | inline Bool_t AliRsnDaughterDef::MatchesCharge(AliRsnDaughter *daughter) | |
79 | { | |
80 | // | |
81 | // Checks that the daughter charge matches that expected by this object. | |
82 | // Works only if the fCharge data member is set to '+', '-' or '0', | |
83 | // otherwise it accepts everything. | |
84 | // | |
85 | ||
86 | switch (fCharge) { | |
87 | case '+': return daughter->IsPos(); | |
88 | case '-': return daughter->IsNeg(); | |
89 | case '0': return daughter->IsNeutral(); | |
90 | default : return kTRUE; | |
91 | } | |
92 | } | |
93 | ||
94 | //__________________________________________________________________________________________________ | |
95 | inline Bool_t AliRsnDaughterDef::MatchesRefType(AliRsnDaughter *daughter) | |
96 | { | |
97 | // | |
98 | // Checks that the daughter object type matches that expected by this object. | |
99 | // Works only if the fRefType data member is different from AliRsnDaughter::kNoType, | |
100 | // otherwise it accepts everything. | |
101 | // | |
102 | ||
103 | switch (fRefType) { | |
104 | case AliRsnDaughter::kTrack : return daughter->IsTrack(); | |
105 | case AliRsnDaughter::kV0 : return daughter->IsV0(); | |
106 | case AliRsnDaughter::kCascade: return daughter->IsCascade(); | |
107 | default : return kTRUE; | |
108 | } | |
109 | } | |
110 | ||
465f48b2 | 111 | #endif |