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