]>
Commit | Line | Data |
---|---|---|
7356f978 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////////////////////////////////////// | |
b9bbd271 | 17 | // |
7356f978 | 18 | // This class contains all code which is used to compute any of the values |
19 | // which can be of interest within a resonance analysis. Besides the obvious | |
20 | // invariant mass, it allows to compute other utility values on all possible | |
21 | // targets, in order to allow a wide spectrum of binning and checks. | |
22 | // When needed, this object can also define a binning in the variable which | |
23 | // it is required to compute, which is used for initializing axes of output | |
24 | // histograms (see AliRsnFunction). | |
25 | // The value computation requires this object to be passed the object whose | |
26 | // informations will be used. This object can be of any allowed input type | |
27 | // (track, pair, event), then this class must inherit from AliRsnTarget. | |
28 | // Then, when value computation is attempted, a check on target type is done | |
29 | // and computation is successful only if expected target matches that of the | |
30 | // passed object. | |
31 | // In some cases, the value computation can require a support external object, | |
32 | // which must then be passed to this class. It can be of any type inheriting | |
33 | // from TObject. | |
b9bbd271 | 34 | // |
7356f978 | 35 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) |
36 | // M. Vala (martin.vala@cern.ch) | |
b9bbd271 | 37 | // |
7356f978 | 38 | //////////////////////////////////////////////////////////////////////////////// |
b9bbd271 | 39 | |
32992791 | 40 | #include "AliESDtrackCuts.h" |
99261e24 | 41 | #include "AliESDpid.h" |
42 | #include "AliAODPid.h" | |
092b1805 | 43 | #include "AliCentrality.h" |
99261e24 | 44 | |
b9bbd271 | 45 | #include "AliRsnEvent.h" |
46 | #include "AliRsnDaughter.h" | |
2dab9030 | 47 | #include "AliRsnMother.h" |
b9bbd271 | 48 | #include "AliRsnPairDef.h" |
11ed73f6 | 49 | #include "AliRsnDaughterDef.h" |
b9bbd271 | 50 | |
51 | #include "AliRsnValue.h" | |
52 | ||
53 | ClassImp(AliRsnValue) | |
54 | ||
55 | //_____________________________________________________________________________ | |
2dab9030 | 56 | AliRsnValue::AliRsnValue() : |
2a1c7696 | 57 | AliRsnTarget(), |
58 | fComputedValue(0), | |
c865cb1d | 59 | fBinArray(0) |
2dab9030 | 60 | { |
61 | // | |
32992791 | 62 | // Default constructor without arguments. |
63 | // Initialize data members to meaningless values. | |
2a1c7696 | 64 | // This method is provided for ROOT streaming, |
32992791 | 65 | // but should never be used directly by a user. |
2dab9030 | 66 | // |
67 | } | |
68 | ||
69 | //_____________________________________________________________________________ | |
70 | AliRsnValue::AliRsnValue | |
c865cb1d | 71 | (const char *name, Int_t nbins, Double_t min, Double_t max) : |
72 | AliRsnTarget(name), | |
2a1c7696 | 73 | fComputedValue(0.0), |
c865cb1d | 74 | fBinArray(0) |
b9bbd271 | 75 | { |
76 | // | |
32992791 | 77 | // Main constructor (version 1). |
78 | // This constructor defines in meaningful way all data members, | |
79 | // and defined a fixed binnings, subdividing the specified interval | |
80 | // into that many bins as specified in the integer argument. | |
81 | // --- | |
82 | // This method is also the entry point for all instances | |
83 | // of this class which don't need to do binning (e.g.: TNtuple inputs), | |
84 | // since arguments 3 to 5 have default values which don't create any | |
85 | // binning array, in order not to allocate memory when this is useless. | |
b9bbd271 | 86 | // |
2dab9030 | 87 | |
2a1c7696 | 88 | SetBins(nbins, min, max); |
2dab9030 | 89 | } |
90 | ||
91 | //_____________________________________________________________________________ | |
92 | AliRsnValue::AliRsnValue | |
c865cb1d | 93 | (const char *name, Double_t min, Double_t max, Double_t step) : |
94 | AliRsnTarget(name), | |
2a1c7696 | 95 | fComputedValue(0.0), |
c865cb1d | 96 | fBinArray(0) |
2dab9030 | 97 | { |
98 | // | |
32992791 | 99 | // Main constructor (version 2). |
100 | // This constructor defines in meaningful way all data members | |
101 | // and creates enough equal bins of the specified size to cover | |
102 | // the required interval. | |
2dab9030 | 103 | // |
104 | ||
2a1c7696 | 105 | SetBins(min, max, step); |
b9bbd271 | 106 | } |
107 | ||
108 | //_____________________________________________________________________________ | |
b2b08ca2 | 109 | AliRsnValue::AliRsnValue |
c865cb1d | 110 | (const char *name, Int_t nbins, Double_t *array) : |
111 | AliRsnTarget(name), | |
2a1c7696 | 112 | fComputedValue(0.0), |
c865cb1d | 113 | fBinArray(0) |
b9bbd271 | 114 | { |
115 | // | |
32992791 | 116 | // Main constructor (version 3). |
117 | // This constructor defines in meaningful way all data members | |
118 | // and creates a set of variable bins delimited by the passed array. | |
b2b08ca2 | 119 | // |
120 | ||
2a1c7696 | 121 | SetBins(nbins, array); |
b9bbd271 | 122 | } |
123 | ||
124 | //_____________________________________________________________________________ | |
2a1c7696 | 125 | AliRsnValue::AliRsnValue(const AliRsnValue& copy) : |
126 | AliRsnTarget(copy), | |
127 | fComputedValue(copy.fComputedValue), | |
c865cb1d | 128 | fBinArray(copy.fBinArray) |
52944696 | 129 | { |
130 | // | |
32992791 | 131 | // Copy constructor. |
132 | // Duplicates the binning array and copies all settings. | |
52944696 | 133 | // |
134 | } | |
135 | ||
136 | //_____________________________________________________________________________ | |
137 | AliRsnValue& AliRsnValue::operator=(const AliRsnValue& copy) | |
138 | { | |
139 | // | |
32992791 | 140 | // Assignment operator. |
141 | // Works like copy constructor. | |
52944696 | 142 | // |
143 | ||
2a1c7696 | 144 | AliRsnTarget::operator=(copy); |
145 | ||
146 | fComputedValue = copy.fComputedValue; | |
147 | fBinArray = copy.fBinArray; | |
2a1c7696 | 148 | |
149 | return (*this); | |
52944696 | 150 | } |
151 | ||
152 | //_____________________________________________________________________________ | |
b2b08ca2 | 153 | void AliRsnValue::SetBins(Int_t nbins, Double_t min, Double_t max) |
b9bbd271 | 154 | { |
155 | // | |
b2b08ca2 | 156 | // Set binning for the axis in equally spaced bins |
157 | // where the number of bins, minimum and maximum are given. | |
158 | // | |
159 | ||
2a1c7696 | 160 | if (!nbins) { |
161 | fBinArray.Set(0); | |
162 | return; | |
163 | } | |
164 | ||
165 | fBinArray.Set(nbins + 1); | |
166 | ||
167 | Double_t mymax = TMath::Max(min, max); | |
168 | Double_t mymin = TMath::Min(min, max); | |
169 | ||
170 | Int_t k = 0; | |
171 | Double_t binSize = (mymax - mymin) / ((Double_t)nbins); | |
172 | ||
173 | fBinArray[0] = mymin; | |
174 | for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k - 1] + binSize; | |
2dab9030 | 175 | } |
176 | ||
177 | //_____________________________________________________________________________ | |
b2b08ca2 | 178 | void AliRsnValue::SetBins(Double_t min, Double_t max, Double_t step) |
2dab9030 | 179 | { |
180 | // | |
b2b08ca2 | 181 | // Set binning for the axis in equally spaced bins |
182 | // where the bin size, minimum and maximum are given. | |
2dab9030 | 183 | // |
184 | ||
2a1c7696 | 185 | Double_t dblNbins = TMath::Abs(max - min) / step; |
186 | Int_t intNbins = ((Int_t)dblNbins) + 1; | |
187 | ||
188 | SetBins(intNbins, min, max); | |
b9bbd271 | 189 | } |
190 | ||
191 | //_____________________________________________________________________________ | |
b2b08ca2 | 192 | void AliRsnValue::SetBins(Int_t nbins, Double_t *array) |
2dab9030 | 193 | { |
194 | // | |
b2b08ca2 | 195 | // Set binning for the axis in unequally spaced bins |
196 | // using the same way it is done in TAxis | |
2dab9030 | 197 | // |
198 | ||
2a1c7696 | 199 | if (!nbins) { |
200 | fBinArray.Set(0); | |
201 | return; | |
202 | } | |
203 | ||
d7712d44 | 204 | Int_t i; |
205 | fBinArray.Set(nbins); | |
206 | for (i = 0; i < nbins; i++) fBinArray[i] = array[i]; | |
32992791 | 207 | } |
208 | ||
209 | //_____________________________________________________________________________ | |
c865cb1d | 210 | Bool_t AliRsnValue::Eval(TObject *, Bool_t) |
b9bbd271 | 211 | { |
212 | // | |
213 | // Evaluation of the required value. | |
214 | // Checks that the passed object is of the right type | |
32992791 | 215 | // and if this check is successful, computes the required value. |
216 | // The output of the function tells if computing was successful, | |
b9bbd271 | 217 | // and the values must be taken with GetValue(). |
218 | // | |
219 | ||
c865cb1d | 220 | AliWarning("This method must be overridden by derived classes"); |
221 | return kTRUE; | |
b9bbd271 | 222 | } |
c18b1218 | 223 | |
69fbb331 | 224 | //_____________________________________________________________________________ |
c865cb1d | 225 | void AliRsnValue::Print(Option_t *option) const |
69fbb331 | 226 | { |
227 | // | |
32992791 | 228 | // Print informations about this object |
69fbb331 | 229 | // |
230 | ||
2a1c7696 | 231 | AliInfo("=== VALUE INFO ================================================="); |
232 | AliInfo(Form(" Name : %s", GetName())); | |
2a1c7696 | 233 | AliInfo(Form(" Current computed value: %f", fComputedValue)); |
c865cb1d | 234 | if (!strcmp(option, "BINS")) { |
235 | Int_t i; | |
236 | for (i = 0; i < fBinArray.GetSize(); i++) { | |
237 | AliInfo(Form(" Bin limit #%03d = %f", i, fBinArray[i])); | |
238 | } | |
2a1c7696 | 239 | } |
eaa44581 | 240 | } |