1 #ifndef ALIRSNDAUGHTERDEF_H
2 #define ALIRSNDAUGHTERDEF_H
5 // Definition for a single candidate daughter.
6 // They can be chosen among the following possibilities:
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)
15 // -- track charge, which can be '+', '-', '0',
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
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
25 #include "AliRsnDaughter.h"
27 class AliRsnDaughterDef : public TObject {
31 AliRsnDaughterDef(EPARTYPE type, Char_t charge = 0);
32 AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t charge = 0);
33 AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t charge = 0);
34 AliRsnDaughterDef(const AliRsnDaughterDef ©);
35 AliRsnDaughterDef &operator= (const AliRsnDaughterDef ©);
36 virtual ~AliRsnDaughterDef() { }
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;}
43 virtual const char *GetName() const {return Form("%s%c", AliRsnDaughter::SpeciesName(fPID), fCharge);}
44 Bool_t IsChargeDefined() const {return (fCharge == '+' || fCharge == '-' || fCharge == '0');}
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;}
50 Bool_t MatchesPID(AliRsnDaughter *daughter);
51 Bool_t MatchesCharge(AliRsnDaughter *daughter) const;
52 Bool_t MatchesRefType(AliRsnDaughter *daughter) const;
53 Bool_t MatchesPDG(Int_t pdgCode) {return (AliRsnDaughter::SpeciesPDG(fPID) == pdgCode);}
54 Bool_t MatchesChargeS(Short_t charge) const {return (GetChargeS() == charge);}
55 Bool_t MatchesChargeC(Char_t charge) const {return (GetChargeC() == charge);}
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)
65 ClassDef(AliRsnDaughterDef, 1)
68 //__________________________________________________________________________________________________
69 inline Bool_t AliRsnDaughterDef::MatchesPID(AliRsnDaughter *daughter)
72 // Checks if the passed daughter true particle type
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
80 if (fPID == AliRsnDaughter::kUnknown) {
81 AliError("This DaughterDef has undefined species: cannot check PDG matching with passed arg");
83 } else if (!daughter->GetRefMC()) {
84 AliError("The passed argument has NULL MC pointer: cannot check PDG matching with this DaughterDef");
88 return MatchesPDG(daughter->GetPDGAbs());
91 //__________________________________________________________________________________________________
92 inline Bool_t AliRsnDaughterDef::MatchesCharge(AliRsnDaughter *daughter) const
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.
101 case '+': return daughter->IsPos();
102 case '-': return daughter->IsNeg();
103 case '0': return daughter->IsNeutral();
104 default : return kTRUE;
108 //__________________________________________________________________________________________________
109 inline Bool_t AliRsnDaughterDef::MatchesRefType(AliRsnDaughter *daughter) const
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.
117 AliRsnDaughter::ERefType type = daughter->RefType();
119 if (fRefType != AliRsnDaughter::kNoType)
120 return (type == fRefType);