AliPhysics  32b88a8 (32b88a8)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAODMultEventClass.cxx
Go to the documentation of this file.
1 #include "AliAODMultEventClass.h"
2 #include <iostream>
3 #include <TString.h>
4 #include <TAxis.h>
5 
6 //____________________________________________________________________
7 const Int_t*
9 {
10  static const Int_t bins[] = { 1, 3, 6, 9,
11  14, 19, 24, 29,
12  39, 49, 59, 69,
13  79, 89, 99, -1 };
14  return bins;
15 }
16 //____________________________________________________________________
17 const TAxis*
19 {
20  static TAxis* ret = 0;
21  if (!ret) {
22  // Count the number of bins
23  const Int_t* arr = AliAODMultEventClass::GetBins();
24  const Int_t* tmp = arr;
25  Int_t n = 0;
26  while ((*tmp >= 0)) { n++; tmp++; }
27 
28  // Now create temporary array
29  TArrayD bins(n+2);
30  bins[0] = 0;
31  Int_t i = 1;
32  tmp = arr;
33  while ((*tmp >= 0)) {
34  bins[i] = *tmp+(i==1 ? 0 : 1e-6);
35  // Printf("bin[%2d]=%f", i, bins[i]);
36  tmp++;
37  i++;
38  }
39  bins[i] = bins[i-1]+10;
40  // Printf("bin[%2d]=%f", i, bins[i]);
41 
42  ret = new TAxis(n+1, bins.GetArray());
43  ret->SetTitle("Ref. Multiplicity (|#it{#eta}|<0.8)");
44  }
45  return ret;
46 }
47 //____________________________________________________________________
48 Int_t
50 {
51  const Int_t* ptr = GetBins();
52  Int_t bin = 0;
53  while (*ptr > 0) {
54  if (fMult < *ptr) return bin;
55  bin++;
56  ptr++;
57  }
58  return bin;
59 }
60 
61 //____________________________________________________________________
62 namespace {
63  Float_t multCent(Int_t m)
64  {
66  Double_t max = a->GetBinUpEdge(a->GetNbins());
67  Float_t r = TMath::Min(max-1, Double_t(m));
68  if (m >= max) Printf("mult=%4d -> %6.1f", m, r);
69  return r;
70  }
71 }
72 //____________________________________________________________________
73 Float_t
75 {
76  TString::ECaseCompare k = TString::kIgnoreCase;
77  if (which.EqualTo("MULT", k)) return multCent(fMult);
78  if (which.EqualTo("V0A", k)) return fUtilV0A;
79  if (which.EqualTo("V0M", k)) return fUtilV0M;
80  if (which.EqualTo("V0C", k)) return fUtilV0C;
81  if (which.EqualTo("V0AEQ", k)) return fUtilV0AEq;
82  if (which.EqualTo("V0MEQ", k)) return fUtilV0MEq;
83  if (which.EqualTo("V0CEQ", k)) return fUtilV0CEq;
84  if (which.EqualTo("MULTV0A", k)) return fUtilV0A;
85  if (which.EqualTo("MULTV0M", k)) return fUtilV0M;
86  if (which.EqualTo("MULTV0C", k)) return fUtilV0C;
87  if (which.EqualTo("MULTV0AEQ",k)) return fUtilV0AEq;
88  if (which.EqualTo("MULTV0MEQ",k)) return fUtilV0MEq;
89  if (which.EqualTo("MULTV0CEQ",k)) return fUtilV0CEq;
90  if (which.EqualTo("CND", k)) return fSelCND;
91  if (which.EqualTo("SELCND", k)) return fSelCND;
92  if (which.EqualTo("SEL", k)) return fSelCND;
93  if (which.EqualTo("SELV0A", k)) return fSelV0A;
94  if (which.EqualTo("SELV0M", k)) return fSelV0M;
95  if (which.EqualTo("SELV0C", k)) return fSelV0C;
96  if (which.EqualTo("SELV0AEQ", k)) return fSelV0AEq;
97  if (which.EqualTo("SELV0MEQ", k)) return fSelV0MEq;
98  if (which.EqualTo("SELV0CEQ", k)) return fSelV0CEq;
99  Warning("GetCentrality", "Unknown estimator: %s", which.Data());
100  return -1;
101 }
102 
103 //____________________________________________________________________
104 Float_t
106 {
107  const Float_t* x[][2][2]
108  = {{{ &fSelV0M,&fUtilV0M }, { &fSelV0MEq,&fUtilV0MEq }},
109  {{ &fSelV0A,&fUtilV0A }, { &fSelV0AEq,&fUtilV0AEq }},
110  {{ &fSelV0C,&fUtilV0C }, { &fSelV0CEq,&fUtilV0CEq }}};
111  Bool_t isEq = (which & kEq);
112  switch (which & 0xff) {
113  case kV0M: return *(x[0][isEq][util]); break;
114  case kV0A: return *(x[1][isEq][util]); break;
115  case kV0C: return *(x[2][isEq][util]); break;
116  case kCND: return fSelCND; break;
117  default:
118  Warning("GetCentrality", "Unknown estimator 0x%x for %s", which,
119  (util ? "util" : "sel"));
120  break;
121  }
122  return -1;
123 }
124 //____________________________________________________________________
125 void
127 {
128  Float_t* x[][2][2] = {{{ &fSelV0M,&fUtilV0M }, { &fSelV0MEq,&fUtilV0MEq }},
129  {{ &fSelV0A,&fUtilV0A }, { &fSelV0AEq,&fUtilV0AEq }},
130  {{ &fSelV0C,&fUtilV0C }, { &fSelV0CEq,&fUtilV0CEq }}};
131  Bool_t isEq = (which & kEq);
132  switch (which & 0xff) {
133  case kV0M: *(x[0][isEq][util]) = c; break;
134  case kV0A: *(x[1][isEq][util]) = c; break;
135  case kV0C: *(x[2][isEq][util]) = c; break;
136  case kCND: fSelCND = c; break;
137  default:
138  Warning("SetCentrality", "Unknown estimator 0x%x for %s", which,
139  (util ? "util" : "sel"));
140  break;
141  }
142 }
143 
144 //____________________________________________________________________
145 void
147 {
148  fMult = -1;
149  fUtilV0M = -1;
150  fUtilV0A = -1;
151  fUtilV0C = -1;
152  fUtilV0MEq = -1;
153  fUtilV0AEq = -1;
154  fUtilV0CEq = -1;
155  fSelCND = -1;
156  fSelV0M = -1;
157  fSelV0A = -1;
158  fSelV0C = -1;
159  fSelV0MEq = -1;
160  fSelV0AEq = -1;
161  fSelV0CEq = -1;
162 }
163 
164 #define P(T,U,S) \
165  Printf("%-12s: %6.2f%% (util) %6.2f%% (sel)",T,(U),(S))
166 //____________________________________________________________________
167 void
169 {
170  Printf("%-12s: %8d (bin %2d)", "Multiplicity", fMult, GetMultBin());
171  P("V0M", fUtilV0M, fSelV0M);
172  P("V0A", fUtilV0A, fSelV0A);
173  P("V0C", fUtilV0C, fSelV0C);
174  P("V0MEq", fUtilV0MEq, fSelV0MEq);
175  P("V0AEq", fUtilV0AEq, fSelV0AEq);
176  P("V0CEq", fUtilV0CEq, fSelV0CEq);
177  Printf("%-12s: %6.2f", "CND", fSelCND);
178 }
179 //
180 // EOF
181 //
Float_t GetCentrality(const TString &which) const
#define P(T, U, S)
double Double_t
Definition: External.C:58
virtual void Print(Option_t *option="") const
TCanvas * c
Definition: TestFitELoss.C:172
virtual void Clear(Option_t *option="")
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
void SetCentrality(UShort_t which, Bool_t util, Float_t c)
static const TAxis * GetAxis()
unsigned short UShort_t
Definition: External.C:28
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
static const Int_t * GetBins()