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