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