]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnPairDef.cxx
Class version updated.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairDef.cxx
CommitLineData
06351446 1//
e2bafbbc 2// Class AliRsnPairDef
06351446 3//
e2bafbbc 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
06351446 8//
e2bafbbc 9// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
06351446 10//
11
5eb970a4 12#include <Riostream.h>
13
06351446 14#include "AliLog.h"
15#include "AliRsnDaughter.h"
16#include "AliRsnPairDef.h"
17
18ClassImp(AliRsnPairDef)
19
20//_____________________________________________________________________________
aec0ec32 21AliRsnPairDef::AliRsnPairDef() : fMotherPDG(0)
06351446 22{
23//
24// Empty constructor.
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.
30//
31
e0baff8c 32 Int_t i;
33 for (i = 0; i < 2; i++)
34 {
35 fCharge[i] = '0';
36 fMass[i] = 0.0;
5eb970a4 37 fType[i] = AliPID::kUnknown;
e0baff8c 38 }
06351446 39}
40
41//_____________________________________________________________________________
42AliRsnPairDef::AliRsnPairDef
5eb970a4 43(Char_t sign1, AliPID::EParticleType type1, Char_t sign2, AliPID::EParticleType type2, Int_t motherPDG) :
aec0ec32 44 fMotherPDG(motherPDG)
06351446 45{
46//
47// Constructor with arguments.
48// This constructor allows to define all the working parameters.
49//
50
e0baff8c 51 SetPair(sign1, type1, sign2, type2);
06351446 52}
53
aec0ec32 54//_____________________________________________________________________________
55AliRsnPairDef::AliRsnPairDef
5eb970a4 56(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG) :
aec0ec32 57 fMotherPDG(motherPDG)
58{
59//
60// Constructor with arguments.
61// This constructor allows to define all the working parameters.
62//
63
e0baff8c 64 SetPair(sign1, type1, sign2, type2);
aec0ec32 65}
66
67
06351446 68//_____________________________________________________________________________
69AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef &copy) :
aec0ec32 70 TObject(copy),
71 fMotherPDG(copy.fMotherPDG)
06351446 72{
73//
74// Copy constructor with standard behavior
75//
76
e0baff8c 77 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
06351446 78}
79
80//_____________________________________________________________________________
81const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef &copy)
82{
83//
84// Assignment operator with standard behavior.
85//
86
e0baff8c 87 fMotherPDG = copy.fMotherPDG;
88 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
06351446 89
e0baff8c 90 return (*this);
06351446 91}
92
93//_____________________________________________________________________________
5eb970a4 94Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliPID::EParticleType type)
06351446 95{
96//
97// Set one element of the pair
98// and returns warnings if the type is not valid.
99//
5eb970a4 100
101 AliPID pid;
102
e0baff8c 103 if (i < 0 || i > 1)
104 {
105 AliError("Index out of range");
106 return kFALSE;
107 }
108 if (charge != '+' && charge != '-')
109 {
110 AliError(Form("Character '%c' not recognized as charge sign"));
111 return kFALSE;
112 }
5eb970a4 113 if (type < 0 && type > (Int_t)AliPID::kSPECIES)
e0baff8c 114 {
115 AliError("Type index out of enumeration range");
116 return kFALSE;
117 }
118 fCharge[i] = charge;
119 fType[i] = type;
5eb970a4 120 fMass[i] = pid.ParticleMass(type);
e0baff8c 121
122 return kTRUE;
06351446 123}
124
125//_____________________________________________________________________________
126Bool_t AliRsnPairDef::SetPair
5eb970a4 127(Char_t charge1, AliPID::EParticleType type1, Char_t charge2, AliPID::EParticleType type2)
06351446 128{
129//
130// Set both elements of the pair,
131// returning logical AND of check for each one.
132//
e0baff8c 133 Bool_t part1 = SetPairElement(0, charge1, type1);
134 Bool_t part2 = SetPairElement(1, charge2, type2);
135
136 return (part1 && part2);
06351446 137}
138
aec0ec32 139//_____________________________________________________________________________
140TString AliRsnPairDef::GetPairName()
141{
142//
143// Returns a compact string with the name of the pair,
144// to be used for naming objects related to it.
145//
e0baff8c 146
147 TString sName;
5eb970a4 148 sName += AliPID::ParticleShortName(fType[0]);
e0baff8c 149 sName += fCharge[0];
5eb970a4 150 sName += AliPID::ParticleShortName(fType[1]);
e0baff8c 151 sName += fCharge[1];
152
153 return sName;
aec0ec32 154}