]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Class AliRsnPairDef | |
3 | // | |
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 | |
8 | // | |
9 | // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
10 | // | |
11 | ||
12 | #include "AliLog.h" | |
13 | #include "AliPID.h" | |
14 | #include "AliRsnPairDef.h" | |
15 | ||
16 | ClassImp(AliRsnPairDef) | |
17 | ||
18 | //_____________________________________________________________________________ | |
19 | AliRsnPairDef::AliRsnPairDef() : fMotherMass(0.0), fMotherPDG(0) | |
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 | fPID[i] = AliPID::kUnknown; | |
35 | fDaughterType[i] = AliRsnDaughter::kTrack; | |
36 | } | |
37 | } | |
38 | ||
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), | |
43 | fMotherPDG(motherPDG) | |
44 | { | |
45 | // | |
46 | // Constructor with arguments. | |
47 | // This constructor allows to define all the working parameters. | |
48 | // | |
49 | ||
50 | SetDaughters(type1, sign1, type2, sign2); | |
51 | } | |
52 | ||
53 | ||
54 | //_____________________________________________________________________________ | |
55 | AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) : | |
56 | TObject(copy), | |
57 | fMotherMass(copy.fMotherMass), | |
58 | fMotherPDG(copy.fMotherPDG) | |
59 | { | |
60 | // | |
61 | // Copy constructor with standard behavior | |
62 | // | |
63 | ||
64 | SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); | |
65 | } | |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©) | |
69 | { | |
70 | // | |
71 | // Assignment operator with standard behavior. | |
72 | // | |
73 | ||
74 | fMotherMass = copy.fMotherMass; | |
75 | fMotherPDG = copy.fMotherPDG; | |
76 | SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); | |
77 | ||
78 | return (*this); | |
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
82 | Bool_t AliRsnPairDef::SetDaughter(Int_t i, AliPID::EParticleType type, Char_t charge) | |
83 | { | |
84 | // | |
85 | // Set one element of the pair | |
86 | // and returns warnings if the type is not valid. | |
87 | // | |
88 | ||
89 | AliPID pid; | |
90 | ||
91 | if (i < 0 || i > 1) | |
92 | { | |
93 | AliError("Index out of range"); | |
94 | return kFALSE; | |
95 | } | |
96 | if (charge != '+' && charge != '-' && charge != '0') | |
97 | { | |
98 | AliError(Form("Character '%c' not recognized as charge sign", charge)); | |
99 | return kFALSE; | |
100 | } | |
101 | if (type < 0 && type > (Int_t)AliPID::kSPECIESN) | |
102 | { | |
103 | AliError("Type index out of enumeration range"); | |
104 | return kFALSE; | |
105 | } | |
106 | ||
107 | fCharge[i] = charge; | |
108 | fPID[i] = type; | |
109 | fMass[i] = pid.ParticleMass(type); | |
110 | if ((Int_t)type < AliPID::kSPECIES) fDaughterType[i] = AliRsnDaughter::kTrack; | |
111 | else if (type == AliPID::kKaon0) | |
112 | { | |
113 | fDaughterType[i] = AliRsnDaughter::kV0; | |
114 | fCharge[i] = '0'; | |
115 | } | |
116 | else return kFALSE; | |
117 | ||
118 | return kTRUE; | |
119 | } | |
120 | ||
121 | //_____________________________________________________________________________ | |
122 | Bool_t AliRsnPairDef::SetDaughters | |
123 | (AliPID::EParticleType type1, Char_t charge1, AliPID::EParticleType type2, Char_t charge2) | |
124 | { | |
125 | // | |
126 | // Set both elements of the pair, | |
127 | // returning logical AND of check for each one. | |
128 | // | |
129 | Bool_t part1 = SetDaughter(0, type1, charge1); | |
130 | Bool_t part2 = SetDaughter(1, type2, charge2); | |
131 | ||
132 | return (part1 && part2); | |
133 | } | |
134 | ||
135 | //_____________________________________________________________________________ | |
136 | const char* AliRsnPairDef::GetPairName() const | |
137 | { | |
138 | // | |
139 | // Returns a compact string with the name of the pair, | |
140 | // to be used for naming objects related to it. | |
141 | // | |
142 | ||
143 | return Form("%s%c%s%c", AliPID::ParticleShortName(fPID[0]), fCharge[0], AliPID::ParticleShortName(fPID[1]), fCharge[1]); | |
144 | } |