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