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