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)
13 #include "AliRsnPairDef.h"
15 ClassImp(AliRsnPairDef)
17 //_____________________________________________________________________________
18 AliRsnPairDef::AliRsnPairDef() : fMotherMass(0.0), fMotherPDG(0)
22 // Initializes the data members to default values:
23 // - no definition of particles in the pair;
24 // - histogram binning undefined.
25 // When using this constructor, all analysis elements (particles, histogram)
26 // must be defined before starting event processing.
30 for (i = 0; i < 2; i++) {
33 fType[i] = AliPID::kUnknown;
37 //_____________________________________________________________________________
38 AliRsnPairDef::AliRsnPairDef
39 (Char_t sign1, AliPID::EParticleType type1, Char_t sign2, AliPID::EParticleType type2, Int_t motherPDG, Double_t motherMass) :
40 fMotherMass(motherMass),
44 // Constructor with arguments.
45 // This constructor allows to define all the working parameters.
48 SetPair(sign1, type1, sign2, type2);
51 //_____________________________________________________________________________
52 AliRsnPairDef::AliRsnPairDef
53 (AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG, Double_t motherMass) :
54 fMotherMass(motherMass),
58 // Constructor with arguments.
59 // This constructor allows to define all the working parameters.
62 SetPair(sign1, type1, sign2, type2);
66 //_____________________________________________________________________________
67 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
69 fMotherMass(copy.fMotherMass),
70 fMotherPDG(copy.fMotherPDG)
73 // Copy constructor with standard behavior
76 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
79 //_____________________________________________________________________________
80 const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©)
83 // Assignment operator with standard behavior.
86 fMotherMass = copy.fMotherMass;
87 fMotherPDG = copy.fMotherPDG;
88 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
93 //_____________________________________________________________________________
94 Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliPID::EParticleType type)
97 // Set one element of the pair
98 // and returns warnings if the type is not valid.
103 if (i < 0 || i > 1) {
104 AliError("Index out of range");
107 if (charge != '+' && charge != '-') {
108 AliError(Form("Character '%c' not recognized as charge sign", charge));
111 if (type < 0 && type > (Int_t)AliPID::kSPECIES) {
112 AliError("Type index out of enumeration range");
117 fMass[i] = pid.ParticleMass(type);
122 //_____________________________________________________________________________
123 Bool_t AliRsnPairDef::SetPair
124 (Char_t charge1, AliPID::EParticleType type1, Char_t charge2, AliPID::EParticleType type2)
127 // Set both elements of the pair,
128 // returning logical AND of check for each one.
130 Bool_t part1 = SetPairElement(0, charge1, type1);
131 Bool_t part2 = SetPairElement(1, charge2, type2);
133 return (part1 && part2);
136 //_____________________________________________________________________________
137 TString AliRsnPairDef::GetPairName() const
140 // Returns a compact string with the name of the pair,
141 // to be used for naming objects related to it.
145 sName += AliPID::ParticleShortName(fType[0]);
147 sName += AliPID::ParticleShortName(fType[1]);