Coverity
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliNormalizationCounter.cxx
CommitLineData
c6f61da6 1/**************************************************************************\r
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id$ */\r
17\r
18//*************************************************************************\r
19// Class AliNormalizationCounter\r
20// Class to store the informations relevant for the normalization in the \r
21// barrel for each run\r
22// Authors: G. Ortona, ortona@to.infn.it\r
23// D. Caffarri, davide.caffarri@pd.to.infn.it\r
24// with many thanks to P. Pillot\r
25/////////////////////////////////////////////////////////////\r
26\r
27#include "AliLog.h"\r
28#include "AliNormalizationCounter.h"\r
29#include <AliESDEvent.h>\r
30#include <AliESDtrack.h>\r
31#include <AliAODEvent.h>\r
32#include <AliVParticle.h>\r
33#include <AliTriggerAnalysis.h>\r
34#include <TH1F.h>\r
35#include <TH2F.h>\r
36#include <TList.h>\r
37#include <TString.h>\r
38#include <TCanvas.h>\r
39#include <AliPhysicsSelection.h>\r
40#include <AliMultiplicity.h>\r
41\r
42ClassImp(AliNormalizationCounter)\r
43\r
44//____________________________________________\r
45AliNormalizationCounter::AliNormalizationCounter(): \r
46TNamed(),\r
47fCounters(),\r
48fESD(kFALSE),\r
49fMultiplicity(kFALSE),\r
50fHistTrackFilterEvMult(0),\r
51fHistTrackAnaEvMult(0),\r
52fHistTrackFilterSpdMult(0),\r
53fHistTrackAnaSpdMult(0)\r
54{\r
55 // empty constructor\r
56}\r
57\r
58//__________________________________________________ \r
59AliNormalizationCounter::AliNormalizationCounter(const char *name): \r
60TNamed(name,name),\r
61fCounters(name),\r
62fESD(kFALSE),\r
63fMultiplicity(kFALSE),\r
64fHistTrackFilterEvMult(0),\r
65fHistTrackAnaEvMult(0),\r
66fHistTrackFilterSpdMult(0),\r
67fHistTrackAnaSpdMult(0)\r
68{\r
69 ;\r
70}\r
71\r
72//______________________________________________\r
73AliNormalizationCounter::~AliNormalizationCounter()\r
74{\r
75 //destructor\r
76 if(fHistTrackFilterEvMult){\r
77 delete fHistTrackFilterEvMult;\r
78 fHistTrackFilterEvMult =0;\r
79 }\r
80 if(fHistTrackAnaEvMult){\r
81 delete fHistTrackAnaEvMult;\r
82 fHistTrackAnaEvMult=0;\r
83 }\r
84 if(fHistTrackFilterSpdMult){\r
85 delete fHistTrackFilterSpdMult;\r
86 fHistTrackFilterSpdMult=0;\r
87 }\r
88 if(fHistTrackAnaSpdMult){\r
89 delete fHistTrackAnaSpdMult;\r
90 fHistTrackAnaSpdMult=0;\r
91 }\r
92}\r
93\r
94//______________________________________________\r
95void AliNormalizationCounter::Init()\r
96{\r
97 //variables initialization\r
98 fCounters.AddRubric("Event","triggered/V0AND/PileUp/PbPbC0SMH-B-NOPF-ALLNOTRD/Candles0.3/PrimaryV/countForNorm/noPrimaryV/zvtxGT10/!V0A&Candle03/!V0A&PrimaryV/Candid(Filter)/Candid(Analysis)/NCandid(Filter)/NCandid(Analysis)");\r
99 if(fMultiplicity) fCounters.AddRubric("Multiplicity", 5000);\r
100 fCounters.AddRubric("Run", 1000000);\r
101 fCounters.Init();\r
102 fHistTrackFilterEvMult=new TH2F("FiltCandidvsTracksinEv","FiltCandidvsTracksinEv",10000,-0.5,9999.5,200,-0.5,199.5);\r
103 fHistTrackFilterEvMult->GetYaxis()->SetTitle("NCandidates");\r
104 fHistTrackFilterEvMult->GetXaxis()->SetTitle("NTracksinEvent");\r
105 fHistTrackAnaEvMult=new TH2F("AnaCandidvsTracksinEv","AnaCandidvsTracksinEv",10000,-0.5,9999.5,100,-0.5,99.5);\r
106 fHistTrackAnaEvMult->GetYaxis()->SetTitle("NCandidates");\r
107 fHistTrackAnaEvMult->GetXaxis()->SetTitle("NTracksinEvent");\r
108 fHistTrackFilterSpdMult=new TH2F("FilterCandidvsSpdMult","FilterCandidvsSpdMult",5000,-0.5,4999.5,200,-0.5,199.5);\r
109 fHistTrackFilterSpdMult->GetYaxis()->SetTitle("NCandidates");\r
110 fHistTrackFilterSpdMult->GetXaxis()->SetTitle("NSPDTracklets");\r
111 fHistTrackAnaSpdMult=new TH2F("AnaCandidvsSpdMult","AnaCandidvsSpdMult",5000,-0.5,4999.5,100,-0.5,99.5);\r
112 fHistTrackAnaSpdMult->GetYaxis()->SetTitle("NCandidates");\r
113 fHistTrackAnaSpdMult->GetXaxis()->SetTitle("NSPDTracklets");\r
114}\r
115\r
116//______________________________________________\r
117Long64_t AliNormalizationCounter::Merge(TCollection* list){\r
118 if (!list) return 0;\r
119 if (list->IsEmpty()) return 0;//(Long64_t)fCounters.Merge(list);\r
120\r
121 TIter next(list);\r
122 const TObject* obj = 0x0;\r
123 while ((obj = next())) {\r
124 \r
125 // check that "obj" is an object of the class AliNormalizationCounter\r
126 const AliNormalizationCounter* counter = dynamic_cast<const AliNormalizationCounter*>(obj);\r
127 if (!counter) {\r
128 AliError(Form("object named %s is not AliNormalizationCounter! Skipping it.", counter->GetName()));\r
129 continue;\r
130 }\r
131\r
132 Add(counter);\r
133\r
134 }\r
135 \r
136 return (Long64_t)1;//(Long64_t)fCounters->GetEntries();\r
137}\r
138//_______________________________________\r
139void AliNormalizationCounter::Add(const AliNormalizationCounter *norm){\r
140 fCounters.Add(&(norm->fCounters));\r
141 fHistTrackFilterEvMult->Add(norm->fHistTrackFilterEvMult);\r
142 fHistTrackAnaEvMult->Add(norm->fHistTrackAnaEvMult);\r
143 fHistTrackFilterSpdMult->Add(norm->fHistTrackFilterSpdMult);\r
144 fHistTrackAnaSpdMult->Add(norm->fHistTrackAnaSpdMult);\r
145}\r
146//_______________________________________\r
147/*\r
148Stores the variables used for normalization as function of run number\r
149returns kTRUE if the event is to be counted for normalization\r
150(pass event selection cuts OR has no primary vertex)\r
151 */\r
152void AliNormalizationCounter::StoreEvent(AliVEvent *event,AliRDHFCuts *rdCut,Bool_t mc){\r
153 //\r
154\r
1e6f5250 155 Bool_t isEventSelected = rdCut->IsEventSelected(event);\r
156\r
157 // events not passing physics selection. do nothing\r
158 if(rdCut->IsEventRejectedDuePhysicsSelection()) return;\r
159\r
c6f61da6 160 Bool_t v0A=kFALSE; \r
161 Bool_t v0B=kFALSE;\r
162 Bool_t flag03=kFALSE;\r
163 Bool_t flagPV=kFALSE;\r
164\r
165 //Run Number\r
166 Int_t runNumber = event->GetRunNumber();\r
167 \r
168 // Evaluate the multiplicity\r
169 Int_t multiplicity = Multiplicity(event);\r
170\r
171 //Find CINT1B\r
172 AliESDEvent *eventESD = (AliESDEvent*)event;\r
173 if(!eventESD){AliError("ESD event not available");return;}\r
174 if(mc&&event->GetEventType() != 0)return;\r
175 //event must be either physics or MC\r
176 if(!(event->GetEventType() == 7||event->GetEventType() == 0))return;\r
177 \r
178 if(fMultiplicity) \r
179 fCounters.Count(Form("Event:triggered/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
180 else \r
181 fCounters.Count(Form("Event:triggered/Run:%d",runNumber));\r
182\r
183 //Find V0AND\r
184 AliTriggerAnalysis trAn; /// Trigger Analysis\r
185 v0B = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0C);\r
186 v0A = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0A);\r
187 if(v0A&&v0B){\r
188 if(fMultiplicity) \r
189 fCounters.Count(Form("Event:V0AND/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
190 else\r
191 fCounters.Count(Form("Event:V0AND/Run:%d",runNumber));\r
192 }\r
193 \r
194 //FindPrimary vertex \r
195 // AliVVertex *vtrc = (AliVVertex*)event->GetPrimaryVertex();\r
196 // if(vtrc && vtrc->GetNContributors()>0){\r
197 // fCounters.Count(Form("Event:PrimaryV/Run:%d",runNumber));\r
198 // flagPV=kTRUE;\r
199 // }\r
200\r
201 //trigger\r
202 AliAODEvent *eventAOD = (AliAODEvent*)event;\r
203 TString trigclass=eventAOD->GetFiredTriggerClasses();\r
204 if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD")||trigclass.Contains("C0SMH-B-NOPF-ALL")){\r
205 if(fMultiplicity) \r
206 fCounters.Count(Form("Event:PbPbC0SMH-B-NOPF-ALLNOTRD/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
207 else \r
208 fCounters.Count(Form("Event:PbPbC0SMH-B-NOPF-ALLNOTRD/Run:%d",runNumber));\r
209 }\r
210\r
211 //FindPrimary vertex \r
1e6f5250 212 if(isEventSelected){\r
c6f61da6 213 if(fMultiplicity) \r
214 fCounters.Count(Form("Event:PrimaryV/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
215 else\r
216 fCounters.Count(Form("Event:PrimaryV/Run:%d",runNumber));\r
217 flagPV=kTRUE;\r
218 }else{\r
219 if(rdCut->GetWhyRejection()==0){\r
220 if(fMultiplicity) \r
221 fCounters.Count(Form("Event:noPrimaryV/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
222 else\r
223 fCounters.Count(Form("Event:noPrimaryV/Run:%d",runNumber));\r
224 }\r
225 //find good vtx outside range\r
226 if(rdCut->GetWhyRejection()==6){\r
227 if(fMultiplicity) {\r
228 fCounters.Count(Form("Event:zvtxGT10/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
229 fCounters.Count(Form("Event:PrimaryV/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
230 } else {\r
231 fCounters.Count(Form("Event:zvtxGT10/Run:%d",runNumber));\r
232 fCounters.Count(Form("Event:PrimaryV/Run:%d",runNumber));\r
233 }\r
234 flagPV=kTRUE;\r
235 }\r
236 if(rdCut->GetWhyRejection()==1){\r
237 if(fMultiplicity) \r
238 fCounters.Count(Form("Event:PileUp/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
239 else\r
240 fCounters.Count(Form("Event:PileUp/Run:%d",runNumber));\r
241 }\r
242 }\r
243 //to be counted for normalization\r
244 if(rdCut->CountEventForNormalization()){\r
245 if(fMultiplicity) \r
246 fCounters.Count(Form("Event:countForNorm/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
247 else \r
248 fCounters.Count(Form("Event:countForNorm/Run:%d",runNumber));\r
249 }\r
250\r
251\r
252 //Find Candle\r
253 Int_t trkEntries = (Int_t)event->GetNumberOfTracks();\r
254 for(Int_t i=0;i<trkEntries&&!flag03;i++){\r
255 AliAODTrack *track=(AliAODTrack*)event->GetTrack(i);\r
256 if((track->Pt()>0.3)&&(!flag03)){\r
257 if(fMultiplicity) \r
258 fCounters.Count(Form("Event:Candles0.3/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
259 else\r
260 fCounters.Count(Form("Event:Candles0.3/Run:%d",runNumber));\r
261 flag03=kTRUE;\r
262 break;\r
263 }\r
264 }\r
265 \r
266 if(!(v0A&&v0B)&&(flag03)){ \r
267 if(fMultiplicity) \r
268 fCounters.Count(Form("Event:!V0A&Candle03/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
269 else \r
270 fCounters.Count(Form("Event:!V0A&Candle03/Run:%d",runNumber));\r
271 }\r
272 if(!(v0A&&v0B)&&flagPV){\r
273 if(fMultiplicity) \r
274 fCounters.Count(Form("Event:!V0A&PrimaryV/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
275 else\r
276 fCounters.Count(Form("Event:!V0A&PrimaryV/Run:%d",runNumber));\r
277 }\r
278 \r
279 return;\r
280}\r
281//_____________________________________________________________________\r
282void AliNormalizationCounter::StoreCandidates(AliVEvent *event,Int_t nCand,Bool_t flagFilter){\r
283 \r
284 Int_t ntracks=event->GetNumberOfTracks();\r
285 if(flagFilter)fHistTrackFilterEvMult->Fill(ntracks,nCand);\r
286 else fHistTrackAnaEvMult->Fill(ntracks,nCand);\r
287 Int_t nSPD=0;\r
288 if(fESD){\r
289 AliESDEvent *ESDevent=(AliESDEvent*)event;\r
290 const AliMultiplicity *alimult = ESDevent->GetMultiplicity();\r
291 nSPD = alimult->GetNumberOfTracklets();\r
292\r
293 }else{\r
294 AliAODEvent *aodEvent =(AliAODEvent*)event;\r
295 AliAODTracklets *trklets=aodEvent->GetTracklets();\r
296 nSPD = trklets->GetNumberOfTracklets();\r
297 }\r
298 if(flagFilter)fHistTrackFilterSpdMult->Fill(nSPD,nCand);\r
299 else fHistTrackAnaSpdMult->Fill(nSPD,nCand);\r
300 \r
301 Int_t runNumber = event->GetRunNumber();\r
302 Int_t multiplicity = Multiplicity(event);\r
303 if(nCand==0)return;\r
304 if(flagFilter){\r
305 if(fMultiplicity) \r
306 fCounters.Count(Form("Event:Candid(Filter)/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
307 else \r
308 fCounters.Count(Form("Event:Candid(Filter)/Run:%d",runNumber));\r
309 for(Int_t i=0;i<nCand;i++){ \r
310 if(fMultiplicity) \r
311 fCounters.Count(Form("Event:NCandid(Filter)/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
312 else \r
313 fCounters.Count(Form("Event:NCandid(Filter)/Run:%d",runNumber));\r
314 }\r
315 }else{\r
316 if(fMultiplicity) \r
317 fCounters.Count(Form("Event:Candid(Analysis)/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
318 else\r
319 fCounters.Count(Form("Event:Candid(Analysis)/Run:%d",runNumber));\r
320 for(Int_t i=0;i<nCand;i++){ \r
321 if(fMultiplicity) \r
322 fCounters.Count(Form("Event:NCandid(Analysis)/Run:%d/Multiplicity:%d",runNumber,multiplicity));\r
323 else\r
324 fCounters.Count(Form("Event:NCandid(Analysis)/Run:%d",runNumber));\r
325 }\r
326 }\r
327 return;\r
328}\r
329//_______________________________________________________________________\r
330TH1D* AliNormalizationCounter::DrawAgainstRuns(TString candle,Bool_t drawHist){\r
331 //\r
332 fCounters.SortRubric("Run");\r
333 TString selection;\r
334 selection.Form("event:%s",candle.Data());\r
335 TH1D* histoneD = fCounters.Get("run",selection.Data());\r
336\r
337 histoneD->Sumw2();\r
338 if(drawHist)histoneD->DrawClone();\r
339 return histoneD;\r
340}\r
341//___________________________________________________________________________\r
342TH1D* AliNormalizationCounter::DrawRatio(TString candle1,TString candle2){\r
343 //\r
344 fCounters.SortRubric("Run");\r
345 TString name;\r
346\r
347 name.Form("%s/%s",candle1.Data(),candle2.Data());\r
348 TH1D* num=DrawAgainstRuns(candle1.Data(),kFALSE);\r
349 TH1D* den=DrawAgainstRuns(candle2.Data(),kFALSE);\r
350\r
351 den->SetTitle(candle2.Data());\r
352 den->SetName(candle2.Data());\r
353 num->Divide(num,den,1,1,"B");\r
354 num->SetTitle(name.Data());\r
355 num->SetName(name.Data());\r
356 num->DrawClone();\r
357 return num;\r
358}\r
359//___________________________________________________________________________\r
360void AliNormalizationCounter::PrintRubrics(){\r
361 fCounters.PrintKeyWords();\r
362}\r
363//___________________________________________________________________________\r
364Double_t AliNormalizationCounter::GetSum(TString candle){\r
365 TString selection="event:";\r
366 selection.Append(candle);\r
367 return fCounters.GetSum(selection.Data());\r
368}\r
369//___________________________________________________________________________\r
370TH2F* AliNormalizationCounter::GetHist(Bool_t filtercuts,Bool_t spdtracklets,Bool_t drawHist){\r
371 if(filtercuts){\r
372 if(spdtracklets){\r
373 if(drawHist)fHistTrackFilterSpdMult->DrawCopy("LEGO2Z 0");\r
374 return fHistTrackFilterSpdMult;\r
375 }else{\r
376 if(drawHist)fHistTrackFilterEvMult->DrawCopy("LEGO2Z 0");\r
377 return fHistTrackFilterEvMult;\r
378 }\r
379 }else{\r
380 if(spdtracklets){\r
381 if(drawHist)fHistTrackAnaSpdMult->DrawCopy("LEGO2Z 0");\r
382 return fHistTrackAnaSpdMult;\r
383 }else{\r
384 if(drawHist)fHistTrackAnaEvMult->DrawCopy("LEGO2Z 0");\r
385 return fHistTrackAnaEvMult;\r
386 }\r
387 }\r
388}\r
389//___________________________________________________________________________\r
390Double_t AliNormalizationCounter::GetNEventsForNorm(){\r
391 Double_t noVtxzGT10=GetSum("noPrimaryV")*GetSum("zvtxGT10")/GetSum("PrimaryV");\r
392 return GetSum("countForNorm")-noVtxzGT10;\r
393}\r
394//___________________________________________________________________________\r
395Double_t AliNormalizationCounter::GetNEventsForNorm(Int_t runnumber){\r
396 TString listofruns = fCounters.GetKeyWords("RUN");\r
397 if(!listofruns.Contains(Form("%d",runnumber))){\r
398 printf("WARNING: %d is not a valid run number\n",runnumber);\r
399 fCounters.Print("Run","",kTRUE);\r
400 return 0.;\r
401 }\r
402 TString suffix;suffix.Form("/RUN:%d",runnumber);\r
403 TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());\r
404 TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());\r
405 TString pV;pV.Form("PrimaryV%s",suffix.Data());\r
406 TString tbc;tbc.Form("countForNorm%s",suffix.Data());\r
407 Double_t noVtxzGT10=GetSum(noPV.Data())*GetSum(zvtx.Data())/GetSum(pV.Data());\r
408 return GetSum(tbc.Data())-noVtxzGT10;\r
409}\r
410\r
411//___________________________________________________________________________\r
412Double_t AliNormalizationCounter::GetNEventsForNorm(Int_t minmultiplicity, Int_t maxmultiplicity){\r
413\r
414 if(!fMultiplicity) {\r
415 AliInfo("Sorry, you didn't activate the multiplicity in the counter!");\r
416 return 0.;\r
417 }\r
418\r
419 TString listofruns = fCounters.GetKeyWords("Multiplicity");\r
420\r
421 Int_t nmultbins = maxmultiplicity - minmultiplicity;\r
422 Double_t sumnoPV=0., sumZvtx=0., sumPv=0., sumEvtNorm=0.;\r
423 for (Int_t ibin=0; ibin<=nmultbins; ibin++) {\r
424 // cout << " Looking at bin "<< ibin+minmultiplicity<<endl;\r
425 if(!listofruns.Contains(Form("%d",ibin+minmultiplicity))){\r
426 AliInfo(Form("WARNING: %d is not a valid multiplicity number. \n",ibin+minmultiplicity));\r
427 continue;\r
428 }\r
429 TString suffix;suffix.Form("/Multiplicity:%d",ibin+minmultiplicity);\r
430 TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());\r
431 TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());\r
432 TString pV;pV.Form("PrimaryV%s",suffix.Data());\r
433 TString tbc;tbc.Form("countForNorm%s",suffix.Data());\r
434 sumnoPV += GetSum(noPV.Data());\r
435 sumZvtx += GetSum(zvtx.Data());\r
436 sumPv += GetSum(pV.Data());\r
437 sumEvtNorm += GetSum(tbc.Data());\r
438 }\r
439 Double_t noVtxzGT10 = sumPv>0. ? sumnoPV * sumZvtx / sumPv : 0.;\r
440 return sumEvtNorm - noVtxzGT10;\r
441}\r
442\r
443//___________________________________________________________________________\r
444TH1D* AliNormalizationCounter::DrawNEventsForNorm(Bool_t drawRatio){\r
445 //usare algebra histos\r
446 fCounters.SortRubric("Run");\r
447 TString selection;\r
448\r
449 selection.Form("event:noPrimaryV");\r
450 TH1D* hnoPrimV = fCounters.Get("run",selection.Data());\r
451 hnoPrimV->Sumw2();\r
452\r
453 selection.Form("event:zvtxGT10");\r
454 TH1D* hzvtx= fCounters.Get("run",selection.Data());\r
455 hzvtx->Sumw2();\r
456\r
457 selection.Form("event:PrimaryV");\r
458 TH1D* hPrimV = fCounters.Get("run",selection.Data());\r
459 hPrimV->Sumw2();\r
460\r
461 hzvtx->Multiply(hnoPrimV);\r
462 hzvtx->Divide(hPrimV);\r
463\r
464 selection.Form("event:countForNorm");\r
465 TH1D* hCountForNorm = fCounters.Get("run",selection.Data());\r
466 hCountForNorm->Sumw2();\r
467\r
468 hCountForNorm->Add(hzvtx,-1.);\r
469\r
470 if(drawRatio){\r
471 selection.Form("event:triggered");\r
472 TH1D* htriggered = fCounters.Get("run",selection.Data());\r
473 htriggered->Sumw2();\r
474 hCountForNorm->Divide(htriggered);\r
475 }\r
476\r
477 hCountForNorm->DrawClone();\r
478 return hCountForNorm;\r
479}\r
480\r
481//___________________________________________________________________________\r
482Int_t AliNormalizationCounter::Multiplicity(AliVEvent* event){\r
483\r
484 Int_t multiplicity = 0;\r
485 AliAODEvent *eventAOD = (AliAODEvent*)event;\r
486 AliAODTracklets * aodTracklets = (AliAODTracklets*)eventAOD->GetTracklets();\r
487 Int_t ntracklets = (Int_t)aodTracklets->GetNumberOfTracklets();\r
488 for(Int_t i=0;i<ntracklets; i++){\r
489 Double_t theta = aodTracklets->GetTheta(i);\r
490 Double_t eta = -TMath::Log( TMath::Tan(theta/2.) ); // check the formula\r
491 if(TMath::Abs(eta)<1.6){ // set the proper cut on eta\r
492 multiplicity++;\r
493 }\r
494 }\r
495\r
496 return multiplicity;\r
497}\r