AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMultEventClassifier.cxx
Go to the documentation of this file.
1 #include <TH1.h>
2 #include <TList.h>
4 #include "AliAODMultEventClass.h"
5 #include "AliPPVsMultUtils.h"
6 #include <AliESDEvent.h>
7 #include <TArrayD.h>
8 #include <TH2.h>
9 #include <AliCentrality.h>
10 #include <AliESDtrackCuts.h>
11 #include "AliForwardUtil.h"
12 //____________________________________________________________________
13 const char*
15 {
16  Bool_t isEq = (which & AliAODMultEventClass::kEq);
17  if (which & AliAODMultEventClass::kV0M) return isEq ? "V0MEq" : "V0M";
18  else if (which & AliAODMultEventClass::kV0A) return isEq ? "V0AEq" : "V0A";
19  else if (which & AliAODMultEventClass::kV0C) return isEq ? "V0CEq" : "V0C";
20  else if (which & AliAODMultEventClass::kCND) return "CND";
21  return 0;
22 }
23 
24 //____________________________________________________________________
25 TH2*
27 {
28  Bool_t isEq = (which & AliAODMultEventClass::kEq);
29  if (which & AliAODMultEventClass::kV0M)
30  return isEq ? fCorrV0MEq : fCorrV0M;
31  else if (which & AliAODMultEventClass::kV0A)
32  return isEq ? fCorrV0AEq : fCorrV0A;
33  else if (which & AliAODMultEventClass::kV0C)
34  return isEq ? fCorrV0CEq : fCorrV0C;
35  return 0;
36 }
37 //____________________________________________________________________
38 TH2*
40 {
41  Bool_t isEq = (which & AliAODMultEventClass::kEq);
42  if (which & AliAODMultEventClass::kV0M)
43  return isEq ? fMultV0MEq : fMultV0M;
44  else if (which & AliAODMultEventClass::kV0A)
45  return isEq ? fMultV0AEq : fMultV0A;
46  else if (which & AliAODMultEventClass::kV0C)
47  return isEq ? fMultV0CEq : fMultV0C;
48  else if (which & AliAODMultEventClass::kCND)
49  return fMultCND;
50  return 0;
51 }
52 //____________________________________________________________________
53 void
56  Int_t mult,
57  UShort_t which)
58 {
59  Bool_t isCn = which == AliAODMultEventClass::kCND;
60  Bool_t isUt = fUseCentrality;
61  const char* meth = GetCentName(which);
62  Float_t util = (isCn ? -1:
63  isUt ? fUtil->GetMultiplicityPercentile(esd,meth):-1);
64  Float_t sel = -1;
65  AliCentrality* cObj = esd->GetCentrality();
66  if (cObj) sel = cObj->GetCentralityPercentile(meth);
67  TH2* corr = GetCorr(which);
68  TH2* vs = GetVs(which);
69 
70  if (isCn) util = sel;
71  if (corr) corr->Fill(util, sel);
72  if (vs) vs ->Fill(mult, util);
73 
74  if (!data) return;
75  data->SetCentrality(which, true, util);
76  data->SetCentrality(which, false, sel);
77 
78  // TString m(Form("MULT%s", meth));
79  // Printf("%s: %f (%f) (%f)", meth, data->GetCentrality(m), util, sel);
80 }
81 //____________________________________________________________________
82 TH2*
84 {
85  if ((which & AliAODMultEventClass::kCND)) return 0;
86 
87  const char* meth = GetCentName(which);
88  TH2* corr = new TH2D(Form("corr%s", meth),
89  Form("Correlation of %s estimators", meth),
90  101, -1.5, 100.5, 101, -1.5, 100.5);
91  corr->SetDirectory(0);
92  corr->SetXTitle("Centrality from AliPPVsMultUtils [%]");
93  corr->SetYTitle("Centrality from AliCentralitySelector [%]");
94 
95  Bool_t isEq = (which & AliAODMultEventClass::kEq);
96  if (which & AliAODMultEventClass::kV0M) {
97  if (isEq) fCorrV0MEq = corr; else fCorrV0M = corr;
98  }
99  else if (which & AliAODMultEventClass::kV0A) {
100  if (isEq) fCorrV0AEq = corr; else fCorrV0A = corr;
101  }
102  else if (which & AliAODMultEventClass::kV0C) {
103  if (isEq) fCorrV0CEq = corr; else fCorrV0C = corr;
104  }
105 
106  fList->Add(corr);
107  return corr;
108 }
109 
110 //____________________________________________________________________
111 TH2*
113 {
114  Bool_t isEq = (which & AliAODMultEventClass::kEq);
115  Bool_t isCn = which & AliAODMultEventClass::kCND;
116  if (isCn && isEq) return 0;
117 
118  const char* meth = GetCentName(which);
119  TH2* vs = 0;
120  vs = new TH2D(Form("vs%s", meth),
121  Form("Reference multiplicity vs %s estimator", meth),
122  bins.GetSize()-1,bins.GetArray(), 101, -1.5, 100.5);
123  vs->SetDirectory(0);
124  vs->SetXTitle("Reference multiplicity");
125  vs->SetYTitle("Centrality from AliPPVsMultUtils [%]");
126  if (isCn) vs->SetYTitle("Centrality from AliCentrality [%]");
127 
128  if (which & AliAODMultEventClass::kV0M)
129  if (isEq) fMultV0MEq = vs; else fMultV0M = vs;
130  else if (which & AliAODMultEventClass::kV0A)
131  if (isEq) fMultV0AEq = vs; else fMultV0A = vs;
132  else if (which & AliAODMultEventClass::kV0C)
133  if (isEq) fMultV0CEq = vs; else fMultV0C = vs;
134  else if (which & AliAODMultEventClass::kCND)
135  if (!isEq) fMultCND = vs;
136 
137  fList->Add(vs);
138  return vs;
139 }
140 
141 //____________________________________________________________________
142 void
144 {
145  fList = new TList;
146  fList->SetOwner(true);
147  fList->SetName(GetName());
148  if (l) l->Add(fList);
149 
150  const Int_t* arr = AliAODMultEventClass::GetBins();
151  Int_t* tmp = const_cast<Int_t*>(arr);
152  Int_t n = 0;
153  while ((*tmp >= 0)) { n++; tmp++; }
154 
155  TArrayD bins(n+2);
156  bins[0] = -1;
157  Int_t i = 1;
158  tmp = const_cast<Int_t*>(arr);
159  while ((*tmp >= 0)) {
160  bins[i] = *tmp;
161  tmp++;
162  i++;
163  }
164  fMax = bins[i-1];
165  bins[i] = fMax + 10;
166 
180 
181  fUtil = new AliPPVsMultUtils;
182 }
183 //____________________________________________________________________
184 void
186  AliAODMultEventClass* data)
187 {
188  if (data) data->Clear();
189  Int_t mult =
190  AliESDtrackCuts
191  ::GetReferenceMultiplicity(esd,
192  AliESDtrackCuts::kTrackletsITSTPC, 0.8 ) ;
193  if (data) data->SetMult(mult);
194  Int_t fill = (mult >= Int_t(fMax) ? fMax+1 : mult);
195 
196  if (!fUseCentrality) return;
197 
198  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0M);
199  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0A);
200  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0C);
201  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0M|
203  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0A|
205  GetCentrality(esd, data, fill, AliAODMultEventClass::kV0C|
207  GetCentrality(esd, data, fill, AliAODMultEventClass::kCND);
208 
209  // if (data) data->Print();
210 }
211 
212 //____________________________________________________________________
213 void
215 {
217 }
218 
219 //____________________________________________________________________
220 //
221 // EOF
222 //
223 
224 
225 
void Print(Option_t *option="") const
TH2 * MakeVs(UShort_t which, const TArrayD &bins)
void Process(AliESDEvent *esd, AliAODMultEventClass *data)
TH2 * MakeCorr(UShort_t which)
TH2 * GetVs(UShort_t which) const
virtual void Clear(Option_t *option="")
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Various utilities used in PWGLF/FORWARD.
const char * GetCentName(UShort_t which) const
Definition: External.C:228
void SetCentrality(UShort_t which, Bool_t util, Float_t c)
void GetCentrality(AliESDEvent *esd, AliAODMultEventClass *data, Int_t mult, UShort_t which)
static void PrintTask(const TObject &o)
Definition: External.C:220
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()
TH2 * GetCorr(UShort_t which) const