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)
14 #include "AliRsnPairDef.h"
16 ClassImp(AliRsnPairDef)
18 //_____________________________________________________________________________
19 AliRsnPairDef::AliRsnPairDef() : fMotherMass(0.0), fMotherPDG(0)
23 // Initializes the data members to default values:
24 // - no definition of particles in the pair;
25 // - histogram binning undefined.
26 // When using this constructor, all analysis elements (particles, histogram)
27 // must be defined before starting event processing.
31 for (i = 0; i < 2; i++) {
34 fPID[i] = AliPID::kUnknown;
35 fDaughterType[i] = AliRsnDaughter::kTrack;
39 //_____________________________________________________________________________
40 AliRsnPairDef::AliRsnPairDef
41 (AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG, Double_t motherMass) :
42 fMotherMass(motherMass),
46 // Constructor with arguments.
47 // This constructor allows to define all the working parameters.
50 SetDaughters(type1, sign1, type2, sign2);
54 //_____________________________________________________________________________
55 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
57 fMotherMass(copy.fMotherMass),
58 fMotherPDG(copy.fMotherPDG)
61 // Copy constructor with standard behavior
64 SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]);
67 //_____________________________________________________________________________
68 const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©)
71 // Assignment operator with standard behavior.
74 fMotherMass = copy.fMotherMass;
75 fMotherPDG = copy.fMotherPDG;
76 SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]);
81 //_____________________________________________________________________________
82 Bool_t AliRsnPairDef::SetDaughter(Int_t i, AliPID::EParticleType type, Char_t charge)
85 // Set one element of the pair
86 // and returns warnings if the type is not valid.
93 AliError("Index out of range");
96 if (charge != '+' && charge != '-' && charge != '0')
98 AliError(Form("Character '%c' not recognized as charge sign", charge));
101 if (type < 0 && type > (Int_t)AliPID::kSPECIESN)
103 AliError("Type index out of enumeration range");
109 fMass[i] = pid.ParticleMass(type);
110 if ((Int_t)type < AliPID::kSPECIES) fDaughterType[i] = AliRsnDaughter::kTrack;
111 else if (type == AliPID::kKaon0)
113 fDaughterType[i] = AliRsnDaughter::kV0;
121 //_____________________________________________________________________________
122 Bool_t AliRsnPairDef::SetDaughters
123 (AliPID::EParticleType type1, Char_t charge1, AliPID::EParticleType type2, Char_t charge2)
126 // Set both elements of the pair,
127 // returning logical AND of check for each one.
129 Bool_t part1 = SetDaughter(0, type1, charge1);
130 Bool_t part2 = SetDaughter(1, type2, charge2);
132 return (part1 && part2);
135 //_____________________________________________________________________________
136 const char* AliRsnPairDef::GetPairName() const
139 // Returns a compact string with the name of the pair,
140 // to be used for naming objects related to it.
143 return Form("%s%c%s%c", AliPID::ParticleShortName(fPID[0]), fCharge[0], AliPID::ParticleShortName(fPID[1]), fCharge[1]);