//
#include "AliLog.h"
-#include "AliRsnDaughter.h"
+#include "AliPID.h"
#include "AliRsnPairDef.h"
ClassImp(AliRsnPairDef)
//_____________________________________________________________________________
-AliRsnPairDef::AliRsnPairDef() : fMotherPDG(0)
+AliRsnPairDef::AliRsnPairDef() : fMotherMass(0.0), fMotherPDG(0)
{
//
// Empty constructor.
//
Int_t i;
- for (i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
fCharge[i] = '0';
fMass[i] = 0.0;
- fType[i] = AliRsnPID::kUnknown;
+ fPID[i] = AliPID::kUnknown;
+ fDaughterType[i] = AliRsnDaughter::kTrack;
}
}
//_____________________________________________________________________________
AliRsnPairDef::AliRsnPairDef
-(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2, Int_t motherPDG) :
- fMotherPDG(motherPDG)
+(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, 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
-(AliRsnPID::EType type1, Char_t sign1, AliRsnPID::EType type2, Char_t sign2, Int_t motherPDG) :
- fMotherPDG(motherPDG)
-{
-//
-// Constructor with arguments.
-// 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),
- 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]);
}
//_____________________________________________________________________________
// Assignment operator with standard behavior.
//
+ 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, AliRsnPID::EType type)
+Bool_t AliRsnPairDef::SetDaughter(Int_t i, AliPID::EParticleType type, Char_t charge)
{
//
// Set one element of the pair
// and returns warnings if the type is not valid.
//
- if (i < 0 || i > 1)
+
+ AliPID pid;
+
+ 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"));
+ AliError(Form("Character '%c' not recognized as charge sign", charge));
return kFALSE;
}
- if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown)
+ if (type < 0 && type > (Int_t)AliPID::kSPECIESN)
{
AliError("Type index out of enumeration range");
return kFALSE;
}
+
fCharge[i] = charge;
- fType[i] = type;
- fMass[i] = AliRsnPID::ParticleMass(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, AliRsnPID::EType type1, Char_t charge2, AliRsnPID::EType 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);
}
//_____________________________________________________________________________
-Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1)
-{
-//
-// Compute a weight for filling the histograms:
-// probability of first track to be identified as 'type[0]' times
-// the probability of second track to be identified as 'type[1]',
-// according to the order of appearance in argument list.
-//
-
- Double_t prob0 = d0->PIDProb()[fType[0]];
- Double_t prob1 = d1->PIDProb()[fType[1]];
-
- return prob0*prob1;
-}
-
-//_____________________________________________________________________________
-TString AliRsnPairDef::GetPairName()
+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 += AliRsnPID::ParticleName(fType[0]);
- sName += fCharge[0];
- sName += AliRsnPID::ParticleName(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]);
}