fixed warning, reduced printout
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalysisTaskFragmentationFunction.cxx
1 \r
2 /*************************************************************************\r
3  *                                                                       *\r
4  * Task for Fragmentation Function Analysis in PWG4 Jet Task Force Train *\r
5  *                                                                       *\r
6  *************************************************************************/\r
7 \r
8 \r
9 /**************************************************************************\r
10  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
11  *                                                                        *\r
12  * Author: The ALICE Off-line Project.                                    *\r
13  * Contributors are mentioned in the code where appropriate.              *\r
14  *                                                                        *\r
15  * Permission to use, copy, modify and distribute this software and its   *\r
16  * documentation strictly for non-commercial purposes is hereby granted   *\r
17  * without fee, provided that the above copyright notice appears in all   *\r
18  * copies and that both the copyright notice and this permission notice   *\r
19  * appear in the supporting documentation. The authors make no claims     *\r
20  * about the suitability of this software for any purpose. It is          *\r
21  * provided "as is" without express or implied warranty.                  *\r
22  **************************************************************************/\r
23 \r
24 /* $Id: */\r
25 \r
26 \r
27 #include "TList.h"\r
28 #include "TH1F.h"\r
29 #include "TH2F.h"\r
30 #include "TString.h"\r
31 \r
32 #include "AliAODInputHandler.h" \r
33 #include "AliAODHandler.h" \r
34 #include "AliESDEvent.h"\r
35 #include "AliAODMCParticle.h"\r
36 #include "AliAODJet.h"\r
37 #include "AliGenPythiaEventHeader.h"\r
38 #include "AliInputEventHandler.h"\r
39 \r
40 #include "AliAnalysisHelperJetTasks.h"\r
41 #include "AliAnalysisManager.h"\r
42 #include "AliAnalysisTaskSE.h"\r
43 \r
44 #include "AliAnalysisTaskFragmentationFunction.h"\r
45 \r
46 \r
47 ClassImp(AliAnalysisTaskFragmentationFunction)\r
48 \r
49 //____________________________________________________________________________\r
50 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()\r
51    : AliAnalysisTaskSE()\r
52    ,fESD(0)\r
53    ,fAOD(0)\r
54    ,fMCEvent(0)\r
55    ,fBranchRecJets("jets")\r
56    ,fBranchGenJets("")\r
57    ,fTrackTypeGen(0)\r
58    ,fJetTypeGen(0)\r
59    ,fFilterMask(0)\r
60    ,fTrackPtCut(0)\r
61    ,fTrackEtaMin(0)\r
62    ,fTrackEtaMax(0)\r
63    ,fTrackPhiMin(0)\r
64    ,fTrackPhiMax(0)\r
65    ,fJetPtCut(0)\r
66    ,fJetEtaMin(0)\r
67    ,fJetEtaMax(0)\r
68    ,fJetPhiMin(0)\r
69    ,fJetPhiMax(0)\r
70    ,fFFRadius(0)\r
71    ,fDijetDeltaPhiCut(0)\r
72    ,fDijetInvMassMin(0)\r
73    ,fDijetInvMassMax(0)\r
74    ,fDijetCDFcut(0)\r
75    ,fDijetEMeanMin(0)\r
76    ,fDijetEMeanMax(0)\r
77    ,fDijetEFractionCut(0)\r
78    ,fDijetEFraction(0)\r
79    ,fTracksRec(0)\r
80    ,fTracksRecCuts(0)\r
81    ,fTracksGen(0)\r
82    ,fJetsRec(0)\r
83    ,fJetsRecCuts(0)\r
84    ,fJetsGen(0)\r
85    ,fQATrackHistosRec(0)\r
86    ,fQATrackHistosRecCuts(0)\r
87    ,fQATrackHistosGen(0)\r
88    ,fQAJetHistosRec(0)\r
89    ,fQAJetHistosRecCuts(0)\r
90    ,fQAJetHistosRecCutsLeading(0)\r
91    ,fQAJetHistosGen(0)\r
92    ,fQAJetHistosGenLeading(0)\r
93    ,fFFHistosRecCuts(0)\r
94    ,fFFHistosRecLeading(0)\r
95    ,fFFHistosRecLeadingTrack(0)\r
96    ,fFFHistosGen(0)\r
97    ,fFFHistosGenLeading(0)\r
98    ,fFFHistosGenLeadingTrack(0)\r
99    ,fQATrackHighPtThreshold(0)\r
100    ,fFFNBinsJetPt(0)    \r
101    ,fFFJetPtMin(0) \r
102    ,fFFJetPtMax(0)\r
103    ,fFFNBinsPt(0)      \r
104    ,fFFPtMin(0)        \r
105    ,fFFPtMax(0)        \r
106    ,fFFNBinsXi(0)      \r
107    ,fFFXiMin(0)        \r
108    ,fFFXiMax(0)        \r
109    ,fFFNBinsZ(0)       \r
110    ,fFFZMin(0)         \r
111    ,fFFZMax(0)         \r
112    ,fQAJetNBinsPt(0)   \r
113    ,fQAJetPtMin(0)     \r
114    ,fQAJetPtMax(0)     \r
115    ,fQAJetNBinsEta(0)  \r
116    ,fQAJetEtaMin(0)    \r
117    ,fQAJetEtaMax(0)    \r
118    ,fQAJetNBinsPhi(0)  \r
119    ,fQAJetPhiMin(0)    \r
120    ,fQAJetPhiMax(0)    \r
121    ,fQATrackNBinsPt(0) \r
122    ,fQATrackPtMin(0)   \r
123    ,fQATrackPtMax(0)   \r
124    ,fQATrackNBinsEta(0)\r
125    ,fQATrackEtaMin(0)  \r
126    ,fQATrackEtaMax(0)  \r
127    ,fQATrackNBinsPhi(0)\r
128    ,fQATrackPhiMin(0)  \r
129    ,fQATrackPhiMax(0)  \r
130    ,fCommonHistList(0)\r
131    ,fh1EvtSelection(0)\r
132    ,fh1VertexNContributors(0)\r
133    ,fh1VertexZ(0)\r
134    ,fh1EvtMult(0)\r
135    ,fh1nRecJetsCuts(0)\r
136    ,fh1nGenJets(0)\r
137 {\r
138    // default constructor\r
139 }\r
140 \r
141 //__________________________________________________________________________________________\r
142 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char *name) \r
143   : AliAnalysisTaskSE(name)\r
144   ,fESD(0)\r
145   ,fAOD(0)\r
146   ,fMCEvent(0)\r
147   ,fBranchRecJets("jets")\r
148   ,fBranchGenJets("")\r
149   ,fTrackTypeGen(0)\r
150   ,fJetTypeGen(0)\r
151   ,fFilterMask(0)\r
152   ,fTrackPtCut(0)\r
153   ,fTrackEtaMin(0)\r
154   ,fTrackEtaMax(0)\r
155   ,fTrackPhiMin(0)\r
156   ,fTrackPhiMax(0)\r
157   ,fJetPtCut(0)\r
158   ,fJetEtaMin(0)\r
159   ,fJetEtaMax(0)\r
160   ,fJetPhiMin(0)\r
161   ,fJetPhiMax(0)\r
162   ,fFFRadius(0)\r
163   ,fDijetDeltaPhiCut(0)\r
164   ,fDijetInvMassMin(0)\r
165   ,fDijetInvMassMax(0)\r
166   ,fDijetCDFcut(0)\r
167   ,fDijetEMeanMin(0)\r
168   ,fDijetEMeanMax(0)\r
169   ,fDijetEFractionCut(0)\r
170   ,fDijetEFraction(0)\r
171   ,fTracksRec(0)\r
172   ,fTracksRecCuts(0)\r
173   ,fTracksGen(0)\r
174   ,fJetsRec(0)\r
175   ,fJetsRecCuts(0)\r
176   ,fJetsGen(0)\r
177   ,fQATrackHistosRec(0)\r
178   ,fQATrackHistosRecCuts(0)\r
179   ,fQATrackHistosGen(0)\r
180   ,fQAJetHistosRec(0)\r
181   ,fQAJetHistosRecCuts(0)\r
182   ,fQAJetHistosRecCutsLeading(0)\r
183   ,fQAJetHistosGen(0)\r
184   ,fQAJetHistosGenLeading(0)\r
185   ,fFFHistosRecCuts(0)\r
186   ,fFFHistosRecLeading(0)\r
187   ,fFFHistosRecLeadingTrack(0)\r
188   ,fFFHistosGen(0)\r
189   ,fFFHistosGenLeading(0)\r
190   ,fFFHistosGenLeadingTrack(0)\r
191   ,fQATrackHighPtThreshold(0) \r
192   ,fFFNBinsJetPt(0)    \r
193   ,fFFJetPtMin(0) \r
194   ,fFFJetPtMax(0)\r
195   ,fFFNBinsPt(0)      \r
196   ,fFFPtMin(0)        \r
197   ,fFFPtMax(0)        \r
198   ,fFFNBinsXi(0)      \r
199   ,fFFXiMin(0)        \r
200   ,fFFXiMax(0)        \r
201   ,fFFNBinsZ(0)       \r
202   ,fFFZMin(0)         \r
203   ,fFFZMax(0)         \r
204   ,fQAJetNBinsPt(0)   \r
205   ,fQAJetPtMin(0)     \r
206   ,fQAJetPtMax(0)     \r
207   ,fQAJetNBinsEta(0)  \r
208   ,fQAJetEtaMin(0)    \r
209   ,fQAJetEtaMax(0)    \r
210   ,fQAJetNBinsPhi(0)  \r
211   ,fQAJetPhiMin(0)    \r
212   ,fQAJetPhiMax(0)    \r
213   ,fQATrackNBinsPt(0) \r
214   ,fQATrackPtMin(0)   \r
215   ,fQATrackPtMax(0)   \r
216   ,fQATrackNBinsEta(0)\r
217   ,fQATrackEtaMin(0)  \r
218   ,fQATrackEtaMax(0)  \r
219   ,fQATrackNBinsPhi(0)\r
220   ,fQATrackPhiMin(0)  \r
221   ,fQATrackPhiMax(0)  \r
222   ,fCommonHistList(0)\r
223   ,fh1EvtSelection(0)\r
224   ,fh1VertexNContributors(0)\r
225   ,fh1VertexZ(0)\r
226   ,fh1EvtMult(0)\r
227   ,fh1nRecJetsCuts(0)\r
228   ,fh1nGenJets(0)\r
229 {\r
230   // constructor\r
231   \r
232   DefineOutput(1,TList::Class());\r
233   \r
234 \r
235 }\r
236 \r
237 //__________________________________________________________________________________________________________________________\r
238 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const  AliAnalysisTaskFragmentationFunction &copy)\r
239   : AliAnalysisTaskSE()\r
240   ,fESD(copy.fESD)\r
241   ,fAOD(copy.fAOD)\r
242   ,fMCEvent(copy.fMCEvent)\r
243   ,fBranchRecJets(copy.fBranchRecJets)\r
244   ,fBranchGenJets(copy.fBranchGenJets)\r
245   ,fTrackTypeGen(copy.fTrackTypeGen)\r
246   ,fJetTypeGen(copy.fJetTypeGen)\r
247   ,fFilterMask(copy.fFilterMask)\r
248   ,fTrackPtCut(copy.fTrackPtCut)\r
249   ,fTrackEtaMin(copy.fTrackEtaMin)\r
250   ,fTrackEtaMax(copy.fTrackEtaMax)\r
251   ,fTrackPhiMin(copy.fTrackPhiMin)\r
252   ,fTrackPhiMax(copy.fTrackPhiMax)\r
253   ,fJetPtCut(copy.fJetPtCut)\r
254   ,fJetEtaMin(copy.fJetEtaMin)\r
255   ,fJetEtaMax(copy.fJetEtaMax)\r
256   ,fJetPhiMin(copy.fJetPhiMin)\r
257   ,fJetPhiMax(copy.fJetPhiMax)\r
258   ,fFFRadius(copy.fFFRadius)\r
259   ,fDijetDeltaPhiCut(copy.fDijetDeltaPhiCut)\r
260   ,fDijetInvMassMin(copy.fDijetInvMassMin)\r
261   ,fDijetInvMassMax(copy.fDijetInvMassMax)\r
262   ,fDijetCDFcut(copy.fDijetCDFcut)\r
263   ,fDijetEMeanMin(copy.fDijetEMeanMin)\r
264   ,fDijetEMeanMax(copy.fDijetEMeanMax)\r
265   ,fDijetEFractionCut(copy.fDijetEFractionCut)\r
266   ,fDijetEFraction(copy.fDijetEFraction)\r
267   ,fTracksRec(copy.fTracksRec)\r
268   ,fTracksRecCuts(copy.fTracksRecCuts)\r
269   ,fTracksGen(copy.fTracksGen)\r
270   ,fJetsRec(copy.fJetsRec)\r
271   ,fJetsRecCuts(copy.fJetsRecCuts)\r
272   ,fJetsGen(copy.fJetsGen)\r
273   ,fQATrackHistosRec(copy.fQATrackHistosRec)\r
274   ,fQATrackHistosRecCuts(copy.fQATrackHistosRecCuts)\r
275   ,fQATrackHistosGen(copy.fQATrackHistosGen)\r
276   ,fQAJetHistosRec(copy.fQAJetHistosRec)\r
277   ,fQAJetHistosRecCuts(copy.fQAJetHistosRecCuts)\r
278   ,fQAJetHistosRecCutsLeading(copy.fQAJetHistosRecCutsLeading)\r
279   ,fQAJetHistosGen(copy.fQAJetHistosGen)\r
280   ,fQAJetHistosGenLeading(copy.fQAJetHistosGenLeading)\r
281   ,fFFHistosRecCuts(copy.fFFHistosRecCuts)\r
282   ,fFFHistosRecLeading(copy.fFFHistosRecLeading)\r
283   ,fFFHistosRecLeadingTrack(copy.fFFHistosRecLeadingTrack)\r
284   ,fFFHistosGen(copy.fFFHistosGen)\r
285   ,fFFHistosGenLeading(copy.fFFHistosGenLeading)\r
286   ,fFFHistosGenLeadingTrack(copy.fFFHistosGenLeadingTrack)\r
287   ,fQATrackHighPtThreshold(copy.fQATrackHighPtThreshold) \r
288   ,fFFNBinsJetPt(copy.fFFNBinsJetPt)    \r
289   ,fFFJetPtMin(copy.fFFJetPtMin) \r
290   ,fFFJetPtMax(copy.fFFJetPtMax)\r
291   ,fFFNBinsPt(copy.fFFNBinsPt)      \r
292   ,fFFPtMin(copy.fFFPtMin)        \r
293   ,fFFPtMax(copy.fFFPtMax)        \r
294   ,fFFNBinsXi(copy.fFFNBinsXi)      \r
295   ,fFFXiMin(copy.fFFXiMin)        \r
296   ,fFFXiMax(copy.fFFXiMax)        \r
297   ,fFFNBinsZ(copy.fFFNBinsZ)       \r
298   ,fFFZMin(copy.fFFZMin)         \r
299   ,fFFZMax(copy.fFFZMax)         \r
300   ,fQAJetNBinsPt(copy.fQAJetNBinsPt)   \r
301   ,fQAJetPtMin(copy.fQAJetPtMin)     \r
302   ,fQAJetPtMax(copy.fQAJetPtMax)     \r
303   ,fQAJetNBinsEta(copy.fQAJetNBinsEta)  \r
304   ,fQAJetEtaMin(copy.fQAJetEtaMin)    \r
305   ,fQAJetEtaMax(copy.fQAJetEtaMax)    \r
306   ,fQAJetNBinsPhi(copy.fQAJetNBinsPhi)  \r
307   ,fQAJetPhiMin(copy.fQAJetPhiMin)    \r
308   ,fQAJetPhiMax(copy.fQAJetPhiMax)    \r
309   ,fQATrackNBinsPt(copy.fQATrackNBinsPt) \r
310   ,fQATrackPtMin(copy.fQATrackPtMin)   \r
311   ,fQATrackPtMax(copy.fQATrackPtMax)   \r
312   ,fQATrackNBinsEta(copy.fQATrackNBinsEta)\r
313   ,fQATrackEtaMin(copy.fQATrackEtaMin)  \r
314   ,fQATrackEtaMax(copy.fQATrackEtaMax)  \r
315   ,fQATrackNBinsPhi(copy.fQATrackNBinsPhi)\r
316   ,fQATrackPhiMin(copy.fQATrackPhiMin)  \r
317   ,fQATrackPhiMax(copy.fQATrackPhiMax)  \r
318   ,fCommonHistList(copy.fCommonHistList)\r
319   ,fh1EvtSelection(copy.fh1EvtSelection)\r
320   ,fh1VertexNContributors(copy.fh1VertexNContributors)\r
321   ,fh1VertexZ(copy.fh1VertexZ)\r
322   ,fh1EvtMult(copy.fh1EvtMult)\r
323   ,fh1nRecJetsCuts(copy.fh1nRecJetsCuts)\r
324   ,fh1nGenJets(copy.fh1nGenJets)\r
325 {\r
326   // copy constructor\r
327 \r
328 }\r
329 \r
330 // _________________________________________________________________________________________________________________________________\r
331 AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::operator=(const AliAnalysisTaskFragmentationFunction& o)\r
332 {\r
333   // assignment\r
334   \r
335   if(this!=&o){\r
336 \r
337     AliAnalysisTaskSE::operator=(o);\r
338     fESD                       = o.fESD;\r
339     fAOD                       = o.fAOD;\r
340     fMCEvent                   = o.fMCEvent;\r
341     fBranchRecJets             = o.fBranchRecJets;\r
342     fBranchGenJets             = o.fBranchGenJets;\r
343     fTrackTypeGen              = o.fTrackTypeGen;\r
344     fJetTypeGen                = o.fJetTypeGen;\r
345     fFilterMask                = o.fFilterMask;\r
346     fTrackPtCut                = o.fTrackPtCut;\r
347     fTrackEtaMin               = o.fTrackEtaMin;\r
348     fTrackEtaMax               = o.fTrackEtaMax;\r
349     fTrackPhiMin               = o.fTrackPhiMin;\r
350     fTrackPhiMax               = o.fTrackPhiMax;\r
351     fJetPtCut                  = o.fJetPtCut;\r
352     fJetEtaMin                 = o.fJetEtaMin;\r
353     fJetEtaMax                 = o.fJetEtaMax;\r
354     fJetPhiMin                 = o.fJetPhiMin;\r
355     fJetPhiMax                 = o.fJetPhiMax;\r
356     fFFRadius                  = o.fFFRadius;\r
357     fDijetDeltaPhiCut          = o.fDijetDeltaPhiCut;\r
358     fDijetInvMassMin           = o.fDijetInvMassMin;\r
359     fDijetInvMassMax           = o.fDijetInvMassMax;\r
360     fDijetCDFcut               = o.fDijetCDFcut;\r
361     fDijetEMeanMin             = o.fDijetEMeanMin;\r
362     fDijetEMeanMax             = o.fDijetEMeanMax;\r
363     fDijetEFractionCut         = o.fDijetEFractionCut;\r
364     fDijetEFraction            = o.fDijetEFraction;\r
365     fTracksRec                 = o.fTracksRec;\r
366     fTracksRecCuts             = o.fTracksRecCuts;\r
367     fTracksGen                 = o.fTracksGen;\r
368     fJetsRec                   = o.fJetsRec;\r
369     fJetsRecCuts               = o.fJetsRecCuts;\r
370     fJetsGen                   = o.fJetsGen;\r
371     fQATrackHistosRec          = o.fQATrackHistosRec;\r
372     fQATrackHistosRecCuts      = o.fQATrackHistosRecCuts;\r
373     fQATrackHistosGen          = o.fQATrackHistosGen;\r
374     fQAJetHistosRec            = o.fQAJetHistosRec;\r
375     fQAJetHistosRecCuts        = o.fQAJetHistosRecCuts;\r
376     fQAJetHistosRecCutsLeading = o.fQAJetHistosRecCutsLeading;\r
377     fQAJetHistosGen            = o.fQAJetHistosGen;\r
378     fQAJetHistosGenLeading     = o.fQAJetHistosGenLeading;\r
379     fFFHistosRecCuts           = o.fFFHistosRecCuts;\r
380     fFFHistosRecLeading        = o.fFFHistosRecLeading;\r
381     fFFHistosRecLeadingTrack   = o.fFFHistosRecLeadingTrack;\r
382     fFFHistosGen               = o.fFFHistosGen;\r
383     fFFHistosGenLeading        = o.fFFHistosGenLeading;\r
384     fFFHistosGenLeadingTrack   = o.fFFHistosGenLeadingTrack;\r
385     fQATrackHighPtThreshold    = o.fQATrackHighPtThreshold; \r
386     fFFNBinsJetPt              = o.fFFNBinsJetPt;    \r
387     fFFJetPtMin                = o.fFFJetPtMin; \r
388     fFFJetPtMax                = o.fFFJetPtMax;\r
389     fFFNBinsPt                 = o.fFFNBinsPt;      \r
390     fFFPtMin                   = o.fFFPtMin;        \r
391     fFFPtMax                   = o.fFFPtMax;        \r
392     fFFNBinsXi                 = o.fFFNBinsXi;      \r
393     fFFXiMin                   = o.fFFXiMin;        \r
394     fFFXiMax                   = o.fFFXiMax;        \r
395     fFFNBinsZ                  = o.fFFNBinsZ;       \r
396     fFFZMin                    = o.fFFZMin;         \r
397     fFFZMax                    = o.fFFZMax;         \r
398     fQAJetNBinsPt              = o.fQAJetNBinsPt;   \r
399     fQAJetPtMin                = o.fQAJetPtMin;     \r
400     fQAJetPtMax                = o.fQAJetPtMax;     \r
401     fQAJetNBinsEta             = o.fQAJetNBinsEta;  \r
402     fQAJetEtaMin               = o.fQAJetEtaMin;    \r
403     fQAJetEtaMax               = o.fQAJetEtaMax;    \r
404     fQAJetNBinsPhi             = o.fQAJetNBinsPhi;  \r
405     fQAJetPhiMin               = o.fQAJetPhiMin;    \r
406     fQAJetPhiMax               = o.fQAJetPhiMax;    \r
407     fQATrackNBinsPt            = o.fQATrackNBinsPt; \r
408     fQATrackPtMin              = o.fQATrackPtMin;   \r
409     fQATrackPtMax              = o.fQATrackPtMax;   \r
410     fQATrackNBinsEta           = o.fQATrackNBinsEta;\r
411     fQATrackEtaMin             = o.fQATrackEtaMin;  \r
412     fQATrackEtaMax             = o.fQATrackEtaMax;  \r
413     fQATrackNBinsPhi           = o.fQATrackNBinsPhi;\r
414     fQATrackPhiMin             = o.fQATrackPhiMin;  \r
415     fQATrackPhiMax             = o.fQATrackPhiMax;  \r
416     fCommonHistList            = o.fCommonHistList;\r
417     fh1EvtSelection            = o.fh1EvtSelection;\r
418     fh1VertexNContributors     = o.fh1VertexNContributors;\r
419     fh1VertexZ                 = o.fh1VertexZ;\r
420     fh1EvtMult                 = o.fh1EvtMult;\r
421     fh1nRecJetsCuts            = o.fh1nRecJetsCuts;\r
422     fh1nGenJets                = o.fh1nGenJets; \r
423   }\r
424     \r
425   return *this;\r
426 }\r
427 \r
428 //___________________________________________________________________________\r
429 AliAnalysisTaskFragmentationFunction::~AliAnalysisTaskFragmentationFunction()\r
430 {\r
431   // destructor\r
432   \r
433 }\r
434 \r
435 \r
436 \r
437 //______________________________________________________________________________________________________\r
438 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const char* name, \r
439                                                          Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  \r
440                                                          Int_t nPt, Float_t ptMin, Float_t ptMax,\r
441                                                          Int_t nXi, Float_t xiMin, Float_t xiMax,\r
442                                                          Int_t nZ , Float_t zMin , Float_t zMax )\r
443   : TObject()\r
444   ,fNBinsJetPt(nJetPt)\r
445   ,fJetPtMin(jetPtMin)\r
446   ,fJetPtMax(jetPtMax)\r
447   ,fNBinsPt(nPt) \r
448   ,fPtMin(ptMin)   \r
449   ,fPtMax(ptMax)   \r
450   ,fNBinsXi(nXi) \r
451   ,fXiMin(xiMin)   \r
452   ,fXiMax(xiMax)   \r
453   ,fNBinsZ(nZ)  \r
454   ,fZMin(zMin)    \r
455   ,fZMax(zMax)    \r
456   ,fh2TrackPt(0)\r
457   ,fh2Xi(0)\r
458   ,fh2Z(0)\r
459   ,fh1JetPt(0)\r
460   ,fName(name)\r
461 {\r
462   // default constructor\r
463 \r
464 }\r
465 \r
466 //___________________________________________________________________________\r
467 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const AliFragFuncHistos& copy)\r
468   : TObject()\r
469   ,fNBinsJetPt(copy.fNBinsJetPt)\r
470   ,fJetPtMin(copy.fJetPtMin)\r
471   ,fJetPtMax(copy.fJetPtMax)\r
472   ,fNBinsPt(copy.fNBinsPt) \r
473   ,fPtMin(copy.fPtMin)   \r
474   ,fPtMax(copy.fPtMax)   \r
475   ,fNBinsXi(copy.fNBinsXi) \r
476   ,fXiMin(copy.fXiMin)   \r
477   ,fXiMax(copy.fXiMax)   \r
478   ,fNBinsZ(copy.fNBinsZ)  \r
479   ,fZMin(copy.fZMin)    \r
480   ,fZMax(copy.fZMax)    \r
481   ,fh2TrackPt(copy.fh2TrackPt)\r
482   ,fh2Xi(copy.fh2Xi)\r
483   ,fh2Z(copy.fh2Z)\r
484   ,fh1JetPt(copy.fh1JetPt)\r
485   ,fName(copy.fName)\r
486 {\r
487   // copy constructor\r
488 }\r
489 \r
490 //_______________________________________________________________________________________________________________________________________________________________\r
491 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& o)\r
492 {\r
493   // assignment\r
494   \r
495   if(this!=&o){\r
496     TObject::operator=(o);\r
497     fNBinsJetPt = o.fNBinsJetPt;\r
498     fJetPtMin   = o.fJetPtMin;\r
499     fJetPtMax   = o.fJetPtMax;\r
500     fNBinsPt    = o.fNBinsPt; \r
501     fPtMin      = o.fPtMin;   \r
502     fPtMax      = o.fPtMax;   \r
503     fNBinsXi    = o.fNBinsXi; \r
504     fXiMin      = o.fXiMin;   \r
505     fXiMax      = o.fXiMax;   \r
506     fNBinsZ     = o.fNBinsZ;  \r
507     fZMin       = o.fZMin;    \r
508     fZMax       = o.fZMax;    \r
509     fh2TrackPt  = o.fh2TrackPt;\r
510     fh2Xi       = o.fh2Xi;\r
511     fh2Z        = o.fh2Z;\r
512     fh1JetPt    = o.fh1JetPt;\r
513     fName       = o.fName;\r
514   }\r
515     \r
516   return *this;\r
517 }\r
518 \r
519 //_________________________________________________________\r
520 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::~AliFragFuncHistos()\r
521 {\r
522   // destructor \r
523 \r
524   if(fh1JetPt)   delete fh1JetPt;\r
525   if(fh2TrackPt) delete fh2TrackPt;\r
526   if(fh2Xi)      delete fh2Xi;\r
527   if(fh2Z)       delete fh2Z;\r
528 }\r
529 \r
530 //_________________________________________________________________\r
531 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::DefineHistos()\r
532 {\r
533   // book FF histos\r
534 \r
535   fh1JetPt   = new TH1F(Form("fh1FFJetPt%s", fName.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);\r
536   fh2TrackPt = new TH2F(Form("fh2FFTrackPt%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsPt, fPtMin, fPtMax);\r
537   fh2Xi      = new TH2F(Form("fh2FFXi%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsXi, fXiMin, fXiMax);\r
538   fh2Z       = new TH2F(Form("fh2FFZ%s",fName.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsZ, fZMin, fZMax);\r
539 \r
540   AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{T} [GeV/c]", "entries"); \r
541   AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPt,"jet p_{T} [GeV/c]","p_{T} [GeV/c]","entries");\r
542   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi,"jet p_{T} [GeV/c]","#xi", "entries");\r
543   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z,"jet p_{T} [GeV/c]","z","entries");\r
544 }\r
545 \r
546 //_______________________________________________________________________________________________________________\r
547 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::FillFF(Float_t trackPt, Float_t jetPt, Bool_t incrementJetPt)\r
548 {\r
549   // fill FF\r
550  \r
551   if(incrementJetPt) fh1JetPt->Fill(jetPt);    \r
552   fh2TrackPt->Fill(jetPt,trackPt);\r
553   \r
554   Double_t z = trackPt / jetPt;\r
555   Double_t xi = 0;\r
556   if(z>0) xi = TMath::Log(1/z);\r
557   \r
558   fh2Xi->Fill(jetPt,xi);\r
559   fh2Z->Fill(jetPt,z);\r
560 }\r
561 \r
562 //_________________________________________________________________________________\r
563 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AddToOutput(TList* list) const\r
564 {\r
565   // add histos to list\r
566 \r
567   list->Add(fh1JetPt);\r
568   \r
569   list->Add(fh2TrackPt);\r
570   list->Add(fh2Xi);\r
571   list->Add(fh2Z);\r
572 }\r
573 \r
574 \r
575 //_________________________________________________________________________________________________________\r
576 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const char* name,\r
577                                                                Int_t nPt,   Float_t ptMin,   Float_t ptMax,\r
578                                                                Int_t nEta,  Float_t etaMin,  Float_t etaMax,\r
579                                                                Int_t nPhi,  Float_t phiMin,  Float_t phiMax)\r
580   : TObject()\r
581   ,fNBinsPt(nPt)\r
582   ,fPtMin(ptMin)\r
583   ,fPtMax(ptMax)\r
584   ,fNBinsEta(nEta)\r
585   ,fEtaMin(etaMin)\r
586   ,fEtaMax(etaMax)\r
587   ,fNBinsPhi(nPhi)\r
588   ,fPhiMin(phiMin)\r
589   ,fPhiMax(phiMax)\r
590   ,fh2EtaPhi(0)\r
591   ,fh1Pt(0)\r
592   ,fName(name)\r
593 {\r
594   // default constructor\r
595 }\r
596 \r
597 //____________________________________________________________________________________\r
598 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const AliFragFuncQAJetHistos& copy)\r
599   : TObject()\r
600   ,fNBinsPt(copy.fNBinsPt)\r
601   ,fPtMin(copy.fPtMin)\r
602   ,fPtMax(copy.fPtMax)\r
603   ,fNBinsEta(copy.fNBinsEta)\r
604   ,fEtaMin(copy.fEtaMin)\r
605   ,fEtaMax(copy.fEtaMax)\r
606   ,fNBinsPhi(copy.fNBinsPhi)\r
607   ,fPhiMin(copy.fPhiMin)\r
608   ,fPhiMax(copy.fPhiMax)\r
609   ,fh2EtaPhi(copy.fh2EtaPhi)\r
610   ,fh1Pt(copy.fh1Pt)\r
611   ,fName(copy.fName)\r
612 {\r
613   // copy constructor\r
614 }\r
615 \r
616 //________________________________________________________________________________________________________________________________________________________________________\r
617 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& o)\r
618 {\r
619   // assignment\r
620   \r
621   if(this!=&o){\r
622     TObject::operator=(o);\r
623     fNBinsPt  = o.fNBinsPt;\r
624     fPtMin    = o.fPtMin;\r
625     fPtMax    = o.fPtMax;\r
626     fNBinsEta = o.fNBinsEta;\r
627     fEtaMin   = o.fEtaMin;\r
628     fEtaMax   = o.fEtaMax;\r
629     fNBinsPhi = o.fNBinsPhi;\r
630     fPhiMin   = o.fPhiMin;\r
631     fPhiMax   = o.fPhiMax;\r
632     fh2EtaPhi = o.fh2EtaPhi;\r
633     fh1Pt     = o.fh1Pt;\r
634     fName     = o.fName;\r
635   }\r
636   \r
637   return *this;\r
638 }\r
639 \r
640 //______________________________________________________________\r
641 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::~AliFragFuncQAJetHistos()\r
642 {\r
643   // destructor \r
644   \r
645   if(fh2EtaPhi) delete fh2EtaPhi;\r
646   if(fh1Pt)     delete fh1Pt;\r
647 }\r
648 \r
649 //____________________________________________________________________\r
650 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::DefineHistos()\r
651 {\r
652   // book jet QA histos\r
653 \r
654   fh2EtaPhi  = new TH2F(Form("fh2JetQAEtaPhi%s", fName.Data()), Form("%s: #eta - #phi distribution", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
655   fh1Pt      = new TH1F(Form("fh1JetQAPt%s", fName.Data()), Form("%s: p_{T} distribution", fName.Data()), fNBinsPt, fPtMin, fPtMax);\r
656         \r
657   AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); \r
658   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");\r
659 }\r
660 \r
661 //____________________________________________________________________________________________________\r
662 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::FillJetQA(Float_t eta, Float_t phi, Float_t pt)\r
663 {\r
664   // fill jet QA histos \r
665 \r
666   fh2EtaPhi->Fill( eta, phi);\r
667   fh1Pt->Fill( pt );\r
668 }\r
669 \r
670 //____________________________________________________________________________________\r
671 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AddToOutput(TList* list) const \r
672 {\r
673   // add histos to list\r
674 \r
675   list->Add(fh2EtaPhi);\r
676   list->Add(fh1Pt);\r
677 }\r
678 \r
679 \r
680 //___________________________________________________________________________________________________________\r
681 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const char* name,\r
682                                                                    Int_t nPt, Float_t ptMin, Float_t ptMax,\r
683                                                                    Int_t nEta, Float_t etaMin, Float_t etaMax,\r
684                                                                    Int_t nPhi, Float_t phiMin, Float_t phiMax,\r
685                                                                    Float_t ptThresh) \r
686   : TObject()\r
687   ,fNBinsPt(nPt)\r
688   ,fPtMin(ptMin)\r
689   ,fPtMax(ptMax)\r
690   ,fNBinsEta(nEta)\r
691   ,fEtaMin(etaMin)\r
692   ,fEtaMax(etaMax)\r
693   ,fNBinsPhi(nPhi)\r
694   ,fPhiMin(phiMin)\r
695   ,fPhiMax(phiMax)\r
696   ,fHighPtThreshold(ptThresh)\r
697   ,fh2EtaPhi(0)\r
698   ,fh1Pt(0)\r
699   ,fh2HighPtEtaPhi(0)\r
700   ,fName(name)\r
701 {\r
702   // default constructor\r
703 }\r
704 \r
705 //__________________________________________________________________________________________\r
706 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const AliFragFuncQATrackHistos& copy)\r
707   : TObject()\r
708   ,fNBinsPt(copy.fNBinsPt)\r
709   ,fPtMin(copy.fPtMin)\r
710   ,fPtMax(copy.fPtMax)\r
711   ,fNBinsEta(copy.fNBinsEta)\r
712   ,fEtaMin(copy.fEtaMin)\r
713   ,fEtaMax(copy.fEtaMax)\r
714   ,fNBinsPhi(copy.fNBinsPhi)\r
715   ,fPhiMin(copy.fPhiMin)\r
716   ,fPhiMax(copy.fPhiMax)\r
717   ,fHighPtThreshold(copy.fHighPtThreshold)\r
718   ,fh2EtaPhi(copy.fh2EtaPhi)\r
719   ,fh1Pt(copy.fh1Pt)\r
720   ,fh2HighPtEtaPhi(copy.fh2HighPtEtaPhi)\r
721   ,fName(copy.fName)\r
722 {\r
723   // copy constructor\r
724 }\r
725 \r
726 // _____________________________________________________________________________________________________________________________________________________________________________\r
727 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& o)\r
728 {\r
729   // assignment\r
730   \r
731   if(this!=&o){\r
732     TObject::operator=(o);\r
733     fNBinsPt         = o.fNBinsPt;\r
734     fPtMin           = o.fPtMin;\r
735     fPtMax           = o.fPtMax;\r
736     fNBinsEta        = o.fNBinsEta;\r
737     fEtaMin          = o.fEtaMin;\r
738     fEtaMax          = o.fEtaMax;\r
739     fNBinsPhi        = o.fNBinsPhi;\r
740     fPhiMin          = o.fPhiMin;\r
741     fPhiMax          = o.fPhiMax;\r
742     fHighPtThreshold = o.fHighPtThreshold;\r
743     fh2EtaPhi        = o.fh2EtaPhi;\r
744     fh1Pt            = o.fh1Pt;\r
745     fh2HighPtEtaPhi  = o.fh2HighPtEtaPhi;\r
746     fName            = o.fName;\r
747   }\r
748   \r
749   return *this;\r
750 }\r
751 \r
752 //___________________________________________________________________\r
753 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::~AliFragFuncQATrackHistos()\r
754 {\r
755   // destructor \r
756   \r
757   if(fh2EtaPhi)       delete fh2EtaPhi;\r
758   if(fh2HighPtEtaPhi) delete fh2HighPtEtaPhi;\r
759   if(fh1Pt)           delete fh1Pt;\r
760 }\r
761 \r
762 //______________________________________________________________________\r
763 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::DefineHistos()\r
764 {\r
765   // book track QA histos\r
766 \r
767   fh2EtaPhi       = new TH2F(Form("fh2TrackQAEtaPhi%s", fName.Data()), Form("%s: #eta - #phi distribution", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
768   fh2HighPtEtaPhi = new TH2F(Form("fh2TrackQAHighPtEtaPhi%s", fName.Data()), Form("%s: #eta - #phi distribution for high-p_{T}", fName.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);\r
769   fh1Pt           = new TH1F(Form("fh1TrackQAPt%s", fName.Data()), Form("%s: p_{T} distribution", fName.Data()), fNBinsPt, fPtMin, fPtMax);\r
770   \r
771   AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); \r
772   AliAnalysisTaskFragmentationFunction::SetProperties(fh2HighPtEtaPhi, "#eta", "#phi");\r
773   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");\r
774 }\r
775 \r
776 //________________________________________________________________________________________________________\r
777 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::FillTrackQA(Float_t eta, Float_t phi, Float_t pt)\r
778 {\r
779   // fill track QA histos\r
780     \r
781   fh2EtaPhi->Fill( eta, phi);\r
782   if(pt > fHighPtThreshold) fh2HighPtEtaPhi->Fill( eta, phi);\r
783   fh1Pt->Fill( pt );    \r
784 }\r
785 \r
786 //______________________________________________________________________________________\r
787 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AddToOutput(TList* list) const\r
788 {\r
789   // add histos to list\r
790 \r
791   list->Add(fh2EtaPhi);\r
792   list->Add(fh2HighPtEtaPhi);\r
793   list->Add(fh1Pt);\r
794 }\r
795 \r
796 //__________________________________________________________________\r
797 void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()\r
798 {\r
799   // create output objects\r
800   \r
801   if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()");\r
802  \r
803   // create list of tracks and jets \r
804   \r
805   fTracksRec = new TList();\r
806   fTracksRec->SetOwner(kFALSE);  \r
807 \r
808   fTracksRecCuts = new TList();\r
809   fTracksRecCuts->SetOwner(kFALSE);  \r
810 \r
811   fTracksGen = new TList();\r
812   fTracksGen->SetOwner(kFALSE);\r
813 \r
814   fJetsRec = new TList();\r
815   fJetsRec->SetOwner(kFALSE);\r
816 \r
817   fJetsRecCuts = new TList();\r
818   fJetsRecCuts->SetOwner(kFALSE);\r
819 \r
820   fJetsGen = new TList();\r
821   fJetsGen->SetOwner(kFALSE);\r
822 \r
823   // fJetsKine = new TList();\r
824   // fJetsKine->SetOwner(kTRUE); // delete AOD jets using mom from Kine Tree via TList::Clear()\r
825 \r
826 \r
827   //\r
828   // Create histograms / output container\r
829   //\r
830 \r
831   OpenFile(1);\r
832   fCommonHistList = new TList();\r
833   \r
834   Bool_t oldStatus = TH1::AddDirectoryStatus();\r
835   TH1::AddDirectory(kFALSE);\r
836   \r
837   \r
838   // Histograms \r
839   fh1EvtSelection            = new TH1F("fh1EvtSelection", "Event Selection", 6, -0.5, 5.5);\r
840   fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 11,-.5, 10.5);\r
841   fh1VertexZ                 = new TH1F("fh1VertexZ", "Vertex z distribution", 30, -15., 15.);\r
842   fh1EvtMult                 = new TH1F("fh1EvtMult","Event multiplicity, track pT cut > 150 MeV/c, |#eta| < 0.9",100,0.,100.);\r
843   fh1nRecJetsCuts            = new TH1F("fh1nRecJetsCuts","reconstructed jets per event",10,-0.5,9.5);\r
844   fh1nGenJets                = new TH1F("fh1nGenJets","generated jets per event",10,-0.5,9.5);\r
845 \r
846 \r
847   fQATrackHistosRec          = new AliFragFuncQATrackHistos("Rec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
848                                                  fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
849   fQATrackHistosRecCuts      = new AliFragFuncQATrackHistos("RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
850                                                  fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
851   fQATrackHistosGen          = new AliFragFuncQATrackHistos("Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,\r
852                                                  fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, fQATrackHighPtThreshold);\r
853   \r
854 \r
855   fQAJetHistosRec            = new AliFragFuncQAJetHistos("Rec", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
856                                                fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
857   fQAJetHistosRecCuts        = new AliFragFuncQAJetHistos("RecCuts", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
858                                                fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
859   fQAJetHistosRecCutsLeading = new AliFragFuncQAJetHistos("RecCutsLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
860                                                fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
861   fQAJetHistosGen            = new AliFragFuncQAJetHistos("Gen", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
862                                                fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
863   fQAJetHistosGenLeading     = new AliFragFuncQAJetHistos("GenLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,\r
864                                                fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);\r
865   \r
866 \r
867   fFFHistosRecCuts           = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
868                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
869   fFFHistosRecLeading        = new AliFragFuncHistos("RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
870                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
871   fFFHistosRecLeadingTrack   = new AliFragFuncHistos("RecLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
872                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
873   fFFHistosGen               = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
874                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
875   fFFHistosGenLeading        = new AliFragFuncHistos("GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
876                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
877   fFFHistosGenLeadingTrack   = new AliFragFuncHistos("GenLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, fFFNBinsPt, fFFPtMin, fFFPtMax, fFFNBinsXi, fFFXiMin, fFFXiMax,  \r
878                                             fFFNBinsZ , fFFZMin , fFFZMax);\r
879 \r
880 \r
881   fQATrackHistosRec->DefineHistos();\r
882   fQATrackHistosRecCuts->DefineHistos();\r
883   fQATrackHistosGen->DefineHistos();\r
884 \r
885   fQAJetHistosRec->DefineHistos();\r
886   fQAJetHistosRecCuts->DefineHistos();\r
887   fQAJetHistosRecCutsLeading->DefineHistos();\r
888   fQAJetHistosGen->DefineHistos();\r
889   fQAJetHistosGenLeading->DefineHistos();\r
890 \r
891   fFFHistosRecCuts->DefineHistos();\r
892   fFFHistosRecLeading->DefineHistos();\r
893   fFFHistosRecLeadingTrack->DefineHistos();\r
894   fFFHistosGen->DefineHistos();\r
895   fFFHistosGenLeading->DefineHistos();\r
896   fFFHistosGenLeadingTrack->DefineHistos();\r
897   \r
898   \r
899   const Int_t saveLevel = 4;\r
900   if(saveLevel>0){\r
901     fCommonHistList->Add(fh1EvtSelection);\r
902     fFFHistosRecCuts->AddToOutput(fCommonHistList);\r
903     fFFHistosRecLeading->AddToOutput(fCommonHistList);\r
904     fFFHistosRecLeadingTrack->AddToOutput(fCommonHistList);\r
905     fFFHistosGen->AddToOutput(fCommonHistList);\r
906     fFFHistosGenLeading->AddToOutput(fCommonHistList);\r
907     fFFHistosGenLeadingTrack->AddToOutput(fCommonHistList);\r
908   }\r
909   if(saveLevel>1){\r
910     fQATrackHistosRec->AddToOutput(fCommonHistList);\r
911     fQATrackHistosRecCuts->AddToOutput(fCommonHistList);\r
912     fQATrackHistosGen->AddToOutput(fCommonHistList);\r
913     \r
914     fQAJetHistosRec->AddToOutput(fCommonHistList);\r
915     fQAJetHistosRecCuts->AddToOutput(fCommonHistList);\r
916     fQAJetHistosRecCutsLeading->AddToOutput(fCommonHistList);\r
917     fQAJetHistosGen->AddToOutput(fCommonHistList);\r
918     fQAJetHistosGenLeading->AddToOutput(fCommonHistList);\r
919     \r
920     fCommonHistList->Add(fh1EvtMult);\r
921     fCommonHistList->Add(fh1nRecJetsCuts);\r
922     fCommonHistList->Add(fh1nGenJets);\r
923   }\r
924   if(saveLevel>2){\r
925     fCommonHistList->Add(fh1VertexNContributors);\r
926     fCommonHistList->Add(fh1VertexZ);    \r
927   }\r
928   if(saveLevel>3){\r
929     \r
930   }\r
931   \r
932   // =========== Switch on Sumw2 for all histos ===========\r
933   for (Int_t i=0; i<fCommonHistList->GetEntries(); ++i) {\r
934     TH1 *h1 = dynamic_cast<TH1*>(fCommonHistList->At(i));\r
935     if (h1) h1->Sumw2();        \r
936   }\r
937   \r
938   TH1::AddDirectory(oldStatus);\r
939 }\r
940 \r
941 //_______________________________________________\r
942 void AliAnalysisTaskFragmentationFunction::Init()\r
943 {\r
944   // Initialization\r
945   if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::Init()");\r
946 \r
947 }\r
948 \r
949 //_____________________________________________________________\r
950 void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *) \r
951 {\r
952   // Main loop\r
953   // Called for each event\r
954   if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserExec()");\r
955         \r
956 \r
957   if(fDebug > 1) Printf("Analysis event #%5d", (Int_t) fEntry);\r
958   // Trigger selection\r
959   \r
960   AliInputEventHandler* inputHandler = (AliInputEventHandler*)\r
961     ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());\r
962   if(inputHandler->IsEventSelected()&AliVEvent::kMB){\r
963     if(fDebug > 1)  Printf(" Trigger Selection: event ACCEPTED ... ");\r
964     fh1EvtSelection->Fill(1.);\r
965   } else {\r
966     fh1EvtSelection->Fill(0.);\r
967     if(inputHandler->InheritsFrom("AliESDInputHandler")){ // PhysicsSelection only with ESD input\r
968        if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");\r
969        PostData(1, fCommonHistList);\r
970        return;\r
971     }\r
972   }\r
973     \r
974   fESD = dynamic_cast<AliESDEvent*>(InputEvent());\r
975   if(!fESD){\r
976     if(fDebug>3) Printf("%s:%d ESDEvent not found in the input", (char*)__FILE__,__LINE__);\r
977   }\r
978   \r
979   fMCEvent = MCEvent();\r
980   if(!fMCEvent){\r
981     if(fDebug>3) Printf("%s:%d MCEvent not found in the input", (char*)__FILE__,__LINE__);\r
982   }\r
983   \r
984   // get AOD event from input/ouput\r
985   TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
986   if( handler && handler->InheritsFrom("AliAODInputHandler") ) {\r
987     fAOD  =  ((AliAODInputHandler*)handler)->GetEvent();\r
988     if (fDebug > 1)  Printf("%s:%d AOD event from input", (char*)__FILE__,__LINE__);\r
989   }\r
990   else {\r
991     handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();\r
992     if( handler && handler->InheritsFrom("AliAODHandler") ) {\r
993       fAOD  = ((AliAODHandler*)handler)->GetAOD();\r
994       if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);\r
995     }\r
996   }\r
997   \r
998   if(!fAOD){\r
999     Printf("%s:%d AODEvent not found", (char*)__FILE__,__LINE__);\r
1000     return;\r
1001   }\r
1002   \r
1003   \r
1004   // event selection (vertex) *****************************************\r
1005   \r
1006   AliAODVertex* primVtx = fAOD->GetPrimaryVertex();\r
1007   Int_t nTracksPrim = primVtx->GetNContributors();\r
1008   fh1VertexNContributors->Fill(nTracksPrim);\r
1009   \r
1010   if (fDebug > 1) Printf("%s:%d primary vertex selection: %d", (char*)__FILE__,__LINE__,nTracksPrim);\r
1011   if(!nTracksPrim){\r
1012     if (fDebug > 1) Printf("%s:%d primary vertex selection: event REJECTED...",(char*)__FILE__,__LINE__); \r
1013     fh1EvtSelection->Fill(2.);\r
1014     PostData(1, fCommonHistList);\r
1015     return;\r
1016   }\r
1017 \r
1018   fh1VertexZ->Fill(primVtx->GetZ());\r
1019   \r
1020   if(TMath::Abs(primVtx->GetZ())>10){\r
1021     if (fDebug > 1) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); \r
1022     fh1EvtSelection->Fill(3.);\r
1023     PostData(1, fCommonHistList);\r
1024     return; \r
1025   }\r
1026 \r
1027   TString primVtxName(primVtx->GetName());\r
1028 \r
1029   if(primVtxName.CompareTo("TPCVertex",TString::kIgnoreCase) == 1){\r
1030     if (fDebug > 1) Printf("%s:%d primary vertex selection: TPC vertex, event REJECTED...",(char*)__FILE__,__LINE__);\r
1031     fh1EvtSelection->Fill(4.);\r
1032     PostData(1, fCommonHistList);\r
1033     return;\r
1034   }\r
1035   if (fDebug > 1) Printf("%s:%d primary vertex selection: event ACCEPTED ...",(char*)__FILE__,__LINE__); \r
1036   fh1EvtSelection->Fill(5.);\r
1037   \r
1038   \r
1039   //___ fetch jets __________________________________________________________________________\r
1040   \r
1041   Int_t nJ = GetListOfJets(fJetsRec, kJetsRec);\r
1042   Int_t nRecJets = 0;\r
1043   if(nJ>=0) nRecJets = fJetsRec->GetEntries();\r
1044   if(fDebug>2)Printf("%s:%d Selected Rec jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);\r
1045   if(nJ != nRecJets) Printf("%s:%d Mismatch Selected Rec Jets: %d %d",(char*)__FILE__,__LINE__,nJ,nRecJets);\r
1046 \r
1047   Int_t nJCuts = GetListOfJets(fJetsRecCuts, kJetsRecAcceptance);\r
1048   Int_t nRecJetsCuts = 0;\r
1049   if(nJCuts>=0) nRecJetsCuts = fJetsRecCuts->GetEntries();\r
1050   if(fDebug>2)Printf("%s:%d Selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);\r
1051   if(nRecJetsCuts != nJCuts) Printf("%s:%d Mismatch selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);\r
1052   fh1nRecJetsCuts->Fill(nRecJetsCuts);\r
1053 \r
1054   \r
1055   if(fJetTypeGen==kJetsKine || fJetTypeGen == kJetsKineAcceptance) fJetsGen->SetOwner(kTRUE); // kine aod jets allocated on heap, delete them with TList::Clear() \r
1056   Int_t nJGen  = GetListOfJets(fJetsGen, fJetTypeGen);\r
1057   Int_t nGenJets = 0;\r
1058   if(nJGen>=0) nGenJets = fJetsGen->GetEntries();\r
1059   if(fDebug>2)Printf("%s:%d Selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);\r
1060   if(nJGen != nGenJets) Printf("%s:%d Mismatch selected Gen jets: %d %d",(char*)__FILE__,__LINE__,nJGen,nGenJets);\r
1061   fh1nGenJets->Fill(nGenJets);\r
1062 \r
1063 \r
1064   //____ fetch particles __________________________________________________________\r
1065   \r
1066   Int_t nT = GetListOfTracks(fTracksRec, kTrackAOD);\r
1067   Int_t nRecPart = 0;\r
1068   if(nT>=0) nRecPart = fTracksRec->GetEntries();\r
1069   if(fDebug>2)Printf("%s:%d Selected Rec tracks: %d %d",(char*)__FILE__,__LINE__,nT,nRecPart);\r
1070   if(nRecPart != nT) Printf("%s:%d Mismatch selected Rec tracks: %d %d",(char*)__FILE__,__LINE__,nT,nRecPart);\r
1071   \r
1072 \r
1073   Int_t nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODCuts);\r
1074   Int_t nRecPartCuts = 0;\r
1075   if(nTCuts>=0) nRecPartCuts = fTracksRecCuts->GetEntries();\r
1076   if(fDebug>2)Printf("%s:%d Selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);\r
1077   if(nRecPartCuts != nTCuts) Printf("%s:%d Mismatch selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,nRecPartCuts);\r
1078   fh1EvtMult->Fill(nRecPartCuts);\r
1079 \r
1080 \r
1081   Int_t nTGen = GetListOfTracks(fTracksGen,fTrackTypeGen);\r
1082   Int_t nGenPart = 0;\r
1083   if(nTGen>=0) nGenPart = fTracksGen->GetEntries();\r
1084   if(fDebug>2)Printf("%s:%d Selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);\r
1085   if(nGenPart != nTGen) Printf("%s:%d Mismatch selected Gen tracks: %d %d",(char*)__FILE__,__LINE__,nTGen,nGenPart);\r
1086   \r
1087   \r
1088   //____ analysis, fill histos ___________________________________________________\r
1089   \r
1090   // loop over tracks\r
1091 \r
1092   for(Int_t it=0; it<nRecPart; ++it){\r
1093     AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRec->At(it));\r
1094     fQATrackHistosRec->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
1095   }\r
1096   for(Int_t it=0; it<nRecPartCuts; ++it){\r
1097     AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksRecCuts->At(it));\r
1098     fQATrackHistosRecCuts->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
1099   }\r
1100   for(Int_t it=0; it<nGenPart; ++it){\r
1101     AliVParticle *part = dynamic_cast<AliVParticle*>(fTracksGen->At(it));\r
1102     fQATrackHistosGen->FillTrackQA( part->Eta(), TVector2::Phi_0_2pi(part->Phi()), part->Pt());\r
1103   }\r
1104   \r
1105   // loop over jets\r
1106 \r
1107   for(Int_t ij=0; ij<nRecJets; ++ij){\r
1108 \r
1109     AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRec->At(ij));\r
1110     fQAJetHistosRec->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
1111   }\r
1112   \r
1113 \r
1114   for(Int_t ij=0; ij<nRecJetsCuts; ++ij){\r
1115 \r
1116     AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsRecCuts->At(ij));\r
1117     fQAJetHistosRecCuts->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
1118 \r
1119     if(ij==0){ // leading jet\r
1120       \r
1121       fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );\r
1122       \r
1123       TList* jettracklist = new TList();\r
1124       Double_t sumPt = 0.;\r
1125       Float_t leadTrackPt = 0.;\r
1126       \r
1127       if(GetFFRadius()<=0){\r
1128         GetJetTracksTrackrefs(jettracklist, jet);\r
1129        } else {\r
1130         GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt);\r
1131       }\r
1132       \r
1133       for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
1134         Float_t trackPt = (dynamic_cast<AliVParticle*> (jettracklist->At(it)))->Pt();\r
1135         Float_t jetPt = jet->Pt();\r
1136         Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
1137         \r
1138         fFFHistosRecCuts->FillFF( trackPt, jetPt, incrementJetPt);\r
1139         \r
1140         if(it==0){ \r
1141           leadTrackPt = trackPt;\r
1142           fFFHistosRecLeadingTrack->FillFF( leadTrackPt, jetPt, kTRUE);\r
1143         }\r
1144         fFFHistosRecLeading->FillFF( trackPt, leadTrackPt , incrementJetPt);\r
1145       }\r
1146       \r
1147       delete jettracklist;\r
1148     }\r
1149   }\r
1150         \r
1151 \r
1152   for(Int_t ij=0; ij<nGenJets; ++ij){\r
1153 \r
1154     AliAODJet* jet = dynamic_cast<AliAODJet*>(fJetsGen->At(ij));\r
1155     fQAJetHistosGen->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
1156     \r
1157     if(ij==0){ // leading jet\r
1158     \r
1159       fQAJetHistosGenLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt());\r
1160       \r
1161       TList* jettracklist = new TList();\r
1162       Double_t sumPt = 0.;\r
1163       Float_t leadTrackPt = 0.;\r
1164       \r
1165       if(GetFFRadius()<=0){\r
1166         GetJetTracksTrackrefs(jettracklist, jet);\r
1167       } else {\r
1168         GetJetTracksPointing(fTracksGen, jettracklist, jet, GetFFRadius(), sumPt);\r
1169       }\r
1170       \r
1171       for(Int_t it=0; it<jettracklist->GetSize(); ++it){\r
1172         Float_t trackPt = (dynamic_cast<AliVParticle*>(jettracklist->At(it)))->Pt();\r
1173         Float_t jetPt = jet->Pt();\r
1174         Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;\r
1175 \r
1176         fFFHistosGen->FillFF( trackPt, jetPt, incrementJetPt);\r
1177         \r
1178         if(it==0){ \r
1179           leadTrackPt = trackPt;\r
1180           fFFHistosGenLeadingTrack->FillFF( leadTrackPt, jetPt, kTRUE);\r
1181         }\r
1182         fFFHistosGenLeading->FillFF( trackPt, leadTrackPt, incrementJetPt);\r
1183       }\r
1184       \r
1185       delete jettracklist;\r
1186     }\r
1187   }\r
1188   \r
1189   fTracksRec->Clear();\r
1190   fTracksRecCuts->Clear();\r
1191   fTracksGen->Clear();\r
1192   fJetsRec->Clear();\r
1193   fJetsRecCuts->Clear();\r
1194   fJetsGen->Clear();\r
1195 \r
1196   //Post output data.\r
1197   PostData(1, fCommonHistList);\r
1198   \r
1199 }\r
1200 \r
1201 //______________________________________________________________\r
1202 void AliAnalysisTaskFragmentationFunction::Terminate(Option_t *) \r
1203 {\r
1204   // terminated\r
1205 \r
1206   if(fDebug > 1) printf("AliAnalysisTaskFragmentationFunction::Terminate() \n");\r
1207 }  \r
1208 \r
1209 //_________________________________________________________________________________\r
1210 Int_t AliAnalysisTaskFragmentationFunction::GetListOfTracks(TList *list, Int_t type)\r
1211 {\r
1212   // fill list of tracks selected according to type\r
1213 \r
1214   if(fDebug > 2) Printf("%s:%d Selecting tracks with %d", (char*)__FILE__,__LINE__,type);\r
1215   \r
1216   if(!list){\r
1217     if(fDebug>1) Printf("%s:%d no input list", (char*)__FILE__,__LINE__);\r
1218     return -1;\r
1219   }\r
1220 \r
1221   if(type==kTrackUndef) return -1;\r
1222   \r
1223   Int_t iCount = 0;\r
1224   if(type==kTrackAODCuts || type==kTrackAOD){\r
1225 \r
1226     // all rec. tracks, esd filter mask, eta range\r
1227     if(!fAOD) return -1;\r
1228     \r
1229     for(Int_t it=0; it<fAOD->GetNumberOfTracks(); ++it){\r
1230       AliAODTrack *tr = fAOD->GetTrack(it);\r
1231       \r
1232       if(type == kTrackAODCuts){\r
1233         if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))   continue;\r
1234         if(tr->Eta() < fTrackEtaMin || tr->Eta() > fTrackEtaMax) continue;\r
1235         if(tr->Phi() < fTrackPhiMin || tr->Phi() > fTrackPhiMax) continue;\r
1236         if(tr->Pt()  < fTrackPtCut) continue;\r
1237       }\r
1238       list->Add(tr);\r
1239       iCount++;\r
1240     }\r
1241   }\r
1242   else if (type==kTrackKineAll || type==kTrackKineCharged || type==kTrackKineChargedAcceptance){\r
1243     // kine particles, all or rather charged\r
1244     if(!fMCEvent) return iCount;\r
1245     \r
1246     for(Int_t it=0; it<fMCEvent->GetNumberOfTracks(); ++it){\r
1247       AliMCParticle* part = (AliMCParticle*) fMCEvent->GetTrack(it);\r
1248       \r
1249       if(type == kTrackKineCharged || type == kTrackKineChargedAcceptance){\r
1250         if(part->Charge()==0) continue;\r
1251         \r
1252         if(type == kTrackKineChargedAcceptance && \r
1253            (       part->Eta() < fTrackEtaMin\r
1254                 || part->Eta() > fTrackEtaMax\r
1255                 || part->Phi() < fTrackPhiMin\r
1256                 || part->Phi() > fTrackPhiMax \r
1257                 || part->Pt()  < fTrackPtCut)) continue;\r
1258       }\r
1259       \r
1260       list->Add(part);\r
1261       iCount++;\r
1262     }\r
1263   }\r
1264   else if (type==kTrackAODMCCharged || type==kTrackAODMCAll || type==kTrackAODMCChargedAcceptance) {\r
1265     // MC particles (from AOD), physical primaries, all or rather charged or rather charged within acceptance\r
1266     if(!fAOD) return -1;\r
1267     \r
1268     TClonesArray *tca = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
1269     if(!tca)return iCount;\r
1270     \r
1271     for(int it=0; it<tca->GetEntriesFast(); ++it){\r
1272       AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));\r
1273       if(!part->IsPhysicalPrimary())continue;\r
1274       \r
1275       if (type==kTrackAODMCCharged || type==kTrackAODMCChargedAcceptance){\r
1276         if(part->Charge()==0) continue;\r
1277         if(type==kTrackAODMCChargedAcceptance && \r
1278            (     part->Eta() > fTrackEtaMax\r
1279               || part->Eta() < fTrackEtaMin\r
1280               || part->Phi() > fTrackPhiMax\r
1281               || part->Phi() < fTrackPhiMin\r
1282               || part->Pt()  < fTrackPtCut)) continue;\r
1283       }\r
1284       \r
1285       list->Add(part);\r
1286       iCount++;\r
1287     }\r
1288   }\r
1289   \r
1290   list->Sort();\r
1291   return iCount;\r
1292   \r
1293 }\r
1294 // _______________________________________________________________________________\r
1295 Int_t AliAnalysisTaskFragmentationFunction::GetListOfJets(TList *list, Int_t type)\r
1296 {\r
1297   // fill list of jets selected according to type\r
1298   \r
1299   if(!list){\r
1300     if(fDebug>1) Printf("%s:%d no input list", (char*)__FILE__,__LINE__);\r
1301     return -1;\r
1302   }\r
1303 \r
1304   if(type == kJetsRec || type == kJetsRecAcceptance){ // reconstructed jets\r
1305 \r
1306     if(fBranchRecJets.Length()==0){\r
1307       Printf("%s:%d no rec jet branch specified", (char*)__FILE__,__LINE__);\r
1308       if(fDebug>1)fAOD->Print();\r
1309       return 0;\r
1310     }\r
1311 \r
1312     TClonesArray *aodRecJets = 0x0;\r
1313     if(fBranchRecJets.Length()) aodRecJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchRecJets.Data()));\r
1314     if(!aodRecJets)             aodRecJets = dynamic_cast<TClonesArray*>(fAOD->GetList()->FindObject(fBranchRecJets.Data()));\r
1315 \r
1316     if(!aodRecJets){\r
1317       if(fBranchRecJets.Length()) Printf("%s:%d no reconstructed jet array with name %s found", (char*)__FILE__,__LINE__,fBranchRecJets.Data());\r
1318 \r
1319       if(fDebug>1)fAOD->Print();\r
1320       return 0;\r
1321     }\r
1322 \r
1323     Int_t nRecJets = 0;\r
1324     \r
1325     for(Int_t ij=0; ij<aodRecJets->GetEntries(); ++ij){\r
1326 \r
1327       AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodRecJets->At(ij));\r
1328       if(!tmp) continue;\r
1329         \r
1330       if( tmp->Pt() < fJetPtCut ) continue;\r
1331       if( type == kJetsRecAcceptance &&\r
1332           (    tmp->Eta() < fJetEtaMin\r
1333             || tmp->Eta() > fJetEtaMax\r
1334             || tmp->Phi() < fJetPhiMin\r
1335             || tmp->Phi() > fJetPhiMax )) continue;\r
1336       \r
1337       list->Add(tmp);\r
1338           \r
1339       nRecJets++;\r
1340     }\r
1341 \r
1342     list->Sort();\r
1343     return nRecJets;\r
1344   }\r
1345   else if(type == kJetsKine || type == kJetsKineAcceptance){\r
1346     \r
1347     // generated jets\r
1348     Int_t nGenJets = 0;\r
1349     \r
1350     if(!fMCEvent){\r
1351       if(fDebug>1) Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__);\r
1352       return 0;\r
1353     }\r
1354     \r
1355     AliGenPythiaEventHeader*  pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(fMCEvent);\r
1356     if(!pythiaGenHeader){\r
1357       Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);\r
1358       return 0;\r
1359     }\r
1360     \r
1361     // fetch the pythia generated jets\r
1362     for(int ip=0; ip<pythiaGenHeader->NTriggerJets(); ++ip){\r
1363       \r
1364       Float_t p[4];\r
1365       AliAODJet *jet = new AliAODJet();\r
1366       pythiaGenHeader->TriggerJet(ip, p);\r
1367       jet->SetPxPyPzE(p[0], p[1], p[2], p[3]);\r
1368 \r
1369       if( type == kJetsKineAcceptance &&\r
1370           (    jet->Eta() < fJetEtaMin\r
1371             || jet->Eta() > fJetEtaMax\r
1372             || jet->Phi() < fJetPhiMin\r
1373             || jet->Phi() > fJetPhiMax )) continue;\r
1374       \r
1375       list->Add(jet);\r
1376       nGenJets++;\r
1377     }\r
1378     list->Sort();\r
1379     return nGenJets;\r
1380   }\r
1381   else if(type == kJetsGen || type == kJetsGenAcceptance ){\r
1382 \r
1383     if(fBranchGenJets.Length()==0){\r
1384       if(fDebug>1) Printf("%s:%d no gen jet branch specified", (char*)__FILE__,__LINE__);\r
1385       return 0;\r
1386     }\r
1387     \r
1388     TClonesArray *aodGenJets = 0x0;\r
1389     if(fBranchGenJets.Length()) aodGenJets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fBranchGenJets.Data()));\r
1390     if(!aodGenJets)             aodGenJets = dynamic_cast<TClonesArray*>(fAOD->GetList()->FindObject(fBranchGenJets.Data()));\r
1391 \r
1392     if(!aodGenJets){\r
1393       if(fDebug>0){\r
1394         if(fBranchGenJets.Length())         Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGenJets.Data());\r
1395       }\r
1396       if(fDebug>1)fAOD->Print();\r
1397       return 0;\r
1398     }\r
1399 \r
1400     Int_t nGenJets = 0;\r
1401     \r
1402     for(Int_t ig=0; ig<aodGenJets->GetEntries(); ++ig){\r
1403           \r
1404       AliAODJet *tmp = dynamic_cast<AliAODJet*>(aodGenJets->At(ig));\r
1405       if(!tmp) continue;\r
1406           \r
1407       if( tmp->Pt() < fJetPtCut ) continue;\r
1408       if( type == kJetsGenAcceptance &&\r
1409           (    tmp->Eta() < fJetEtaMin\r
1410             || tmp->Eta() > fJetEtaMax\r
1411             || tmp->Phi() < fJetPhiMin\r
1412             || tmp->Phi() > fJetPhiMax )) continue;\r
1413       \r
1414       list->Add(tmp);\r
1415       \r
1416       nGenJets++;\r
1417     }\r
1418     list->Sort();\r
1419     return nGenJets;\r
1420   } \r
1421   else{\r
1422     if(fDebug>0)Printf("%s:%d no such type %d",(char*)__FILE__,__LINE__,type);\r
1423     return 0;\r
1424   }\r
1425 }\r
1426 \r
1427 \r
1428 // __________________________________________________________________________________________\r
1429 void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, const char* y)\r
1430 {\r
1431   //Set properties of histos (x and y title)\r
1432 \r
1433   h->SetXTitle(x);\r
1434   h->SetYTitle(y);\r
1435   h->GetXaxis()->SetTitleColor(1);\r
1436   h->GetYaxis()->SetTitleColor(1);\r
1437 }\r
1438 \r
1439 // _________________________________________________________________________________________________________\r
1440 void AliAnalysisTaskFragmentationFunction::SetProperties(TH2* h,const char* x, const char* y, const char* z)\r
1441 {\r
1442   //Set properties of histos (x,y and z title)\r
1443 \r
1444   h->SetXTitle(x);\r
1445   h->SetYTitle(y);\r
1446   h->SetZTitle(z);\r
1447   h->GetXaxis()->SetTitleColor(1);\r
1448   h->GetYaxis()->SetTitleColor(1);\r
1449   h->GetZaxis()->SetTitleColor(1);\r
1450 }\r
1451 \r
1452 // ________________________________________________________________________________________________________________________________________________________\r
1453 void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist, TList* outputlist, AliAODJet* jet, const Double_t radius,Double_t& sumPt)\r
1454 {\r
1455   // fill list of tracks in cone around jet axis  \r
1456 \r
1457   sumPt = 0;\r
1458 \r
1459   Double_t jetMom[3];\r
1460   jet->PxPyPz(jetMom);\r
1461   TVector3 jet3mom(jetMom);\r
1462 \r
1463   for (Int_t itrack=0; itrack<inputlist->GetSize(); itrack++){\r
1464 \r
1465     AliVParticle* track = dynamic_cast<AliVParticle*>(inputlist->At(itrack));\r
1466 \r
1467     Double_t trackMom[3];\r
1468     track->PxPyPz(trackMom);\r
1469     TVector3 track3mom(trackMom);\r
1470 \r
1471     Double_t dR = jet3mom.DeltaR(track3mom);\r
1472 \r
1473     if(dR<radius){\r
1474 \r
1475       outputlist->Add(track);\r
1476       \r
1477       sumPt += track->Pt();\r
1478     }\r
1479   }\r
1480   \r
1481   outputlist->Sort();\r
1482 }\r
1483 \r
1484 // ___________________________________________________________________________________________\r
1485 void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, AliAODJet* jet)\r
1486 {\r
1487   // list of jet tracks from trackrefs\r
1488   \r
1489   Int_t nTracks = jet->GetRefTracks()->GetEntriesFast();\r
1490 \r
1491   for (Int_t itrack=0; itrack<nTracks; itrack++) {\r
1492     \r
1493     AliVParticle* track = dynamic_cast<AliVParticle*>(jet->GetRefTracks()->At(itrack));\r
1494     if(!track){\r
1495       AliError("expected ref track not found ");\r
1496       continue;\r
1497     }\r
1498         \r
1499     list->Add(track);\r
1500   }\r
1501   \r
1502   list->Sort();\r
1503 }\r