2 // Class AliRsnDaughterDef
4 // Defines a decay channel for a resonance,
5 // resulting in a specified PDG code for the mother,
6 // and the particle type for the daughters, defined
7 // according to the internal PID format of the package
9 // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
14 #include "AliRsnDaughterDef.h"
16 ClassImp(AliRsnDaughterDef)
19 //_____________________________________________________________________________
20 AliRsnDaughterDef::AliRsnDaughterDef() :
23 fPID(AliPID::kUnknown),
24 fDaughterType(AliRsnDaughter::kNoType)
28 // This version of constructor leaves all undefined,
29 // and all daughters will be accepted.
33 //_____________________________________________________________________________
34 AliRsnDaughterDef::AliRsnDaughterDef(AliPID::EParticleType type, Char_t sign) :
38 fDaughterType(AliRsnDaughter::kNoType)
42 // This version of constructor initializes the PID type
43 // and the charge (optional, leave its default to include both),
44 // and calls 'SetDaughter()' to assign the object type accordingly.
47 SetDaughter(type, sign);
50 //_____________________________________________________________________________
51 AliRsnDaughterDef::AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t sign) :
54 fPID(AliPID::kUnknown),
55 fDaughterType(refType)
59 // This version of constructor initialized the object type
60 // and the charge (optiona, leave its defaul to include both),
61 // and sets the PID type undefined.
65 //_____________________________________________________________________________
66 AliRsnDaughterDef::AliRsnDaughterDef(const AliRsnDaughterDef ©) :
69 fCharge(copy.fCharge),
71 fDaughterType(copy.fDaughterType)
74 // Copy constructor with standard behavior
78 //_____________________________________________________________________________
79 const AliRsnDaughterDef& AliRsnDaughterDef::operator=(const AliRsnDaughterDef ©)
82 // Assignment operator with standard behavior.
86 fCharge = copy.fCharge;
88 fDaughterType = copy.fDaughterType;
93 //_____________________________________________________________________________
94 Bool_t AliRsnDaughterDef::SetDaughter(AliPID::EParticleType type, Char_t charge)
97 // Set one element of the pair
98 // and returns warnings if the type is not valid.
103 // charge and type come from arguments
107 // mass is assigned by AliPID, if possible
109 if ((Int_t)type >= 0 && (Int_t)type < AliPID::kSPECIESN)
110 fMass = pid.ParticleMass(type);
112 // object type is determined by type itself
113 if ((Int_t)type >= 0 && (Int_t)type < AliPID::kSPECIES)
114 fDaughterType = AliRsnDaughter::kTrack;
115 else if (type == AliPID::kKaon0) {
116 fDaughterType = AliRsnDaughter::kV0;
120 fDaughterType = AliRsnDaughter::kNoType;
125 //_____________________________________________________________________________
126 Bool_t AliRsnDaughterDef::MatchesDaughter(AliRsnDaughter *checked, Bool_t truePID)
129 // Checks if the argument matches the definitions here.
130 // If second argument is kTRUE and checked daughter has MC,
131 // check also that the particle species is correct.
135 // if charge was set to '+', '-' or '0'
136 // the checked daughter charge must match that defined in the settings
137 // otherwise no specific charge requirement was done
138 Bool_t chargeMatch = kTRUE;
141 chargeMatch = checked->IsPos();
144 chargeMatch = checked->IsNeg();
147 chargeMatch = checked->IsNeutral();
153 // object type matching
154 Bool_t objMatch = kTRUE;
155 if (fDaughterType != AliRsnDaughter::kNoType)
156 objMatch = (checked->RefType() == fDaughterType);
158 // particle type matching (only if MC is available and second arg is true)
159 Bool_t pidMatch = kTRUE;
160 if (truePID && fPID != AliPID::kUnknown && checked->GetRefMC())
161 pidMatch = (AliPID::ParticleCode(fPID) == checked->GetPDG());
163 // return the AND of all
164 return (chargeMatch && objMatch && pidMatch);