0b436825d3d308c50805c5eff578eb1ca1b7f46f
[u/mrichter/AliRoot.git] / PWGJE / StrangenessInJets / AliAnalysisTaskJetChem.cxx
1 /*************************************************************************
2  *                                                                       *
3  *                                                                       *
4  *      Task for Jet Chemistry Analysis in PWG4 Jet Task Force Train     *
5  *    Analysis of K0s, Lambda and Antilambda with and without Jetevents  *
6  *                                                                       *
7  *************************************************************************/
8
9 /**************************************************************************
10  * Copyright(c) 1998-2012, ALICE Experiment at CERN, All rights reserved. *
11  *                                                                        *
12  * Author: The ALICE Off-line Project.                                    *
13  * Contributors are mentioned in the code where appropriate.              *
14  *                                                                        *
15  * Permission to use, copy, modify and distribute this software and its   *
16  * documentation strictly for non-commercial purposes is hereby grante    *
17  *                                                                        *
18  * without fee, provided that the above copyright notice appears in all   *
19  * copies and that both the copyright notice and this permission notice   *
20  * appear in the supporting documentation. The authors make no claims     *
21  * about the suitability of this software for any purpose. It is          *
22  * provided "as is" without express or implied warranty.                  *
23  **************************************************************************/
24 //Task for K0s, Lambda and Antilambda analysis in jets
25 //Author: Alice Zimmermann (zimmermann@physi.uni-heidelberg.de)
26   
27
28 /* $Id: */
29
30 #include <iostream>
31 #include "TH2.h"
32 #include "TH3.h"
33 #include "TH2F.h"
34 #include "TH3F.h"
35 #include "TH2D.h"
36 #include "TH3D.h"
37 #include "TChain.h"
38 #include "TTree.h"
39 #include "TList.h"
40 #include "TCanvas.h"
41 #include "TPDGCode.h"
42 #include "TProfile.h"
43 #include "THnSparse.h"
44 #include <algorithm>
45 #include <string> 
46 #include "AliAnalysisHelperJetTasks.h"
47 #include "TDatabasePDG.h"
48 #include "TPDGCode.h"
49 #include "AliAnalysisManager.h"
50 #include "AliAODHandler.h" 
51 #include "AliAODInputHandler.h" 
52 #include "AliESDEvent.h"
53 #include "AliGenPythiaEventHeader.h"
54 #include "AliGenHijingEventHeader.h"
55 #include "AliGenEventHeader.h"
56 #include "TLorentzVector.h"
57 #include "AliAODEvent.h"
58 #include "AliAODJet.h"
59 #include "AliAODv0.h"
60 #include "AliAODTrack.h"
61 #include "AliCentrality.h"
62 #include "AliAnalysisTaskSE.h"
63 #include "AliESDtrack.h"
64 #include "AliESDtrackCuts.h"
65 #include "AliESDEvent.h"
66 #include "AliESDInputHandler.h"
67 #include "AliPID.h" 
68 #include "AliPIDResponse.h"
69 #include "AliAODPid.h"
70 #include "AliExternalTrackParam.h"
71 #include "AliAnalysisTaskJetChem.h"
72 #include "AliPhysicsSelection.h"
73 #include "AliBackgroundSelection.h"
74 #include "AliInputEventHandler.h"
75 #include "AliAODMCHeader.h"
76 #include "AliAODPid.h"
77 #include "AliVEvent.h"
78 #include "AliAODMCParticle.h"
79 #include "TVector3.h"
80 #include "TRandom3.h"
81
82 ClassImp(AliAnalysisTaskJetChem)
83
84 //____________________________________________________________________________
85 AliAnalysisTaskJetChem::AliAnalysisTaskJetChem()
86    : AliAnalysisTaskFragmentationFunction()
87  
88    ,fRandom(0)
89    ,fAnalysisMC(0)
90    ,fDeltaVertexZ(0)
91    ,fCutjetEta(0)
92    ,fCuttrackNegNcls(0)
93    ,fCuttrackPosNcls(0)
94    ,fCutPostrackRap(0)
95    ,fCutNegtrackRap(0)
96    ,fCutRap(0)
97    ,fCutPostrackEta(0)
98    ,fCutNegtrackEta(0)
99    ,fCutEta(0)
100    ,fCutV0cosPointAngle(0)
101    ,fKinkDaughters(0)
102    ,fRequireTPCRefit(0)
103    ,fCutArmenteros(0)
104    ,fCutV0DecayMin(0)
105    ,fCutV0DecayMax(0)
106    ,fCutV0totMom(0)
107    ,fCutDcaV0Daughters(0)
108    ,fCutDcaPosToPrimVertex(0)
109    ,fCutDcaNegToPrimVertex(0)
110    ,fCutV0RadiusMin(0)
111    ,fCutV0RadiusMax(0)
112    ,fCutBetheBloch(0)
113    ,fCutRatio(0)
114    ,fK0Type(0)  
115    ,fFilterMaskK0(0)
116    ,jettracklist(0)
117    ,jetConeK0list(0)
118    ,jetConeLalist(0)
119    ,jetConeALalist(0)
120    ,jetPerpConeK0list(0)
121    ,jetPerpConeLalist(0)
122    ,jetPerpConeALalist(0)
123    ,jetMedianConeK0list(0)
124    ,jetMedianConeLalist(0)
125    ,jetMedianConeALalist(0)
126    ,fListK0sRC(0)
127    ,fListLaRC(0)
128    ,fListALaRC(0)
129    ,fListK0s(0)
130    ,fPIDResponse(0)
131    ,fV0QAK0(0)
132    ,fFFHistosRecCutsK0Evt(0)      
133   //,fFFHistosIMK0AllEvt(0)        
134   //,fFFHistosIMK0Jet(0)           
135   //,fFFHistosIMK0Cone(0)
136    ,fLaType(0) 
137    ,fFilterMaskLa(0)
138    ,fListLa(0)
139   // ,fFFHistosIMLaAllEvt(0)        
140   // ,fFFHistosIMLaJet(0)           
141   //,fFFHistosIMLaCone(0)
142    ,fALaType(0) 
143    ,fFilterMaskALa(0)
144    ,fListALa(0)
145    ,fListFeeddownLaCand(0)
146    ,fListFeeddownALaCand(0)
147    ,jetConeFDLalist(0)
148    ,jetConeFDALalist(0)
149    ,fListMCgenK0s(0)
150    ,fListMCgenLa(0)
151    ,fListMCgenALa(0)
152    ,fListMCgenK0sCone(0)
153    ,fListMCgenLaCone(0)
154    ,fListMCgenALaCone(0)
155    ,IsArmenterosSelected(0)
156   // ,fFFHistosIMALaAllEvt(0)        
157   // ,fFFHistosIMALaJet(0)           
158   // ,fFFHistosIMALaCone(0)
159    ,fFFIMNBinsJetPt(0)  
160    ,fFFIMJetPtMin(0) 
161    ,fFFIMJetPtMax(0)
162    ,fFFIMNBinsInvM(0) 
163    ,fFFIMInvMMin(0)   
164    ,fFFIMInvMMax(0)   
165    ,fFFIMNBinsPt(0)      
166    ,fFFIMPtMin(0)        
167    ,fFFIMPtMax(0)        
168    ,fFFIMNBinsXi(0)      
169    ,fFFIMXiMin(0)        
170    ,fFFIMXiMax(0)        
171    ,fFFIMNBinsZ(0)       
172    ,fFFIMZMin(0)         
173    ,fFFIMZMax(0)
174    ,fFFIMLaNBinsJetPt(0)    
175    ,fFFIMLaJetPtMin(0) 
176    ,fFFIMLaJetPtMax(0)
177    ,fFFIMLaNBinsInvM(0) 
178    ,fFFIMLaInvMMin(0)   
179    ,fFFIMLaInvMMax(0)   
180    ,fFFIMLaNBinsPt(0)      
181    ,fFFIMLaPtMin(0)        
182    ,fFFIMLaPtMax(0)        
183    ,fFFIMLaNBinsXi(0)      
184    ,fFFIMLaXiMin(0)        
185    ,fFFIMLaXiMax(0)        
186    ,fFFIMLaNBinsZ(0)       
187    ,fFFIMLaZMin(0)         
188    ,fFFIMLaZMax(0)
189    ,fh1EvtAllCent(0)
190    ,fh1Evt(0)
191    ,fh1K0Mult(0)
192    ,fh1dPhiJetK0(0)
193    ,fh1LaMult(0)
194    ,fh1dPhiJetLa(0)
195    ,fh1ALaMult(0)
196    ,fh1dPhiJetALa(0)
197    ,fh1JetEta(0)         
198    ,fh1JetPhi(0)                 
199    ,fh2JetEtaPhi(0)
200   //,fh1V0JetPt(0)
201    ,fh1IMK0Cone(0)
202    ,fh1IMLaCone(0)
203    ,fh1IMALaCone(0) 
204    ,fh2FFJetTrackEta(0)
205   //,fh1trackPosNCls(0)           
206   //,fh1trackNegNCls(0)   
207    ,fh1trackPosRap(0)            
208    ,fh1trackNegRap(0)          
209   //,fh1V0Rap(0)        
210    ,fh1trackPosEta(0)            
211    ,fh1trackNegEta(0)          
212    ,fh1V0Eta(0)
213   //,fh1V0totMom(0)           
214    ,fh1CosPointAngle(0)           
215    ,fh1DecayLengthV0(0)    
216    ,fh2ProperLifetimeK0sVsPtBeforeCut(0)    
217    ,fh2ProperLifetimeK0sVsPtAfterCut(0)
218    ,fh1V0Radius(0)     
219    ,fh1DcaV0Daughters(0)        
220    ,fh1DcaPosToPrimVertex(0)   
221    ,fh1DcaNegToPrimVertex(0)    
222    ,fh2ArmenterosBeforeCuts(0)
223    ,fh2ArmenterosAfterCuts(0)
224    ,fh2BBLaPos(0)
225    ,fh2BBLaNeg(0)
226    ,fh1PosDaughterCharge(0)
227    ,fh1NegDaughterCharge(0)
228    ,fh1PtMCK0s(0)
229    ,fh1PtMCLa(0)
230    ,fh1PtMCALa(0)
231    ,fh1EtaK0s(0)
232    ,fh1EtaLa(0)
233    ,fh1EtaALa(0)
234    ,fh1RC(0)
235    ,fh1RCBiasK0(0)
236    ,fh1RCBiasLa(0)
237    ,fh1RCBiasALa(0)
238    ,fh1MCC(0)
239    ,fh1OC(0)
240    ,fh1NJ(0)
241    ,fhnInvMassEtaTrackPtK0s(0)
242    ,fhnInvMassEtaTrackPtLa(0)
243    ,fhnInvMassEtaTrackPtALa(0)
244    ,fh1TrackMultCone(0)
245    ,fh2TrackMultCone(0)
246    ,fhnNJK0(0)
247    ,fhnNJLa(0)
248    ,fhnNJALa(0)
249   // ,fh2MCgenK0Cone(0)
250   // ,fh2MCgenLaCone(0)
251   // ,fh2MCgenALaCone(0) 
252   // ,fh2MCEtagenK0Cone(0)
253   // ,fh2MCEtagenLaCone(0)
254   // ,fh2MCEtagenALaCone(0)
255    ,fh2CorrHijingLaProton(0)
256    ,fh2CorrInjectLaProton(0)
257    ,fh2CorrHijingALaAProton(0)
258    ,fh2CorrInjectALaAProton(0)
259    ,fh1IMK0ConeSmear(0)
260    ,fh1IMLaConeSmear(0)
261    ,fh1IMALaConeSmear(0)
262    ,fh2MCEtaVsPtHijingLa(0)
263    ,fh2MCEtaVsPtInjectLa(0)
264    ,fh2MCEtaVsPtHijingALa(0)
265    ,fh2MCEtaVsPtInjectALa(0)
266    ,fhnrecMCHijingLaIncl(0)
267    ,fhnrecMCHijingLaCone(0)
268    ,fhnrecMCHijingALaIncl(0)
269    ,fhnrecMCHijingALaCone(0)
270    ,fhnrecMCInjectLaIncl(0)
271    ,fhnrecMCInjectLaCone(0)
272    ,fhnrecMCInjectALaIncl(0)
273    ,fhnrecMCInjectALaCone(0)
274    ,fhnMCrecK0Cone(0)   
275    ,fhnMCrecLaCone(0)   
276    ,fhnMCrecALaCone(0)
277    ,fhnMCrecK0ConeSmear(0) 
278    ,fhnMCrecLaConeSmear(0)   
279    ,fhnMCrecALaConeSmear(0)
280    ,fhnK0sSecContinCone(0)
281    ,fhnLaSecContinCone(0)
282    ,fhnALaSecContinCone(0)
283    ,fhnK0sIncl(0)
284    ,fhnK0sCone(0)
285    ,fhnLaIncl(0)
286    ,fhnLaCone(0)
287    ,fhnALaIncl(0)
288    ,fhnALaCone(0)
289    ,fhnK0sPC(0)
290    ,fhnLaPC(0)
291    ,fhnALaPC(0)
292    ,fhnK0sMCC(0)
293    ,fhnLaMCC(0)
294    ,fhnALaMCC(0)
295    ,fhnK0sRC(0)
296    ,fhnLaRC(0)
297    ,fhnALaRC(0)
298    ,fhnK0sRCBias(0)
299    ,fhnLaRCBias(0)
300    ,fhnALaRCBias(0)
301    ,fhnK0sOC(0)
302    ,fhnLaOC(0)
303    ,fhnALaOC(0)
304    ,fh1AreaExcluded(0)
305    ,fh1MedianEta(0)
306    ,fh1JetPtMedian(0)
307    ,fh1MCMultiplicityPrimary(0)
308    ,fh1MCMultiplicityTracks(0)
309    ,fhnFeedDownLa(0)
310    ,fhnFeedDownALa(0)
311    ,fhnFeedDownLaCone(0)
312    ,fhnFeedDownALaCone(0)
313    ,fh1MCProdRadiusK0s(0)
314    ,fh1MCProdRadiusLambda(0)
315    ,fh1MCProdRadiusAntiLambda(0)
316    ,fh1MCPtV0s(0)
317    ,fh1MCPtK0s(0) 
318    ,fh1MCPtLambda(0) 
319    ,fh1MCPtAntiLambda(0) 
320    ,fh1MCXiPt(0)
321    ,fh1MCXibarPt(0)
322    ,fh2MCEtaVsPtK0s(0)
323    ,fh2MCEtaVsPtLa(0)
324    ,fh2MCEtaVsPtALa(0)
325   //,fh1MCRapK0s(0) 
326   //,fh1MCRapLambda(0)
327   //,fh1MCRapAntiLambda(0)
328    ,fh1MCEtaAllK0s(0) 
329    ,fh1MCEtaK0s(0) 
330    ,fh1MCEtaLambda(0)
331    ,fh1MCEtaAntiLambda(0)
332
333 {
334    // default constructor
335 }
336
337 //__________________________________________________________________________________________
338 AliAnalysisTaskJetChem::AliAnalysisTaskJetChem(const char *name) 
339   : AliAnalysisTaskFragmentationFunction(name)
340
341   ,fRandom(0)
342   ,fAnalysisMC(0)
343   ,fDeltaVertexZ(0)
344   ,fCutjetEta(0)
345   ,fCuttrackNegNcls(0)
346   ,fCuttrackPosNcls(0)
347   ,fCutPostrackRap(0)
348   ,fCutNegtrackRap(0)
349   ,fCutRap(0)
350   ,fCutPostrackEta(0)
351   ,fCutNegtrackEta(0)
352   ,fCutEta(0)
353   ,fCutV0cosPointAngle(0)
354   ,fKinkDaughters(0)
355   ,fRequireTPCRefit(0)
356   ,fCutArmenteros(0)
357   ,fCutV0DecayMin(0)
358   ,fCutV0DecayMax(0)
359   ,fCutV0totMom(0)
360   ,fCutDcaV0Daughters(0)
361   ,fCutDcaPosToPrimVertex(0)
362   ,fCutDcaNegToPrimVertex(0)
363   ,fCutV0RadiusMin(0)
364   ,fCutV0RadiusMax(0)
365   ,fCutBetheBloch(0)
366   ,fCutRatio(0)  
367   ,fK0Type(0)  
368   ,fFilterMaskK0(0)
369   ,jettracklist(0)
370   ,jetConeK0list(0)
371   ,jetConeLalist(0)
372   ,jetConeALalist(0)
373   ,jetPerpConeK0list(0)
374   ,jetPerpConeLalist(0)
375   ,jetPerpConeALalist(0)
376   ,jetMedianConeK0list(0)
377   ,jetMedianConeLalist(0)
378   ,jetMedianConeALalist(0)
379   ,fListK0sRC(0)
380   ,fListLaRC(0)
381   ,fListALaRC(0)
382   ,fListK0s(0)
383   ,fPIDResponse(0)
384   ,fV0QAK0(0)
385   ,fFFHistosRecCutsK0Evt(0)      
386     //,fFFHistosIMK0AllEvt(0)        
387     //,fFFHistosIMK0Jet(0)           
388     //,fFFHistosIMK0Cone(0)
389   ,fLaType(0)  
390   ,fFilterMaskLa(0)
391   ,fListLa(0)
392     //,fFFHistosIMLaAllEvt(0)        
393     //,fFFHistosIMLaJet(0)           
394     //,fFFHistosIMLaCone(0)
395   ,fALaType(0)  
396   ,fFilterMaskALa(0)
397   ,fListALa(0)
398   ,fListFeeddownLaCand(0)
399   ,fListFeeddownALaCand(0)
400   ,jetConeFDLalist(0)
401   ,jetConeFDALalist(0)
402   ,fListMCgenK0s(0)
403   ,fListMCgenLa(0)
404   ,fListMCgenALa(0)
405   ,fListMCgenK0sCone(0)
406   ,fListMCgenLaCone(0)
407   ,fListMCgenALaCone(0)
408   ,IsArmenterosSelected(0)
409     //,fFFHistosIMALaAllEvt(0)        
410     //,fFFHistosIMALaJet(0)           
411     // ,fFFHistosIMALaCone(0)
412   ,fFFIMNBinsJetPt(0)    
413   ,fFFIMJetPtMin(0) 
414   ,fFFIMJetPtMax(0)
415   ,fFFIMNBinsInvM(0) 
416   ,fFFIMInvMMin(0)   
417   ,fFFIMInvMMax(0)   
418   ,fFFIMNBinsPt(0)      
419   ,fFFIMPtMin(0)        
420   ,fFFIMPtMax(0)        
421   ,fFFIMNBinsXi(0)      
422   ,fFFIMXiMin(0)        
423   ,fFFIMXiMax(0)        
424   ,fFFIMNBinsZ(0)       
425   ,fFFIMZMin(0)         
426   ,fFFIMZMax(0) 
427   ,fFFIMLaNBinsJetPt(0)    
428   ,fFFIMLaJetPtMin(0) 
429   ,fFFIMLaJetPtMax(0)
430   ,fFFIMLaNBinsInvM(0) 
431   ,fFFIMLaInvMMin(0)   
432   ,fFFIMLaInvMMax(0)   
433   ,fFFIMLaNBinsPt(0)      
434   ,fFFIMLaPtMin(0)        
435   ,fFFIMLaPtMax(0)        
436   ,fFFIMLaNBinsXi(0)      
437   ,fFFIMLaXiMin(0)        
438   ,fFFIMLaXiMax(0)        
439   ,fFFIMLaNBinsZ(0)       
440   ,fFFIMLaZMin(0)         
441   ,fFFIMLaZMax(0)
442   ,fh1EvtAllCent(0)
443   ,fh1Evt(0)
444   ,fh1K0Mult(0)
445   ,fh1dPhiJetK0(0) 
446   ,fh1LaMult(0)
447   ,fh1dPhiJetLa(0) 
448   ,fh1ALaMult(0)
449   ,fh1dPhiJetALa(0)  
450   ,fh1JetEta(0)         
451   ,fh1JetPhi(0)                 
452   ,fh2JetEtaPhi(0)
453     //  ,fh1V0JetPt(0)
454   ,fh1IMK0Cone(0)
455   ,fh1IMLaCone(0)
456   ,fh1IMALaCone(0)
457   ,fh2FFJetTrackEta(0)  
458     //  ,fh1trackPosNCls(0)           
459     // ,fh1trackNegNCls(0) 
460   ,fh1trackPosRap(0)            
461   ,fh1trackNegRap(0)          
462     //,fh1V0Rap(0)          
463   ,fh1trackPosEta(0)            
464   ,fh1trackNegEta(0)          
465   ,fh1V0Eta(0)  
466     // ,fh1V0totMom(0)            
467   ,fh1CosPointAngle(0)        
468   ,fh1DecayLengthV0(0) 
469   ,fh2ProperLifetimeK0sVsPtBeforeCut(0)  
470   ,fh2ProperLifetimeK0sVsPtAfterCut(0)            
471   ,fh1V0Radius(0)       
472   ,fh1DcaV0Daughters(0)        
473   ,fh1DcaPosToPrimVertex(0)   
474   ,fh1DcaNegToPrimVertex(0)    
475   ,fh2ArmenterosBeforeCuts(0)
476   ,fh2ArmenterosAfterCuts(0)
477   ,fh2BBLaPos(0)
478   ,fh2BBLaNeg(0)
479   ,fh1PosDaughterCharge(0)
480   ,fh1NegDaughterCharge(0)
481   ,fh1PtMCK0s(0)
482   ,fh1PtMCLa(0)
483   ,fh1PtMCALa(0)
484   ,fh1EtaK0s(0)
485   ,fh1EtaLa(0)
486   ,fh1EtaALa(0)
487   ,fh1RC(0)
488   ,fh1RCBiasK0(0)
489   ,fh1RCBiasLa(0)
490   ,fh1RCBiasALa(0)
491   ,fh1MCC(0)
492   ,fh1OC(0)
493   ,fh1NJ(0)
494   ,fhnInvMassEtaTrackPtK0s(0)
495   ,fhnInvMassEtaTrackPtLa(0)
496   ,fhnInvMassEtaTrackPtALa(0)
497   ,fh1TrackMultCone(0)
498   ,fh2TrackMultCone(0)
499   ,fhnNJK0(0)
500   ,fhnNJLa(0)
501   ,fhnNJALa(0)
502     //,fh2MCgenK0Cone(0)
503     //,fh2MCgenLaCone(0)
504     //,fh2MCgenALaCone(0)
505     //,fh2MCEtagenK0Cone(0)
506     //,fh2MCEtagenLaCone(0)
507     //,fh2MCEtagenALaCone(0)
508   ,fh2CorrHijingLaProton(0)
509   ,fh2CorrInjectLaProton(0)
510   ,fh2CorrHijingALaAProton(0)
511   ,fh2CorrInjectALaAProton(0)
512   ,fh1IMK0ConeSmear(0)
513   ,fh1IMLaConeSmear(0)
514   ,fh1IMALaConeSmear(0) 
515   ,fh2MCEtaVsPtHijingLa(0)
516   ,fh2MCEtaVsPtInjectLa(0)
517   ,fh2MCEtaVsPtHijingALa(0)
518   ,fh2MCEtaVsPtInjectALa(0) 
519   ,fhnrecMCHijingLaIncl(0)
520   ,fhnrecMCHijingLaCone(0)
521   ,fhnrecMCHijingALaIncl(0)
522   ,fhnrecMCHijingALaCone(0)
523   ,fhnrecMCInjectLaIncl(0)
524   ,fhnrecMCInjectLaCone(0)
525   ,fhnrecMCInjectALaIncl(0)
526   ,fhnrecMCInjectALaCone(0)
527   ,fhnMCrecK0Cone(0)
528   ,fhnMCrecLaCone(0)
529   ,fhnMCrecALaCone(0) 
530   ,fhnMCrecK0ConeSmear(0) 
531   ,fhnMCrecLaConeSmear(0)   
532   ,fhnMCrecALaConeSmear(0)
533   ,fhnK0sSecContinCone(0)
534   ,fhnLaSecContinCone(0)
535   ,fhnALaSecContinCone(0)
536   ,fhnK0sIncl(0)
537   ,fhnK0sCone(0)
538   ,fhnLaIncl(0)
539   ,fhnLaCone(0)
540   ,fhnALaIncl(0)
541   ,fhnALaCone(0)
542   ,fhnK0sPC(0)
543   ,fhnLaPC(0)
544   ,fhnALaPC(0)
545   ,fhnK0sMCC(0)
546   ,fhnLaMCC(0)
547   ,fhnALaMCC(0)
548   ,fhnK0sRC(0)
549   ,fhnLaRC(0)
550   ,fhnALaRC(0)
551   ,fhnK0sRCBias(0)
552   ,fhnLaRCBias(0)
553   ,fhnALaRCBias(0)
554   ,fhnK0sOC(0)
555   ,fhnLaOC(0)
556   ,fhnALaOC(0)
557   ,fh1AreaExcluded(0)
558   ,fh1MedianEta(0)
559   ,fh1JetPtMedian(0)
560   ,fh1MCMultiplicityPrimary(0)
561   ,fh1MCMultiplicityTracks(0)
562   ,fhnFeedDownLa(0)
563   ,fhnFeedDownALa(0)
564   ,fhnFeedDownLaCone(0)
565   ,fhnFeedDownALaCone(0)
566   ,fh1MCProdRadiusK0s(0)
567   ,fh1MCProdRadiusLambda(0)
568   ,fh1MCProdRadiusAntiLambda(0)
569   ,fh1MCPtV0s(0)
570   ,fh1MCPtK0s(0)
571   ,fh1MCPtLambda(0) 
572   ,fh1MCPtAntiLambda(0) 
573   ,fh1MCXiPt(0)
574   ,fh1MCXibarPt(0)
575   ,fh2MCEtaVsPtK0s(0)
576   ,fh2MCEtaVsPtLa(0)
577   ,fh2MCEtaVsPtALa(0)
578     //,fh1MCRapK0s(0) 
579     //,fh1MCRapLambda(0)
580     //,fh1MCRapAntiLambda(0)
581   ,fh1MCEtaAllK0s(0) 
582   ,fh1MCEtaK0s(0) 
583   ,fh1MCEtaLambda(0)
584   ,fh1MCEtaAntiLambda(0)
585
586
587 {
588   // constructor
589   
590   DefineOutput(1,TList::Class());  
591 }
592
593 //__________________________________________________________________________________________________________________________
594 AliAnalysisTaskJetChem::AliAnalysisTaskJetChem(const  AliAnalysisTaskJetChem &copy)
595   : AliAnalysisTaskFragmentationFunction()
596   
597   ,fRandom(copy.fRandom)
598   ,fAnalysisMC(copy.fAnalysisMC)
599   ,fDeltaVertexZ(copy.fDeltaVertexZ)
600   ,fCutjetEta(copy.fCutjetEta)
601   ,fCuttrackNegNcls(copy.fCuttrackNegNcls)
602   ,fCuttrackPosNcls(copy.fCuttrackPosNcls)
603   ,fCutPostrackRap(copy.fCutPostrackRap)
604   ,fCutNegtrackRap(copy.fCutNegtrackRap)
605   ,fCutRap(copy.fCutRap)
606   ,fCutPostrackEta(copy.fCutPostrackEta)
607   ,fCutNegtrackEta(copy.fCutNegtrackEta)
608   ,fCutEta(copy.fCutEta)
609   ,fCutV0cosPointAngle(copy.fCutV0cosPointAngle)
610   ,fKinkDaughters(copy.fKinkDaughters)
611   ,fRequireTPCRefit(copy.fRequireTPCRefit)
612   ,fCutArmenteros(copy.fCutArmenteros)
613   ,fCutV0DecayMin(copy.fCutV0DecayMin)
614   ,fCutV0DecayMax(copy.fCutV0DecayMax)
615   ,fCutV0totMom(copy.fCutV0totMom)
616   ,fCutDcaV0Daughters(copy.fCutDcaV0Daughters)
617   ,fCutDcaPosToPrimVertex(copy.fCutDcaPosToPrimVertex)
618   ,fCutDcaNegToPrimVertex(copy.fCutDcaNegToPrimVertex)
619   ,fCutV0RadiusMin(copy.fCutV0RadiusMin)
620   ,fCutV0RadiusMax(copy.fCutV0RadiusMax)
621   ,fCutBetheBloch(copy.fCutBetheBloch)
622   ,fCutRatio(copy.fCutRatio)
623   ,fK0Type(copy.fK0Type)              
624   ,fFilterMaskK0(copy.fFilterMaskK0)
625   ,jettracklist(copy.jettracklist)
626   ,jetConeK0list(copy.jetConeK0list)
627   ,jetConeLalist(copy.jetConeLalist)
628   ,jetConeALalist(copy.jetConeALalist)
629   ,jetPerpConeK0list(copy.jetPerpConeK0list)
630   ,jetPerpConeLalist(copy.jetPerpConeLalist)
631   ,jetPerpConeALalist(copy.jetPerpConeALalist)
632   ,jetMedianConeK0list(copy.jetMedianConeK0list)
633   ,jetMedianConeLalist(copy.jetMedianConeLalist)
634   ,jetMedianConeALalist(copy.jetMedianConeALalist)
635   ,fListK0sRC(copy.fListK0sRC)
636   ,fListLaRC(copy.fListLaRC)
637   ,fListALaRC(copy.fListALaRC)
638   ,fListK0s(copy.fListK0s)
639   ,fPIDResponse(copy.fPIDResponse)
640   ,fV0QAK0(copy.fV0QAK0)
641   ,fFFHistosRecCutsK0Evt(copy.fFFHistosRecCutsK0Evt)      
642     //,fFFHistosIMK0AllEvt(copy.fFFHistosIMK0AllEvt)        
643     //,fFFHistosIMK0Jet(copy.fFFHistosIMK0Jet)           
644     //,fFFHistosIMK0Cone(copy.fFFHistosIMK0Cone)          
645   ,fLaType(copy.fLaType)                  
646   ,fFilterMaskLa(copy.fFilterMaskLa)
647   ,fListLa(copy.fListLa)
648     //,fFFHistosIMLaAllEvt(copy.fFFHistosIMLaAllEvt)        
649     //,fFFHistosIMLaJet(copy.fFFHistosIMLaJet)           
650     //,fFFHistosIMLaCone(copy.fFFHistosIMLaCone)          
651   ,fALaType(copy.fALaType)                 
652   ,fFilterMaskALa(copy.fFilterMaskALa)
653   ,fListALa(copy.fListALa)
654   ,fListFeeddownLaCand(copy.fListFeeddownLaCand)
655   ,fListFeeddownALaCand(copy.fListFeeddownALaCand)
656   ,jetConeFDLalist(copy.jetConeFDLalist)
657   ,jetConeFDALalist(copy.jetConeFDALalist)
658   ,fListMCgenK0s(copy.fListMCgenK0s)
659   ,fListMCgenLa(copy.fListMCgenLa)
660   ,fListMCgenALa(copy.fListMCgenALa)
661   ,fListMCgenK0sCone(copy.fListMCgenK0sCone)
662   ,fListMCgenLaCone(copy.fListMCgenLaCone)
663   ,fListMCgenALaCone(copy.fListMCgenALaCone)
664   ,IsArmenterosSelected(copy.IsArmenterosSelected)
665     //,fFFHistosIMALaAllEvt(copy.fFFHistosIMALaAllEvt)        
666     //,fFFHistosIMALaJet(copy.fFFHistosIMALaJet)           
667     //,fFFHistosIMALaCone(copy.fFFHistosIMALaCone)          
668   ,fFFIMNBinsJetPt(copy.fFFIMNBinsJetPt) 
669   ,fFFIMJetPtMin(copy.fFFIMJetPtMin)     
670   ,fFFIMJetPtMax(copy.fFFIMJetPtMax)     
671   ,fFFIMNBinsInvM(copy.fFFIMNBinsInvM)  
672   ,fFFIMInvMMin(copy.fFFIMInvMMin)    
673   ,fFFIMInvMMax(copy.fFFIMInvMMax)    
674   ,fFFIMNBinsPt(copy.fFFIMNBinsPt)      
675   ,fFFIMPtMin(copy.fFFIMPtMin)        
676   ,fFFIMPtMax(copy.fFFIMPtMax)        
677   ,fFFIMNBinsXi(copy.fFFIMNBinsXi)      
678   ,fFFIMXiMin(copy.fFFIMXiMin)        
679   ,fFFIMXiMax(copy.fFFIMXiMax)        
680   ,fFFIMNBinsZ(copy.fFFIMNBinsZ)       
681   ,fFFIMZMin(copy.fFFIMZMin)         
682   ,fFFIMZMax(copy.fFFIMZMax) 
683   ,fFFIMLaNBinsJetPt(copy.fFFIMLaNBinsJetPt)   
684   ,fFFIMLaJetPtMin(copy.fFFIMLaJetPtMin)     
685   ,fFFIMLaJetPtMax(copy.fFFIMLaJetPtMax)     
686   ,fFFIMLaNBinsInvM(copy.fFFIMLaNBinsInvM)  
687   ,fFFIMLaInvMMin(copy.fFFIMLaInvMMin)    
688   ,fFFIMLaInvMMax(copy.fFFIMLaInvMMax)    
689   ,fFFIMLaNBinsPt(copy.fFFIMLaNBinsPt)      
690   ,fFFIMLaPtMin(copy.fFFIMLaPtMin)        
691   ,fFFIMLaPtMax(copy.fFFIMLaPtMax)        
692   ,fFFIMLaNBinsXi(copy.fFFIMLaNBinsXi)      
693   ,fFFIMLaXiMin(copy.fFFIMLaXiMin)        
694   ,fFFIMLaXiMax(copy.fFFIMLaXiMax)        
695   ,fFFIMLaNBinsZ(copy.fFFIMLaNBinsZ)       
696   ,fFFIMLaZMin(copy.fFFIMLaZMin)         
697   ,fFFIMLaZMax(copy.fFFIMLaZMax) 
698   ,fh1EvtAllCent(copy.fh1EvtAllCent)
699   ,fh1Evt(copy.fh1Evt)
700   ,fh1K0Mult(copy.fh1K0Mult)
701   ,fh1dPhiJetK0(copy.fh1dPhiJetK0)
702   ,fh1LaMult(copy.fh1LaMult)
703   ,fh1dPhiJetLa(copy.fh1dPhiJetLa)
704   ,fh1ALaMult(copy.fh1ALaMult)
705   ,fh1dPhiJetALa(copy.fh1dPhiJetALa)
706   ,fh1JetEta(copy.fh1JetEta)         
707   ,fh1JetPhi(copy.fh1JetPhi)                 
708   ,fh2JetEtaPhi(copy.fh2JetEtaPhi)
709     //,fh1V0JetPt(copy.fh1V0JetPt)
710   ,fh1IMK0Cone(copy.fh1IMK0Cone)
711   ,fh1IMLaCone(copy.fh1IMLaCone)
712   ,fh1IMALaCone(copy.fh1IMALaCone)
713   ,fh2FFJetTrackEta(copy.fh2FFJetTrackEta) 
714     //,fh1trackPosNCls(copy.fh1trackPosNCls)           
715     //,fh1trackNegNCls(copy.fh1trackNegNCls)
716   ,fh1trackPosRap(copy.fh1trackPosRap)            
717   ,fh1trackNegRap(copy.fh1trackNegRap)          
718     //,fh1V0Rap(copy.fh1V0Rap)         
719   ,fh1trackPosEta(copy.fh1trackPosEta)            
720   ,fh1trackNegEta(copy.fh1trackNegEta)          
721   ,fh1V0Eta(copy.fh1V0Eta)   
722     //,fh1V0totMom(copy.fh1V0totMom)           
723   ,fh1CosPointAngle(copy.fh1CosPointAngle)           
724   ,fh1DecayLengthV0(copy.fh1DecayLengthV0)  
725   ,fh2ProperLifetimeK0sVsPtBeforeCut(copy.fh2ProperLifetimeK0sVsPtBeforeCut)  
726   ,fh2ProperLifetimeK0sVsPtAfterCut(copy.fh2ProperLifetimeK0sVsPtAfterCut)    
727   ,fh1V0Radius(copy.fh1V0Radius)          
728   ,fh1DcaV0Daughters(copy.fh1DcaV0Daughters)        
729   ,fh1DcaPosToPrimVertex(copy.fh1DcaPosToPrimVertex)   
730   ,fh1DcaNegToPrimVertex(copy.fh1DcaNegToPrimVertex)    
731   ,fh2ArmenterosBeforeCuts(copy.fh2ArmenterosBeforeCuts)
732   ,fh2ArmenterosAfterCuts(copy.fh2ArmenterosAfterCuts)
733   ,fh2BBLaPos(copy.fh2BBLaPos)
734   ,fh2BBLaNeg(copy.fh2BBLaPos)
735   ,fh1PosDaughterCharge(copy.fh1PosDaughterCharge)
736   ,fh1NegDaughterCharge(copy.fh1NegDaughterCharge)
737   ,fh1PtMCK0s(copy.fh1PtMCK0s)
738   ,fh1PtMCLa(copy.fh1PtMCLa)
739   ,fh1PtMCALa(copy.fh1PtMCALa)
740   ,fh1EtaK0s(copy.fh1EtaK0s)
741   ,fh1EtaLa(copy.fh1EtaLa)
742   ,fh1EtaALa(copy.fh1EtaALa)
743   ,fh1RC(copy.fh1RC)
744   ,fh1RCBiasK0(copy.fh1RCBiasK0)
745   ,fh1RCBiasLa(copy.fh1RCBiasLa)
746   ,fh1RCBiasALa(copy.fh1RCBiasALa)
747   ,fh1MCC(copy.fh1MCC)
748   ,fh1OC(copy.fh1OC)
749   ,fh1NJ(copy.fh1NJ)
750   ,fhnInvMassEtaTrackPtK0s(copy.fhnInvMassEtaTrackPtK0s)
751   ,fhnInvMassEtaTrackPtLa(copy.fhnInvMassEtaTrackPtLa)
752   ,fhnInvMassEtaTrackPtALa(copy.fhnInvMassEtaTrackPtALa)
753   ,fh1TrackMultCone(copy.fh1TrackMultCone)
754   ,fh2TrackMultCone(copy.fh2TrackMultCone)
755   ,fhnNJK0(copy.fhnNJK0)
756   ,fhnNJLa(copy.fhnNJLa)
757   ,fhnNJALa(copy.fhnNJALa)
758     //,fh2MCgenK0Cone(copy.fh2MCgenK0Cone)
759     //,fh2MCgenLaCone(copy.fh2MCgenLaCone)
760     //,fh2MCgenALaCone(copy.fh2MCgenALaCone)
761     //,fh2MCEtagenK0Cone(copy.fh2MCEtagenK0Cone)
762     //,fh2MCEtagenLaCone(copy.fh2MCEtagenLaCone)
763     //,fh2MCEtagenALaCone(copy.fh2MCEtagenALaCone)
764   ,fh2CorrHijingLaProton(copy.fh2CorrHijingLaProton)
765   ,fh2CorrInjectLaProton(copy.fh2CorrInjectLaProton)
766   ,fh2CorrHijingALaAProton(copy.fh2CorrHijingALaAProton)
767   ,fh2CorrInjectALaAProton(copy.fh2CorrInjectALaAProton)
768   ,fh1IMK0ConeSmear(copy.fh1IMK0ConeSmear)
769   ,fh1IMLaConeSmear(copy.fh1IMLaConeSmear)
770   ,fh1IMALaConeSmear(copy.fh1IMALaConeSmear)
771   ,fh2MCEtaVsPtHijingLa(copy.fh2MCEtaVsPtHijingLa)
772   ,fh2MCEtaVsPtInjectLa(copy.fh2MCEtaVsPtInjectLa)
773   ,fh2MCEtaVsPtHijingALa(copy.fh2MCEtaVsPtHijingALa)
774   ,fh2MCEtaVsPtInjectALa(copy.fh2MCEtaVsPtInjectALa)
775   ,fhnrecMCHijingLaIncl(copy.fhnrecMCHijingLaIncl)
776   ,fhnrecMCHijingLaCone(copy.fhnrecMCHijingLaCone)
777   ,fhnrecMCHijingALaIncl(copy.fhnrecMCHijingALaIncl)
778   ,fhnrecMCHijingALaCone(copy.fhnrecMCHijingALaCone)
779   ,fhnrecMCInjectLaIncl(copy.fhnrecMCInjectLaIncl)
780   ,fhnrecMCInjectLaCone(copy.fhnrecMCInjectLaCone)
781   ,fhnrecMCInjectALaIncl(copy.fhnrecMCInjectALaIncl)
782   ,fhnrecMCInjectALaCone(copy.fhnrecMCInjectALaCone)   
783   ,fhnMCrecK0Cone(copy.fhnMCrecK0Cone)
784   ,fhnMCrecLaCone(copy.fhnMCrecLaCone)
785   ,fhnMCrecALaCone(copy.fhnMCrecALaCone) 
786   ,fhnMCrecK0ConeSmear(copy.fhnMCrecK0ConeSmear)
787   ,fhnMCrecLaConeSmear(copy.fhnMCrecLaConeSmear)
788   ,fhnMCrecALaConeSmear(copy.fhnMCrecALaConeSmear)
789   ,fhnK0sSecContinCone(copy.fhnK0sSecContinCone)
790   ,fhnLaSecContinCone(copy.fhnLaSecContinCone)
791   ,fhnALaSecContinCone(copy.fhnALaSecContinCone)
792   ,fhnK0sIncl(copy.fhnK0sIncl)
793   ,fhnK0sCone(copy.fhnK0sCone)
794   ,fhnLaIncl(copy.fhnLaIncl)
795   ,fhnLaCone(copy.fhnLaCone)
796   ,fhnALaIncl(copy.fhnALaIncl)
797   ,fhnALaCone(copy.fhnALaCone)
798   ,fhnK0sPC(copy.fhnK0sPC)
799   ,fhnLaPC(copy.fhnLaPC)
800   ,fhnALaPC(copy.fhnALaPC)
801   ,fhnK0sMCC(copy.fhnK0sMCC)
802   ,fhnLaMCC(copy.fhnLaMCC)
803   ,fhnALaMCC(copy.fhnALaMCC)
804   ,fhnK0sRC(copy.fhnK0sRC)
805   ,fhnLaRC(copy.fhnLaRC)
806   ,fhnALaRC(copy.fhnALaRC)
807   ,fhnK0sRCBias(copy.fhnK0sRCBias)
808   ,fhnLaRCBias(copy.fhnLaRCBias)
809   ,fhnALaRCBias(copy.fhnALaRCBias)
810   ,fhnK0sOC(copy.fhnK0sOC)
811   ,fhnLaOC(copy.fhnLaOC)
812   ,fhnALaOC(copy.fhnALaOC)
813   ,fh1AreaExcluded(copy.fh1AreaExcluded)
814   ,fh1MedianEta(copy.fh1MedianEta)
815   ,fh1JetPtMedian(copy.fh1JetPtMedian)
816   ,fh1MCMultiplicityPrimary(copy.fh1MCMultiplicityPrimary)
817   ,fh1MCMultiplicityTracks(copy.fh1MCMultiplicityTracks)
818   ,fhnFeedDownLa(copy.fhnFeedDownLa)
819   ,fhnFeedDownALa(copy.fhnFeedDownALa)
820   ,fhnFeedDownLaCone(copy.fhnFeedDownLaCone)
821   ,fhnFeedDownALaCone(copy.fhnFeedDownALaCone)
822   ,fh1MCProdRadiusK0s(copy.fh1MCProdRadiusK0s)
823   ,fh1MCProdRadiusLambda(copy.fh1MCProdRadiusLambda)
824   ,fh1MCProdRadiusAntiLambda(copy.fh1MCProdRadiusAntiLambda)
825   ,fh1MCPtV0s(copy.fh1MCPtV0s)
826   ,fh1MCPtK0s(copy.fh1MCPtK0s) 
827   ,fh1MCPtLambda(copy.fh1MCPtLambda) 
828   ,fh1MCPtAntiLambda(copy.fh1MCPtAntiLambda) 
829   ,fh1MCXiPt(copy.fh1MCXiPt)
830   ,fh1MCXibarPt(copy.fh1MCXibarPt)
831   ,fh2MCEtaVsPtK0s(copy.fh2MCEtaVsPtK0s)
832   ,fh2MCEtaVsPtLa(copy.fh2MCEtaVsPtLa)
833   ,fh2MCEtaVsPtALa(copy.fh2MCEtaVsPtALa)
834     //,fh1MCRapK0s(copy.fh1MCRapK0s) 
835     //,fh1MCRapLambda(copy.fh1MCRapLambda)
836     //,fh1MCRapAntiLambda(copy.fh1MCRapAntiLambda)
837   ,fh1MCEtaAllK0s(copy.fh1MCEtaAllK0s) 
838   ,fh1MCEtaK0s(copy.fh1MCEtaK0s) 
839   ,fh1MCEtaLambda(copy.fh1MCEtaLambda)
840   ,fh1MCEtaAntiLambda(copy.fh1MCEtaAntiLambda)
841
842 {
843   // copy constructor
844   
845 }
846
847 // _________________________________________________________________________________________________________________________________
848 AliAnalysisTaskJetChem& AliAnalysisTaskJetChem::operator=(const AliAnalysisTaskJetChem& o)
849 {
850   // assignment
851   
852   if(this!=&o){
853     AliAnalysisTaskFragmentationFunction::operator=(o);
854
855     fRandom                         = o.fRandom; 
856     fAnalysisMC                     = o.fAnalysisMC;
857     fDeltaVertexZ                   = o.fDeltaVertexZ;
858     fCutjetEta                      = o.fCutjetEta;
859     fCuttrackNegNcls                = o.fCuttrackNegNcls;
860     fCuttrackPosNcls                = o.fCuttrackPosNcls;
861     fCutPostrackRap                 = o.fCutPostrackRap;
862     fCutNegtrackRap                 = o.fCutNegtrackRap;  
863     fCutRap                         = o.fCutRap;
864     fCutPostrackEta                 = o.fCutPostrackEta;
865     fCutNegtrackEta                 = o.fCutNegtrackEta;  
866     fCutEta                         = o.fCutEta;
867     fCutV0cosPointAngle             = o.fCutV0cosPointAngle;
868     fKinkDaughters                  = o.fKinkDaughters;
869     fRequireTPCRefit                = o.fRequireTPCRefit;
870     fCutArmenteros                  = o.fCutArmenteros;
871     fCutV0DecayMin                  = o.fCutV0DecayMin;
872     fCutV0DecayMax                  = o.fCutV0DecayMax;
873     fCutV0totMom                    = o.fCutV0totMom;
874     fCutDcaV0Daughters              = o.fCutDcaV0Daughters;
875     fCutDcaPosToPrimVertex          = o.fCutDcaPosToPrimVertex;
876     fCutDcaNegToPrimVertex          = o.fCutDcaNegToPrimVertex;
877     fCutV0RadiusMin                 = o.fCutV0RadiusMin;
878     fCutV0RadiusMax                 = o.fCutV0RadiusMax;
879     fCutBetheBloch                  = o.fCutBetheBloch; 
880     fCutRatio                       = o.fCutRatio;
881     fK0Type                         = o.fK0Type;
882     fFilterMaskK0                   = o.fFilterMaskK0;
883     jettracklist                    = o.jettracklist;
884     jetConeK0list                   = o.jetConeK0list;
885     jetConeLalist                   = o.jetConeLalist;
886     jetConeALalist                  = o.jetConeALalist;
887     jetPerpConeK0list               = o.jetPerpConeK0list;
888     jetPerpConeLalist               = o.jetPerpConeLalist;
889     jetPerpConeALalist              = o.jetPerpConeALalist;
890     jetMedianConeK0list             = o.jetMedianConeK0list;
891     jetMedianConeLalist             = o.jetMedianConeLalist;
892     jetMedianConeALalist            = o.jetMedianConeALalist;
893     fListK0sRC                      = o.fListK0sRC;
894     fListLaRC                       = o.fListLaRC;
895     fListALaRC                      = o.fListALaRC;
896     fListK0s                        = o.fListK0s;
897     fPIDResponse                    = o.fPIDResponse;
898     fV0QAK0                         = o.fV0QAK0;
899     fFFHistosRecCutsK0Evt           = o.fFFHistosRecCutsK0Evt;      
900     //fFFHistosIMK0AllEvt             = o.fFFHistosIMK0AllEvt;        
901     //fFFHistosIMK0Jet                = o.fFFHistosIMK0Jet;           
902     //fFFHistosIMK0Cone               = o.fFFHistosIMK0Cone;          
903     fLaType                         = o.fLaType;
904     fFilterMaskLa                   = o.fFilterMaskLa;
905     fListLa                         = o.fListLa;
906     //fFFHistosIMLaAllEvt             = o.fFFHistosIMLaAllEvt;        
907     //fFFHistosIMLaJet                = o.fFFHistosIMLaJet;           
908     //fFFHistosIMLaCone               = o.fFFHistosIMLaCone;          
909     fALaType                        = o.fALaType;
910     fFilterMaskALa                  = o.fFilterMaskALa;
911     fListFeeddownLaCand             = o.fListFeeddownLaCand;
912     fListFeeddownALaCand            = o.fListFeeddownALaCand;
913     jetConeFDLalist                 = o.jetConeFDLalist;
914     jetConeFDALalist                = o.jetConeFDALalist;
915     fListMCgenK0s                   = o.fListMCgenK0s;
916     fListMCgenLa                    = o.fListMCgenLa;
917     fListMCgenALa                   = o.fListMCgenALa;
918     fListMCgenK0sCone               = o.fListMCgenK0sCone;
919     fListMCgenLaCone                = o.fListMCgenLaCone;
920     fListMCgenALaCone               = o.fListMCgenALaCone;
921     IsArmenterosSelected            = o.IsArmenterosSelected;
922     // fFFHistosIMALaAllEvt            = o.fFFHistosIMALaAllEvt;        
923     // fFFHistosIMALaJet               = o.fFFHistosIMALaJet;           
924     // fFFHistosIMALaCone              = o.fFFHistosIMALaCone;          
925     fFFIMNBinsJetPt                 = o.fFFIMNBinsJetPt;   
926     fFFIMJetPtMin                   = o.fFFIMJetPtMin; 
927     fFFIMJetPtMax                   = o.fFFIMJetPtMax;
928     fFFIMNBinsPt                    = o.fFFIMNBinsPt;      
929     fFFIMPtMin                      = o.fFFIMPtMin;        
930     fFFIMPtMax                      = o.fFFIMPtMax;        
931     fFFIMNBinsXi                    = o.fFFIMNBinsXi;      
932     fFFIMXiMin                      = o.fFFIMXiMin;        
933     fFFIMXiMax                      = o.fFFIMXiMax;        
934     fFFIMNBinsZ                     = o.fFFIMNBinsZ;       
935     fFFIMZMin                       = o.fFFIMZMin;         
936     fFFIMZMax                       = o.fFFIMZMax;  
937     fFFIMLaNBinsJetPt               = o.fFFIMLaNBinsJetPt;    
938     fFFIMLaJetPtMin                 = o.fFFIMLaJetPtMin; 
939     fFFIMLaJetPtMax                 = o.fFFIMLaJetPtMax;
940     fFFIMLaNBinsPt                  = o.fFFIMLaNBinsPt;      
941     fFFIMLaPtMin                    = o.fFFIMLaPtMin;        
942     fFFIMLaPtMax                    = o.fFFIMLaPtMax;        
943     fFFIMLaNBinsXi                  = o.fFFIMLaNBinsXi;      
944     fFFIMLaXiMin                    = o.fFFIMLaXiMin;        
945     fFFIMLaXiMax                    = o.fFFIMLaXiMax;        
946     fFFIMLaNBinsZ                   = o.fFFIMLaNBinsZ;       
947     fFFIMLaZMin                     = o.fFFIMLaZMin;         
948     fFFIMLaZMax                     = o.fFFIMLaZMax;
949     fh1EvtAllCent                   = o.fh1EvtAllCent;
950     fh1Evt                          = o.fh1Evt;
951     fh1K0Mult                       = o.fh1K0Mult;
952     fh1dPhiJetK0                    = o.fh1dPhiJetK0;
953     fh1LaMult                       = o.fh1LaMult;
954     fh1dPhiJetLa                    = o.fh1dPhiJetLa;
955     fh1ALaMult                      = o.fh1ALaMult;
956     fh1dPhiJetALa                   = o.fh1dPhiJetALa;
957     fh1JetEta                       = o.fh1JetEta;         
958     fh1JetPhi                       = o.fh1JetPhi;                 
959     fh2JetEtaPhi                    = o.fh2JetEtaPhi;
960     //fh1V0JetPt                     = o.fh1V0JetPt;
961     fh1IMK0Cone                     = o.fh1IMK0Cone;
962     fh1IMLaCone                     = o.fh1IMLaCone;
963     fh1IMALaCone                    = o.fh1IMALaCone;
964     fh2FFJetTrackEta                = o.fh2FFJetTrackEta; 
965     //fh1trackPosNCls                 = o.fh1trackPosNCls;           
966     //fh1trackNegNCls                 = o.fh1trackNegNCls;    
967     fh1trackPosRap                  = o.fh1trackPosRap;            
968     fh1trackNegRap                  = o.fh1trackNegRap;        
969     //fh1V0Rap                        = o.fh1V0Rap;        
970     fh1trackPosEta                  = o.fh1trackPosEta;            
971     fh1trackNegEta                  = o.fh1trackNegEta;        
972     fh1V0Eta                        = o.fh1V0Eta;  
973     // fh1V0totMom                     = o.fh1V0totMom;            
974     fh1CosPointAngle                = o.fh1CosPointAngle;                      
975     fh1DecayLengthV0                = o.fh1DecayLengthV0;  
976     fh2ProperLifetimeK0sVsPtBeforeCut = o.fh2ProperLifetimeK0sVsPtBeforeCut;
977     fh2ProperLifetimeK0sVsPtAfterCut= o.fh2ProperLifetimeK0sVsPtAfterCut; 
978     fh1V0Radius                     = o.fh1V0Radius;         
979     fh1DcaV0Daughters               = o.fh1DcaV0Daughters;        
980     fh1DcaPosToPrimVertex           = o.fh1DcaPosToPrimVertex;   
981     fh1DcaNegToPrimVertex           = o.fh1DcaNegToPrimVertex;    
982     fh2ArmenterosBeforeCuts         = o.fh2ArmenterosBeforeCuts;
983     fh2ArmenterosAfterCuts          = o.fh2ArmenterosAfterCuts;
984     fh2BBLaPos                      = o.fh2BBLaPos;
985     fh2BBLaNeg                      = o.fh2BBLaPos;
986     fh1PosDaughterCharge            = o.fh1PosDaughterCharge;
987     fh1NegDaughterCharge            = o.fh1NegDaughterCharge;
988     fh1PtMCK0s                      = o.fh1PtMCK0s;
989     fh1PtMCLa                       = o.fh1PtMCLa;
990     fh1PtMCALa                      = o.fh1PtMCALa;
991     fh1EtaK0s                       = o.fh1EtaK0s;
992     fh1EtaLa                        = o.fh1EtaLa;
993     fh1EtaALa                       = o.fh1EtaALa;
994     fh1RC                           = o.fh1RC;
995     fh1RCBiasK0                     = o.fh1RCBiasK0;
996     fh1RCBiasLa                     = o.fh1RCBiasLa;
997     fh1RCBiasALa                    = o.fh1RCBiasALa;
998     fh1MCC                          = o.fh1MCC;
999     fh1OC                           = o.fh1OC;
1000     fh1NJ                           = o.fh1NJ;
1001     fhnInvMassEtaTrackPtK0s         = o.fhnInvMassEtaTrackPtK0s;
1002     fhnInvMassEtaTrackPtLa          = o.fhnInvMassEtaTrackPtLa;
1003     fhnInvMassEtaTrackPtALa         = o.fhnInvMassEtaTrackPtALa;
1004     fh1TrackMultCone                = o.fh1TrackMultCone;
1005     fh2TrackMultCone                = o.fh2TrackMultCone;
1006     fhnNJK0                         = o.fhnNJK0;
1007     fhnNJLa                         = o.fhnNJLa;
1008     fhnNJALa                        = o.fhnNJALa;
1009     //fh2MCgenK0Cone                  = o.fh2MCgenK0Cone;
1010     //fh2MCgenLaCone                  = o.fh2MCgenLaCone;
1011     //fh2MCgenALaCone                 = o.fh2MCgenALaCone; 
1012     //fh2MCEtagenK0Cone               = o.fh2MCEtagenK0Cone;
1013     //fh2MCEtagenLaCone               = o.fh2MCEtagenLaCone;
1014     //fh2MCEtagenALaCone              = o.fh2MCEtagenALaCone;
1015     fh1IMK0ConeSmear                = o.fh1IMK0ConeSmear;
1016     fh1IMLaConeSmear                = o.fh1IMLaConeSmear;
1017     fh1IMALaConeSmear               = o.fh1IMALaConeSmear;
1018     fh2MCEtaVsPtHijingLa            = o.fh2MCEtaVsPtHijingLa;
1019     fh2MCEtaVsPtInjectLa            = o.fh2MCEtaVsPtInjectLa;
1020     fh2MCEtaVsPtHijingALa           = o.fh2MCEtaVsPtHijingALa;
1021     fh2MCEtaVsPtInjectALa           = o.fh2MCEtaVsPtInjectALa;
1022     fhnrecMCHijingLaIncl            = o.fhnrecMCHijingLaIncl;
1023     fhnrecMCHijingLaCone            = o.fhnrecMCHijingLaCone;
1024     fhnrecMCHijingALaIncl           = o.fhnrecMCHijingALaIncl;
1025     fhnrecMCHijingALaCone           = o.fhnrecMCHijingALaCone;
1026     fhnrecMCInjectLaIncl            = o.fhnrecMCInjectLaIncl;
1027     fhnrecMCInjectLaCone            = o.fhnrecMCInjectLaCone;
1028     fhnrecMCInjectALaIncl           = o.fhnrecMCInjectALaIncl;
1029     fhnrecMCInjectALaCone           = o.fhnrecMCInjectALaCone;        
1030     fhnMCrecK0Cone                  = o.fhnMCrecK0Cone;
1031     fhnMCrecLaCone                  = o.fhnMCrecLaCone;
1032     fhnMCrecALaCone                 = o.fhnMCrecALaCone;
1033     fhnMCrecK0ConeSmear             = o.fhnMCrecK0ConeSmear;
1034     fhnMCrecLaConeSmear             = o.fhnMCrecLaConeSmear;
1035     fhnMCrecALaConeSmear            = o.fhnMCrecALaConeSmear;
1036     fhnK0sSecContinCone             = o.fhnK0sSecContinCone;
1037     fhnLaSecContinCone              = o.fhnLaSecContinCone;
1038     fhnALaSecContinCone             = o.fhnALaSecContinCone;
1039     fhnK0sIncl                      = o.fhnK0sIncl; 
1040     fhnK0sCone                      = o.fhnK0sCone;
1041     fhnLaIncl                       = o.fhnLaIncl;
1042     fhnLaCone                       = o.fhnLaCone;
1043     fhnALaIncl                      = o.fhnALaIncl;
1044     fhnALaCone                      = o.fhnALaCone;   
1045     fhnK0sPC                        = o.fhnK0sPC;
1046     fhnLaPC                         = o.fhnLaPC;
1047     fhnALaPC                        = o.fhnALaPC;
1048     fhnK0sRC                        = o.fhnK0sRC;
1049     fhnLaRC                         = o.fhnLaRC;
1050     fhnALaRC                        = o.fhnALaRC;
1051     fhnK0sRCBias                    = o.fhnK0sRCBias;
1052     fhnLaRCBias                     = o.fhnLaRCBias;
1053     fhnALaRCBias                    = o.fhnALaRCBias;
1054     fhnK0sOC                        = o.fhnK0sOC;
1055     fhnLaOC                         = o.fhnLaOC;
1056     fhnALaOC                        = o.fhnALaOC;
1057     fh1AreaExcluded                 = o.fh1AreaExcluded;
1058     fh1MedianEta                    = o.fh1MedianEta;
1059     fh1JetPtMedian                  = o.fh1JetPtMedian;
1060     fh1MCMultiplicityPrimary        = o.fh1MCMultiplicityPrimary;
1061     fh1MCMultiplicityTracks         = o.fh1MCMultiplicityTracks;
1062     fhnFeedDownLa                   = o.fhnFeedDownLa;
1063     fhnFeedDownALa                  = o.fhnFeedDownALa;
1064     fhnFeedDownLaCone               = o.fhnFeedDownLaCone;
1065     fhnFeedDownALaCone              = o.fhnFeedDownALaCone;
1066     fh1MCProdRadiusK0s              = o.fh1MCProdRadiusK0s;
1067     fh1MCProdRadiusLambda           = o.fh1MCProdRadiusLambda;
1068     fh1MCProdRadiusAntiLambda       = o.fh1MCProdRadiusAntiLambda;
1069     fh1MCPtV0s                      = o.fh1MCPtV0s;
1070     fh1MCPtK0s                      = o.fh1MCPtK0s; 
1071     fh1MCPtLambda                   = o.fh1MCPtLambda;
1072     fh1MCPtAntiLambda               = o.fh1MCPtAntiLambda; 
1073     fh1MCXiPt                       = o.fh1MCXiPt;
1074     fh1MCXibarPt                    = o.fh1MCXibarPt;
1075     fh2MCEtaVsPtK0s                 = o.fh2MCEtaVsPtK0s;
1076     fh2MCEtaVsPtLa                  = o.fh2MCEtaVsPtLa;
1077     fh2MCEtaVsPtALa                 = o.fh2MCEtaVsPtALa;
1078     //fh1MCRapK0s                     = o.fh1MCRapK0s; 
1079     //fh1MCRapLambda                  = o.fh1MCRapLambda;
1080     //fh1MCRapAntiLambda              = o.fh1MCRapAntiLambda;
1081     fh1MCEtaAllK0s                  = o.fh1MCEtaAllK0s; 
1082     fh1MCEtaK0s                     = o.fh1MCEtaK0s; 
1083     fh1MCEtaLambda                  = o.fh1MCEtaLambda;
1084     fh1MCEtaAntiLambda              = o.fh1MCEtaAntiLambda;
1085 }
1086     
1087   return *this;
1088 }
1089
1090 //_______________________________________________
1091 AliAnalysisTaskJetChem::~AliAnalysisTaskJetChem()
1092 {
1093   // destructor  
1094
1095   if(jettracklist) delete jettracklist;
1096   if(jetConeK0list) delete jetConeK0list;
1097   if(jetConeLalist) delete jetConeLalist;
1098   if(jetConeALalist) delete jetConeALalist;
1099   if(jetPerpConeK0list) delete jetPerpConeK0list;
1100   if(jetPerpConeLalist) delete jetPerpConeLalist;
1101   if(jetPerpConeALalist) delete jetPerpConeALalist;
1102   if(jetMedianConeK0list) delete jetMedianConeK0list;
1103   if(jetMedianConeLalist) delete jetMedianConeLalist;
1104   if(jetMedianConeALalist) delete jetMedianConeALalist;
1105   if(fListK0sRC) delete fListK0sRC;
1106   if(fListLaRC) delete fListLaRC;
1107   if(fListALaRC) delete fListALaRC;
1108   if(fListK0s) delete fListK0s;
1109   if(fListLa) delete fListLa;
1110   if(fListALa) delete fListALa;
1111   if(fListFeeddownLaCand) delete fListFeeddownLaCand;
1112   if(fListFeeddownALaCand) delete fListFeeddownALaCand;
1113   if(jetConeFDLalist) delete jetConeFDLalist;
1114   if(jetConeFDALalist) delete jetConeFDALalist;   
1115   if(fListMCgenK0s) delete fListMCgenK0s;
1116   if(fListMCgenLa) delete fListMCgenLa;
1117   if(fListMCgenALa) delete fListMCgenALa;
1118   if(fListMCgenK0sCone) delete fListMCgenK0sCone;
1119   if(fListMCgenLaCone) delete fListMCgenLaCone;
1120   if(fListMCgenALaCone) delete fListMCgenALaCone;
1121   if(fRandom) delete fRandom;
1122 }
1123
1124 //________________________________________________________________________________________________________________________________
1125 AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::AliFragFuncHistosInvMass(const char* name, 
1126                                                                            Int_t nJetPt, Float_t jetPtMin, Float_t jetPtMax,  
1127                                                                            Int_t nInvMass, Float_t invMassMin, Float_t invMassMax,
1128                                                                            Int_t nPt, Float_t ptMin, Float_t ptMax,
1129                                                                            Int_t nXi, Float_t xiMin, Float_t xiMax,
1130                                                                            Int_t nZ , Float_t zMin , Float_t zMax )
1131   : TObject()
1132   ,fNBinsJetPt(nJetPt)
1133   ,fJetPtMin(jetPtMin)
1134   ,fJetPtMax(jetPtMax)
1135   ,fNBinsInvMass(nInvMass)
1136   ,fInvMassMin(invMassMin)  
1137   ,fInvMassMax(invMassMax)
1138   ,fNBinsPt(nPt) 
1139   ,fPtMin(ptMin)   
1140   ,fPtMax(ptMax)   
1141   ,fNBinsXi(nXi) 
1142   ,fXiMin(xiMin)   
1143   ,fXiMax(xiMax)   
1144   ,fNBinsZ(nZ)  
1145   ,fZMin(zMin)    
1146   ,fZMax(zMax)    
1147   ,fh3TrackPt(0)
1148   ,fh3Xi(0)
1149   ,fh3Z(0)
1150   ,fh1JetPt(0)
1151   ,fNameFF(name)
1152 {
1153   // default constructor
1154
1155 }
1156
1157 //______________________________________________________________________________________________________________
1158 AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::AliFragFuncHistosInvMass(const AliFragFuncHistosInvMass& copy)
1159   : TObject()
1160   ,fNBinsJetPt(copy.fNBinsJetPt)
1161   ,fJetPtMin(copy.fJetPtMin)
1162   ,fJetPtMax(copy.fJetPtMax)
1163   ,fNBinsInvMass(copy.fNBinsInvMass)
1164   ,fInvMassMin(copy.fInvMassMin)  
1165   ,fInvMassMax(copy.fInvMassMax)
1166   ,fNBinsPt(copy.fNBinsPt) 
1167   ,fPtMin(copy.fPtMin)   
1168   ,fPtMax(copy.fPtMax)   
1169   ,fNBinsXi(copy.fNBinsXi) 
1170   ,fXiMin(copy.fXiMin)   
1171   ,fXiMax(copy.fXiMax)   
1172   ,fNBinsZ(copy.fNBinsZ)  
1173   ,fZMin(copy.fZMin)    
1174   ,fZMax(copy.fZMax)    
1175   ,fh3TrackPt(copy.fh3TrackPt)
1176   ,fh3Xi(copy.fh3Xi)
1177   ,fh3Z(copy.fh3Z)
1178   ,fh1JetPt(copy.fh1JetPt)
1179   ,fNameFF(copy.fNameFF)
1180 {
1181   // copy constructor
1182 }
1183
1184 //______________________________________________________________________________________________________________________________________________________________________
1185 AliAnalysisTaskJetChem::AliFragFuncHistosInvMass& AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::operator=(const AliAnalysisTaskJetChem::AliFragFuncHistosInvMass& o)
1186 {
1187   // assignment
1188   
1189   if(this!=&o){
1190     TObject::operator=(o);
1191     fNBinsJetPt   = o.fNBinsJetPt;
1192     fJetPtMin     = o.fJetPtMin;
1193     fJetPtMax     = o.fJetPtMax;
1194     fNBinsInvMass = o.fNBinsInvMass;
1195     fInvMassMin   = o.fInvMassMin;  
1196     fInvMassMax   = o.fInvMassMax;
1197     fNBinsPt      = o.fNBinsPt; 
1198     fPtMin        = o.fPtMin;   
1199     fPtMax        = o.fPtMax;   
1200     fNBinsXi      = o.fNBinsXi; 
1201     fXiMin        = o.fXiMin;   
1202     fXiMax        = o.fXiMax;   
1203     fNBinsZ       = o.fNBinsZ;  
1204     fZMin         = o.fZMin;    
1205     fZMax         = o.fZMax;    
1206     fh3TrackPt    = o.fh3TrackPt;
1207     fh3Xi         = o.fh3Xi;
1208     fh3Z          = o.fh3Z;
1209     fh1JetPt      = o.fh1JetPt;
1210     fNameFF       = o.fNameFF;
1211   }
1212     
1213   return *this;
1214 }
1215
1216 //___________________________________________________________________________
1217 AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::~AliFragFuncHistosInvMass()
1218
1219   // destructor 
1220
1221   if(fh1JetPt)   delete fh1JetPt;
1222   if(fh3TrackPt) delete fh3TrackPt;
1223   if(fh3Xi)      delete fh3Xi;
1224   if(fh3Z)       delete fh3Z;
1225 }
1226
1227 //_________________________________________________________________
1228 void AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::DefineHistos()
1229 {
1230   // book FF histos
1231
1232   fh1JetPt   = new TH1F(Form("fh1FFJetPtIM%s", fNameFF.Data()),"",fNBinsJetPt,fJetPtMin,fJetPtMax);
1233   fh3TrackPt = new TH3F(Form("fh3FFTrackPtIM%s",fNameFF.Data()),"",fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsInvMass, fInvMassMin, fInvMassMax, fNBinsPt, fPtMin, fPtMax);
1234   fh3Xi      = new TH3F(Form("fh3FFXiIM%s", fNameFF.Data()),"", fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsInvMass, fInvMassMin, fInvMassMax, fNBinsXi, fXiMin, fXiMax);
1235   fh3Z       = new TH3F(Form("fh3FFZIM%s", fNameFF.Data()),"", fNBinsJetPt, fJetPtMin, fJetPtMax, fNBinsInvMass, fInvMassMin, fInvMassMax, fNBinsZ, fZMin, fZMax);
1236
1237   AliAnalysisTaskFragmentationFunction::SetProperties(fh1JetPt, "p_{t} (GeV/c)", "entries"); 
1238   AliAnalysisTaskJetChem::SetProperties(fh3TrackPt,"jet p_{t} (GeV/c)","inv Mass (GeV/c^2)","p_{t} (GeV/c)");
1239   AliAnalysisTaskJetChem::SetProperties(fh3Xi,"jet p_{t} (GeV/c)","inv Mass (GeV/c^2)","#xi");
1240   AliAnalysisTaskJetChem::SetProperties(fh3Z,"jet p_{t} (GeV/c)","inv Mass (GeV/c^2)","z");
1241 }
1242
1243 //________________________________________________________________________________________________________________________________
1244 void AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::FillFF(Float_t trackPt, Float_t invM, Float_t jetPt, Bool_t incrementJetPt)
1245 {
1246   // fill FF, don't use TH3F anymore use THnSparse instead to save memory
1247  
1248   if(incrementJetPt) fh1JetPt->Fill(jetPt);    
1249   //fh3TrackPt->Fill(jetPt,invM,trackPt);//Fill(x,y,z)
1250   invM = 0;
1251   Double_t z = 0.;
1252   if(jetPt>0) z = trackPt / jetPt;
1253   // Double_t xi = 0;
1254   //if(z>0) xi = TMath::Log(1/z);
1255   
1256   //fh3Xi->Fill(jetPt,invM,xi);
1257   //fh3Z->Fill(jetPt,invM,z);
1258 }
1259
1260 //___________________________________________________________________________________
1261 void AliAnalysisTaskJetChem::AliFragFuncHistosInvMass::AddToOutput(TList* list) const
1262 {
1263   // add histos to list
1264
1265   list->Add(fh1JetPt);
1266   //list->Add(fh3TrackPt);
1267   //list->Add(fh3Xi);
1268   //list->Add(fh3Z);
1269 }
1270
1271
1272 //____________________________________________________
1273 void AliAnalysisTaskJetChem::UserCreateOutputObjects()
1274 {
1275   // create output objects
1276    
1277   fRandom = new TRandom3(0);
1278   fRandom->SetSeed(0);
1279
1280   if(fDebug > 1) Printf("AliAnalysisTaskJetChem::UserCreateOutputObjects()");
1281  
1282   // create list of tracks and jets 
1283   jettracklist = new TList();
1284   jettracklist->SetOwner(kFALSE);
1285   jetConeK0list = new TList();
1286   jetConeK0list->SetOwner(kFALSE);
1287   jetConeLalist = new TList();
1288   jetConeLalist->SetOwner(kFALSE);
1289   jetConeALalist = new TList();
1290   jetConeALalist->SetOwner(kFALSE);
1291   jetPerpConeK0list = new TList();
1292   jetPerpConeK0list->SetOwner(kFALSE);
1293   jetPerpConeLalist = new TList(); 
1294   jetPerpConeLalist->SetOwner(kFALSE);
1295   jetPerpConeALalist = new TList();
1296   jetPerpConeALalist->SetOwner(kFALSE);
1297   jetMedianConeK0list = new TList();
1298   jetMedianConeK0list->SetOwner(kFALSE);
1299   jetMedianConeLalist = new TList();
1300   jetMedianConeLalist->SetOwner(kFALSE);
1301   jetMedianConeALalist = new TList();
1302   jetMedianConeALalist->SetOwner(kFALSE);
1303   fListK0sRC = new TList();
1304   fListK0sRC->SetOwner(kFALSE);
1305   fListLaRC = new TList();
1306   fListLaRC->SetOwner(kFALSE);
1307   fListALaRC = new TList();
1308   fListALaRC->SetOwner(kFALSE);
1309   fTracksRecCuts = new TList();
1310   fTracksRecCuts->SetOwner(kFALSE); //objects in TList wont be deleted when TList is deleted 
1311   fJetsRecCuts = new TList();
1312   fJetsRecCuts->SetOwner(kFALSE);
1313   fBckgJetsRec = new TList();
1314   fBckgJetsRec->SetOwner(kFALSE);
1315   fListK0s = new TList(); 
1316   fListK0s->SetOwner(kFALSE);
1317   fListLa = new TList(); 
1318   fListLa->SetOwner(kFALSE);
1319   fListALa = new TList(); 
1320   fListALa->SetOwner(kFALSE);
1321   fListFeeddownLaCand = new TList();    //feeddown Lambda candidates
1322   fListFeeddownLaCand->SetOwner(kFALSE);
1323   fListFeeddownALaCand = new TList();   //feeddown Antilambda candidates
1324   fListFeeddownALaCand->SetOwner(kFALSE);
1325   jetConeFDLalist = new TList();     
1326   jetConeFDLalist->SetOwner(kFALSE);  //feeddown Lambda candidates in jet cone
1327   jetConeFDALalist = new TList();     
1328   jetConeFDALalist->SetOwner(kFALSE); //feeddown Antilambda candidates in jet cone
1329   fListMCgenK0s = new TList();          //MC generated K0s 
1330   fListMCgenK0s->SetOwner(kFALSE);
1331   fListMCgenLa = new TList();           //MC generated Lambdas
1332   fListMCgenLa->SetOwner(kFALSE);
1333   fListMCgenALa = new TList();          //MC generated Antilambdas
1334   fListMCgenALa->SetOwner(kFALSE);
1335   fListMCgenK0sCone = new TList();
1336   fListMCgenK0sCone->SetOwner(kFALSE);
1337   fListMCgenLaCone = new TList();
1338   fListMCgenLaCone->SetOwner(kFALSE);
1339   fListMCgenALaCone = new TList();
1340   fListMCgenALaCone->SetOwner(kFALSE);
1341   
1342   // Create histograms / output container
1343  
1344   fCommonHistList = new TList();
1345   fCommonHistList->SetOwner();
1346   
1347   Bool_t oldStatus = TH1::AddDirectoryStatus();
1348   TH1::AddDirectory(kFALSE);//By default (fAddDirectory = kTRUE), histograms are automatically added to the list of objects in memory
1349         
1350   // histograms inherited from AliAnalysisTaskFragmentationFunction
1351
1352   fh1EvtSelection            = new TH1F("fh1EvtSelection", "Event Selection", 6, -0.5, 5.5);
1353   fh1EvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
1354   fh1EvtSelection->GetXaxis()->SetBinLabel(2,"event trigger selection: rejected");
1355   fh1EvtSelection->GetXaxis()->SetBinLabel(3,"event class: rejected");
1356   fh1EvtSelection->GetXaxis()->SetBinLabel(4,"vertex Ncontr: rejected");
1357   fh1EvtSelection->GetXaxis()->SetBinLabel(5,"vertex z: rejected");
1358   fh1EvtSelection->GetXaxis()->SetBinLabel(6,"vertex type: rejected");
1359
1360
1361   fh1EvtCent                 = new TH1F("fh1EvtCent","centrality",100,0.,100.);
1362   fh1VertexNContributors     = new TH1F("fh1VertexNContributors", "Vertex N contributors", 11,-.5, 10.5);
1363   fh1VertexZ                 = new TH1F("fh1VertexZ", "Vertex z distribution", 30, -15., 15.);
1364   fh1Xsec                    = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
1365   fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
1366   fh1Trials                  = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1);
1367   fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
1368   fh1PtHard                  = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
1369   fh1PtHardTrials            = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
1370   fh1nRecJetsCuts            = new TH1F("fh1nRecJetsCuts","reconstructed jets per event",100,-0.5,99.5);
1371  
1372   // histograms JetChem task
1373  
1374   fh1EvtAllCent                 = new TH1F("fh1EvtAllCent","before centrality selection",100,0.,100.);
1375   fh1Evt                        = new TH1F("fh1Evt", "All events runned over", 3, 0.,1.);
1376   fh1EvtMult                    = new TH1F("fh1EvtMult","multiplicity",240,0.,240.);
1377   fh1K0Mult                     = new TH1F("fh1K0Mult","K0 multiplicity",100,0.,100.);//500. all
1378   fh1dPhiJetK0                  = new TH1F("fh1dPhiJetK0","",64,-1,5.4);
1379   fh1LaMult                     = new TH1F("fh1LaMult","La multiplicity",100,0.,100.);
1380   fh1dPhiJetLa                  = new TH1F("fh1dPhiJetLa","",64,-1,5.4);
1381   fh1ALaMult                    = new TH1F("fh1ALaMult","ALa multiplicity",100,0.,100.);
1382   fh1dPhiJetALa                 = new TH1F("fh1dPhiJetALa","",64,-1,5.4);
1383   fh1JetEta                     = new TH1F("fh1JetEta","#eta distribution of all jets",40,-2.,2.);
1384   fh1JetPhi                     = new TH1F("fh1JetPhi","#phi distribution of all jets",63,0.,6.3);
1385   fh2JetEtaPhi                  = new TH2F("fh2JetEtaPhi","#eta and #phi distribution of all jets",400,-2.,2.,63,0.,6.3);
1386
1387
1388   //fh1V0JetPt                    = new TH1F("fh1V0JetPt","p_{T} distribution of all jets containing v0s",200,0.,200.);
1389   fh1IMK0Cone                     = new TH1F("fh1IMK0Cone","p_{T} distribution of all jets containing K0s candidates",19,5.,100.);
1390   fh1IMLaCone                     = new TH1F("fh1IMLaCone","p_{T} distribution of all jets containing #Lambda candidates",19,5.,100.);
1391   fh1IMALaCone                    = new TH1F("fh1IMALaCone","p_{T} distribution of all jets containing #bar{#Lambda} candidates",19,5.,100.);
1392
1393   fh2FFJetTrackEta              = new TH2F("fh2FFJetTrackEta","charged track eta distr. in jet cone",200,-1.,1.,40,0.,200.);  
1394   //fh1trackPosNCls               = new TH1F("fh1trackPosNCls","NTPC clusters positive daughters",10,0.,100.);
1395   //fh1trackNegNCls               = new TH1F("fh1trackNegNCls","NTPC clusters negative daughters",10,0.,100.);
1396   fh1trackPosEta                = new TH1F("fh1trackPosEta","eta positive daughters",100,-2.,2.);
1397   fh1trackNegEta                = new TH1F("fh1trackNegEta","eta negative daughters",100,-2.,2.);
1398   fh1V0Eta                      = new TH1F("fh1V0Eta","V0 eta",60,-1.5,1.5);
1399   //fh1V0totMom                   = new TH1F("fh1V0totMom","V0 tot mom",100,0.,20.); 
1400   fh1CosPointAngle              = new TH1F("fh1CosPointAngle", "Cosine of V0's pointing angle",50,0.99,1.0);
1401   fh1DecayLengthV0              = new TH1F("fh1DecayLengthV0", "V0s decay Length;decay length(cm)",1200,0.,120.);
1402   fh2ProperLifetimeK0sVsPtBeforeCut = new TH2F("fh2ProperLifetimeK0sVsPtBeforeCut"," K0s ProperLifetime vs Pt; p_{T} (GeV/#it{c})",150,0.,15.,250,0.,250.);
1403   fh2ProperLifetimeK0sVsPtAfterCut = new TH2F("fh2ProperLifetimeK0sVsPtAfterCut"," K0s ProperLifetime vs Pt; p_{T} (GeV/#it{c})",150,0.,15.,250,0.,250.);
1404   fh1V0Radius                   = new TH1F("fh1V0Radius", "V0s Radius;Radius(cm)",200,0.,40.);
1405   fh1DcaV0Daughters             = new TH1F("fh1DcaV0Daughters", "DCA between daughters;dca(cm)",200,0.,2.);
1406   fh1DcaPosToPrimVertex         = new TH1F("fh1DcaPosToPrimVertex", "Positive V0 daughter;dca(cm)",100,0.,10.);
1407   fh1DcaNegToPrimVertex         = new TH1F("fh1DcaNegToPrimVertex", "Negative V0 daughter;dca(cm)",100,0.,10.);
1408   fh2ArmenterosBeforeCuts       = new TH2F("fh2ArmenterosBeforeCuts","Armenteros Podolanski Plot for K0s Candidates;#alpha;(p^{arm})_{T}/(GeV/#it{c})",200,-1.2,1.2,350,0.,0.35);
1409   fh2ArmenterosAfterCuts        = new TH2F("fh2ArmenterosAfterCuts","Armenteros Podolanski Plot for K0s Candidates;#alpha;(p^{arm})_{T}/(GeV/#it{c});",200,-1.2,1.2,350,0.,0.35);
1410   fh2BBLaPos                    = new TH2F("fh2BBLaPos","PID of the positive daughter of La candidates; P (GeV); -dE/dx (keV/cm ?)",100,0,10,200,0,200);
1411   fh2BBLaNeg                    = new TH2F("fh2BBLaNeg","PID of the negative daughter of La candidates; P (GeV); -dE/dx (keV/cm ?)",100,0,10,200,0,200);
1412   fh1PosDaughterCharge          = new TH1F("fh1PosDaughterCharge","charge of V0 positive daughters; V0 daughters",3,-2.,2.);
1413   fh1NegDaughterCharge          = new TH1F("fh1NegDaughterCharge","charge of V0 negative daughters; V0 daughters",3,-2.,2.);
1414   fh1PtMCK0s                    = new TH1F("fh1PtMCK0s","Pt of MC rec K0s; #it{p}_{T} (GeV/#it{c})",200,0.,20.);
1415   fh1PtMCLa                     = new TH1F("fh1PtMCLa","Pt of MC rec La; #it{p}_{T} (GeV/#it{c})",200,0.,20.);
1416   fh1PtMCALa                    = new TH1F("fh1PtMCALa","Pt of MC rec ALa; #it{p}_{T} (GeV/#it{c})",200,0.,20.);
1417   fh1EtaK0s                     = new TH1F("fh1EtaK0s","K^{0}_{s} entries ;#eta",200,-1.,1.);
1418   fh1EtaLa                      = new TH1F("fh1EtaLa","#Lambda entries ;#eta",200,-1.,1.);
1419   fh1EtaALa                     = new TH1F("fh1EtaALa","#bar{#Lambda} entries ;#eta",200,-1.,1.);
1420
1421   //histos for normalisation of MCC, RC, OC and NJ
1422
1423   fh1RC                         = new TH1F("fh1RC"," # random cones used",1,0.5,1.5);
1424   fh1RCBiasK0                   = new TH1F("fh1RCBiasK0"," # random cones with K0s trigger particle",1,0.5,1.5);
1425   fh1RCBiasLa                   = new TH1F("fh1RCBiasLa"," # random cones with La trigger particle",1,0.5,1.5);
1426   fh1RCBiasALa                  = new TH1F("fh1RCBiasALa"," # random cones with ALa trigger particle",1,0.5,1.5);
1427   fh1MCC                        = new TH1F("fh1MCC","# median cluster cones used",1,0.5,1.5);
1428   fh1OC                         = new TH1F("fh1OC","# outside cones used, number of jet events",1,0.5,1.5);
1429   fh1NJ                         = new TH1F("fh1NJ","# non-jet events used",1,0.5,1.5);
1430
1431   Int_t binsInvMassEtaTrackPtK0s[3] = {200, 200, 120};//eta,invM,trackPt
1432   Double_t xminInvMassEtaTrackPtK0s[3] = {-1.,0.3,0.};
1433   Double_t xmaxInvMassEtaTrackPtK0s[3] = {1.,0.7,12.};
1434
1435   fhnInvMassEtaTrackPtK0s       = new THnSparseF("fhnInvMassEtaTrackPtK0s","#eta; K0s invM (GeV/{#it{c}}^{2}); #it{p}_{T} (GeV/#it{c})",3,binsInvMassEtaTrackPtK0s,xminInvMassEtaTrackPtK0s,xmaxInvMassEtaTrackPtK0s);
1436
1437   Int_t binsInvMassEtaTrackPtLa[3] = {200, 200, 120};//eta,invM,trackPt
1438   Double_t xminInvMassEtaTrackPtLa[3] = {-1.,1.05,0.};
1439   Double_t xmaxInvMassEtaTrackPtLa[3] = {1.,1.25,12.};
1440
1441   fhnInvMassEtaTrackPtLa       = new THnSparseF("fhnInvMassEtaTrackPtLa","#eta; #Lambda invM (GeV/{#it{c}}^{2}); #it{p}_{T} (GeV/#it{c})",3,binsInvMassEtaTrackPtLa,xminInvMassEtaTrackPtLa,xmaxInvMassEtaTrackPtLa);
1442
1443   Int_t binsInvMassEtaTrackPtALa[3] = {200, 200, 120};//eta,invM,trackPt
1444   Double_t xminInvMassEtaTrackPtALa[3] = {-1.,1.05,0.};
1445   Double_t xmaxInvMassEtaTrackPtALa[3] = {1.,1.25,12.};
1446
1447   fhnInvMassEtaTrackPtALa       = new THnSparseF("fhnInvMassEtaTrackPtALa","#eta; #bar{#Lambda} invM (GeV/{#it{c}}^{2}); #it{p}_{T} (GeV/#it{c})",3,binsInvMassEtaTrackPtALa,xminInvMassEtaTrackPtALa,xmaxInvMassEtaTrackPtALa);
1448
1449   Int_t binsK0sPC[4] = {19, 200, 120, 200};
1450   Double_t xminK0sPC[4] = {5.,0.3, 0., -1.};
1451   Double_t xmaxK0sPC[4] = {100.,0.7, 12., 1.};
1452   fhnK0sPC                      = new THnSparseF("fhnK0sPC","jet pT; K0s invM; particle pT; particle #eta",4,binsK0sPC,xminK0sPC,xmaxK0sPC);
1453
1454   Int_t binsLaPC[4] = {19, 200, 120, 200};
1455   Double_t xminLaPC[4] = {5.,1.05, 0., -1.};
1456   Double_t xmaxLaPC[4] = {100.,1.25, 12., 1.};
1457   fhnLaPC                       = new THnSparseF("fhnLaPC","jet pT; #Lambda invM; particle pT; particle #eta",4,binsLaPC,xminLaPC,xmaxLaPC);
1458
1459   Int_t binsALaPC[4] = {19, 200, 120, 200};
1460   Double_t xminALaPC[4] = {5.,1.05, 0., -1.};
1461   Double_t xmaxALaPC[4] = {100.,1.25, 12., 1.};
1462   fhnALaPC                      = new THnSparseF("fhnALaPC","jet pT; #bar#Lambda invM; particle pT; particle #eta",4,binsALaPC,xminALaPC,xmaxALaPC);
1463
1464   Int_t binsK0sMCC[3] = {200, 120, 200};
1465   Double_t xminK0sMCC[3] = {0.3, 0., -1.};
1466   Double_t xmaxK0sMCC[3] = {0.7, 12., 1.};
1467   fhnK0sMCC                     = new THnSparseF("fhnK0sMCC","jet pT; K0s invM; particle pT; particle #eta",3,binsK0sMCC,xminK0sMCC,xmaxK0sMCC);
1468
1469   Int_t binsLaMCC[3] = {200, 120, 200};
1470   Double_t xminLaMCC[3] = {1.05, 0., -1.};
1471   Double_t xmaxLaMCC[3] = {1.25, 12., 1.};
1472   fhnLaMCC                      = new THnSparseF("fhnLaMCC","jet pT; #Lambda invM; particle pT; particle #eta",3,binsLaMCC,xminLaMCC,xmaxLaMCC);
1473
1474   Int_t binsALaMCC[3] = {200, 120, 200};
1475   Double_t xminALaMCC[3] = {1.05, 0., -1.};
1476   Double_t xmaxALaMCC[3] = {1.25, 12., 1.};
1477   fhnALaMCC                = new THnSparseF("fhnALaMCC","jet pT; #bara#Lambda invM; particle pT; particle #eta",3,binsALaMCC,xminALaMCC,xmaxALaMCC);
1478
1479   Int_t binsK0sRC[3] = {200, 120, 200};
1480   Double_t xminK0sRC[3] = {0.3, 0., -1.};
1481   Double_t xmaxK0sRC[3] = {0.7, 12., 1.};
1482   fhnK0sRC                 = new THnSparseF("fhnK0sRC","jet pT; K0s invM; particle pT; particle #eta",3,binsK0sRC,xminK0sRC,xmaxK0sRC);
1483
1484   Int_t binsLaRC[3] = {200, 120, 200};
1485   Double_t xminLaRC[3] = {1.05, 0., -1.};
1486   Double_t xmaxLaRC[3] = {1.25, 12., 1.};
1487   fhnLaRC                  = new THnSparseF("fhnLaRC","jet pT; #Lambda invM; particle pT; particle #eta",3,binsLaRC,xminLaRC,xmaxLaRC);
1488
1489   Int_t binsALaRC[3] = {200, 120, 200};
1490   Double_t xminALaRC[3] = {1.05, 0., -1.};
1491   Double_t xmaxALaRC[3] = {1.25, 12., 1.};
1492   fhnALaRC                 = new THnSparseF("fhnALaRC","jet pT; #bara#Lambda invM; particle pT; particle #eta",3,binsALaRC,xminALaRC,xmaxALaRC);
1493
1494   Int_t binsK0sRCBias[3] = {200, 120, 200};
1495   Double_t xminK0sRCBias[3] = {0.3, 0., -1.};
1496   Double_t xmaxK0sRCBias[3] = {0.7, 12., 1.};
1497   fhnK0sRCBias             = new THnSparseF("fhnK0sRCBias","jet pT; K0s invM; particle pT; particle #eta",3,binsK0sRCBias,xminK0sRCBias,xmaxK0sRCBias);
1498
1499   Int_t binsLaRCBias[3] = {200, 120, 200};
1500   Double_t xminLaRCBias[3] = {1.05, 0., -1.};
1501   Double_t xmaxLaRCBias[3] = {1.25, 12., 1.};
1502   fhnLaRCBias              = new THnSparseF("fhnLaRCBias","jet pT; #Lambda invM; particle pT; particle #eta",3,binsLaRCBias,xminLaRCBias,xmaxLaRCBias);
1503
1504   Int_t binsALaRCBias[3] = {200, 120, 200};
1505   Double_t xminALaRCBias[3] = {1.05, 0., -1.};
1506   Double_t xmaxALaRCBias[3] = {1.25, 12., 1.};
1507   fhnALaRCBias             = new THnSparseF("fhnALaRCBias","jet pT; #bara#Lambda invM; particle pT; particle #eta",3,binsALaRCBias,xminALaRCBias,xmaxALaRCBias);
1508
1509   Int_t binsK0sOC[3] = {200, 120, 200};
1510   Double_t xminK0sOC[3] = {0.3, 0., -1.};
1511   Double_t xmaxK0sOC[3] = {0.7, 12., 1.};
1512   fhnK0sOC                     = new THnSparseF("fhnK0sOC","jet pT; K0s invM; particle pT; particle #eta",3,binsK0sOC,xminK0sOC,xmaxK0sOC);
1513
1514   Int_t binsLaOC[3] = {200, 120, 200};
1515   Double_t xminLaOC[3] = {1.05, 0., -1.};
1516   Double_t xmaxLaOC[3] = {1.25, 12., 1.};
1517   fhnLaOC                      = new THnSparseF("fhnLaOC","jet pT; #Lambda invM; particle pT; particle #eta",3,binsLaOC,xminLaOC,xmaxLaOC);
1518
1519   Int_t binsALaOC[3] = {200, 120, 200};
1520   Double_t xminALaOC[3] = {1.05, 0., -1.};
1521   Double_t xmaxALaOC[3] = {1.25, 12., 1.};
1522
1523   fhnALaOC                      = new THnSparseF("fhnALaOC","jet pT; #bara#Lambda invM; particle pT; particle #eta",3,binsALaOC,xminALaOC,xmaxALaOC);
1524
1525   fh1AreaExcluded               = new TH1F("fh1AreaExcluded","area excluded for selected jets in event acceptance",50,0.,1.);
1526
1527   fh1MedianEta                  = new TH1F("fh1MedianEta","Median cluster axis ;#eta",200,-1.,1.);
1528   fh1JetPtMedian                = new TH1F("fh1JetPtMedian"," (selected) jet it{p}_{T} distribution for MCC method; #GeV/it{c}",19,5.,100.);
1529
1530   fh1TrackMultCone              = new TH1F("fh1TrackMultCone","track multiplicity in jet cone; number of tracks",20,0.,50.);
1531
1532   fh2TrackMultCone              = new TH2F("fh2TrackMultCone","track multiplicity in jet cone vs. jet momentum; number of tracks; jet it{p}_{T} (GeV/it{c})",50,0.,50.,19,5.,100.);
1533
1534   Int_t binsNJK0[3] = {200, 120, 200};
1535   Double_t xminNJK0[3] = {0.3, 0., -1.};
1536   Double_t xmaxNJK0[3] = {0.7, 12., 1.};
1537   fhnNJK0                       = new THnSparseF("fhnNJK0","K0s candidates in events wo selected jets;",3,binsNJK0,xminNJK0,xmaxNJK0);
1538
1539   Int_t binsNJLa[3] = {200, 120, 200};
1540   Double_t xminNJLa[3] = {1.05, 0., -1.};
1541   Double_t xmaxNJLa[3] = {1.25, 12., 1.};
1542   fhnNJLa                    = new THnSparseF("fhnNJLa","La candidates in events wo selected jets; ",3,binsNJLa,xminNJLa,xmaxNJLa);
1543
1544   Int_t binsNJALa[3] = {200, 120, 200};
1545   Double_t xminNJALa[3] = {1.05, 0., -1.};
1546   Double_t xmaxNJALa[3] = {1.25, 12., 1.};
1547   fhnNJALa                    = new THnSparseF("fhnNJALa","ALa candidates in events wo selected jets; ",3,binsNJALa,xminNJALa,xmaxNJALa);
1548
1549   fFFHistosRecCuts              = new AliFragFuncHistos("RecCuts", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
1550                                                      fFFNBinsPt, fFFPtMin, fFFPtMax, 
1551                                                      fFFNBinsXi, fFFXiMin, fFFXiMax,  
1552                                                      fFFNBinsZ , fFFZMin , fFFZMax);
1553   
1554   fV0QAK0                       = new AliFragFuncQATrackHistos("V0QAK0",fQATrackNBinsPt, fQATrackPtMin, fQATrackPtMax, 
1555                                                             fQATrackNBinsEta, fQATrackEtaMin, fQATrackEtaMax,
1556                                                             fQATrackNBinsPhi, fQATrackPhiMin, fQATrackPhiMax, 
1557                                                             fQATrackHighPtThreshold);
1558   
1559   fFFHistosRecCutsK0Evt         = new AliFragFuncHistos("RecCutsK0Evt", fFFNBinsJetPt, fFFJetPtMin, fFFJetPtMax, 
1560                                                      fFFNBinsPt, fFFPtMin, fFFPtMax, 
1561                                                      fFFNBinsXi, fFFXiMin, fFFXiMax,  
1562                                                      fFFNBinsZ , fFFZMin , fFFZMax);
1563   
1564   /*
1565   fFFHistosIMK0AllEvt        = new AliFragFuncHistosInvMass("K0AllEvt", fFFIMNBinsJetPt, fFFIMJetPtMin, fFFIMJetPtMax, 
1566                                                             fFFIMNBinsInvM,fFFIMInvMMin,fFFIMInvMMax,
1567                                                             fFFIMNBinsPt, fFFIMPtMin, fFFIMPtMax, 
1568                                                             fFFIMNBinsXi, fFFIMXiMin, fFFIMXiMax,  
1569                                                             fFFIMNBinsZ , fFFIMZMin , fFFIMZMax);
1570   
1571   fFFHistosIMK0Jet           = new AliFragFuncHistosInvMass("K0Jet", fFFIMNBinsJetPt, fFFIMJetPtMin, fFFIMJetPtMax, 
1572                                                             fFFIMNBinsInvM,fFFIMInvMMin,fFFIMInvMMax,
1573                                                             fFFIMNBinsPt, fFFIMPtMin, fFFIMPtMax, 
1574                                                             fFFIMNBinsXi, fFFIMXiMin, fFFIMXiMax,  
1575                                                             fFFIMNBinsZ , fFFIMZMin , fFFIMZMax);
1576     
1577   fFFHistosIMK0Cone          = new AliFragFuncHistosInvMass("K0Cone", fFFIMNBinsJetPt, fFFIMJetPtMin, fFFIMJetPtMax, 
1578                                                             fFFIMNBinsInvM,fFFIMInvMMin,fFFIMInvMMax,
1579                                                             fFFIMNBinsPt, fFFIMPtMin, fFFIMPtMax, 
1580                                                             fFFIMNBinsXi, fFFIMXiMin, fFFIMXiMax,  
1581                                                             fFFIMNBinsZ , fFFIMZMin , fFFIMZMax);
1582   
1583   fFFHistosIMLaAllEvt        = new AliFragFuncHistosInvMass("LaAllEvt", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1584                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1585                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1586                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1587                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1588   
1589   fFFHistosIMLaJet           = new AliFragFuncHistosInvMass("LaJet", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1590                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1591                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1592                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1593                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1594   
1595   
1596   fFFHistosIMLaCone          = new AliFragFuncHistosInvMass("LaCone", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1597                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1598                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1599                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1600                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1601  
1602  
1603   fFFHistosIMALaAllEvt        = new AliFragFuncHistosInvMass("ALaAllEvt", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1604                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1605                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1606                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1607                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1608   
1609   fFFHistosIMALaJet           = new AliFragFuncHistosInvMass("ALaJet", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1610                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1611                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1612                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1613                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1614   
1615   fFFHistosIMALaCone          = new AliFragFuncHistosInvMass("ALaCone", fFFIMLaNBinsJetPt, fFFIMLaJetPtMin, fFFIMLaJetPtMax, 
1616                                                             fFFIMLaNBinsInvM,fFFIMLaInvMMin,fFFIMLaInvMMax,
1617                                                             fFFIMLaNBinsPt, fFFIMLaPtMin, fFFIMLaPtMax, 
1618                                                             fFFIMLaNBinsXi, fFFIMLaXiMin, fFFIMLaXiMax,  
1619                                                             fFFIMLaNBinsZ , fFFIMLaZMin , fFFIMLaZMax);
1620   */
1621
1622   //***************
1623   // MC histograms
1624   //***************
1625
1626   //fh2MCgenK0Cone                = new TH2F("fh2MCgenK0Cone", "MC gen {K^{0}}^{s} #it{p}_{T}  in cone around rec jet axis versus jet #it{p}_{T}; jet #it{p}_{T}",19,5.,100.,200,0.,20.);
1627   //fh2MCgenLaCone                = new TH2F("fh2MCgenLaCone", "MC gen #Lambda #it{p}_{T} in cone around rec jet axis versus jet #it{p}_{T} ; jet #it{p}_{T}",19,5.,100.,200,0.,20.);
1628   //fh2MCgenALaCone               = new TH2F("fh2MCgenALaCone", "MC gen #Antilambda #it{p}_{T} in cone around rec jet axis versus jet #it{p}_{T}; jet #it{p}_{T}",19,5.,100.,200,0.,20.);
1629
1630   //fh2MCgenK0Cone->GetYaxis()->SetTitle("MC gen K^{0}}^{s} #it{p}_{T}");
1631   //fh2MCgenLaCone->GetYaxis()->SetTitle("MC gen #Lambda #it{p}_{T}");
1632   //fh2MCgenALaCone->GetYaxis()->SetTitle("MC gen #Antilambda #it{p}_{T}");
1633
1634   //fh2MCEtagenK0Cone             = new TH2F("fh2MCEtagenK0Cone","MC gen {K^{0}}^{s} #it{p}_{T} #eta distribution in jet cone;#eta",19,5.,100.,200,-1.,1.);
1635   //fh2MCEtagenLaCone             = new TH2F("fh2MCEtagenLaCone","MC gen #Lambda #it{p}_{T} #eta distribution in jet cone;#eta",19,5.,100.,200,-1.,1.);
1636   //fh2MCEtagenALaCone            = new TH2F("fh2MCEtagenALaCone","MC gen #Antilambda #it{p}_{T} #eta distribution in jet cone;#eta",19,5.,100.,200,-1.,1.);
1637   fh1IMK0ConeSmear                = new TH1F("fh1IMK0ConeSmear","Smeared jet pt study for K0s-in-cone-jets; smeared jet #it{p}_{T}", 19,5.,100.);
1638   fh1IMLaConeSmear                = new TH1F("fh1IMLaConeSmear","Smeared jet pt study for La-in-cone-jets; smeared jet #it{p}_{T}", 19,5.,100.);
1639   fh1IMALaConeSmear               = new TH1F("fh1IMALaConeSmear","Smeared jet pt study for ALa-in-cone-jets; smeared jet #it{p}_{T}", 19,5.,100.);
1640   
1641   fh2CorrHijingLaProton           = new TH2F("fh2CorrHijingLaProton","#Lambda - proton pT correlation, Hijing;#it{p^{#Lambda}}_{T} (GeV/c);#it{p^{proton}}_{T} (GeV/c)",120,0.,12.,120,0.,12.);        
1642   fh2CorrInjectLaProton           = new TH2F("fh2CorrInjectLaProton","#Lambda - proton pT correlation, Injected;#it{p^{#Lambda}}_{T} (GeV/c);#it{p^{proton}}_{T} (GeV/c)",120,0.,12.,120,0.,12.);
1643   fh2CorrHijingALaAProton         = new TH2F("fh2CorrHijingALaAProton","#bar{#Lambda} - proton pT correlation, Hijing;#it{p^{#Lambda}}_{T} (GeV/c);#it{p^{#bar{proton}}}_{T} (GeV/c)",120,0.,12.,120,0.,12.);        
1644   fh2CorrInjectALaAProton         = new TH2F("fh2CorrInjectALaAProton","#bar{#Lambda} - proton pT correlation, Injected;#it{p^{#Lambda}}_{T} (GeV/c);#it{p^{#bar{proton}}}_{T} (GeV/c)",120,0.,12.,120,0.,12.);
1645   //12 new histograms: Cone, Incl, Lambda, Antilambda, Hijing, Injected:
1646    
1647   fh2MCEtaVsPtHijingLa              = new TH2F("fh2MCEtaVsPtHijingLa","MC Hijing gen. #Lambda #eta; #it{p}_{T}",200,0.,20.,200,-1.,1.);
1648   fh2MCEtaVsPtInjectLa              = new TH2F("fh2MCEtaVsPtInjectLa","MC injected gen. #Lambda  #eta; #it{p}_{T}",200,0.,20.,200,-1.,1.);
1649   fh2MCEtaVsPtHijingALa             = new TH2F("fh2MCEtaVsPtHijingALa","MC gen. Hijing  #bar{#Lambda} #eta; #it{p}_{T}",200,0.,20.,200,-1.,1.);
1650   fh2MCEtaVsPtInjectALa             = new TH2F("fh2MCEtaVsPtInjectALa","MC gen. injected #bar{#Lambda}  #eta; #it{p}_{T}",200,0.,20.,200,-1.,1.);
1651
1652   Int_t binsrecMCHijingLaIncl[3] = {200, 120, 200};
1653   Double_t xminrecMCHijingLaIncl[3] = {1.05, 0., -1.};
1654   Double_t xmaxrecMCHijingLaIncl[3] = {1.25, 12., 1.};
1655   fhnrecMCHijingLaIncl          = new THnSparseF("fhnrecMCHijingLaIncl","La inv. mass; particle pT; particle #eta",3,binsrecMCHijingLaIncl,xminrecMCHijingLaIncl,xmaxrecMCHijingLaIncl);
1656
1657   Int_t binsrecMCHijingLaCone[4] = {19, 200, 120, 200};
1658   Double_t xminrecMCHijingLaCone[4] = {5., 1.05, 0., -1.};
1659   Double_t xmaxrecMCHijingLaCone[4] = {100., 1.25, 12., 1.};
1660   fhnrecMCHijingLaCone          = new THnSparseF("fhnrecMCHijingLaCone","La inv. mass; particle pT; particle #eta",4,binsrecMCHijingLaCone,xminrecMCHijingLaCone,xmaxrecMCHijingLaCone);
1661
1662   Int_t binsrecMCHijingALaIncl[3] = {200, 120, 200};
1663   Double_t xminrecMCHijingALaIncl[3] = {1.05, 0., -1.};
1664   Double_t xmaxrecMCHijingALaIncl[3] = {1.25, 12., 1.};
1665   fhnrecMCHijingALaIncl         = new THnSparseF("fhnrecMCHijingALaIncl","ALa inv. mass; particle pT; particle #eta",3,binsrecMCHijingALaIncl,xminrecMCHijingALaIncl,xmaxrecMCHijingALaIncl);
1666
1667   Int_t binsrecMCHijingALaCone[4] = {19, 200, 120, 200};
1668   Double_t xminrecMCHijingALaCone[4] = {5., 1.05, 0., -1.};
1669   Double_t xmaxrecMCHijingALaCone[4] = {100., 1.25, 12., 1.};
1670   fhnrecMCHijingALaCone         = new THnSparseF("fhnrecMCHijingALaCone","ALa inv. mass; particle pT; particle #eta",4,binsrecMCHijingALaCone,xminrecMCHijingALaCone,xmaxrecMCHijingALaCone);
1671
1672   Int_t binsrecMCInjectLaIncl[3] = {200, 120, 200};
1673   Double_t xminrecMCInjectLaIncl[3] = {1.05, 0., -1.};
1674   Double_t xmaxrecMCInjectLaIncl[3] = {1.25, 12., 1.};
1675   fhnrecMCInjectLaIncl          = new THnSparseF("fhnrecMCInjectLaIncl","La inv. mass; particle pT; particle #eta",3,binsrecMCInjectLaIncl,xminrecMCInjectLaIncl,xmaxrecMCInjectLaIncl);
1676
1677   Int_t binsrecMCInjectLaCone[4] = {19, 200, 120, 200};
1678   Double_t xminrecMCInjectLaCone[4] = {5., 1.05, 0., -1.};
1679   Double_t xmaxrecMCInjectLaCone[4] = {100., 1.25, 12., 1.};
1680   fhnrecMCInjectLaCone          = new THnSparseF("fhnrecMCInjectLaCone","La jet pT;inv. mass; particle pT; particle #eta",4,binsrecMCInjectLaCone,xminrecMCInjectLaCone,xmaxrecMCInjectLaCone);
1681
1682   Int_t binsrecMCInjectALaIncl[3] = {200, 120, 200};
1683   Double_t xminrecMCInjectALaIncl[3] = {1.05, 0., -1.};
1684   Double_t xmaxrecMCInjectALaIncl[3] = {1.25, 12., 1.};
1685   fhnrecMCInjectALaIncl         = new THnSparseF("fhnrecMCInjectALaIncl","ALa inv. mass; particle pT; particle #eta",3,binsrecMCInjectALaIncl,xminrecMCInjectALaIncl,xmaxrecMCInjectALaIncl);
1686
1687   Int_t binsrecMCInjectALaCone[4] = {19, 200, 120, 200};
1688   Double_t xminrecMCInjectALaCone[4] = {5., 1.05, 0., -1.};
1689   Double_t xmaxrecMCInjectALaCone[4] = {100., 1.25, 12., 1.};
1690   fhnrecMCInjectALaCone         = new THnSparseF("fhnrecMCInjectALaCone","ALa inv. mass; particle pT; particle #eta",4,binsrecMCInjectALaCone,xminrecMCInjectALaCone,xmaxrecMCInjectALaCone);
1691
1692
1693   Int_t binsMCrecK0Cone[4] = {19, 200, 120, 200};
1694   Double_t xminMCrecK0Cone[4] = {5.,0.3, 0., -1.};
1695   Double_t xmaxMCrecK0Cone[4] = {100.,0.7, 12., 1.};
1696   fhnMCrecK0Cone                = new THnSparseF("fhnMCrecK0Cone", "MC rec {K^{0}}^{s} #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecK0Cone,xminMCrecK0Cone,xmaxMCrecK0Cone);  
1697
1698   Int_t binsMCrecLaCone[4] = {19, 200, 120, 200};
1699   Double_t xminMCrecLaCone[4] = {5.,0.3, 0., -1.};
1700   Double_t xmaxMCrecLaCone[4] = {100.,0.7, 12., 1.};
1701   fhnMCrecLaCone                = new THnSparseF("fhnMCrecLaCone", "MC rec {#Lambda #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecLaCone,xminMCrecLaCone,xmaxMCrecLaCone); 
1702
1703   Int_t binsMCrecALaCone[4] = {19, 200, 120, 200};
1704   Double_t xminMCrecALaCone[4] = {5.,0.3, 0., -1.};
1705   Double_t xmaxMCrecALaCone[4] = {100.,0.7, 12., 1.};
1706   fhnMCrecALaCone                = new THnSparseF("fhnMCrecALaCone", "MC rec {#bar{#Lambda} #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecALaCone,xminMCrecALaCone,xmaxMCrecALaCone); 
1707   
1708   Int_t binsMCrecK0ConeSmear[4] = {19, 200, 120, 200};
1709   Double_t xminMCrecK0ConeSmear[4] = {5.,0.3, 0., -1.};
1710   Double_t xmaxMCrecK0ConeSmear[4] = {100.,0.7, 12., 1.};
1711   fhnMCrecK0ConeSmear                = new THnSparseF("fhnMCrecK0ConeSmear", "MC rec {K^{0}}^{s} #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecK0ConeSmear,xminMCrecK0ConeSmear,xmaxMCrecK0ConeSmear);  
1712
1713   Int_t binsMCrecLaConeSmear[4] = {19, 200, 120, 200};
1714   Double_t xminMCrecLaConeSmear[4] = {5.,1.05, 0., -1.};
1715   Double_t xmaxMCrecLaConeSmear[4] = {100.,1.25, 12., 1.};
1716   fhnMCrecLaConeSmear                = new THnSparseF("fhnMCrecLaConeSmear", "MC rec {#Lambda #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecLaConeSmear,xminMCrecLaConeSmear,xmaxMCrecLaConeSmear); 
1717
1718   Int_t binsMCrecALaConeSmear[4] = {19, 200, 120, 200};
1719   Double_t xminMCrecALaConeSmear[4] = {5.,1.05, 0., -1.};
1720   Double_t xmaxMCrecALaConeSmear[4] = {100.,1.25, 12., 1.};
1721   fhnMCrecALaConeSmear                = new THnSparseF("fhnMCrecALaConeSmear", "MC rec {#bar{#Lambda} #it{p}_{T}  in cone around jet axis matching MC gen particle; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",4,binsMCrecALaConeSmear,xminMCrecALaConeSmear,xmaxMCrecALaConeSmear); 
1722
1723   Int_t binsK0sSecContinCone[3] = {19, 120, 200};
1724   Double_t xminK0sSecContinCone[3] = {5.,0., -1.};
1725   Double_t xmaxK0sSecContinCone[3] = {100.,12., 1.};
1726   fhnK0sSecContinCone                = new THnSparseF("fhnK0sSecContinCone", "Secondary contamination {K^{0}}^{s} #it{p}_{T}  in cone around jet axis; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",3,binsK0sSecContinCone,xminK0sSecContinCone,xmaxK0sSecContinCone);  
1727
1728   Int_t binsLaSecContinCone[3] = {19, 120, 200};
1729   Double_t xminLaSecContinCone[3] = {5.,0., -1.};
1730   Double_t xmaxLaSecContinCone[3] = {100.,12., 1.};
1731   fhnLaSecContinCone                = new THnSparseF("fhnLaSecContinCone", "Secondary contamination {#Lambda #it{p}_{T}  in cone around jet axis; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",3,binsLaSecContinCone,xminLaSecContinCone,xmaxLaSecContinCone);
1732
1733   Int_t binsALaSecContinCone[3] = {19, 120, 200};
1734   Double_t xminALaSecContinCone[3] = {5.,0., -1.};
1735   Double_t xmaxALaSecContinCone[3] = {100.,12., 1.};
1736   fhnALaSecContinCone                = new THnSparseF("fhnALaSecContinCone", "Secondary contamination {#bar{#Lambda} #it{p}_{T}  in cone around jet axis; jet #it{p}_{T}; inv mass (GeV/#it{c}^{2};#it{p}_{T}",3,binsALaSecContinCone,xminALaSecContinCone,xmaxALaSecContinCone);
1737
1738   Int_t binsK0sIncl[3] = {200, 120, 200};
1739   Double_t xminK0sIncl[3] = {0.3, 0., -1.};
1740   Double_t xmaxK0sIncl[3] = {0.7, 12., 1.};
1741   fhnK0sIncl                    = new THnSparseF("fhnK0sIncl","K0s inv. mass; particle pT; particle #eta",3,binsK0sIncl,xminK0sIncl,xmaxK0sIncl);
1742
1743   Int_t binsK0sCone[4] = {19, 200, 120, 200};
1744   Double_t xminK0sCone[4] = {5.,0.3, 0., -1.};
1745   Double_t xmaxK0sCone[4] = {100.,0.7, 12., 1.};
1746   fhnK0sCone                    = new THnSparseF("fhnK0sCone","jet pT; K0s inv. mass; particle pT; particle #eta",4,binsK0sCone,xminK0sCone,xmaxK0sCone);
1747
1748   Int_t binsLaIncl[3] = {200, 120, 200};
1749   Double_t xminLaIncl[3] = {1.05, 0., -1.};
1750   Double_t xmaxLaIncl[3] = {1.25, 12., 1.};
1751   fhnLaIncl                    = new THnSparseF("fhnLaIncl","La inv. mass; particle pT; particle #eta",3,binsLaIncl,xminLaIncl,xmaxLaIncl);
1752
1753   Int_t binsLaCone[4] = {19, 200, 120, 200};
1754   Double_t xminLaCone[4] = {5.,1.05, 0., -1.};
1755   Double_t xmaxLaCone[4] = {100.,1.25, 12., 1.};
1756   fhnLaCone                    = new THnSparseF("fhnLaCone","jet pT; La inv. mass; particle pT; particle #eta",4,binsLaCone,xminLaCone,xmaxLaCone);
1757
1758   Int_t binsALaIncl[3] = {200, 120, 200};
1759   Double_t xminALaIncl[3] = {1.05, 0., -1.};
1760   Double_t xmaxALaIncl[3] = {1.25, 12., 1.};
1761   fhnALaIncl                    = new THnSparseF("fhnALaIncl","ALa inv. mass; particle pT; particle #eta",3,binsALaIncl,xminALaIncl,xmaxALaIncl);
1762
1763   Int_t binsALaCone[4] = {19, 200, 120, 200};
1764   Double_t xminALaCone[4] = {5.,1.05, 0., -1.};
1765   Double_t xmaxALaCone[4] = {100.,1.25, 12., 1.};
1766   fhnALaCone                    = new THnSparseF("fhnALaCone","jet pT; ALa inv. mass; particle pT; particle #eta",4,binsALaCone,xminALaCone,xmaxALaCone);
1767
1768   fh1MCMultiplicityPrimary      = new TH1F("fh1MCMultiplicityPrimary", "MC Primary Particles;NPrimary;Count", 201, -0.5, 200.5);
1769   fh1MCMultiplicityTracks       = new TH1F("h1MCMultiplicityTracks", "MC Tracks;Ntracks;Count", 201, -0.5, 200.5);
1770
1771
1772   Int_t binsFeedDownLa[3] = {19, 200, 120};
1773   Double_t xminFeedDownLa[3] = {5.,1.05, 0.};
1774   Double_t xmaxFeedDownLa[3] = {100.,1.25, 12.};
1775   fhnFeedDownLa                 = new THnSparseF("fhnFeedDownLa","#Lambda stemming from feeddown from Xi(0/-)",3,binsFeedDownLa,xminFeedDownLa,xmaxFeedDownLa);
1776
1777   Int_t binsFeedDownALa[3] = {19, 200, 120};
1778   Double_t xminFeedDownALa[3] = {5.,1.05, 0.};
1779   Double_t xmaxFeedDownALa[3] = {100.,1.25, 12.};
1780   fhnFeedDownALa                 = new THnSparseF("fhnFeedDownALa","#bar#Lambda stemming from feeddown from Xibar(0/+)",3,binsFeedDownALa,xminFeedDownALa,xmaxFeedDownALa);
1781
1782   Int_t binsFeedDownLaCone[3] = {19, 200, 120};
1783   Double_t xminFeedDownLaCone[3] = {5.,1.05, 0.};
1784   Double_t xmaxFeedDownLaCone[3] = {100.,1.25, 12.};
1785   fhnFeedDownLaCone             = new THnSparseF("fhnFeedDownLaCone","#Lambda stemming from feeddown from Xi(0/-) in jet cone",3,binsFeedDownLaCone,xminFeedDownLaCone,xmaxFeedDownLaCone);
1786
1787   Int_t binsFeedDownALaCone[3] = {19, 200, 120};
1788   Double_t xminFeedDownALaCone[3] = {5.,1.05, 0.};
1789   Double_t xmaxFeedDownALaCone[3] = {100.,1.25, 12.};
1790   fhnFeedDownALaCone             = new THnSparseF("fhnFeedDownALaCone","#bar#Lambda stemming from feeddown from Xibar(0/+) in jet cone",3,binsFeedDownALaCone,xminFeedDownALaCone,xmaxFeedDownALaCone);
1791
1792
1793   fh1MCProdRadiusK0s            = new TH1F("fh1MCProdRadiusK0s","MC gen. MC K0s prod radius",100,0.,100.);
1794   fh1MCProdRadiusLambda         = new TH1F("fh1MCProdRadiusLambda","MC gen. MC La prod radius",100,0.,100.);
1795   fh1MCProdRadiusAntiLambda     = new TH1F("fh1MCProdRadiusAntiLambda","MC gen. MC ALa prod radius",100,0.,100.);
1796
1797   // Pt and inv mass distributions
1798
1799   fh1MCPtV0s                    = new TH1F("fh1MCPtV0s", "MC gen. V^{0} in rap range;#it{p}_{T} (GeV/#it{c})",120,0,12.);// 0.1 GeV/c steps
1800   fh1MCPtK0s                    = new TH1F("fh1MCPtK0s", "MC gen. K^{0}_{s} in eta range;#it{p}_{T} (GeV/#it{c})",120,0.,12.);
1801   fh1MCPtLambda                 = new TH1F("fh1MCPtLambda", "MC gen. #Lambda in rap range;#it{p}_{T} (GeV/#it{c})",120,0.,12.);
1802   fh1MCPtAntiLambda             = new TH1F("fh1MCPtAntiLambda", "MC gen. #AntiLambda in rap range;#it{p}_{T} (GeV/#it{c})",120,0.,12.);
1803   fh1MCXiPt                     = new TH1F("fh1MCXiPt", "MC gen. #Xi^{-/o};#it{p}_{T} (GeV/#it{c})",120,0.,12.);
1804   fh1MCXibarPt                  = new TH1F("fh1MCXibarPt", "MC gen. #bar{#Xi}^{+/o};#it{p}_{T} (GeV/#it{c})",120,0.,12.);
1805   fh2MCEtaVsPtK0s               = new TH2F("fh2MCEtaVsPtK0s","MC gen. K^{0}_{s} #eta; #it{p}_{T}",120,0.,12.,200,-1.,1.);
1806   fh2MCEtaVsPtLa                = new TH2F("fh2MCEtaVsPtLa","MC gen. #Lambda #eta; #it{p}_{T}",120,0.,12.,200,-1.,1.);
1807   fh2MCEtaVsPtALa               = new TH2F("fh2MCEtaVsPtALa","MC gen. #bar{#Lambda}  #eta; #it{p}_{T}",120,0.,12.,200,-1.,1.);
1808
1809   // Rapidity
1810   //fh1MCRapK0s                   = new TH1F("fh1MCRapK0s", "MC gen. K0s;rap with cut",200,-10,10); 
1811   //fh1MCRapLambda                = new TH1F("fh1MCRapLambda", "MC gen. #Lambda;rap",200,-10,10);
1812   //fh1MCRapAntiLambda            = new TH1F("fh1MCRapAntiLambda", "MC gen. #bar{#Lambda};rap",200,-10,10);
1813   fh1MCEtaAllK0s                = new TH1F("fh1MCEtaAllK0s", "MC gen. K0s;#eta",200,-1.,1.); 
1814   fh1MCEtaK0s                   = new TH1F("fh1MCEtaK0s", "MC gen. K0s;#eta with cut",200,-1.,1.); 
1815   fh1MCEtaLambda                = new TH1F("fh1MCEtaLambda", "MC gen. #Lambda;#eta",200,-1.,1.);
1816   fh1MCEtaAntiLambda            = new TH1F("fh1MCEtaAntiLambda", "MC gen. #bar{#Lambda};#eta",200,-1.,1.);
1817
1818   fV0QAK0->DefineHistos();
1819   fFFHistosRecCuts->DefineHistos();
1820   fFFHistosRecCutsK0Evt->DefineHistos();
1821   /* fFFHistosIMK0AllEvt->DefineHistos();
1822   fFFHistosIMK0Jet->DefineHistos();
1823   fFFHistosIMK0Cone->DefineHistos();
1824   fFFHistosIMLaAllEvt->DefineHistos();
1825   fFFHistosIMLaJet->DefineHistos();
1826   fFFHistosIMLaCone->DefineHistos();
1827   fFFHistosIMALaAllEvt->DefineHistos();
1828   fFFHistosIMALaJet->DefineHistos();
1829   fFFHistosIMALaCone->DefineHistos();
1830   */
1831
1832   const Int_t saveLevel = 5;
1833   if(saveLevel>0){
1834
1835     fCommonHistList->Add(fh1EvtAllCent);
1836     fCommonHistList->Add(fh1Evt);
1837     fCommonHistList->Add(fh1EvtSelection);
1838     fCommonHistList->Add(fh1EvtCent);
1839     fCommonHistList->Add(fh1VertexNContributors);
1840     fCommonHistList->Add(fh1VertexZ);
1841     fCommonHistList->Add(fh1Xsec);
1842     fCommonHistList->Add(fh1Trials);
1843     fCommonHistList->Add(fh1PtHard);
1844     fCommonHistList->Add(fh1PtHardTrials);
1845     fCommonHistList->Add(fh1nRecJetsCuts);
1846     fCommonHistList->Add(fh1EvtMult);
1847     fCommonHistList->Add(fh1K0Mult);
1848     fCommonHistList->Add(fh1dPhiJetK0);
1849     fCommonHistList->Add(fh1LaMult);
1850     fCommonHistList->Add(fh1dPhiJetLa);
1851     fCommonHistList->Add(fh1ALaMult);
1852     fCommonHistList->Add(fh1dPhiJetALa);
1853     fCommonHistList->Add(fh1JetEta);        
1854     fCommonHistList->Add(fh1JetPhi);               
1855     fCommonHistList->Add(fh2JetEtaPhi);
1856     //fCommonHistList->Add(fh1V0JetPt); 
1857     fCommonHistList->Add(fh1IMK0Cone);
1858     fCommonHistList->Add(fh1IMLaCone);
1859     fCommonHistList->Add(fh1IMALaCone);
1860     fCommonHistList->Add(fh2FFJetTrackEta);   
1861     // fCommonHistList->Add(fh1trackPosNCls);           
1862     //fCommonHistList->Add(fh1trackNegNCls);          
1863     fCommonHistList->Add(fh1trackPosEta);            
1864     fCommonHistList->Add(fh1trackNegEta);          
1865     fCommonHistList->Add(fh1V0Eta); 
1866     // fCommonHistList->Add(fh1V0totMom);        
1867     fCommonHistList->Add(fh1CosPointAngle);                      
1868     fCommonHistList->Add(fh1DecayLengthV0); 
1869     fCommonHistList->Add(fh2ProperLifetimeK0sVsPtBeforeCut);
1870     fCommonHistList->Add(fh2ProperLifetimeK0sVsPtAfterCut);
1871     fCommonHistList->Add(fh1V0Radius);     
1872     fCommonHistList->Add(fh1DcaV0Daughters);        
1873     fCommonHistList->Add(fh1DcaPosToPrimVertex);   
1874     fCommonHistList->Add(fh1DcaNegToPrimVertex);    
1875     fCommonHistList->Add(fh2ArmenterosBeforeCuts);
1876     fCommonHistList->Add(fh2ArmenterosAfterCuts);
1877     fCommonHistList->Add(fh2BBLaPos);
1878     fCommonHistList->Add(fh2BBLaNeg);
1879     fCommonHistList->Add(fh1PosDaughterCharge);
1880     fCommonHistList->Add(fh1NegDaughterCharge);
1881     fCommonHistList->Add(fh1PtMCK0s);
1882     fCommonHistList->Add(fh1PtMCLa);
1883     fCommonHistList->Add(fh1PtMCALa);
1884     fCommonHistList->Add(fh1EtaK0s);
1885     fCommonHistList->Add(fh1EtaLa);
1886     fCommonHistList->Add(fh1EtaALa);
1887     fCommonHistList->Add(fh1RC);   
1888     fCommonHistList->Add(fh1RCBiasK0);
1889     fCommonHistList->Add(fh1RCBiasLa);
1890     fCommonHistList->Add(fh1RCBiasALa);                       
1891     fCommonHistList->Add(fh1MCC);                          
1892     fCommonHistList->Add(fh1OC);                          
1893     fCommonHistList->Add(fh1NJ);              
1894     fCommonHistList->Add(fhnInvMassEtaTrackPtK0s);
1895     fCommonHistList->Add(fhnInvMassEtaTrackPtLa);
1896     fCommonHistList->Add(fhnInvMassEtaTrackPtALa);
1897     fCommonHistList->Add(fh1TrackMultCone);
1898     fCommonHistList->Add(fh2TrackMultCone);
1899     fCommonHistList->Add(fhnNJK0);
1900     fCommonHistList->Add(fhnNJLa);
1901     fCommonHistList->Add(fhnNJALa);
1902     //fCommonHistList->Add(fh2MCgenK0Cone);
1903     //fCommonHistList->Add(fh2MCgenLaCone);
1904     //fCommonHistList->Add(fh2MCgenALaCone);
1905     //fCommonHistList->Add(fh2MCEtagenK0Cone);
1906     //fCommonHistList->Add(fh2MCEtagenLaCone);
1907     //fCommonHistList->Add(fh2MCEtagenALaCone);
1908     fCommonHistList->Add(fh2CorrHijingLaProton);
1909     fCommonHistList->Add(fh2CorrInjectLaProton);
1910     fCommonHistList->Add(fh2CorrHijingALaAProton);
1911     fCommonHistList->Add(fh2CorrInjectALaAProton);
1912     fCommonHistList->Add(fh2MCEtaVsPtHijingLa);
1913     fCommonHistList->Add(fh2MCEtaVsPtInjectLa);
1914     fCommonHistList->Add(fh2MCEtaVsPtHijingALa);
1915     fCommonHistList->Add(fh2MCEtaVsPtInjectALa);
1916     fCommonHistList->Add(fh1IMK0ConeSmear);
1917     fCommonHistList->Add(fh1IMLaConeSmear);
1918     fCommonHistList->Add(fh1IMALaConeSmear);
1919     fCommonHistList->Add(fhnrecMCHijingLaIncl);
1920     fCommonHistList->Add(fhnrecMCHijingLaCone);
1921     fCommonHistList->Add(fhnrecMCHijingALaIncl);
1922     fCommonHistList->Add(fhnrecMCHijingALaCone);
1923     fCommonHistList->Add(fhnrecMCInjectLaIncl);
1924     fCommonHistList->Add(fhnrecMCInjectLaCone);
1925     fCommonHistList->Add(fhnrecMCInjectALaIncl);
1926     fCommonHistList->Add(fhnrecMCInjectALaCone);
1927     fCommonHistList->Add(fhnMCrecK0Cone);
1928     fCommonHistList->Add(fhnMCrecLaCone);
1929     fCommonHistList->Add(fhnMCrecALaCone); 
1930     fCommonHistList->Add(fhnMCrecK0ConeSmear);
1931     fCommonHistList->Add(fhnMCrecLaConeSmear);
1932     fCommonHistList->Add(fhnMCrecALaConeSmear); 
1933     fCommonHistList->Add(fhnK0sSecContinCone);
1934     fCommonHistList->Add(fhnLaSecContinCone);
1935     fCommonHistList->Add(fhnALaSecContinCone);
1936     fCommonHistList->Add(fhnK0sIncl);
1937     fCommonHistList->Add(fhnK0sCone);
1938     fCommonHistList->Add(fhnLaIncl);
1939     fCommonHistList->Add(fhnLaCone);
1940     fCommonHistList->Add(fhnALaIncl);
1941     fCommonHistList->Add(fhnALaCone);
1942     fCommonHistList->Add(fhnK0sPC);
1943     fCommonHistList->Add(fhnLaPC);
1944     fCommonHistList->Add(fhnALaPC);
1945     fCommonHistList->Add(fhnK0sMCC);
1946     fCommonHistList->Add(fhnLaMCC);
1947     fCommonHistList->Add(fhnALaMCC);
1948     fCommonHistList->Add(fhnK0sRC);
1949     fCommonHistList->Add(fhnLaRC);
1950     fCommonHistList->Add(fhnALaRC);
1951     fCommonHistList->Add(fhnK0sRCBias);
1952     fCommonHistList->Add(fhnLaRCBias);
1953     fCommonHistList->Add(fhnALaRCBias);
1954     fCommonHistList->Add(fhnK0sOC);
1955     fCommonHistList->Add(fhnLaOC);
1956     fCommonHistList->Add(fhnALaOC);
1957     fCommonHistList->Add(fh1AreaExcluded); 
1958     fCommonHistList->Add(fh1MedianEta);
1959     fCommonHistList->Add(fh1JetPtMedian);
1960     fCommonHistList->Add(fh1MCMultiplicityPrimary);       
1961     fCommonHistList->Add(fh1MCMultiplicityTracks);       
1962     fCommonHistList->Add(fhnFeedDownLa);
1963     fCommonHistList->Add(fhnFeedDownALa);
1964     fCommonHistList->Add(fhnFeedDownLaCone);
1965     fCommonHistList->Add(fhnFeedDownALaCone);
1966     fCommonHistList->Add(fh1MCProdRadiusK0s);
1967     fCommonHistList->Add(fh1MCProdRadiusLambda);
1968     fCommonHistList->Add(fh1MCProdRadiusAntiLambda);
1969     fCommonHistList->Add(fh1MCPtV0s);                    
1970     fCommonHistList->Add(fh1MCPtK0s);
1971     fCommonHistList->Add(fh1MCPtLambda);    
1972     fCommonHistList->Add(fh1MCPtAntiLambda);
1973     fCommonHistList->Add(fh1MCXiPt);
1974     fCommonHistList->Add(fh1MCXibarPt);
1975     fCommonHistList->Add(fh2MCEtaVsPtK0s); 
1976     fCommonHistList->Add(fh2MCEtaVsPtLa);
1977     fCommonHistList->Add(fh2MCEtaVsPtALa);     
1978     //fCommonHistList->Add(fh1MCRapK0s);
1979     //fCommonHistList->Add(fh1MCRapLambda);
1980     //fCommonHistList->Add(fh1MCRapAntiLambda);   
1981     fCommonHistList->Add(fh1MCEtaAllK0s);
1982     fCommonHistList->Add(fh1MCEtaK0s);
1983     fCommonHistList->Add(fh1MCEtaLambda);
1984     fCommonHistList->Add(fh1MCEtaAntiLambda);         
1985
1986
1987
1988     fV0QAK0->AddToOutput(fCommonHistList);
1989     fFFHistosRecCuts->AddToOutput(fCommonHistList);
1990     fFFHistosRecCutsK0Evt->AddToOutput(fCommonHistList);
1991     // fFFHistosIMK0AllEvt->AddToOutput(fCommonHistList);
1992     // fFFHistosIMK0Jet->AddToOutput(fCommonHistList);
1993     // fFFHistosIMK0Cone->AddToOutput(fCommonHistList);
1994     // fFFHistosIMLaAllEvt->AddToOutput(fCommonHistList);
1995     // fFFHistosIMLaJet->AddToOutput(fCommonHistList);
1996     // fFFHistosIMLaCone->AddToOutput(fCommonHistList);
1997     // fFFHistosIMALaAllEvt->AddToOutput(fCommonHistList);
1998     // fFFHistosIMALaJet->AddToOutput(fCommonHistList);
1999     // fFFHistosIMALaCone->AddToOutput(fCommonHistList);
2000     
2001  
2002   }
2003
2004     // =========== Switch on Sumw2 for all histos ===========
2005   for (Int_t i=0; i<fCommonHistList->GetEntries(); ++i){
2006
2007    TH1 *h1 = dynamic_cast<TH1*>(fCommonHistList->At(i));
2008  
2009    if (h1) h1->Sumw2();//The error per bin will be computed as sqrt(sum of squares of weight) for each bin
2010     else{   
2011       THnSparse *hnSparse = dynamic_cast<THnSparse*>(fCommonHistList->At(i));
2012       if(hnSparse) hnSparse->Sumw2();
2013     }
2014
2015   }
2016   TH1::AddDirectory(oldStatus);
2017  PostData(1, fCommonHistList); 
2018 }
2019
2020 //_______________________________________________
2021 void AliAnalysisTaskJetChem::UserExec(Option_t *) 
2022 {
2023   // Main loop
2024   // Called for each event
2025
2026   if(fDebug > 1) Printf("AliAnalysisTaskJetChem::UserExec()");
2027    
2028   if(fDebug > 1) Printf("Analysis event #%5d", (Int_t) fEntry);
2029
2030    // Trigger selection
2031   AliInputEventHandler* inputHandler = (AliInputEventHandler*)
2032     ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
2033   
2034
2035   //for AliPIDResponse:
2036   //AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
2037   //AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
2038   fPIDResponse = inputHandler->GetPIDResponse();
2039
2040   if (!fPIDResponse){if(fDebug > 1) Printf("AliAnalysisTaskJetChem::UserExec(): fPIDResponse does not exist!"); return;}
2041
2042   //std::cout<<"inputHandler->IsEventSelected(): "<<inputHandler->IsEventSelected()<<std::endl;
2043   //std::cout<<"fEvtSelectionMask: "<<fEvtSelectionMask<<std::endl;
2044   
2045   if(!(inputHandler->IsEventSelected() & fEvtSelectionMask)){
2046     //std::cout<<"########event rejected!!############"<<std::endl;
2047     fh1EvtSelection->Fill(1.);
2048     if (fDebug > 1 ) Printf(" Trigger Selection: event REJECTED ... ");
2049     PostData(1, fCommonHistList);
2050     return;
2051   } 
2052   
2053   fESD = dynamic_cast<AliESDEvent*>(InputEvent());//casting of pointers for inherited class, only for ESDs
2054   if(!fESD){
2055     if(fDebug>3) Printf("%s:%d ESDEvent not found in the input", (char*)__FILE__,__LINE__);
2056   }
2057   
2058   fMCEvent = MCEvent();
2059   if(!fMCEvent){
2060     if(fDebug>3) Printf("%s:%d MCEvent not found in the input", (char*)__FILE__,__LINE__);
2061   }
2062   
2063   // get AOD event from input/output         
2064   TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
2065   if( handler && handler->InheritsFrom("AliAODInputHandler") ) {
2066     fAOD  =  ((AliAODInputHandler*)handler)->GetEvent();
2067     if(fUseAODInputJets) fAODJets = fAOD;
2068     if (fDebug > 1)  Printf("%s:%d AOD event from input", (char*)__FILE__,__LINE__);
2069   }
2070   else {
2071     handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
2072     if( handler && handler->InheritsFrom("AliAODHandler") ) {
2073       fAOD = ((AliAODHandler*)handler)->GetAOD();
2074       fAODJets = fAOD;
2075       if (fDebug > 1)  Printf("%s:%d AOD event from output", (char*)__FILE__,__LINE__);
2076     }
2077   }
2078   
2079   if(!fAODJets && !fUseAODInputJets){ // case we have AOD in input & output and want jets from output
2080     TObject* outHandler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler();
2081     if( outHandler && outHandler->InheritsFrom("AliAODHandler") ){
2082       fAODJets = ((AliAODHandler*)outHandler)->GetAOD();
2083       if (fDebug > 1)  Printf("%s:%d jets from output AOD", (char*)__FILE__,__LINE__);
2084     }
2085   }
2086   
2087   if(fNonStdFile.Length()!=0){
2088     // case we have an AOD extension - fetch the jets from the extended output
2089     
2090     AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
2091     fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);    
2092     if(!fAODExtension){
2093       if(fDebug>1)Printf("AODExtension not found for %s",fNonStdFile.Data());
2094     }
2095   }
2096   
2097   if(!fAOD){
2098     Printf("%s:%d AODEvent not found", (char*)__FILE__,__LINE__);
2099     return;
2100   }
2101   if(!fAODJets){
2102     Printf("%s:%d AODEvent with jet branch not found", (char*)__FILE__,__LINE__);
2103     return;
2104   }
2105   
2106   //primary vertex position:
2107   AliAODVertex *myPrimaryVertex = NULL;
2108   myPrimaryVertex = (AliAODVertex*)fAOD->GetPrimaryVertex();
2109   if (!myPrimaryVertex) return;
2110   fh1Evt->Fill(1.);//fill in every event that was accessed with InputHandler
2111
2112   // event selection  *****************************************
2113   
2114   // *** vertex cut ***
2115   AliAODVertex* primVtx = fAOD->GetPrimaryVertex();
2116   Int_t nTracksPrim = primVtx->GetNContributors();
2117   fh1VertexNContributors->Fill(nTracksPrim);
2118   
2119   if (fDebug > 1) Printf("%s:%d primary vertex selection: %d", (char*)__FILE__,__LINE__,nTracksPrim);
2120   //if(!nTracksPrim){
2121   if(nTracksPrim <= 2){
2122     if (fDebug > 1) Printf("%s:%d primary vertex selection: event REJECTED...",(char*)__FILE__,__LINE__); 
2123     fh1EvtSelection->Fill(3.);
2124     PostData(1, fCommonHistList);
2125     return;
2126   }
2127   
2128   fh1VertexZ->Fill(primVtx->GetZ());
2129   
2130   if(TMath::Abs(primVtx->GetZ())>fMaxVertexZ){
2131     if (fDebug > 1) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); 
2132     fh1EvtSelection->Fill(4.);
2133     PostData(1, fCommonHistList);
2134     return; 
2135   }
2136   
2137   // accepts only events that have same "primary" and SPD vertex, special issue of LHC11h PbPb data
2138
2139   //fAOD: pointer to global primary vertex
2140   
2141   const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
2142   
2143   if (TMath::Abs(spdVtx->GetZ() - primVtx->GetZ())>fDeltaVertexZ) { if (fDebug > 1) Printf("deltaZVertex: event REJECTED..."); return;}
2144
2145
2146   //check for vertex radius to be smaller than 1 cm, (that was first applied by Vit Kucera in his analysis)
2147
2148   Double_t vtxX = primVtx->GetX();
2149   Double_t vtxY = primVtx->GetY();
2150  
2151   if(TMath::Sqrt(vtxX*vtxX + vtxY*vtxY)>=1){
2152     if (fDebug > 1) Printf("%s:%d primary vertex r = %f: event REJECTED...",(char*)__FILE__,__LINE__,TMath::Sqrt(vtxX*vtxX + vtxY*vtxY)); 
2153     return; 
2154   }
2155   
2156
2157   TString primVtxName(primVtx->GetName());
2158   
2159   if(primVtxName.CompareTo("TPCVertex",TString::kIgnoreCase) == 1){
2160     if (fDebug > 1) Printf("%s:%d primary vertex selection: TPC vertex, event REJECTED...",(char*)__FILE__,__LINE__);
2161     fh1EvtSelection->Fill(5.);
2162     PostData(1, fCommonHistList);
2163     return;
2164   }
2165   
2166   Bool_t selectedHelper = AliAnalysisHelperJetTasks::Selected();
2167   if(!selectedHelper){
2168     fh1EvtSelection->Fill(6.);
2169     PostData(1, fCommonHistList);
2170     return;
2171   }
2172
2173   // event selection  *****************************************
2174   
2175   Double_t centPercent = -1;
2176   Int_t cl = 0;
2177   if(fEventClass>0){
2178     
2179     if(handler && handler->InheritsFrom("AliAODInputHandler")){ 
2180       
2181       centPercent = fAOD->GetHeader()->GetCentrality();
2182       cl = 1;
2183       //std::cout<<"centPercent: "<<centPercent<<std::endl;
2184       
2185       fh1EvtAllCent->Fill(centPercent);
2186       /*    
2187       if(centPercent>10) cl = 2; //standard PWG-JE binning
2188       if(centPercent>30) cl = 3;
2189       if(centPercent>50) cl = 4;
2190       */
2191     
2192   
2193       if(centPercent < 0) cl = -1;
2194       if(centPercent >= 0)  cl = 1;
2195       if(centPercent > 10) cl = 2; //standard PWG-JE binning
2196       if(centPercent > 30) cl = 3;
2197       if(centPercent > 50) cl = 4;
2198       if(centPercent > 80) cl = 5; //takes centralities higher than my upper edge of 80%, not to be used
2199       
2200     }
2201     else {
2202
2203       cl = AliAnalysisHelperJetTasks::EventClass();
2204
2205       if(fESD) centPercent = fESD->GetCentrality()->GetCentralityPercentile("V0M"); //ESD JetServices Task has the centrality binning 0-10,10-30,30-50,50-80
2206       fh1EvtAllCent->Fill(centPercent);
2207     }
2208     
2209     if(cl!=fEventClass){ // event not in selected event class, reject event#########################################
2210      
2211       if (fDebug > 1) Printf("%s:%d event not in selected event class: event REJECTED ...",(char*)__FILE__,__LINE__);
2212       fh1EvtSelection->Fill(2.);
2213       PostData(1, fCommonHistList);
2214       return;
2215     }
2216   }//end if fEventClass > 0
2217   
2218   
2219   if (fDebug > 1) Printf("%s:%d event ACCEPTED ...",(char*)__FILE__,__LINE__); 
2220   
2221   //test test
2222   //Printf("Analysis event #%5d", (Int_t) fEntry);
2223
2224   fh1EvtSelection->Fill(0.);
2225   fh1EvtCent->Fill(centPercent);
2226     
2227   //___ get MC information __________________________________________________________________
2228
2229  
2230   Double_t ptHard = 0.; //parton energy bins -> energy of particle
2231   Double_t nTrials = 1; // trials for MC trigger weight for real data
2232   
2233   if(fMCEvent){
2234      AliGenEventHeader* genHeader = fMCEvent->GenEventHeader();
2235      AliGenPythiaEventHeader*  pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);//check usage of Pythia (pp) or Hijing (PbPb)
2236      AliGenHijingEventHeader*  hijingGenHeader = 0x0;
2237      
2238      if(pythiaGenHeader){
2239        if(fDebug>3) Printf("%s:%d pythiaGenHeader found", (char*)__FILE__,__LINE__);
2240        nTrials = pythiaGenHeader->Trials();
2241        ptHard  = pythiaGenHeader->GetPtHard();
2242        
2243        fh1PtHard->Fill(ptHard);
2244        fh1PtHardTrials->Fill(ptHard,nTrials);
2245
2246        
2247      } else { // no pythia, hijing?
2248
2249        if(fDebug>3) Printf("%s:%d no pythiaGenHeader found", (char*)__FILE__,__LINE__);
2250        
2251        hijingGenHeader = dynamic_cast<AliGenHijingEventHeader*>(genHeader);
2252        if(!hijingGenHeader){
2253          if(fDebug>3) Printf("%s:%d no pythiaGenHeader or hjingGenHeader found", (char*)__FILE__,__LINE__);
2254        } else {
2255          if(fDebug>3) Printf("%s:%d hijingGenHeader found", (char*)__FILE__,__LINE__);
2256        }
2257      }
2258      
2259      fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
2260   }
2261   
2262     //____ fetch jets _______________________________________________________________
2263
2264   Int_t nJCuts = GetListOfJets(fJetsRecCuts, kJetsRecAcceptance);//fetch list with jets that survived all jet cuts: fJetsRecCuts
2265
2266   Int_t nRecJetsCuts = 0;                                        //number of reconstructed jets after jet cuts
2267   if(nJCuts>=0) nRecJetsCuts = fJetsRecCuts->GetEntries(); 
2268   if(fDebug>2)Printf("%s:%d Selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);
2269   if(nRecJetsCuts != nJCuts) Printf("%s:%d Mismatch selected Rec jets after cuts: %d %d",(char*)__FILE__,__LINE__,nJCuts,nRecJetsCuts);
2270   fh1nRecJetsCuts->Fill(nRecJetsCuts);
2271
2272
2273   //____ fetch background clusters ___________________________________________________
2274   if(fBranchRecBckgClusters.Length() != 0){
2275
2276     Int_t nBJ = GetListOfBckgJets(fBckgJetsRec, kJetsRec);
2277     Int_t nRecBckgJets = 0;
2278     if(nBJ>=0) nRecBckgJets = fBckgJetsRec->GetEntries();
2279     if(fDebug>2)Printf("%s:%d Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);
2280     if(nBJ != nRecBckgJets) Printf("%s:%d Mismatch Selected Rec background jets: %d %d",(char*)__FILE__,__LINE__,nBJ,nRecBckgJets);
2281   }
2282
2283   
2284   //____ fetch reconstructed particles __________________________________________________________
2285  
2286   Int_t nTCuts = GetListOfTracks(fTracksRecCuts, kTrackAODCuts);//all tracks of event
2287   if(fDebug>2)Printf("%s:%d selected reconstructed tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,fTracksRecCuts->GetEntries());
2288   if(fTracksRecCuts->GetEntries() != nTCuts) 
2289     Printf("%s:%d Mismatch selected reconstructed tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nTCuts,fTracksRecCuts->GetEntries());
2290   fh1EvtMult->Fill(fTracksRecCuts->GetEntries());
2291
2292   Int_t nK0s = GetListOfV0s(fListK0s,fK0Type,kK0,myPrimaryVertex,fAOD);//all V0s in event with K0s assumption
2293   
2294   if(fDebug>5){std::cout<<"fK0Type: "<<fK0Type<<" kK0: "<<kK0<<" myPrimaryVertex: "<<myPrimaryVertex<<" fAOD:  "<<fAOD<<std::endl;} 
2295
2296   //std::cout<< "nK0s: "<<nK0s<<std::endl;
2297
2298   if(fDebug>2)Printf("%s:%d Selected V0s after cuts: %d %d",(char*)__FILE__,__LINE__,nK0s,fListK0s->GetEntries());
2299   if(nK0s != fListK0s->GetEntries()) Printf("%s:%d Mismatch selected K0s: %d %d",(char*)__FILE__,__LINE__,nK0s,fListK0s->GetEntries());
2300   fh1K0Mult->Fill(fListK0s->GetEntries());
2301
2302   
2303   Int_t nLa = GetListOfV0s(fListLa,fLaType,kLambda,myPrimaryVertex,fAOD);//all V0s in event with Lambda particle assumption 
2304   if(fDebug>2)Printf("%s:%d Selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nLa,fListLa->GetEntries());
2305   if(nLa != fListLa->GetEntries()) Printf("%s:%d Mismatch selected La: %d %d",(char*)__FILE__,__LINE__,nLa,fListLa->GetEntries());
2306   fh1LaMult->Fill(fListLa->GetEntries());
2307  
2308   Int_t nALa = GetListOfV0s(fListALa,fALaType,kAntiLambda,myPrimaryVertex,fAOD);//all V0s in event with Antilambda particle assumption
2309   if(fDebug>2)Printf("%s:%d Selected Rec tracks after cuts: %d %d",(char*)__FILE__,__LINE__,nALa,fListALa->GetEntries());
2310   if(nALa != fListALa->GetEntries()) Printf("%s:%d Mismatch selected ALa: %d %d",(char*)__FILE__,__LINE__,nALa,fListALa->GetEntries());
2311   fh1ALaMult->Fill(fListALa->GetEntries());
2312
2313
2314     
2315   //fetch MC gen particles_______________________________________________________
2316
2317   if(fAnalysisMC){ // here 
2318
2319     //fill feeddown histo for associated particles
2320
2321     // Access MC generated particles, fill TLists and histograms :
2322     
2323     Int_t nMCgenK0s = GetListOfMCParticles(fListMCgenK0s,kK0,fAOD); //fill TList with MC generated primary true K0s (list to fill, particletype, mc aod event)
2324     if(nMCgenK0s != fListMCgenK0s->GetEntries()) Printf("%s:%d Mismatch selected MCgenK0s: %d %d",(char*)__FILE__,__LINE__,nMCgenK0s,fListMCgenK0s->GetEntries());
2325     
2326     
2327     for(Int_t it=0; it<fListMCgenK0s->GetSize(); ++it){ // loop MC generated K0s, filling histograms
2328       
2329       AliAODMCParticle* mcp0 = dynamic_cast<AliAODMCParticle*>(fListMCgenK0s->At(it));
2330       if(!mcp0) continue;
2331       
2332       //MC gen K0s                  
2333       
2334       //Double_t fRapCurrentPart   = MyRapidity(mcp0->E(),mcp0->Pz());
2335       Double_t fEtaCurrentPart   = mcp0->Eta();
2336       Double_t fPtCurrentPart    = mcp0->Pt();
2337       
2338       fh1MCEtaK0s->Fill(fEtaCurrentPart); 
2339       //fh1MCRapK0s->Fill(fRapCurrentPart);
2340       fh1MCPtK0s->Fill(fPtCurrentPart);   
2341       
2342       fh2MCEtaVsPtK0s->Fill(fPtCurrentPart,fEtaCurrentPart);                  //eta cut, physical primary selection and decay mode considered
2343
2344     }//end of the loop
2345         
2346     Int_t nMCgenLa = GetListOfMCParticles(fListMCgenLa,kLambda,fAOD); //fill TList with MC generated primary true Lambdas (list to fill, particletype, mc aod event)
2347     if(nMCgenLa != fListMCgenLa->GetEntries()) Printf("%s:%d Mismatch selected MCgenLa: %d %d",(char*)__FILE__,__LINE__,nMCgenLa,fListMCgenLa->GetEntries());
2348
2349     TList *mclist = fAOD->GetList();    
2350     TClonesArray *stackMC = 0x0;
2351     stackMC = (TClonesArray*)mclist->FindObject(AliAODMCParticle::StdBranchName());
2352     if (!stackMC) {
2353       Printf("ERROR: AliAnalysisTaskJetChem.cxx: loop over MC gen. particles: stackMC not available!");
2354     }
2355     
2356     AliAODMCHeader *mcHdr=(AliAODMCHeader*)mclist->FindObject(AliAODMCHeader::StdBranchName());
2357     if(!mcHdr)Printf("ERROR: AliAnalysisTaskJetChem.cxx: loop over MC gen. particles: mcHdr not available!");
2358           
2359     for(Int_t it=0; it<fListMCgenLa->GetSize(); ++it){ // loop MC generated La, filling histograms
2360       
2361       AliAODMCParticle* mcp0 = dynamic_cast<AliAODMCParticle*>(fListMCgenLa->At(it));
2362       if(!mcp0) continue;
2363           
2364       //MC gen Lambdas  
2365       
2366       //Double_t fRapCurrentPart   = MyRapidity(mcp0->E(),mcp0->Pz());
2367       Double_t fEtaCurrentPart   = mcp0->Eta();
2368       Double_t fPtCurrentPart    = mcp0->Pt();
2369       TString generatorName;
2370       
2371       fh1MCEtaLambda->Fill(fEtaCurrentPart); 
2372       //fh1MCRapLambda->Fill(fRapCurrentPart);
2373       fh1MCPtLambda->Fill(fPtCurrentPart);        
2374       fh2MCEtaVsPtLa->Fill(fPtCurrentPart,fEtaCurrentPart);                  //eta cut, physical primary selection and decay mode considered
2375
2376       Int_t mcp0label = mcp0->GetLabel();
2377       Bool_t istrackInject = IsTrackInjected(mcp0label, mcHdr, stackMC, generatorName);  
2378     
2379       //std::cout<<"generatorName: "<<generatorName<<std::endl;
2380
2381
2382       if(generatorName == "Hijing"){
2383         fh2MCEtaVsPtHijingLa->Fill(fPtCurrentPart,fEtaCurrentPart);
2384       }
2385       
2386       if(istrackInject == kTRUE){
2387         fh2MCEtaVsPtInjectLa->Fill(fPtCurrentPart,fEtaCurrentPart);
2388       }  
2389       
2390     }//end of the loop
2391       
2392       
2393     Int_t nMCgenALa = GetListOfMCParticles(fListMCgenALa,kAntiLambda,fAOD); //fill TList with MC generated primary true Antilambdas (list to fill, particletype, mc aod event)
2394     if(nMCgenALa != fListMCgenALa->GetEntries()) Printf("%s:%d Mismatch selected MCgenALa: %d %d",(char*)__FILE__,__LINE__,nMCgenALa,fListMCgenALa->GetEntries());
2395   
2396         
2397     for(Int_t it=0; it<fListMCgenALa->GetSize(); ++it){ // loop MC generated ALa, filling histograms
2398       
2399       AliAODMCParticle* mcp0 = dynamic_cast<AliAODMCParticle*>(fListMCgenALa->At(it));
2400       if(!mcp0) continue;
2401       
2402       //MC gen Antilambdas                  
2403       
2404       //Double_t fRapCurrentPart   = MyRapidity(mcp0->E(),mcp0->Pz());
2405       Double_t fEtaCurrentPart   = mcp0->Eta();
2406       Double_t fPtCurrentPart    = mcp0->Pt();
2407       TString generatorName;
2408
2409       fh1MCEtaAntiLambda->Fill(fEtaCurrentPart); 
2410       //fh1MCRapAntiLambda->Fill(fRapCurrentPart);
2411       fh1MCPtAntiLambda->Fill(fPtCurrentPart);    
2412       fh2MCEtaVsPtALa->Fill(fPtCurrentPart,fEtaCurrentPart);                  //eta cut, physical primary selection and decay mode considered
2413
2414
2415       Int_t mcp0label = mcp0->GetLabel();
2416       Bool_t istrackInject = IsTrackInjected(mcp0label, mcHdr, stackMC, generatorName);  
2417     
2418       //std::cout<<"generatorName: "<<generatorName<<std::endl;
2419
2420
2421       if(generatorName == "Hijing"){
2422         fh2MCEtaVsPtHijingALa->Fill(fPtCurrentPart,fEtaCurrentPart);
2423       }
2424       
2425       if(istrackInject == kTRUE){
2426         fh2MCEtaVsPtInjectALa->Fill(fPtCurrentPart,fEtaCurrentPart);
2427       }  
2428
2429         
2430     }//end of the loop
2431
2432         
2433
2434   //loop over MC feeddown candidates in TList
2435
2436     //.... 
2437
2438         
2439   } //end MCAnalysis part for gen particles
2440       
2441       
2442   // ___ V0 QA + K0s + La + ALa pt spectra all events _______________________________________________
2443   
2444   Double_t lPrimaryVtxPosition[3];
2445   Double_t lV0Position[3];
2446   lPrimaryVtxPosition[0] = primVtx->GetX();
2447   lPrimaryVtxPosition[1] = primVtx->GetY();
2448   lPrimaryVtxPosition[2] = primVtx->GetZ();
2449   Double_t dRadiusExcludeCone = 2*GetFFRadius(); //2 times jet radius
2450   //------------------------------------------
2451  for(Int_t it=0; it<fListK0s->GetSize(); ++it){ 
2452         
2453     AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0s->At(it));
2454     if(!v0) continue;
2455
2456     // VO's main characteristics to check the reconstruction cuts
2457     
2458     //Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
2459     Double_t invMK0s=0;
2460     Double_t trackPt=0;   
2461     Double_t fV0Radius      = -999;
2462     Double_t fDcaV0Daughters = v0->DcaV0Daughters();
2463     Double_t fDcaPosToPrimVertex = v0->DcaPosToPrimVertex();//IP of positive charged daughter
2464     Double_t fDcaNegToPrimVertex = v0->DcaNegToPrimVertex();//IP of negative charged daughter
2465     Int_t negDaughterpdg = 0;
2466     Int_t posDaughterpdg = 0;
2467     Int_t motherType = 0;
2468     Int_t v0Label = -1;
2469     Double_t MCPt = 0;
2470     Bool_t fPhysicalPrimary = kFALSE;//don't use IsPhysicalPrimary() anymore for MC analysis, use instead 2D distance from primary to secondary vertex
2471     Int_t MCv0PdgCode = 0;
2472
2473     AliAODTrack *trackPos = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(0));  
2474     AliAODTrack *trackNeg = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(1));   
2475     
2476     Double_t PosEta = trackPos->AliAODTrack::Eta();//daughter track charge is sometimes wrong here, account for that!!!
2477     Double_t NegEta = trackNeg->AliAODTrack::Eta();
2478     
2479     //Double_t trackPosNcls = trackPos->GetTPCNcls();//Get number of clusters for positive charged tracks
2480     //Double_t trackNegNcls = trackNeg->GetTPCNcls();//Get number of clusters for negative charged tracks
2481     
2482     CalculateInvMass(v0, kK0, invMK0s, trackPt);  //function to calculate invMass with TLorentzVector class
2483     
2484  
2485     //OUTSIDE CONES:########
2486
2487     Double_t fEta = v0->PseudoRapV0();
2488     Bool_t bIsInCone = kFALSE;//init boolean, is not in any cone (OC)
2489     Int_t nRemainingJets = nRecJetsCuts; //init value    Int_t nRemainingJets = nRecJetsCuts; //init value 
2490
2491     for(Int_t ij=0; ij<nRecJetsCuts; ++ij){ // loop over all jets in event 
2492       
2493       AliAODJet* jet = (AliAODJet*) (fJetsRecCuts->At(ij));
2494       jettracklist->Clear();
2495       Double_t sumPt      = 0.;
2496       Bool_t isBadJet     = kFALSE;
2497  
2498       if(GetFFRadius()<=0){
2499         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);// list of jet tracks from trackrefs
2500       } else {
2501         GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);  // fill list of tracks in cone around jet axis with cone Radius (= 0.4 standard)
2502       }
2503       
2504       //leading track pt bias on jets inside this small jet loop
2505       //APPLICATION OF REMAINING JET CUTS (leading track pt bias etc..):
2506       if(isBadJet){
2507         nRemainingJets = nRemainingJets-1;//remove one jet from nRemainingJets (was initialized with nRecJetsCuts) continue;//all bad jets are rejected
2508         continue;
2509       }
2510
2511       //if jet is selected, then check whether V0 is part of the jet cone:
2512       if(IsParticleInCone(jet, v0, dRadiusExcludeCone) == kTRUE) {bIsInCone = kTRUE;}
2513       
2514       jettracklist->Clear();
2515     }
2516     
2517     if((bIsInCone==kFALSE)&&(nRemainingJets > 0)){//K0s is not part of any selected jet in event, but its a jet event
2518       Double_t vK0sOC[3] = {invMK0s,trackPt,fEta};
2519       fhnK0sOC->Fill(vK0sOC);      
2520     }
2521     
2522     //end of outside cone K0s
2523    
2524     Double_t fV0cosPointAngle = v0->CosPointingAngle(lPrimaryVtxPosition);
2525
2526     lV0Position[0]= v0->DecayVertexV0X();  
2527     lV0Position[1]= v0->DecayVertexV0Y();  
2528     lV0Position[2]= v0->DecayVertexV0Z();
2529     
2530     Double_t fV0DecayLength = v0->DecayLengthV0(lPrimaryVtxPosition);
2531     fV0Radius  = TMath::Sqrt(lV0Position[0]*lV0Position[0]+lV0Position[1]*lV0Position[1]);
2532
2533     
2534     fV0QAK0->FillTrackQA(v0->Eta(), TVector2::Phi_0_2pi(v0->Phi()), v0->Pt()); 
2535     //fFFHistosIMK0AllEvt->FillFF(trackPt, invMK0s, jetPt, incrementJetPt);
2536     //fh1trackPosNCls->Fill(trackPosNcls);
2537     //fh1trackNegNCls->Fill(trackNegNcls);
2538     fh1EtaK0s->Fill(fEta);
2539
2540     Double_t vK0sIncl[3] = {invMK0s,trackPt,fEta}; //fill all K0s in event into THnSparse of 3 dimensions
2541     fhnK0sIncl->Fill(vK0sIncl);
2542
2543
2544     if(fAnalysisMC){
2545       TString generatorName;
2546       Bool_t isinjected;
2547       TList *listmc = fAOD->GetList();
2548       Bool_t mclabelcheck = MCLabelCheck(v0, kK0, trackNeg, trackPos, listmc, negDaughterpdg, posDaughterpdg, motherType, v0Label, MCPt, fPhysicalPrimary, MCv0PdgCode, generatorName, isinjected);
2549       //if(fPhysicalPrimary == kFALSE)continue;
2550       //std::cout<<"mclabelcheck: "<<mclabelcheck<<std::endl;
2551       //std::cout<<"IsPhysicalPrimary: "<<fPhysicalPrimary<<std::endl;
2552
2553       if(mclabelcheck == kFALSE)continue;
2554       
2555       Double_t vInvMassEtaTrackPtK0s[3] = {fEta,invMK0s,trackPt};
2556       fhnInvMassEtaTrackPtK0s->Fill(vInvMassEtaTrackPtK0s);//includes also feeddown particles, mainly phi particles whose decay products are considered here as primary
2557
2558
2559       fh1PtMCK0s->Fill(MCPt);
2560     }
2561  
2562
2563     fh1V0Eta->Fill(fEta);
2564     //fh1V0totMom->Fill(fV0TotalMomentum);
2565     fh1CosPointAngle->Fill(fV0cosPointAngle);
2566     fh1DecayLengthV0->Fill(fV0DecayLength);
2567     fh1V0Radius->Fill(fV0Radius);
2568     fh1DcaV0Daughters->Fill(fDcaV0Daughters);
2569     fh1DcaPosToPrimVertex->Fill(fDcaPosToPrimVertex);
2570     fh1DcaNegToPrimVertex->Fill(fDcaNegToPrimVertex);
2571     fh1trackPosEta->Fill(PosEta);
2572     fh1trackNegEta->Fill(NegEta);  
2573   }
2574   
2575
2576   // __La pt spectra all events _______________________________________________
2577
2578     
2579   for(Int_t it=0; it<fListLa->GetSize(); ++it){ // loop all La 
2580       
2581     AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListLa->At(it));
2582     if(!v0) continue;
2583     
2584     // VO's main characteristics to check the reconstruction cuts
2585     //  Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
2586     Double_t invMLa =0;
2587     Double_t trackPt=0;
2588     Double_t fV0Radius      = -999;
2589     Double_t fDcaV0Daughters = v0->DcaV0Daughters();
2590     Double_t fDcaPosToPrimVertex = v0->DcaPosToPrimVertex();//IP of positive charged daughter
2591     Double_t fDcaNegToPrimVertex = v0->DcaNegToPrimVertex();//IP of negative charged daughter
2592     Int_t negDaughterpdg = 0;
2593     Int_t posDaughterpdg = 0;
2594     Int_t motherType = 0;
2595     Int_t v0Label = -1;
2596     Double_t MCPt = 0;
2597     Bool_t fPhysicalPrimary = kFALSE;
2598     Int_t MCv0PdgCode = 0;
2599     AliAODTrack *trackPos = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(0));  
2600     AliAODTrack *trackNeg = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(1));   
2601     
2602     //Double_t trackPosNcls = trackPos->GetTPCNcls();//Get number of clusters for positive charged tracks
2603     //Double_t trackNegNcls = trackNeg->GetTPCNcls();//Get number of clusters for negative charged tracks
2604     
2605     Double_t PosEta = trackPos->AliAODTrack::Eta();//daughter track charge is sometimes wrong here, account for that!!!
2606     Double_t NegEta = trackNeg->AliAODTrack::Eta();
2607     
2608     Double_t fEta = v0->PseudoRapV0();
2609     Bool_t bIsInCone = kFALSE;//init boolean, is not in any cone (OC)
2610     Int_t nRemainingJets = nRecJetsCuts; //init value 
2611
2612     CalculateInvMass(v0, kLambda, invMLa, trackPt);//function to calculate invMass with TLorentzVector class
2613     
2614     
2615     for(Int_t ij=0; ij<nRecJetsCuts; ++ij){ // loop over all jets in event 
2616       
2617       AliAODJet* jet = (AliAODJet*) (fJetsRecCuts->At(ij));
2618       jettracklist->Clear();
2619       Double_t sumPt      = 0.;
2620       Bool_t isBadJet     = kFALSE;
2621  
2622       if(GetFFRadius()<=0){
2623         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);// list of jet tracks from trackrefs
2624       } else {
2625         GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);  // fill list of tracks in cone around jet axis with cone Radius (= 0.4 standard)
2626       }
2627       
2628
2629       //leading track pt bias on jets inside this small jet loop
2630    
2631       if(isBadJet){
2632         nRemainingJets = nRemainingJets-1;//remove one jet from nRemainingJets (was initialized with nRecJetsCuts) continue;//all bad jets are rejected
2633         continue;
2634       }
2635
2636
2637
2638       if(IsParticleInCone(jet, v0, dRadiusExcludeCone) == kTRUE) {bIsInCone = kTRUE;}
2639      
2640       jettracklist->Clear();  
2641     }  //end jet loop  
2642     
2643     if((bIsInCone == kFALSE)&&(nRemainingJets > 0)){//success! Lambda doesn't belong to any selected jet in event
2644       Double_t vLaOC[3] = {invMLa, trackPt,fEta};
2645       fhnLaOC->Fill(vLaOC); 
2646     }
2647     
2648     // Double_t jetPt = fFFIMJetPtMin; // assign pro forma jet energy
2649     // Double_t fRap = v0->Y(3122);
2650     
2651     Double_t fV0DecayLength = v0->DecayLengthV0(lPrimaryVtxPosition);
2652     Double_t fV0cosPointAngle = v0->CosPointingAngle(lPrimaryVtxPosition);
2653     lV0Position[0]= v0->DecayVertexV0X();  
2654     lV0Position[1]= v0->DecayVertexV0Y();  
2655     lV0Position[2]= v0->DecayVertexV0Z();  
2656     
2657     fV0Radius  = TMath::Sqrt(lV0Position[0]*lV0Position[0]+lV0Position[1]*lV0Position[1]);
2658     
2659     //fFFHistosIMLaAllEvt->FillFF(trackPt, invMLa, jetPt, incrementJetPt);
2660     //fh1trackPosNCls->Fill(trackPosNcls);
2661     //fh1trackNegNCls->Fill(trackNegNcls);
2662     fh1EtaLa->Fill(fEta);
2663
2664     Double_t vLaIncl[3] = {invMLa,trackPt,fEta};
2665     fhnLaIncl->Fill(vLaIncl);
2666
2667     if(fAnalysisMC){  
2668    
2669       TString generatorName;
2670       Bool_t isinjected;
2671       TList* listmc = fAOD->GetList();
2672       Bool_t mclabelcheck = MCLabelCheck(v0, kLambda, trackNeg, trackPos, listmc, negDaughterpdg, posDaughterpdg, motherType, v0Label, MCPt, fPhysicalPrimary, MCv0PdgCode, generatorName, isinjected);
2673       if(mclabelcheck == kFALSE)continue; 
2674       //if(fPhysicalPrimary == kFALSE)continue;
2675       
2676       if(generatorName == "Hijing"){
2677         Double_t vrecMCHijingLaIncl[3] = {invMLa,trackPt,fEta};
2678         fhnrecMCHijingLaIncl->Fill(vrecMCHijingLaIncl);
2679
2680         Double_t protonPt = trackPos->Pt();
2681         fh2CorrHijingLaProton->Fill(trackPt,protonPt);
2682       }
2683
2684       if(isinjected == kTRUE){
2685         Double_t vrecMCInjectLaIncl[3] = {invMLa,trackPt,fEta};
2686         fhnrecMCInjectLaIncl->Fill(vrecMCInjectLaIncl);
2687
2688         Double_t protonPt = trackPos->Pt();
2689         fh2CorrInjectLaProton->Fill(trackPt,protonPt);
2690       }
2691
2692       Double_t vInvMassEtaTrackPtLa[3] = {fEta,invMLa,trackPt};
2693       fhnInvMassEtaTrackPtLa->Fill(vInvMassEtaTrackPtLa);//includes also feed-down particles
2694       fh1PtMCLa->Fill(MCPt);
2695       
2696
2697       fh1PtMCLa->Fill(MCPt);
2698   
2699
2700     }
2701     fh1V0Eta->Fill(fEta);
2702     //fh1V0totMom->Fill(fV0TotalMomentum);
2703     fh1CosPointAngle->Fill(fV0cosPointAngle);
2704     fh1DecayLengthV0->Fill(fV0DecayLength);
2705     fh1V0Radius->Fill(fV0Radius);
2706     fh1DcaV0Daughters->Fill(fDcaV0Daughters);
2707     fh1DcaPosToPrimVertex->Fill(fDcaPosToPrimVertex);
2708     fh1DcaNegToPrimVertex->Fill(fDcaNegToPrimVertex);
2709     fh1trackPosEta->Fill(PosEta);
2710     fh1trackNegEta->Fill(NegEta);
2711   }
2712   
2713   // __ALa pt spectra all events _______________________________________________
2714     
2715   for(Int_t it=0; it<fListALa->GetSize(); ++it){ // loop all ALa 
2716     
2717     AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListALa->At(it));
2718     if(!v0) continue;
2719       
2720
2721     //VO's main characteristics to check the reconstruction cuts
2722     Double_t invMALa =0;
2723     Double_t trackPt=0;
2724     Double_t fV0Radius      = -999;
2725     Double_t fDcaV0Daughters = v0->DcaV0Daughters();
2726     Double_t fDcaPosToPrimVertex = v0->DcaPosToPrimVertex();//IP of positive charged daughter
2727     Double_t fDcaNegToPrimVertex = v0->DcaNegToPrimVertex();//IP of negative charged daughter
2728     Int_t negDaughterpdg = 0;
2729     Int_t posDaughterpdg = 0;
2730     Int_t motherType = 0;
2731     Int_t v0Label = -1;
2732     Double_t MCPt = 0;
2733     Bool_t fPhysicalPrimary = kFALSE;
2734     Int_t MCv0PdgCode = 0;
2735     
2736     AliAODTrack *trackPos = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(0));  
2737     AliAODTrack *trackNeg = (AliAODTrack *) (v0->GetSecondaryVtx()->GetDaughter(1));   
2738       
2739     Double_t PosEta = trackPos->AliAODTrack::Eta();//daughter track charge is sometimes wrong here, account for that!!!
2740     Double_t NegEta = trackNeg->AliAODTrack::Eta();
2741
2742     Double_t fEta = v0->PseudoRapV0();
2743     Bool_t bIsInCone = kFALSE;//init boolean for OC     
2744     Int_t nRemainingJets = nRecJetsCuts; //init value 
2745     
2746     CalculateInvMass(v0, kAntiLambda, invMALa, trackPt);  //function to calculate invMass with TLorentzVector class
2747       
2748     for(Int_t ij=0; ij<nRecJetsCuts; ++ij){ // loop over all jets in event 
2749       
2750       AliAODJet* jet = (AliAODJet*) (fJetsRecCuts->At(ij));
2751       jettracklist->Clear();
2752       Double_t sumPt      = 0.;
2753       Bool_t isBadJet     = kFALSE;
2754  
2755
2756       if(GetFFRadius()<=0){
2757         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);// list of jet tracks from trackrefs
2758       } else {
2759         GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);  // fill list of tracks in cone around jet axis with cone Radius (= 0.4 standard)
2760       }
2761       
2762       //leading track pt bias on jets inside this small jet loop
2763   
2764       if(isBadJet){
2765         nRemainingJets = nRemainingJets-1;//remove one jet from nRemainingJets (was initialized with nRecJetsCuts) continue;//all bad jets are rejected
2766         continue;
2767       }
2768
2769
2770       if(IsParticleInCone(jet, v0, dRadiusExcludeCone) == kTRUE){
2771         bIsInCone = kTRUE;      
2772       }
2773
2774       jettracklist->Clear();
2775     }
2776  
2777     if((bIsInCone == kFALSE)&&(nRemainingJets > 0)){//success!
2778       Double_t vALaOC[3] = {invMALa, trackPt,fEta};
2779       fhnALaOC->Fill(vALaOC); 
2780     }
2781     
2782     //Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
2783     //Double_t jetPt = fFFIMJetPtMin; // assign pro forma jet energy
2784     //      Double_t fRap = v0->Y(-3122);
2785
2786     
2787     Double_t fV0cosPointAngle = v0->CosPointingAngle(lPrimaryVtxPosition);
2788     lV0Position[0]= v0->DecayVertexV0X();  
2789     lV0Position[1]= v0->DecayVertexV0Y();  
2790     lV0Position[2]= v0->DecayVertexV0Z();  
2791     Double_t fV0DecayLength = v0->DecayLengthV0(lPrimaryVtxPosition);
2792     fV0Radius  = TMath::Sqrt(lV0Position[0]*lV0Position[0]+lV0Position[1]*lV0Position[1]);
2793        
2794     //fFFHistosIMALaAllEvt->FillFF(trackPt, invMALa, jetPt, incrementJetPt);
2795     //fh1trackPosNCls->Fill(trackPosNcls);
2796     //fh1trackNegNCls->Fill(trackNegNcls);
2797     fh1EtaALa->Fill(fEta);
2798
2799     Double_t vALaIncl[3] = {invMALa,trackPt,fEta};
2800     fhnALaIncl->Fill(vALaIncl);
2801
2802     if(fAnalysisMC){
2803       TString generatorName;
2804       Bool_t isinjected;
2805       TList* listmc = fAOD->GetList();
2806       Bool_t mclabelcheck = MCLabelCheck(v0, kAntiLambda, trackNeg, trackPos, listmc, negDaughterpdg, posDaughterpdg, motherType, v0Label, MCPt, fPhysicalPrimary, MCv0PdgCode, generatorName, isinjected);
2807       if(mclabelcheck == kFALSE)continue; 
2808       //if(fPhysicalPrimary == kFALSE)continue;//take also feeddown particles into account
2809       
2810       if(generatorName == "Hijing"){
2811         Double_t vrecMCHijingALaIncl[3] = {invMALa,trackPt,fEta};
2812         fhnrecMCHijingALaIncl->Fill(vrecMCHijingALaIncl);
2813
2814         Double_t aprotonPt = trackNeg->Pt();
2815         fh2CorrHijingALaAProton->Fill(trackPt,aprotonPt);
2816       }
2817
2818
2819       if(isinjected == kTRUE){
2820         Double_t vrecMCInjectALaIncl[3] = {invMALa,trackPt,fEta};
2821         fhnrecMCInjectALaIncl->Fill(vrecMCInjectALaIncl);
2822
2823         Double_t aprotonPt = trackNeg->Pt();
2824         fh2CorrInjectALaAProton->Fill(trackPt,aprotonPt);
2825
2826       }
2827
2828
2829       Double_t vInvMassEtaTrackPtALa[3] = {fEta,invMALa,trackPt};
2830       fhnInvMassEtaTrackPtALa->Fill(vInvMassEtaTrackPtALa);
2831       fh1PtMCALa->Fill(MCPt);
2832
2833     }
2834     fh1V0Eta->Fill(fEta);
2835     //fh1V0totMom->Fill(fV0TotalMomentum);
2836     fh1CosPointAngle->Fill(fV0cosPointAngle);
2837     fh1DecayLengthV0->Fill(fV0DecayLength);
2838     fh1V0Radius->Fill(fV0Radius);
2839     fh1DcaV0Daughters->Fill(fDcaV0Daughters);
2840     fh1DcaPosToPrimVertex->Fill(fDcaPosToPrimVertex);
2841     fh1DcaNegToPrimVertex->Fill(fDcaNegToPrimVertex);
2842     fh1trackPosEta->Fill(PosEta);
2843     fh1trackNegEta->Fill(NegEta);
2844   }
2845   
2846   //_____no jets events______________________________________________________________________________________________________________________________________
2847
2848   if(nRecJetsCuts == 0){//no jet events, before the remaining jet cuts are applied, the second part for the non-jet events comes inside the jet loop
2849         
2850     fh1NJ->Fill(1.);//for normalisation by number of NJ events for events in which no rec. jets are found right from the beginning and before even the leading track bias is applied
2851     
2852     if(fDebug>6) { std::cout<<"################## nRecJetsCuts == 0 ###################"<<std::endl;
2853       //std::cout<<"fListK0s->GetSize() in NJ event: "<<fListK0s->GetSize()<<std::endl;
2854     }
2855     
2856     for(Int_t it=0; it<fListK0s->GetSize(); ++it){ // loop all K0s 
2857       
2858       AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0s->At(it));
2859       if(!v0) continue;
2860       
2861       Double_t invMK0s =0;
2862       Double_t trackPt=0;
2863       CalculateInvMass(v0, kK0, invMK0s, trackPt);
2864       Double_t fEta = v0->Eta();
2865
2866       Double_t vNJK0[3] = {invMK0s,trackPt,fEta}; //fill all K0s in events wo selected jets
2867       fhnNJK0->Fill(vNJK0);
2868       
2869     }
2870     
2871     for(Int_t it=0; it<fListLa->GetSize(); ++it){ // loop all La 
2872       
2873       AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListLa->At(it));
2874       if(!v0) continue;
2875       
2876       Double_t invMLa =0;
2877       Double_t trackPt=0;       
2878       CalculateInvMass(v0, kLambda, invMLa, trackPt);
2879       Double_t fEta = v0->Eta();
2880
2881       Double_t vNJLa[3] = {invMLa,trackPt,fEta}; //fill all K0s in events wo selected jets
2882       fhnNJLa->Fill(vNJLa);
2883
2884     } 
2885     
2886     for(Int_t it=0; it<fListALa->GetSize(); ++it){ // loop all ALa 
2887       
2888       AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListALa->At(it));
2889       if(!v0) continue;
2890       
2891       Double_t invMALa =0;
2892       Double_t trackPt=0;       
2893       CalculateInvMass(v0, kAntiLambda, invMALa, trackPt);
2894
2895       Double_t fEta = v0->Eta();
2896
2897       Double_t vNJALa[3] = {invMALa,trackPt,fEta}; //fill all K0s in events wo selected jets
2898       fhnNJALa->Fill(vNJALa);
2899    
2900       
2901     } 
2902     
2903   }//no jet events
2904   
2905   //____ fill all jet related histos  ________________________________________________________________________________________________________________________
2906   //##########################jet loop########################################################################################################################
2907
2908   Int_t nSelJets = nRecJetsCuts; //init value
2909   Bool_t IsOCEvt = kFALSE; //init for this outside cones normalisation histo (total number of OC events)
2910   Bool_t IsRCEvt = kFALSE; //init for that the random cone is placed only once per event
2911   Bool_t IsMCCEvt = kFALSE; //init for that the median cluster cone is placed only once per event
2912
2913   //fill jet histos in general
2914   for(Int_t ij=0; ij<nRecJetsCuts; ++ij){                               // ij is an index running over the list of the reconstructed jets after most of the cuts, but not yet the leading track bias, all jets in event are looped
2915     
2916     AliAODJet* jet = (AliAODJet*) (fJetsRecCuts->At(ij));
2917
2918     Double_t jetPt  = jet->Pt();
2919     Double_t jetEta = jet->Eta();
2920     Double_t jetPhi = jet->Phi();
2921     
2922     //if(ij==0){ // loop over leading jets for ij = 0, for ij>= 0 look into all jets
2923
2924     if(ij>=0){//all jets in event
2925
2926       jettracklist->Clear();
2927       Double_t sumPt      = 0.;
2928       Bool_t isBadJet     = kFALSE;
2929       Int_t njetTracks    = 0;
2930
2931       if(GetFFRadius()<=0){
2932         GetJetTracksTrackrefs(jettracklist, jet, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);// list of jet tracks from trackrefs
2933       } else {
2934         GetJetTracksPointing(fTracksRecCuts, jettracklist, jet, GetFFRadius(), sumPt, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJet);  // fill list of charged hybrid tracks in cone around jet axis with cone Radius (= 0.4 standard), application of leading track cut
2935       }
2936
2937       //not applied at the moment:
2938       if(GetFFMinNTracks()>0 && jettracklist->GetSize() <= GetFFMinNTracks()) isBadJet = kTRUE; // reject jets with less tracks than fFFMinNTracks
2939
2940       //APPLICATION OF REMAINING JET CUTS (leading track pt bias etc..) + NJ events
2941       if(isBadJet) {
2942
2943         nSelJets = nSelJets-1;//remove one jet from nSelJets (was initialized with nRecJetsCuts)
2944
2945         if(nSelJets == 0){//case that event doesn't contain no selected jets at all and there are no jets remaining to be looped over
2946
2947           fh1NJ->Fill(1.);//for normalisation by number of NJ events
2948           
2949           for(Int_t it=0; it<fListK0s->GetSize(); ++it){ // loop all K0s 
2950             
2951             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0s->At(it));
2952             if(!v0) continue;
2953             
2954             Double_t invMK0s =0;
2955             Double_t trackPt=0;
2956             CalculateInvMass(v0, kK0, invMK0s, trackPt);
2957             Double_t fEta = v0->Eta();
2958             
2959             Double_t vNJK0[3] = {invMK0s,trackPt,fEta}; //fill all K0s in events wo selected jets
2960             fhnNJK0->Fill(vNJK0);
2961             
2962           }
2963           
2964           for(Int_t it=0; it<fListLa->GetSize(); ++it){ // loop all La 
2965             
2966             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListLa->At(it));
2967             if(!v0) continue;
2968             
2969             Double_t invMLa =0;
2970             Double_t trackPt=0; 
2971             CalculateInvMass(v0, kLambda, invMLa, trackPt);
2972             Double_t fEta = v0->Eta();
2973             
2974             Double_t vNJLa[3] = {invMLa,trackPt,fEta}; //fill all K0s in events wo selected jets
2975             fhnNJLa->Fill(vNJLa);
2976             
2977           } 
2978           
2979           for(Int_t it=0; it<fListALa->GetSize(); ++it){ // loop all ALa 
2980       
2981             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListALa->At(it));
2982             if(!v0) continue;
2983             
2984             Double_t invMALa =0;
2985             Double_t trackPt=0; 
2986             CalculateInvMass(v0, kAntiLambda, invMALa, trackPt);
2987             
2988             Double_t fEta = v0->Eta();
2989             
2990             Double_t vNJALa[3] = {invMALa,trackPt,fEta}; //fill all K0s in events wo selected jets
2991             fhnNJALa->Fill(vNJALa);
2992             
2993             
2994           }       
2995          
2996         }
2997         continue;//rejection of current jet
2998       } // rejects jets in which no track has a track pt higher than 5 GeV/c (see AddTask macro)
2999       
3000       if(IsOCEvt == kFALSE){IsOCEvt = kTRUE;fh1OC->Fill(1.);}//the first found jet triggers an OC event and is filled only once into normalisation histo
3001       
3002       //Float_t fJetAreaMin = 0.6*TMath::Pi()*GetFFRadius()*GetFFRadius(); // minimum jet area cut, already applied in JetListOfJets() in FF Task
3003
3004       //if(fDebug > 2)  {if (jet->EffectiveAreaCharged() < fJetAreaMin) {std::cout<<" fCutjetArea cut removed a jet!!!!! Should not have to be done again!!"<<std::endl;}}// cut on jet area, already done by jet selection in FF task
3005       
3006       Double_t dAreaExcluded = TMath::Pi()*dRadiusExcludeCone*dRadiusExcludeCone; // area of the cone
3007       dAreaExcluded -= AreaCircSegment(dRadiusExcludeCone,fCutjetEta-jet->Eta()); // positive eta overhang
3008       dAreaExcluded -= AreaCircSegment(dRadiusExcludeCone,fCutjetEta+jet->Eta()); // negative eta overhang
3009       fh1AreaExcluded->Fill(dAreaExcluded);//histo contains all areas that are jet related and have to be excluded concerning OC UE pt spectrum normalisation by area
3010
3011       fh1JetEta->Fill(jetEta);        
3012       fh1JetPhi->Fill(jetPhi);                
3013       fh2JetEtaPhi->Fill(jetEta,jetPhi);  
3014   
3015       // printf("pT = %f, eta = %f, phi = %f, leadtr pt = %f\n, ",jetPt,jetEta,jetphi,leadtrack);
3016
3017       for(Int_t it=0; it<jettracklist->GetSize(); ++it){//loop over all particles in jet
3018         
3019         AliVParticle* trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));//all tracks in jet cone      
3020         if(!trackVP)continue;
3021         
3022         Float_t trackPt = trackVP->Pt();//transversal momentum of jet particle
3023         Float_t trackEta = trackVP->Eta();
3024
3025         Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
3026         
3027         fFFHistosRecCuts->FillFF(trackPt, jetPt, incrementJetPt);//histo with tracks/jets after cut selection, for all events
3028         if(nK0s>0) fFFHistosRecCutsK0Evt->FillFF(trackPt, jetPt, incrementJetPt);//only for K0s events
3029         fh2FFJetTrackEta->Fill(trackEta,jetPt);
3030
3031
3032       }
3033      
3034       njetTracks = jettracklist->GetSize();
3035
3036       //____________________________________________________________________________________________________________________      
3037       //strangeness constribution to jet cone 
3038       /*
3039       if(fAnalysisMC){
3040
3041         TList *list = fAOD->GetList();  
3042         AliAODMCHeader *mcHeadr=(AliAODMCHeader*)list->FindObject(AliAODMCHeader::StdBranchName());       
3043         if(!mcHeadr)continue;
3044
3045         Double_t mcXv=0., mcYv=0., mcZv=0.;//MC primary vertex position
3046
3047         mcXv=mcHeadr->GetVtxX(); mcYv=mcHeadr->GetVtxY(); mcZv=mcHeadr->GetVtxZ(); // position of the MC primary vertex
3048
3049         for(Int_t it=0; it<jettracklist->GetSize(); ++it){//loop over all tracks in the jet
3050           
3051           AliVParticle* trackVP = dynamic_cast<AliVParticle*>(jettracklist->At(it));//track in jet cone 
3052           if(!trackVP)continue;
3053           AliAODTrack *tr = dynamic_cast<AliAODTrack*> (trackVP);                   //fetch one jet track from the TList
3054           if(!tr)continue;
3055           
3056           //get MC label information
3057           TList *mclist = fAOD->GetList();                                           
3058          
3059           //fetch the MC stack
3060           TClonesArray* stackMC = (TClonesArray*)mclist->FindObject(AliAODMCParticle::StdBranchName()); //get MCAOD branch in data
3061           if (!stackMC) {Printf("ERROR: stack not available");}
3062
3063           else {
3064             
3065             Int_t trackLabel = TMath::Abs(tr->GetLabel());                       //fetch jet track label in MC stack
3066             
3067             AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(stackMC->At(trackLabel));  //fetch MC gen. particle for rec. jet track
3068
3069             if(!part)continue;  //skip non-existing objects     
3070             
3071
3072             //Bool_t IsPhysicalPrimary = part->IsPhysicalPrimary();//not recommended to check, better use distance between primary vertex and secondary vertex
3073             
3074             Float_t fDistPrimaryMax = 0.01;
3075             // Get the distance between production point of the MC mother particle and the primary vertex
3076             
3077             Double_t dx = mcXv-part->Xv();//mc primary vertex - mc gen. v0 vertex 
3078             Double_t dy = mcYv-part->Yv();
3079             Double_t dz = mcZv-part->Zv();
3080             
3081             Float_t fDistPrimary = TMath::Sqrt(dx*dx + dy*dy + dz*dz);
3082             Bool_t fPhysicalPrimary = (fDistPrimary < fDistPrimaryMax);
3083  
3084             // std::cout<<"fDistPrimary"<<fDistPrimary<<std::endl;
3085             // std::cout<<"fPhysicalPrimary"<<fPhysicalPrimary<<std::endl;
3086
3087             if(!fPhysicalPrimary)continue;//rejects Kstar and other strong decaying particles from Secondary Contamination
3088             
3089             Bool_t isFromStrange = kFALSE;// flag to check whether particle has strange mother
3090             
3091             Int_t iMother = part->GetMother(); //get mother MC gen. particle label
3092             
3093             if(iMother >= 0){
3094               AliAODMCParticle *partM = dynamic_cast<AliAODMCParticle*>(stackMC->At(iMother)); //fetch mother of MC gen. particle
3095               if(!partM) continue;
3096
3097               Int_t codeM =  TMath::Abs(partM->GetPdgCode());                                 //mothers pdg code
3098               
3099               Int_t mfl = Int_t (codeM/ TMath::Power(10, Int_t(TMath::Log10(codeM))));        //asks for first number of mothers pdg code (strange particles always start with 3..)
3100               
3101               if  (mfl == 3 && codeM != 3) isFromStrange = kTRUE;
3102             }
3103     
3104             if(isFromStrange == kTRUE){
3105
3106               Double_t trackPt = part->Pt();
3107               Double_t trackEta = part->Eta();
3108               //fh3StrContinCone->Fill(jetPt, trackPt, trackEta);//MC gen. particle parameters, but rec. jet pt
3109                       
3110               }//isFromStrange is kTRUE  
3111           } //end else
3112         }//end loop over jet tracks
3113         
3114       }// end fAnalysisMC
3115       */
3116
3117       fh1TrackMultCone->Fill(njetTracks);
3118       fh2TrackMultCone->Fill(njetTracks,jetPt);      
3119           
3120       // ---- K0s ---- 
3121       
3122       // fQAJetHistosRecCutsLeading->FillJetQA( jet->Eta(), TVector2::Phi_0_2pi(jet->Phi()), jet->Pt() );
3123       
3124       for(Int_t it=0; it<fListK0s->GetSize(); ++it){ // loop all K0s 
3125         
3126         AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0s->At(it));
3127         if(!v0) continue;//rejection of events with no V0 vertex
3128
3129         Double_t v0Mom[3];
3130         v0->PxPyPz(v0Mom);
3131         TVector3 v0MomVect(v0Mom);
3132         
3133         Double_t dPhiJetK0 = (jet->MomentumVector()->Vect()).DeltaPhi(v0MomVect);
3134         //      Bool_t incrementJetPt = (it==0) ? kTRUE : kFALSE;
3135         
3136         //      if(incrementJetPt){fh1V0JetPt->Fill(jetPt);}
3137
3138         Double_t invMK0s =0;
3139         Double_t trackPt=0;     
3140         CalculateInvMass(v0, kK0, invMK0s, trackPt);  //function to calculate invMass with TLorentzVector class
3141         
3142         //      fFFHistosIMK0Jet->FillFF(trackPt, invMK0s, jetPt, incrementJetPt);
3143         
3144
3145         if(dPhiJetK0<fh1dPhiJetK0->GetXaxis()->GetXmin()) dPhiJetK0 += 2*TMath::Pi();
3146         fh1dPhiJetK0->Fill(dPhiJetK0);
3147         
3148       }
3149
3150       // if(fListK0s->GetSize() == 0){ // no K0: increment jet pt spectrum 
3151         
3152       //        Bool_t incrementJetPt = kTRUE;
3153         //      fFFHistosIMK0Jet->FillFF(-1, -1, jetPt, incrementJetPt);
3154       //  }
3155       
3156       //____fetch reconstructed K0s in cone around jet axis:_______________________________________________________________________________
3157       
3158       jetConeK0list->Clear();
3159
3160       Double_t sumPtK0     = 0.;
3161       
3162       Bool_t isBadJetK0    = kFALSE; // dummy, do not use
3163
3164       GetTracksInCone(fListK0s, jetConeK0list, jet, GetFFRadius(), sumPtK0, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetK0); //reconstructed K0s in cone around jet axis
3165     
3166       if(fDebug>2)Printf("%s:%d nK0s total: %d, in jet cone: %d,FFRadius %f ",(char*)__FILE__,__LINE__,nK0s,jetConeK0list->GetEntries(),GetFFRadius());
3167       
3168       
3169       for(Int_t it=0; it<jetConeK0list->GetSize(); ++it){ // loop for K0s in jet cone
3170         
3171         AliAODv0* v0 = dynamic_cast<AliAODv0*>(jetConeK0list->At(it));
3172         if(!v0) continue;
3173         
3174         Bool_t   incrementJetPt = (it==0) ? kTRUE : kFALSE;
3175         Double_t invMK0s =0;
3176         Double_t trackPt=0;
3177         Double_t fEta=0;
3178         fEta = v0->Eta();
3179         
3180         CalculateInvMass(v0, kK0, invMK0s, trackPt);  //function to calculate invMass with TLorentzVector class
3181
3182
3183         if(fAnalysisMC){
3184           Double_t jetPtSmear = -1;  
3185           SmearJetPt(jetPt,cl,GetFFRadius(),GetFFMinLTrackPt(),jetPtSmear);  
3186           if(incrementJetPt == kTRUE){fh1IMK0ConeSmear->Fill(jetPtSmear);}                          //fill TH1F for normalization purposes 
3187         }
3188
3189         if(incrementJetPt==kTRUE){
3190           fh1IMK0Cone->Fill(jetPt);}//normalisation by number of selected jets
3191
3192         //fFFHistosIMK0Cone->FillFF(trackPt, invMK0s, jetPt, incrementJetPt);
3193         
3194         Double_t vK0sCone[4] = {jetPt, invMK0s,trackPt,fEta};
3195         fhnK0sCone->Fill(vK0sCone);
3196       }
3197       
3198       
3199       if(jetConeK0list->GetSize() == 0){ // no K0: increment jet pt spectrum 
3200         
3201         
3202         Bool_t incrementJetPt = kTRUE;//jets without K0s will be only filled in TH1F only once, so no increment needed 
3203         //fFFHistosIMK0Cone->FillFF(-1, -1, jetPt, incrementJetPt);
3204         Double_t vK0sCone[4] = {jetPt, -1, -1, -1};
3205         fhnK0sCone->Fill(vK0sCone);
3206
3207         if(incrementJetPt==kTRUE){
3208           fh1IMK0Cone->Fill(jetPt);}//normalisation by number of selected jets
3209
3210         if(fAnalysisMC){
3211           Double_t jetPtSmear = -1;  
3212           SmearJetPt(jetPt,cl,GetFFRadius(),GetFFMinLTrackPt(),jetPtSmear);  
3213           if(incrementJetPt == kTRUE){fh1IMK0ConeSmear->Fill(jetPtSmear);}                          //fill TH1F for normalization purposes 
3214         }
3215       }    
3216       
3217       //Random cones________________________________________________________________________
3218      
3219
3220       if(IsRCEvt == kFALSE){//fetch random cone V0s only once per event
3221         
3222
3223         IsRCEvt = kTRUE;//set boolean to kTRUE once a random cone is placed per event
3224         
3225         AliAODJet* jetRC = 0;
3226         jetRC = GetRandomCone(fJetsRecCuts, fCutjetEta, 2*GetFFRadius());//fetch one random cone for each event 
3227         
3228         fListK0sRC->Clear();//list for K0s in random cone (RC), one RC per event
3229         fListLaRC->Clear();
3230         fListALaRC->Clear();
3231
3232         Double_t sumPtK0sRC = 0;
3233         Double_t sumPtLaRC = 0;
3234         Double_t sumPtALaRC = 0;
3235         Bool_t isBadJetK0sRC = kFALSE;
3236         Bool_t isBadJetLaRC = kFALSE;
3237         Bool_t isBadJetALaRC = kFALSE;
3238
3239         
3240         if(jetRC != 0) {//if random cone was selected properly and fullfilling all the requirements
3241
3242         //fetch V0s in RC:
3243           fh1RC->Fill(1.);//for normalisation purposes
3244
3245           GetTracksInCone(fListK0s, fListK0sRC, jetRC, GetFFRadius(), sumPtK0sRC, 0, 0, isBadJetK0sRC);
3246           
3247           //________________fill RC with all V0s__________________
3248           for(Int_t it=0; it<fListK0sRC->GetSize(); ++it){ // loop for K0s in random cone
3249             
3250             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0sRC->At(it));
3251             if(!v0) continue;
3252             
3253             Double_t invMK0s =0;
3254             Double_t trackPt=0;
3255             Double_t fEta=0;
3256             fEta = v0->Eta();
3257                 
3258             CalculateInvMass(v0, kK0, invMK0s, trackPt);  //function to calculate invMass with TLorentzVector class
3259             
3260             Double_t vK0sRC[3] = {invMK0s,trackPt,fEta};
3261             fhnK0sRC->Fill(vK0sRC);
3262           }
3263           
3264         
3265           
3266           GetTracksInCone(fListLa, fListLaRC, jetRC, GetFFRadius(), sumPtLaRC, 0, 0, isBadJetLaRC);
3267           
3268           for(Int_t it=0; it<fListLaRC->GetSize(); ++it){ // loop for Lambdas in random cone
3269             
3270             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListLaRC->At(it));
3271             if(!v0) continue;
3272             
3273             Double_t invMLa =0;
3274             Double_t trackPt=0;
3275             Double_t fEta=0;
3276             fEta = v0->Eta();
3277             
3278             CalculateInvMass(v0, kLambda, invMLa, trackPt);  //function to calculate invMass with TLorentzVector class
3279             
3280             Double_t vLaRC[3] = {invMLa,trackPt,fEta};
3281             fhnLaRC->Fill(vLaRC);
3282           }
3283         
3284         
3285           
3286           GetTracksInCone(fListALa, fListALaRC, jetRC, GetFFRadius(), sumPtALaRC, 0, 0, isBadJetALaRC);
3287           
3288           for(Int_t it=0; it<fListALaRC->GetSize(); ++it){ // loop for Lambdas in random cone
3289             
3290             AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListALaRC->At(it));
3291             if(!v0) continue;
3292             
3293             Double_t invMALa =0;
3294             Double_t trackPt=0;
3295             Double_t fEta=0;
3296             fEta = v0->Eta();
3297                 
3298             CalculateInvMass(v0, kAntiLambda, invMALa, trackPt);  //function to calculate invMass with TLorentzVector class
3299             
3300             Double_t vALaRC[3] = {invMALa,trackPt,fEta};
3301             fhnALaRC->Fill(vALaRC);
3302           }
3303
3304
3305           if(isBadJetK0sRC == kFALSE){ //in case RC contains at least one K0s with minimum pT 
3306             fh1RCBiasK0->Fill(1.);//for normalisation purposes
3307
3308             //________________fill RC (with trigger particle bias)_____________
3309             for(Int_t it=0; it<fListK0sRC->GetSize(); ++it){ // loop for K0s in random cone
3310               
3311               AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListK0sRC->At(it));
3312               if(!v0) continue;
3313               
3314               Double_t invMK0s =0;
3315               Double_t trackPt=0;
3316               Double_t fEta=0;
3317               fEta = v0->Eta();
3318               
3319               CalculateInvMass(v0, kK0, invMK0s, trackPt);  //function to calculate invMass with TLorentzVector class
3320               
3321               //Double_t vK0sRC[3] = {invMK0s,trackPt,fEta};
3322               //fhnK0sRCBias->Fill(vK0sRC);
3323             }
3324           }
3325         
3326           
3327           if(isBadJetLaRC == kFALSE){ //in case RC contains at least one Lambda with minimum pT 
3328             fh1RCBiasLa->Fill(1.);//for normalisation purposes
3329             for(Int_t it=0; it<fListLaRC->GetSize(); ++it){ // loop for Lambdas in random cone
3330               
3331               AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListLaRC->At(it));
3332               if(!v0) continue;
3333               
3334               Double_t invMLa =0;
3335               Double_t trackPt=0;
3336               Double_t fEta=0;
3337               fEta = v0->Eta();
3338             
3339               CalculateInvMass(v0, kLambda, invMLa, trackPt);  //function to calculate invMass with TLorentzVector class
3340               
3341               //Double_t vLaRC[3] = {invMLa,trackPt,fEta};
3342               //fhnLaRCBias->Fill(vLaRC);
3343             }
3344           }
3345         
3346           
3347          
3348           if(isBadJetALaRC == kFALSE){ //in case RC contains at least one Antilambda with minimum pT 
3349             fh1RCBiasALa->Fill(1.);//for normalisation purposes
3350             for(Int_t it=0; it<fListALaRC->GetSize(); ++it){ // loop for Lambdas in random cone
3351               
3352               AliAODv0* v0 = dynamic_cast<AliAODv0*>(fListALaRC->At(it));
3353               if(!v0) continue;
3354             
3355               Double_t invMALa =0;
3356               Double_t trackPt=0;
3357               Double_t fEta=0;
3358               fEta = v0->Eta();
3359               
3360               CalculateInvMass(v0, kAntiLambda, invMALa, trackPt);  //function to calculate invMass with TLorentzVector class
3361               
3362               //Double_t vALaRC[3] = {invMALa,trackPt,fEta};
3363               //fhnALaRCBias->Fill(vALaRC);
3364             }
3365             
3366           }
3367
3368         }
3369         
3370         fListK0sRC->Clear();
3371         fListLaRC->Clear();
3372         fListALaRC->Clear();
3373       }
3374
3375
3376       //fetch particles in perpendicular cone to estimate UE event contribution to particle spectrum
3377       //these perpendicular cone particle spectra serve to subtract the particles in jet cones, that are stemming from the Underlying event, on a statistical basis
3378       //for normalization the common jet pT spectrum is used: fh1IMK0Cone, fh1IMLaCone and fh1IMALaCone
3379       
3380       //____fetch reconstructed K0s in cone perpendicular to jet axis:_______________________________________________________________________________
3381       
3382   
3383       jetPerpConeK0list->Clear();
3384       Double_t sumPerpPtK0     = 0.;
3385       
3386       GetTracksInPerpCone(fListK0s, jetPerpConeK0list, jet, GetFFRadius(), sumPerpPtK0); //reconstructed K0s in cone around jet axis
3387       
3388       if(fDebug>2)Printf("%s:%d nK0s total: %d, in perp jet cone: %d,FFRadius %f ",(char*)__FILE__,__LINE__,nK0s,jetPerpConeK0list->GetEntries(),GetFFRadius());
3389       
3390       for(Int_t it=0; it<jetPerpConeK0list->GetSize(); ++it){ // loop for K0s in perpendicular cone
3391         
3392         AliAODv0* v0 = dynamic_cast<AliAODv0*>(jetPerpConeK0list->At(it));
3393         if(!v0) continue;
3394         
3395         Double_t invMPerpK0s =0;
3396         Double_t trackPt=0;
3397         Double_t fEta=0;
3398
3399         fEta = v0->Eta();       
3400         CalculateInvMass(v0, kK0, invMPerpK0s, trackPt);  //function to calculate invMass with TLorentzVector class
3401         Double_t vK0sPC[4] = {jetPt, invMPerpK0s,trackPt,fEta};
3402         
3403         fhnK0sPC->Fill(vK0sPC);  //(x,y,z) //pay attention, this histogram contains the V0 content of both (+/- 90 degrees) perp. cones!!
3404         
3405       }
3406       
3407       
3408       if(jetPerpConeK0list->GetSize() == 0){ // no K0s in jet cone 
3409         
3410         Double_t vK0sPC[4] = {jetPt, -1, -1 , -999};//default values for case: no K0s is found in PC
3411         fhnK0sPC->Fill(vK0sPC);
3412         
3413       }
3414       
3415
3416       if(IsMCCEvt == kFALSE){//median cluster only once for event
3417
3418         IsMCCEvt = kTRUE;
3419
3420       // if(ij==0){
3421
3422         AliAODJet* medianCluster = GetMedianCluster();
3423
3424         if(medianCluster){
3425         // ____ rec K0s in median cluster___________________________________________________________________________________________________________ 
3426         
3427
3428           jetMedianConeK0list->Clear();
3429           jetMedianConeLalist->Clear();
3430           jetMedianConeALalist->Clear();
3431           
3432           Double_t medianEta = medianCluster->Eta();
3433         
3434         if(TMath::Abs(medianEta)<=fCutjetEta){
3435           
3436           fh1MedianEta->Fill(medianEta);
3437           fh1JetPtMedian->Fill(jetPt);
3438           fh1MCC->Fill(1.);//for normalisation by total number of median cluster jets
3439           Double_t sumMedianPtK0     = 0.;
3440           
3441           Bool_t isBadJetK0Median    = kFALSE; // dummy, do not use
3442           
3443           GetTracksInCone(fListK0s, jetMedianConeK0list, medianCluster, GetFFRadius(), sumMedianPtK0, 0., 0., isBadJetK0Median); //reconstructed K0s in median cone around jet axis
3444           //GetTracksInCone(fListK0s, jetConeK0list, jet, GetFFRadius(), sumPtK0, GetFFMinLTrackPt(), GetFFMaxTrackPt(), isBadJetK0); //original use of function
3445           
3446           //cut parameters from Fragmentation Function task:
3447           //Float_t fFFMinLTrackPt;   // reject jets with leading track with pt smaller than this value, use GetFFMinLTrackPt()
3448           //Float_t fFFMaxTrackPt;    // reject jetscontaining any track with pt larger than this value, use GetFFMaxTrackPt()
3449           
3450           for(Int_t it=0; it<jetMedianConeK0list->GetSize(); ++it){ // loop for K0s in median cone
3451             
3452             AliAODv0* v0 = dynamic_cast<AliAODv0*>(jetMedianConeK0list->At(it));
3453             if(!v0) continue;
3454             
3455             Double_t invMMedianK0s =0;
3456             Double_t trackPt=0;
3457             Double_t fEta=0;
3458             
3459             fEta = v0->Eta();
3460             CalculateInvMass(v0, kK0, invMMedianK0s, trackPt);  //function to calculate invMass with TLorentzVector class       
3461             Double_t vK0sMCC[3] = {invMMedianK0s,trackPt,fEta};
3462             fhnK0sMCC->Fill(vK0sMCC);
3463             
3464           }
3465           
3466           if(jetMedianConeK0list->GetSize() == 0){ // no K0s in median cluster cone 
3467            
3468             Double_t vK0sMCC[3] = {-1, -1, -999};
3469             fhnK0sMCC->Fill(vK0sMCC);
3470