Introduce the case when no files are to be processed and sent to the OCDB
[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"
13#include "AliRsnDaughter.h"
14#include "AliRsnPairDef.h"
15
16ClassImp(AliRsnPairDef)
17
18//_____________________________________________________________________________
aec0ec32 19AliRsnPairDef::AliRsnPairDef() : fMotherPDG(0)
06351446 20{
21//
22// Empty constructor.
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.
28//
29
e0baff8c 30 Int_t i;
31 for (i = 0; i < 2; i++)
32 {
33 fCharge[i] = '0';
34 fMass[i] = 0.0;
35 fType[i] = AliRsnPID::kUnknown;
36 }
06351446 37}
38
39//_____________________________________________________________________________
40AliRsnPairDef::AliRsnPairDef
e2bafbbc 41(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2, Int_t motherPDG) :
aec0ec32 42 fMotherPDG(motherPDG)
06351446 43{
44//
45// Constructor with arguments.
46// This constructor allows to define all the working parameters.
47//
48
e0baff8c 49 SetPair(sign1, type1, sign2, type2);
06351446 50}
51
52//_____________________________________________________________________________
aec0ec32 53AliRsnPairDef::AliRsnPairDef
54(AliRsnPID::EType type1, Char_t sign1, AliRsnPID::EType type2, Char_t sign2, Int_t motherPDG) :
55 fMotherPDG(motherPDG)
56{
57//
58// Constructor with arguments.
59// This constructor allows to define all the working parameters.
60//
61
e0baff8c 62 SetPair(sign1, type1, sign2, type2);
aec0ec32 63}
64
65
66//_____________________________________________________________________________
06351446 67AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef &copy) :
aec0ec32 68 TObject(copy),
69 fMotherPDG(copy.fMotherPDG)
06351446 70{
71//
72// Copy constructor with standard behavior
73//
74
e0baff8c 75 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
06351446 76}
77
78//_____________________________________________________________________________
79const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef &copy)
80{
81//
82// Assignment operator with standard behavior.
83//
84
e0baff8c 85 fMotherPDG = copy.fMotherPDG;
86 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
06351446 87
e0baff8c 88 return (*this);
06351446 89}
90
91//_____________________________________________________________________________
92Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliRsnPID::EType type)
93{
94//
95// Set one element of the pair
96// and returns warnings if the type is not valid.
97//
e0baff8c 98 if (i < 0 || i > 1)
99 {
100 AliError("Index out of range");
101 return kFALSE;
102 }
103 if (charge != '+' && charge != '-')
104 {
105 AliError(Form("Character '%c' not recognized as charge sign"));
106 return kFALSE;
107 }
108 if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown)
109 {
110 AliError("Type index out of enumeration range");
111 return kFALSE;
112 }
113 fCharge[i] = charge;
114 fType[i] = type;
115 fMass[i] = AliRsnPID::ParticleMass(type);
116
117 return kTRUE;
06351446 118}
119
120//_____________________________________________________________________________
121Bool_t AliRsnPairDef::SetPair
122(Char_t charge1, AliRsnPID::EType type1, Char_t charge2, AliRsnPID::EType type2)
123{
124//
125// Set both elements of the pair,
126// returning logical AND of check for each one.
127//
e0baff8c 128 Bool_t part1 = SetPairElement(0, charge1, type1);
129 Bool_t part2 = SetPairElement(1, charge2, type2);
130
131 return (part1 && part2);
06351446 132}
133
134//_____________________________________________________________________________
06351446 135Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1)
136{
137//
138// Compute a weight for filling the histograms:
139// probability of first track to be identified as 'type[0]' times
140// the probability of second track to be identified as 'type[1]',
141// according to the order of appearance in argument list.
142//
143
e0baff8c 144 Double_t prob0 = d0->PIDProb()[fType[0]];
145 Double_t prob1 = d1->PIDProb()[fType[1]];
06351446 146
e0baff8c 147 return prob0*prob1;
06351446 148}
aec0ec32 149
150//_____________________________________________________________________________
151TString AliRsnPairDef::GetPairName()
152{
153//
154// Returns a compact string with the name of the pair,
155// to be used for naming objects related to it.
156//
e0baff8c 157
158 TString sName;
159 sName += AliRsnPID::ParticleName(fType[0]);
160 sName += fCharge[0];
161 sName += AliRsnPID::ParticleName(fType[1]);
162 sName += fCharge[1];
163
164 return sName;
aec0ec32 165}