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)
12 #include <Riostream.h>
15 #include "AliRsnDaughter.h"
16 #include "AliRsnPairDef.h"
18 ClassImp(AliRsnPairDef)
20 //_____________________________________________________________________________
21 AliRsnPairDef::AliRsnPairDef() : fMotherPDG(0)
25 // Initializes the data members to default values:
26 // - no definition of particles in the pair;
27 // - histogram binning undefined.
28 // When using this constructor, all analysis elements (particles, histogram)
29 // must be defined before starting event processing.
33 for (i = 0; i < 2; i++)
37 fType[i] = AliPID::kUnknown;
41 //_____________________________________________________________________________
42 AliRsnPairDef::AliRsnPairDef
43 (Char_t sign1, AliPID::EParticleType type1, Char_t sign2, AliPID::EParticleType type2, Int_t motherPDG) :
47 // Constructor with arguments.
48 // This constructor allows to define all the working parameters.
51 SetPair(sign1, type1, sign2, type2);
54 //_____________________________________________________________________________
55 AliRsnPairDef::AliRsnPairDef
56 (AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG) :
60 // Constructor with arguments.
61 // This constructor allows to define all the working parameters.
64 SetPair(sign1, type1, sign2, type2);
68 //_____________________________________________________________________________
69 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
71 fMotherPDG(copy.fMotherPDG)
74 // Copy constructor with standard behavior
77 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
80 //_____________________________________________________________________________
81 const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©)
84 // Assignment operator with standard behavior.
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.
105 AliError("Index out of range");
108 if (charge != '+' && charge != '-')
110 AliError(Form("Character '%c' not recognized as charge sign"));
113 if (type < 0 && type > (Int_t)AliPID::kSPECIES)
115 AliError("Type index out of enumeration range");
120 fMass[i] = pid.ParticleMass(type);
125 //_____________________________________________________________________________
126 Bool_t AliRsnPairDef::SetPair
127 (Char_t charge1, AliPID::EParticleType type1, Char_t charge2, AliPID::EParticleType type2)
130 // Set both elements of the pair,
131 // returning logical AND of check for each one.
133 Bool_t part1 = SetPairElement(0, charge1, type1);
134 Bool_t part2 = SetPairElement(1, charge2, type2);
136 return (part1 && part2);
139 //_____________________________________________________________________________
140 TString AliRsnPairDef::GetPairName()
143 // Returns a compact string with the name of the pair,
144 // to be used for naming objects related to it.
148 sName += AliPID::ParticleShortName(fType[0]);
150 sName += AliPID::ParticleShortName(fType[1]);