]>
Commit | Line | Data |
---|---|---|
465f48b2 | 1 | #ifndef ALIRSNDAUGHTERDEF_H |
2 | #define ALIRSNDAUGHTERDEF_H | |
3 | ||
7356f978 | 4 | // |
f34f960b | 5 | // Definition for a single candidate daughter. |
6 | // They can be chosen among the following possibilities: | |
7 | // | |
8 | // -- particle species, chosen in the enum AliRsnDaughter::ESpecies; | |
9 | // this option does two things: | |
10 | // -- when possible (needs MC) and required, allow to check is a daughter | |
11 | // is of the defined species (e.g.: for selecting true daughters of a resonance) | |
12 | // -- defines the mass to be assigned to this object, for any purpose | |
13 | // (e.g.: to compute its 4-momentum to be used for a resonance mass) | |
7356f978 | 14 | // |
61f275d1 | 15 | // -- track charge, which can be '+', '-', '0', |
f34f960b | 16 | // -- any other char leaves this undefined (use only in daughter monitor loops) |
17 | // -- when doing resonance analysis, or when RSN Input handler needs to be used, | |
18 | // this must always be defined | |
61f275d1 | 19 | // |
f34f960b | 20 | // -- object type (track/V0/cascade) |
21 | // -- could be needed to select tracks when particle species is not specified | |
22 | // -- works only in single daughter loops | |
61f275d1 | 23 | // |
7356f978 | 24 | |
465f48b2 | 25 | #include "AliRsnDaughter.h" |
26 | ||
27 | class AliRsnDaughterDef : public TObject { | |
28 | public: | |
29 | ||
3a15c861 | 30 | AliRsnDaughterDef(); |
7356f978 | 31 | AliRsnDaughterDef(EPARTYPE type, Char_t charge = 0); |
32 | AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t charge = 0); | |
3a15c861 | 33 | AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t charge = 0); |
465f48b2 | 34 | AliRsnDaughterDef(const AliRsnDaughterDef ©); |
61f275d1 | 35 | AliRsnDaughterDef &operator= (const AliRsnDaughterDef ©); |
465f48b2 | 36 | virtual ~AliRsnDaughterDef() { } |
37 | ||
c865cb1d | 38 | AliRsnDaughter::ESpecies GetPID() const {return fPID;} |
39 | Double_t GetMass() const {return fMass;} | |
40 | Char_t GetChargeC() const {return fCharge;} | |
41 | Short_t GetChargeS() const {if (fCharge == '+') return 1; else if (fCharge == '-') return -1; else return 0;} | |
42 | AliRsnDaughter::ERefType GetRefType() const {return fRefType;} | |
61f275d1 | 43 | virtual const char *GetName() const {return Form("%s%c", AliRsnDaughter::SpeciesName(fPID), fCharge);} |
c865cb1d | 44 | Bool_t IsChargeDefined() const {return (fCharge == '+' || fCharge == '-' || fCharge == '0');} |
61f275d1 | 45 | |
c865cb1d | 46 | void SetPID(AliRsnDaughter::ESpecies pid) {fPID = pid; fRefType = AliRsnDaughter::RefType(pid); fMass = AliRsnDaughter::SpeciesMass(pid);} |
47 | void SetCharge(Char_t charge) {fCharge = charge;} | |
48 | void SetRefType(AliRsnDaughter::ERefType type) {fRefType = type;} | |
61f275d1 | 49 | |
7356f978 | 50 | Bool_t MatchesPID(AliRsnDaughter *daughter); |
b63357a0 | 51 | Bool_t MatchesCharge(AliRsnDaughter *daughter) const; |
52 | Bool_t MatchesRefType(AliRsnDaughter *daughter) const; | |
f34f960b | 53 | Bool_t MatchesPDG(Int_t pdgCode) {return (AliRsnDaughter::SpeciesPDG(fPID) == pdgCode);} |
b63357a0 | 54 | Bool_t MatchesChargeS(Short_t charge) const {return (GetChargeS() == charge);} |
55 | Bool_t MatchesChargeC(Char_t charge) const {return (GetChargeC() == charge);} | |
465f48b2 | 56 | |
57 | private: | |
58 | ||
c865cb1d | 59 | AliRsnDaughter::ESpecies fPID; // PID of particles |
60 | Double_t fMass; // mass of particles (subordinate to fPID) | |
61 | Char_t fCharge; // charge of particles | |
62 | AliRsnDaughter::ERefType fRefType; // object reference type (track/V0/cascade) | |
465f48b2 | 63 | |
64 | // ROOT dictionary | |
65 | ClassDef(AliRsnDaughterDef, 1) | |
66 | }; | |
67 | ||
7356f978 | 68 | //__________________________________________________________________________________________________ |
69 | inline Bool_t AliRsnDaughterDef::MatchesPID(AliRsnDaughter *daughter) | |
70 | { | |
71 | // | |
61f275d1 | 72 | // Checks if the passed daughter true particle type |
f34f960b | 73 | // matches the species defined in fPID data member, |
74 | // by comparing the corresponding PDG codes of both in absolute value. | |
75 | // Returns kTRUE when the two codes match, and kFALSE when: | |
76 | // -- PDG codes don't match | |
77 | // -- fPID is not set to a well-defined species (AliRsnDaughter::kUnknown) | |
78 | // -- passed daughter has not MC information | |
7356f978 | 79 | // |
f34f960b | 80 | if (fPID == AliRsnDaughter::kUnknown) { |
81 | AliError("This DaughterDef has undefined species: cannot check PDG matching with passed arg"); | |
82 | return kFALSE; | |
83 | } else if (!daughter->GetRefMC()) { | |
84 | AliError("The passed argument has NULL MC pointer: cannot check PDG matching with this DaughterDef"); | |
85 | return kFALSE; | |
86 | } | |
61f275d1 | 87 | |
f34f960b | 88 | return MatchesPDG(daughter->GetPDGAbs()); |
7356f978 | 89 | } |
61f275d1 | 90 | |
7356f978 | 91 | //__________________________________________________________________________________________________ |
b63357a0 | 92 | inline Bool_t AliRsnDaughterDef::MatchesCharge(AliRsnDaughter *daughter) const |
7356f978 | 93 | { |
94 | // | |
f34f960b | 95 | // Checks if the passed daughter charge matches that defined in fCharge data member. |
96 | // If fCharge is not initialized to '+', '-' or '0', that is interpreted as if the user | |
97 | // does not want to select in charge, and then the function returns always kTRUE. | |
7356f978 | 98 | // |
99 | ||
100 | switch (fCharge) { | |
101 | case '+': return daughter->IsPos(); | |
102 | case '-': return daughter->IsNeg(); | |
103 | case '0': return daughter->IsNeutral(); | |
104 | default : return kTRUE; | |
105 | } | |
106 | } | |
f34f960b | 107 | |
7356f978 | 108 | //__________________________________________________________________________________________________ |
b63357a0 | 109 | inline Bool_t AliRsnDaughterDef::MatchesRefType(AliRsnDaughter *daughter) const |
7356f978 | 110 | { |
111 | // | |
f34f960b | 112 | // Checks that the daughter object type matches that defined in fRefType data member. |
113 | // If fRefType is initialized to AliRsnDaughter::kNoType, that is interpreted as if the user | |
114 | // does not want to select in type and then the function returns always kTRUE. | |
7356f978 | 115 | // |
116 | ||
d7712d44 | 117 | AliRsnDaughter::ERefType type = daughter->RefType(); |
61f275d1 | 118 | |
119 | if (fRefType != AliRsnDaughter::kNoType) | |
d7712d44 | 120 | return (type == fRefType); |
121 | else | |
122 | return kTRUE; | |
7356f978 | 123 | } |
124 | ||
465f48b2 | 125 | #endif |