minor fixes
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskFragmentationFunction.cxx
1 // *************************************************************************
2 // *                                                                       *
3 // * Task for Fragmentation Function Analysis in PWG4 Jet Task Force Train *
4 // *                                                                       *
5 // *************************************************************************
6
7
8 /**************************************************************************
9  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
10  *                                                                        *
11  * Author: The ALICE Off-line Project.                                    *
12  * Contributors are mentioned in the code where appropriate.              *
13  *                                                                        *
14  * Permission to use, copy, modify and distribute this software and its   *
15  * documentation strictly for non-commercial purposes is hereby granted   *
16  * without fee, provided that the above copyright notice appears in all   *
17  * copies and that both the copyright notice and this permission notice   *
18  * appear in the supporting documentation. The authors make no claims     *
19  * about the suitability of this software for any purpose. It is          *
20  * provided "as is" without express or implied warranty.                  *
21  **************************************************************************/
22
23 /* $Id: */
24
25 #include "TList.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TH3F.h"
29 #include "TString.h"
30 #include "THnSparse.h"
31 #include "TProfile.h"
32 #include "TFile.h"
33 #include "TKey.h"
34 #include "TRandom3.h"
35
36 #include "AliAODInputHandler.h" 
37 #include "AliAODHandler.h" 
38 #include "AliESDEvent.h"
39 #include "AliAODMCParticle.h"
40 #include "AliAODJet.h"
41 #include "AliAODJetEventBackground.h"
42 #include "AliGenPythiaEventHeader.h"
43 #include "AliGenHijingEventHeader.h"
44 #include "AliInputEventHandler.h"
45
46 #include "AliAnalysisHelperJetTasks.h"
47 #include "AliAnalysisManager.h"
48 #include "AliAnalysisTaskSE.h"
49 #include "AliVParticle.h"
50 #include "AliVEvent.h"
51
52 #include "AliAnalysisTaskFragmentationFunction.h"
53
54 ClassImp(AliAnalysisTaskFragmentationFunction)
55
56 //____________________________________________________________________________
57 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()
58    : AliAnalysisTaskSE()
59    ,fESD(0)
60    ,fAOD(0)
61    ,fAODJets(0)  
62    ,fAODExtension(0)
63    ,fNonStdFile("")
64    ,fBranchRecJets("jets")
65    ,fBranchRecBackJets("")
66    ,fBranchRecBckgClusters("")
67    ,fBranchGenJets("")
68    ,fBranchEmbeddedJets("")
69    ,fTrackTypeGen(0)
70    ,fJetTypeGen(0)
71    ,fJetTypeRecEff(0)
72    ,fUseAODInputJets(kTRUE)
73    ,fFilterMask(0)
74    ,fUsePhysicsSelection(kTRUE)
75    ,fEventClass(0)
76    ,fMaxVertexZ(10)
77    ,fTrackPtCut(0)
78    ,fTrackEtaMin(0)
79    ,fTrackEtaMax(0)
80    ,fTrackPhiMin(0)
81    ,fTrackPhiMax(0)
82    ,fUseExtraTracks(0)
83    ,fUseExtraTracksBgr(0)
84    ,fCutFractionPtEmbedded(0)
85    ,fUseEmbeddedJetAxis(0)
86    ,fUseEmbeddedJetPt(0)
87    ,fJetPtCut(0)
88    ,fJetEtaMin(0)
89    ,fJetEtaMax(0)
90    ,fJetPhiMin(0)
91    ,fJetPhiMax(0)
92    ,fDiJetCut(0)
93    ,fDiJetDeltaPhiCut(0)
94    ,fDiJetPtFractionCut(0)
95    ,fDiJetCDFCut(0)
96    ,fDiJetKindBins(0)
97    ,fFFRadius(0)
98    ,fFFBckgRadius(0)
99    ,fBckgMode(0)
100    ,fIJMode(0)
101    ,fQAMode(0)
102    ,fFFMode(0)
103    ,fDJMode(0)
104    ,fEffMode(0)
105    ,fPhiCorrMode(0)
106    ,fUseRecEffRecJetPtBins(0)
107    ,fUseResponseRecJetPtBins(1)
108    ,fAvgTrials(0)
109    ,fTracksRec(0)
110    ,fTracksRecCuts(0)
111    ,fTracksGen(0)
112    ,fTracksAODMCCharged(0)
113    ,fTracksAODMCChargedSec(0)
114    ,fTracksRecQualityCuts(0)
115    ,fJetsRec(0)
116    ,fJetsRecCuts(0)
117    ,fJetsGen(0)
118    ,fJetsRecEff(0)
119    ,fJetsEmbedded(0)
120    ,fBckgJetsRec(0)
121    ,fBckgJetsRecCuts(0)
122    ,fBckgJetsGen(0)
123    ,fQATrackHistosRec(0)
124    ,fQATrackHistosRecCuts(0)
125    ,fQATrackHistosGen(0)
126    ,fQAJetHistosRec(0)
127    ,fQAJetHistosRecCuts(0)
128    ,fQAJetHistosRecCutsLeading(0)
129    ,fQAJetHistosGen(0)
130    ,fQAJetHistosGenLeading(0)
131    ,fQAJetHistosRecEffLeading(0)
132    ,fFFHistosRecCuts(0)
133    ,fFFHistosRecLeading(0)
134    ,fFFHistosRecLeadingTrack(0)
135    ,fFFHistosGen(0)
136    ,fFFHistosGenLeading(0)
137    ,fFFHistosGenLeadingTrack(0)
138    ,fIJHistosRecCuts(0)
139    ,fIJHistosRecLeading(0)
140    ,fIJHistosRecLeadingTrack(0)
141    ,fIJHistosGen(0)
142    ,fIJHistosGenLeading(0)
143    ,fIJHistosGenLeadingTrack(0)
144    ,fFFDiJetHistosRecCuts(0)
145    ,fFFDiJetHistosRecLeading(0)
146    ,fFFDiJetHistosRecLeadingTrack(0)
147    ,fFFDiJetHistosGen(0)
148    ,fFFDiJetHistosGenLeading(0)
149    ,fFFDiJetHistosGenLeadingTrack(0)
150    ,fQADiJetHistosRecCuts(0)
151    ,fQADiJetHistosGen(0)
152    ,fPhiCorrHistosJetArea(0)
153    ,fPhiCorrHistosTransverseArea(0)
154    ,fPhiCorrHistosAwayArea(0)
155    ,fQATrackHighPtThreshold(0)
156    ,fFFNBinsJetPt(0)    
157    ,fFFJetPtMin(0) 
158    ,fFFJetPtMax(0)
159    ,fFFNBinsPt(0)      
160    ,fFFPtMin(0)        
161    ,fFFPtMax(0)        
162    ,fFFNBinsXi(0)      
163    ,fFFXiMin(0)        
164    ,fFFXiMax(0)        
165    ,fFFNBinsZ(0)       
166    ,fFFZMin(0)         
167    ,fFFZMax(0)         
168    ,fQAJetNBinsPt(0)   
169    ,fQAJetPtMin(0)     
170    ,fQAJetPtMax(0)     
171    ,fQAJetNBinsEta(0)  
172    ,fQAJetEtaMin(0)    
173    ,fQAJetEtaMax(0)    
174    ,fQAJetNBinsPhi(0)  
175    ,fQAJetPhiMin(0)    
176    ,fQAJetPhiMax(0)    
177    ,fQATrackNBinsPt(0) 
178    ,fQATrackPtMin(0)   
179    ,fQATrackPtMax(0)   
180    ,fQATrackNBinsEta(0)
181    ,fQATrackEtaMin(0)  
182    ,fQATrackEtaMax(0)  
183    ,fQATrackNBinsPhi(0)
184    ,fQATrackPhiMin(0)  
185    ,fQATrackPhiMax(0)
186    ,fIJNBinsJetPt(0)
187    ,fIJJetPtMin(0)
188    ,fIJJetPtMax(0)
189    ,fIJNBinsPt(0)
190    ,fIJPtMin(0)
191    ,fIJPtMax(0)
192    ,fIJNBinsZ(0)
193    ,fIJZMin(0)
194    ,fIJZMax(0)
195    ,fIJNBinsCosTheta(0)
196    ,fIJCosThetaMin(0)
197    ,fIJCosThetaMax(0)
198    ,fIJNBinsTheta(0)
199    ,fIJThetaMin(0)
200    ,fIJThetaMax(0)
201    ,fIJNBinsJt(0)
202    ,fIJJtMin(0)
203    ,fIJJtMax(0)
204    ,fDiJetNBinsJetInvMass(0)
205    ,fDiJetJetInvMassMin(0)
206    ,fDiJetJetInvMassMax(0)
207    ,fDiJetNBinsJetPt(0)
208    ,fDiJetJetPtMin(0)
209    ,fDiJetJetPtMax(0)
210    ,fDiJetNBinsPt(0)
211    ,fDiJetPtMin(0)
212    ,fDiJetPtMax(0)
213    ,fDiJetNBinsXi(0)
214    ,fDiJetXiMin(0)
215    ,fDiJetXiMax(0)
216    ,fDiJetNBinsZ(0)
217    ,fDiJetZMin(0)
218    ,fDiJetZMax(0)
219    ,fQADiJetNBinsInvMass(0)
220    ,fQADiJetInvMassMin(0)
221    ,fQADiJetInvMassMax(0)
222    ,fQADiJetNBinsJetPt(0)
223    ,fQADiJetJetPtMin(0)
224    ,fQADiJetJetPtMax(0)
225    ,fQADiJetNBinsDeltaPhi(0)
226    ,fQADiJetDeltaPhiMin(0)
227    ,fQADiJetDeltaPhiMax(0)
228    ,fQADiJetNBinsDeltaEta(0)
229    ,fQADiJetDeltaEtaMin(0)
230    ,fQADiJetDeltaEtaMax(0)
231    ,fQADiJetNBinsDeltaPt(0)
232    ,fQADiJetDeltaPtMin(0)
233    ,fQADiJetDeltaPtMax(0)
234    ,fQADiJetNBinsInBal(0)  
235    ,fQADiJetInBalMin(0)    
236    ,fQADiJetInBalMax(0)    
237    ,fPhiCorrNBinsPt(0)
238    ,fPhiCorrPtMin(0)
239    ,fPhiCorrPtMax(0)
240    ,fPhiCorrNBinsEta(0)
241    ,fPhiCorrEtaMin(0)
242    ,fPhiCorrEtaMax(0)
243    ,fPhiCorrNBinsPhi(0)
244    ,fPhiCorrPhiMin(0)
245    ,fPhiCorrPhiMax(0)
246    ,fCommonHistList(0)
247    ,fh1EvtSelection(0)
248    ,fh1VertexNContributors(0)
249    ,fh1VertexZ(0)
250    ,fh1EvtMult(0)
251    ,fh1EvtCent(0)
252    ,fh2TrackPtVsDCAXY(0)
253    ,fh2TrackPtVsDCAZ(0)
254    ,fh1Xsec(0)
255    ,fh1Trials(0)
256    ,fh1PtHard(0)
257    ,fh1PtHardTrials(0)
258    ,fh1nRecJetsCuts(0)
259    ,fh1nGenJets(0)
260    ,fh1nRecEffJets(0)
261    ,fh1nEmbeddedJets(0)
262    ,fh1nRecBckgJetsCuts(0)
263    ,fh1nGenBckgJets(0)
264    ,fh2PtRecVsGenPrim(0)
265    ,fh2PtRecVsGenSec(0)
266    ,fQATrackHistosRecEffGen(0)  
267    ,fQATrackHistosRecEffRec(0)
268    ,fQATrackHistosSecRec(0)   
269    ,fFFHistosRecEffGen(0)    
270    ,fFFHistosRecEffRec(0)
271    ,fFFHistosSecRec(0)
272    ,fhnResponseSinglePt(0)
273    ,fh2SingleInvPtRecMnGenVsPtGen(0)   
274    ,fhnResponseJetTrackPt(0)  
275    ,fhnResponseJetZ(0)        
276    ,fhnResponseJetXi(0)       
277    // Background
278    ,fh1OutLeadingMult(0)
279    ,fh1OutLeadingStatMult(0)
280    ,fh1PerpMult(0)
281    ,fh1ASideMult(0)
282    ,fh1ASideWindowMult(0)
283    ,fh1PerpWindowMult(0)
284    ,fh1Out2JetsMult(0)
285    ,fh1Out3JetsMult(0)
286    ,fh1MedianClustersMult(0)
287    ,fh1OutClustersMult(0)
288    ,fh1FractionPtEmbedded(0)
289    ,fh1IndexEmbedded(0)
290    ,fh2DeltaPtVsJetPtEmbedded(0)
291    ,fh2DeltaPtVsRecJetPtEmbedded(0)
292    ,fh1DeltaREmbedded(0)
293    ,fh2ptVsDistNN_pt50_rec(0) 
294    ,fh2ptVsDistNN_pt50_nonRec(0) 
295    ,fh2ptVsDistNN_pt10_rec(0) 
296    ,fh2ptVsDistNN_pt10_nonRec(0) 
297    ,fQABckgHisto0RecCuts(0)  
298    ,fQABckgHisto0Gen(0)      
299    ,fQABckgHisto1RecCuts(0)  
300    ,fQABckgHisto1Gen(0)      
301    ,fQABckgHisto2RecCuts(0)  
302    ,fQABckgHisto2Gen(0)
303    ,fQABckgHisto3RecCuts(0)
304    ,fQABckgHisto3Gen(0)
305    ,fQABckgHisto4RecCuts(0)
306    ,fQABckgHisto4Gen(0)
307    ,fFFBckgHisto0RecCuts(0)
308    ,fFFBckgHisto0RecLeading(0)
309    ,fFFBckgHisto0Gen(0)       
310    ,fFFBckgHisto0GenLeading(0)
311    ,fFFBckgHisto1RecCuts(0)
312    ,fFFBckgHisto1RecLeading(0)
313    ,fFFBckgHisto1Gen(0)       
314    ,fFFBckgHisto1GenLeading(0)
315    ,fFFBckgHisto2RecCuts(0)
316    ,fFFBckgHisto2RecLeading(0)
317    ,fFFBckgHisto2Gen(0)       
318    ,fFFBckgHisto2GenLeading(0)
319    ,fFFBckgHisto3RecCuts(0)
320    ,fFFBckgHisto3RecLeading(0)
321    ,fFFBckgHisto3Gen(0)       
322    ,fFFBckgHisto3GenLeading(0)
323    ,fFFBckgHisto4RecCuts(0)
324    ,fFFBckgHisto4RecLeading(0)
325    ,fFFBckgHisto4Gen(0)       
326    ,fFFBckgHisto4GenLeading(0)
327    ,fIJBckgHisto0RecCuts(0)   
328    ,fIJBckgHisto0RecLeading(0)
329    ,fIJBckgHisto0Gen(0)       
330    ,fIJBckgHisto0GenLeading(0)
331    ,fIJBckgHisto1RecCuts(0)   
332    ,fIJBckgHisto1RecLeading(0)
333    ,fIJBckgHisto1Gen(0)       
334    ,fIJBckgHisto1GenLeading(0)
335    ,fIJBckgHisto2RecCuts(0)   
336    ,fIJBckgHisto2RecLeading(0)
337    ,fIJBckgHisto2Gen(0)       
338    ,fIJBckgHisto2GenLeading(0)
339    ,fIJBckgHisto3RecCuts(0)   
340    ,fIJBckgHisto3RecLeading(0)
341    ,fIJBckgHisto3Gen(0)       
342    ,fIJBckgHisto3GenLeading(0)
343    ,fIJBckgHisto4RecCuts(0)   
344    ,fIJBckgHisto4RecLeading(0)
345    ,fIJBckgHisto4Gen(0)       
346    ,fIJBckgHisto4GenLeading(0)
347    ,fRandom(0)
348    ,fBckgSubMethod(0)
349 {
350    // default constructor
351   fBckgType[0] = 0;
352   fBckgType[1] = 0;
353   fBckgType[2] = 0;
354   fBckgType[3] = 0;
355   fBckgType[4] = 0;
356 }
357
358 //__________________________________________________________________________________________
359 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const char *name) 
360   : AliAnalysisTaskSE(name)
361   ,fESD(0)
362   ,fAOD(0)
363   ,fAODJets(0)  
364   ,fAODExtension(0)
365   ,fNonStdFile("")
366   ,fBranchRecJets("jets")
367   ,fBranchRecBackJets("")
368   ,fBranchRecBckgClusters("")
369   ,fBranchGenJets("")
370   ,fBranchEmbeddedJets("")
371   ,fTrackTypeGen(0)
372   ,fJetTypeGen(0)
373   ,fJetTypeRecEff(0)
374   ,fUseAODInputJets(kTRUE)
375   ,fFilterMask(0)
376   ,fUsePhysicsSelection(kTRUE)
377   ,fEventClass(0)
378   ,fMaxVertexZ(10)
379   ,fTrackPtCut(0)
380   ,fTrackEtaMin(0)
381   ,fTrackEtaMax(0)
382   ,fTrackPhiMin(0)
383   ,fTrackPhiMax(0)
384   ,fUseExtraTracks(0)
385   ,fUseExtraTracksBgr(0)
386   ,fCutFractionPtEmbedded(0)
387   ,fUseEmbeddedJetAxis(0)
388   ,fUseEmbeddedJetPt(0)  
389   ,fJetPtCut(0)
390   ,fJetEtaMin(0)
391   ,fJetEtaMax(0)
392   ,fJetPhiMin(0)
393   ,fJetPhiMax(0)
394   ,fDiJetCut(0)
395   ,fDiJetDeltaPhiCut(0)
396   ,fDiJetPtFractionCut(0)
397   ,fDiJetCDFCut(0)
398   ,fDiJetKindBins(0)
399   ,fFFRadius(0)
400   ,fFFBckgRadius(0)
401   ,fBckgMode(0)
402   ,fIJMode(0)
403   ,fQAMode(0)
404   ,fFFMode(0)
405   ,fDJMode(0)
406   ,fEffMode(0)
407   ,fPhiCorrMode(0)
408   ,fUseRecEffRecJetPtBins(0)
409   ,fUseResponseRecJetPtBins(1)
410   ,fAvgTrials(0)
411   ,fTracksRec(0)
412   ,fTracksRecCuts(0)
413   ,fTracksGen(0)
414   ,fTracksAODMCCharged(0)
415   ,fTracksAODMCChargedSec(0)
416   ,fTracksRecQualityCuts(0)
417   ,fJetsRec(0)
418   ,fJetsRecCuts(0)
419   ,fJetsGen(0)
420   ,fJetsRecEff(0)
421   ,fJetsEmbedded(0)
422   ,fBckgJetsRec(0)
423   ,fBckgJetsRecCuts(0)
424   ,fBckgJetsGen(0)
425   ,fQATrackHistosRec(0)
426   ,fQATrackHistosRecCuts(0)
427   ,fQATrackHistosGen(0)
428   ,fQAJetHistosRec(0)
429   ,fQAJetHistosRecCuts(0)
430   ,fQAJetHistosRecCutsLeading(0)
431   ,fQAJetHistosGen(0)
432   ,fQAJetHistosGenLeading(0)
433   ,fQAJetHistosRecEffLeading(0)
434   ,fFFHistosRecCuts(0)
435   ,fFFHistosRecLeading(0)
436   ,fFFHistosRecLeadingTrack(0)
437   ,fFFHistosGen(0)
438   ,fFFHistosGenLeading(0)
439   ,fFFHistosGenLeadingTrack(0)
440   ,fIJHistosRecCuts(0)
441   ,fIJHistosRecLeading(0)
442   ,fIJHistosRecLeadingTrack(0)
443   ,fIJHistosGen(0)
444   ,fIJHistosGenLeading(0)
445   ,fIJHistosGenLeadingTrack(0)
446   ,fFFDiJetHistosRecCuts(0)
447   ,fFFDiJetHistosRecLeading(0)
448   ,fFFDiJetHistosRecLeadingTrack(0)
449   ,fFFDiJetHistosGen(0)
450   ,fFFDiJetHistosGenLeading(0)
451   ,fFFDiJetHistosGenLeadingTrack(0)
452   ,fQADiJetHistosRecCuts(0)
453   ,fQADiJetHistosGen(0)
454   ,fPhiCorrHistosJetArea(0)
455   ,fPhiCorrHistosTransverseArea(0)
456   ,fPhiCorrHistosAwayArea(0)
457   ,fQATrackHighPtThreshold(0) 
458   ,fFFNBinsJetPt(0)    
459   ,fFFJetPtMin(0) 
460   ,fFFJetPtMax(0)
461   ,fFFNBinsPt(0)      
462   ,fFFPtMin(0)        
463   ,fFFPtMax(0)        
464   ,fFFNBinsXi(0)      
465   ,fFFXiMin(0)        
466   ,fFFXiMax(0)        
467   ,fFFNBinsZ(0)       
468   ,fFFZMin(0)         
469   ,fFFZMax(0)         
470   ,fQAJetNBinsPt(0)   
471   ,fQAJetPtMin(0)     
472   ,fQAJetPtMax(0)     
473   ,fQAJetNBinsEta(0)  
474   ,fQAJetEtaMin(0)    
475   ,fQAJetEtaMax(0)    
476   ,fQAJetNBinsPhi(0)  
477   ,fQAJetPhiMin(0)    
478   ,fQAJetPhiMax(0)    
479   ,fQATrackNBinsPt(0) 
480   ,fQATrackPtMin(0)   
481   ,fQATrackPtMax(0)   
482   ,fQATrackNBinsEta(0)
483   ,fQATrackEtaMin(0)  
484   ,fQATrackEtaMax(0)  
485   ,fQATrackNBinsPhi(0)
486   ,fQATrackPhiMin(0)  
487   ,fQATrackPhiMax(0)  
488   ,fIJNBinsJetPt(0)
489   ,fIJJetPtMin(0)
490   ,fIJJetPtMax(0)
491   ,fIJNBinsPt(0)
492   ,fIJPtMin(0)
493   ,fIJPtMax(0)
494   ,fIJNBinsZ(0)
495   ,fIJZMin(0)
496   ,fIJZMax(0)
497   ,fIJNBinsCosTheta(0)
498   ,fIJCosThetaMin(0)
499   ,fIJCosThetaMax(0)
500   ,fIJNBinsTheta(0)
501   ,fIJThetaMin(0)
502   ,fIJThetaMax(0)
503   ,fIJNBinsJt(0)
504   ,fIJJtMin(0)
505   ,fIJJtMax(0)
506   ,fDiJetNBinsJetInvMass(0)
507   ,fDiJetJetInvMassMin(0)
508   ,fDiJetJetInvMassMax(0)
509   ,fDiJetNBinsJetPt(0)
510   ,fDiJetJetPtMin(0)
511   ,fDiJetJetPtMax(0)
512   ,fDiJetNBinsPt(0)
513   ,fDiJetPtMin(0)
514   ,fDiJetPtMax(0)
515   ,fDiJetNBinsXi(0)
516   ,fDiJetXiMin(0)
517   ,fDiJetXiMax(0)
518   ,fDiJetNBinsZ(0)
519   ,fDiJetZMin(0)
520   ,fDiJetZMax(0)
521   ,fQADiJetNBinsInvMass(0)
522   ,fQADiJetInvMassMin(0)
523   ,fQADiJetInvMassMax(0)
524   ,fQADiJetNBinsJetPt(0)
525   ,fQADiJetJetPtMin(0)
526   ,fQADiJetJetPtMax(0)
527   ,fQADiJetNBinsDeltaPhi(0)
528   ,fQADiJetDeltaPhiMin(0)
529   ,fQADiJetDeltaPhiMax(0)
530   ,fQADiJetNBinsDeltaEta(0)
531   ,fQADiJetDeltaEtaMin(0)
532   ,fQADiJetDeltaEtaMax(0)
533   ,fQADiJetNBinsDeltaPt(0)
534   ,fQADiJetDeltaPtMin(0)
535   ,fQADiJetDeltaPtMax(0)
536   ,fQADiJetNBinsInBal(0)  
537   ,fQADiJetInBalMin(0)    
538   ,fQADiJetInBalMax(0)    
539   ,fPhiCorrNBinsPt(0)
540   ,fPhiCorrPtMin(0)
541   ,fPhiCorrPtMax(0)
542   ,fPhiCorrNBinsEta(0)
543   ,fPhiCorrEtaMin(0)
544   ,fPhiCorrEtaMax(0)
545   ,fPhiCorrNBinsPhi(0)
546   ,fPhiCorrPhiMin(0)
547   ,fPhiCorrPhiMax(0)
548   ,fCommonHistList(0)
549   ,fh1EvtSelection(0)
550   ,fh1VertexNContributors(0)
551   ,fh1VertexZ(0)
552   ,fh1EvtMult(0)
553   ,fh1EvtCent(0)
554   ,fh2TrackPtVsDCAXY(0)
555   ,fh2TrackPtVsDCAZ(0)
556   ,fh1Xsec(0)
557   ,fh1Trials(0)
558   ,fh1PtHard(0)
559   ,fh1PtHardTrials(0)
560   ,fh1nRecJetsCuts(0)
561   ,fh1nGenJets(0)
562   ,fh1nRecEffJets(0)
563   ,fh1nEmbeddedJets(0)
564   ,fh1nRecBckgJetsCuts(0)
565   ,fh1nGenBckgJets(0)
566   ,fh2PtRecVsGenPrim(0)
567   ,fh2PtRecVsGenSec(0)
568   ,fQATrackHistosRecEffGen(0)  
569   ,fQATrackHistosRecEffRec(0)
570   ,fQATrackHistosSecRec(0) 
571   ,fFFHistosRecEffGen(0)    
572   ,fFFHistosRecEffRec(0)
573   ,fFFHistosSecRec(0)
574   ,fhnResponseSinglePt(0)  
575   ,fh2SingleInvPtRecMnGenVsPtGen(0) 
576   ,fhnResponseJetTrackPt(0)  
577   ,fhnResponseJetZ(0)        
578   ,fhnResponseJetXi(0)       
579   // Background
580   ,fh1OutLeadingMult(0)
581   ,fh1OutLeadingStatMult(0)
582   ,fh1PerpMult(0)
583   ,fh1ASideMult(0)
584   ,fh1ASideWindowMult(0)
585   ,fh1PerpWindowMult(0)
586   ,fh1Out2JetsMult(0)
587   ,fh1Out3JetsMult(0)
588   ,fh1MedianClustersMult(0)
589   ,fh1OutClustersMult(0)
590   ,fh1FractionPtEmbedded(0)
591   ,fh1IndexEmbedded(0)
592   ,fh2DeltaPtVsJetPtEmbedded(0)
593   ,fh2DeltaPtVsRecJetPtEmbedded(0)
594   ,fh1DeltaREmbedded(0)
595   ,fh2ptVsDistNN_pt50_rec(0) 
596   ,fh2ptVsDistNN_pt50_nonRec(0) 
597   ,fh2ptVsDistNN_pt10_rec(0) 
598   ,fh2ptVsDistNN_pt10_nonRec(0)
599   ,fQABckgHisto0RecCuts(0)  
600   ,fQABckgHisto0Gen(0)      
601   ,fQABckgHisto1RecCuts(0)  
602   ,fQABckgHisto1Gen(0)      
603   ,fQABckgHisto2RecCuts(0)  
604   ,fQABckgHisto2Gen(0) 
605   ,fQABckgHisto3RecCuts(0)  
606   ,fQABckgHisto3Gen(0)
607   ,fQABckgHisto4RecCuts(0)  
608   ,fQABckgHisto4Gen(0)
609   ,fFFBckgHisto0RecCuts(0)
610   ,fFFBckgHisto0RecLeading(0)
611   ,fFFBckgHisto0Gen(0)       
612   ,fFFBckgHisto0GenLeading(0)
613   ,fFFBckgHisto1RecCuts(0)
614   ,fFFBckgHisto1RecLeading(0)
615   ,fFFBckgHisto1Gen(0)       
616   ,fFFBckgHisto1GenLeading(0)
617   ,fFFBckgHisto2RecCuts(0)
618   ,fFFBckgHisto2RecLeading(0)
619   ,fFFBckgHisto2Gen(0)       
620   ,fFFBckgHisto2GenLeading(0)
621   ,fFFBckgHisto3RecCuts(0)
622   ,fFFBckgHisto3RecLeading(0)
623   ,fFFBckgHisto3Gen(0)       
624   ,fFFBckgHisto3GenLeading(0)
625   ,fFFBckgHisto4RecCuts(0)
626   ,fFFBckgHisto4RecLeading(0)
627   ,fFFBckgHisto4Gen(0)       
628   ,fFFBckgHisto4GenLeading(0)
629   ,fIJBckgHisto0RecCuts(0)   
630   ,fIJBckgHisto0RecLeading(0)
631   ,fIJBckgHisto0Gen(0)       
632   ,fIJBckgHisto0GenLeading(0)
633   ,fIJBckgHisto1RecCuts(0)   
634   ,fIJBckgHisto1RecLeading(0)
635   ,fIJBckgHisto1Gen(0)       
636   ,fIJBckgHisto1GenLeading(0)
637   ,fIJBckgHisto2RecCuts(0)   
638   ,fIJBckgHisto2RecLeading(0)
639   ,fIJBckgHisto2Gen(0)       
640   ,fIJBckgHisto2GenLeading(0)
641   ,fIJBckgHisto3RecCuts(0)   
642   ,fIJBckgHisto3RecLeading(0)
643   ,fIJBckgHisto3Gen(0)       
644   ,fIJBckgHisto3GenLeading(0)
645   ,fIJBckgHisto4RecCuts(0)   
646   ,fIJBckgHisto4RecLeading(0)
647   ,fIJBckgHisto4Gen(0)       
648   ,fIJBckgHisto4GenLeading(0)
649   ,fRandom(0)
650   ,fBckgSubMethod(0)
651 {
652   // constructor
653   fBckgType[0] = 0;
654   fBckgType[1] = 0;
655   fBckgType[2] = 0;
656   fBckgType[3] = 0;
657   fBckgType[4] = 0;
658
659   DefineOutput(1,TList::Class());
660   
661
662 }
663
664 //__________________________________________________________________________________________________________________________
665 AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const  AliAnalysisTaskFragmentationFunction &copy)
666   : AliAnalysisTaskSE()
667   ,fESD(copy.fESD)
668   ,fAOD(copy.fAOD)
669   ,fAODJets(copy.fAODJets)  
670   ,fAODExtension(copy.fAODExtension)
671   ,fNonStdFile(copy.fNonStdFile)
672   ,fBranchRecJets(copy.fBranchRecJets)
673   ,fBranchRecBackJets(copy.fBranchRecBackJets)
674   ,fBranchRecBckgClusters(copy.fBranchRecBckgClusters)
675   ,fBranchGenJets(copy.fBranchGenJets)
676   ,fBranchEmbeddedJets(copy.fBranchEmbeddedJets)
677   ,fTrackTypeGen(copy.fTrackTypeGen)
678   ,fJetTypeGen(copy.fJetTypeGen)
679   ,fJetTypeRecEff(copy.fJetTypeRecEff)
680   ,fUseAODInputJets(copy.fUseAODInputJets)
681   ,fFilterMask(copy.fFilterMask)
682   ,fUsePhysicsSelection(copy.fUsePhysicsSelection)
683   ,fEventClass(copy.fEventClass)
684   ,fMaxVertexZ(copy.fMaxVertexZ)
685   ,fTrackPtCut(copy.fTrackPtCut)
686   ,fTrackEtaMin(copy.fTrackEtaMin)
687   ,fTrackEtaMax(copy.fTrackEtaMax)
688   ,fTrackPhiMin(copy.fTrackPhiMin)
689   ,fTrackPhiMax(copy.fTrackPhiMax)
690   ,fUseExtraTracks(copy.fUseExtraTracks)
691   ,fUseExtraTracksBgr(copy.fUseExtraTracksBgr)
692   ,fCutFractionPtEmbedded(copy.fCutFractionPtEmbedded)
693   ,fUseEmbeddedJetAxis(copy.fUseEmbeddedJetAxis)
694   ,fUseEmbeddedJetPt(copy.fUseEmbeddedJetPt)
695   ,fJetPtCut(copy.fJetPtCut)
696   ,fJetEtaMin(copy.fJetEtaMin)
697   ,fJetEtaMax(copy.fJetEtaMax)
698   ,fJetPhiMin(copy.fJetPhiMin)
699   ,fJetPhiMax(copy.fJetPhiMax)
700   ,fDiJetCut(copy.fDiJetCut)
701   ,fDiJetDeltaPhiCut(copy.fDiJetDeltaPhiCut)
702   ,fDiJetPtFractionCut(copy.fDiJetPtFractionCut)
703   ,fDiJetCDFCut(copy.fDiJetCDFCut)
704   ,fDiJetKindBins(copy.fDiJetKindBins)
705   ,fFFRadius(copy.fFFRadius)
706   ,fFFBckgRadius(copy.fFFBckgRadius)
707   ,fBckgMode(copy.fBckgMode)
708   ,fIJMode(copy.fIJMode)
709   ,fQAMode(copy.fQAMode)
710   ,fFFMode(copy.fFFMode)
711   ,fDJMode(copy.fDJMode)
712   ,fEffMode(copy.fEffMode)
713   ,fPhiCorrMode(copy.fPhiCorrMode)
714   ,fUseRecEffRecJetPtBins(copy.fUseRecEffRecJetPtBins)
715   ,fUseResponseRecJetPtBins(copy.fUseResponseRecJetPtBins)
716   ,fAvgTrials(copy.fAvgTrials)
717   ,fTracksRec(copy.fTracksRec)
718   ,fTracksRecCuts(copy.fTracksRecCuts)
719   ,fTracksGen(copy.fTracksGen)
720   ,fTracksAODMCCharged(copy.fTracksAODMCCharged)
721   ,fTracksAODMCChargedSec(copy.fTracksAODMCChargedSec)
722   ,fTracksRecQualityCuts(copy.fTracksRecQualityCuts)
723   ,fJetsRec(copy.fJetsRec)
724   ,fJetsRecCuts(copy.fJetsRecCuts)
725   ,fJetsGen(copy.fJetsGen)
726   ,fJetsRecEff(copy.fJetsRecEff)
727   ,fJetsEmbedded(copy.fJetsEmbedded)
728   ,fBckgJetsRec(copy.fBckgJetsRec)
729   ,fBckgJetsRecCuts(copy.fBckgJetsRecCuts)
730   ,fBckgJetsGen(copy.fBckgJetsGen)
731   ,fQATrackHistosRec(copy.fQATrackHistosRec)
732   ,fQATrackHistosRecCuts(copy.fQATrackHistosRecCuts)
733   ,fQATrackHistosGen(copy.fQATrackHistosGen)
734   ,fQAJetHistosRec(copy.fQAJetHistosRec)
735   ,fQAJetHistosRecCuts(copy.fQAJetHistosRecCuts)
736   ,fQAJetHistosRecCutsLeading(copy.fQAJetHistosRecCutsLeading)
737   ,fQAJetHistosGen(copy.fQAJetHistosGen)
738   ,fQAJetHistosGenLeading(copy.fQAJetHistosGenLeading)
739   ,fQAJetHistosRecEffLeading(copy.fQAJetHistosRecEffLeading)
740   ,fFFHistosRecCuts(copy.fFFHistosRecCuts)
741   ,fFFHistosRecLeading(copy.fFFHistosRecLeading)
742   ,fFFHistosRecLeadingTrack(copy.fFFHistosRecLeadingTrack)
743   ,fFFHistosGen(copy.fFFHistosGen)
744   ,fFFHistosGenLeading(copy.fFFHistosGenLeading)
745   ,fFFHistosGenLeadingTrack(copy.fFFHistosGenLeadingTrack)
746   ,fIJHistosRecCuts(copy.fIJHistosRecCuts)
747   ,fIJHistosRecLeading(copy.fIJHistosRecLeading)
748   ,fIJHistosRecLeadingTrack(copy.fIJHistosRecLeadingTrack)
749   ,fIJHistosGen(copy.fIJHistosGen)
750   ,fIJHistosGenLeading(copy.fIJHistosGenLeading)
751   ,fIJHistosGenLeadingTrack(copy.fIJHistosGenLeadingTrack)
752   ,fFFDiJetHistosRecCuts(copy.fFFDiJetHistosRecCuts)
753   ,fFFDiJetHistosRecLeading(copy.fFFDiJetHistosRecLeading)
754   ,fFFDiJetHistosRecLeadingTrack(copy.fFFDiJetHistosRecLeadingTrack)
755   ,fFFDiJetHistosGen(copy.fFFDiJetHistosGen)
756   ,fFFDiJetHistosGenLeading(copy.fFFDiJetHistosGenLeading)
757   ,fFFDiJetHistosGenLeadingTrack(copy.fFFDiJetHistosGenLeadingTrack)
758   ,fQADiJetHistosRecCuts(copy.fQADiJetHistosRecCuts)
759   ,fQADiJetHistosGen(copy.fQADiJetHistosGen)
760   ,fPhiCorrHistosJetArea(copy.fPhiCorrHistosJetArea)
761   ,fPhiCorrHistosTransverseArea(copy.fPhiCorrHistosTransverseArea)
762   ,fPhiCorrHistosAwayArea(copy.fPhiCorrHistosAwayArea)
763   ,fQATrackHighPtThreshold(copy.fQATrackHighPtThreshold) 
764   ,fFFNBinsJetPt(copy.fFFNBinsJetPt)    
765   ,fFFJetPtMin(copy.fFFJetPtMin) 
766   ,fFFJetPtMax(copy.fFFJetPtMax)
767   ,fFFNBinsPt(copy.fFFNBinsPt)      
768   ,fFFPtMin(copy.fFFPtMin)        
769   ,fFFPtMax(copy.fFFPtMax)        
770   ,fFFNBinsXi(copy.fFFNBinsXi)      
771   ,fFFXiMin(copy.fFFXiMin)        
772   ,fFFXiMax(copy.fFFXiMax)        
773   ,fFFNBinsZ(copy.fFFNBinsZ)       
774   ,fFFZMin(copy.fFFZMin)         
775   ,fFFZMax(copy.fFFZMax)         
776   ,fQAJetNBinsPt(copy.fQAJetNBinsPt)   
777   ,fQAJetPtMin(copy.fQAJetPtMin)     
778   ,fQAJetPtMax(copy.fQAJetPtMax)     
779   ,fQAJetNBinsEta(copy.fQAJetNBinsEta)  
780   ,fQAJetEtaMin(copy.fQAJetEtaMin)    
781   ,fQAJetEtaMax(copy.fQAJetEtaMax)    
782   ,fQAJetNBinsPhi(copy.fQAJetNBinsPhi)  
783   ,fQAJetPhiMin(copy.fQAJetPhiMin)    
784   ,fQAJetPhiMax(copy.fQAJetPhiMax)    
785   ,fQATrackNBinsPt(copy.fQATrackNBinsPt) 
786   ,fQATrackPtMin(copy.fQATrackPtMin)   
787   ,fQATrackPtMax(copy.fQATrackPtMax)   
788   ,fQATrackNBinsEta(copy.fQATrackNBinsEta)
789   ,fQATrackEtaMin(copy.fQATrackEtaMin)  
790   ,fQATrackEtaMax(copy.fQATrackEtaMax)  
791   ,fQATrackNBinsPhi(copy.fQATrackNBinsPhi)
792   ,fQATrackPhiMin(copy.fQATrackPhiMin)  
793   ,fQATrackPhiMax(copy.fQATrackPhiMax)
794   ,fIJNBinsJetPt(copy.fIJNBinsJetPt)
795   ,fIJJetPtMin(copy.fIJJetPtMin)
796   ,fIJJetPtMax(copy.fIJJetPtMax)
797   ,fIJNBinsPt(copy.fIJNBinsPt)
798   ,fIJPtMin(copy.fIJPtMin)
799   ,fIJPtMax(copy.fIJPtMax)
800   ,fIJNBinsZ(copy.fIJNBinsZ)
801   ,fIJZMin(copy.fIJZMin)
802   ,fIJZMax(copy.fIJZMax)
803   ,fIJNBinsCosTheta(copy.fIJNBinsCosTheta)
804   ,fIJCosThetaMin(copy.fIJCosThetaMin)
805   ,fIJCosThetaMax(copy.fIJCosThetaMax)
806   ,fIJNBinsTheta(copy.fIJNBinsTheta)
807   ,fIJThetaMin(copy.fIJThetaMin)
808   ,fIJThetaMax(copy.fIJThetaMax)
809   ,fIJNBinsJt(copy.fIJNBinsJt)
810   ,fIJJtMin(copy.fIJJtMin)
811   ,fIJJtMax(copy.fIJJtMax)
812   ,fDiJetNBinsJetInvMass(copy.fDiJetNBinsJetInvMass)
813   ,fDiJetJetInvMassMin(copy.fDiJetJetInvMassMin)
814   ,fDiJetJetInvMassMax(copy.fDiJetJetInvMassMax)
815   ,fDiJetNBinsJetPt(copy.fDiJetNBinsJetPt)
816   ,fDiJetJetPtMin(copy.fDiJetJetPtMin)
817   ,fDiJetJetPtMax(copy.fDiJetJetPtMax)
818   ,fDiJetNBinsPt(copy.fDiJetNBinsPt)
819   ,fDiJetPtMin(copy.fDiJetPtMin)
820   ,fDiJetPtMax(copy.fDiJetPtMax)
821   ,fDiJetNBinsXi(copy.fDiJetNBinsXi)
822   ,fDiJetXiMin(copy.fDiJetXiMin)
823   ,fDiJetXiMax(copy.fDiJetXiMax)
824   ,fDiJetNBinsZ(copy.fDiJetNBinsZ)
825   ,fDiJetZMin(copy.fDiJetZMin)
826   ,fDiJetZMax(copy.fDiJetZMax)
827   ,fQADiJetNBinsInvMass(copy.fQADiJetNBinsInvMass)
828   ,fQADiJetInvMassMin(copy.fQADiJetInvMassMin)
829   ,fQADiJetInvMassMax(copy.fQADiJetInvMassMax)
830   ,fQADiJetNBinsJetPt(copy.fQADiJetNBinsJetPt)
831   ,fQADiJetJetPtMin(copy.fQADiJetJetPtMin)
832   ,fQADiJetJetPtMax(copy.fQADiJetJetPtMax)
833   ,fQADiJetNBinsDeltaPhi(copy.fQADiJetNBinsDeltaPhi)
834   ,fQADiJetDeltaPhiMin(copy.fQADiJetDeltaPhiMin)
835   ,fQADiJetDeltaPhiMax(copy.fQADiJetDeltaPhiMax)
836   ,fQADiJetNBinsDeltaEta(copy.fQADiJetNBinsDeltaEta)
837   ,fQADiJetDeltaEtaMin(copy.fQADiJetDeltaEtaMin)
838   ,fQADiJetDeltaEtaMax(copy.fQADiJetDeltaEtaMax)
839   ,fQADiJetNBinsDeltaPt(copy.fQADiJetNBinsDeltaPt)
840   ,fQADiJetDeltaPtMin(copy.fQADiJetDeltaPtMin)
841   ,fQADiJetDeltaPtMax(copy.fQADiJetDeltaPtMax)
842   ,fQADiJetNBinsInBal(copy.fQADiJetNBinsInBal)
843   ,fQADiJetInBalMin(copy.fQADiJetInBalMin)
844   ,fQADiJetInBalMax(copy.fQADiJetInBalMax)
845   ,fPhiCorrNBinsPt(copy.fPhiCorrNBinsPt)
846   ,fPhiCorrPtMin(copy.fPhiCorrPtMin)
847   ,fPhiCorrPtMax(copy.fPhiCorrPtMax)
848   ,fPhiCorrNBinsEta(copy.fPhiCorrNBinsEta)
849   ,fPhiCorrEtaMin(copy.fPhiCorrEtaMin)
850   ,fPhiCorrEtaMax(copy.fPhiCorrEtaMax)
851   ,fPhiCorrNBinsPhi(copy.fPhiCorrNBinsPhi)
852   ,fPhiCorrPhiMin(copy.fPhiCorrPhiMin)
853   ,fPhiCorrPhiMax(copy.fPhiCorrPhiMax)
854   ,fCommonHistList(copy.fCommonHistList)
855   ,fh1EvtSelection(copy.fh1EvtSelection)
856   ,fh1VertexNContributors(copy.fh1VertexNContributors)
857   ,fh1VertexZ(copy.fh1VertexZ)
858   ,fh1EvtMult(copy.fh1EvtMult)
859   ,fh1EvtCent(copy.fh1EvtCent)
860   ,fh2TrackPtVsDCAXY(copy.fh2TrackPtVsDCAXY)
861   ,fh2TrackPtVsDCAZ(copy.fh2TrackPtVsDCAXY)
862   ,fh1Xsec(copy.fh1Xsec)
863   ,fh1Trials(copy.fh1Trials)
864   ,fh1PtHard(copy.fh1PtHard)  
865   ,fh1PtHardTrials(copy.fh1PtHardTrials)  
866   ,fh1nRecJetsCuts(copy.fh1nRecJetsCuts)
867   ,fh1nGenJets(copy.fh1nGenJets)
868   ,fh1nRecEffJets(copy.fh1nRecEffJets)
869   ,fh1nEmbeddedJets(copy.fh1nEmbeddedJets)
870   ,fh1nRecBckgJetsCuts(copy.fh1nRecBckgJetsCuts)
871   ,fh1nGenBckgJets(copy.fh1nGenBckgJets)
872   ,fh2PtRecVsGenPrim(copy.fh2PtRecVsGenPrim)
873   ,fh2PtRecVsGenSec(copy.fh2PtRecVsGenSec)
874   ,fQATrackHistosRecEffGen(copy.fQATrackHistosRecEffGen)  
875   ,fQATrackHistosRecEffRec(copy.fQATrackHistosRecEffRec)  
876   ,fQATrackHistosSecRec(copy.fQATrackHistosSecRec)  
877   ,fFFHistosRecEffGen(copy.fFFHistosRecEffGen)    
878   ,fFFHistosRecEffRec(copy.fFFHistosRecEffRec)  
879   ,fFFHistosSecRec(copy.fFFHistosSecRec)   
880   ,fhnResponseSinglePt(copy.fhnResponseSinglePt)
881   ,fh2SingleInvPtRecMnGenVsPtGen(copy.fh2SingleInvPtRecMnGenVsPtGen) 
882   ,fhnResponseJetTrackPt(copy.fhnResponseJetTrackPt)
883   ,fhnResponseJetZ(copy.fhnResponseJetZ)
884   ,fhnResponseJetXi(copy.fhnResponseJetXi)
885   // Background
886   ,fh1OutLeadingMult(copy.fh1OutLeadingMult)
887   ,fh1OutLeadingStatMult(copy.fh1OutLeadingStatMult)
888   ,fh1PerpMult(copy.fh1PerpMult)
889   ,fh1ASideMult(copy.fh1ASideMult)
890   ,fh1ASideWindowMult(copy.fh1ASideWindowMult)
891   ,fh1PerpWindowMult(copy.fh1PerpWindowMult)
892   ,fh1Out2JetsMult(copy.fh1Out2JetsMult)
893   ,fh1Out3JetsMult(copy.fh1Out3JetsMult)
894   ,fh1MedianClustersMult(copy.fh1MedianClustersMult)
895   ,fh1OutClustersMult(copy.fh1OutClustersMult)
896   ,fh1FractionPtEmbedded(copy.fh1FractionPtEmbedded)
897   ,fh1IndexEmbedded(copy.fh1IndexEmbedded)
898   ,fh2DeltaPtVsJetPtEmbedded(copy.fh2DeltaPtVsJetPtEmbedded)
899   ,fh2DeltaPtVsRecJetPtEmbedded(copy.fh2DeltaPtVsRecJetPtEmbedded)
900   ,fh1DeltaREmbedded(copy.fh1DeltaREmbedded)
901   ,fh2ptVsDistNN_pt50_rec(copy.fh2ptVsDistNN_pt50_rec)    
902   ,fh2ptVsDistNN_pt50_nonRec(copy.fh2ptVsDistNN_pt50_nonRec) 
903   ,fh2ptVsDistNN_pt10_rec(copy.fh2ptVsDistNN_pt10_rec)    
904   ,fh2ptVsDistNN_pt10_nonRec(copy.fh2ptVsDistNN_pt10_nonRec) 
905   ,fQABckgHisto0RecCuts(copy.fQABckgHisto0RecCuts)  
906   ,fQABckgHisto0Gen(copy.fQABckgHisto0Gen)      
907   ,fQABckgHisto1RecCuts(copy.fQABckgHisto1RecCuts)  
908   ,fQABckgHisto1Gen(copy.fQABckgHisto1Gen)      
909   ,fQABckgHisto2RecCuts(copy.fQABckgHisto2RecCuts)  
910   ,fQABckgHisto2Gen(copy.fQABckgHisto2Gen)
911   ,fQABckgHisto3RecCuts(copy.fQABckgHisto3RecCuts)  
912   ,fQABckgHisto3Gen(copy.fQABckgHisto3Gen)     
913   ,fQABckgHisto4RecCuts(copy.fQABckgHisto4RecCuts)  
914   ,fQABckgHisto4Gen(copy.fQABckgHisto4Gen)     
915   ,fFFBckgHisto0RecCuts(copy.fFFBckgHisto0RecCuts)
916   ,fFFBckgHisto0RecLeading(copy.fFFBckgHisto0RecLeading)
917   ,fFFBckgHisto0Gen(copy.fFFBckgHisto0Gen)       
918   ,fFFBckgHisto0GenLeading(copy.fFFBckgHisto0GenLeading)
919   ,fFFBckgHisto1RecCuts(copy.fFFBckgHisto1RecCuts)
920   ,fFFBckgHisto1RecLeading(copy.fFFBckgHisto1RecLeading)
921   ,fFFBckgHisto1Gen(copy.fFFBckgHisto1Gen)       
922   ,fFFBckgHisto1GenLeading(copy.fFFBckgHisto1GenLeading)
923   ,fFFBckgHisto2RecCuts(copy.fFFBckgHisto2RecCuts)
924   ,fFFBckgHisto2RecLeading(copy.fFFBckgHisto2RecLeading)
925   ,fFFBckgHisto2Gen(copy.fFFBckgHisto2Gen)       
926   ,fFFBckgHisto2GenLeading(copy.fFFBckgHisto2GenLeading)
927   ,fFFBckgHisto3RecCuts(copy.fFFBckgHisto3RecCuts)
928   ,fFFBckgHisto3RecLeading(copy.fFFBckgHisto3RecLeading)
929   ,fFFBckgHisto3Gen(copy.fFFBckgHisto3Gen)       
930   ,fFFBckgHisto3GenLeading(copy.fFFBckgHisto3GenLeading)
931   ,fFFBckgHisto4RecCuts(copy.fFFBckgHisto4RecCuts)
932   ,fFFBckgHisto4RecLeading(copy.fFFBckgHisto4RecLeading)
933   ,fFFBckgHisto4Gen(copy.fFFBckgHisto4Gen)       
934   ,fFFBckgHisto4GenLeading(copy.fFFBckgHisto4GenLeading)
935   ,fIJBckgHisto0RecCuts(copy.fIJBckgHisto0RecCuts)   
936   ,fIJBckgHisto0RecLeading(copy.fIJBckgHisto0RecLeading)
937   ,fIJBckgHisto0Gen(copy.fIJBckgHisto0Gen)       
938   ,fIJBckgHisto0GenLeading(copy.fIJBckgHisto0GenLeading)
939   ,fIJBckgHisto1RecCuts(copy.fIJBckgHisto1RecCuts)   
940   ,fIJBckgHisto1RecLeading(copy.fIJBckgHisto1RecLeading)
941   ,fIJBckgHisto1Gen(copy.fIJBckgHisto1Gen)       
942   ,fIJBckgHisto1GenLeading(copy.fIJBckgHisto1GenLeading)
943   ,fIJBckgHisto2RecCuts(copy.fIJBckgHisto2RecCuts)   
944   ,fIJBckgHisto2RecLeading(copy.fIJBckgHisto2RecLeading)
945   ,fIJBckgHisto2Gen(copy.fIJBckgHisto2Gen)       
946   ,fIJBckgHisto2GenLeading(copy.fIJBckgHisto2GenLeading)
947   ,fIJBckgHisto3RecCuts(copy.fIJBckgHisto3RecCuts)   
948   ,fIJBckgHisto3RecLeading(copy.fIJBckgHisto3RecLeading)
949   ,fIJBckgHisto3Gen(copy.fIJBckgHisto3Gen)       
950   ,fIJBckgHisto3GenLeading(copy.fIJBckgHisto3GenLeading)
951   ,fIJBckgHisto4RecCuts(copy.fIJBckgHisto4RecCuts)   
952   ,fIJBckgHisto4RecLeading(copy.fIJBckgHisto4RecLeading)
953   ,fIJBckgHisto4Gen(copy.fIJBckgHisto4Gen)       
954   ,fIJBckgHisto4GenLeading(copy.fIJBckgHisto4GenLeading)
955   ,fRandom(copy.fRandom)
956   ,fBckgSubMethod(copy.fBckgSubMethod)
957 {
958   // copy constructor
959   fBckgType[0] = copy.fBckgType[0];
960   fBckgType[1] = copy.fBckgType[1];
961   fBckgType[2] = copy.fBckgType[2];
962   fBckgType[3] = copy.fBckgType[3];
963   fBckgType[4] = copy.fBckgType[4];
964 }
965
966 // _________________________________________________________________________________________________________________________________
967 AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::operator=(const AliAnalysisTaskFragmentationFunction& o)
968 {
969   // assignment
970   
971   if(this!=&o){
972
973     AliAnalysisTaskSE::operator=(o);
974     fESD                          = o.fESD;
975     fAOD                          = o.fAOD;
976     fAODJets                      = o.fAODJets;  
977     fAODExtension                 = o.fAODExtension;
978     fNonStdFile                   = o.fNonStdFile;
979     fBranchRecJets                = o.fBranchRecJets;
980     fBranchRecBackJets            = o.fBranchRecBackJets;
981     fBranchRecBckgClusters        = o.fBranchRecBckgClusters;
982     fBranchGenJets                = o.fBranchGenJets;
983     fBranchEmbeddedJets           = o.fBranchEmbeddedJets;
984     fTrackTypeGen                 = o.fTrackTypeGen;
985     fJetTypeGen                   = o.fJetTypeGen;
986     fJetTypeRecEff                = o.fJetTypeRecEff;
987     fUseAODInputJets              = o.fUseAODInputJets;
988     fFilterMask                   = o.fFilterMask;
989     fUsePhysicsSelection          = o.fUsePhysicsSelection;
990     fEventClass                   = o.fEventClass;
991     fMaxVertexZ                   = o.fMaxVertexZ;
992     fTrackPtCut                   = o.fTrackPtCut;
993     fTrackEtaMin                  = o.fTrackEtaMin;
994     fTrackEtaMax                  = o.fTrackEtaMax;
995     fTrackPhiMin                  = o.fTrackPhiMin;
996     fTrackPhiMax                  = o.fTrackPhiMax;
997     fUseExtraTracks               = o.fUseExtraTracks;
998     fUseExtraTracksBgr            = o.fUseExtraTracksBgr;
999     fCutFractionPtEmbedded        = o.fCutFractionPtEmbedded;
1000     fUseEmbeddedJetAxis           = o.fUseEmbeddedJetAxis;
1001     fUseEmbeddedJetPt             = o.fUseEmbeddedJetPt;
1002     fJetPtCut                     = o.fJetPtCut;
1003     fJetEtaMin                    = o.fJetEtaMin;
1004     fJetEtaMax                    = o.fJetEtaMax;
1005     fJetPhiMin                    = o.fJetPhiMin;
1006     fJetPhiMax                    = o.fJetPhiMin;
1007     fDiJetCut                     = o.fDiJetCut;
1008     fDiJetDeltaPhiCut             = o.fDiJetDeltaPhiCut;
1009     fDiJetPtFractionCut           = o.fDiJetPtFractionCut;
1010     fDiJetCDFCut                  = o.fDiJetCDFCut;
1011     fDiJetKindBins                = o.fDiJetKindBins;
1012     fFFRadius                     = o.fFFRadius;
1013     fFFBckgRadius                 = o.fFFBckgRadius;
1014     fBckgMode                     = o.fBckgMode;
1015     fIJMode                       = o.fIJMode;
1016     fQAMode                       = o.fQAMode;
1017     fFFMode                       = o.fFFMode;
1018     fDJMode                       = o.fDJMode;
1019     fEffMode                      = o.fEffMode;
1020     fPhiCorrMode                  = o.fPhiCorrMode;
1021     fBckgType[0]                  = o.fBckgType[0];
1022     fBckgType[1]                  = o.fBckgType[1];
1023     fBckgType[2]                  = o.fBckgType[2];
1024     fBckgType[3]                  = o.fBckgType[3];
1025     fBckgType[4]                  = o.fBckgType[4];
1026     fUseRecEffRecJetPtBins        = o.fUseRecEffRecJetPtBins;
1027     fUseResponseRecJetPtBins      = o.fUseResponseRecJetPtBins;
1028     fAvgTrials                    = o.fAvgTrials;
1029     fTracksRec                    = o.fTracksRec;
1030     fTracksRecCuts                = o.fTracksRecCuts;
1031     fTracksGen                    = o.fTracksGen;
1032     fTracksAODMCCharged           = o.fTracksAODMCCharged;
1033     fTracksAODMCChargedSec        = o.fTracksAODMCChargedSec;
1034     fTracksRecQualityCuts         = o.fTracksRecQualityCuts;
1035     fJetsRec                      = o.fJetsRec;
1036     fJetsRecCuts                  = o.fJetsRecCuts;
1037     fJetsGen                      = o.fJetsGen;
1038     fJetsRecEff                   = o.fJetsRecEff;
1039     fJetsEmbedded                 = o.fJetsEmbedded;
1040     fBckgJetsRec                  = o.fBckgJetsRec;
1041     fBckgJetsRecCuts              = o.fBckgJetsRecCuts;
1042     fBckgJetsGen                  = o.fBckgJetsGen;
1043     fQATrackHistosRec             = o.fQATrackHistosRec;
1044     fQATrackHistosRecCuts         = o.fQATrackHistosRecCuts;
1045     fQATrackHistosGen             = o.fQATrackHistosGen;
1046     fQAJetHistosRec               = o.fQAJetHistosRec;
1047     fQAJetHistosRecCuts           = o.fQAJetHistosRecCuts;
1048     fQAJetHistosRecCutsLeading    = o.fQAJetHistosRecCutsLeading;
1049     fQAJetHistosGen               = o.fQAJetHistosGen;
1050     fQAJetHistosGenLeading        = o.fQAJetHistosGenLeading;
1051     fQAJetHistosRecEffLeading     = o.fQAJetHistosRecEffLeading;
1052     fFFHistosRecCuts              = o.fFFHistosRecCuts;
1053     fFFHistosRecLeading           = o.fFFHistosRecLeading;
1054     fFFHistosRecLeadingTrack      = o.fFFHistosRecLeadingTrack;
1055     fFFHistosGen                  = o.fFFHistosGen;
1056     fFFHistosGenLeading           = o.fFFHistosGenLeading;
1057     fFFHistosGenLeadingTrack      = o.fFFHistosGenLeadingTrack;
1058     fIJHistosRecCuts              = o.fIJHistosRecCuts;
1059     fIJHistosRecLeading           = o.fIJHistosRecLeading;
1060     fIJHistosRecLeadingTrack      = o.fIJHistosRecLeadingTrack;
1061     fIJHistosGen                  = o.fIJHistosGen;
1062     fIJHistosGenLeading           = o.fIJHistosGenLeading;
1063     fIJHistosGenLeadingTrack      = o.fIJHistosGenLeadingTrack;
1064     fFFDiJetHistosRecCuts         = o.fFFDiJetHistosRecCuts;
1065     fFFDiJetHistosRecLeading      = o.fFFDiJetHistosRecLeading;
1066     fFFDiJetHistosRecLeadingTrack = o.fFFDiJetHistosRecLeadingTrack;
1067     fFFDiJetHistosGen             = o.fFFDiJetHistosGen;
1068     fFFDiJetHistosGenLeading      = o.fFFDiJetHistosGenLeading;
1069     fFFDiJetHistosGenLeadingTrack = o.fFFDiJetHistosGenLeadingTrack;
1070     fQADiJetHistosRecCuts         = o.fQADiJetHistosRecCuts;
1071     fQADiJetHistosGen             = o.fQADiJetHistosGen;
1072     fPhiCorrHistosJetArea         = o.fPhiCorrHistosJetArea;
1073     fPhiCorrHistosTransverseArea  = o.fPhiCorrHistosTransverseArea;
1074     fPhiCorrHistosAwayArea        = o.fPhiCorrHistosAwayArea;
1075     fQATrackHighPtThreshold       = o.fQATrackHighPtThreshold; 
1076     fFFNBinsJetPt                 = o.fFFNBinsJetPt;    
1077     fFFJetPtMin                   = o.fFFJetPtMin; 
1078     fFFJetPtMax                   = o.fFFJetPtMax;
1079     fFFNBinsPt                    = o.fFFNBinsPt;      
1080     fFFPtMin                      = o.fFFPtMin;        
1081     fFFPtMax                      = o.fFFPtMax;        
1082     fFFNBinsXi                    = o.fFFNBinsXi;      
1083     fFFXiMin                      = o.fFFXiMin;        
1084     fFFXiMax                      = o.fFFXiMax;        
1085     fFFNBinsZ                     = o.fFFNBinsZ;       
1086     fFFZMin                       = o.fFFZMin;         
1087     fFFZMax                       = o.fFFZMax;         
1088     fQAJetNBinsPt                 = o.fQAJetNBinsPt;   
1089     fQAJetPtMin                   = o.fQAJetPtMin;     
1090     fQAJetPtMax                   = o.fQAJetPtMax;     
1091     fQAJetNBinsEta                = o.fQAJetNBinsEta;  
1092     fQAJetEtaMin                  = o.fQAJetEtaMin;    
1093     fQAJetEtaMax                  = o.fQAJetEtaMax;    
1094     fQAJetNBinsPhi                = o.fQAJetNBinsPhi;  
1095     fQAJetPhiMin                  = o.fQAJetPhiMin;    
1096     fQAJetPhiMax                  = o.fQAJetPhiMax;    
1097     fQATrackNBinsPt               = o.fQATrackNBinsPt; 
1098     fQATrackPtMin                 = o.fQATrackPtMin;   
1099     fQATrackPtMax                 = o.fQATrackPtMax;   
1100     fQATrackNBinsEta              = o.fQATrackNBinsEta;
1101     fQATrackEtaMin                = o.fQATrackEtaMin;  
1102     fQATrackEtaMax                = o.fQATrackEtaMax;  
1103     fQATrackNBinsPhi              = o.fQATrackNBinsPhi;
1104     fQATrackPhiMin                = o.fQATrackPhiMin;  
1105     fQATrackPhiMax                = o.fQATrackPhiMax;  
1106     fIJNBinsJetPt                 = o.fIJNBinsJetPt;
1107     fIJJetPtMin                   = o.fIJJetPtMin;
1108     fIJJetPtMax                   = o.fIJJetPtMax;
1109     fIJNBinsPt                    = o.fIJNBinsPt;
1110     fIJPtMin                      = o.fIJPtMin;
1111     fIJPtMax                      = o.fIJPtMax;
1112     fIJNBinsZ                     = o.fIJNBinsZ;
1113     fIJZMin                       = o.fIJZMin;
1114     fIJZMax                       = o.fIJZMax;
1115     fIJNBinsCosTheta              = o.fIJNBinsCosTheta;
1116     fIJCosThetaMin                = o.fIJCosThetaMin;
1117     fIJCosThetaMax                = o.fIJCosThetaMax;
1118     fIJNBinsTheta                 = o.fIJNBinsTheta;
1119     fIJThetaMin                   = o.fIJThetaMin;
1120     fIJThetaMax                   = o.fIJThetaMax;
1121     fIJNBinsJt                    = o.fIJNBinsJt;
1122     fIJJtMin                      = o.fIJJtMin;
1123     fIJJtMax                      = o.fIJJtMax;
1124     fDiJetNBinsJetInvMass         = o.fDiJetNBinsJetInvMass;
1125     fDiJetJetInvMassMin           = o.fDiJetJetInvMassMin;
1126     fDiJetJetInvMassMax           = o.fDiJetJetInvMassMax;
1127     fDiJetNBinsJetPt              = o.fDiJetNBinsJetPt;
1128     fDiJetJetPtMin                = o.fDiJetJetPtMin;
1129     fDiJetJetPtMax                = o.fDiJetJetPtMax;
1130     fDiJetNBinsPt                 = o.fDiJetNBinsPt;
1131     fDiJetPtMin                   = o.fDiJetPtMin;
1132     fDiJetPtMax                   = o.fDiJetPtMax;
1133     fDiJetNBinsXi                 = o.fDiJetNBinsXi;
1134     fDiJetXiMin                   = o.fDiJetXiMin;
1135     fDiJetXiMax                   = o.fDiJetXiMax;
1136     fDiJetNBinsZ                  = o.fDiJetNBinsZ;
1137     fDiJetZMin                    = o.fDiJetZMin;
1138     fDiJetZMax                    = o.fDiJetZMax;
1139     fQADiJetNBinsInvMass          = o.fQADiJetNBinsInvMass;
1140     fQADiJetInvMassMin            = o.fQADiJetInvMassMin;
1141     fQADiJetInvMassMax            = o.fQADiJetInvMassMax;
1142     fQADiJetNBinsJetPt            = o.fQADiJetNBinsJetPt;
1143     fQADiJetJetPtMin              = o.fQADiJetJetPtMin;
1144     fQADiJetJetPtMax              = o.fQADiJetJetPtMax;
1145     fQADiJetNBinsDeltaPhi         = o.fQADiJetNBinsDeltaPhi;
1146     fQADiJetDeltaPhiMin           = o.fQADiJetDeltaPhiMin;
1147     fQADiJetDeltaPhiMax           = o.fQADiJetDeltaPhiMax;
1148     fQADiJetNBinsDeltaEta         = o.fQADiJetNBinsDeltaEta;
1149     fQADiJetDeltaEtaMin           = o.fQADiJetDeltaEtaMin;
1150     fQADiJetDeltaEtaMax           = o.fQADiJetDeltaEtaMax;
1151     fQADiJetNBinsDeltaPt          = o.fQADiJetNBinsDeltaPt;
1152     fQADiJetDeltaPtMin            = o.fQADiJetDeltaPtMin;
1153     fQADiJetDeltaPtMax            = o.fQADiJetDeltaPtMax;
1154     fQADiJetNBinsInBal            = o.fQADiJetNBinsInBal;
1155     fQADiJetInBalMin              = o.fQADiJetInBalMin;
1156     fQADiJetInBalMax              = o.fQADiJetInBalMax;
1157     fPhiCorrNBinsPt               = o.fPhiCorrNBinsPt;
1158     fPhiCorrPtMin                 = o.fPhiCorrPtMin;
1159     fPhiCorrPtMax                 = o.fPhiCorrPtMax;
1160     fPhiCorrNBinsEta              = o.fPhiCorrNBinsEta;
1161     fPhiCorrEtaMin                = o.fPhiCorrEtaMin;
1162     fPhiCorrEtaMax                = o.fPhiCorrEtaMax;
1163     fPhiCorrNBinsPhi              = o.fPhiCorrNBinsPhi;
1164     fPhiCorrPhiMin                = o.fPhiCorrPhiMin;
1165     fPhiCorrPhiMax                = o.fPhiCorrPhiMax;
1166     fCommonHistList               = o.fCommonHistList;
1167     fh1EvtSelection               = o.fh1EvtSelection;
1168     fh1VertexNContributors        = o.fh1VertexNContributors;
1169     fh1VertexZ                    = o.fh1VertexZ;
1170     fh1EvtMult                    = o.fh1EvtMult;
1171     fh1EvtCent                    = o.fh1EvtCent;
1172     fh2TrackPtVsDCAXY             = o.fh2TrackPtVsDCAXY;
1173     fh2TrackPtVsDCAZ              = o.fh2TrackPtVsDCAXY;
1174     fh1Xsec                       = o.fh1Xsec;
1175     fh1Trials                     = o.fh1Trials;
1176     fh1PtHard                     = o.fh1PtHard;
1177     fh1PtHardTrials               = o.fh1PtHardTrials;
1178     fh1nRecJetsCuts               = o.fh1nRecJetsCuts;
1179     fh1nGenJets                   = o.fh1nGenJets; 
1180     fh1nRecEffJets                = o.fh1nRecEffJets;
1181     fh1nEmbeddedJets              = o.fh1nEmbeddedJets;
1182     fh2PtRecVsGenPrim             = o.fh2PtRecVsGenPrim;
1183     fh2PtRecVsGenSec              = o.fh2PtRecVsGenSec;
1184     fQATrackHistosRecEffGen       = o.fQATrackHistosRecEffGen;  
1185     fQATrackHistosRecEffRec       = o.fQATrackHistosRecEffRec;  
1186     fQATrackHistosSecRec          = o.fQATrackHistosSecRec;  
1187     fFFHistosRecEffGen            = o.fFFHistosRecEffGen;    
1188     fFFHistosRecEffRec            = o.fFFHistosRecEffRec;  
1189     fFFHistosSecRec               = o.fFFHistosSecRec;   
1190     fhnResponseSinglePt           = o.fhnResponseSinglePt;
1191     fh2SingleInvPtRecMnGenVsPtGen = o.fh2SingleInvPtRecMnGenVsPtGen;
1192     fhnResponseJetTrackPt         = o.fhnResponseJetTrackPt;
1193     fhnResponseJetZ               = o.fhnResponseJetZ;
1194     fhnResponseJetXi              = o.fhnResponseJetXi;
1195     // Background
1196     fh1OutLeadingMult             = o.fh1OutLeadingMult;
1197     fh1OutLeadingStatMult         = o.fh1OutLeadingStatMult;
1198     fh1PerpMult                   = o.fh1PerpMult;
1199     fh1ASideMult                  = o.fh1ASideMult;
1200     fh1ASideWindowMult            = o.fh1ASideWindowMult;
1201     fh1PerpWindowMult             = o.fh1PerpWindowMult;
1202     fh1Out2JetsMult               = o.fh1Out2JetsMult;
1203     fh1Out3JetsMult               = o.fh1Out3JetsMult;
1204     fh1MedianClustersMult         = o.fh1MedianClustersMult;
1205     fh1OutClustersMult            = o.fh1OutClustersMult;
1206     fh1FractionPtEmbedded         = o.fh1FractionPtEmbedded;
1207     fh1IndexEmbedded              = o.fh1IndexEmbedded;
1208     fh2DeltaPtVsJetPtEmbedded     = o.fh2DeltaPtVsJetPtEmbedded;
1209     fh2DeltaPtVsRecJetPtEmbedded  = o.fh2DeltaPtVsRecJetPtEmbedded;
1210     fh1DeltaREmbedded             = o.fh1DeltaREmbedded;
1211     fh2ptVsDistNN_pt50_rec        = o.fh2ptVsDistNN_pt50_rec;    
1212     fh2ptVsDistNN_pt50_nonRec     = o.fh2ptVsDistNN_pt50_nonRec; 
1213     fh2ptVsDistNN_pt10_rec        = o.fh2ptVsDistNN_pt10_rec;    
1214     fh2ptVsDistNN_pt10_nonRec     = o.fh2ptVsDistNN_pt10_nonRec; 
1215     fQABckgHisto0RecCuts          = o.fQABckgHisto0RecCuts;  
1216     fQABckgHisto0Gen              = o.fQABckgHisto0Gen;      
1217     fQABckgHisto1RecCuts          = o.fQABckgHisto1RecCuts;  
1218     fQABckgHisto1Gen              = o.fQABckgHisto1Gen;      
1219     fQABckgHisto2RecCuts          = o.fQABckgHisto2RecCuts;  
1220     fQABckgHisto2Gen              = o.fQABckgHisto2Gen;  
1221     fQABckgHisto3RecCuts          = o.fQABckgHisto3RecCuts;  
1222     fQABckgHisto3Gen              = o.fQABckgHisto3Gen;  
1223     fQABckgHisto4RecCuts          = o.fQABckgHisto4RecCuts;  
1224     fQABckgHisto4Gen              = o.fQABckgHisto4Gen;  
1225     fFFBckgHisto0RecCuts          = o.fFFBckgHisto0RecCuts;
1226     fFFBckgHisto0RecLeading       = o.fFFBckgHisto0RecLeading;
1227     fFFBckgHisto0Gen              = o.fFFBckgHisto0Gen;       
1228     fFFBckgHisto0GenLeading       = o.fFFBckgHisto0GenLeading;
1229     fFFBckgHisto1RecCuts          = o.fFFBckgHisto1RecCuts;
1230     fFFBckgHisto1RecLeading       = o.fFFBckgHisto1RecLeading;
1231     fFFBckgHisto1Gen              = o.fFFBckgHisto1Gen;       
1232     fFFBckgHisto1GenLeading       = o.fFFBckgHisto1GenLeading;
1233     fFFBckgHisto2RecCuts          = o.fFFBckgHisto2RecCuts;
1234     fFFBckgHisto2RecLeading       = o.fFFBckgHisto2RecLeading;
1235     fFFBckgHisto2Gen              = o.fFFBckgHisto2Gen;       
1236     fFFBckgHisto2GenLeading       = o.fFFBckgHisto2GenLeading;
1237     fFFBckgHisto3RecCuts          = o.fFFBckgHisto3RecCuts;
1238     fFFBckgHisto3RecLeading       = o.fFFBckgHisto3RecLeading;
1239     fFFBckgHisto3Gen              = o.fFFBckgHisto3Gen;       
1240     fFFBckgHisto3GenLeading       = o.fFFBckgHisto3GenLeading;
1241     fFFBckgHisto4RecCuts          = o.fFFBckgHisto4RecCuts;
1242     fFFBckgHisto4RecLeading       = o.fFFBckgHisto4RecLeading;
1243     fFFBckgHisto4Gen              = o.fFFBckgHisto4Gen;       
1244     fFFBckgHisto4GenLeading       = o.fFFBckgHisto4GenLeading;
1245     fIJBckgHisto0RecCuts          = o.fIJBckgHisto0RecCuts;   
1246     fIJBckgHisto0RecLeading       = o.fIJBckgHisto0RecLeading;
1247     fIJBckgHisto0Gen              = o.fIJBckgHisto0Gen;       
1248     fIJBckgHisto0GenLeading       = o.fIJBckgHisto0GenLeading;
1249     fIJBckgHisto1RecCuts          = o.fIJBckgHisto1RecCuts;   
1250     fIJBckgHisto1RecLeading       = o.fIJBckgHisto1RecLeading;
1251     fIJBckgHisto1Gen              = o.fIJBckgHisto1Gen;       
1252     fIJBckgHisto1GenLeading       = o.fIJBckgHisto1GenLeading;
1253     fIJBckgHisto2RecCuts          = o.fIJBckgHisto2RecCuts;   
1254     fIJBckgHisto2RecLeading       = o.fIJBckgHisto2RecLeading;
1255     fIJBckgHisto2Gen              = o.fIJBckgHisto2Gen;       
1256     fIJBckgHisto2GenLeading       = o.fIJBckgHisto2GenLeading;
1257     fIJBckgHisto3Gen              = o.fIJBckgHisto3Gen;       
1258     fIJBckgHisto3GenLeading       = o.fIJBckgHisto3GenLeading;
1259     fIJBckgHisto4Gen              = o.fIJBckgHisto4Gen;       
1260     fIJBckgHisto4GenLeading       = o.fIJBckgHisto4GenLeading;
1261     fRandom                       = o.fRandom;
1262     fBckgSubMethod                = o.fBckgSubMethod;
1263   }
1264     
1265   return *this;
1266 }
1267
1268 //___________________________________________________________________________
1269 AliAnalysisTaskFragmentationFunction::~AliAnalysisTaskFragmentationFunction()
1270 {
1271   // destructor
1272   
1273   if(fTracksRec)             delete fTracksRec;
1274   if(fTracksRecCuts)         delete fTracksRecCuts;
1275   if(fTracksGen)             delete fTracksGen;
1276   if(fTracksAODMCCharged)    delete fTracksAODMCCharged;  
1277   if(fTracksAODMCChargedSec) delete fTracksAODMCChargedSec;  
1278   if(fTracksRecQualityCuts)  delete fTracksRecQualityCuts; 
1279   if(fJetsRec)               delete fJetsRec;
1280   if(fJetsRecCuts)           delete fJetsRecCuts;
1281   if(fJetsGen)               delete fJetsGen;
1282   if(fJetsRecEff)            delete fJetsRecEff;
1283   if(fJetsEmbedded)          delete fJetsEmbedded;
1284
1285   if(fBckgMode && 
1286      (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
1287       fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
1288       fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
1289
1290     if(fBckgJetsRec)          delete fBckgJetsRec;
1291     if(fBckgJetsRecCuts)      delete fBckgJetsRecCuts;
1292     if(fBckgJetsGen)          delete fBckgJetsGen;
1293   }
1294   if(fRandom)               delete fRandom;
1295 }
1296
1297 //______________________________________________________________________________________________________
1298 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const char* name, 
1299                                                          Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
1300                                                          Int_t nPt, Float_t ptMin, Float_t ptMax,
1301                                                          Int_t nXi, Float_t xiMin, Float_t xiMax,
1302                                                          Int_t nZ , Float_t zMin , Float_t zMax )
1303   : TObject()
1304   ,fNBinsJetPt(nJetPt)
1305   ,fJetPtMin(jetPtMin)
1306   ,fJetPtMax(jetPtMax)
1307   ,fNBinsPt(nPt) 
1308   ,fPtMin(ptMin)   
1309   ,fPtMax(ptMax)   
1310   ,fNBinsXi(nXi) 
1311   ,fXiMin(xiMin)   
1312   ,fXiMax(xiMax)   
1313   ,fNBinsZ(nZ)  
1314   ,fZMin(zMin)    
1315   ,fZMax(zMax)    
1316   ,fh2TrackPt(0)
1317   ,fh2Xi(0)
1318   ,fh2Z(0)
1319   ,fh1JetPt(0)
1320   ,fNameFF(name)
1321 {
1322   // default constructor
1323
1324 }
1325
1326 //___________________________________________________________________________
1327 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AliFragFuncHistos(const AliFragFuncHistos& copy)
1328   : TObject()
1329   ,fNBinsJetPt(copy.fNBinsJetPt)
1330   ,fJetPtMin(copy.fJetPtMin)
1331   ,fJetPtMax(copy.fJetPtMax)
1332   ,fNBinsPt(copy.fNBinsPt) 
1333   ,fPtMin(copy.fPtMin)   
1334   ,fPtMax(copy.fPtMax)   
1335   ,fNBinsXi(copy.fNBinsXi) 
1336   ,fXiMin(copy.fXiMin)   
1337   ,fXiMax(copy.fXiMax)   
1338   ,fNBinsZ(copy.fNBinsZ)  
1339   ,fZMin(copy.fZMin)    
1340   ,fZMax(copy.fZMax)    
1341   ,fh2TrackPt(copy.fh2TrackPt)
1342   ,fh2Xi(copy.fh2Xi)
1343   ,fh2Z(copy.fh2Z)
1344   ,fh1JetPt(copy.fh1JetPt)
1345   ,fNameFF(copy.fNameFF)
1346 {
1347   // copy constructor
1348 }
1349
1350 //_______________________________________________________________________________________________________________________________________________________________
1351 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncHistos& o)
1352 {
1353   // assignment
1354   
1355   if(this!=&o){
1356     TObject::operator=(o);
1357     fNBinsJetPt = o.fNBinsJetPt;
1358     fJetPtMin   = o.fJetPtMin;
1359     fJetPtMax   = o.fJetPtMax;
1360     fNBinsPt    = o.fNBinsPt; 
1361     fPtMin      = o.fPtMin;   
1362     fPtMax      = o.fPtMax;   
1363     fNBinsXi    = o.fNBinsXi; 
1364     fXiMin      = o.fXiMin;   
1365     fXiMax      = o.fXiMax;   
1366     fNBinsZ     = o.fNBinsZ;  
1367     fZMin       = o.fZMin;    
1368     fZMax       = o.fZMax;    
1369     fh2TrackPt  = o.fh2TrackPt;
1370     fh2Xi       = o.fh2Xi;
1371     fh2Z        = o.fh2Z;
1372     fh1JetPt    = o.fh1JetPt;
1373     fNameFF     = o.fNameFF;
1374   }
1375     
1376   return *this;
1377 }
1378
1379 //_________________________________________________________
1380 AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::~AliFragFuncHistos()
1381 {
1382   // destructor 
1383
1384   if(fh1JetPt)   delete fh1JetPt;
1385   if(fh2TrackPt) delete fh2TrackPt;
1386   if(fh2Xi)      delete fh2Xi;
1387   if(fh2Z)       delete fh2Z;
1388 }
1389
1390 //_________________________________________________________________
1391 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::DefineHistos()
1392 {
1393   // book FF histos
1394
1395   fh1JetPt   = new TH1F(Form("fh1FFJetPt%s", fNameFF.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);
1396   fh2TrackPt = new TH2F(Form("fh2FFTrackPt%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsPt, fPtMin, fPtMax);
1397   fh2Xi      = new TH2F(Form("fh2FFXi%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsXi, fXiMin, fXiMax);
1398   fh2Z       = new TH2F(Form("fh2FFZ%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsZ, fZMin, fZMax);
1399
1400   AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{T} [GeV/c]", "entries"); 
1401   AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPt,"jet p_{T} [GeV/c]","p_{T} [GeV/c]","entries");
1402   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi,"jet p_{T} [GeV/c]","#xi", "entries");
1403   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z,"jet p_{T} [GeV/c]","z","entries");
1404 }
1405
1406 //_______________________________________________________________________________________________________________
1407 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::FillFF(Float_t trackPt, Float_t jetPt, Bool_t incrementJetPt, Float_t norm)
1408 {
1409   // fill FF
1410  
1411   if(incrementJetPt && norm) fh1JetPt->Fill(jetPt,1/norm);
1412   else if(incrementJetPt) fh1JetPt->Fill(jetPt);
1413
1414  // Added for proper normalization of FF background estimation
1415   // when zero track are found in the background region
1416   if((int)trackPt==-1) return;
1417  
1418   if(norm)fh2TrackPt->Fill(jetPt,trackPt,1/norm);
1419   else fh2TrackPt->Fill(jetPt,trackPt);
1420   
1421   Double_t z = 0.;
1422   if(jetPt>0) z = trackPt / jetPt;
1423   Double_t xi = 0;
1424   if(z>0) xi = TMath::Log(1/z);
1425   
1426   if(norm){
1427     fh2Xi->Fill(jetPt,xi,1/norm);
1428     fh2Z->Fill(jetPt,z,1/norm);
1429   }
1430   else {
1431     fh2Xi->Fill(jetPt,xi);
1432     fh2Z->Fill(jetPt,z);
1433   }
1434 }
1435
1436 //_________________________________________________________________________________
1437 void AliAnalysisTaskFragmentationFunction::AliFragFuncHistos::AddToOutput(TList* list) const
1438 {
1439   // add histos to list
1440
1441   list->Add(fh1JetPt);
1442   
1443   list->Add(fh2TrackPt);
1444   list->Add(fh2Xi);
1445   list->Add(fh2Z);
1446 }
1447
1448 //_________________________________________________________________________________________________________
1449 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const char* name,
1450                                                                Int_t nPt,   Float_t ptMin,   Float_t ptMax,
1451                                                                Int_t nEta,  Float_t etaMin,  Float_t etaMax,
1452                                                                Int_t nPhi,  Float_t phiMin,  Float_t phiMax)
1453   : TObject()
1454   ,fNBinsPt(nPt)
1455   ,fPtMin(ptMin)
1456   ,fPtMax(ptMax)
1457   ,fNBinsEta(nEta)
1458   ,fEtaMin(etaMin)
1459   ,fEtaMax(etaMax)
1460   ,fNBinsPhi(nPhi)
1461   ,fPhiMin(phiMin)
1462   ,fPhiMax(phiMax)
1463   ,fh2EtaPhi(0)
1464   ,fh1Pt(0)
1465   ,fNameQAJ(name)
1466 {
1467   // default constructor
1468 }
1469
1470 //____________________________________________________________________________________
1471 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AliFragFuncQAJetHistos(const AliFragFuncQAJetHistos& copy)
1472   : TObject()
1473   ,fNBinsPt(copy.fNBinsPt)
1474   ,fPtMin(copy.fPtMin)
1475   ,fPtMax(copy.fPtMax)
1476   ,fNBinsEta(copy.fNBinsEta)
1477   ,fEtaMin(copy.fEtaMin)
1478   ,fEtaMax(copy.fEtaMax)
1479   ,fNBinsPhi(copy.fNBinsPhi)
1480   ,fPhiMin(copy.fPhiMin)
1481   ,fPhiMax(copy.fPhiMax)
1482   ,fh2EtaPhi(copy.fh2EtaPhi)
1483   ,fh1Pt(copy.fh1Pt)
1484   ,fNameQAJ(copy.fNameQAJ)
1485 {
1486   // copy constructor
1487 }
1488
1489 //________________________________________________________________________________________________________________________________________________________________________
1490 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos& o)
1491 {
1492   // assignment
1493   
1494   if(this!=&o){
1495     TObject::operator=(o);
1496     fNBinsPt  = o.fNBinsPt;
1497     fPtMin    = o.fPtMin;
1498     fPtMax    = o.fPtMax;
1499     fNBinsEta = o.fNBinsEta;
1500     fEtaMin   = o.fEtaMin;
1501     fEtaMax   = o.fEtaMax;
1502     fNBinsPhi = o.fNBinsPhi;
1503     fPhiMin   = o.fPhiMin;
1504     fPhiMax   = o.fPhiMax;
1505     fh2EtaPhi = o.fh2EtaPhi;
1506     fh1Pt     = o.fh1Pt;
1507     fNameQAJ  = o.fNameQAJ;
1508   }
1509   
1510   return *this;
1511 }
1512
1513 //______________________________________________________________
1514 AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::~AliFragFuncQAJetHistos()
1515 {
1516   // destructor 
1517   
1518   if(fh2EtaPhi) delete fh2EtaPhi;
1519   if(fh1Pt)     delete fh1Pt;
1520 }
1521
1522 //____________________________________________________________________
1523 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::DefineHistos()
1524 {
1525   // book jet QA histos
1526
1527   fh2EtaPhi  = new TH2F(Form("fh2JetQAEtaPhi%s", fNameQAJ.Data()), Form("%s: #eta - #phi distribution", fNameQAJ.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
1528   fh1Pt      = new TH1F(Form("fh1JetQAPt%s", fNameQAJ.Data()), Form("%s: p_{T} distribution", fNameQAJ.Data()), fNBinsPt, fPtMin, fPtMax);
1529         
1530   AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); 
1531   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");
1532 }
1533
1534 //____________________________________________________________________________________________________
1535 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::FillJetQA(Float_t eta, Float_t phi, Float_t pt)
1536 {
1537   // fill jet QA histos 
1538
1539   fh2EtaPhi->Fill( eta, phi);
1540   fh1Pt->Fill( pt );
1541 }
1542
1543 //____________________________________________________________________________________
1544 void AliAnalysisTaskFragmentationFunction::AliFragFuncQAJetHistos::AddToOutput(TList* list) const 
1545 {
1546   // add histos to list
1547
1548   list->Add(fh2EtaPhi);
1549   list->Add(fh1Pt);
1550 }
1551
1552 //___________________________________________________________________________________________________________
1553 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const char* name,
1554                                                                    Int_t nPt, Float_t ptMin, Float_t ptMax,
1555                                                                    Int_t nEta, Float_t etaMin, Float_t etaMax,
1556                                                                    Int_t nPhi, Float_t phiMin, Float_t phiMax,
1557                                                                    Float_t ptThresh) 
1558   : TObject()
1559   ,fNBinsPt(nPt)
1560   ,fPtMin(ptMin)
1561   ,fPtMax(ptMax)
1562   ,fNBinsEta(nEta)
1563   ,fEtaMin(etaMin)
1564   ,fEtaMax(etaMax)
1565   ,fNBinsPhi(nPhi)
1566   ,fPhiMin(phiMin)
1567   ,fPhiMax(phiMax)
1568   ,fHighPtThreshold(ptThresh)
1569   ,fh2EtaPhi(0)
1570   ,fh1Pt(0)
1571   ,fh2HighPtEtaPhi(0)
1572   ,fh2PhiPt(0)
1573   ,fNameQAT(name)
1574 {
1575   // default constructor
1576 }
1577
1578 //__________________________________________________________________________________________
1579 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AliFragFuncQATrackHistos(const AliFragFuncQATrackHistos& copy)
1580   : TObject()
1581   ,fNBinsPt(copy.fNBinsPt)
1582   ,fPtMin(copy.fPtMin)
1583   ,fPtMax(copy.fPtMax)
1584   ,fNBinsEta(copy.fNBinsEta)
1585   ,fEtaMin(copy.fEtaMin)
1586   ,fEtaMax(copy.fEtaMax)
1587   ,fNBinsPhi(copy.fNBinsPhi)
1588   ,fPhiMin(copy.fPhiMin)
1589   ,fPhiMax(copy.fPhiMax)
1590   ,fHighPtThreshold(copy.fHighPtThreshold)
1591   ,fh2EtaPhi(copy.fh2EtaPhi)
1592   ,fh1Pt(copy.fh1Pt)
1593   ,fh2HighPtEtaPhi(copy.fh2HighPtEtaPhi)
1594   ,fh2PhiPt(copy.fh2PhiPt)
1595   ,fNameQAT(copy.fNameQAT)
1596 {
1597   // copy constructor
1598 }
1599
1600 // _____________________________________________________________________________________________________________________________________________________________________________
1601 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos& o)
1602 {
1603   // assignment
1604   
1605   if(this!=&o){
1606     TObject::operator=(o);
1607     fNBinsPt         = o.fNBinsPt;
1608     fPtMin           = o.fPtMin;
1609     fPtMax           = o.fPtMax;
1610     fNBinsEta        = o.fNBinsEta;
1611     fEtaMin          = o.fEtaMin;
1612     fEtaMax          = o.fEtaMax;
1613     fNBinsPhi        = o.fNBinsPhi;
1614     fPhiMin          = o.fPhiMin;
1615     fPhiMax          = o.fPhiMax;
1616     fHighPtThreshold = o.fHighPtThreshold;
1617     fh2EtaPhi        = o.fh2EtaPhi;
1618     fh1Pt            = o.fh1Pt;
1619     fh2HighPtEtaPhi  = o.fh2HighPtEtaPhi;
1620     fh2PhiPt         = o.fh2PhiPt;
1621     fNameQAT         = o.fNameQAT;
1622   }
1623   
1624   return *this;
1625 }
1626
1627 //___________________________________________________________________
1628 AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::~AliFragFuncQATrackHistos()
1629 {
1630   // destructor 
1631   
1632   if(fh2EtaPhi)       delete fh2EtaPhi;
1633   if(fh2HighPtEtaPhi) delete fh2HighPtEtaPhi;
1634   if(fh1Pt)           delete fh1Pt;
1635   if(fh2PhiPt)        delete fh2PhiPt;
1636 }
1637
1638 //______________________________________________________________________
1639 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::DefineHistos()
1640 {
1641   // book track QA histos
1642
1643   fh2EtaPhi       = new TH2F(Form("fh2TrackQAEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
1644   fh2HighPtEtaPhi = new TH2F(Form("fh2TrackQAHighPtEtaPhi%s", fNameQAT.Data()), Form("%s: #eta - #phi distribution for high-p_{T}", fNameQAT.Data()), fNBinsEta, fEtaMin, fEtaMax, fNBinsPhi, fPhiMin, fPhiMax);
1645   fh1Pt           = new TH1F(Form("fh1TrackQAPt%s", fNameQAT.Data()), Form("%s: p_{T} distribution", fNameQAT.Data()), fNBinsPt, fPtMin, fPtMax);
1646     fh2PhiPt        = new TH2F(Form("fh2TrackQAPhiPt%s", fNameQAT.Data()), Form("%s: #phi - p_{T} distribution", fNameQAT.Data()), fNBinsPhi, fPhiMin, fPhiMax, fNBinsPt, fPtMin, fPtMax);
1647
1648   AliAnalysisTaskFragmentationFunction::SetProperties(fh2EtaPhi, "#eta", "#phi"); 
1649   AliAnalysisTaskFragmentationFunction::SetProperties(fh2HighPtEtaPhi, "#eta", "#phi");
1650   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Pt, "p_{T} [GeV/c]", "entries");
1651   AliAnalysisTaskFragmentationFunction::SetProperties(fh2PhiPt, "#phi", "p_{T} [GeV/c]"); 
1652 }
1653
1654 //________________________________________________________________________________________________________
1655 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::FillTrackQA(Float_t eta, Float_t phi, Float_t pt, Bool_t weightPt, Float_t norm)
1656 {
1657   // fill track QA histos
1658   Float_t weight = 1.;
1659   if(weightPt) weight = pt;  
1660   fh2EtaPhi->Fill( eta, phi, weight);
1661   if(pt > fHighPtThreshold) fh2HighPtEtaPhi->Fill( eta, phi, weight);
1662   if(norm) fh1Pt->Fill( pt, 1/norm );
1663   else fh1Pt->Fill( pt );
1664   fh2PhiPt->Fill(phi, pt);
1665 }
1666
1667 //______________________________________________________________________________________
1668 void AliAnalysisTaskFragmentationFunction::AliFragFuncQATrackHistos::AddToOutput(TList* list) const
1669 {
1670   // add histos to list
1671
1672   list->Add(fh2EtaPhi);
1673   list->Add(fh2HighPtEtaPhi);
1674   list->Add(fh1Pt);
1675   list->Add(fh2PhiPt);
1676 }
1677
1678 //______________________________________________________________________________________________________
1679 AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::AliFragFuncIntraJetHistos(const char* name, 
1680                                                          Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
1681                                                          Int_t nPt, Float_t ptMin, Float_t ptMax,
1682                                                          Int_t nZ , Float_t zMin , Float_t zMax,
1683                                                          Int_t nCosTheta , Float_t costhetaMin , Float_t costhetaMax,
1684                                                          Int_t nTheta , Float_t thetaMin , Float_t thetaMax,
1685                                                          Int_t nJt , Float_t jtMin , Float_t jtMax)
1686   : TObject()
1687   ,fNBinsJetPt(nJetPt)
1688   ,fJetPtMin(jetPtMin)
1689   ,fJetPtMax(jetPtMax)
1690   ,fNBinsPt(nPt) 
1691   ,fPtMin(ptMin)   
1692   ,fPtMax(ptMax)   
1693   ,fNBinsZ(nZ) 
1694   ,fZMin(zMin)   
1695   ,fZMax(zMax)   
1696   ,fNBinsJt(nJt)
1697   ,fJtMin(jtMin)
1698   ,fJtMax(jtMax)
1699   ,fNBinsTheta(nTheta)
1700   ,fThetaMin(thetaMin)
1701   ,fThetaMax(thetaMax)
1702   ,fNBinsCosTheta(nCosTheta)
1703   ,fCosThetaMin(costhetaMin)
1704   ,fCosThetaMax(costhetaMax)
1705   ,fh2CosTheta(0)
1706   ,fh2PtZ(0)
1707   ,fh3ThetaZ(0)
1708   ,fh3JtTheta(0)
1709   ,fh3JtZ(0)
1710   ,fNameIJ(name)
1711 {
1712   // default constructor
1713
1714 }
1715
1716 //___________________________________________________________________________
1717 AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::AliFragFuncIntraJetHistos(const AliFragFuncIntraJetHistos& copy)
1718   : TObject()
1719   ,fNBinsJetPt(copy.fNBinsJetPt)
1720   ,fJetPtMin(copy.fJetPtMin)
1721   ,fJetPtMax(copy.fJetPtMax)
1722   ,fNBinsPt(copy.fNBinsPt) 
1723   ,fPtMin(copy.fPtMin)   
1724   ,fPtMax(copy.fPtMax)   
1725   ,fNBinsZ(copy.fNBinsZ) 
1726   ,fZMin(copy.fZMin)   
1727   ,fZMax(copy.fZMax)   
1728   ,fNBinsJt(copy.fNBinsJt)
1729   ,fJtMin(copy.fJtMin)
1730   ,fJtMax(copy.fJtMax)
1731   ,fNBinsTheta(copy.fNBinsTheta)
1732   ,fThetaMin(copy.fThetaMin)
1733   ,fThetaMax(copy.fThetaMax)
1734   ,fNBinsCosTheta(copy.fNBinsCosTheta)
1735   ,fCosThetaMin(copy.fCosThetaMin)
1736   ,fCosThetaMax(copy.fCosThetaMax)
1737   ,fh2CosTheta(copy.fh2CosTheta)
1738   ,fh2PtZ(copy.fh2PtZ)
1739   ,fh3ThetaZ(copy.fh3ThetaZ)
1740   ,fh3JtTheta(copy.fh3JtTheta)
1741   ,fh3JtZ(copy.fh3JtZ)
1742   ,fNameIJ(copy.fNameIJ)
1743 {
1744   // copy constructor
1745 }
1746
1747 //_______________________________________________________________________________________________________________________________________________________________
1748 AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos& o)
1749 {
1750   // assignment
1751   
1752   if(this!=&o){
1753     TObject::operator=(o);
1754     fNBinsJetPt       = o.fNBinsJetPt;
1755     fJetPtMin         = o.fJetPtMin;
1756     fJetPtMax         = o.fJetPtMax;
1757     fNBinsPt          = o.fNBinsPt; 
1758     fPtMin            = o.fPtMin;   
1759     fPtMax            = o.fPtMax;   
1760     fNBinsZ           = o.fNBinsZ; 
1761     fZMin             = o.fZMin;   
1762     fZMax             = o.fZMax;   
1763     fNBinsJt          = o.fNBinsJt;
1764     fJtMin            = o.fJtMin;
1765     fJtMax            = o.fJtMax;
1766     fNBinsTheta       = o.fNBinsTheta;
1767     fThetaMin         = o.fThetaMin;
1768     fThetaMax         = o.fThetaMax;
1769     fNBinsCosTheta    = o.fNBinsCosTheta;
1770     fCosThetaMin      = o.fCosThetaMin;
1771     fCosThetaMax      = o.fCosThetaMax;
1772     fh2CosTheta       = o.fh2CosTheta;
1773     fh2PtZ            = o.fh2PtZ;
1774     fh3ThetaZ         = o.fh3ThetaZ;
1775     fh3JtTheta        = o.fh3JtTheta;
1776     fh3JtZ            = o.fh3JtZ;
1777     fNameIJ           = o.fNameIJ;
1778   }
1779     
1780   return *this;
1781 }
1782
1783 //_________________________________________________________
1784 AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::~AliFragFuncIntraJetHistos()
1785 {
1786   // destructor 
1787
1788
1789   if(fh2CosTheta)       delete fh2CosTheta;
1790   if(fh2PtZ)            delete fh2PtZ;
1791   if(fh3ThetaZ)         delete fh3ThetaZ;             
1792   if(fh3JtTheta)        delete fh3JtTheta;
1793   if(fh3JtZ)            delete fh3JtZ;
1794
1795 }
1796
1797 //_________________________________________________________________
1798 void AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::DefineHistos()
1799 {
1800   // book FF histos
1801
1802   fh2CosTheta = new TH2F(Form("fh2IJcosTheta%s",fNameIJ.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax,fNBinsCosTheta, fCosThetaMin, fCosThetaMax);
1803   fh2PtZ      = new TH2F(Form("fh2IJPtZ%s",fNameIJ.Data()),"",fNBinsPt, fPtMin, fPtMax, fNBinsZ, fZMin, fZMax);
1804   fh3ThetaZ   = new TH3F(Form("fh3IJThetaZ%s",fNameIJ.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsTheta, fThetaMin, fThetaMax, fNBinsZ, fZMin, fZMax);
1805   fh3JtTheta  = new TH3F(Form("fh3IJJtTheta%s",fNameIJ.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsJt, fJtMin, fJtMax, fNBinsTheta, fThetaMin, fThetaMax);
1806   fh3JtZ      = new TH3F(Form("fh3IJJtZ%s",fNameIJ.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsJt, fJtMin, fJtMax, fNBinsZ, fZMin, fZMax);
1807   
1808   AliAnalysisTaskFragmentationFunction::SetProperties(fh2CosTheta,"jet p_{T} [GeV/c]","cos(#Theta)", "entries");
1809   AliAnalysisTaskFragmentationFunction::SetProperties(fh2PtZ,"had p_{T} [GeV/c]","z=p_{T}^{had}/p_{T}^{jet}","entries");
1810   AliAnalysisTaskFragmentationFunction::SetProperties(fh3ThetaZ,"jet p_{T} [GeV/c]","#Theta [rad]","z=p_{T}^{had}/p_{T}^{jet}");
1811   AliAnalysisTaskFragmentationFunction::SetProperties(fh3JtTheta,"jet p_{T} [GeV/c]","j_{T} [GeV/c]","#Theta [rad]");
1812   AliAnalysisTaskFragmentationFunction::SetProperties(fh3JtZ,"jet p_{T} [GeV/c]","j_{T} [GeV/c]","z=p_{T}^{had}/p_{T}^{jet}");
1813
1814 }
1815
1816 //_______________________________________________________________________________________________________________
1817 void AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::FillIntraJet(const TLorentzVector* trackV, const TLorentzVector* jetV, Float_t norm)
1818 {
1819   // fill IntraJet histos
1820  
1821   Float_t cosTheta = 0.; Float_t theta = 0.; 
1822   Float_t jt = 0.; Float_t z = 0.; 
1823   // For Theta distribution
1824   Float_t pxT  = trackV->Px();
1825   Float_t pyT  = trackV->Py();
1826   Float_t pzT  = trackV->Pz();
1827   Float_t ptT  = trackV->Pt();
1828   Float_t pT   = trackV->P();
1829   Float_t etaT = trackV->Eta();
1830   Float_t phiT = trackV->Phi(); // Check the value returned
1831   Float_t pxJ = jetV->Px();
1832   Float_t pyJ = jetV->Py();
1833   Float_t pzJ = jetV->Pz();
1834   Float_t ptJ = jetV->Pt();
1835   Float_t pJ  = jetV->P();
1836
1837   // Compute z
1838   if(ptJ>0) z = (Float_t)(ptT/ptJ);
1839
1840   // Compute theta
1841   cosTheta = (pxT*pxJ+pyT*pyJ+pzT*pzJ)/(pT*pJ);
1842   theta = TMath::ACos(cosTheta);
1843
1844   // Compute jt
1845   TVector3 trackP; TVector3 jetP;
1846   jetP[0] = pxJ;
1847   jetP[1] = pyJ;
1848   jetP[2] = pzJ;
1849   trackP.SetPtEtaPhi(ptT,etaT,phiT);
1850   jt = TMath::Sin(trackP.Angle(jetP))*trackP.Mag();
1851
1852   // Fill histos
1853   if(norm){
1854     fh2CosTheta->Fill(ptJ,cosTheta,1/norm);
1855     fh2PtZ->Fill(ptT,z,1/norm);
1856     fh3ThetaZ->Fill(ptJ,theta,z,1/norm);
1857     fh3JtTheta->Fill(ptJ,jt,theta,1/norm);
1858     fh3JtZ->Fill(ptJ,jt,z,1/norm);
1859   }
1860   else {
1861     fh2CosTheta->Fill(ptJ,cosTheta);
1862     fh2PtZ->Fill(ptT,z);
1863     fh3ThetaZ->Fill(ptJ,theta,z);
1864     fh3JtTheta->Fill(ptJ,jt,theta);
1865     fh3JtZ->Fill(ptJ,jt,z);
1866   }
1867
1868 }
1869
1870 //______________________________________________________________________________________________________
1871 AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::AliFragFuncDiJetHistos(const char* name, Int_t kindSlices,
1872                                                          Int_t nJetInvMass, Float_t jetInvMassMin, Float_t jetInvMassMax,  
1873                                                          Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
1874                                                          Int_t nPt, Float_t ptMin, Float_t ptMax,
1875                                                          Int_t nXi, Float_t xiMin, Float_t xiMax,
1876                                                          Int_t nZ , Float_t zMin , Float_t zMax)
1877   : TObject()
1878   ,fKindSlices(kindSlices)
1879   ,fNBinsJetInvMass(nJetInvMass)
1880   ,fJetInvMassMin(jetInvMassMin)
1881   ,fJetInvMassMax(jetInvMassMax)
1882   ,fNBinsJetPt(nJetPt)
1883   ,fJetPtMin(jetPtMin)
1884   ,fJetPtMax(jetPtMax)
1885   ,fNBinsPt(nPt) 
1886   ,fPtMin(ptMin)   
1887   ,fPtMax(ptMax)   
1888   ,fNBinsXi(nXi) 
1889   ,fXiMin(xiMin)   
1890   ,fXiMax(xiMax)   
1891   ,fNBinsZ(nZ)  
1892   ,fZMin(zMin)    
1893   ,fZMax(zMax)
1894   ,fh2TrackPtJet1(0)
1895   ,fh2TrackPtJet2(0)
1896   ,fh2TrackPtJet(0)
1897   ,fh1Jet1Pt(0)
1898   ,fh1Jet2Pt(0)
1899   ,fh1JetPt(0)
1900   ,fh2Xi1(0)
1901   ,fh2Xi2(0)
1902   ,fh2Xi(0)
1903   ,fh2Z1(0)
1904   ,fh2Z2(0)
1905   ,fh2Z(0)
1906   ,fh2Pt1(0)
1907   ,fh2Pt2(0)
1908   ,fh2Pt(0)
1909   ,fNameDJ(name)
1910 {
1911   // default constructor
1912
1913 }
1914
1915 //______________________________________________________________________________________________________
1916 AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::AliFragFuncDiJetHistos(const AliFragFuncDiJetHistos& copy)
1917   : TObject()
1918   ,fKindSlices(copy.fKindSlices)
1919   ,fNBinsJetInvMass(copy.fNBinsJetInvMass)
1920   ,fJetInvMassMin(copy.fJetInvMassMin)
1921   ,fJetInvMassMax(copy.fJetInvMassMax)
1922   ,fNBinsJetPt(copy.fNBinsJetPt)
1923   ,fJetPtMin(copy.fJetPtMin)
1924   ,fJetPtMax(copy.fJetPtMax)
1925   ,fNBinsPt(copy.fNBinsPt) 
1926   ,fPtMin(copy.fPtMin)   
1927   ,fPtMax(copy.fPtMax)   
1928   ,fNBinsXi(copy.fNBinsXi) 
1929   ,fXiMin(copy.fXiMin)   
1930   ,fXiMax(copy.fXiMax)   
1931   ,fNBinsZ(copy.fNBinsZ)  
1932   ,fZMin(copy.fZMin)    
1933   ,fZMax(copy.fZMax)
1934   ,fh2TrackPtJet1(copy.fh2TrackPtJet1)
1935   ,fh2TrackPtJet2(copy.fh2TrackPtJet2)
1936   ,fh2TrackPtJet(copy.fh2TrackPtJet)
1937   ,fh1Jet1Pt(copy.fh1Jet1Pt)
1938   ,fh1Jet2Pt(copy.fh1Jet2Pt)
1939   ,fh1JetPt(copy.fh1JetPt)
1940   ,fh2Xi1(copy.fh2Xi1)
1941   ,fh2Xi2(copy.fh2Xi2)
1942   ,fh2Xi(copy.fh2Xi2)
1943   ,fh2Z1(copy.fh2Z1)
1944   ,fh2Z2(copy.fh2Z2)
1945   ,fh2Z(copy.fh2Z)
1946   ,fh2Pt1(copy.fh2Pt1)
1947   ,fh2Pt2(copy.fh2Pt2)
1948   ,fh2Pt(copy.fh2Pt)
1949   ,fNameDJ(copy.fNameDJ)
1950 {
1951   // default constructor
1952
1953 }
1954
1955 //_______________________________________________________________________________________________________________________________________________________________
1956 AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos& o)
1957 {
1958   // assignment
1959   
1960   if(this!=&o){
1961     TObject::operator=(o);
1962     fKindSlices      = o.fKindSlices;
1963     fNBinsJetInvMass = o.fNBinsJetInvMass;
1964     fJetInvMassMin   = o.fJetInvMassMin;
1965     fJetInvMassMax   = o.fJetInvMassMax;
1966     fNBinsJetPt      = o.fNBinsJetPt;
1967     fJetPtMin        = o.fJetPtMin;
1968     fJetPtMax        = o.fJetPtMax;
1969     fNBinsPt         = o.fNBinsPt; 
1970     fPtMin           = o.fPtMin;   
1971     fPtMax           = o.fPtMax;   
1972     fNBinsXi         = o.fNBinsXi; 
1973     fXiMin           = o.fXiMin;   
1974     fXiMax           = o.fXiMax;   
1975     fNBinsZ          = o.fNBinsZ;  
1976     fZMin            = o.fZMin;    
1977     fZMax            = o.fZMax;   
1978     fh2TrackPtJet1   = o.fh2TrackPtJet1;
1979     fh2TrackPtJet2   = o.fh2TrackPtJet2;
1980     fh2TrackPtJet    = o.fh2TrackPtJet;
1981     fh1Jet1Pt        = o.fh1Jet1Pt;
1982     fh1Jet2Pt        = o.fh1Jet2Pt;
1983     fh1JetPt         = o.fh1JetPt;
1984     fh2Xi1           = o.fh2Xi1;
1985     fh2Xi2           = o.fh2Xi2;
1986     fh2Xi            = o.fh2Xi;
1987     fh2Z1            = o.fh2Z1;
1988     fh2Z2            = o.fh2Z2;
1989     fh2Z             = o.fh2Z;
1990     fh2Pt1           = o.fh2Pt1;
1991     fh2Pt2           = o.fh2Pt2;
1992     fh2Pt            = o.fh2Pt;
1993     fNameDJ          = o.fNameDJ;
1994   }
1995     
1996   return *this;
1997 }
1998
1999 //_________________________________________________________
2000 AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::~AliFragFuncDiJetHistos()
2001 {
2002   // destructor 
2003
2004   if(fh2TrackPtJet1) delete fh2TrackPtJet1;
2005   if(fh2TrackPtJet2) delete fh2TrackPtJet2;
2006   if(fh2TrackPtJet ) delete fh2TrackPtJet;
2007   if(fh1Jet1Pt)      delete fh1Jet1Pt;
2008   if(fh1Jet2Pt)      delete fh1Jet2Pt;
2009   if(fh1JetPt)       delete fh1JetPt;
2010   if(fh2Xi1)         delete fh2Xi1;
2011   if(fh2Xi2)         delete fh2Xi2;
2012   if(fh2Xi)          delete fh2Xi;
2013   if(fh2Z1)          delete fh2Z1;
2014   if(fh2Z2)          delete fh2Z2;
2015   if(fh2Z)           delete fh2Z;
2016   if(fh2Pt1)         delete fh2Pt1;
2017   if(fh2Pt2)         delete fh2Pt2;
2018   if(fh2Pt)          delete fh2Pt;
2019 }
2020
2021 //________________________________________________________________________
2022 void AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::DefineDiJetHistos()
2023 {
2024   // book DiJet histos
2025   
2026   Int_t nBins = 0;
2027   Double_t min = 0.;
2028   Double_t max = 0.;
2029   const char *xaxis = "";
2030   if(fKindSlices == 1)
2031     {
2032       nBins = fNBinsJetInvMass;
2033       min   = fJetInvMassMin;
2034       max   = fJetInvMassMax;
2035       xaxis = "M_{JJ} [GeV]";
2036     }
2037   if(fKindSlices == 2 || fKindSlices == 3)
2038     {
2039       nBins = fNBinsJetPt;
2040       min   = fJetPtMin;
2041       max   = fJetPtMax;
2042       if(fKindSlices == 2) xaxis = "E_{Tmean} [GeV]";
2043       if(fKindSlices == 3) xaxis ="leading jet p_{T} [GeV/c]";
2044     }
2045   
2046   fh1Jet1Pt      = new TH1F(Form("fh1DJJet1Pt%s", fNameDJ.Data()), "", fNBinsJetPt, fJetPtMin, fJetPtMax);
2047   fh1Jet2Pt      = new TH1F(Form("fh1DJJet2Pt%s", fNameDJ.Data()), "", fNBinsJetPt, fJetPtMin, fJetPtMax);
2048   fh1JetPt       = new TH1F(Form("fh1DJJetPt%s",  fNameDJ.Data()), "", fNBinsJetPt, fJetPtMin, fJetPtMax);
2049   
2050   fh2TrackPtJet1 = new TH2F(Form("fh2DJTrackPtJet1%s", fNameDJ.Data()), "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2051   fh2TrackPtJet2 = new TH2F(Form("fh2DJTrackPtJet2%s", fNameDJ.Data()), "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2052   fh2TrackPtJet  = new TH2F(Form("fh2DJTrackPtJet%s", fNameDJ.Data()),  "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2053   
2054   fh2Xi1         = new TH2F(Form("fh2DJXi1%s", fNameDJ.Data()), "",nBins, min, max, fNBinsXi, fXiMin, fXiMax);
2055   fh2Xi2         = new TH2F(Form("fh2DJXi2%s", fNameDJ.Data()), "",nBins, min, max, fNBinsXi, fXiMin, fXiMax);
2056   fh2Xi          = new TH2F(Form("fh2DJXi%s", fNameDJ.Data()),  "",nBins, min, max, fNBinsXi, fXiMin, fXiMax);
2057   
2058   fh2Z1          = new TH2F(Form("fh2DJZ1%s", fNameDJ.Data()), "",nBins, min, max, fNBinsZ, fZMin, fZMax);
2059   fh2Z2          = new TH2F(Form("fh2DJZ2%s", fNameDJ.Data()), "",nBins, min, max, fNBinsZ, fZMin, fZMax);
2060   fh2Z           = new TH2F(Form("fh2DJZ%s", fNameDJ.Data()),  "",nBins, min, max, fNBinsZ, fZMin, fZMax);
2061   
2062   fh2Pt1         = new TH2F(Form("fh2DJPt1%s", fNameDJ.Data()), "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2063   fh2Pt2         = new TH2F(Form("fh2DJPt2%s", fNameDJ.Data()), "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2064   fh2Pt          = new TH2F(Form("fh2DJPtZ%s", fNameDJ.Data()),  "",nBins, min, max, fNBinsPt, fPtMin, fPtMax);
2065       
2066   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Jet1Pt, "p_{T} [GeV/c]", "entries");
2067   AliAnalysisTaskFragmentationFunction::SetProperties(fh1Jet2Pt, "p_{T} [GeV/c]", "entries");
2068   AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{T} [GeV/c]", "entries");
2069
2070   AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPtJet1, xaxis, "p_{T} [GeV/c]", "Entries");
2071   AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPtJet2, xaxis, "p_{T} [GeV/c]", "Entries");
2072   AliAnalysisTaskFragmentationFunction::SetProperties(fh2TrackPtJet, xaxis, "p_{T} [GeV/c]", "Entries");
2073   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi1, xaxis, "#xi", "Entries");
2074   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi2, xaxis, "#xi", "Entries");
2075   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Xi, xaxis, "#xi", "Entries");
2076   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z1, xaxis, "z", "Entries");
2077   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z2, xaxis, "z", "Entries");
2078   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Z, xaxis, "z", "Entries");
2079   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Pt1, xaxis, "p_{T} [GeV/c]", "Entries");
2080   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Pt2, xaxis, "p_{T} [GeV/c]", "Entries");
2081   AliAnalysisTaskFragmentationFunction::SetProperties(fh2Pt, xaxis, "p_{T} [GeV/c]", "Entries");
2082 }
2083
2084 //________________________________________________________________________
2085 void AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::FillDiJetFF(Int_t jetType, Float_t trackPt, Float_t jetPt, Double_t jetBin, Bool_t incrementJetPt)
2086 {
2087   // fill DiJet FF
2088
2089   if(jetType == 0)
2090     {
2091       if(incrementJetPt) fh1JetPt->Fill(jetPt);  
2092       
2093       fh2TrackPtJet->Fill(jetBin, trackPt);
2094       
2095       Double_t z = trackPt / jetPt;
2096       Double_t xi = 0;
2097       if(z>0) xi = TMath::Log(1/z);
2098       
2099       fh2Xi->Fill(jetBin, xi);
2100       fh2Z->Fill(jetBin, z);
2101     }
2102   if(jetType == 1)
2103     {
2104       if(incrementJetPt) fh1Jet1Pt->Fill(jetPt);
2105       
2106       fh2TrackPtJet1->Fill(jetBin, trackPt);
2107       
2108       Double_t z = trackPt / jetPt;
2109       Double_t xi = 0;
2110       if(z>0) xi = TMath::Log(1/z);
2111       
2112       fh2Xi1->Fill(jetBin, xi);
2113       fh2Z1->Fill(jetBin, z);
2114     }
2115   if(jetType == 2)
2116     {
2117       if(incrementJetPt) fh1Jet2Pt->Fill(jetPt);
2118       
2119       fh2TrackPtJet2->Fill(jetBin, trackPt);
2120       
2121       Double_t z = trackPt / jetPt;
2122       Double_t xi = 0;
2123       if(z>0) xi = TMath::Log(1/z);
2124       
2125       fh2Xi2->Fill(jetBin, xi);
2126       fh2Z2->Fill(jetBin, z);
2127     }
2128
2129
2130 }
2131
2132 //________________________________________________________________________
2133 void AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos::AddToOutput(TList* list)const
2134 {
2135   // add histos to list
2136
2137   list->Add(fh1Jet1Pt);
2138   list->Add(fh1Jet2Pt);
2139   list->Add(fh1JetPt);
2140   list->Add(fh2TrackPtJet1);
2141   list->Add(fh2TrackPtJet2);
2142   list->Add(fh2TrackPtJet);
2143   list->Add(fh2Xi1);
2144   list->Add(fh2Xi2);
2145   list->Add(fh2Xi);
2146   list->Add(fh2Z1);
2147   list->Add(fh2Z2);
2148   list->Add(fh2Z);
2149 }
2150
2151 //______________________________________________________________________________________________________
2152 AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::AliFragFuncQADiJetHistos(const char* name, Int_t kindSlices,
2153                                              Int_t nInvMass, Float_t invMassMin, Float_t invMassMax, 
2154                                              Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
2155                                              Int_t nDeltaPhi, Float_t deltaPhiMin, Float_t deltaPhiMax, 
2156                                              Int_t nDeltaEta, Float_t deltaEtaMin, Float_t deltaEtaMax, 
2157                                              Int_t nDeltaPt, Float_t deltaPtMin, Float_t deltaPtMax, 
2158                                              Int_t nInBal, Float_t inBalMin, Float_t inBalMax)
2159   : TObject()
2160   ,fKindSlices(kindSlices)
2161   ,fNBinsJetInvMass(nInvMass)
2162   ,fJetInvMassMin(invMassMin)
2163   ,fJetInvMassMax(invMassMax)
2164   ,fNBinsJetPt(nJetPt)
2165   ,fJetPtMin(jetPtMin)
2166   ,fJetPtMax(jetPtMax)
2167   ,fNBinsDeltaPhi(nDeltaPhi)
2168   ,fDeltaPhiMin(deltaPhiMin)
2169   ,fDeltaPhiMax(deltaPhiMax)
2170   ,fNBinsDeltaEta(nDeltaEta)
2171   ,fDeltaEtaMin(deltaEtaMin)
2172   ,fDeltaEtaMax(deltaEtaMax)
2173   ,fNBinsDeltaPt(nDeltaPt)
2174   ,fDeltaPtMin(deltaPtMin)
2175   ,fDeltaPtMax(deltaPtMax)
2176   ,fNBinsInBal(nInBal)
2177   ,fInBalMin(inBalMin)
2178   ,fInBalMax(inBalMax)
2179   ,fh2InvMass(0)
2180   ,fh2DeltaPhi(0)
2181   ,fh2DeltaEta(0)
2182   ,fh2DeltaPt(0)
2183   ,fh2InBal(0)
2184   ,fNameQADJ(name)
2185 {
2186   // default constructor
2187
2188 }
2189
2190 //______________________________________________________________________________________________________
2191 AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::AliFragFuncQADiJetHistos(const AliFragFuncQADiJetHistos& copy)
2192   : TObject()
2193   ,fKindSlices(copy.fKindSlices)
2194   ,fNBinsJetInvMass(copy.fNBinsJetInvMass)
2195   ,fJetInvMassMin(copy.fJetInvMassMin)
2196   ,fJetInvMassMax(copy.fJetInvMassMax)
2197   ,fNBinsJetPt(copy.fNBinsJetPt)
2198   ,fJetPtMin(copy.fJetPtMin)
2199   ,fJetPtMax(copy.fJetPtMax)
2200   ,fNBinsDeltaPhi(copy.fNBinsDeltaPhi)
2201   ,fDeltaPhiMin(copy.fDeltaPhiMin)
2202   ,fDeltaPhiMax(copy.fDeltaPhiMax)
2203   ,fNBinsDeltaEta(copy.fNBinsDeltaEta)
2204   ,fDeltaEtaMin(copy.fDeltaEtaMin)
2205   ,fDeltaEtaMax(copy.fDeltaEtaMax)
2206   ,fNBinsDeltaPt(copy.fNBinsDeltaPt)
2207   ,fDeltaPtMin(copy.fDeltaPtMin)
2208   ,fDeltaPtMax(copy.fDeltaPtMax)
2209   ,fNBinsInBal(copy.fNBinsInBal)
2210   ,fInBalMin(copy.fInBalMin)
2211   ,fInBalMax(copy.fInBalMax)
2212   ,fh2InvMass(copy.fh2InvMass)
2213   ,fh2DeltaPhi(copy.fh2DeltaPhi)
2214   ,fh2DeltaEta(copy.fh2DeltaEta)
2215   ,fh2DeltaPt(copy.fh2DeltaPt)
2216   ,fh2InBal(copy.fh2InBal)
2217   ,fNameQADJ(copy.fNameQADJ)
2218 {
2219   // default constructor
2220
2221 }
2222
2223 //_______________________________________________________________________________________________________________________________________________________________
2224 AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos& AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::operator=(const AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos& o)
2225 {
2226   // assignment
2227   
2228   if(this!=&o){
2229     TObject::operator=(o);
2230     fKindSlices       = o.fKindSlices;
2231     fNBinsJetInvMass  = o.fNBinsJetInvMass;
2232     fJetInvMassMin    = o.fJetInvMassMin;
2233     fJetInvMassMax    = o.fJetInvMassMax;
2234     fNBinsJetPt       = o.fNBinsJetPt;
2235     fJetPtMin         = o.fJetPtMin;
2236     fJetPtMax         = o.fJetPtMax;
2237     fNBinsDeltaPhi    = o.fNBinsDeltaPhi;
2238     fDeltaPhiMin      = o.fDeltaPhiMin;
2239     fDeltaPhiMax      = o.fDeltaPhiMax;
2240     fNBinsDeltaEta    = o.fNBinsDeltaEta;
2241     fDeltaEtaMin      = o.fDeltaEtaMin;
2242     fDeltaEtaMax      = o.fDeltaEtaMax;
2243     fNBinsDeltaPt     = o.fNBinsDeltaPt;
2244     fDeltaPtMin       = o.fDeltaPtMin;
2245     fDeltaPtMax       = o.fDeltaPtMax;
2246     fNBinsInBal       = o.fNBinsInBal;
2247     fInBalMin         = o.fInBalMin;
2248     fInBalMax         = o.fInBalMax;
2249     fh2InvMass        = o.fh2InvMass;
2250     fh2DeltaPhi       = o.fh2DeltaPhi;
2251     fh2DeltaEta       = o.fh2DeltaEta;
2252     fh2DeltaPt        = o.fh2DeltaPt;
2253     fh2InBal          = o.fh2InBal;
2254     fNameQADJ         = o.fNameQADJ;
2255   }
2256     
2257   return *this;
2258 }
2259
2260 //_________________________________________________________
2261 AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::~AliFragFuncQADiJetHistos()
2262 {
2263   // destructor 
2264
2265   if(fh2InvMass)  delete fh2InvMass;
2266   if(fh2DeltaPhi) delete fh2DeltaPhi;
2267   if(fh2DeltaEta) delete fh2DeltaEta;
2268   if(fh2DeltaPt)  delete fh2DeltaPt;
2269   if(fh2InBal)    delete fh2InBal;
2270 }
2271
2272 //________________________________________________________________________
2273 void AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::DefineQADiJetHistos()
2274 {
2275   // define histos
2276   
2277   Int_t nBins = 0;
2278   Double_t min = 0.;
2279   Double_t max = 0.;
2280   const char *xaxis = "";
2281   if(fKindSlices == 1)
2282     {
2283       nBins = fNBinsJetInvMass;
2284       min   = fJetInvMassMin;
2285       max   = fJetInvMassMax;
2286       xaxis = "M_{JJ} [GeV]";
2287     }
2288   if(fKindSlices == 2 || fKindSlices == 3)
2289     {
2290       nBins = fNBinsJetPt;
2291       min   = fJetPtMin;
2292       max   = fJetPtMax;
2293       if(fKindSlices == 2) xaxis = "E_{Tmean} [GeV]";
2294       if(fKindSlices == 3) xaxis ="leading jet p_{T} [GeV/c]";
2295     }
2296   
2297   
2298   fh2InvMass  = new TH2F(Form("fh2DJInvMassPositionCut%s",  fNameQADJ.Data()), "",nBins, min, max, fNBinsJetInvMass, fJetInvMassMin, fJetInvMassMax);
2299   fh2DeltaPhi = new TH2F(Form("fh2DJDeltaPhiPositionCut%s", fNameQADJ.Data()), "",nBins, min, max, fNBinsDeltaPhi, fDeltaPhiMin, fDeltaPhiMax);
2300   fh2DeltaEta = new TH2F(Form("fh2DJDeltaEtaPositionCut%s", fNameQADJ.Data()), "",nBins, min, max, fNBinsDeltaEta, fDeltaEtaMin, fDeltaEtaMax);
2301   fh2DeltaPt  = new TH2F(Form("fh2DJDeltaPtPositionCut%s",  fNameQADJ.Data()), "",nBins, min, max, fNBinsDeltaPt, fDeltaPtMin, fDeltaPtMax);
2302   fh2InBal  = new TH2F(Form("fh2DJInBalPositionCut%s",  fNameQADJ.Data()), "",nBins, min, max, fNBinsInBal, fInBalMin, fInBalMax);
2303
2304   AliAnalysisTaskFragmentationFunction::SetProperties(fh2InvMass, xaxis, "Invariant Mass", "Entries");
2305   AliAnalysisTaskFragmentationFunction::SetProperties(fh2DeltaPhi, xaxis, "#Delta #phi", "Entries");
2306   AliAnalysisTaskFragmentationFunction::SetProperties(fh2DeltaEta, xaxis, "#Delta #eta", "Entries");
2307   AliAnalysisTaskFragmentationFunction::SetProperties(fh2DeltaPt, xaxis, "#Delta p_{T}", "Entries");
2308   AliAnalysisTaskFragmentationFunction::SetProperties(fh2InBal, xaxis, "(p_{T}^{1}-p_{T}^{2})/(p_{T}^{1}+p_{T}^{2})", "Entries");
2309
2310 }
2311
2312 //________________________________________________________________________
2313 void AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::FillDiJetQA(Double_t invMass, Double_t deltaPhi, Double_t deltaEta,Double_t deltaPt, Double_t inbal, Double_t jetBin)
2314 {
2315   // fill dijet QA
2316
2317   fh2InvMass->Fill(jetBin, invMass);
2318   fh2DeltaPhi->Fill(jetBin, deltaPhi);
2319   fh2DeltaEta->Fill(jetBin, deltaEta);
2320   fh2DeltaPt->Fill(jetBin, deltaPt);
2321   fh2InBal->Fill(jetBin, inbal);
2322 }
2323
2324 //________________________________________________________________________
2325 void AliAnalysisTaskFragmentationFunction::AliFragFuncQADiJetHistos::AddToOutput(TList* list)const
2326 {
2327   // add histos to list
2328
2329   list->Add(fh2InvMass);
2330   list->Add(fh2DeltaPhi);
2331   list->Add(fh2DeltaEta);
2332   list->Add(fh2DeltaPt);
2333   list->Add(fh2InBal);
2334 }
2335
2336 //_________________________________________________________________________________
2337 void AliAnalysisTaskFragmentationFunction::AliFragFuncIntraJetHistos::AddToOutput(TList* list) const
2338 {
2339   // add histos to list
2340
2341   list->Add(fh2CosTheta);
2342   list->Add(fh2PtZ);
2343   list->Add(fh3ThetaZ);
2344   list->Add(fh3JtTheta);
2345   list->Add(fh3JtZ);
2346
2347 }
2348
2349 //_________________________________________________________________________________
2350 Bool_t AliAnalysisTaskFragmentationFunction::Notify()
2351 {
2352   //
2353   // Implemented Notify() to read the cross sections
2354   // and number of trials from pyxsec.root
2355   // (taken from AliAnalysisTaskJetSpectrum2)
2356   // 
2357   TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
2358   Float_t xsection = 0;
2359   Float_t ftrials  = 1;
2360
2361   fAvgTrials = 1;
2362   if(tree){
2363     TFile *curfile = tree->GetCurrentFile();
2364     if (!curfile) {
2365       Error("Notify","No current file");
2366       return kFALSE;
2367     }
2368     if(!fh1Xsec||!fh1Trials){
2369       Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
2370       return kFALSE;
2371     }
2372     AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
2373     fh1Xsec->Fill("<#sigma>",xsection);
2374     // construct a poor man average trials 
2375     Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
2376     if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
2377   }
2378
2379   // Set seed for backg study
2380   fRandom = new TRandom3();
2381   fRandom->SetSeed(0);
2382
2383   return kTRUE;
2384 }
2385
2386
2387
2388 //__________________________________________________________________
2389 void AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()
2390 {
2391   // create output objects
2392
2393   if(fDebug > 1) Printf("AliAnalysisTaskFragmentationFunction::UserCreateOutputObjects()");
2394  
2395   // create list of tracks and jets 
2396   
2397   fTracksRec = new TList();
2398   fTracksRec->SetOwner(kFALSE);  
2399
2400   fTracksRecCuts = new TList();
2401   fTracksRecCuts->SetOwner(kFALSE);  
2402
2403   fTracksGen = new TList();
2404   fTracksGen->SetOwner(kFALSE);
2405
2406   fTracksAODMCCharged = new TList();
2407   fTracksAODMCCharged->SetOwner(kFALSE);
2408     
2409   fTracksAODMCChargedSec = new TList();
2410   fTracksAODMCChargedSec->SetOwner(kFALSE);
2411
2412   fTracksRecQualityCuts = new TList(); 
2413   fTracksRecQualityCuts->SetOwner(kFALSE);
2414
2415   fJetsRec = new TList();
2416   fJetsRec->SetOwner(kFALSE);
2417   if(fBranchRecJets.Contains("KT") && fBckgSubMethod) fJetsRec->SetOwner(kTRUE);
2418
2419   fJetsRecCuts = new TList();
2420   fJetsRecCuts->SetOwner(kFALSE);
2421   if(fBranchRecJets.Contains("KT") && fBckgSubMethod) fJetsRecCuts->SetOwner(kTRUE);
2422
2423   fJetsGen = new TList();
2424   fJetsGen->SetOwner(kFALSE);
2425
2426   fJetsRecEff = new TList();
2427   fJetsRecEff->SetOwner(kFALSE);
2428
2429   fJetsEmbedded = new TList();
2430   fJetsEmbedded->SetOwner(kFALSE);
2431
2432   // fJetsKine = new TList();
2433   // fJetsKine->SetOwner(kTRUE); // delete AOD jets using mom from Kine Tree via TList::Clear()
2434
2435   if(fBckgMode && 
2436      (fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters ||  fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters ||
2437       fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
2438       fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading)){
2439     
2440     fBckgJetsRec = new TList();
2441     fBckgJetsRec->SetOwner(kFALSE);
2442
2443     fBckgJetsRecCuts = new TList();
2444     fBckgJetsRecCuts->SetOwner(kFALSE);
2445
2446     fBckgJetsGen = new TList();
2447     fBckgJetsGen->SetOwner(kFALSE);
2448   }
2449
2450   //
2451   // Create histograms / output container
2452   //
2453
2454   OpenFile(1);
2455   fCommonHistList = new TList();
2456   
2457   Bool_t oldStatus = TH1::AddDirectoryStatus();
2458   TH1::AddDirectory(kFALSE);
2459   
2460   
2461   // Histograms 
2462   fh1EvtSelection            = new TH1F("fh1EvtSelection", "Event Selection", 6, -0.5, 5.5);
2463   fh1EvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
2464   fh1EvtSelection->GetXaxis()->SetBinLabel(2,"event selection: rejected");
2465   fh1EvtSelection->GetXaxis()->SetBinLabel(3,"event class: rejected");
2466   fh1EvtSelection->GetXaxis()->SetBinLabel(4,"vertex Ncontr: rejected");
2467   fh1EvtSelection->GetXaxis()->SetBinLabel(5,"vertex z: rejected");
2468   fh1EvtSelection->GetXaxis()->SetBinLabel(6,"vertex type: rejected");
2469   
2470   fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 2500,-.5, 2499.5);
2471   fh1VertexZ                 = new TH1F("fh1VertexZ", "Vertex z distribution", 30, -15., 15.);
2472   fh1EvtMult                 = new TH1F("fh1EvtMult","Event multiplicity, track pT cut > 150 MeV/c, |#eta| < 0.9",120,0.,12000.);
2473   fh1EvtCent                 = new TH1F("fh1EvtCent","centrality",100,0.,100.);
2474   fh2TrackPtVsDCAXY          = new TH2F("fh2TrackPtVsDCAXY","",400,-0.02,0.02,100,0.,10.); 
2475   fh2TrackPtVsDCAZ           = new TH2F("fh2TrackPtVsDCAZ","",100,-0.050,0.050,100,0.,10.);
2476
2477   fh1Xsec                    = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
2478   fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
2479   fh1Trials                  = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1);
2480   fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
2481   fh1PtHard                  = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
2482   fh1PtHardTrials            = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
2483
2484   fh1nRecJetsCuts            = new TH1F("fh1nRecJetsCuts","reconstructed jets per event",10,-0.5,9.5);
2485   fh1nGenJets                = new TH1F("fh1nGenJets","generated jets per event",10,-0.5,9.5);
2486   fh1nRecEffJets             = new TH1F("fh1nRecEffJets","reconstruction effiency: jets per event",10,-0.5,9.5);
2487   fh1nEmbeddedJets           = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);
2488
2489   fh2PtRecVsGenPrim          = new TH2F("fh2PtRecVsGenPrim","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);
2490   fh2PtRecVsGenSec           = new TH2F("fh2PtRecVsGenSec","rec vs gen pt",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax);
2491
2492
2493   // Background
2494   if(fBckgMode) {
2495     if(fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters || 
2496        fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || 
2497        fBckgType[3]==kBckgClustersOutLeading || fBckgType[4]==kBckgClustersOutLeading){
2498       
2499       fh1nRecBckgJetsCuts        = new TH1F("fh1nRecBckgJetsCuts","reconstructed background jets per event",10,-0.5,9.5);
2500       fh1nGenBckgJets            = new TH1F("fh1nGenBckgJets","generated background jets per event",10,-0.5,9.5);
2501     }
2502
2503     if(fBckgType[0]==kBckgPerp || fBckgType[1]==kBckgPerp || fBckgType[2]==kBckgPerp || fBckgType[3]==kBckgPerp || fBckgType[4]==kBckgPerp )
2504       fh1PerpMult                = new TH1F("fh1PerpMult","Background multiplicity - Cone perpendicular to leading jet axis",500,0.,500.);
2505     if(fBckgType[0]==kBckgASide || fBckgType[1]==kBckgASide || fBckgType[2]==kBckgASide || fBckgType[3]==kBckgASide || fBckgType[4]==kBckgASide)
2506       fh1ASideMult               = new TH1F("fh1ASideMult","Background multiplicity - Cone in the away side of leading jet axis",500,0.,500.);
2507     if(fBckgType[0]==kBckgASideWindow || fBckgType[1]==kBckgASideWindow || fBckgType[2]==kBckgASideWindow || fBckgType[3]==kBckgASideWindow || fBckgType[4]==kBckgASideWindow)
2508       fh1ASideWindowMult         = new TH1F("fh1ASideWindowMult","Background multiplicity - Cone in the away side of leading jet axis",500,0.,500.);
2509     if(fBckgType[0]==kBckgPerpWindow || fBckgType[1]==kBckgPerpWindow || fBckgType[2]==kBckgPerpWindow || fBckgType[3]==kBckgPerpWindow || fBckgType[4]==kBckgPerpWindow)
2510       fh1PerpWindowMult         = new TH1F("fh1PerpWindowMult","Background multiplicity - Cone in the perp direction of leading jet axis",500,0.,500.);
2511     if(fBckgType[0]==kBckgOutLJ || fBckgType[1]==kBckgOutLJ || fBckgType[2]==kBckgOutLJ || fBckgType[3]==kBckgOutLJ || fBckgType[4]==kBckgOutLJ)
2512       fh1OutLeadingMult          = new TH1F("fh1OutLeadingMult","Background multiplicity - Cone outside leading jet",500,0,500.);
2513     if(fBckgType[0]==kBckgOutLJStat || fBckgType[1]==kBckgOutLJStat || fBckgType[2]==kBckgOutLJStat || fBckgType[3]==kBckgOutLJStat || fBckgType[4]==kBckgOutLJStat)
2514       fh1OutLeadingStatMult      = new TH1F("fh1OutLeadingStatMult","Background multiplicity - Cone outside leading jet",3000,0,3000.);
2515     if(fBckgType[0]==kBckgOut2J || fBckgType[1]==kBckgOut2J || fBckgType[2]==kBckgOut2J || fBckgType[3]==kBckgOut2J || fBckgType[4]==kBckgOut2J)
2516       fh1Out2JetsMult            = new TH1F("fh1Out2JetsMult","Background multiplicity - Cone outside 2 jets",500,0.,500.);
2517     if(fBckgType[0]==kBckgOut3J || fBckgType[1]==kBckgOut3J || fBckgType[2]==kBckgOut3J || fBckgType[3]==kBckgOut3J || fBckgType[4]==kBckgOut3J)
2518       fh1Out3JetsMult            = new TH1F("fh1Out3JetsMult","Background multiplicity - Cone outside 3 jets",500,0.,500.);
2519     if(fBckgType[0]==kBckgClusters || fBckgType[1]==kBckgClusters || fBckgType[2]==kBckgClusters || fBckgType[3]==kBckgClusters || fBckgType[4]==kBckgClusters)
2520       fh1MedianClustersMult  = new TH1F("fh1MedianClustersMult","Background multiplicity - median cluster",500,0.,500.);
2521     if(fBckgType[0]==kBckgClustersOutLeading || fBckgType[1]==kBckgClustersOutLeading || fBckgType[2]==kBckgClustersOutLeading || fBckgType[3]==kBckgClustersOutLeading 
2522        || fBckgType[4]==kBckgClustersOutLeading)
2523       fh1OutClustersMult            = new TH1F("fh1OutClustersMult","Background multiplicity - clusters outside leading jet",3000,0.,3000.);
2524   }
2525   
2526   // embedding
2527   if(fBranchEmbeddedJets.Length()){
2528     fh1FractionPtEmbedded         = new TH1F("fh1FractionPtEmbedded","",200,0,2);
2529     fh1IndexEmbedded              = new TH1F("fh1IndexEmbedded","",11,-1,10);
2530     fh2DeltaPtVsJetPtEmbedded     = new TH2F("fh2DeltaPtVsJetPtEmbedded","",250,0,250,200,-100,100);
2531     fh2DeltaPtVsRecJetPtEmbedded  = new TH2F("fh2DeltaPtVsRecJetPtEmbedded","",250,0,250,200,-100,100);
2532     fh1DeltaREmbedded             = new TH1F("fh1DeltaREmbedded","",50,0,0.5);
2533     fh1nEmbeddedJets              = new TH1F("fh1nEmbeddedJets","embedded jets per event",10,-0.5,9.5);
2534   }
2535
2536   if(fEffMode){
2537     fh2ptVsDistNN_pt50_rec          = new TH2F("fh2ptVsDistNN_pt50_rec","",200,0,0.2,500,0.,100);    
2538     fh2ptVsDistNN_pt50_nonRec       = new TH2F("fh2ptVsDistNN_pt50_nonRec","",200,0,0.2,500,0.,100);    
2539     fh2ptVsDistNN_pt10_rec          = new TH2F("fh2ptVsDistNN_pt10_rec","",200,0,0.2,500,0.,100);    
2540     fh2ptVsDistNN_pt10_nonRec       = new TH2F("fh2ptVsDistNN_pt10_nonRec","",200,0,0.2,500,0.,100);    
2541   }
2542
2543   if(fQAMode){
2544     if(fQAMode&1){ // track QA
2545       fQATrackHistosRec          = new AliFragFuncQATrackHistos("Rec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2546                                                                 fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2547                                                                 fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2548                                                                 fQATrackHighPtThreshold);
2549       fQATrackHistosRecCuts      = new AliFragFuncQATrackHistos("RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2550                                                                 fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2551                                                                 fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2552                                                                 fQATrackHighPtThreshold);
2553       fQATrackHistosGen          = new AliFragFuncQATrackHistos("Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2554                                                                 fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2555                                                                 fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2556                                                                 fQATrackHighPtThreshold);
2557     }
2558
2559     if(fQAMode&2){ // jet QA
2560       fQAJetHistosRec            = new AliFragFuncQAJetHistos("Rec", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2561                                                               fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
2562                                                               fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
2563       fQAJetHistosRecCuts        = new AliFragFuncQAJetHistos("RecCuts", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2564                                                               fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
2565                                                               fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
2566       fQAJetHistosRecCutsLeading = new AliFragFuncQAJetHistos("RecCutsLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2567                                                               fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
2568                                                               fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
2569       fQAJetHistosGen            = new AliFragFuncQAJetHistos("Gen", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2570                                                               fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
2571                                                               fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
2572       fQAJetHistosGenLeading     = new AliFragFuncQAJetHistos("GenLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2573                                                               fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,
2574                                                               fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);  
2575       if(fEffMode) fQAJetHistosRecEffLeading  = new AliFragFuncQAJetHistos("RecEffLeading", fQAJetNBinsPt, fQAJetPtMin, fQAJetPtMax, 
2576                                                                            fQAJetNBinsEta, fQAJetEtaMin, fQAJetEtaMax,fQAJetNBinsPhi, fQAJetPhiMin, fQAJetPhiMax);
2577     }
2578   } // end: QA
2579
2580   if(fFFMode){
2581     fFFHistosRecCuts         = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2582                                                      fFFNBinsPt, fFFPtMin, fFFPtMax, 
2583                                                      fFFNBinsXi, fFFXiMin, fFFXiMax,  
2584                                                      fFFNBinsZ , fFFZMin , fFFZMax);
2585     fFFHistosRecLeading        = new AliFragFuncHistos("RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2586                                                        fFFNBinsPt, fFFPtMin, fFFPtMax, 
2587                                                        fFFNBinsXi, fFFXiMin, fFFXiMax,  
2588                                                        fFFNBinsZ , fFFZMin , fFFZMax);
2589     fFFHistosRecLeadingTrack   = new AliFragFuncHistos("RecLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2590                                                        fFFNBinsPt, fFFPtMin, fFFPtMax, 
2591                                                        fFFNBinsXi, fFFXiMin, fFFXiMax,  
2592                                                        fFFNBinsZ , fFFZMin , fFFZMax);
2593     fFFHistosGen             = new AliFragFuncHistos("Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2594                                                      fFFNBinsPt, fFFPtMin, fFFPtMax, 
2595                                                      fFFNBinsXi, fFFXiMin, fFFXiMax,  
2596                                                      fFFNBinsZ , fFFZMin , fFFZMax);
2597     fFFHistosGenLeading        = new AliFragFuncHistos("GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2598                                                        fFFNBinsPt, fFFPtMin, fFFPtMax, 
2599                                                        fFFNBinsXi, fFFXiMin, fFFXiMax,  
2600                                                        fFFNBinsZ , fFFZMin , fFFZMax);
2601     fFFHistosGenLeadingTrack   = new AliFragFuncHistos("GenLeadingTrack", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2602                                                        fFFNBinsPt, fFFPtMin, fFFPtMax, 
2603                                                        fFFNBinsXi, fFFXiMin, fFFXiMax,  
2604                                                        fFFNBinsZ , fFFZMin , fFFZMax);
2605   } // end: FF
2606
2607   if(fIJMode)
2608     {
2609       fIJHistosRecCuts               = new AliFragFuncIntraJetHistos("RecCuts", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2610                                                                      fIJNBinsPt, fIJPtMin, fIJPtMax, 
2611                                                                      fIJNBinsZ, fIJZMin, fIJZMax,  
2612                                                                      fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2613                                                                      fIJNBinsTheta , fIJThetaMin , fIJThetaMax,
2614                                                                      fIJNBinsJt , fIJJtMin , fIJJtMax);
2615       fIJHistosRecLeading        = new AliFragFuncIntraJetHistos("RecLeading", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2616                                                                  fIJNBinsPt, fIJPtMin, fIJPtMax, 
2617                                                                  fIJNBinsZ, fIJZMin, fIJZMax,  
2618                                                                  fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2619                                                                  fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2620                                                                  fIJNBinsJt , fIJJtMin , fIJJtMax);
2621       fIJHistosRecLeadingTrack   = new AliFragFuncIntraJetHistos("RecLeadingTrack", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2622                                                                  fIJNBinsPt, fIJPtMin, fIJPtMax, 
2623                                                                  fIJNBinsZ, fIJZMin, fIJZMax,  
2624                                                                  fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2625                                                                  fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2626                                                                  fIJNBinsJt , fIJJtMin , fIJJtMax);
2627       fIJHistosGen           = new AliFragFuncIntraJetHistos("Gen", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2628                                                              fIJNBinsPt, fIJPtMin, fIJPtMax, 
2629                                                              fIJNBinsZ, fIJZMin, fIJZMax,  
2630                                                              fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2631                                                              fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2632                                                              fIJNBinsJt , fIJJtMin , fIJJtMax);
2633       fIJHistosGenLeading        = new AliFragFuncIntraJetHistos("GenLeading", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2634                                                                  fIJNBinsPt, fIJPtMin, fIJPtMax, 
2635                                                                  fIJNBinsZ, fIJZMin, fIJZMax,  
2636                                                                  fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2637                                                                  fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2638                                                                  fIJNBinsJt , fIJJtMin , fIJJtMax);
2639       fIJHistosGenLeadingTrack   = new AliFragFuncIntraJetHistos("GenLeadingTrack", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2640                                                                  fIJNBinsPt, fIJPtMin, fIJPtMax, 
2641                                                                  fIJNBinsZ, fIJZMin, fIJZMax,  
2642                                                                  fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2643                                                                  fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2644                                                                  fIJNBinsJt , fIJJtMin , fIJJtMax);
2645     } // end: intra-jet
2646   
2647   if(fDJMode){
2648     if(fDJMode&1){
2649       fFFDiJetHistosRecCuts         = new AliFragFuncDiJetHistos("RecCuts", fDiJetKindBins, 
2650                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2651                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax,
2652                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax, 
2653                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax, 
2654                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax);
2655       fFFDiJetHistosRecLeading      = new AliFragFuncDiJetHistos("RecLeading", fDiJetKindBins, 
2656                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2657                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax, 
2658                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax, 
2659                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax, 
2660                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax); 
2661       fFFDiJetHistosRecLeadingTrack = new AliFragFuncDiJetHistos("RecLeadingTrack", fDiJetKindBins, 
2662                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2663                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax, 
2664                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax, 
2665                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax, 
2666                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax);
2667       
2668       fFFDiJetHistosGen             = new AliFragFuncDiJetHistos("Gen", fDiJetKindBins, 
2669                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2670                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax,
2671                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax, 
2672                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax,
2673                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax);
2674       fFFDiJetHistosGenLeading      = new AliFragFuncDiJetHistos("GenLeading", fDiJetKindBins, 
2675                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2676                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax,
2677                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax,
2678                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax,
2679                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax);
2680       fFFDiJetHistosGenLeadingTrack = new AliFragFuncDiJetHistos("GenLeadingTrack", fDiJetKindBins, 
2681                                                                  fDiJetNBinsJetInvMass, fDiJetJetInvMassMin, fDiJetJetInvMassMax,
2682                                                                  fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax, 
2683                                                                  fDiJetNBinsPt, fDiJetPtMin, fDiJetPtMax, 
2684                                                                  fDiJetNBinsXi, fDiJetXiMin, fDiJetXiMax, 
2685                                                                  fDiJetNBinsZ, fDiJetZMin, fDiJetZMax);
2686     }
2687     
2688     if(fDJMode&2){
2689       fQADiJetHistosRecCuts = new AliFragFuncQADiJetHistos("RecCuts", fDiJetKindBins, 
2690                                                            fQADiJetNBinsInvMass, fQADiJetInvMassMin, fQADiJetInvMassMax,
2691                                                            fQADiJetNBinsJetPt, fQADiJetJetPtMin, fQADiJetJetPtMax,
2692                                                            fQADiJetNBinsDeltaPhi, fQADiJetDeltaPhiMin, fQADiJetDeltaPhiMax , 
2693                                                            fQADiJetNBinsDeltaEta, fQADiJetDeltaEtaMin, fQADiJetDeltaEtaMax , 
2694                                                            fQADiJetNBinsDeltaPt, fQADiJetDeltaPtMin, fQADiJetDeltaPtMax,
2695                                                            fQADiJetNBinsInBal, fQADiJetInBalMin, fQADiJetInBalMax);
2696       fQADiJetHistosGen     = new AliFragFuncQADiJetHistos("Gen", fDiJetKindBins, 
2697                                                            fQADiJetNBinsInvMass, fQADiJetInvMassMin,  fQADiJetInvMassMax, 
2698                                                            fDiJetNBinsJetPt, fDiJetJetPtMin, fDiJetJetPtMax,
2699                                                            fQADiJetNBinsDeltaPhi, fQADiJetDeltaPhiMin, fQADiJetDeltaPhiMax,
2700                                                            fQADiJetNBinsDeltaEta, fQADiJetDeltaEtaMin, fQADiJetDeltaEtaMax,
2701                                                            fQADiJetNBinsDeltaPt, fQADiJetDeltaPtMin, fQADiJetDeltaPtMax,
2702                                                            fQADiJetNBinsInBal, fQADiJetInBalMin, fQADiJetInBalMax);
2703     }
2704   } // end: di-jet
2705
2706   // efficiency
2707
2708   if(fEffMode){
2709     if(fQAMode&1){
2710       fQATrackHistosRecEffGen = new AliFragFuncQATrackHistos("RecEffGen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2711                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2712                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2713                                                              fQATrackHighPtThreshold);
2714       
2715       fQATrackHistosRecEffRec = new AliFragFuncQATrackHistos("RecEffRec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2716                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2717                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2718                                                              fQATrackHighPtThreshold);
2719
2720       fQATrackHistosSecRec    = new AliFragFuncQATrackHistos("SecRec", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2721                                                              fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2722                                                              fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2723                                                              fQATrackHighPtThreshold);
2724
2725
2726       Int_t    nBinsResponseSinglePt[2]     = {fFFNBinsPt, fFFNBinsPt};
2727       Double_t binMinResponseSinglePt[2]    = {fFFPtMin, fFFPtMin};
2728       Double_t binMaxResponseSinglePt[2]    = {fFFPtMax, fFFPtMax};
2729       const char* labelsResponseSinglePt[2] = {"rec p_{T} [GeV/c]", "gen p_{T} [GeV/c]"};
2730
2731       fhnResponseSinglePt  = new THnSparseF("fhnResponseSinglePt","track pt gen : track pt rec",2,
2732                                             nBinsResponseSinglePt,binMinResponseSinglePt,binMaxResponseSinglePt);
2733      
2734       AliAnalysisTaskFragmentationFunction::SetProperties(fhnResponseSinglePt,2,labelsResponseSinglePt);
2735
2736       // TH2F inv pt diff
2737       fh2SingleInvPtRecMnGenVsPtGen = new TH2F("fh2SingleInvPtRecMnGenVsPtGen","",fQATrackNBinsPt,fQATrackPtMin,fQATrackPtMax,200,-1,1);
2738     }
2739     if(fFFMode){
2740       fFFHistosRecEffGen      = new AliFragFuncHistos("RecEffGen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2741                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2742                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2743                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2744       
2745       fFFHistosRecEffRec      = new AliFragFuncHistos("RecEffRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2746                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2747                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2748                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2749
2750       fFFHistosSecRec         = new AliFragFuncHistos("SecRec", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2751                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2752                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2753                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2754
2755
2756       Int_t    nBinsResponseJetTrackPt[3]     = {fFFNBinsJetPt,fFFNBinsPt,fFFNBinsPt};
2757       Double_t binMinResponseJetTrackPt[3]    = {fFFJetPtMin,fFFPtMin, fFFPtMin};
2758       Double_t binMaxResponseJetTrackPt[3]    = {fFFJetPtMax,fFFPtMax,fFFPtMax};
2759       const char* labelsResponseJetTrackPt[3] = { "jet p_{T} [GeV/c]","rec p_{T} [GeV/c]", "gen p_{T} [GeV/c]"};
2760
2761       fhnResponseJetTrackPt  = new THnSparseF("fhnResponseJetTrackPt","jet pt:track pt rec:track pt gen",3,
2762                                               nBinsResponseJetTrackPt,binMinResponseJetTrackPt,binMaxResponseJetTrackPt);
2763      
2764       AliAnalysisTaskFragmentationFunction::SetProperties(fhnResponseJetTrackPt,3,labelsResponseJetTrackPt);
2765
2766       Int_t    nBinsResponseJetZ[3]     = {fFFNBinsJetPt, fFFNBinsZ,fFFNBinsZ};
2767       Double_t binMinResponseJetZ[3]    = {fFFJetPtMin, fFFZMin, fFFZMin};
2768       Double_t binMaxResponseJetZ[3]    = {fFFJetPtMax, fFFZMax, fFFZMax};
2769       const char* labelsResponseJetZ[3] = { "jet p_{T} [GeV/c]","rec z","gen z"};
2770
2771       fhnResponseJetZ  = new THnSparseF("fhnResponseJetZ","jet pt:track pt rec:track pt gen",3,
2772                                         nBinsResponseJetZ,binMinResponseJetZ,binMaxResponseJetZ);
2773       
2774       AliAnalysisTaskFragmentationFunction::SetProperties(fhnResponseJetZ,3,labelsResponseJetZ);
2775       
2776       Int_t    nBinsResponseJetXi[3]     = {fFFNBinsJetPt, fFFNBinsXi,fFFNBinsXi};
2777       Double_t binMinResponseJetXi[3]    = {fFFJetPtMin, fFFXiMin, fFFXiMin};
2778       Double_t binMaxResponseJetXi[3]    = {fFFJetPtMax, fFFXiMax, fFFXiMax};
2779       const char* labelsResponseJetXi[3] = { "jet p_{T} [GeV/c]","rec xi","gen xi"};
2780
2781       fhnResponseJetXi  = new THnSparseF("fhnResponseJetXi","jet pt:track xi rec:track xi gen",3,
2782                                         nBinsResponseJetXi,binMinResponseJetXi,binMaxResponseJetXi);
2783       
2784       AliAnalysisTaskFragmentationFunction::SetProperties(fhnResponseJetXi,3,labelsResponseJetXi);
2785
2786     }
2787   } // end: efficiency
2788
2789   // Background
2790   if(fBckgMode){
2791     // Track QA
2792     TString title[5];
2793     for(Int_t i=0; i<5; i++){
2794       if(fBckgType[i]==kBckgPerp) title[i]="Perp";
2795       else if(fBckgType[i]==kBckgPerpWindow) title[i]="PerpW";
2796       else if(fBckgType[i]==kBckgASide) title[i]="ASide";
2797       else if(fBckgType[i]==kBckgASideWindow) title[i]="ASideW";
2798       else if(fBckgType[i]==kBckgOutLJ) title[i]="OutLeadingJet";
2799       else if(fBckgType[i]==kBckgOut2J) title[i]="Out2Jets";
2800       else if(fBckgType[i]==kBckgOut3J) title[i]="Out3Jets";
2801       else if(fBckgType[i]==kBckgOutAJ) title[i]="AllJets";
2802       else if(fBckgType[i]==kBckgOutLJStat) title[i]="OutLeadingJetStat";
2803       else if(fBckgType[i]==kBckgOut2JStat) title[i]="Out2JetsStat";
2804       else if(fBckgType[i]==kBckgOut3JStat) title[i]="Out3JetsStat";
2805       else if(fBckgType[i]==kBckgOutAJStat) title[i]="AllJetsStat";
2806       else if(fBckgType[i]==kBckgClustersOutLeading) title[i]="OutClusters";
2807       else if(fBckgType[i]==kBckgClusters) title[i]="MedianClusters";
2808       else printf("Please chose background method number %d!",i);
2809     }
2810
2811     if(fQAMode&1){
2812       fQABckgHisto0RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[0]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2813                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2814                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2815                                                                fQATrackHighPtThreshold);
2816       fQABckgHisto0Gen          = new AliFragFuncQATrackHistos("Bckg"+title[0]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2817                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2818                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2819                                                                fQATrackHighPtThreshold);
2820       fQABckgHisto1RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[1]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2821                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2822                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2823                                                                fQATrackHighPtThreshold);
2824       fQABckgHisto1Gen          = new AliFragFuncQATrackHistos("Bckg"+title[1]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2825                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2826                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2827                                                                fQATrackHighPtThreshold);
2828       fQABckgHisto2RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[2]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2829                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2830                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2831                                                                fQATrackHighPtThreshold);
2832       fQABckgHisto2Gen          = new AliFragFuncQATrackHistos("Bckg"+title[2]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2833                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2834                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2835                                                                fQATrackHighPtThreshold);
2836       fQABckgHisto3RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[3]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2837                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2838                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2839                                                                fQATrackHighPtThreshold);
2840       fQABckgHisto3Gen          = new AliFragFuncQATrackHistos("Bckg"+title[3]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2841                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2842                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2843                                                                fQATrackHighPtThreshold);
2844       fQABckgHisto4RecCuts      = new AliFragFuncQATrackHistos("Bckg"+title[4]+"RecCuts", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2845                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2846                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2847                                                                fQATrackHighPtThreshold);
2848       fQABckgHisto4Gen          = new AliFragFuncQATrackHistos("Bckg"+title[4]+"Gen", fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
2849                                                                fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
2850                                                                fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
2851                                                                fQATrackHighPtThreshold);
2852
2853
2854     } // end: background QA
2855
2856     if(fFFMode){
2857       // outside leading jet or 2 jets or more
2858       fFFBckgHisto0RecCuts    = new AliFragFuncHistos("Bckg"+title[0]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2859                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2860                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2861                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2862       fFFBckgHisto0RecLeading = new AliFragFuncHistos("Bckg"+title[0]+"RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2863                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2864                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2865                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2866       fFFBckgHisto0Gen        = new AliFragFuncHistos("Bckg"+title[0]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2867                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2868                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2869                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2870       fFFBckgHisto0GenLeading = new AliFragFuncHistos("Bckg"+title[0]+"GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2871                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2872                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2873                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2874       
2875       fFFBckgHisto1RecCuts    = new AliFragFuncHistos("Bckg"+title[1]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2876                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2877                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2878                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2879       fFFBckgHisto1RecLeading = new AliFragFuncHistos("Bckg"+title[1]+"RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2880                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2881                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2882                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2883       fFFBckgHisto1Gen        = new AliFragFuncHistos("Bckg"+title[1]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2884                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2885                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2886                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2887       fFFBckgHisto1GenLeading = new AliFragFuncHistos("Bckg"+title[1]+"GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2888                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2889                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2890                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2891       
2892       fFFBckgHisto2RecCuts    = new AliFragFuncHistos("Bckg"+title[2]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2893                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2894                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2895                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2896       fFFBckgHisto2RecLeading = new AliFragFuncHistos("Bckg"+title[2]+"RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2897                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2898                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2899                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2900       fFFBckgHisto2Gen        = new AliFragFuncHistos("Bckg"+title[2]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2901                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2902                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2903                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2904       fFFBckgHisto2GenLeading = new AliFragFuncHistos("Bckg"+title[2]+"GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2905                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2906                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2907                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2908       fFFBckgHisto3RecCuts    = new AliFragFuncHistos("Bckg"+title[3]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2909                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2910                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2911                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2912       fFFBckgHisto3RecLeading = new AliFragFuncHistos("Bckg"+title[3]+"RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2913                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2914                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2915                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2916       fFFBckgHisto3Gen        = new AliFragFuncHistos("Bckg"+title[3]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2917                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2918                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2919                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2920       fFFBckgHisto3GenLeading = new AliFragFuncHistos("Bckg"+title[3]+"GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2921                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2922                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2923                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2924       fFFBckgHisto4RecCuts    = new AliFragFuncHistos("Bckg"+title[4]+"RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2925                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2926                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2927                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2928       fFFBckgHisto4RecLeading = new AliFragFuncHistos("Bckg"+title[4]+"RecLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2929                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2930                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2931                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2932       fFFBckgHisto4Gen        = new AliFragFuncHistos("Bckg"+title[4]+"Gen", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2933                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2934                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2935                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2936       fFFBckgHisto4GenLeading = new AliFragFuncHistos("Bckg"+title[4]+"GenLeading", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
2937                                                       fFFNBinsPt, fFFPtMin, fFFPtMax, 
2938                                                       fFFNBinsXi, fFFXiMin, fFFXiMax,  
2939                                                       fFFNBinsZ , fFFZMin , fFFZMax);
2940
2941     } // end: background FF
2942
2943     if(fIJMode){    
2944       fIJBckgHisto0RecCuts           = new AliFragFuncIntraJetHistos("Bckg"+title[0]+"RecCuts", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2945                                                                      fIJNBinsPt, fIJPtMin, fIJPtMax, 
2946                                                                      fIJNBinsZ, fIJZMin, fIJZMax,  
2947                                                                      fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2948                                                                      fIJNBinsTheta , fIJThetaMin , fIJThetaMax,
2949                                                                      fIJNBinsJt , fIJJtMin , fIJJtMax);
2950       fIJBckgHisto0RecLeading        = new AliFragFuncIntraJetHistos("Bckg"+title[0]+"RecLeading", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2951                                                                      fIJNBinsPt, fIJPtMin, fIJPtMax, 
2952                                                                      fIJNBinsZ, fIJZMin, fIJZMax,  
2953                                                                      fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2954                                                                      fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2955                                                                      fIJNBinsJt , fIJJtMin , fIJJtMax);
2956       fIJBckgHisto0Gen               = new AliFragFuncIntraJetHistos("Bckg"+title[0]+"Gen", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2957                                                                      fIJNBinsPt, fIJPtMin, fIJPtMax, 
2958                                                                      fIJNBinsZ, fIJZMin, fIJZMax,  
2959                                                                      fIJNBinsCosTheta , fIJCosThetaMin , fIJCosThetaMax, 
2960                                                                      fIJNBinsTheta , fIJThetaMin , fIJThetaMax, 
2961                                                                      fIJNBinsJt , fIJJtMin , fIJJtMax);
2962       fIJBckgHisto0GenLeading        = new AliFragFuncIntraJetHistos("Bckg"+title[0]+"GenLeading", fIJNBinsJetPt, fIJJetPtMin, fIJJetPtMax, 
2963                                                                        fIJNBinsPt, fIJPtMin, fIJPtMax,