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