//
#include "AliLog.h"
+#include "AliPID.h"
#include "AliRsnPairDef.h"
ClassImp(AliRsnPairDef)
for (i = 0; i < 2; i++) {
fCharge[i] = '0';
fMass[i] = 0.0;
- fType[i] = AliPID::kUnknown;
+ fPID[i] = AliPID::kUnknown;
+ fDaughterType[i] = AliRsnDaughter::kTrack;
}
}
-//_____________________________________________________________________________
-AliRsnPairDef::AliRsnPairDef
-(Char_t sign1, AliPID::EParticleType type1, Char_t sign2, AliPID::EParticleType type2, Int_t motherPDG, Double_t motherMass) :
- fMotherMass(motherMass),
- fMotherPDG(motherPDG)
-{
-//
-// Constructor with arguments.
-// This constructor allows to define all the working parameters.
-//
-
- SetPair(sign1, type1, sign2, type2);
-}
-
//_____________________________________________________________________________
AliRsnPairDef::AliRsnPairDef
(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG, Double_t motherMass) :
// This constructor allows to define all the working parameters.
//
- SetPair(sign1, type1, sign2, type2);
+ SetDaughters(type1, sign1, type2, sign2);
}
//_____________________________________________________________________________
AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
- TObject(copy),
- fMotherMass(copy.fMotherMass),
- fMotherPDG(copy.fMotherPDG)
+ TObject(copy),
+ fMotherMass(copy.fMotherMass),
+ fMotherPDG(copy.fMotherPDG)
{
//
// Copy constructor with standard behavior
//
- SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
+ SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]);
}
//_____________________________________________________________________________
fMotherMass = copy.fMotherMass;
fMotherPDG = copy.fMotherPDG;
- SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
+ SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]);
return (*this);
}
//_____________________________________________________________________________
-Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliPID::EParticleType type)
+Bool_t AliRsnPairDef::SetDaughter(Int_t i, AliPID::EParticleType type, Char_t charge)
{
//
// Set one element of the pair
AliPID pid;
- if (i < 0 || i > 1) {
+ if (i < 0 || i > 1)
+ {
AliError("Index out of range");
return kFALSE;
}
- if (charge != '+' && charge != '-') {
+ if (charge != '+' && charge != '-' && charge != '0')
+ {
AliError(Form("Character '%c' not recognized as charge sign"));
return kFALSE;
}
- if (type < 0 && type > (Int_t)AliPID::kSPECIES) {
+ if (type < 0 && type > (Int_t)AliPID::kSPECIESN)
+ {
AliError("Type index out of enumeration range");
return kFALSE;
}
+
fCharge[i] = charge;
- fType[i] = type;
+ fPID[i] = type;
fMass[i] = pid.ParticleMass(type);
+ if ((Int_t)type < AliPID::kSPECIES) fDaughterType[i] = AliRsnDaughter::kTrack;
+ else if (type == AliPID::kKaon0)
+ {
+ fDaughterType[i] = AliRsnDaughter::kV0;
+ fCharge[i] = '0';
+ }
+ else return kFALSE;
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliRsnPairDef::SetPair
-(Char_t charge1, AliPID::EParticleType type1, Char_t charge2, AliPID::EParticleType type2)
+Bool_t AliRsnPairDef::SetDaughters
+(AliPID::EParticleType type1, Char_t charge1, AliPID::EParticleType type2, Char_t charge2)
{
//
// Set both elements of the pair,
// returning logical AND of check for each one.
//
- Bool_t part1 = SetPairElement(0, charge1, type1);
- Bool_t part2 = SetPairElement(1, charge2, type2);
+ Bool_t part1 = SetDaughter(0, type1, charge1);
+ Bool_t part2 = SetDaughter(1, type2, charge2);
return (part1 && part2);
}
//_____________________________________________________________________________
-TString AliRsnPairDef::GetPairName() const
+const char* AliRsnPairDef::GetPairName() const
{
//
// Returns a compact string with the name of the pair,
// to be used for naming objects related to it.
//
- TString sName;
- sName += AliPID::ParticleShortName(fType[0]);
- sName += fCharge[0];
- sName += AliPID::ParticleShortName(fType[1]);
- sName += fCharge[1];
-
- return sName;
+ return Form("%s%c%s%c", AliPID::ParticleShortName(fPID[0]), fCharge[0], AliPID::ParticleShortName(fPID[1]), fCharge[1]);
}