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() : 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) :
43 // Constructor with arguments.
44 // This constructor allows to define all the working parameters.
47 SetPair(sign1, type1, sign2, type2);
50 //_____________________________________________________________________________
51 AliRsnPairDef::AliRsnPairDef
52 (AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG) :
56 // Constructor with arguments.
57 // This constructor allows to define all the working parameters.
60 SetPair(sign1, type1, sign2, type2);
64 //_____________________________________________________________________________
65 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
67 fMotherPDG(copy.fMotherPDG)
70 // Copy constructor with standard behavior
73 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
76 //_____________________________________________________________________________
77 const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©)
80 // Assignment operator with standard behavior.
83 fMotherPDG = copy.fMotherPDG;
84 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
89 //_____________________________________________________________________________
90 Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliPID::EParticleType type)
93 // Set one element of the pair
94 // and returns warnings if the type is not valid.
100 AliError("Index out of range");
103 if (charge != '+' && charge != '-') {
104 AliError(Form("Character '%c' not recognized as charge sign"));
107 if (type < 0 && type > (Int_t)AliPID::kSPECIES) {
108 AliError("Type index out of enumeration range");
113 fMass[i] = pid.ParticleMass(type);
118 //_____________________________________________________________________________
119 Bool_t AliRsnPairDef::SetPair
120 (Char_t charge1, AliPID::EParticleType type1, Char_t charge2, AliPID::EParticleType type2)
123 // Set both elements of the pair,
124 // returning logical AND of check for each one.
126 Bool_t part1 = SetPairElement(0, charge1, type1);
127 Bool_t part2 = SetPairElement(1, charge2, type2);
129 return (part1 && part2);
132 //_____________________________________________________________________________
133 TString AliRsnPairDef::GetPairName() const
136 // Returns a compact string with the name of the pair,
137 // to be used for naming objects related to it.
141 sName += AliPID::ParticleShortName(fType[0]);
143 sName += AliPID::ParticleShortName(fType[1]);