AliPhysics  8d00e07 (8d00e07)
AliAnalysisTaskSELc2eleLambdafromAODtracks.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appeuear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //
19 //
20 // Lc->e Lambda analysis code
21 //
22 // Input: AOD
23 // Output: TTree and/or THnSparse (mass vs pT vs Centrality)
24 //
25 // Cuts:
26 // TTree: SingleCuts on V0 and electron
27 // THnSparse: In addition to that, IsSelected(obj, kCandidate) applied
28 //
29 //-------------------------------------------------------------------------
30 //
31 // Authors: Y.S Watanabe(a)
32 // (a) CNS, the University of Tokyo
33 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
34 //-------------------------------------------------------------------------
35 
36 #include <TSystem.h>
37 #include <TParticle.h>
38 #include <TParticlePDG.h>
39 #include <TH1F.h>
40 #include <TH1F.h>
41 #include <TH2F.h>
42 #include <THnSparse.h>
43 #include <TLorentzVector.h>
44 #include <TTree.h>
45 #include "TROOT.h"
46 #include <TDatabasePDG.h>
47 #include <AliAnalysisDataSlot.h>
48 #include <AliAnalysisDataContainer.h>
49 #include "AliMCEvent.h"
50 #include "AliAnalysisManager.h"
51 #include "AliAODMCHeader.h"
52 #include "AliAODHandler.h"
53 #include "AliLog.h"
54 #include "AliExternalTrackParam.h"
55 #include "AliAODVertex.h"
56 #include "AliESDVertex.h"
57 #include "AliAODRecoDecay.h"
58 #include "AliAODRecoDecayHF.h"
59 #include "AliAODRecoCascadeHF.h"
60 #include "AliESDtrack.h"
61 #include "AliAODTrack.h"
62 #include "AliAODv0.h"
63 #include "AliAODcascade.h"
64 #include "AliAODMCParticle.h"
65 #include "AliAnalysisTaskSE.h"
67 #include "AliPIDResponse.h"
68 #include "AliPIDCombined.h"
69 #include "AliTOFPIDResponse.h"
70 #include "AliAODPidHF.h"
71 #include "AliInputEventHandler.h"
72 #include "AliESDtrackCuts.h"
73 #include "AliNeutralTrackParam.h"
74 #include "AliKFParticle.h"
75 #include "AliKFVertex.h"
76 #include "AliExternalTrackParam.h"
77 #include "AliESDtrack.h"
78 #include "AliCentrality.h"
79 #include "AliVertexerTracks.h"
80 #include "AliEventPoolManager.h"
82 #include "AliVertexingHFUtils.h"
83 #include "AliQnCorrectionsManager.h"
84 #include "AliQnCorrectionsQnVector.h"
85 #include "AliAnalysisTaskFlowVectorCorrections.h"
86 
87 using std::cout;
88 using std::endl;
89 
93 
94 //__________________________________________________________________________
97  fUseMCInfo(kFALSE),
98  fOutput(0),
99  fOutputAll(0),
100  fListCuts(0),
101  fCEvents(0),
102  fHTrigger(0),
103  fHCentrality(0),
104  fHEventPlane(0),
105  fHNTrackletvsZ(0),
106  fHNTrackletCorrvsZ(0),
107  fAnalCuts(0),
108  fIsEventSelected(kFALSE),
109  fWriteVariableTree(kFALSE),
110  fWriteEachVariableTree(kFALSE),
111  fWriteMCVariableTree(kFALSE),
112  fVariablesTree(0),
113  fEleVariablesTree(0),
114  fV0VariablesTree(0),
115  fSingleVariablesTree(0),
116  fMCVariablesTree(0),
117  fMCEleVariablesTree(0),
118  fMCV0VariablesTree(0),
119  fMCGenPairVariablesTree(0),
120  fCorrelationVariablesTree(0),
121  fReconstructPrimVert(kFALSE),
122  fIsMB(kFALSE),
123  fIsSemi(kFALSE),
124  fIsCent(kFALSE),
125  fIsINT7(kFALSE),
126  fIsEMC7(kFALSE),
127  fCandidateVariables(),
128  fCandidateEleVariables(),
129  fCandidateV0Variables(),
130  fCandidateSingleVariables(),
131  fCandidateMCVariables(),
132  fCandidateMCEleVariables(),
133  fCandidateMCV0Variables(),
134  fCandidateMCGenPairVariables(),
135  fCorrelationVariables(),
136  fVtx1(0),
137  fV1(0),
138  fVtxZ(0),
139  fEventPlane(0),
140  fQ(0),
141  fQSub1(0),
142  fQSub2(0),
143  fBzkG(0),
144  fCentrality(0),
145  fRunNumber(0),
146  fTriggerCheck(0),
147  fUseCentralityV0M(kFALSE),
148  fUseCentralitySPDTracklet(kFALSE),
149  fUseEventPlane(0),
150  fEvNumberCounter(0),
151  fMCEventType(-9999),
152  fMCDoPairAnalysis(kFALSE),
153  fHistoEleLambdaMass(0),
154  fHistoEleLambdaMassRS(0),
155  fHistoEleLambdaMassRS1(0),
156  fHistoEleLambdaMassRS2(0),
157  fHistoEleLambdaMassWS(0),
158  fHistoEleLambdaMassWS1(0),
159  fHistoEleLambdaMassWS2(0),
160  fHistoEleLambdaMassRSMix(0),
161  fHistoEleLambdaMassRSMix1(0),
162  fHistoEleLambdaMassRSMix2(0),
163  fHistoEleLambdaMassWSMix(0),
164  fHistoEleLambdaMassWSMix1(0),
165  fHistoEleLambdaMassWSMix2(0),
166  fHistoEleLambdaMassRSSide(0),
167  fHistoEleLambdaMassRSSide1(0),
168  fHistoEleLambdaMassRSSide2(0),
169  fHistoEleLambdaMassWSSide(0),
170  fHistoEleLambdaMassWSSide1(0),
171  fHistoEleLambdaMassWSSide2(0),
172  fHistoEleLambdaMassRSAway(0),
173  fHistoEleLambdaMassRS1Away(0),
174  fHistoEleLambdaMassRS2Away(0),
175  fHistoEleLambdaMassWSAway(0),
176  fHistoEleLambdaMassWS1Away(0),
177  fHistoEleLambdaMassWS2Away(0),
178  fHistoEleLambdaMassRSMixAway(0),
179  fHistoEleLambdaMassRSMix1Away(0),
180  fHistoEleLambdaMassRSMix2Away(0),
181  fHistoEleLambdaMassWSMixAway(0),
182  fHistoEleLambdaMassWSMix1Away(0),
183  fHistoEleLambdaMassWSMix2Away(0),
184  fHistoEleLambdaMassRSSideAway(0),
185  fHistoEleLambdaMassRSSide1Away(0),
186  fHistoEleLambdaMassRSSide2Away(0),
187  fHistoEleLambdaMassWSSideAway(0),
188  fHistoEleLambdaMassWSSide1Away(0),
189  fHistoEleLambdaMassWSSide2Away(0),
190  fHistoEleLambdaMassvsElePtRS(0),
191  fHistoEleLambdaMassvsElePtWS(0),
192  fHistoEleLambdaMassvsElePtRSMix(0),
193  fHistoEleLambdaMassvsElePtWSMix(0),
194  fHistoEleLambdaMassvsElePtRSSide(0),
195  fHistoEleLambdaMassvsElePtWSSide(0),
196  fHistoEleLambdaMassvsElePtRS1(0),
197  fHistoEleLambdaMassvsElePtWS1(0),
198  fHistoEleLambdaMassvsElePtRSMix1(0),
199  fHistoEleLambdaMassvsElePtWSMix1(0),
200  fHistoEleLambdaMassvsElePtRSSide1(0),
201  fHistoEleLambdaMassvsElePtWSSide1(0),
202  fHistoEleLambdaMassvsElePtRS2(0),
203  fHistoEleLambdaMassvsElePtWS2(0),
204  fHistoEleLambdaMassvsElePtRSMix2(0),
205  fHistoEleLambdaMassvsElePtWSMix2(0),
206  fHistoEleLambdaMassvsElePtRSSide2(0),
207  fHistoEleLambdaMassvsElePtWSSide2(0),
208  fHistoElePtRS(0),
209  fHistoElePtWS(0),
210  fHistoElePtRSMix(0),
211  fHistoElePtWSMix(0),
212  fHistoEleLambdaMassMCS(0),
213  fHistoEleLambdaMassLambdabMCS(0),
214  fHistoEleLambdaMassXibMCS(0),
215  fHistoEleLambdaMassMCGen(0),
216  fHistoEleLambdaMassvsElePtMCS(0),
217  fHistoEleLambdaMassvsElePtMCGen(0),
218  fHistoEleLambdaMassvsElePtMCS1(0),
219  fHistoEleLambdaMassvsElePtMCGen1(0),
220  fHistoEleLambdaMassvsElePtMCS2(0),
221  fHistoEleLambdaMassvsElePtMCGen2(0),
222  fHistoElePtMCS(0),
223  fHistoElePtMCGen(0),
224  fHistoElePtvsEtaRS(0),
225  fHistoElePtvsEtaWS(0),
226  fHistoElePtvsEtaRSMix(0),
227  fHistoElePtvsEtaWSMix(0),
228  fHistoElePtvsEtaMCS(0),
229  fHistoElePtvsEtaMCGen(0),
230  fHistoElePtvsLambdaPtRS(0),
231  fHistoElePtvsLambdaPtWS(0),
232  fHistoElePtvsLambdaPtRSMix(0),
233  fHistoElePtvsLambdaPtWSMix(0),
234  fHistoElePtvsLambdaPtMCS(0),
235  fHistoElePtvsLambdaPtvsLcPtMCS(0),
236  fHistoElePtvsLambdaPtMCGen(0),
237  fHistoElePtvsLambdaPtvsLcPtMCGen(0),
238  fHistoElePtvsLambdaPtMCLcGen(0),
239  fHistoElePtvsd0RS(0),
240  fHistoElePtvsd0WS(0),
241  fHistoElePtvsd0RSMix(0),
242  fHistoElePtvsd0WSMix(0),
243  fHistoElePtvsd0MCS(0),
244  fHistoElePtvsd0PromptMCS(0),
245  fHistoElePtvsd0BFeeddownMCS(0),
246  fHistoEleLambdaMassFeeddownXic0MCS(0),
247  fHistoEleLambdaMassFeeddownXic0MCGen(0),
248  fHistoEleLambdaMassvsElePtFeeddownXic0MCS(0),
249  fHistoEleLambdaMassvsElePtFeeddownXic0MCGen(0),
250  fHistoEleLambdaMassvsElePtFeeddownXic0MCS1(0),
251  fHistoEleLambdaMassvsElePtFeeddownXic0MCGen1(0),
252  fHistoEleLambdaMassvsElePtFeeddownXic0MCS2(0),
253  fHistoEleLambdaMassvsElePtFeeddownXic0MCGen2(0),
254  fHistoElePtFeeddownXic0MCS(0),
255  fHistoElePtFeeddownXic0MCGen(0),
256  fHistoElePtvsEtaFeeddownXic0MCS(0),
257  fHistoElePtvsEtaFeeddownXic0MCGen(0),
258  fHistoElePtvsLambdaPtFeeddownXic0MCS(0),
259  fHistoElePtvsLambdaPtFeeddownXic0MCGen(0),
260  fHistoEleLambdaMassFeeddownXicPlusMCS(0),
261  fHistoEleLambdaMassFeeddownXicPlusMCGen(0),
262  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCS(0),
263  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCGen(0),
264  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCS1(0),
265  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCGen1(0),
266  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCS2(0),
267  fHistoEleLambdaMassvsElePtFeeddownXicPlusMCGen2(0),
268  fHistoElePtFeeddownXicPlusMCS(0),
269  fHistoElePtFeeddownXicPlusMCGen(0),
270  fHistoElePtvsEtaFeeddownXicPlusMCS(0),
271  fHistoElePtvsEtaFeeddownXicPlusMCGen(0),
272  fHistoElePtvsLambdaPtFeeddownXicPlusMCS(0),
273  fHistoElePtvsLambdaPtFeeddownXicPlusMCGen(0),
274  fHistoBachPt(0),
275  fHistoBachPtMCS(0),
276  fHistoBachPtMCGen(0),
277  fHistoBachFracSharedITS(0),
278  fHistoBachChi2NclsITS(0),
279  fHistod0Bach(0),
280  fHistoLambdaMassvsPt(0),
281  fHistoLambdaMassvsPtMCS(0),
282  fHistoLambdaMassvsPtMCGen(0),
283  fHistoLambdaPtvsEta(0),
284  fHistoLambdaPtvsEtaMCS(0),
285  fHistoLambdaPtvsEtaMCGen(0),
286  fHistoLambdaArmenteros(0),
287  fHistoLambdaArmenterosMCS(0),
288  fHistoLambdaPtvsDl(0),
289  fHistoLambdaPtvsDlSide(0),
290  fHistoLambdaPtvsDlMCS(0),
291  fHistoLambdaPtvsDlFeeddownXi0MCS(0),
292  fHistoLambdaPtvsDlFeeddownXiMinusMCS(0),
293  fHistoLambdaPtvsDlFeeddownOmegaMCS(0),
294  fHistoK0sMassvsPt(0),
295  fHistoElectronTPCPID(0),
296  fHistoElectronTOFPID(0),
297  fHistoElectronITSPID(0),
298  fHistoElectronTPCSelPID(0),
299  fHistoElectronTOFSelPID(0),
300  fHistoElectronITSSelPID(0),
301  fHistoElectronTPCPIDSelTOF(0),
302  fHistoElectronTPCPIDSelTOFSmallEta(0),
303  fHistoElectronTPCPIDSelTOFLargeEta(0),
304  fHistoElectronITSPIDSelTPCTOF(0),
305  fHistoElectronITSPIDSelTPCTOFSmallEta(0),
306  fHistoElectronITSPIDSelTPCTOFLargeEta(0),
307  fHistoMassConversionsMin(0),
308  fHistoMassConversionsSameSignMin(0),
309  fHistoElectronQovPtvsPhi(0),
310  fHistoLambdaQovPtvsPhi(0),
311  fHistoLcMCGen(0),
312  fHistoLcMCGen1(0),
313  fHistoLcMCGen2(0),
314  fHistoLbMCGen(0),
315  fHistoLbMCGen1(0),
316  fHistoLbMCGen2(0),
317  fHistoLcMCGenWithEleA(0),
318  fHistoLcMCGenWithEleB(0),
319  fHistoLbMCGenWithEleA(0),
320  fHistoLbMCGenWithEleB(0),
321  fHistoLbMCGenWithLambdac(0),
322  fHistoLcMCS(0),
323  fHistoLcMCS1(0),
324  fHistoLcMCS2(0),
325  fHistoLbMCS(0),
326  fHistoLbMCS1(0),
327  fHistoLbMCS2(0),
328  fHistoFeedDownXic0MCGen(0),
329  fHistoFeedDownXic0MCGen1(0),
330  fHistoFeedDownXic0MCGen2(0),
331  fHistoFeedDownXic0MCS(0),
332  fHistoFeedDownXic0MCS1(0),
333  fHistoFeedDownXic0MCS2(0),
334  fHistoFeedDownXicPlusMCGen(0),
335  fHistoFeedDownXicPlusMCGen1(0),
336  fHistoFeedDownXicPlusMCGen2(0),
337  fHistoFeedDownXicPlusMCS(0),
338  fHistoFeedDownXicPlusMCS1(0),
339  fHistoFeedDownXicPlusMCS2(0),
340  fHistoFeedDownSigmaMCGen(0),
341  fHistoFeedDownSigmaMCGen1(0),
342  fHistoFeedDownSigmaMCGen2(0),
343  fHistoFeedDownSigmaMCS(0),
344  fHistoFeedDownSigmaMCS1(0),
345  fHistoFeedDownSigmaMCS2(0),
346  fHistoLcElectronMCGen(0),
347  fHistoLcElectronMCGen1(0),
348  fHistoLcElectronMCGen2(0),
349  fHistoLcElectronMCS(0),
350  fHistoLcElectronMCS1(0),
351  fHistoLcElectronMCS2(0),
352  fHistoLbElectronMCGen(0),
353  fHistoLbElectronMCGen1(0),
354  fHistoLbElectronMCGen2(0),
355  fHistoLbElectronMCS(0),
356  fHistoLbElectronMCS1(0),
357  fHistoLbElectronMCS2(0),
358  fHistoElectronFeedDownXic0MCGen(0),
359  fHistoElectronFeedDownXic0MCGen1(0),
360  fHistoElectronFeedDownXic0MCGen2(0),
361  fHistoElectronFeedDownXic0MCS(0),
362  fHistoElectronFeedDownXic0MCS1(0),
363  fHistoElectronFeedDownXic0MCS2(0),
364  fHistoElectronFeedDownXicPlusMCGen(0),
365  fHistoElectronFeedDownXicPlusMCGen1(0),
366  fHistoElectronFeedDownXicPlusMCGen2(0),
367  fHistoElectronFeedDownXicPlusMCS(0),
368  fHistoElectronFeedDownXicPlusMCS1(0),
369  fHistoElectronFeedDownXicPlusMCS2(0),
370  fHistoElectronFeedDownXibMCGen(0),
371  fHistoElectronFeedDownXibMCGen1(0),
372  fHistoElectronFeedDownXibMCGen2(0),
373  fHistoElectronFeedDownXibMCS(0),
374  fHistoElectronFeedDownXibMCS1(0),
375  fHistoElectronFeedDownXibMCS2(0),
376  fHistoElectronMCGen(0),
377  fHistoBottomElectronMCGen(0),
378  fHistoCharmElectronMCGen(0),
379  fHistoLambdaMCGen(0),
380  fHistoElePtvsV0dlRS(0),
381  fHistoElePtvsV0dlRS1(0),
382  fHistoElePtvsV0dlRS2(0),
383  fHistoElePtvsV0dlRSSide(0),
384  fHistoElePtvsV0dlRSSide1(0),
385  fHistoElePtvsV0dlRSSide2(0),
386  fHistoElePtvsV0dlRSMix(0),
387  fHistoElePtvsV0dlRSMix1(0),
388  fHistoElePtvsV0dlRSMix2(0),
389  fHistoElePtvsV0dlWS(0),
390  fHistoElePtvsV0dlWS1(0),
391  fHistoElePtvsV0dlWS2(0),
392  fHistoElePtvsV0dlWSSide(0),
393  fHistoElePtvsV0dlWSSide1(0),
394  fHistoElePtvsV0dlWSSide2(0),
395  fHistoElePtvsV0dlWSMix(0),
396  fHistoElePtvsV0dlWSMix1(0),
397  fHistoElePtvsV0dlWSMix2(0),
398  fHistoElePtvsV0dlMCS(0),
399  fHistoElePtvsV0dlMCS1(0),
400  fHistoElePtvsV0dlMCS2(0),
401  fHistoElePtvsV0dlFeedDownXic0MCS(0),
402  fHistoElePtvsV0dlFeedDownXic0MCS1(0),
403  fHistoElePtvsV0dlFeedDownXic0MCS2(0),
404  fHistoElePtvsV0dlFeedDownXicPlusMCS(0),
405  fHistoElePtvsV0dlFeedDownXicPlusMCS1(0),
406  fHistoElePtvsV0dlFeedDownXicPlusMCS2(0),
407  fHistoElePtvsV0dcaRS(0),
408  fHistoElePtvsV0dcaRS1(0),
409  fHistoElePtvsV0dcaRS2(0),
410  fHistoElePtvsV0dcaRSSide(0),
411  fHistoElePtvsV0dcaRSSide1(0),
412  fHistoElePtvsV0dcaRSSide2(0),
413  fHistoElePtvsV0dcaRSMix(0),
414  fHistoElePtvsV0dcaRSMix1(0),
415  fHistoElePtvsV0dcaRSMix2(0),
416  fHistoElePtvsV0dcaWS(0),
417  fHistoElePtvsV0dcaWS1(0),
418  fHistoElePtvsV0dcaWS2(0),
419  fHistoElePtvsV0dcaWSSide(0),
420  fHistoElePtvsV0dcaWSSide1(0),
421  fHistoElePtvsV0dcaWSSide2(0),
422  fHistoElePtvsV0dcaWSMix(0),
423  fHistoElePtvsV0dcaWSMix1(0),
424  fHistoElePtvsV0dcaWSMix2(0),
425  fHistoElePtvsV0dcaMCS(0),
426  fHistoElePtvsV0dcaMCS1(0),
427  fHistoElePtvsV0dcaMCS2(0),
428  fHistoElePtvsV0dcaFeedDownXic0MCS(0),
429  fHistoElePtvsV0dcaFeedDownXic0MCS1(0),
430  fHistoElePtvsV0dcaFeedDownXic0MCS2(0),
431  fHistoElePtvsV0dcaFeedDownXicPlusMCS(0),
432  fHistoElePtvsV0dcaFeedDownXicPlusMCS1(0),
433  fHistoElePtvsV0dcaFeedDownXicPlusMCS2(0),
434  fHistoEleLambdaPtvsV0dlRS(0),
435  fHistoEleLambdaPtvsV0dlRS1(0),
436  fHistoEleLambdaPtvsV0dlRS2(0),
437  fHistoEleLambdaPtvsV0dlRSSide(0),
438  fHistoEleLambdaPtvsV0dlRSSide1(0),
439  fHistoEleLambdaPtvsV0dlRSSide2(0),
440  fHistoEleLambdaPtvsV0dlRSMix(0),
441  fHistoEleLambdaPtvsV0dlRSMix1(0),
442  fHistoEleLambdaPtvsV0dlRSMix2(0),
443  fHistoEleLambdaPtvsV0dlWS(0),
444  fHistoEleLambdaPtvsV0dlWS1(0),
445  fHistoEleLambdaPtvsV0dlWS2(0),
446  fHistoEleLambdaPtvsV0dlWSSide(0),
447  fHistoEleLambdaPtvsV0dlWSSide1(0),
448  fHistoEleLambdaPtvsV0dlWSSide2(0),
449  fHistoEleLambdaPtvsV0dlWSMix(0),
450  fHistoEleLambdaPtvsV0dlWSMix1(0),
451  fHistoEleLambdaPtvsV0dlWSMix2(0),
452  fHistoEleLambdaPtvsV0dlMCS(0),
453  fHistoEleLambdaPtvsV0dlMCS1(0),
454  fHistoEleLambdaPtvsV0dlMCS2(0),
455  fHistoEleLambdaPtvsV0dlPromptMCS(0),
456  fHistoEleLambdaPtvsV0dlPromptMCS1(0),
457  fHistoEleLambdaPtvsV0dlPromptMCS2(0),
458  fHistoEleLambdaPtvsV0dlBFeeddownMCS(0),
459  fHistoEleLambdaPtvsV0dlBFeeddownMCS1(0),
460  fHistoEleLambdaPtvsV0dlBFeeddownMCS2(0),
461  fHistoEleLambdaPtvsV0dlFeedDownXic0MCS(0),
462  fHistoEleLambdaPtvsV0dlFeedDownXic0MCS1(0),
463  fHistoEleLambdaPtvsV0dlFeedDownXic0MCS2(0),
464  fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS(0),
465  fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS1(0),
466  fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS2(0),
467  fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS(0),
468  fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS1(0),
469  fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS2(0),
470  fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS(0),
471  fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS1(0),
472  fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS2(0),
473  fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS(0),
474  fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS1(0),
475  fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS2(0),
476  fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS(0),
477  fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS1(0),
478  fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS2(0),
479  fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS(0),
480  fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS1(0),
481  fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS2(0),
482  fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS(0),
483  fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS1(0),
484  fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS2(0),
485  fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS(0),
486  fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS1(0),
487  fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS2(0),
488  fHistoEleLambdaPtvsV0dlLambdabMCS(0),
489  fHistoEleLambdaPtvsV0dlLambdabMCS1(0),
490  fHistoEleLambdaPtvsV0dlLambdabMCS2(0),
491  fHistoEleLambdaPtvsV0dlXibMCS(0),
492  fHistoEleLambdaPtvsV0dlXibMCS1(0),
493  fHistoEleLambdaPtvsV0dlXibMCS2(0),
494  fHistoEleLambdaPtvsV0dlRSAway(0),
495  fHistoEleLambdaPtvsV0dlRS1Away(0),
496  fHistoEleLambdaPtvsV0dlRS2Away(0),
497  fHistoEleLambdaPtvsV0dlRSSideAway(0),
498  fHistoEleLambdaPtvsV0dlRSSide1Away(0),
499  fHistoEleLambdaPtvsV0dlRSSide2Away(0),
500  fHistoEleLambdaPtvsV0dlRSMixAway(0),
501  fHistoEleLambdaPtvsV0dlRSMix1Away(0),
502  fHistoEleLambdaPtvsV0dlRSMix2Away(0),
503  fHistoEleLambdaPtvsV0dlWSAway(0),
504  fHistoEleLambdaPtvsV0dlWS1Away(0),
505  fHistoEleLambdaPtvsV0dlWS2Away(0),
506  fHistoEleLambdaPtvsV0dlWSSideAway(0),
507  fHistoEleLambdaPtvsV0dlWSSide1Away(0),
508  fHistoEleLambdaPtvsV0dlWSSide2Away(0),
509  fHistoEleLambdaPtvsV0dlWSMixAway(0),
510  fHistoEleLambdaPtvsV0dlWSMix1Away(0),
511  fHistoEleLambdaPtvsV0dlWSMix2Away(0),
512  fHistoCorrelationVariablesvsEleLambdaPt(0),
513  fHistoCorrelationVariablesvsEleLambdaPtMix(0),
514  fHistoCorrelationVariablesvsEleLambdaPtMC(0),
515  fHistoCorrelationVariablesvsElePt(0),
516  fHistoCorrelationVariablesvsElePtMix(0),
517  fHistoCorrelationVariablesvsElePtMC(0),
518  fHistoCorrelationVariablesvsLambdaPt(0),
519  fHistoCorrelationVariablesvsLambdaPtMix(0),
520  fHistoCorrelationVariablesvsLambdaPtMC(0),
521  fHistoMassVariablesvsEleLambdaPt(0),
522  fHistoMassVariablesvsEleLambdaPtMix(0),
523  fHistoMassVariablesvsEleLambdaPtMC(0),
524  fHistoMassVariablesvsElePt(0),
525  fHistoMassVariablesvsElePtMix(0),
526  fHistoMassVariablesvsElePtMC(0),
527  fHistoMassVariablesvsLambdaPt(0),
528  fHistoMassVariablesvsLambdaPtMix(0),
529  fHistoMassVariablesvsLambdaPtMC(0),
530  fHistoResponseElePt(0),
531  fHistoResponseElePt1(0),
532  fHistoResponseElePt2(0),
533  fHistoResponseEleLambdaPt(0),
534  fHistoResponseEleLambdaPt1(0),
535  fHistoResponseEleLambdaPt2(0),
536  fHistoResponseEleLambdaPtFeeddownXic0(0),
537  fHistoResponseEleLambdaPtFeeddownXic01(0),
538  fHistoResponseEleLambdaPtFeeddownXic02(0),
539  fHistoResponseEleLambdaPtFeeddownXicPlus(0),
540  fHistoResponseEleLambdaPtFeeddownXicPlus1(0),
541  fHistoResponseEleLambdaPtFeeddownXicPlus2(0),
542  fHistoResponseEleLambdaPtFeeddownSigma(0),
543  fHistoResponseEleLambdaPtFeeddownSigma1(0),
544  fHistoResponseEleLambdaPtFeeddownSigma2(0),
545  fHistoResponseEleLambdaPtLambdab(0),
546  fHistoResponseElePtLambdab(0),
547  fHistoResponseLambdaPtLambdab(0),
548  fHistoResponseLambdaPt(0),
549  fHistoResponseLambdaPtFeeddownXic0(0),
550  fHistoResponseLambdaPtFeeddownXicPlus(0),
551  fHistoResponseLambdaPtFeeddownSigma(0),
552  fHistoResponseLambdaPtvsEleLambdaPt(0),
553  fHistoResponseLambdaPtvsEleLambdaPtLambdab(0),
554  fHistoResponseMcGenLambdabPtvsLambdacPt(0),
555  fHistoLcPtvseleLambdaPtvsElePtvsLambdaPt(0),
556  fHistoEleLambdaPtvsRapidityRS(0),
557  fHistoEleLambdaPtvsRapidityWS(0),
558  fHistoEleLambdaPtvsRapidityMCS(0),
559  fHistoPi0MCGen(0),
560  fHistoElectronPi0Total(0),
561  fHistoElectronPi0Tag(0),
562  fHistoEtaMCGen(0),
563  fHistoElectronEtaTotal(0),
564  fHistoElectronEtaTag(0),
565  fHistoKaonMCGen(0),
566  fHistoD0MCGen(0),
567  fCounter(0),
568  fHistonEvtvsRunNumber(0),
569  fHistonElevsRunNumber(0),
570  fHistonLambdavsRunNumber(0),
571  fHistoMCEventType(0),
572  fHistoMCDeltaPhiccbar(0),
573  fRefMult(9.26),
574  fGTI(0),fGTIndex(0), fTrackBuffSize(19000),
575  fHistodPhiSdEtaSElectronProtonR125RS(0),
576  fHistodPhiSdEtaSElectronProtonR125WS(0),
577  fHistodPhiSdEtaSElectronProtonR125RSMix(0),
578  fHistodPhiSdEtaSElectronProtonR125WSMix(0),
579  fHistodPhiSdEtaSElectronPionR125RS(0),
580  fHistodPhiSdEtaSElectronPionR125WS(0),
581  fHistodPhiSdEtaSElectronPionR125RSMix(0),
582  fHistodPhiSdEtaSElectronPionR125WSMix(0),
583  fDoEventMixing(0),
584  fMixWithoutConversionFlag(kFALSE),
585  fNumberOfEventsForMixing (5),
586  fNzVtxBins (0),
587  fNCentBins (0),
588  fNRPBins (0),
589  fNOfPools(1),
590  fPoolIndex(-9999),
591  fHistoPoolMonitor(0),
592  fHistoPoolIDCounter(0),
593  nextResVec(),
594  reservoirsReady(),
595  m_ReservoirE(),
596  m_ReservoirL1(),
597  m_ReservoirL2(),
598  m_ReservoirVarsE(),
599  m_ReservoirVarsL1(),
600  m_ReservoirVarsL2()
601 {
602  //
604  //
605  for(Int_t i=0;i<17;i++){
606  fHistoElePtvsCutVarsRS[i] = 0;
607  fHistoElePtvsCutVarsWS[i] = 0;
609  }
610  for(Int_t i=0;i<8;i++){
613  }
614  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=0;
615 }
616 
617 //___________________________________________________________________________
620  Bool_t writeVariableTree) :
621  AliAnalysisTaskSE(name),
622  fUseMCInfo(kFALSE),
623  fOutput(0),
624  fOutputAll(0),
625  fListCuts(0),
626  fCEvents(0),
627  fHTrigger(0),
628  fHCentrality(0),
629  fHEventPlane(0),
630  fHNTrackletvsZ(0),
632  fAnalCuts(analCuts),
633  fIsEventSelected(kFALSE),
634  fWriteVariableTree(writeVariableTree),
635  fWriteEachVariableTree(kFALSE),
636  fWriteMCVariableTree(kFALSE),
637  fVariablesTree(0),
639  fV0VariablesTree(0),
641  fMCVariablesTree(0),
646  fReconstructPrimVert(kFALSE),
647  fIsMB(kFALSE),
648  fIsSemi(kFALSE),
649  fIsCent(kFALSE),
650  fIsINT7(kFALSE),
651  fIsEMC7(kFALSE),
661  fVtx1(0),
662  fV1(0),
663  fVtxZ(0),
664  fEventPlane(0),
665  fQ(0),
666  fQSub1(0),
667  fQSub2(0),
668  fBzkG(0),
669  fCentrality(0),
670  fRunNumber(0),
671  fTriggerCheck(0),
672  fUseCentralityV0M(kFALSE),
674  fUseEventPlane(0),
675  fEvNumberCounter(0),
676  fMCEventType(-9999),
677  fMCDoPairAnalysis(kFALSE),
733  fHistoElePtRS(0),
734  fHistoElePtWS(0),
735  fHistoElePtRSMix(0),
736  fHistoElePtWSMix(0),
747  fHistoElePtMCS(0),
748  fHistoElePtMCGen(0),
799  fHistoBachPt(0),
800  fHistoBachPtMCS(0),
804  fHistod0Bach(0),
836  fHistoLcMCGen(0),
837  fHistoLcMCGen1(0),
838  fHistoLcMCGen2(0),
839  fHistoLbMCGen(0),
840  fHistoLbMCGen1(0),
841  fHistoLbMCGen2(0),
847  fHistoLcMCS(0),
848  fHistoLcMCS1(0),
849  fHistoLcMCS2(0),
850  fHistoLbMCS(0),
851  fHistoLbMCS1(0),
852  fHistoLbMCS2(0),
1084  fHistoPi0MCGen(0),
1087  fHistoEtaMCGen(0),
1090  fHistoKaonMCGen(0),
1091  fHistoD0MCGen(0),
1092  fCounter(0),
1096  fHistoMCEventType(0),
1098  fRefMult(9.26),
1099  fGTI(0),fGTIndex(0), fTrackBuffSize(19000),
1108  fDoEventMixing(0),
1109  fMixWithoutConversionFlag(kFALSE),
1111  fNzVtxBins (0),
1112  fNCentBins (0),
1113  fNRPBins (0),
1114  fNOfPools(1),
1115  fPoolIndex(-9999),
1116  fHistoPoolMonitor(0),
1118  nextResVec(),
1119  reservoirsReady(),
1120  m_ReservoirE(),
1121  m_ReservoirL1(),
1122  m_ReservoirL2(),
1123  m_ReservoirVarsE(),
1126 {
1127  //
1129  //
1130  Info("AliAnalysisTaskSELc2eleLambdafromAODtracks","Calling Constructor");
1131 
1132  for(Int_t i=0;i<17;i++){
1133  fHistoElePtvsCutVarsRS[i] = 0;
1134  fHistoElePtvsCutVarsWS[i] = 0;
1135  fHistoElePtvsCutVarsMCS[i] = 0;
1136  }
1137  for(Int_t i=0;i<8;i++){
1140  }
1141  for(Int_t i=0; i<4; i++) fMultEstimatorAvg[i]=0;
1142 
1143  DefineOutput(1,TList::Class()); //conters
1144  DefineOutput(2,TList::Class());
1145  DefineOutput(3,TList::Class()); //conters
1146  DefineOutput(4,TTree::Class()); //My private output
1147  DefineOutput(5,TTree::Class()); //My private output
1148  DefineOutput(6,TTree::Class()); //My private output
1149  DefineOutput(7,TTree::Class()); //My private output
1150  DefineOutput(8,AliNormalizationCounter::Class());
1151  DefineOutput(9,TTree::Class()); //My private output
1152  DefineOutput(10,TTree::Class()); //My private output
1153  DefineOutput(11,TTree::Class()); //My private output
1154  DefineOutput(12,TTree::Class()); //My private output
1155 }
1156 
1157 //___________________________________________________________________________
1159  //
1161  //
1162  Info("~AliAnalysisTaskSELc2eleLambdafromAODtracks","Calling Destructor");
1163 
1164  if (fOutput) {
1165  delete fOutput;
1166  fOutput = 0;
1167  }
1168 
1169  if (fOutputAll) {
1170  delete fOutputAll;
1171  fOutputAll = 0;
1172  }
1173 
1174  if (fListCuts) {
1175  delete fListCuts;
1176  fListCuts = 0;
1177  }
1178 
1179 
1180  if (fAnalCuts) {
1181  delete fAnalCuts;
1182  fAnalCuts = 0;
1183  }
1184 
1185  if (fVariablesTree) {
1186  delete fVariablesTree;
1187  fVariablesTree = 0;
1188  }
1189  if (fEleVariablesTree) {
1190  delete fEleVariablesTree;
1191  fEleVariablesTree = 0;
1192  }
1193  if (fV0VariablesTree) {
1194  delete fV0VariablesTree;
1195  fV0VariablesTree = 0;
1196  }
1197  if (fSingleVariablesTree) {
1198  delete fSingleVariablesTree;
1200  }
1201  if (fMCVariablesTree) {
1202  delete fMCVariablesTree;
1203  fMCVariablesTree = 0;
1204  }
1205  if (fMCEleVariablesTree) {
1206  delete fMCEleVariablesTree;
1207  fMCEleVariablesTree = 0;
1208  }
1209  if (fMCV0VariablesTree) {
1210  delete fMCV0VariablesTree;
1211  fMCV0VariablesTree = 0;
1212  }
1214  delete fMCGenPairVariablesTree;
1216  }
1220  }
1221  if(fCounter){
1222  delete fCounter;
1223  fCounter = 0;
1224  }
1225 
1226  for(Int_t i = 0;i<fNOfPools;i++){
1227  for(Int_t j=0;j<fNumberOfEventsForMixing;j++){
1228  while(!m_ReservoirE[i][j].empty()){
1229  delete m_ReservoirE[i][j].back();
1230  m_ReservoirE[i][j].pop_back();
1231  }
1232  while(!m_ReservoirL1[i][j].empty()){
1233  delete m_ReservoirL1[i][j].back();
1234  m_ReservoirL1[i][j].pop_back();
1235  }
1236  while(!m_ReservoirL2[i][j].empty()){
1237  delete m_ReservoirL2[i][j].back();
1238  m_ReservoirL2[i][j].pop_back();
1239  }
1240  while(!m_ReservoirVarsE[i][j].empty()){
1241  delete m_ReservoirVarsE[i][j].back();
1242  m_ReservoirVarsE[i][j].pop_back();
1243  }
1244  while(!m_ReservoirVarsL1[i][j].empty()){
1245  delete m_ReservoirVarsL1[i][j].back();
1246  m_ReservoirVarsL1[i][j].pop_back();
1247  }
1248  while(!m_ReservoirVarsL2[i][j].empty()){
1249  delete m_ReservoirVarsL2[i][j].back();
1250  m_ReservoirVarsL2[i][j].pop_back();
1251  }
1252  }
1253  }
1254 
1255  if (fGTI)
1256  delete[] fGTI;
1257  fGTI=0;
1258  if (fGTIndex)
1259  delete[] fGTIndex;
1260  fGTIndex=0;
1261 }
1262 
1263 //_________________________________________________
1265  //
1267  //
1268  //
1269 
1270  fIsEventSelected=kFALSE;
1271 
1272  if (fDebug > 1) AliInfo("Init");
1273 
1274  fListCuts = new TList();
1275  fListCuts->SetOwner();
1276  fListCuts->SetName("ListCuts");
1278  PostData(2,fListCuts);
1279 
1280  return;
1281 }
1282 
1283 //_________________________________________________
1285 {
1286  //
1288  //
1289 
1290  if (!fInputEvent) {
1291  AliError("NO EVENT FOUND!");
1292  return;
1293  }
1294  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
1295  fCEvents->Fill(1);
1296  fEvNumberCounter++;
1297 
1298  //------------------------------------------------
1299  // First check if the event has proper B
1300  //------------------------------------------------
1301 
1302  fBzkG = (Double_t)aodEvent->GetMagneticField();
1303  AliKFParticle::SetField(fBzkG);
1304  if (TMath::Abs(fBzkG)<0.001) {
1305  return;
1306  }
1307  fCEvents->Fill(2);
1308 
1309  Int_t countTr=0;
1310  Double_t countCorr=0;
1312  {
1313  AliAODTracklets* tracklets=aodEvent->GetTracklets();
1314  Int_t nTr=tracklets->GetNumberOfTracklets();
1315  for(Int_t iTr=0; iTr<nTr; iTr++){
1316  Double_t theta=tracklets->GetTheta(iTr);
1317  Double_t eta=-TMath::Log(TMath::Tan(theta/2.));
1318  if(eta>-1.0 && eta<1.0) countTr++;
1319  }
1320  AliAODVertex *vtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
1321  Bool_t isVtxOk=kFALSE;
1322  if(vtx1){
1323  if(vtx1->GetNContributors()>0){
1324  fCEvents->Fill(8);
1325  isVtxOk=kTRUE;
1326  }
1327  }
1328 
1329  countCorr=countTr;
1330  if(isVtxOk){
1331  TProfile* estimatorAvg = GetEstimatorHistogram(aodEvent);
1332  countCorr=static_cast<Int_t>(AliVertexingHFUtils::GetCorrectedNtracklets(estimatorAvg,countTr,vtx1->GetZ(),fRefMult));
1333  }
1334  }
1335 
1336 
1338  fCounter->StoreEvent(aodEvent,fAnalCuts,fUseMCInfo,countCorr);
1339  }else{
1341  }
1343 
1344  //------------------------------------------------
1345  // MC analysis setting
1346  //------------------------------------------------
1347  TClonesArray *mcArray = 0;
1348  AliAODMCHeader *mcHeader=0;
1349  if (fUseMCInfo) {
1350  // MC array need for maching
1351  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1352  if (!mcArray) {
1353  AliError("Could not find Monte-Carlo in AOD");
1354  return;
1355  }
1356  fCEvents->Fill(6); // in case of MC events
1357 
1358  // load MC header
1359  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1360  if (!mcHeader) {
1361  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: MC header branch not found!\n");
1362  return;
1363  }
1364  fCEvents->Fill(7); // in case of MC events
1365 
1366  Double_t zMCVertex = mcHeader->GetVtxZ();
1367  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
1368  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
1369  return;
1370  } else {
1371  fCEvents->Fill(17); // in case of MC events
1372  }
1373  if ((TMath::Abs(zMCVertex) < fAnalCuts->GetMaxVtxZ()) && (!fAnalCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnalCuts->IsEventRejectedDueToTrigger())) {
1374  Bool_t selevt = MakeMCAnalysis(mcArray);
1375  if(!selevt) return;
1376  }
1377  }
1378 
1379  //------------------------------------------------
1380  // Event selection
1381  //------------------------------------------------
1382  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
1383  if (!fVtx1) return;
1384 
1385  Double_t pos[3],cov[6];
1386  fVtx1->GetXYZ(pos);
1387  fVtx1->GetCovarianceMatrix(cov);
1388  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
1389  fVtxZ = pos[2];
1390 
1391  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
1392  if(!fIsTriggerNotOK) fCEvents->Fill(3);
1393  if(!fIsEventSelected) {
1394  delete fV1;
1395  return;
1396  }
1397  fCEvents->Fill(4);
1398 
1399  fHNTrackletvsZ->Fill(fVtxZ,countTr);
1400  fHNTrackletCorrvsZ->Fill(fVtxZ,countCorr);
1401 
1402  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
1403  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
1404  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
1405  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
1406  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
1408  if(fIsMB) fHTrigger->Fill(1);
1409  if(fIsSemi) fHTrigger->Fill(2);
1410  if(fIsCent) fHTrigger->Fill(3);
1411  if(fIsINT7) fHTrigger->Fill(4);
1412  if(fIsEMC7) fHTrigger->Fill(5);
1413  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
1414  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
1415  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
1416  if(fIsMB&fIsCent) fHTrigger->Fill(11);
1417  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
1418 
1419  if(fUseCentralityV0M){
1420  fCentrality = fAnalCuts->GetCentrality(aodEvent);
1421  }else if(fUseCentralitySPDTracklet){
1422  if(countCorr>=0 && countCorr<=0) fCentrality = 5.;
1423  else if(countCorr>=1 && countCorr<=8) fCentrality = 15.;
1424  else if(countCorr>= 9 && countCorr<=13) fCentrality = 25.;
1425  else if(countCorr>=14 && countCorr<=19) fCentrality = 35.;
1426  else if(countCorr>=20 && countCorr<=30) fCentrality = 45.;
1427  else if(countCorr>=31 && countCorr<=49) fCentrality = 55.;
1428  else fCentrality = 65.;
1429  }else{
1430  fCentrality = 1.;
1431  }
1432  if(fCentrality<0.||fCentrality>100.-0.0000001) {
1433  delete fV1;
1434  return;
1435  }
1436  fHCentrality->Fill(fCentrality);
1437 
1438  if(fUseEventPlane>0){
1439  if(fUseEventPlane<10){
1440  //OLD framework
1441 
1442  AliEventplane *pl=aodEvent->GetEventplane();
1443  if(!pl){
1444  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec:no eventplane! v2 analysis without eventplane not possible!\n");
1445  fCEvents->Fill(18);
1446  return;
1447  }
1448 
1449  Double_t ep_v0m = GetPhi0Pi(pl->GetEventplane("V0",aodEvent,2));
1450  Double_t ep_v0a = GetPhi0Pi(pl->GetEventplane("V0A",aodEvent,2));
1451  Double_t ep_v0c = GetPhi0Pi(pl->GetEventplane("V0C",aodEvent,2));
1452  Double_t ep_tpc = GetPhi0Pi(pl->GetEventplane("Q"));
1453  if(fUseEventPlane==1)
1454  fEventPlane = ep_v0m;
1455  if(fUseEventPlane==2)
1456  fEventPlane = ep_v0a;
1457  if(fUseEventPlane==3)
1458  fEventPlane = ep_v0c;
1459  if(fUseEventPlane==4){
1460  fEventPlane = ep_tpc;
1461  fQSub1 = pl->GetQsub1();
1462  fQSub2 = pl->GetQsub2();
1463  fQ = pl->GetQVector();
1464  if(!fQSub1 || !fQSub2){
1465  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: no Q vectors");
1466  fCEvents->Fill(19);
1467  return;
1468  }
1469  }
1470  }else{
1471  //New framework
1472  AliQnCorrectionsManager *flowQnVectorMgr;
1473  AliAnalysisTaskFlowVectorCorrections *flowQnVectorTask =
1474  dynamic_cast<AliAnalysisTaskFlowVectorCorrections *>(AliAnalysisManager::GetAnalysisManager()->GetTask("FlowQnVectorCorrections"));
1475  if (flowQnVectorTask != NULL) {
1476  flowQnVectorMgr = flowQnVectorTask->GetAliQnCorrectionsManager();
1477  }
1478  else {
1479  AliFatal("This task needs the Flow Qn vector corrections framework and it is not present. Aborting!!!");
1480  }
1481 
1482  if(fUseEventPlane==11){
1483  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: No such event plane method");
1484  return;
1485  }else if(fUseEventPlane==12){
1486  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: No such event plane method");
1487  return;
1488  }else if(fUseEventPlane==13){
1489  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: No such event plane method");
1490  return;
1491  }else if(fUseEventPlane==14){
1492  const AliQnCorrectionsQnVector *myQnVector;
1493  myQnVector = flowQnVectorMgr->GetDetectorQnVector("TPC");
1494  if(!myQnVector) {
1495  AliError("AliAnalysisTaskSELc2eleLambdafromAODtracks::UserExec: no Q vectors");
1496  fCEvents->Fill(19);
1497  return;
1498  }
1499  Double_t ep_tpc = myQnVector->EventPlane(2);
1500  fEventPlane = GetPhi0Pi((Float_t)ep_tpc);
1501  }
1502  }
1503  }
1504 
1505  fHEventPlane->Fill(fEventPlane);
1506  fRunNumber = aodEvent->GetRunNumber();
1507 
1508  Int_t runnumber_offset = 0;
1509  Int_t runnumber = aodEvent->GetRunNumber();
1510  if(runnumber<=131000&&runnumber>=114000){
1511  runnumber_offset = 114000;//lhc10bcde
1512  }else if(runnumber<=196000&&runnumber>=195000){
1513  runnumber_offset = 195000;//lhc13bc
1514  }else if(runnumber<=170593&&runnumber>=167902){
1515  runnumber_offset = 167902;//lhc11h
1516  }else if(runnumber<=246994&&runnumber>=244824){
1517  runnumber_offset = 244824;//lhc15o
1518  }
1519  fHistonEvtvsRunNumber->Fill(runnumber-runnumber_offset,1.);
1520 
1521  //------------------------------------------------
1522  // Check if the event has v0 candidate
1523  //------------------------------------------------
1524  //Int_t nv0 = aodEvent->GetNumberOfV0s();
1525  fCEvents->Fill(5);
1526 
1527 
1528  //------------------------------------------------
1529  // Main analysis done in this function
1530  //------------------------------------------------
1533  MakeAnalysis(aodEvent,mcArray);
1534 
1535  PostData(1,fOutput);
1536  PostData(3,fOutputAll);
1537  PostData(4,fVariablesTree);
1538  PostData(5,fEleVariablesTree);
1539  PostData(6,fV0VariablesTree);
1540  PostData(7,fMCVariablesTree);
1541  PostData(8,fCounter);
1542  PostData(9,fMCEleVariablesTree);
1543  PostData(10,fMCV0VariablesTree);
1544  //PostData(11,fMCGenPairVariablesTree);
1545  PostData(11,fSingleVariablesTree);
1546  PostData(12,fCorrelationVariablesTree);
1547 
1548  fIsEventSelected=kFALSE;
1549 
1550  delete fV1;
1551  return;
1552 }
1553 
1554 //________________________________________ terminate ___________________________
1556 {
1560 
1561  //AliInfo("Terminate","");
1562  AliAnalysisTaskSE::Terminate();
1563 
1564 
1565  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1566  if (!fOutput) {
1567  AliError("fOutput not available");
1568  return;
1569  }
1570 
1571  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
1572  if (!fOutputAll) {
1573  AliError("fOutputAll not available");
1574  return;
1575  }
1576 
1577  return;
1578 }
1579 
1580 //___________________________________________________________________________
1582 {
1586  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
1587 
1588  //------------------------------------------------
1589  // output object setting
1590  //------------------------------------------------
1591  fOutput = new TList();
1592  fOutput->SetOwner();
1593  fOutput->SetName("chist0");
1594  DefineGeneralHistograms(); // define general histograms
1595  PostData(1,fOutput);
1596 
1597  fOutputAll = new TList();
1598  fOutputAll->SetOwner();
1599  fOutputAll->SetName("anahisto");
1600  DefineAnalysisHistograms(); // define general histograms
1601  PostData(3,fOutputAll);
1602 
1604  PostData(4,fVariablesTree);
1605 
1607  PostData(5,fEleVariablesTree);
1608 
1610  PostData(6,fV0VariablesTree);
1611 
1613  PostData(7,fMCVariablesTree);
1614 
1616  PostData(9,fMCEleVariablesTree);
1617 
1619  PostData(10,fMCV0VariablesTree);
1620 
1621  //DefineMCGenPairTreeVariables();
1622  //PostData(11,fMCGenPairVariablesTree);
1624  PostData(11,fSingleVariablesTree);
1625 
1627  PostData(12,fCorrelationVariablesTree);
1628 
1629  //Counter for Normalization
1630  TString normName="NormalizationCounter";
1631  AliAnalysisDataContainer *cont = GetOutputSlot(8)->GetContainer();
1632  if(cont)normName=(TString)cont->GetName();
1633  fCounter = new AliNormalizationCounter(normName.Data());
1635  fCounter->SetStudyMultiplicity(kTRUE,1.);
1636  }
1637  fCounter->Init();
1638  PostData(8,fCounter);
1639 
1640  if(fDoEventMixing){
1642  m_ReservoirE.resize(fNOfPools,std::vector<std::vector<TLorentzVector *> > (fNumberOfEventsForMixing));
1643  m_ReservoirL1.resize(fNOfPools,std::vector<std::vector<TLorentzVector *> > (fNumberOfEventsForMixing));
1644  m_ReservoirL2.resize(fNOfPools,std::vector<std::vector<TLorentzVector *> > (fNumberOfEventsForMixing));
1645  m_ReservoirVarsE.resize(fNOfPools,std::vector<std::vector<TVector *> > (fNumberOfEventsForMixing));
1646  m_ReservoirVarsL1.resize(fNOfPools,std::vector<std::vector<TVector *> > (fNumberOfEventsForMixing));
1647  m_ReservoirVarsL2.resize(fNOfPools,std::vector<std::vector<TVector *> > (fNumberOfEventsForMixing));
1648  nextResVec.resize(fNOfPools,0);
1649  reservoirsReady.resize(fNOfPools,kFALSE);
1650 
1651  for(Int_t s=0; s<fNOfPools; s++) {
1652  for(Int_t k=0;k<fNumberOfEventsForMixing;k++){
1653  m_ReservoirE[s][k].clear();
1654  m_ReservoirL1[s][k].clear();
1655  m_ReservoirL2[s][k].clear();
1656  m_ReservoirVarsE[s][k].clear();
1657  m_ReservoirVarsL1[s][k].clear();
1658  m_ReservoirVarsL2[s][k].clear();
1659  }
1660  }
1661  }
1662 
1663  fGTI = new AliAODTrack *[fTrackBuffSize]; // Array of pointers
1664  fGTIndex = new Int_t [fTrackBuffSize]; // Array of index
1665 
1666  return;
1667 }
1668 
1669 //-------------------------------------------------------------------------------
1672  AliAODEvent *aodEvent, TClonesArray *mcArray
1673  )
1674 {
1675  //
1677  //
1678  if(fDoEventMixing){
1681  if(fPoolIndex<0) return;
1682 
1683  Int_t nextRes( nextResVec[fPoolIndex] );
1684  while(!m_ReservoirE[fPoolIndex][nextRes].empty()){
1685  delete m_ReservoirE[fPoolIndex][nextRes].back();
1686  m_ReservoirE[fPoolIndex][nextRes].pop_back();
1687  }
1688  while(!m_ReservoirL1[fPoolIndex][nextRes].empty()){
1689  delete m_ReservoirL1[fPoolIndex][nextRes].back();
1690  m_ReservoirL1[fPoolIndex][nextRes].pop_back();
1691  }
1692  while(!m_ReservoirL2[fPoolIndex][nextRes].empty()){
1693  delete m_ReservoirL2[fPoolIndex][nextRes].back();
1694  m_ReservoirL2[fPoolIndex][nextRes].pop_back();
1695  }
1696  while(!m_ReservoirVarsE[fPoolIndex][nextRes].empty()){
1697  delete m_ReservoirVarsE[fPoolIndex][nextRes].back();
1698  m_ReservoirVarsE[fPoolIndex][nextRes].pop_back();
1699  }
1700  while(!m_ReservoirVarsL1[fPoolIndex][nextRes].empty()){
1701  delete m_ReservoirVarsL1[fPoolIndex][nextRes].back();
1702  m_ReservoirVarsL1[fPoolIndex][nextRes].pop_back();
1703  }
1704  while(!m_ReservoirVarsL2[fPoolIndex][nextRes].empty()){
1705  delete m_ReservoirVarsL2[fPoolIndex][nextRes].back();
1706  m_ReservoirVarsL2[fPoolIndex][nextRes].pop_back();
1707  }
1708  }
1709 
1710 
1711  if(fAnalCuts->GetProdAODFilterBit()==7){
1713  // ..and set it
1714  for (Int_t iTrack=0;iTrack<aodEvent->GetNumberOfTracks();iTrack++){
1715  // cast needed since the event now returns AliVTrack instead of AliAODTrack
1716  AliAODTrack *track = dynamic_cast<AliAODTrack *>(aodEvent->GetTrack(iTrack));
1717  if (!track) continue;
1718 
1719  // Store the reference of the global tracks
1720  StoreGlobalTrackReference(track,iTrack);
1721  }
1722  }
1723 
1724  //------------------------------------------------
1725  // Select good track before hand to save time
1726  //------------------------------------------------
1727 
1728  Int_t nV0s= aodEvent->GetNumberOfV0s();
1729  Int_t nTracks= aodEvent->GetNumberOfTracks();
1730 
1731  Bool_t seleTrkFlags[nTracks];
1732  Int_t nSeleTrks=0;
1733  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags,mcArray);
1734 
1735  Bool_t seleV0Flags[nV0s];
1736  Int_t nSeleV0=0;
1737  SelectV0(aodEvent,nV0s,nSeleV0,seleV0Flags,mcArray);
1738 
1739  Int_t runnumber_offset = 0;
1740  Int_t runnumber = aodEvent->GetRunNumber();
1741  if(runnumber<=131000&&runnumber>=114000){
1742  runnumber_offset = 114000;//lhc10bcde
1743  }else if(runnumber<=196000&&runnumber>=195000){
1744  runnumber_offset = 195000;//lhc13bc
1745  }else if(runnumber<=170593&&runnumber>=167902){
1746  runnumber_offset = 167902;//lhc11h
1747  }else if(runnumber<=246994&&runnumber>=244824){
1748  runnumber_offset = 244824;//lhc15o
1749  }
1750  fHistonElevsRunNumber->Fill(runnumber-runnumber_offset,nSeleTrks);
1751  fHistonLambdavsRunNumber->Fill(runnumber-runnumber_offset,nSeleV0);
1752 
1753  //if(nSeleTrks==0 && nSeleV0 ==0) return;
1754 
1755  //------------------------------------------------
1756  // Fill Pools and single Root Objects
1757  //------------------------------------------------
1758  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
1759  if(!seleTrkFlags[itrk]) continue;
1760  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
1761 
1762  FillElectronROOTObjects(trk,aodEvent,mcArray);
1763  }
1764 
1765  for (Int_t iv0 = 0; iv0<nV0s; iv0++) {
1766  if(!seleV0Flags[iv0]) continue;
1767  AliAODv0 *v0 = aodEvent->GetV0(iv0);
1768  if(!v0) continue;
1769 
1770  FillV0ROOTObjects(v0, aodEvent, mcArray);
1771  }
1772 
1774  return;
1775 
1776  //------------------------------------------------
1777  // V0 loop
1778  //------------------------------------------------
1779  for (Int_t iv0 = 0; iv0<nV0s; iv0++) {
1780  if(!seleV0Flags[iv0]) continue;
1781  AliAODv0 *v0 = aodEvent->GetV0(iv0);
1782  if(!v0) continue;
1783 
1784  AliAODTrack *cptrack = (AliAODTrack*)(v0->GetDaughter(0));
1785  AliAODTrack *cntrack = (AliAODTrack*)(v0->GetDaughter(1));
1786 
1787  //------------------------------------------------
1788  // track loop
1789  //------------------------------------------------
1790  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
1791  if(!seleTrkFlags[itrk]) continue;
1792  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
1793  //if(trk->GetID()<0) continue;
1794 
1795  //if(!fAnalCuts->SelectWithRoughCuts(v0,trk)) continue;
1796 
1797  //TPC only track (BIT 7) does not have PID information
1798  //In addition to that, TPC only tracks does not have good DCA resolution
1799  //(according to femtoscopy code)
1800  AliAODTrack *trkpid = 0;
1801  if(fAnalCuts->GetProdAODFilterBit()==7){
1802  trkpid = fGTI[-trk->GetID()-1];
1803  }else{
1804  trkpid = trk;
1805  }
1806 
1807  Int_t cpid = cptrack->GetID();
1808  Int_t cnid = cntrack->GetID();
1809  Int_t lpid = trkpid->GetID();
1810  if((cpid==lpid)||(cnid==lpid)) continue;
1811 
1812  AliAODVertex *secVert = ReconstructSecondaryVertex(v0,trk,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
1813  if(!secVert) continue;
1814 
1815  AliAODRecoCascadeHF *elobj = MakeCascadeHF(v0,trk,trkpid,aodEvent,secVert);
1816  if(!elobj) {
1817  continue;
1818  }
1819 
1820  FillROOTObjects(elobj,v0,trk,trkpid,aodEvent,mcArray);
1821 
1822  elobj->GetSecondaryVtx()->RemoveDaughters();
1823  elobj->UnsetOwnPrimaryVtx();
1824  delete elobj;elobj=NULL;
1825  delete secVert;
1826  }
1827  }
1828 
1829  if(fDoEventMixing){
1831 
1832  Int_t nextRes( nextResVec[fPoolIndex] );
1833  nextRes++;
1834  if( nextRes>=fNumberOfEventsForMixing ){
1835  nextRes = 0;
1836  reservoirsReady[fPoolIndex] = kTRUE;
1837  }
1838  nextResVec[fPoolIndex] = nextRes;
1839  }
1840 }
1843 {
1847 
1848  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
1849  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
1850  Int_t nVar = 94;
1852  TString * fCandidateVariableNames = new TString[nVar];
1853 
1854  fCandidateVariableNames[ 0]="Centrality";
1855  fCandidateVariableNames[ 1]="InvMassEleLambda";
1856  fCandidateVariableNames[ 2]="EleLambdaPt";
1857  fCandidateVariableNames[ 3]="EleLambdaPx";
1858  fCandidateVariableNames[ 4]="EleLambdaPy";
1859  fCandidateVariableNames[ 5]="EleLambdaPz";
1860  fCandidateVariableNames[ 6]="ElePx";
1861  fCandidateVariableNames[ 7]="ElePy";
1862  fCandidateVariableNames[ 8]="ElePz";
1863  fCandidateVariableNames[ 9]="V0Px";
1864  fCandidateVariableNames[10]="V0Py";
1865  fCandidateVariableNames[11]="V0Pz";
1866  fCandidateVariableNames[12]="AntiLambdaFlag";
1867  fCandidateVariableNames[13]="MassLambda";
1868  fCandidateVariableNames[14]="MassAntiLambda";
1869  fCandidateVariableNames[15]="Eled0";
1870  fCandidateVariableNames[16]="V0d0";
1871  fCandidateVariableNames[17]="nSigmaTPCele";
1872  fCandidateVariableNames[18]="nSigmaTOFele";
1873  fCandidateVariableNames[19]="nSigmaTPCv0pr";
1874  fCandidateVariableNames[20]="nSigmaTOFv0pr";
1875  fCandidateVariableNames[21]="EleCharge";
1876  fCandidateVariableNames[22]="ProtonPx";
1877  fCandidateVariableNames[23]="ProtonPy";
1878  fCandidateVariableNames[24]="ProtonPz";
1879  fCandidateVariableNames[25]="PiPx";
1880  fCandidateVariableNames[26]="PiPy";
1881  fCandidateVariableNames[27]="PiPz";
1882  fCandidateVariableNames[28]="mcpdglc";
1883  fCandidateVariableNames[29]="mclablc";
1884  fCandidateVariableNames[30]="mcpdgmomele";
1885  fCandidateVariableNames[31]="mcpdgmomv0";
1886  fCandidateVariableNames[32]="Mixing";
1887  fCandidateVariableNames[33]="mcpdgele";
1888  fCandidateVariableNames[34]="nSigmaTPCpr_etrk";
1889  fCandidateVariableNames[35]="nSigmaTOFpr_etrk";
1890  fCandidateVariableNames[36]="nSigmaTPCka_etrk";
1891  fCandidateVariableNames[37]="nSigmaTOFka_etrk";
1892  fCandidateVariableNames[38]="MassK0Short";
1893  fCandidateVariableNames[39]="mcpdggrmomele";
1894  fCandidateVariableNames[40]="mcpdggrmomv0";
1895  fCandidateVariableNames[41]="mcngenele";
1896  fCandidateVariableNames[42]="mcngenv0";
1897  fCandidateVariableNames[43]="mclcpx";
1898  fCandidateVariableNames[44]="mclcpy";
1899  fCandidateVariableNames[45]="mclcpz";
1900  fCandidateVariableNames[46]="mcelepx";
1901  fCandidateVariableNames[47]="mcelepy";
1902  fCandidateVariableNames[48]="mcelepz";
1903  fCandidateVariableNames[49]="mcv0px";
1904  fCandidateVariableNames[50]="mcv0py";
1905  fCandidateVariableNames[51]="mcv0pz";
1906  fCandidateVariableNames[52]="nSigmaTPCpi_etrk";
1907  fCandidateVariableNames[53]="nSigmaTOFpi_etrk";
1908  fCandidateVariableNames[54]="PrimVertx";
1909  fCandidateVariableNames[55]="PrimVerty";
1910  fCandidateVariableNames[56]="PrimVertz";
1911  fCandidateVariableNames[57]="V0Vertx";
1912  fCandidateVariableNames[58]="V0Verty";
1913  fCandidateVariableNames[59]="V0Vertz";
1914 
1915  fCandidateVariableNames[60]="DcaV0PrToPrimVertex";
1916  fCandidateVariableNames[61]="DcaV0PiToPrimVertex";
1917  fCandidateVariableNames[62]="DcaV0daughters";
1918  fCandidateVariableNames[63]="V0CosPointingAngle";
1919  fCandidateVariableNames[64]="V0ProperDecayLength";
1920  fCandidateVariableNames[65]="MassK0Short2";
1921 
1922  fCandidateVariableNames[66]="nSigmaTPCv0pi";
1923  fCandidateVariableNames[67]="nSigmaTOFv0pi";
1924 
1925  fCandidateVariableNames[68]= "EleITSMatch";
1926  fCandidateVariableNames[69]= "V0PosITSMatch";
1927  fCandidateVariableNames[70]= "V0NegITSMatch";
1928  fCandidateVariableNames[71]= "IsV0PeakRegion";
1929  fCandidateVariableNames[72]= "mcpdgv0";
1930 
1931  fCandidateVariableNames[73]= "mcv0pospx";
1932  fCandidateVariableNames[74]= "mcv0pospy";
1933  fCandidateVariableNames[75]= "mcv0pospz";
1934  fCandidateVariableNames[76]= "mcpdgv0pos";
1935  fCandidateVariableNames[77]= "mcv0negpx";
1936  fCandidateVariableNames[78]= "mcv0negpy";
1937  fCandidateVariableNames[79]= "mcv0negpz";
1938  fCandidateVariableNames[80]= "mcpdgv0neg";
1939 
1940  fCandidateVariableNames[81]= "ProtonPxPV";
1941  fCandidateVariableNames[82]= "ProtonPyPV";
1942  fCandidateVariableNames[83]= "ProtonPzPV";
1943  fCandidateVariableNames[84]= "PiPxPV";
1944  fCandidateVariableNames[85]= "PiPyPV";
1945  fCandidateVariableNames[86]= "PiPzPV";
1946 
1947  fCandidateVariableNames[87]= "mcv0vertx";
1948  fCandidateVariableNames[88]= "mcv0verty";
1949  fCandidateVariableNames[89]= "mcv0vertz";
1950 
1951  fCandidateVariableNames[90]="OnFlyStatus";
1952  fCandidateVariableNames[91]="MagneticField";
1953  fCandidateVariableNames[92]="EvNumber";
1954  fCandidateVariableNames[93]="RunNumber";
1955 
1956 
1957  for (Int_t ivar=0; ivar<nVar; ivar++) {
1958  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1959  }
1960 
1961  return;
1962 }
1963 
1965 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *elobj, AliAODv0 *v0, AliAODTrack *trk, AliAODTrack *trkpid, AliAODEvent *event, TClonesArray *mcArray)
1966 {
1970  if(!trk) return;
1971  if(!trkpid) return;
1972  if(!v0) return;
1973 
1974  for(Int_t i=0;i<94;i++)
1975  {
1976  fCandidateVariables[i] = -9999.;
1977  }
1978 
1979  Bool_t anti_lambda_flag = kFALSE;
1980  if(fabs(v0->MassAntiLambda()-1.115683)<fAnalCuts->GetProdV0MassTolLambdaRough()) anti_lambda_flag = kTRUE;
1981 
1982  AliAODTrack *cptrack = (AliAODTrack*)(v0->GetDaughter(0));
1983  AliAODTrack *cntrack = (AliAODTrack*)(v0->GetDaughter(1));
1984 // if(cptrack->Charge()<0 && cntrack->Charge()>0){
1985 // cptrack = (AliAODTrack*)(v0->GetDaughter(1));
1986 // cntrack = (AliAODTrack*)(v0->GetDaughter(0));
1987 // }
1988 
1989  Double_t v0px = elobj->PxProng(1);
1990  Double_t v0py = elobj->PyProng(1);
1991  Double_t v0pz = elobj->PzProng(1);
1992  Double_t momv0 = sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz);
1993  Double_t Ev0 = sqrt(momv0*momv0+1.115683*1.115683);
1994  Double_t epx = elobj->PxProng(0);
1995  Double_t epy = elobj->PyProng(0);
1996  Double_t epz = elobj->PzProng(0);
1997  Double_t mome = sqrt(epx*epx+epy*epy+epz*epz);
1998  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
1999  Double_t cosoa = (v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz);
2000  Double_t Esum = Ee + Ev0;
2001 
2002  Double_t uxe = epx/mome;
2003  Double_t uye = epy/mome;
2004  Double_t uze = epz/mome;
2005  Double_t lf = -2.*(v0px*uxe+v0py*uye+v0pz*uze);
2006  Double_t pxv_flip = v0px + lf * uxe;
2007  Double_t pyv_flip = v0py + lf * uye;
2008  Double_t pzv_flip = v0pz + lf * uze;
2009  Double_t pxsum_flip = epx + pxv_flip;
2010  Double_t pysum_flip = epy + pyv_flip;
2011  Double_t pzsum_flip = epz + pzv_flip;
2012  Double_t melam_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
2013  Double_t ptelam_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
2014 
2015  Double_t minmass_ee = 9999.;
2016  Bool_t isconv = fAnalCuts->TagConversions(trk,fGTIndex,(AliAODEvent*)event,event->GetNumberOfTracks(),minmass_ee);
2017  Double_t minmasslike_ee = 9999.;
2018  Bool_t isconv_like = fAnalCuts->TagConversionsSameSign(trk,fGTIndex,(AliAODEvent*)event,event->GetNumberOfTracks(),minmasslike_ee);
2019 
2021  UInt_t pdgdg[2]={11,3122};
2022  fCandidateVariables[ 1] = elobj->InvMass(2,pdgdg);
2023  fCandidateVariables[ 2] = elobj->Pt();
2024  fCandidateVariables[ 3] = elobj->Px();
2025  fCandidateVariables[ 4] = elobj->Py();
2026  fCandidateVariables[ 5] = elobj->Pz();
2027  fCandidateVariables[ 6] = elobj->PxProng(0);
2028  fCandidateVariables[ 7] = elobj->PyProng(0);
2029  fCandidateVariables[ 8] = elobj->PzProng(0);
2030  fCandidateVariables[ 9] = elobj->PxProng(1);
2031  fCandidateVariables[10] = elobj->PyProng(1);
2032  fCandidateVariables[11] = elobj->PzProng(1);
2033  fCandidateVariables[12] = anti_lambda_flag;
2034  fCandidateVariables[13] = v0->MassLambda();
2035  fCandidateVariables[14] = v0->MassAntiLambda();
2036  fCandidateVariables[15] = elobj->Getd0Prong(0);
2037  fCandidateVariables[16] = elobj->Getd0Prong(1);
2038 
2039  Double_t nSigmaTPCele=-9999.;
2040  Double_t nSigmaTOFele=-9999.;
2041  Double_t nSigmaTPCv0pr=-9999.;
2042  Double_t nSigmaTOFv0pr=-9999.;
2043  Double_t nSigmaTPCv0pi=-9999.;
2044  Double_t nSigmaTOFv0pi=-9999.;
2045  if(fAnalCuts->GetIsUsePID())
2046  {
2047  nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kElectron);
2048  nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kElectron);
2049  fCandidateVariables[17] = nSigmaTPCele;
2050  fCandidateVariables[18] = nSigmaTOFele;
2051  }
2052 
2053  if(fAnalCuts->GetUseLambdaPID())
2054  {
2055  if(anti_lambda_flag){
2056  nSigmaTPCv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
2057  nSigmaTOFv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
2058  nSigmaTPCv0pi = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
2059  nSigmaTOFv0pi = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
2060  }else{
2061  nSigmaTPCv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
2062  nSigmaTOFv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
2063  nSigmaTPCv0pi = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
2064  nSigmaTOFv0pi = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
2065  }
2066  fCandidateVariables[19] = nSigmaTPCv0pr;
2067  fCandidateVariables[20] = nSigmaTOFv0pr;
2068  fCandidateVariables[66] = nSigmaTPCv0pi;
2069  fCandidateVariables[67] = nSigmaTOFv0pi;
2070  }
2071  fCandidateVariables[21] = trk->Charge();
2072 
2073  if(anti_lambda_flag){
2074  fCandidateVariables[22] = v0->MomNegX(); //cntrack->Px();
2075  fCandidateVariables[23] = v0->MomNegY(); //cntrack->Py();
2076  fCandidateVariables[24] = v0->MomNegZ(); //cntrack->Pz();
2077  fCandidateVariables[25] = v0->MomPosX(); //cptrack->Px();
2078  fCandidateVariables[26] = v0->MomPosY(); //cptrack->Py();
2079  fCandidateVariables[27] = v0->MomPosZ(); //cptrack->Pz();
2080  }else{
2081  fCandidateVariables[22] = v0->MomPosX(); //cptrack->Px();
2082  fCandidateVariables[23] = v0->MomPosY(); //cptrack->Py();
2083  fCandidateVariables[24] = v0->MomPosZ(); //cptrack->Pz();
2084  fCandidateVariables[25] = v0->MomNegX(); //cntrack->Px();
2085  fCandidateVariables[26] = v0->MomNegY(); //cntrack->Py();
2086  fCandidateVariables[27] = v0->MomNegZ(); //cntrack->Pz();
2087  }
2088 
2089  AliAODMCParticle *mclc = 0;
2090  AliAODMCParticle *mcele = 0;
2091  AliAODMCParticle *mcv0 = 0;
2092  Int_t mclablc = 0;
2093  Int_t mcpdgele_array[100];
2094  Int_t mcpdgv0_array[100];
2095  Int_t mclabelele_array[100];
2096  Int_t mclabelv0_array[100];
2097  Int_t mcngen_ele=-9999;
2098  Int_t mcngen_v0=-9999;
2099 
2100  if(fUseMCInfo && mcArray){
2101  mclablc = MatchToMC(elobj,mcArray,mcpdgele_array, mcpdgv0_array,mclabelele_array,mclabelv0_array,mcngen_ele,mcngen_v0);
2102  if(mclabelele_array[0]>=0){
2103  mcele = (AliAODMCParticle*) mcArray->At(mclabelele_array[0]);
2104  if(mcele){
2105  fCandidateVariables[46] = mcele->Px();
2106  fCandidateVariables[47] = mcele->Py();
2107  fCandidateVariables[48] = mcele->Pz();
2108  }
2109  }
2110  if(mclabelv0_array[0]>=0){
2111  mcv0 = (AliAODMCParticle*) mcArray->At(mclabelv0_array[0]);
2112  if(mcv0){
2113  fCandidateVariables[49] = mcv0->Px();
2114  fCandidateVariables[50] = mcv0->Py();
2115  fCandidateVariables[51] = mcv0->Pz();
2116  fCandidateVariables[72] = mcv0->GetPdgCode();
2117  }
2118  }else{
2119  Int_t pdgdgv0[2]={211,211};
2120  Int_t labV0 = v0->MatchToMC(310,mcArray,2,pdgdgv0); // the V0
2121  if(labV0>=0){
2122  mcv0 = (AliAODMCParticle*) mcArray->At(labV0);
2123  if(mcv0){
2124  fCandidateVariables[49] = mcv0->Px();
2125  fCandidateVariables[50] = mcv0->Py();
2126  fCandidateVariables[51] = mcv0->Pz();
2127  fCandidateVariables[72] = mcv0->GetPdgCode();
2128  }
2129  }
2130  }
2131 
2132  Int_t labPos = cptrack->GetLabel();
2133  if(labPos>=0){
2134  AliAODMCParticle *mcv0pos = (AliAODMCParticle*)mcArray->At(labPos);
2135  fCandidateVariables[73] = mcv0pos->Px();
2136  fCandidateVariables[74] = mcv0pos->Py();
2137  fCandidateVariables[75] = mcv0pos->Pz();
2138  fCandidateVariables[76] = mcv0pos->GetPdgCode();
2139  fCandidateVariables[87] = mcv0pos->Xv();
2140  fCandidateVariables[88] = mcv0pos->Yv();
2141  fCandidateVariables[89] = mcv0pos->Zv();
2142  }
2143  Int_t labNeg = cntrack->GetLabel();
2144  if(labNeg>=0){
2145  AliAODMCParticle *mcv0neg = (AliAODMCParticle*)mcArray->At(labNeg);
2146  fCandidateVariables[77] = mcv0neg->Px();
2147  fCandidateVariables[78] = mcv0neg->Py();
2148  fCandidateVariables[79] = mcv0neg->Pz();
2149  fCandidateVariables[80] = mcv0neg->GetPdgCode();
2150  }
2151 
2152  if(mclablc>-1){
2153  mclc = (AliAODMCParticle*) mcArray->At(mclablc);
2154  if(mclc){
2155  fCandidateVariables[28] = mclc->GetPdgCode();
2156  fCandidateVariables[29] = mclc->Label();
2157  fCandidateVariables[43] = mclc->Px();
2158  fCandidateVariables[44] = mclc->Py();
2159  fCandidateVariables[45] = mclc->Pz();
2160  }
2161  }
2162  fCandidateVariables[30] = mcpdgele_array[1];
2163  fCandidateVariables[31] = mcpdgv0_array[1];
2164  fCandidateVariables[33] = mcpdgele_array[0];
2165  fCandidateVariables[39] = mcpdgele_array[2];
2166  fCandidateVariables[40] = mcpdgv0_array[2];
2167  fCandidateVariables[41] = mcngen_ele;
2168  fCandidateVariables[42] = mcngen_v0;
2169  }
2170  fCandidateVariables[32] = 0;
2171 
2172  if(fAnalCuts->GetIsUsePID())
2173  {
2174  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kProton);
2175  Double_t nSigmaTOFpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kProton);
2176  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kKaon);
2177  Double_t nSigmaTOFka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kKaon);
2178  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kPion);
2179  Double_t nSigmaTOFpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kPion);
2180  fCandidateVariables[34] = nSigmaTPCpr_etrk;
2181  fCandidateVariables[35] = nSigmaTOFpr_etrk;
2182  fCandidateVariables[36] = nSigmaTPCka_etrk;
2183  fCandidateVariables[37] = nSigmaTOFka_etrk;
2184  fCandidateVariables[52] = nSigmaTPCpi_etrk;
2185  fCandidateVariables[53] = nSigmaTOFpi_etrk;
2186  }
2187  fCandidateVariables[38] = v0->MassK0Short();
2188 
2189  fCandidateVariables[54] = fVtx1->GetX();
2190  fCandidateVariables[55] = fVtx1->GetY();
2191  fCandidateVariables[56] = fVtx1->GetZ();
2192  fCandidateVariables[57] = v0->DecayVertexV0X();
2193  fCandidateVariables[58] = v0->DecayVertexV0Y();
2194  fCandidateVariables[59] = v0->DecayVertexV0Z();
2195 
2196  Double_t lDcaPosToPrimVertex = v0->DcaPosToPrimVertex();
2197  Double_t lDcaNegToPrimVertex = v0->DcaNegToPrimVertex();
2198  if(!anti_lambda_flag){
2199  fCandidateVariables[60] = lDcaPosToPrimVertex;
2200  fCandidateVariables[61] = lDcaNegToPrimVertex;
2201  }else{
2202  fCandidateVariables[60] = lDcaNegToPrimVertex;
2203  fCandidateVariables[61] = lDcaPosToPrimVertex;
2204  }
2205  fCandidateVariables[62] = v0->DcaV0Daughters();
2206  Double_t posVtx[3] = {0.,0.,0.};
2207  fVtx1->GetXYZ(posVtx);
2208  fCandidateVariables[63] = v0->CosPointingAngle(posVtx);
2209  Double_t ptotlam = TMath::Sqrt(pow(v0->Px(),2)+pow(v0->Py(),2)+pow(v0->Pz(),2));
2210  fCandidateVariables[64] = v0->DecayLengthV0(posVtx)*1.1157/ptotlam;
2211  fCandidateVariables[65] = v0->MassK0Short();
2212 
2213  if(trk) fCandidateVariables[68] = trk->GetITSClusterMap();
2214  if(cptrack) fCandidateVariables[69] = cptrack->GetITSClusterMap();
2215  if(cntrack) fCandidateVariables[70] = cntrack->GetITSClusterMap();
2216 
2218 
2219  if(!anti_lambda_flag){
2220  fCandidateVariables[81] = cptrack->Px();
2221  fCandidateVariables[82] = cptrack->Py();
2222  fCandidateVariables[83] = cptrack->Pz();
2223  fCandidateVariables[84] = cntrack->Px();
2224  fCandidateVariables[85] = cntrack->Py();
2225  fCandidateVariables[86] = cntrack->Pz();
2226  }else{
2227  fCandidateVariables[81] = cntrack->Px();
2228  fCandidateVariables[82] = cntrack->Py();
2229  fCandidateVariables[83] = cntrack->Pz();
2230  fCandidateVariables[84] = cptrack->Px();
2231  fCandidateVariables[85] = cptrack->Py();
2232  fCandidateVariables[86] = cptrack->Pz();
2233  }
2234  fCandidateVariables[90] = v0->GetOnFlyStatus();
2235 
2236  fCandidateVariables[91] = fBzkG;
2239 
2240 
2241 // if(fWriteVariableTree)
2242 // fVariablesTree->Fill();
2243 
2244  Double_t dphis_ele_pr, detas_ele_pr,dphis_ele_pi, detas_ele_pi;
2245  dphis_ele_pr = 9999.;detas_ele_pr = 9999.;dphis_ele_pi = 9999.;detas_ele_pi = 9999.;
2246  //fAnalCuts->GetdPhiSdEtaSR125(trk,cptrack,cntrack,fBzkG,posVtx, dphis_ele_pr,detas_ele_pr,dphis_ele_pi,detas_ele_pi);
2247 
2248  Double_t cont[3];
2249  cont[0] = elobj->InvMass(2,pdgdg);
2250  cont[1] = elobj->Pt();
2251  cont[2] = fCentrality;
2252  fHistoEleLambdaMass->Fill(cont);
2253 
2254  Double_t cont_flip[3];
2255  cont_flip[0] = melam_flip;
2256  cont_flip[1] = ptelam_flip;
2257  cont_flip[2] = fCentrality;
2258 
2259  Double_t cont2[3];
2260  cont2[0] = elobj->InvMass(2,pdgdg);
2261  cont2[1] = trk->Pt();
2262  cont2[2] = fCentrality;
2263  Double_t cont_eleptvseta[3];
2264  cont_eleptvseta[0] = trk->Pt();
2265  cont_eleptvseta[1] = trk->Eta();
2266  cont_eleptvseta[2] = fCentrality;
2267 
2268  Double_t cont_eleptvslambdapt[3];
2269  cont_eleptvslambdapt[0] = trk->Pt();
2270  cont_eleptvslambdapt[1] = v0->Pt();
2271  cont_eleptvslambdapt[2] = fCentrality;
2272 
2273  Double_t cont_eleptvsd0[3];
2274  cont_eleptvsd0[0] = trk->Pt();
2275  cont_eleptvsd0[1] = elobj->Getd0Prong(0)*trk->Charge();
2276  cont_eleptvsd0[2] = fCentrality;
2277 
2278  Double_t cont_eleptvsv0dl[3];
2279  cont_eleptvsv0dl[0] = trk->Pt();
2280  cont_eleptvsv0dl[1] = v0->DecayLengthV0(posVtx)*1.115683/ptotlam;
2281  cont_eleptvsv0dl[2] = fCentrality;
2282 
2283  Double_t cont_elelamptvsv0dl[4];
2284  cont_elelamptvsv0dl[0] = elobj->Pt();
2285  cont_elelamptvsv0dl[1] = v0->DecayLengthV0(posVtx)*1.115683/ptotlam;
2286  cont_elelamptvsv0dl[2] = elobj->Getd0Prong(0)*trk->Charge();
2287  cont_elelamptvsv0dl[3] = fCentrality;
2288 
2289  Double_t cont_elelamptvsv0dl_flip[4];
2290  cont_elelamptvsv0dl_flip[0] = ptelam_flip;
2291  cont_elelamptvsv0dl_flip[1] = v0->DecayLengthV0(posVtx)*1.115683/ptotlam;
2292  cont_elelamptvsv0dl_flip[2] = 0.0;
2293  cont_elelamptvsv0dl_flip[3] = fCentrality;
2294 
2295 
2296  Double_t cont_eleptvsv0dca[3];
2297  cont_eleptvsv0dca[0] = trk->Pt();
2298  cont_eleptvsv0dca[1] = v0->DcaV0ToPrimVertex();
2299  cont_eleptvsv0dca[2] = fCentrality;
2300 
2301  Double_t elobj_mass = elobj->InvMass(2,pdgdg);
2302  Double_t elobj_px = elobj->Px();
2303  Double_t elobj_py = elobj->Py();
2304  Double_t elobj_pz = elobj->Pz();
2305  Double_t elobj_E = sqrt(elobj_mass*elobj_mass+elobj_px*elobj_px+elobj_py*elobj_py+elobj_pz*elobj_pz);
2306  Double_t elobj_rap = 0.5*log((elobj_E+elobj_pz)/(elobj_E-elobj_pz));
2307 
2308  //
2309  // Old strategy only look at mass and pairpt
2310  //
2312  {
2313  if((trk->Charge()>0 && !anti_lambda_flag) || (trk->Charge()<0 && anti_lambda_flag)){
2314  fHistoEleLambdaMassRS->Fill(cont);
2315  if(trk->Charge()>0) fHistoEleLambdaMassRS1->Fill(cont);
2316  else fHistoEleLambdaMassRS2->Fill(cont);
2317 
2318  fHistoEleLambdaMassvsElePtRS->Fill(cont2);
2319  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtRS1->Fill(cont2);
2320  else fHistoEleLambdaMassvsElePtRS2->Fill(cont2);
2321  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2322  fHistoEleLambdaPtvsRapidityRS->Fill(elobj->Pt(),elobj_rap);
2323  fHistoElePtRS->Fill(trk->Pt(),fCentrality);
2324  fHistoElePtvsEtaRS->Fill(cont_eleptvseta);
2325  fHistoElePtvsLambdaPtRS->Fill(cont_eleptvslambdapt);
2326  fHistoElePtvsd0RS->Fill(cont_eleptvsd0);
2327 
2328  fHistoElePtvsV0dlRS->Fill(cont_eleptvsv0dl);
2329  if(trk->Charge()>0) fHistoElePtvsV0dlRS1->Fill(cont_eleptvsv0dl);
2330  else fHistoElePtvsV0dlRS2->Fill(cont_eleptvsv0dl);
2331 
2332  fHistoEleLambdaPtvsV0dlRS->Fill(cont_elelamptvsv0dl);
2333  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlRS1->Fill(cont_elelamptvsv0dl);
2334  else fHistoEleLambdaPtvsV0dlRS2->Fill(cont_elelamptvsv0dl);
2335 
2336  fHistoElePtvsV0dcaRS->Fill(cont_eleptvsv0dca);
2337  if(trk->Charge()>0) fHistoElePtvsV0dcaRS1->Fill(cont_eleptvsv0dca);
2338  else fHistoElePtvsV0dcaRS2->Fill(cont_eleptvsv0dca);
2339 
2340  for(Int_t ih=0;ih<17;ih++){
2341  Double_t cont_eleptvscutvars[3];
2342  cont_eleptvscutvars[0] = elobj->Pt();
2343  cont_eleptvscutvars[2] = fCentrality;
2344 
2345  if(ih==0){
2346  cont_eleptvscutvars[1] = trk->GetTPCNcls();
2347  }else if(ih==1){
2348  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
2349  }else if(ih==2){
2350  cont_eleptvscutvars[1] = nSigmaTPCele;
2351  }else if(ih==3){
2352  cont_eleptvscutvars[1] = nSigmaTOFele;
2353  }else if(ih==4){
2354  cont_eleptvscutvars[1] = trk->Eta();
2355  }else if(ih==5){
2356  cont_eleptvscutvars[1] = trk->GetITSNcls();
2357  }else if(ih==6){
2358  if(!anti_lambda_flag)
2359  cont_eleptvscutvars[1] = v0->MassLambda();
2360  else
2361  cont_eleptvscutvars[1] = v0->MassAntiLambda();
2362  }else if(ih==7){
2363  Double_t lPosV0[3];
2364  lPosV0[0] = v0->DecayVertexV0X();
2365  lPosV0[1] = v0->DecayVertexV0Y();
2366  lPosV0[2] = v0->DecayVertexV0Z();
2367  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
2368  }else if(ih==8){
2369  cont_eleptvscutvars[1] = v0->DcaV0Daughters();
2370  }else if(ih==9){
2371  if(!anti_lambda_flag)
2372  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2373  else
2374  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2375  }else if(ih==10){
2376  if(!anti_lambda_flag)
2377  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2378  else
2379  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2380  }else if(ih==11){
2381  cont_eleptvscutvars[1] = v0->CosPointingAngle(posVtx);
2382  }else if(ih==12){
2383  cont_eleptvscutvars[1] = v0->MassK0Short();
2384  }else if(ih==13){
2385  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
2386  }else if(ih==14){
2387  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
2388  }else if(ih==15){
2389  cont_eleptvscutvars[1] = v0->Eta();
2390  }else if(ih==16){
2391  Double_t v0px = elobj->PxProng(1);
2392  Double_t v0py = elobj->PyProng(1);
2393  Double_t v0pz = elobj->PzProng(1);
2394  Double_t epx = elobj->PxProng(0);
2395  Double_t epy = elobj->PyProng(0);
2396  Double_t epz = elobj->PzProng(0);
2397  cont_eleptvscutvars[1] = acos((v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz));
2398  }else{
2399  cont_eleptvscutvars[1] = -9999.;
2400  }
2401 
2402  fHistoElePtvsCutVarsRS[ih]->Fill(cont_eleptvscutvars);
2403  }
2404  }
2405  if(fUseMCInfo){
2406  if(mclc){
2407  Int_t pdgcode = mclc->GetPdgCode();
2408  Double_t cont_mclc[3];
2409  cont_mclc[0] = mclc->Pt();
2410  cont_mclc[1] = mclc->Y();
2411  cont_mclc[2] = fCentrality;
2412  Double_t cont_mcele[3];
2413  cont_mcele[0] = mcele->Pt();
2414  cont_mcele[1] = mcele->Eta();
2415  cont_mcele[2] = fCentrality;
2416 
2417  Int_t labmotherlc = mclc->GetMother();
2418  Bool_t isbottomfd = kFALSE;
2419  if(labmotherlc>=0){
2420  AliAODMCParticle *motherlc = (AliAODMCParticle*)mcArray->At(labmotherlc);
2421  Int_t pdgmotherlc = motherlc->GetPdgCode();
2422  if(TMath::Abs(pdgmotherlc)==511||TMath::Abs(pdgmotherlc)==521||TMath::Abs(pdgmotherlc)==5122||TMath::Abs(pdgmotherlc)==5132||TMath::Abs(pdgmotherlc)==5232||TMath::Abs(pdgmotherlc)==5332){
2423  isbottomfd = kTRUE;
2424  }
2425  }
2426  cont2[1] = mcele->Pt();
2427 
2428  if(abs(pdgcode)==4122 && abs(mcpdgele_array[1])==4122 && abs(mcpdgv0_array[1])==4122){
2429  fHistoEleLambdaMassMCS->Fill(cont);
2430  fHistoEleLambdaMassvsElePtMCS->Fill(cont2);
2431  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtMCS1->Fill(cont2);
2432  else fHistoEleLambdaMassvsElePtMCS2->Fill(cont2);
2433  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2434  fHistoEleLambdaPtvsRapidityMCS->Fill(elobj->Pt(),elobj_rap);
2435  fHistoElePtMCS->Fill(trk->Pt(),fCentrality);
2436  fHistoElePtvsEtaMCS->Fill(cont_eleptvseta);
2437  fHistoElePtvsLambdaPtMCS->Fill(cont_eleptvslambdapt);
2438  fHistoElePtvsd0MCS->Fill(cont_eleptvsd0);
2439 
2440  fHistoElePtvsV0dlMCS->Fill(cont_eleptvsv0dl);
2441  if(trk->Charge()>0) fHistoElePtvsV0dlMCS1->Fill(cont_eleptvsv0dl);
2442  else fHistoElePtvsV0dlMCS2->Fill(cont_eleptvsv0dl);
2443 
2444  fHistoElePtvsV0dcaMCS->Fill(cont_eleptvsv0dca);
2445  if(trk->Charge()>0) fHistoElePtvsV0dcaMCS1->Fill(cont_eleptvsv0dca);
2446  else fHistoElePtvsV0dcaMCS2->Fill(cont_eleptvsv0dca);
2447 
2448  fHistoEleLambdaPtvsV0dlMCS->Fill(cont_elelamptvsv0dl);
2449  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlMCS1->Fill(cont_elelamptvsv0dl);
2450  else fHistoEleLambdaPtvsV0dlMCS2->Fill(cont_elelamptvsv0dl);
2451 
2452  if(isbottomfd){
2453  fHistoEleLambdaPtvsV0dlBFeeddownMCS->Fill(cont_elelamptvsv0dl);
2454  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlBFeeddownMCS1->Fill(cont_elelamptvsv0dl);
2455  else fHistoEleLambdaPtvsV0dlBFeeddownMCS2->Fill(cont_elelamptvsv0dl);
2456  }else{
2457  fHistoEleLambdaPtvsV0dlPromptMCS->Fill(cont_elelamptvsv0dl);
2458  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlPromptMCS1->Fill(cont_elelamptvsv0dl);
2459  else fHistoEleLambdaPtvsV0dlPromptMCS2->Fill(cont_elelamptvsv0dl);
2460  }
2461 
2462  fHistoLcMCS->Fill(cont_mclc);
2463  if(trk->Charge()>0) fHistoLcMCS1->Fill(cont_mclc);
2464  else fHistoLcMCS2->Fill(cont_mclc);
2465 
2466  fHistoLcElectronMCS->Fill(cont_mcele);
2467  if(trk->Charge()>0) fHistoLcElectronMCS1->Fill(cont_mcele);
2468  else fHistoLcElectronMCS2->Fill(cont_mcele);
2469 
2470  fHistoResponseElePt->Fill(mclc->Pt(),trk->Pt());
2471  if(trk->Charge()>0) fHistoResponseElePt1->Fill(mclc->Pt(),trk->Pt());
2472  else fHistoResponseElePt2->Fill(mclc->Pt(),trk->Pt());
2473  fHistoResponseEleLambdaPt->Fill(mclc->Pt(),elobj->Pt());
2474  if(trk->Charge()>0) fHistoResponseEleLambdaPt1->Fill(mclc->Pt(),trk->Pt());
2475  else fHistoResponseEleLambdaPt2->Fill(mclc->Pt(),trk->Pt());
2476 
2477  fHistoResponseLambdaPt->Fill(mclc->Pt(),v0->Pt());
2478  fHistoResponseLambdaPtvsEleLambdaPt->Fill(elobj->Pt(),v0->Pt());
2479 
2480  Double_t cont_eleptvslambdaptvslcpt[4];
2481  cont_eleptvslambdaptvslcpt[0] = cont_eleptvslambdapt[0];
2482  cont_eleptvslambdaptvslcpt[1] = cont_eleptvslambdapt[1];
2483  cont_eleptvslambdaptvslcpt[2] = mclc->Pt();
2484  cont_eleptvslambdaptvslcpt[3] = cont_eleptvslambdapt[2];
2485  fHistoElePtvsLambdaPtvsLcPtMCS->Fill(cont_eleptvslambdaptvslcpt);
2486 
2487  Double_t cont_allpt[4];
2488  cont_allpt[0] = mclc->Pt();
2489  cont_allpt[1] = elobj->Pt();
2490  cont_allpt[2] = trk->Pt();
2491  cont_allpt[3] = v0->Pt();
2492  fHistoLcPtvseleLambdaPtvsElePtvsLambdaPt->Fill(cont_allpt);
2493 
2494  if(isbottomfd){
2495  fHistoElePtvsd0BFeeddownMCS->Fill(cont_eleptvsd0);
2496  }else{
2497  fHistoElePtvsd0PromptMCS->Fill(cont_eleptvsd0);
2498  }
2499 
2500  for(Int_t ih=0;ih<17;ih++){
2501  Double_t cont_eleptvscutvars[3];
2502  cont_eleptvscutvars[0] = elobj->Pt();
2503  cont_eleptvscutvars[2] = fCentrality;
2504 
2505  if(ih==0){
2506  cont_eleptvscutvars[1] = trk->GetTPCNcls();
2507  }else if(ih==1){
2508  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
2509  }else if(ih==2){
2510  cont_eleptvscutvars[1] = nSigmaTPCele;
2511  }else if(ih==3){
2512  cont_eleptvscutvars[1] = nSigmaTOFele;
2513  }else if(ih==4){
2514  cont_eleptvscutvars[1] = trk->Eta();
2515  }else if(ih==5){
2516  cont_eleptvscutvars[1] = trk->GetITSNcls();
2517  }else if(ih==6){
2518  if(!anti_lambda_flag)
2519  cont_eleptvscutvars[1] = v0->MassLambda();
2520  else
2521  cont_eleptvscutvars[1] = v0->MassAntiLambda();
2522  }else if(ih==7){
2523  Double_t lPosV0[3];
2524  lPosV0[0] = v0->DecayVertexV0X();
2525  lPosV0[1] = v0->DecayVertexV0Y();
2526  lPosV0[2] = v0->DecayVertexV0Z();
2527  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
2528  }else if(ih==8){
2529  cont_eleptvscutvars[1] = v0->DcaV0Daughters();
2530  }else if(ih==9){
2531  if(!anti_lambda_flag)
2532  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2533  else
2534  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2535  }else if(ih==10){
2536  if(!anti_lambda_flag)
2537  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2538  else
2539  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2540  }else if(ih==11){
2541  cont_eleptvscutvars[1] = v0->CosPointingAngle(posVtx);
2542  }else if(ih==12){
2543  cont_eleptvscutvars[1] = v0->MassK0Short();
2544  }else if(ih==13){
2545  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
2546  }else if(ih==14){
2547  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
2548  }else if(ih==15){
2549  cont_eleptvscutvars[1] = v0->Eta();
2550  }else if(ih==16){
2551  Double_t v0px = elobj->PxProng(1);
2552  Double_t v0py = elobj->PyProng(1);
2553  Double_t v0pz = elobj->PzProng(1);
2554  Double_t epx = elobj->PxProng(0);
2555  Double_t epy = elobj->PyProng(0);
2556  Double_t epz = elobj->PzProng(0);
2557  cont_eleptvscutvars[1] = acos((v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz));
2558  }else{
2559  cont_eleptvscutvars[1] = -9999.;
2560  }
2561 
2562  fHistoElePtvsCutVarsMCS[ih]->Fill(cont_eleptvscutvars);
2563  }
2564  }
2565  }
2566  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgv0_array[1])==3312){
2569  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtFeeddownXic0MCS1->Fill(cont2);
2571  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2572  fHistoFeedDownXic0MCS->Fill(cont_mclc);
2573  if(trk->Charge()>0) fHistoFeedDownXic0MCS1->Fill(cont_mclc);
2574  else fHistoFeedDownXic0MCS2->Fill(cont_mclc);
2575 
2576  fHistoElectronFeedDownXic0MCS->Fill(cont_mcele);
2577  if(trk->Charge()>0) fHistoElectronFeedDownXic0MCS1->Fill(cont_mcele);
2578  else fHistoElectronFeedDownXic0MCS2->Fill(cont_mcele);
2579 
2580  fHistoElePtvsV0dlFeedDownXic0MCS->Fill(cont_eleptvsv0dl);
2581  if(trk->Charge()>0) fHistoElePtvsV0dlFeedDownXic0MCS1->Fill(cont_eleptvsv0dl);
2582  else fHistoElePtvsV0dlFeedDownXic0MCS2->Fill(cont_eleptvsv0dl);
2583 
2584  fHistoEleLambdaPtvsV0dlFeedDownXic0MCS->Fill(cont_elelamptvsv0dl);
2585  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXic0MCS1->Fill(cont_elelamptvsv0dl);
2586  else fHistoEleLambdaPtvsV0dlFeedDownXic0MCS2->Fill(cont_elelamptvsv0dl);
2587 
2588  if(isbottomfd){
2589  fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS->Fill(cont_elelamptvsv0dl);
2590  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS1->Fill(cont_elelamptvsv0dl);
2591  else fHistoEleLambdaPtvsV0dlFeedDownXic0BFeeddownMCS2->Fill(cont_elelamptvsv0dl);
2592  }else{
2593  fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS->Fill(cont_elelamptvsv0dl);
2594  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS1->Fill(cont_elelamptvsv0dl);
2595  else fHistoEleLambdaPtvsV0dlFeedDownXic0PromptMCS2->Fill(cont_elelamptvsv0dl);
2596  }
2597 
2598  fHistoElePtvsV0dcaFeedDownXic0MCS->Fill(cont_eleptvsv0dca);
2599  if(trk->Charge()>0) fHistoElePtvsV0dcaFeedDownXic0MCS->Fill(cont_eleptvsv0dca);
2600  else fHistoElePtvsV0dcaFeedDownXic0MCS->Fill(cont_eleptvsv0dca);
2601 
2602  fHistoResponseEleLambdaPtFeeddownXic0->Fill(mclc->Pt(),elobj->Pt());
2603  if(trk->Charge()>0) fHistoResponseEleLambdaPtFeeddownXic01->Fill(mclc->Pt(),trk->Pt());
2604  else fHistoResponseEleLambdaPtFeeddownXic02->Fill(mclc->Pt(),trk->Pt());
2605 
2606  fHistoResponseLambdaPtFeeddownXic0->Fill(mclc->Pt(),v0->Pt());
2607 
2608  fHistoElePtFeeddownXic0MCS->Fill(trk->Pt(),fCentrality);
2609  fHistoElePtvsEtaFeeddownXic0MCS->Fill(cont_eleptvseta);
2610  fHistoElePtvsLambdaPtFeeddownXic0MCS->Fill(cont_eleptvslambdapt);
2611  }
2612  }
2613  if(abs(pdgcode)==4232 && abs(mcpdgele_array[1])==4232 && abs(mcpdgv0_array[1])==3322){
2616  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtFeeddownXicPlusMCS1->Fill(cont2);
2618  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2619  fHistoFeedDownXicPlusMCS->Fill(cont_mclc);
2620  if(trk->Charge()>0) fHistoFeedDownXicPlusMCS1->Fill(cont_mclc);
2621  else fHistoFeedDownXicPlusMCS2->Fill(cont_mclc);
2622 
2623  fHistoElectronFeedDownXicPlusMCS->Fill(cont_mcele);
2624  if(trk->Charge()>0) fHistoElectronFeedDownXicPlusMCS1->Fill(cont_mcele);
2625  else fHistoElectronFeedDownXicPlusMCS2->Fill(cont_mcele);
2626 
2627  fHistoElePtvsV0dlFeedDownXicPlusMCS->Fill(cont_eleptvsv0dl);
2628  if(trk->Charge()>0) fHistoElePtvsV0dlFeedDownXicPlusMCS1->Fill(cont_eleptvsv0dl);
2629  else fHistoElePtvsV0dlFeedDownXicPlusMCS2->Fill(cont_eleptvsv0dl);
2630 
2631  fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS->Fill(cont_elelamptvsv0dl);
2632  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS1->Fill(cont_elelamptvsv0dl);
2633  else fHistoEleLambdaPtvsV0dlFeedDownXicPlusMCS2->Fill(cont_elelamptvsv0dl);
2634 
2635  if(isbottomfd){
2636  fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS->Fill(cont_elelamptvsv0dl);
2637  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS1->Fill(cont_elelamptvsv0dl);
2638  else fHistoEleLambdaPtvsV0dlFeedDownXicPlusBFeeddownMCS2->Fill(cont_elelamptvsv0dl);
2639  }else{
2640  fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS->Fill(cont_elelamptvsv0dl);
2641  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS1->Fill(cont_elelamptvsv0dl);
2642  else fHistoEleLambdaPtvsV0dlFeedDownXicPlusPromptMCS2->Fill(cont_elelamptvsv0dl);
2643  }
2644 
2645  fHistoElePtvsV0dcaFeedDownXicPlusMCS->Fill(cont_eleptvsv0dca);
2646  if(trk->Charge()>0) fHistoElePtvsV0dcaFeedDownXicPlusMCS->Fill(cont_eleptvsv0dca);
2647  else fHistoElePtvsV0dcaFeedDownXicPlusMCS->Fill(cont_eleptvsv0dca);
2648 
2649  fHistoResponseEleLambdaPtFeeddownXicPlus->Fill(mclc->Pt(),elobj->Pt());
2650  if(trk->Charge()>0) fHistoResponseEleLambdaPtFeeddownXicPlus1->Fill(mclc->Pt(),trk->Pt());
2651  else fHistoResponseEleLambdaPtFeeddownXicPlus2->Fill(mclc->Pt(),trk->Pt());
2652 
2653  fHistoResponseLambdaPtFeeddownXicPlus->Fill(mclc->Pt(),v0->Pt());
2654 
2655  fHistoElePtFeeddownXicPlusMCS->Fill(trk->Pt(),fCentrality);
2656  fHistoElePtvsEtaFeeddownXicPlusMCS->Fill(cont_eleptvseta);
2657  fHistoElePtvsLambdaPtFeeddownXicPlusMCS->Fill(cont_eleptvslambdapt);
2658  }
2659  }
2660  if(abs(pdgcode)==4122 && abs(mcpdgele_array[1])==4122 && ( abs(mcpdgv0_array[1])==3212 || abs(mcpdgv0_array[1])==3214 || abs(mcpdgv0_array[1])==3224) ){
2661  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2662  fHistoFeedDownSigmaMCS->Fill(cont_mclc);
2663  if(trk->Charge()>0) fHistoFeedDownSigmaMCS1->Fill(cont_mclc);
2664  else fHistoFeedDownSigmaMCS2->Fill(cont_mclc);
2665 
2666  fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS->Fill(cont_elelamptvsv0dl);
2667  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS1->Fill(cont_elelamptvsv0dl);
2668  else fHistoEleLambdaPtvsV0dlFeedDownSigmaMCS2->Fill(cont_elelamptvsv0dl);
2669 
2670  if(isbottomfd){
2671  fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS->Fill(cont_elelamptvsv0dl);
2672  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS1->Fill(cont_elelamptvsv0dl);
2673  else fHistoEleLambdaPtvsV0dlFeedDownSigmaBFeeddownMCS2->Fill(cont_elelamptvsv0dl);
2674  }else{
2675  fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS->Fill(cont_elelamptvsv0dl);
2676  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS1->Fill(cont_elelamptvsv0dl);
2677  else fHistoEleLambdaPtvsV0dlFeedDownSigmaPromptMCS2->Fill(cont_elelamptvsv0dl);
2678  }
2679  fHistoResponseEleLambdaPtFeeddownSigma->Fill(mclc->Pt(),elobj->Pt());
2680  if(trk->Charge()>0) fHistoResponseEleLambdaPtFeeddownSigma1->Fill(mclc->Pt(),trk->Pt());
2681  else fHistoResponseEleLambdaPtFeeddownSigma2->Fill(mclc->Pt(),trk->Pt());
2682 
2683  fHistoResponseLambdaPtFeeddownSigma->Fill(mclc->Pt(),v0->Pt());
2684  }
2685  }
2686  }
2687  }
2688  fHistodPhiSdEtaSElectronProtonR125RS->Fill(dphis_ele_pr,detas_ele_pr);
2689  fHistodPhiSdEtaSElectronPionR125RS->Fill(dphis_ele_pi,detas_ele_pi);
2690  }else if((trk->Charge()<0 && !anti_lambda_flag) || (trk->Charge()>0 && anti_lambda_flag)){
2691  fHistoEleLambdaMassWS->Fill(cont);
2692  if(trk->Charge()>0) fHistoEleLambdaMassWS1->Fill(cont);
2693  else fHistoEleLambdaMassWS2->Fill(cont);
2694 
2695  fHistoEleLambdaMassvsElePtWS->Fill(cont2);
2696  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtWS1->Fill(cont2);
2697  else fHistoEleLambdaMassvsElePtWS2->Fill(cont2);
2698  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2699  fHistoEleLambdaPtvsRapidityWS->Fill(elobj->Pt(),elobj_rap);
2700  fHistoElePtWS->Fill(trk->Pt(),fCentrality);
2701  fHistoElePtvsEtaWS->Fill(cont_eleptvseta);
2702  fHistoElePtvsLambdaPtWS->Fill(cont_eleptvslambdapt);
2703  fHistoElePtvsd0WS->Fill(cont_eleptvsd0);
2704 
2705  fHistoElePtvsV0dlWS->Fill(cont_eleptvsv0dl);
2706  if(trk->Charge()>0) fHistoElePtvsV0dlWS1->Fill(cont_eleptvsv0dl);
2707  else fHistoElePtvsV0dlWS2->Fill(cont_eleptvsv0dl);
2708 
2709  fHistoEleLambdaPtvsV0dlWS->Fill(cont_elelamptvsv0dl);
2710  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlWS1->Fill(cont_elelamptvsv0dl);
2711  else fHistoEleLambdaPtvsV0dlWS2->Fill(cont_elelamptvsv0dl);
2712 
2713  fHistoElePtvsV0dcaWS->Fill(cont_eleptvsv0dca);
2714  if(trk->Charge()>0) fHistoElePtvsV0dcaWS1->Fill(cont_eleptvsv0dca);
2715  else fHistoElePtvsV0dcaWS2->Fill(cont_eleptvsv0dca);
2716 
2717  for(Int_t ih=0;ih<17;ih++){
2718  Double_t cont_eleptvscutvars[3];
2719  cont_eleptvscutvars[0] = elobj->Pt();
2720  cont_eleptvscutvars[2] = fCentrality;
2721 
2722  if(ih==0){
2723  cont_eleptvscutvars[1] = trk->GetTPCNcls();
2724  }else if(ih==1){
2725  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
2726  }else if(ih==2){
2727  cont_eleptvscutvars[1] = nSigmaTPCele;
2728  }else if(ih==3){
2729  cont_eleptvscutvars[1] = nSigmaTOFele;
2730  }else if(ih==4){
2731  cont_eleptvscutvars[1] = trk->Eta();
2732  }else if(ih==5){
2733  cont_eleptvscutvars[1] = trk->GetITSNcls();
2734  }else if(ih==6){
2735  if(!anti_lambda_flag)
2736  cont_eleptvscutvars[1] = v0->MassLambda();
2737  else
2738  cont_eleptvscutvars[1] = v0->MassAntiLambda();
2739  }else if(ih==7){
2740  Double_t lPosV0[3];
2741  lPosV0[0] = v0->DecayVertexV0X();
2742  lPosV0[1] = v0->DecayVertexV0Y();
2743  lPosV0[2] = v0->DecayVertexV0Z();
2744  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
2745  }else if(ih==8){
2746  cont_eleptvscutvars[1] = v0->DcaV0Daughters();
2747  }else if(ih==9){
2748  if(!anti_lambda_flag)
2749  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2750  else
2751  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2752  }else if(ih==10){
2753  if(!anti_lambda_flag)
2754  cont_eleptvscutvars[1] = v0->DcaNegToPrimVertex();
2755  else
2756  cont_eleptvscutvars[1] = v0->DcaPosToPrimVertex();
2757  }else if(ih==11){
2758  cont_eleptvscutvars[1] = v0->CosPointingAngle(posVtx);
2759  }else if(ih==12){
2760  cont_eleptvscutvars[1] = v0->MassK0Short();
2761  }else if(ih==13){
2762  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
2763  }else if(ih==14){
2764  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
2765  }else if(ih==15){
2766  cont_eleptvscutvars[1] = v0->Eta();
2767  }else if(ih==16){
2768  Double_t v0px = elobj->PxProng(1);
2769  Double_t v0py = elobj->PyProng(1);
2770  Double_t v0pz = elobj->PzProng(1);
2771  Double_t epx = elobj->PxProng(0);
2772  Double_t epy = elobj->PyProng(0);
2773  Double_t epz = elobj->PzProng(0);
2774  cont_eleptvscutvars[1] = acos((v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz));
2775  }else{
2776  cont_eleptvscutvars[1] = -9999.;
2777  }
2778 
2779  fHistoElePtvsCutVarsWS[ih]->Fill(cont_eleptvscutvars);
2780  }
2781  }
2782  if(fUseMCInfo){
2783  if(mclc){
2784  Int_t pdgcode = mclc->GetPdgCode();
2785  Double_t cont_mclb[3];
2786  cont_mclb[0] = mclc->Pt();
2787  cont_mclb[1] = mclc->Y();
2788  cont_mclb[2] = fCentrality;
2789  Double_t cont_mcele[3];
2790  cont_mcele[0] = mcele->Pt();
2791  cont_mcele[1] = mcele->Eta();
2792  cont_mcele[2] = fCentrality;
2793 
2794  if(abs(pdgcode)==5122 && abs(mcpdgele_array[1])==5122 && abs(mcpdgv0_array[1])==4122 && abs(mcpdgv0_array[2])==5122){
2795  fHistoEleLambdaMassLambdabMCS->Fill(cont);
2796  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2797  fHistoResponseEleLambdaPtLambdab->Fill(mclc->Pt(),elobj->Pt());
2798  fHistoResponseElePtLambdab->Fill(mclc->Pt(),trk->Pt());
2799  fHistoResponseLambdaPtLambdab->Fill(mclc->Pt(),v0->Pt());
2800  fHistoResponseLambdaPtvsEleLambdaPtLambdab->Fill(elobj->Pt(),v0->Pt());
2801 
2802  fHistoLbMCS->Fill(cont_mclb);
2803  if(trk->Charge()>0) fHistoLbMCS1->Fill(cont_mclb);
2804  else fHistoLbMCS2->Fill(cont_mclb);
2805 
2806  fHistoEleLambdaPtvsV0dlLambdabMCS->Fill(cont_elelamptvsv0dl);
2807  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlLambdabMCS1->Fill(cont_elelamptvsv0dl);
2808  else fHistoEleLambdaPtvsV0dlLambdabMCS2->Fill(cont_elelamptvsv0dl);
2809 
2810  fHistoLbElectronMCS->Fill(cont_mcele);
2811  if(trk->Charge()>0) fHistoLbElectronMCS1->Fill(cont_mcele);
2812  else fHistoLbElectronMCS2->Fill(cont_mcele);
2813  }
2814  }
2815  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgv0_array[1])==4132 && abs(mcpdgv0_array[2])==5132){
2816  fHistoEleLambdaMassXibMCS->Fill(cont);
2817  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2818  fHistoEleLambdaPtvsV0dlXibMCS->Fill(cont_elelamptvsv0dl);
2819  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlXibMCS1->Fill(cont_elelamptvsv0dl);
2820  else fHistoEleLambdaPtvsV0dlXibMCS2->Fill(cont_elelamptvsv0dl);
2821 
2822  fHistoElectronFeedDownXibMCS->Fill(cont_mcele);
2823  if(trk->Charge()>0) fHistoElectronFeedDownXibMCS1->Fill(cont_mcele);
2824  else fHistoElectronFeedDownXibMCS2->Fill(cont_mcele);
2825  }
2826  }
2827  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgv0_array[1])==4232 && abs(mcpdgv0_array[2])==5132){
2828  fHistoEleLambdaMassXibMCS->Fill(cont);
2829  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2830  fHistoEleLambdaPtvsV0dlXibMCS->Fill(cont_elelamptvsv0dl);
2831  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlXibMCS1->Fill(cont_elelamptvsv0dl);
2832  else fHistoEleLambdaPtvsV0dlXibMCS2->Fill(cont_elelamptvsv0dl);
2833 
2834  fHistoElectronFeedDownXibMCS->Fill(cont_mcele);
2835  if(trk->Charge()>0) fHistoElectronFeedDownXibMCS1->Fill(cont_mcele);
2836  else fHistoElectronFeedDownXibMCS2->Fill(cont_mcele);
2837  }
2838  }
2839  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgv0_array[1])==4132 && abs(mcpdgv0_array[2])==5232){
2840  fHistoEleLambdaMassXibMCS->Fill(cont);
2841  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2842  fHistoEleLambdaPtvsV0dlXibMCS->Fill(cont_elelamptvsv0dl);
2843  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlXibMCS1->Fill(cont_elelamptvsv0dl);
2844  else fHistoEleLambdaPtvsV0dlXibMCS2->Fill(cont_elelamptvsv0dl);
2845 
2846  fHistoElectronFeedDownXibMCS->Fill(cont_mcele);
2847  if(trk->Charge()>0) fHistoElectronFeedDownXibMCS1->Fill(cont_mcele);
2848  else fHistoElectronFeedDownXibMCS2->Fill(cont_mcele);
2849  }
2850  }
2851  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgv0_array[1])==4232 && abs(mcpdgv0_array[2])==5232){
2852  fHistoEleLambdaMassXibMCS->Fill(cont);
2853  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
2854  fHistoEleLambdaPtvsV0dlXibMCS->Fill(cont_elelamptvsv0dl);
2855  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlXibMCS1->Fill(cont_elelamptvsv0dl);
2856  else fHistoEleLambdaPtvsV0dlXibMCS2->Fill(cont_elelamptvsv0dl);
2857 
2858  fHistoElectronFeedDownXibMCS->Fill(cont_mcele);
2859  if(trk->Charge()>0) fHistoElectronFeedDownXibMCS1->Fill(cont_mcele);
2860  else fHistoElectronFeedDownXibMCS2->Fill(cont_mcele);
2861  }
2862  }
2863  }
2864  }
2865  fHistodPhiSdEtaSElectronProtonR125WS->Fill(dphis_ele_pr,detas_ele_pr);
2866  fHistodPhiSdEtaSElectronPionR125WS->Fill(dphis_ele_pi,detas_ele_pi);
2867  }
2868  }
2869 
2870  //if( elobj->InvMass(2,pdgdg) < 10. && cosoa < 0. && fAnalCuts->IsPeakRegion(v0))
2871  if( melam_flip < 10. && cosoa < 0. && fAnalCuts->IsPeakRegion(v0))
2872  {
2873  if((trk->Charge()>0 && !anti_lambda_flag) || (trk->Charge()<0 && anti_lambda_flag)){
2874  fHistoEleLambdaMassRSAway->Fill(cont_flip);
2875  if(trk->Charge()>0) fHistoEleLambdaMassRS1Away->Fill(cont_flip);
2876  else fHistoEleLambdaMassRS2Away->Fill(cont_flip);
2877  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
2878  fHistoEleLambdaPtvsV0dlRSAway->Fill(cont_elelamptvsv0dl_flip);
2879  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlRS1Away->Fill(cont_elelamptvsv0dl_flip);
2880  else fHistoEleLambdaPtvsV0dlRS2Away->Fill(cont_elelamptvsv0dl_flip);
2881  }
2882  }else{
2883  fHistoEleLambdaMassWSAway->Fill(cont_flip);
2884  if(trk->Charge()>0) fHistoEleLambdaMassWS1Away->Fill(cont_flip);
2885  else fHistoEleLambdaMassWS2Away->Fill(cont_flip);
2886  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
2887  fHistoEleLambdaPtvsV0dlWSAway->Fill(cont_elelamptvsv0dl_flip);
2888  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlWS1Away->Fill(cont_elelamptvsv0dl_flip);
2889  else fHistoEleLambdaPtvsV0dlWS2Away->Fill(cont_elelamptvsv0dl_flip);
2890  }
2891  }
2892  }
2893 
2895  {
2896  if((trk->Charge()>0 && !anti_lambda_flag) || (trk->Charge()<0 && anti_lambda_flag)){
2897  fHistoEleLambdaMassRSSide->Fill(cont);
2898  if(trk->Charge()>0) fHistoEleLambdaMassRSSide1->Fill(cont);
2899  else fHistoEleLambdaMassRSSide2->Fill(cont);
2900 
2901  fHistoEleLambdaMassvsElePtRSSide->Fill(cont2);
2902  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtRSSide1->Fill(cont2);
2903  else fHistoEleLambdaMassvsElePtRSSide2->Fill(cont2);
2904 
2905  fHistoElePtvsV0dlRSSide->Fill(cont_eleptvsv0dl);
2906  if(trk->Charge()>0) fHistoElePtvsV0dlRSSide1->Fill(cont_eleptvsv0dl);
2907  else fHistoElePtvsV0dlRSSide2->Fill(cont_eleptvsv0dl);
2908 
2909  fHistoEleLambdaPtvsV0dlRSSide->Fill(cont_elelamptvsv0dl);
2910  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlRSSide1->Fill(cont_elelamptvsv0dl);
2911  else fHistoEleLambdaPtvsV0dlRSSide2->Fill(cont_elelamptvsv0dl);
2912 
2913  fHistoElePtvsV0dcaRSSide->Fill(cont_eleptvsv0dca);
2914  if(trk->Charge()>0) fHistoElePtvsV0dcaRSSide1->Fill(cont_eleptvsv0dca);
2915  else fHistoElePtvsV0dcaRSSide2->Fill(cont_eleptvsv0dca);
2916 
2917  }else if((trk->Charge()<0 && !anti_lambda_flag) || (trk->Charge()>0 && anti_lambda_flag)){
2918  fHistoEleLambdaMassWSSide->Fill(cont);
2919  if(trk->Charge()>0) fHistoEleLambdaMassWSSide1->Fill(cont);
2920  else fHistoEleLambdaMassWSSide2->Fill(cont);
2921 
2922  fHistoEleLambdaMassvsElePtWSSide->Fill(cont2);
2923  if(trk->Charge()>0) fHistoEleLambdaMassvsElePtWSSide1->Fill(cont2);
2924  else fHistoEleLambdaMassvsElePtWSSide2->Fill(cont2);
2925 
2926  fHistoElePtvsV0dlWSSide->Fill(cont_eleptvsv0dl);
2927  if(trk->Charge()>0) fHistoElePtvsV0dlWSSide1->Fill(cont_eleptvsv0dl);
2928  else fHistoElePtvsV0dlWSSide2->Fill(cont_eleptvsv0dl);
2929 
2930  fHistoEleLambdaPtvsV0dlWSSide->Fill(cont_elelamptvsv0dl);
2931  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlWSSide1->Fill(cont_elelamptvsv0dl);
2932  else fHistoEleLambdaPtvsV0dlWSSide2->Fill(cont_elelamptvsv0dl);
2933 
2934  fHistoElePtvsV0dcaWSSide->Fill(cont_eleptvsv0dca);
2935  if(trk->Charge()>0) fHistoElePtvsV0dcaWSSide1->Fill(cont_eleptvsv0dca);
2936  else fHistoElePtvsV0dcaWSSide2->Fill(cont_eleptvsv0dca);
2937  }
2938  }
2939 
2940  //if( elobj->InvMass(2,pdgdg) < 10. && cosoa < 0. && fAnalCuts->IsSideBand(v0))
2941  if( melam_flip < 10. && cosoa < 0. && fAnalCuts->IsSideBand(v0))
2942  {
2943  if((trk->Charge()>0 && !anti_lambda_flag) || (trk->Charge()<0 && anti_lambda_flag)){
2944  fHistoEleLambdaMassRSSideAway->Fill(cont_flip);
2945  if(trk->Charge()>0) fHistoEleLambdaMassRSSide1Away->Fill(cont_flip);
2946  else fHistoEleLambdaMassRSSide2Away->Fill(cont_flip);
2947  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
2948  fHistoEleLambdaPtvsV0dlRSSideAway->Fill(cont_elelamptvsv0dl_flip);
2949  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlRSSide1Away->Fill(cont_elelamptvsv0dl_flip);
2950  else fHistoEleLambdaPtvsV0dlRSSide2Away->Fill(cont_elelamptvsv0dl_flip);
2951  }
2952  }else{
2953  fHistoEleLambdaMassWSSideAway->Fill(cont_flip);
2954  if(trk->Charge()>0) fHistoEleLambdaMassWSSide1Away->Fill(cont_flip);
2955  else fHistoEleLambdaMassWSSide2Away->Fill(cont_flip);
2956  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
2957  fHistoEleLambdaPtvsV0dlWSSideAway->Fill(cont_elelamptvsv0dl_flip);
2958  if(trk->Charge()>0) fHistoEleLambdaPtvsV0dlWSSide1Away->Fill(cont_elelamptvsv0dl_flip);
2959  else fHistoEleLambdaPtvsV0dlWSSide2Away->Fill(cont_elelamptvsv0dl_flip);
2960  }
2961  }
2962  }
2963 
2964  //
2965  // New strategy: Fully analyze correlation
2966  //
2967  for(Int_t iv=0;iv<15;iv++){
2968  fCorrelationVariables[iv] = -9999.;
2969  }
2970 
2971  Double_t cont_cor_nd[7];
2972  for(Int_t iv=0;iv<7;iv++){
2973  cont_cor_nd[iv] = -9999.;
2974  }
2975  Double_t cont_mass_nd[8];
2976  for(Int_t iv=0;iv<8;iv++){
2977  cont_mass_nd[iv] = -9999.;
2978  }
2979 
2980  fCorrelationVariables[0] = v0->Pt();
2981  fCorrelationVariables[1] = trk->Pt();
2984  fCorrelationVariables[4] = v0->DecayLengthV0(posVtx)*1.115683/ptotlam;;
2985  fCorrelationVariables[5] = elobj->Getd0Prong(0);
2986  if(!fUseMCInfo) fCorrelationVariables[6] = 0;
2987  else fCorrelationVariables[6] = 1;
2988  if(trk->Charge()>0){
2989  if(!anti_lambda_flag) fCorrelationVariables[7] = 0;
2990  else fCorrelationVariables[7] = 2;
2991  }else if(trk->Charge()<0){
2992  if(!anti_lambda_flag) fCorrelationVariables[7] = 1;
2993  else fCorrelationVariables[7] = 3;
2994  }
2995  fCorrelationVariables[8] = (Int_t)isconv + 2 * (Int_t)isconv_like;
2997  fCorrelationVariables[11] = elobj->Pt();
2998  fCorrelationVariables[12] = elobj->InvMass(2,pdgdg);
3000 
3001  cont_cor_nd[0] = elobj->Pt();
3002  cont_cor_nd[1] = fAnalCuts->DeltaPhi(v0,trk);
3003  cont_cor_nd[2] = v0->DecayLengthV0(posVtx)*1.115683/ptotlam;;
3004  if(trk->Charge()>0){
3005  if(!anti_lambda_flag) cont_cor_nd[3] = 0;
3006  else cont_cor_nd[3] = 2;
3007  }else if(trk->Charge()<0){
3008  if(!anti_lambda_flag) cont_cor_nd[3] = 3;
3009  else cont_cor_nd[3] = 1;
3010  }
3011  cont_cor_nd[4] = fCorrelationVariables[8];
3012  cont_cor_nd[5] = 0;
3013  cont_cor_nd[6] = fCentrality;
3014 
3015  if(fUseMCInfo && FromSemileptonicDecays(mcpdgele_array)>0){
3016  if(mclc){
3017  Int_t pdgcode = mclc->GetPdgCode();
3018  if(abs(pdgcode)==4122 && abs(mcpdgele_array[1])==4122 && abs(mcpdgv0_array[1])==4122){
3019  fCorrelationVariables[9] = 1;
3020  cont_cor_nd[5] = 1;
3021  }
3022  if(abs(pdgcode)==4122 && abs(mcpdgele_array[1])==4122 && ( abs(mcpdgv0_array[1])==3212 || abs(mcpdgv0_array[1])==3214 || abs(mcpdgv0_array[1])==3224) ){
3023  fCorrelationVariables[9] = 2;
3024  cont_cor_nd[5] = 2;
3025  }
3026  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgv0_array[1])==3312){
3027  fCorrelationVariables[9] = 3;
3028  cont_cor_nd[5] = 3;
3029  }
3030  if(abs(pdgcode)==4232 && abs(mcpdgele_array[1])==4232 && abs(mcpdgv0_array[1])==3322){
3031  fCorrelationVariables[9] = 4;
3032  cont_cor_nd[5] = 4;
3033  }
3034  if(abs(pdgcode)==5122 && abs(mcpdgele_array[1])==5122 && abs(mcpdgv0_array[1])==4122 && abs(mcpdgv0_array[2])==5122){
3035  fCorrelationVariables[9] = 11;
3036  cont_cor_nd[5] = 5;
3037  }
3038  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgv0_array[1])==4132 && abs(mcpdgv0_array[2])==5132){
3039  fCorrelationVariables[9] = 12;
3040  cont_cor_nd[5] = 6;
3041  }
3042  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgv0_array[1])==4232 && abs(mcpdgv0_array[2])==5132){
3043  fCorrelationVariables[9] = 13;
3044  cont_cor_nd[5] = 6;
3045  }
3046  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgv0_array[1])==4132 && abs(mcpdgv0_array[2])==5232){
3047  fCorrelationVariables[9] = 14;
3048  cont_cor_nd[5] = 6;
3049  }
3050  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgv0_array[1])==4232 && abs(mcpdgv0_array[2])==5232){
3051  fCorrelationVariables[9] = 15;
3052  cont_cor_nd[5] = 6;
3053  }
3054  if(FromSemileptonicDecays(mcpdgele_array)==3){
3055  fCorrelationVariables[9] = 16;
3056  }
3057  }
3058  if(fCorrelationVariables[9]<0){
3059  Bool_t lam_from_bottom = HaveBottomInHistory(mcpdgv0_array);
3060  Bool_t lam_from_charm = HaveCharmInHistory(mcpdgv0_array);
3061  if(FromSemileptonicDecays(mcpdgele_array)==1){
3062  if(lam_from_bottom) fCorrelationVariables[9] = 1011;
3063  else if(lam_from_charm) fCorrelationVariables[9] = 1012;
3064  else fCorrelationVariables[9] = 1013;
3065 
3066  cont_cor_nd[5] = 7;
3067  }
3068  if(FromSemileptonicDecays(mcpdgele_array)==2){
3069  if(lam_from_bottom) fCorrelationVariables[9] = 1014;
3070  else if(lam_from_charm) fCorrelationVariables[9] = 1015;
3071  else fCorrelationVariables[9] = 1016;
3072 
3073  cont_cor_nd[5] = 8;
3074  }
3075  if(FromSemileptonicDecays(mcpdgele_array)==1 && HaveBottomInHistory(mcpdgele_array)){
3076  if(lam_from_bottom) fCorrelationVariables[9] = 1017;
3077  else if(lam_from_charm) fCorrelationVariables[9] = 1018;
3078  else fCorrelationVariables[9] = 1019;
3079 
3080  cont_cor_nd[5] = 9;
3081  }
3082  if(FromSemileptonicDecays(mcpdgele_array)==3){
3083  if(HaveBottomInHistory(mcpdgele_array)) fCorrelationVariables[9] = 1021;
3084  else if(HaveCharmInHistory(mcpdgele_array)) fCorrelationVariables[9] = 1022;
3085  else fCorrelationVariables[9] = 1023;
3086  }
3087  }
3088  }
3089  if(fUseMCInfo) fCorrelationVariables[14] = mcpdgele_array[1];
3090 
3092  {
3093  if(fWriteVariableTree)
3094  fCorrelationVariablesTree->Fill();
3095 
3096  if(fUseMCInfo){
3097  if(elobj->InvMass(2,pdgdg)<fAnalCuts->GetEleLambdaMassMax())
3098  fHistoCorrelationVariablesvsEleLambdaPtMC->Fill(cont_cor_nd);
3099  cont_cor_nd[0] = trk->Pt();
3100  fHistoCorrelationVariablesvsElePtMC->Fill(cont_cor_nd);
3101  cont_cor_nd[0] = v0->Pt();
3102  fHistoCorrelationVariablesvsLambdaPtMC->Fill(cont_cor_nd);
3103  }else{
3104  if(elobj->InvMass(2,pdgdg)<fAnalCuts->GetEleLambdaMassMax())
3105  fHistoCorrelationVariablesvsEleLambdaPt->Fill(cont_cor_nd);
3106  cont_cor_nd[0] = trk->Pt();
3107  fHistoCorrelationVariablesvsElePt->Fill(cont_cor_nd);
3108  cont_cor_nd[0] = v0->Pt();
3109  fHistoCorrelationVariablesvsLambdaPt->Fill(cont_cor_nd);
3110  }
3111  }
3112 
3113  cont_mass_nd[0] = elobj->InvMass(2,pdgdg);
3114  cont_mass_nd[1] = cont_cor_nd[0];
3115  cont_mass_nd[4] = cont_cor_nd[3];
3116  cont_mass_nd[5] = cont_cor_nd[4];
3117  cont_mass_nd[6] = cont_cor_nd[5];
3118  cont_mass_nd[7] = cont_cor_nd[6];
3119 
3120  if(fAnalCuts->IsPeakRegion(v0)) cont_mass_nd[3] = 1;
3121  if(fAnalCuts->IsSideBand(v0)) cont_mass_nd[3] = 0;
3122  if(fAnalCuts->IsSelected(elobj,AliRDHFCuts::kCandidate)) cont_mass_nd[2]=1;
3123  if(melam_flip < 10.&& cosoa < 0.) cont_mass_nd[2]=0;
3124  if(fUseMCInfo){
3125  fHistoMassVariablesvsEleLambdaPtMC->Fill(cont_mass_nd);
3126  cont_mass_nd[1] = trk->Pt();
3127  fHistoMassVariablesvsElePtMC->Fill(cont_mass_nd);
3128  cont_mass_nd[1] = v0->Pt();
3129  fHistoMassVariablesvsLambdaPtMC->Fill(cont_mass_nd);
3130  }else{
3131  fHistoMassVariablesvsEleLambdaPt->Fill(cont_mass_nd);
3132  cont_mass_nd[1] = trk->Pt();
3133  fHistoMassVariablesvsElePt->Fill(cont_mass_nd);
3134  cont_mass_nd[1] = v0->Pt();
3135  fHistoMassVariablesvsLambdaPt->Fill(cont_mass_nd);
3136  }
3137 
3138  return;
3139 }
3140 
3142 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillMixROOTObjects(TLorentzVector *trke, TLorentzVector *v0, TVector *elevars, TVector *v0vars, Int_t chargepr)
3143 {
3147  if(!trke) return;
3148  if(!v0) return;
3149 
3150  for(Int_t i=0;i<94;i++)
3151  {
3152  fCandidateVariables[i] = -9999.;
3153  }
3154 
3155 
3156  Double_t pxe = trke->Px();
3157  Double_t pye = trke->Py();
3158  Double_t pze = trke->Pz();
3159  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
3160  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
3161 
3162  Double_t pxv = v0->Px();
3163  Double_t pyv = v0->Py();
3164  Double_t pzv = v0->Pz();
3165  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
3166  Double_t Ev = sqrt(momv*momv+1.115683*1.115683);
3167 
3168  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
3169 
3170  Double_t pxsum = pxe + pxv;
3171  Double_t pysum = pye + pyv;
3172  Double_t pzsum = pze + pzv;
3173  Double_t Esum = Ee + Ev;
3174  Double_t mel = sqrt(Esum*Esum-pxsum*pxsum-pysum*pysum-pzsum*pzsum);
3175 
3176  Double_t uxe = pxe/mome;
3177  Double_t uye = pye/mome;
3178  Double_t uze = pze/mome;
3179  Double_t lf = -2.*(pxv*uxe+pyv*uye+pzv*uze);
3180  Double_t pxv_flip = pxv + lf * uxe;
3181  Double_t pyv_flip = pyv + lf * uye;
3182  Double_t pzv_flip = pzv + lf * uze;
3183  Double_t pxsum_flip = pxe + pxv_flip;
3184  Double_t pysum_flip = pye + pyv_flip;
3185  Double_t pzsum_flip = pze + pzv_flip;
3186  Double_t mel_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
3187  Double_t ptel_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
3188 
3190  UInt_t pdgdg[2]={11,3122};
3191  fCandidateVariables[ 1] = mel;
3192  fCandidateVariables[ 2] = sqrt(pxsum*pxsum+pysum*pysum);
3193  fCandidateVariables[ 3] = pxsum;
3194  fCandidateVariables[ 4] = pysum;
3195  fCandidateVariables[ 5] = pzsum;
3196  fCandidateVariables[ 6] = pxe;
3197  fCandidateVariables[ 7] = pye;
3198  fCandidateVariables[ 8] = pze;
3199  fCandidateVariables[ 9] = pxv;
3200  fCandidateVariables[10] = pyv;
3201  fCandidateVariables[11] = pzv;
3202  if(chargepr>0){
3203  fCandidateVariables[12] = 0;
3204  fCandidateVariables[13] = v0->M();
3205  fCandidateVariables[14] = 0.;
3206  }else{
3207  fCandidateVariables[12] = 1;
3208  fCandidateVariables[13] = 0;
3209  fCandidateVariables[14] = v0->M();
3210  }
3211 
3212  fCandidateVariables[17] = (*elevars)[3];
3213  fCandidateVariables[18] = (*elevars)[4];
3214 
3215  fCandidateVariables[21] = trke->T();
3216  fCandidateVariables[22] = (*v0vars)[9];
3217  fCandidateVariables[23] = (*v0vars)[10];
3218  fCandidateVariables[24] = (*v0vars)[11];
3219  fCandidateVariables[25] = (*v0vars)[12];
3220  fCandidateVariables[26] = (*v0vars)[13];
3221  fCandidateVariables[27] = (*v0vars)[14];
3222 
3223  fCandidateVariables[32] = 1;
3224 
3225  fCandidateVariables[54] = fVtx1->GetX();
3226  fCandidateVariables[55] = fVtx1->GetY();
3227  fCandidateVariables[56] = fVtx1->GetZ();
3228  fCandidateVariables[57] = (*v0vars)[6];
3229  fCandidateVariables[58] = (*v0vars)[7];
3230  fCandidateVariables[59] = (*v0vars)[8];
3231  fCandidateVariables[64] = (*v0vars)[15];
3232 
3233  fCandidateVariables[91] = fBzkG;
3236 
3237 
3238 // if(fWriteVariableTree)
3239 // fVariablesTree->Fill();
3240 
3241  Double_t cont[3];
3242  cont[0] = mel;
3243  cont[1] = sqrt(pxsum*pxsum+pysum*pysum);
3244  cont[2] = fCentrality;
3245  fHistoEleLambdaMass->Fill(cont);
3246 
3247  Double_t cont_flip[3];
3248  cont_flip[0] = mel_flip;
3249  cont_flip[1] = ptel_flip;
3250  cont_flip[2] = fCentrality;
3251 
3252  Double_t cont2[3];
3253  cont2[0] = mel;
3254  cont2[1] = sqrt(pxe*pxe+pye*pye);
3255  cont2[2] = fCentrality;
3256  Double_t cont_eleptvseta[3];
3257  cont_eleptvseta[0] = trke->Pt();
3258  cont_eleptvseta[1] = trke->Eta();
3259  cont_eleptvseta[2] = fCentrality;
3260 
3261  Double_t cont_eleptvslambdapt[3];
3262  cont_eleptvslambdapt[0] = trke->Pt();
3263  cont_eleptvslambdapt[1] = v0->Pt();
3264  cont_eleptvslambdapt[2] = fCentrality;
3265 
3266  Double_t cont_eleptvsd0[3];
3267  cont_eleptvsd0[0] = trke->Pt();
3268  cont_eleptvsd0[1] = 0.;
3269  cont_eleptvsd0[2] = fCentrality;
3270 
3271  Double_t cont_eleptvsv0dl[3];
3272  cont_eleptvsv0dl[0] = trke->Pt();
3273  cont_eleptvsv0dl[1] = (*v0vars)[15];
3274  cont_eleptvsv0dl[2] = fCentrality;
3275 
3276  Double_t cont_eleptvsv0dca[3];
3277  cont_eleptvsv0dca[0] = trke->Pt();
3278  cont_eleptvsv0dca[1] = (*v0vars)[16];
3279  cont_eleptvsv0dca[2] = fCentrality;
3280 
3281  Double_t cont_elelamptvsv0dl[4];
3282  cont_elelamptvsv0dl[0] = sqrt(pxsum*pxsum+pysum*pysum);
3283  cont_elelamptvsv0dl[1] = (*v0vars)[15];
3284  cont_elelamptvsv0dl[2] = 0.0;
3285  cont_elelamptvsv0dl[3] = fCentrality;
3286 
3287  Double_t cont_elelamptvsv0dl_flip[4];
3288  cont_elelamptvsv0dl_flip[0] = ptel_flip;
3289  cont_elelamptvsv0dl_flip[1] = (*v0vars)[15];
3290  cont_elelamptvsv0dl_flip[2] = 0.0;
3291  cont_elelamptvsv0dl_flip[3] = fCentrality;
3292 
3293  Double_t xyzR125_ele[3], xyzR125_pr[3], xyzR125_pi[3];
3294  xyzR125_ele[0] = (*elevars)[0];
3295  xyzR125_ele[1] = (*elevars)[1];
3296  xyzR125_ele[2] = (*elevars)[2];
3297  xyzR125_pr[0] = (*v0vars)[0];
3298  xyzR125_pr[1] = (*v0vars)[1];
3299  xyzR125_pr[2] = (*v0vars)[2];
3300  xyzR125_pi[0] = (*v0vars)[3];
3301  xyzR125_pi[1] = (*v0vars)[4];
3302  xyzR125_pi[2] = (*v0vars)[5];
3303 
3304  Double_t rdhfcutvars[9];
3305  rdhfcutvars[0] = xyzR125_ele[0];
3306  rdhfcutvars[1] = xyzR125_ele[1];
3307  rdhfcutvars[2] = xyzR125_ele[2];
3308  rdhfcutvars[3] = xyzR125_pr[0];
3309  rdhfcutvars[4] = xyzR125_pr[1];
3310  rdhfcutvars[5] = xyzR125_pr[2];
3311  rdhfcutvars[6] = xyzR125_pi[0];
3312  rdhfcutvars[7] = xyzR125_pi[1];
3313  rdhfcutvars[8] = xyzR125_pi[2];
3314 
3315  Double_t dphis_ele_pr = fAnalCuts->dPhiSR125(xyzR125_ele,xyzR125_pr);
3316  Double_t detas_ele_pr = fAnalCuts->dEtaSR125(xyzR125_ele,xyzR125_pr);
3317  Double_t dphis_ele_pi = fAnalCuts->dPhiSR125(xyzR125_ele,xyzR125_pi);
3318  Double_t detas_ele_pi = fAnalCuts->dEtaSR125(xyzR125_ele,xyzR125_pi);
3319 
3320  //if(mel < 10. && cosoa>0. && fAnalCuts->IsPeakRegion(v0))
3321  if(fAnalCuts->IsSelected(trke,v0,rdhfcutvars,AliRDHFCuts::kCandidate) && fAnalCuts->IsPeakRegion(v0))
3322  {
3323 
3324  if(((int)trke->T())*chargepr>0){
3325  fHistoEleLambdaMassRSMix->Fill(cont);
3326  if(trke->T()>0) fHistoEleLambdaMassRSMix1->Fill(cont);
3327  else fHistoEleLambdaMassRSMix2->Fill(cont);
3328 
3329  fHistoEleLambdaMassvsElePtRSMix->Fill(cont2);
3330  if(trke->T()>0) fHistoEleLambdaMassvsElePtRSMix1->Fill(cont2);
3331  else fHistoEleLambdaMassvsElePtRSMix2->Fill(cont2);
3332  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
3333  fHistoElePtRSMix->Fill(trke->Pt(),fCentrality);
3334  fHistoElePtvsEtaRSMix->Fill(cont_eleptvseta);
3335  fHistoElePtvsLambdaPtRSMix->Fill(cont_eleptvslambdapt);
3336  fHistoElePtvsd0RSMix->Fill(cont_eleptvsd0);
3337 
3338  fHistoElePtvsV0dlRSMix->Fill(cont_eleptvsv0dl);
3339  if(trke->T()>0) fHistoElePtvsV0dlRSMix1->Fill(cont_eleptvsv0dl);
3340  else fHistoElePtvsV0dlRSMix2->Fill(cont_eleptvsv0dl);
3341 
3342  fHistoEleLambdaPtvsV0dlRSMix->Fill(cont_elelamptvsv0dl);
3343  if(trke->T()>0) fHistoEleLambdaPtvsV0dlRSMix1->Fill(cont_elelamptvsv0dl);
3344  else fHistoEleLambdaPtvsV0dlRSMix2->Fill(cont_elelamptvsv0dl);
3345 
3346  fHistoElePtvsV0dcaRSMix->Fill(cont_eleptvsv0dca);
3347  if(trke->T()>0) fHistoElePtvsV0dcaRSMix1->Fill(cont_eleptvsv0dca);
3348  else fHistoElePtvsV0dcaRSMix2->Fill(cont_eleptvsv0dca);
3349  }
3350  fHistodPhiSdEtaSElectronProtonR125RSMix->Fill(dphis_ele_pr,detas_ele_pr);
3351  fHistodPhiSdEtaSElectronPionR125RSMix->Fill(dphis_ele_pi,detas_ele_pi);
3352  }else{
3353  fHistoEleLambdaMassWSMix->Fill(cont);
3354  if(trke->T()>0) fHistoEleLambdaMassWSMix1->Fill(cont);
3355  else fHistoEleLambdaMassWSMix2->Fill(cont);
3356 
3357  fHistoEleLambdaMassvsElePtWSMix->Fill(cont2);
3358  if(trke->T()>0) fHistoEleLambdaMassvsElePtWSMix1->Fill(cont2);
3359  else fHistoEleLambdaMassvsElePtWSMix2->Fill(cont2);
3360  if(cont[0]<fAnalCuts->GetEleLambdaMassMax()){
3361  fHistoElePtWSMix->Fill(trke->Pt(),fCentrality);
3362  fHistoElePtvsEtaWSMix->Fill(cont_eleptvseta);
3363  fHistoElePtvsLambdaPtWSMix->Fill(cont_eleptvslambdapt);
3364  fHistoElePtvsd0WSMix->Fill(cont_eleptvsd0);
3365 
3366  fHistoElePtvsV0dlWSMix->Fill(cont_eleptvsv0dl);
3367  if(trke->T()>0) fHistoElePtvsV0dlWSMix1->Fill(cont_eleptvsv0dl);
3368  else fHistoElePtvsV0dlWSMix2->Fill(cont_eleptvsv0dl);
3369 
3370  fHistoEleLambdaPtvsV0dlWSMix->Fill(cont_elelamptvsv0dl);
3371  if(trke->T()>0) fHistoEleLambdaPtvsV0dlWSMix1->Fill(cont_elelamptvsv0dl);
3372  else fHistoEleLambdaPtvsV0dlWSMix2->Fill(cont_elelamptvsv0dl);
3373 
3374  fHistoElePtvsV0dcaWSMix->Fill(cont_eleptvsv0dca);
3375  if(trke->T()>0) fHistoElePtvsV0dcaWSMix1->Fill(cont_eleptvsv0dca);
3376  else fHistoElePtvsV0dcaWSMix2->Fill(cont_eleptvsv0dca);
3377  }
3378  fHistodPhiSdEtaSElectronProtonR125WSMix->Fill(dphis_ele_pr,detas_ele_pr);
3379  fHistodPhiSdEtaSElectronPionR125WSMix->Fill(dphis_ele_pi,detas_ele_pi);
3380  }
3381  }
3382 
3383  //if(mel < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(v0))
3384  if(mel_flip < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(v0))
3385  {
3386  if(((int)trke->T())*chargepr>0){
3387  fHistoEleLambdaMassRSMixAway->Fill(cont_flip);
3388  if(trke->T()>0) fHistoEleLambdaMassRSMix1Away->Fill(cont_flip);
3389  else fHistoEleLambdaMassRSMix2Away->Fill(cont_flip);
3390  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
3391  fHistoEleLambdaPtvsV0dlRSMixAway->Fill(cont_elelamptvsv0dl_flip);
3392  if(trke->T()>0) fHistoEleLambdaPtvsV0dlRSMix1Away->Fill(cont_elelamptvsv0dl_flip);
3393  else fHistoEleLambdaPtvsV0dlRSMix2Away->Fill(cont_elelamptvsv0dl_flip);
3394  }
3395  }else{
3396  fHistoEleLambdaMassWSMixAway->Fill(cont_flip);
3397  if(trke->T()>0) fHistoEleLambdaMassWSMix1Away->Fill(cont_flip);
3398  else fHistoEleLambdaMassWSMix2Away->Fill(cont_flip);
3399  if(cont_flip[0]<fAnalCuts->GetEleLambdaMassMax()){
3400  fHistoEleLambdaPtvsV0dlWSMixAway->Fill(cont_elelamptvsv0dl_flip);
3401  if(trke->T()>0) fHistoEleLambdaPtvsV0dlWSMix1Away->Fill(cont_elelamptvsv0dl_flip);
3402  else fHistoEleLambdaPtvsV0dlWSMix2Away->Fill(cont_elelamptvsv0dl_flip);
3403  }
3404  }
3405  }
3406 
3407  //
3408  // New strategy: Fully analyze correlation
3409  //
3410  for(Int_t iv=0;iv<15;iv++){
3411  fCorrelationVariables[iv] = -9999.;
3412  }
3413 
3414  Double_t cont_cor_nd[7];
3415  for(Int_t iv=0;iv<7;iv++){
3416  cont_cor_nd[iv] = -9999.;
3417  }
3418  Double_t cont_mass_nd[8];
3419  for(Int_t iv=0;iv<8;iv++){
3420  cont_mass_nd[iv] = -9999.;
3421  }
3422 
3423  fCorrelationVariables[0] = v0->Pt();
3424  fCorrelationVariables[1] = trke->Pt();
3425  fCorrelationVariables[2] = TVector2::Phi_mpi_pi(v0->Phi()-trke->Phi());
3426  fCorrelationVariables[3] = v0->Eta()-trke->Eta();
3427  fCorrelationVariables[4] = (*v0vars)[15];
3428  fCorrelationVariables[5] = (*elevars)[5];
3429  fCorrelationVariables[6] = 2;
3430  if(trke->T()>0){
3431  if(chargepr>0) fCorrelationVariables[7] = 0;
3432  else fCorrelationVariables[7] = 2;
3433  }else if(trke->T()<0){
3434  if(chargepr>0) fCorrelationVariables[7] = 1;
3435  else fCorrelationVariables[7] = 3;
3436  }
3437  fCorrelationVariables[8] = (*elevars)[6];
3438  fCorrelationVariables[9] = (*elevars)[7];
3439  fCorrelationVariables[10] = fCentrality;
3440  fCorrelationVariables[11] = sqrt(pxsum*pxsum+pysum*pysum);
3441  fCorrelationVariables[12] = mel;
3442  fCorrelationVariables[13] = cosoa;
3443 
3444  cont_cor_nd[0] = sqrt(pxsum*pxsum+pysum*pysum);
3445  cont_cor_nd[1] = TVector2::Phi_mpi_pi(v0->Phi()-trke->Phi());
3446  cont_cor_nd[2] = (*v0vars)[15];
3447  if(trke->T()>0){
3448  if(chargepr>0) cont_cor_nd[3] = 0;
3449  else cont_cor_nd[3] = 2;
3450  }else if(trke->T()<0){
3451  if(chargepr>0) cont_cor_nd[3] = 3;
3452  else cont_cor_nd[3] = 1;
3453  }
3454  cont_cor_nd[4] = fCorrelationVariables[8];
3455  cont_cor_nd[5] = 0;
3456  if(fabs(fCorrelationVariables[9]-1013)<0.001) cont_cor_nd[5] = 7;
3457  if(fabs(fCorrelationVariables[9]-1016)<0.001) cont_cor_nd[5] = 8;
3458  if(fabs(fCorrelationVariables[9]-1019)<0.001) cont_cor_nd[5] = 9;
3459  cont_cor_nd[6] = fCentrality;
3460 
3461  if(fAnalCuts->IsSelected(trke,v0,rdhfcutvars,AliRDHFCuts::kCandidate) && fAnalCuts->IsPeakRegion(v0))
3462  {
3463  if(fWriteVariableTree)
3464  fCorrelationVariablesTree->Fill();
3465 
3466  if(mel<fAnalCuts->GetEleLambdaMassMax())
3467  fHistoCorrelationVariablesvsEleLambdaPtMix->Fill(cont_cor_nd);
3468  cont_cor_nd[0] = trke->Pt();
3469  fHistoCorrelationVariablesvsElePtMix->Fill(cont_cor_nd);
3470  cont_cor_nd[0] = v0->Pt();
3471  fHistoCorrelationVariablesvsLambdaPtMix->Fill(cont_cor_nd);
3472  }
3473 
3474  cont_mass_nd[0] = mel;
3475  cont_mass_nd[1] = cont_cor_nd[0];
3476  cont_mass_nd[4] = cont_cor_nd[3];
3477  cont_mass_nd[5] = cont_cor_nd[4];
3478  cont_mass_nd[6] = cont_cor_nd[5];
3479  cont_mass_nd[7] = cont_cor_nd[6];
3480 
3481  if(fAnalCuts->IsPeakRegion(v0)) cont_mass_nd[3] = 1;
3482  if(fAnalCuts->IsSideBand(v0)) cont_mass_nd[3] = 0;
3483  if(fAnalCuts->IsSelected(trke,v0,rdhfcutvars,AliRDHFCuts::kCandidate)) cont_mass_nd[2]=1;
3484  if(mel_flip < 10.&& cosoa < 0.) cont_mass_nd[2]=0;
3485  fHistoMassVariablesvsEleLambdaPtMix->Fill(cont_mass_nd);
3486  cont_mass_nd[0] = trke->Pt();
3487  fHistoMassVariablesvsElePtMix->Fill(cont_mass_nd);
3488  cont_mass_nd[0] = v0->Pt();
3489  fHistoMassVariablesvsLambdaPtMix->Fill(cont_mass_nd);
3490 
3491  return;
3492 }
3495 {
3496  //
3498  //
3499 
3500  const char* nameoutput = GetOutputSlot(11)->GetContainer()->GetName();
3501  fSingleVariablesTree = new TTree(nameoutput,"single variables tree");
3502  Int_t nVar = 30;
3504  TString * fCandidateVariableNames = new TString[nVar];
3505 
3506  fCandidateVariableNames[ 0]="Px";
3507  fCandidateVariableNames[ 1]="Py";
3508  fCandidateVariableNames[ 2]="Pz";
3509  fCandidateVariableNames[ 3]="Charge";
3510  fCandidateVariableNames[ 4]="LambdaMass";
3511  fCandidateVariableNames[ 5]="Bz";
3512  fCandidateVariableNames[ 6]="Centrality";
3513  fCandidateVariableNames[ 7]="PrimVertZ";
3514  fCandidateVariableNames[ 8]="EvNumber";
3515  fCandidateVariableNames[ 9]="RunNumber";
3516  fCandidateVariableNames[10]="EventPlane";
3517  fCandidateVariableNames[11]="Vars0";//e: dca, L: proper dl
3518  fCandidateVariableNames[12]="Vars1";//e: trk ID, L: trk ID (pos)
3519  fCandidateVariableNames[13]="Vars2";//e: nSigma TPC, L: trk ID (neg)
3520  fCandidateVariableNames[14]="Vars3";//e: nSigma TOF L: DCA V0 to PV
3521  fCandidateVariableNames[15]="Vars4";//e: nSigma ITS L: DCA V0 daughters
3522  fCandidateVariableNames[16]="MCVars0";// PDG
3523  fCandidateVariableNames[17]="MCVars1";// Mother PDG
3524  fCandidateVariableNames[18]="MCVars2";// Grand Mother PDG
3525  fCandidateVariableNames[19]="MCVars3";// Matched Label
3526  fCandidateVariableNames[20]="MCVars4";// Matched PDG
3527  fCandidateVariableNames[21]="Vars5";//e: Golden chi2 L: Pos dca to PV
3528  fCandidateVariableNames[22]="Vars6";//e: nCls ITS L: Neg dca to PV
3529  fCandidateVariableNames[23]="Vars7";//e: Chi2 ITS L: V0 cosine of pointing angle
3530  fCandidateVariableNames[24]="Vars8";//e: nCls shared ITS L: pT arm
3531  fCandidateVariableNames[25]="Vars9";//e: Not used L: Alpha arm
3532  fCandidateVariableNames[26]="Vars10";//e: Not used L: nSigmaTPC proton
3533  fCandidateVariableNames[27]="Vars11";//e: Not used L: nSigmaTPC pion
3534  fCandidateVariableNames[28]="Vars12";//e: Not used L: nSigmaTOF proton
3535  fCandidateVariableNames[29]="Vars13";//e: Not used L: nSigmaTOF pion
3536  //fCandidateVariableNames[10]="PdgMother";
3537  //fCandidateVariableNames[14]="LabMother";
3538  //fCandidateVariableNames[15]="PdgGrMother";
3539  //fCandidateVariableNames[16]="LabGrMother";
3540 
3541  for (Int_t ivar=0; ivar<nVar; ivar++) {
3542  fSingleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateSingleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3543  }
3544 
3545  return;
3546 }
3549 {
3550  //
3552  //
3553 
3554  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
3555  fEleVariablesTree = new TTree(nameoutput,"electron variables tree");
3556  Int_t nVar = 26;
3558  TString * fCandidateVariableNames = new TString[nVar];
3559 
3560  fCandidateVariableNames[ 0]="ElePx";
3561  fCandidateVariableNames[ 1]="ElePy";
3562  fCandidateVariableNames[ 2]="ElePz";
3563  fCandidateVariableNames[ 3]="TPCChi2overNDF";
3564  fCandidateVariableNames[ 4]="ITSNcls";
3565  fCandidateVariableNames[ 5]="TPCNcls";
3566  fCandidateVariableNames[ 6]="TPCNclsPID";
3567  fCandidateVariableNames[ 7]="TPCNclsRatio";
3568  fCandidateVariableNames[ 8]="d0R";
3569  fCandidateVariableNames[ 9]="d0Z";
3570  fCandidateVariableNames[10]="ITSClusterMap";
3571  fCandidateVariableNames[11]="nSigmaTPCele";
3572  fCandidateVariableNames[12]="nSigmaTOFele";
3573  fCandidateVariableNames[13]="nSigmaTPCpi";
3574  fCandidateVariableNames[14]="nSigmaTPCka";
3575  fCandidateVariableNames[15]="nSigmaTPCpr";
3576  fCandidateVariableNames[16]="EvNumber";
3577  fCandidateVariableNames[17]="EleCharge";
3578  fCandidateVariableNames[18]="ElePdgCode";
3579  fCandidateVariableNames[19]="EleMotherPdgCode";
3580  fCandidateVariableNames[20]="mcelepx";
3581  fCandidateVariableNames[21]="mcelepy";
3582  fCandidateVariableNames[22]="mcelepz";
3583  fCandidateVariableNames[23]="Centrality";
3584  fCandidateVariableNames[24]="PrimVertZ";
3585  fCandidateVariableNames[25]="RunNumber";
3586 
3587  for (Int_t ivar=0; ivar<nVar; ivar++) {
3588  fEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3589  }
3590 
3591  return;
3592 }
3594 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillElectronROOTObjects(AliAODTrack *trk, AliAODEvent *event, TClonesArray *mcArray)
3595 {
3596  //
3598  //
3599 
3600  if(!trk) return;
3601 
3602  AliAODTrack *trkpid = 0;
3603  if(fAnalCuts->GetProdAODFilterBit()==7){
3604  trkpid = fGTI[-trk->GetID()-1];
3605  }else{
3606  trkpid = trk;
3607  }
3608 
3609  fHistoBachPt->Fill(trk->Pt());
3610  fHistoElectronQovPtvsPhi->Fill(trk->Phi(),(Double_t)trk->Charge()/trk->Pt());
3611 
3612  //Int_t ncls_its = trk->GetITSclusters(0);
3613  Int_t ncls_its = 0;
3614  for(Int_t i=0;i<6;i++){
3615  if(trk->HasPointOnITSLayer(i)) ncls_its++;
3616  }
3617  Int_t ncls_its_shared = 0;
3618  for(Int_t i=0;i<6;i++){
3619  if(trk->HasPointOnITSLayer(i) && trk->HasSharedPointOnITSLayer(i)) ncls_its_shared++;
3620  }
3621 
3622  if(ncls_its>0){
3623  fHistoBachFracSharedITS->Fill((Float_t)ncls_its_shared/(Float_t)ncls_its);
3624  fHistoBachChi2NclsITS->Fill(trk->GetITSchi2()/(Float_t)ncls_its);
3625  }else{
3626  fHistoBachFracSharedITS->Fill(-9999);
3627  fHistoBachChi2NclsITS->Fill(-9999);
3628  }
3629 
3630  Double_t d0z0[2],covd0z0[3];
3631  trk->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);
3632 
3633  Double_t minmass_ee = 9999.;
3634  Double_t minmasslike_ee = 9999.;
3635  Bool_t isconv = fAnalCuts->TagConversions(trk,fGTIndex,event,event->GetNumberOfTracks(),minmass_ee);
3636  Bool_t isconv_like = fAnalCuts->TagConversionsSameSign(trk,fGTIndex,event,event->GetNumberOfTracks(),minmasslike_ee);
3637  fHistoMassConversionsMin->Fill(minmass_ee);
3638  fHistoMassConversionsSameSignMin->Fill(minmasslike_ee);
3639 
3640  Int_t pdgEle = -9999;
3641  Int_t pdgEleMother = -9999;
3642  Float_t mcelepx = -9999;
3643  Float_t mcelepy = -9999;
3644  Float_t mcelepz = -9999;
3645  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;//for write eavh variables tree
3646  for(Int_t i=0;i<100;i++){
3647  pdgarray_ele[i]=-9999;
3648  labelarray_ele[i]=-9999;
3649  }
3650  ngen_ele=-9999;
3651  Int_t mcetype = -9999;
3652  if(fUseMCInfo)
3653  {
3654  Int_t labEle = trk->GetLabel();
3655  if(labEle<0) return;
3656  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
3657  if(!mcetrk) return;
3658  if(abs(mcetrk->GetPdgCode())!=11) return;
3659 
3660  pdgEle = mcetrk->GetPdgCode();
3661  mcelepx = mcetrk->Px();
3662  mcelepy = mcetrk->Py();
3663  mcelepz = mcetrk->Pz();
3664 
3665  Int_t labEleMother = mcetrk->GetMother();
3666  if(labEleMother>-1){
3667  AliAODMCParticle *mcemothertrk = (AliAODMCParticle*)mcArray->At(labEleMother);
3668  if(mcemothertrk){
3669  pdgEleMother = mcemothertrk->GetPdgCode();
3670  }
3671  }
3672 
3673  GetMCDecayHistory(mcetrk,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
3674 
3675  Int_t hfe_flag = 0;
3676  Bool_t gamma_flag = kFALSE;
3677  Bool_t pi0_flag = kFALSE;
3678  Bool_t eta_flag = kFALSE;
3679  Double_t pt_pi0 = -9999.;
3680  Double_t pt_eta = -9999.;
3681  if(abs(pdgarray_ele[0])>400&&abs(pdgarray_ele[0])<440){
3682  hfe_flag = 1;
3683  }
3684  if(abs(pdgarray_ele[0])>4000&&abs(pdgarray_ele[0])<4400){
3685  hfe_flag = 1;
3686  }
3687  if(abs(pdgarray_ele[0])>500&&abs(pdgarray_ele[0])<540){
3688  hfe_flag = 2;
3689  }
3690  if(abs(pdgarray_ele[0])>5000&&abs(pdgarray_ele[0])<5400){
3691  hfe_flag = 2;
3692  }
3693 
3694  if(abs(pdgarray_ele[0])==22){
3695  gamma_flag = kTRUE;
3696  }
3697  if(!gamma_flag){
3698  fHistoBachPtMCS->Fill(trk->Pt());
3699  }
3700 
3701  if((abs(pdgarray_ele[0])==22) && (abs(pdgarray_ele[1])==111)){
3702  pi0_flag = kTRUE;
3703  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[1]);
3704  pt_pi0 = mctrkm->Pt();
3705  }
3706  if(abs(pdgarray_ele[0])==111){
3707  pi0_flag = kTRUE;
3708  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[0]);
3709  pt_pi0 = mctrkm->Pt();
3710  }
3711  if((abs(pdgarray_ele[0])==22) && (abs(pdgarray_ele[1])==221)){
3712  eta_flag = kTRUE;
3713  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[1]);
3714  pt_eta = mctrkm->Pt();
3715  }
3716  if(abs(pdgarray_ele[0])==221){
3717  eta_flag = kTRUE;
3718  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[0]);
3719  pt_eta = mctrkm->Pt();
3720  }
3721 
3722  if(pi0_flag){
3723  Double_t cont_pi0[3];
3724  cont_pi0[0] = trk->Pt();
3725  cont_pi0[1] = pt_pi0;
3726  cont_pi0[2] = fCentrality;
3727  fHistoElectronPi0Total->Fill(cont_pi0);
3728  if(isconv) fHistoElectronPi0Tag->Fill(cont_pi0);
3729  }
3730 
3731  if(eta_flag){
3732  Double_t cont_eta[3];
3733  cont_eta[0] = trk->Pt();
3734  cont_eta[1] = pt_eta;
3735  cont_eta[2] = fCentrality;
3736  fHistoElectronEtaTotal->Fill(cont_eta);
3737  if(isconv) fHistoElectronEtaTag->Fill(cont_eta);
3738  }
3739 
3740  if(hfe_flag==0) return;
3741 
3742  if(hfe_flag==1){
3743  mcetype = 1013;
3744  }
3745  if(hfe_flag==2){
3746  mcetype = 1016;
3747  }
3748  if(hfe_flag==1 && HaveBottomInHistory(pdgarray_ele)){
3749  mcetype = 1019;
3750  }
3751  }
3752 
3753  if(fDoEventMixing && !(fMixWithoutConversionFlag && isconv)){
3754  Double_t pv[3];
3755  pv[0] = fVtx1->GetX();
3756  pv[1] = fVtx1->GetY();
3757  pv[2] = fVtx1->GetZ();
3758  Double_t xyzR125[3]={9999.,9999.,9999.};
3759  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(trk,fBzkG,pv,xyzR125);
3760  TVector *varvec = new TVector(8);
3761  (*varvec)[0] = xyzR125[0];
3762  (*varvec)[1] = xyzR125[1];
3763  (*varvec)[2] = xyzR125[2];
3764  (*varvec)[3] = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kElectron);
3765  (*varvec)[4] = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kElectron);
3766  (*varvec)[5] = d0z0[0];
3767  (*varvec)[6] = (Int_t)isconv + 2*(Int_t)isconv_like;
3768  (*varvec)[7] = mcetype;
3769 
3770  Int_t nextRes( nextResVec[fPoolIndex] );
3771  m_ReservoirE[fPoolIndex][nextRes].push_back(new TLorentzVector(trk->Px(),trk->Py(),trk->Pz(),trk->Charge()));
3772  m_ReservoirVarsE[fPoolIndex][nextRes].push_back(varvec);
3773  }
3774 
3775  if(!fWriteEachVariableTree) return;
3776 
3777 
3778  //test propagation
3779 // cout<<"B: "<<fBzkG<<endl;
3780 // cout<<"trk: "<<trk->Charge()<<" "<<trk->Px()<<" "<<trk->Py()<<" "<<trk->Pz()<<endl;
3781 // AliExternalTrackParam etp;
3782 // etp.CopyFromVTrack(trk);
3783 // Double_t xyz_test[3]={-9999.,-9999.,-9999.};
3784 // etp.GetXYZ(xyz_test);
3785 // cout<<"Before: "<<xyz_test[0]<<" "<<xyz_test[1]<<" "<<xyz_test[2]<<endl;
3786 // etp.PropagateTo(80.,(Float_t)fBzkG);
3787 // etp.GetXYZ(xyz_test); // GetXYZ returns global coordinates
3788 // cout<<"After: "<<xyz_test[0]<<" "<<xyz_test[1]<<" "<<xyz_test[2]<<endl;
3789 
3790  for(Int_t i=0;i<26;i++){
3791  fCandidateEleVariables[i] = -9999.;
3792  }
3793  for(Int_t i=0;i<30;i++){
3794  fCandidateSingleVariables[i] = -9999.;
3795  }
3796  fCandidateSingleVariables[ 0] = trk->Px();
3797  fCandidateSingleVariables[ 1] = trk->Py();
3798  fCandidateSingleVariables[ 2] = trk->Pz();
3799  fCandidateSingleVariables[ 3] = trk->Charge();
3800  fCandidateSingleVariables[ 4] = -9999.;//not lambda
3806  if(fUseEventPlane==4){
3807  //Double_t evplane = GetEventPlaneForCandidate(trkpid,0,event->GetEventplane(),fQ,fQSub1,fQSub2); // remove autocorrelations
3808  //fCandidateSingleVariables[10] = evplane;
3810  }else{
3812  }
3813  fCandidateSingleVariables[11] = d0z0[0];
3814  fCandidateSingleVariables[12] = trk->GetID();
3815  if(fAnalCuts->GetIsUsePID())
3816  {
3817  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
3818  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
3819  Double_t nSigmaITSele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasITS(trk,AliPID::kElectron);
3820  fCandidateSingleVariables[13] = nSigmaTPCele;
3821  fCandidateSingleVariables[14] = nSigmaTOFele;
3822  fCandidateSingleVariables[15] = nSigmaITSele;
3823  }
3824  fCandidateSingleVariables[16] = pdgEle;
3825  fCandidateSingleVariables[17] = pdgarray_ele[0];
3826  fCandidateSingleVariables[18] = pdgarray_ele[1];
3827  fCandidateSingleVariables[19] = -9999;//mcinfo[0];
3828  fCandidateSingleVariables[20] = -9999;//mcinfo[1];
3829 
3830  fCandidateSingleVariables[21] = -9999;//trk->GetChi2TPCConstrainedVsGlobal(fVtx1);
3831  fCandidateSingleVariables[22] = (Float_t) ncls_its;
3832  fCandidateSingleVariables[23] = trk->GetITSchi2();
3833  fCandidateSingleVariables[24] = (Float_t)ncls_its_shared;
3834  fCandidateSingleVariables[25] = -9999.;//not used
3835  //26-30 not used
3836 
3837 // if(fUseMCInfo){
3838 // fCandidateSingleVariables[10] = pdgarray_ele[0];
3839 // fCandidateSingleVariables[14] = labelarray_ele[0];
3840 // fCandidateSingleVariables[15] = pdgarray_ele[1];
3841 // fCandidateSingleVariables[16] = labelarray_ele[1];
3842 // }
3843 
3844  fSingleVariablesTree->Fill();
3845 
3846 // fCandidateEleVariables[ 0] = trk->Px();
3847 // fCandidateEleVariables[ 1] = trk->Py();
3848 // fCandidateEleVariables[ 2] = trk->Pz();
3849 // fCandidateEleVariables[ 3] = trk->Chi2perNDF();
3850 // fCandidateEleVariables[ 4] = trk->GetITSNcls();
3851 // fCandidateEleVariables[ 5] = trk->GetTPCncls();
3852 // fCandidateEleVariables[ 6] = trk->GetTPCsignalN();
3853 // if(trk->GetTPCNclsF()>0)
3854 // fCandidateEleVariables[ 7] = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
3855 //
3856 // fCandidateEleVariables[ 8] = d0z0[0];
3857 // fCandidateEleVariables[ 9] = d0z0[1];
3858 // Int_t itsmap = trk->GetITSClusterMap();
3859 // Int_t bit1 = 1;
3860 // Int_t bit2 = 2;
3861 // Bool_t spdfirst = (itsmap & bit1) == bit1;
3862 // Bool_t spdsecond = (itsmap & bit2) == bit2;
3863 // fCandidateEleVariables[10] = ((Int_t)spdfirst) + 2 * ((Int_t)spdsecond);
3864 //
3865 // if(fAnalCuts->GetIsUsePID())
3866 // {
3867 // Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
3868 // Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
3869 // Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
3870 // Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
3871 // Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
3872 // fCandidateEleVariables[11] = nSigmaTPCele;
3873 // fCandidateEleVariables[12] = nSigmaTOFele;
3874 // fCandidateEleVariables[13] = nSigmaTPCpi_etrk;
3875 // fCandidateEleVariables[14] = nSigmaTPCka_etrk;
3876 // fCandidateEleVariables[15] = nSigmaTPCpr_etrk;
3877 // }
3878 // fCandidateEleVariables[16] = fEvNumberCounter;
3879 // fCandidateEleVariables[17] = trk->Charge();
3880 // fCandidateEleVariables[18] = pdgEle;
3881 // fCandidateEleVariables[19] = pdgEleMother;
3882 // fCandidateEleVariables[20] = mcelepx;
3883 // fCandidateEleVariables[21] = mcelepy;
3884 // fCandidateEleVariables[22] = mcelepz;
3885 // fCandidateEleVariables[23] = fCentrality;
3886 // fCandidateEleVariables[24] = fVtxZ;
3887 // fCandidateEleVariables[25] = fRunNumber;
3888 //
3889 // fHistod0Bach->Fill(d0z0[0]);
3890 //
3891 // fEleVariablesTree->Fill();
3892 }
3895 {
3896  //
3898  //
3899 
3900  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
3901  fV0VariablesTree = new TTree(nameoutput,"v0 variables tree");
3902  Int_t nVar = 36;
3904  TString * fCandidateVariableNames = new TString[nVar];
3905 
3906  fCandidateVariableNames[ 0]="V0Px";
3907  fCandidateVariableNames[ 1]="V0Py";
3908  fCandidateVariableNames[ 2]="V0Pz";
3909  fCandidateVariableNames[ 3]="MassLambda";
3910  fCandidateVariableNames[ 4]="MassAntiLambda";
3911  fCandidateVariableNames[ 5]="ProtonPx";
3912  fCandidateVariableNames[ 6]="ProtonPy";
3913  fCandidateVariableNames[ 7]="ProtonPz";
3914  fCandidateVariableNames[ 8]="PionPx";
3915  fCandidateVariableNames[ 9]="PionPy";
3916  fCandidateVariableNames[10]="PionPz";
3917  fCandidateVariableNames[11]="RfidV0";
3918  fCandidateVariableNames[12]="DcaV0PrToPrimVertex";
3919  fCandidateVariableNames[13]="DcaV0PiToPrimVertex";
3920  fCandidateVariableNames[14]="DcaV0daughters";
3921  fCandidateVariableNames[15]="V0CosPointingAngle";
3922  fCandidateVariableNames[16]="V0ProperDecayLength";
3923  fCandidateVariableNames[17]="MassK0Short";
3924  fCandidateVariableNames[18]="nSigmaTPCpr";
3925  fCandidateVariableNames[19]="nSigmaTPCpi";
3926  fCandidateVariableNames[20]="TPCNCrossV0Pr";
3927  fCandidateVariableNames[21]="TPCNCrossV0Pi";
3928  fCandidateVariableNames[22]="TPCNCrossRatioV0Pr";
3929  fCandidateVariableNames[23]="TPCNCrossRatioV0Pi";
3930  fCandidateVariableNames[24]="V0PdgCode";
3931  fCandidateVariableNames[25]="V0MotherPdgCode";
3932  fCandidateVariableNames[26]="mcv0px";
3933  fCandidateVariableNames[27]="mcv0py";
3934  fCandidateVariableNames[28]="mcv0pz";
3935  fCandidateVariableNames[29]="mcv0vertx";
3936  fCandidateVariableNames[30]="mcv0verty";
3937  fCandidateVariableNames[31]="mcv0vertz";
3938  fCandidateVariableNames[32]="EvNumber";
3939  fCandidateVariableNames[33]="Centrality";
3940  fCandidateVariableNames[34]="PrimVertZ";
3941  fCandidateVariableNames[35]="RunNumber";
3942 
3943  for (Int_t ivar=0; ivar<nVar; ivar++) {
3944  fV0VariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateV0Variables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3945  }
3946 
3947  return;
3948 }
3949 
3951 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillV0ROOTObjects(AliAODv0 *v0, AliAODEvent *event, TClonesArray *mcArray)
3952 {
3953  //
3955  //
3956  if(!v0) return;
3957  AliAODTrack *cptrack = (AliAODTrack*)(v0->GetDaughter(0));
3958  AliAODTrack *cntrack = (AliAODTrack*)(v0->GetDaughter(1));
3959  if(!cptrack) return;
3960  if(!cntrack) return;
3961 // if(cptrack->Charge()<0 && cntrack->Charge()>0){
3962 // cptrack = (AliAODTrack*)(v0->GetDaughter(1));
3963 // cntrack = (AliAODTrack*)(v0->GetDaughter(0));
3964 // }
3965  //test propagation
3966 // cout<<"B: "<<fBzkG<<endl;
3967 // cout<<"trk: "<<cptrack->Charge()<<" "<<v0->MomPosX()<<" "<<v0->MomPosY()<<" "<<v0->MomPosZ()<<endl;
3968 // cout<<"vert: "<<v0->DecayVertexV0X()<<" "<<v0->DecayVertexV0Y()<<" "<<v0->DecayVertexV0Z()<<endl;
3969 // AliExternalTrackParam etp;
3970 // etp.CopyFromVTrack(cptrack);
3971 // Double_t xyz_test[3]={-9999.,-9999.,-9999.};
3972 // etp.PropagateTo(10.,(Float_t)fBzkG);
3973 // etp.GetXYZ(xyz_test); // GetXYZ returns global coordinates
3974 // cout<<"10: "<<xyz_test[0]<<" "<<xyz_test[1]<<" "<<xyz_test[2]<<endl;
3975 // etp.PropagateTo(120.,(Float_t)fBzkG);
3976 // etp.GetXYZ(xyz_test); // GetXYZ returns global coordinates
3977 // cout<<"120: "<<xyz_test[0]<<" "<<xyz_test[1]<<" "<<xyz_test[2]<<endl;
3978 
3979  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
3980  Double_t posVtx[3] = {0.,0.,0.};
3981  fVtx1->GetXYZ(posVtx);
3982  Double_t ptotlam = TMath::Sqrt(pow(v0->Px(),2)+pow(v0->Py(),2)+pow(v0->Pz(),2));
3983  Double_t v0propdl = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
3984  Double_t cont_arm[3];
3985  cont_arm[0] = v0->Pt();
3986  cont_arm[1] = v0->PtArmV0();
3987  cont_arm[2] = v0->AlphaV0();
3988 
3989  if(TMath::Abs(v0->MassLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
3990  fHistoLambdaMassvsPt->Fill(v0->MassLambda(),v0->Pt());
3991  }
3992  if(TMath::Abs(v0->MassAntiLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
3993  fHistoLambdaMassvsPt->Fill(v0->MassAntiLambda(),v0->Pt());
3994  }
3995  fHistoK0sMassvsPt->Fill(v0->MassK0Short(),v0->Pt());
3996 
3997  if(fAnalCuts->IsPeakRegion(v0)){
3998  fHistoLambdaPtvsDl->Fill(v0->Pt(),v0propdl);
3999  fHistoLambdaPtvsEta->Fill(v0->Pt(),v0->Eta());
4000  fHistoLambdaArmenteros->Fill(cont_arm);
4001  }
4002  if(fAnalCuts->IsSideBand(v0)){
4003  fHistoLambdaPtvsDlSide->Fill(v0->Pt(),v0propdl);
4004  }
4005 
4006  Double_t momv0x = v0->MomV0X();
4007  Double_t momv0y = v0->MomV0Y();
4008  Double_t phi_alice = atan2(momv0y,momv0x);
4009  if(phi_alice<0.) phi_alice += 2 * M_PI;
4010  fHistoLambdaQovPtvsPhi->Fill(phi_alice,1./sqrt(momv0x*momv0x+momv0y*momv0y));
4011 
4012  if(fDoEventMixing){
4013  Int_t nextRes( nextResVec[fPoolIndex] );
4014  Double_t posVtx[3] = {0.,0.,0.};
4015  fVtx1->GetXYZ(posVtx);
4016  TLorentzVector *lv = new TLorentzVector();
4017  Double_t ptotlam = TMath::Sqrt(pow(v0->Px(),2)+pow(v0->Py(),2)+pow(v0->Pz(),2));
4018  Double_t xyzR125pr[3] = {9999.,9999.,9999.};
4019  Double_t xyzR125pi[3] = {9999.,9999.,9999.};
4020  if(TMath::Abs(v0->MassLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
4021  lv->SetXYZM(v0->Px(),v0->Py(),v0->Pz(),v0->MassLambda());
4022  m_ReservoirL1[fPoolIndex][nextRes].push_back(lv);
4023  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(cptrack,fBzkG,posVtx,xyzR125pr);
4024  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(cntrack,fBzkG,posVtx,xyzR125pi);
4025  TVector *varvec = new TVector(17);
4026  (*varvec)[0] = xyzR125pr[0];
4027  (*varvec)[1] = xyzR125pr[1];
4028  (*varvec)[2] = xyzR125pr[2];
4029  (*varvec)[3] = xyzR125pi[0];
4030  (*varvec)[4] = xyzR125pi[1];
4031  (*varvec)[5] = xyzR125pi[2];
4032  (*varvec)[6] = v0->DecayVertexV0X();
4033  (*varvec)[7] = v0->DecayVertexV0Y();
4034  (*varvec)[8] = v0->DecayVertexV0Z();
4035  (*varvec)[9] = v0->MomPosX();
4036  (*varvec)[10] = v0->MomPosY();
4037  (*varvec)[11] = v0->MomPosZ();
4038  (*varvec)[12] = v0->MomNegX();
4039  (*varvec)[13] = v0->MomNegY();
4040  (*varvec)[14] = v0->MomNegZ();
4041  (*varvec)[15] = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
4042  (*varvec)[16] = v0->DcaV0ToPrimVertex();
4043  m_ReservoirVarsL1[fPoolIndex][nextRes].push_back(varvec);
4044  }else{
4045  lv->SetXYZM(v0->Px(),v0->Py(),v0->Pz(),v0->MassAntiLambda());
4046  m_ReservoirL2[fPoolIndex][nextRes].push_back(lv);
4047  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(cntrack,fBzkG,posVtx,xyzR125pr);
4048  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(cptrack,fBzkG,posVtx,xyzR125pi);
4049  TVector *varvec = new TVector(17);
4050  (*varvec)[0] = xyzR125pr[0];
4051  (*varvec)[1] = xyzR125pr[1];
4052  (*varvec)[2] = xyzR125pr[2];
4053  (*varvec)[3] = xyzR125pi[0];
4054  (*varvec)[4] = xyzR125pi[1];
4055  (*varvec)[5] = xyzR125pi[2];
4056  (*varvec)[6] = v0->DecayVertexV0X();
4057  (*varvec)[7] = v0->DecayVertexV0Y();
4058  (*varvec)[8] = v0->DecayVertexV0Z();
4059  (*varvec)[9] = v0->MomNegX();
4060  (*varvec)[10] = v0->MomNegY();
4061  (*varvec)[11] = v0->MomNegZ();
4062  (*varvec)[12] = v0->MomPosX();
4063  (*varvec)[13] = v0->MomPosY();
4064  (*varvec)[14] = v0->MomPosZ();
4065  (*varvec)[15] = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
4066  (*varvec)[16] = v0->DcaV0ToPrimVertex();
4067  m_ReservoirVarsL2[fPoolIndex][nextRes].push_back(varvec);
4068  }
4069  }
4070 
4071  if(!fWriteEachVariableTree) return;
4072 
4073  Int_t v0pdgcode = -9999;
4074  Int_t v0motherpdgcode = -9999;
4075  Float_t mcv0px = -9999;
4076  Float_t mcv0py = -9999;
4077  Float_t mcv0pz = -9999;
4078  Float_t mcv0vertx = -9999;
4079  Float_t mcv0verty = -9999;
4080  Float_t mcv0vertz = -9999;
4081  Int_t pdgarray_v0[100], labelarray_v0[100], ngen_v0;//for write eavh variables tree
4082  if(fUseMCInfo)
4083  {
4084  Int_t pdgdgv0[2]={2212,211};
4085  Int_t labV0 = v0->MatchToMC(3122,mcArray,2,pdgdgv0); // the V0
4086  if(labV0>=0){
4087  if(TMath::Abs(v0->MassLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
4088  fHistoLambdaMassvsPtMCS->Fill(v0->MassLambda(),v0->Pt());
4089  }
4090  if(TMath::Abs(v0->MassAntiLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
4091  fHistoLambdaMassvsPtMCS->Fill(v0->MassAntiLambda(),v0->Pt());
4092  }
4093  if(fAnalCuts->IsPeakRegion(v0)){
4094  fHistoLambdaPtvsEtaMCS->Fill(v0->Pt(),v0->Eta());
4095  fHistoLambdaArmenterosMCS->Fill(cont_arm);
4096  }
4097 
4098  AliAODMCParticle *mcv0trk = (AliAODMCParticle*)mcArray->At(labV0);
4099  if(mcv0trk){
4100  mcv0px = mcv0trk->Px();
4101  mcv0py = mcv0trk->Py();
4102  mcv0pz = mcv0trk->Pz();
4103 
4104  Int_t labptrk = cptrack->GetLabel();
4105  if(labptrk>=0){
4106  AliAODMCParticle *mcv0ptrk = (AliAODMCParticle*)mcArray->At(labptrk);
4107  if(mcv0ptrk){
4108  mcv0vertx = mcv0ptrk->Xv();
4109  mcv0verty = mcv0ptrk->Yv();
4110  mcv0vertz = mcv0ptrk->Zv();
4111  }
4112  }
4113 
4114  GetMCDecayHistory(mcv0trk,mcArray,pdgarray_v0,labelarray_v0,ngen_v0);
4115 
4116  Bool_t hfv0_flag = kFALSE;
4117  Bool_t promptv0_flag = kFALSE;
4118  v0pdgcode = mcv0trk->GetPdgCode();
4119  Int_t labv0mother = mcv0trk->GetMother();
4120  if(labv0mother>=0){
4121  AliAODMCParticle *motherv0 = (AliAODMCParticle*)mcArray->At(labv0mother);
4122  if(motherv0){
4123  v0motherpdgcode = motherv0->GetPdgCode();
4124  if(abs(v0motherpdgcode)>4000&&abs(v0motherpdgcode)<4400){
4125  hfv0_flag = kTRUE;
4126  }
4127  if(abs(v0motherpdgcode)==3322){
4128  fHistoLambdaPtvsDlFeeddownXi0MCS->Fill(v0->Pt(),v0propdl);
4129  }else if(abs(v0motherpdgcode)==3312){
4130  fHistoLambdaPtvsDlFeeddownXiMinusMCS->Fill(v0->Pt(),v0propdl);
4131  }else if(abs(v0motherpdgcode)==3334){
4132  fHistoLambdaPtvsDlFeeddownOmegaMCS->Fill(v0->Pt(),v0propdl);
4133  }else{
4134  fHistoLambdaPtvsDlMCS->Fill(v0->Pt(),v0propdl);
4135  promptv0_flag = kTRUE;
4136  }
4137  }
4138  //if(!hfv0_flag) return;
4139  //if(!promptv0_flag) return;
4140  }
4141 
4142  }else{
4143  for(Int_t i=0;i<100;i++){
4144  pdgarray_v0[i] = -9999;
4145  labelarray_v0[i] = -9999;
4146  }
4147  ngen_v0 = -9999;
4148  }
4149  }
4150  }
4151 
4152  for(Int_t i=0;i<36;i++){
4153  fCandidateV0Variables[i] = -9999.;
4154  }
4155 
4156  for(Int_t i=0;i<30;i++){
4157  fCandidateSingleVariables[i] = -9999.;
4158  }
4159 
4160  Bool_t isparticle = kFALSE;
4161  if(TMath::Abs(v0->MassLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()){
4162  isparticle = kTRUE;
4163  }
4164 
4165  fCandidateSingleVariables[ 0] = v0->Px();
4166  fCandidateSingleVariables[ 1] = v0->Py();
4167  fCandidateSingleVariables[ 2] = v0->Pz();
4168  if(isparticle){
4169  fCandidateSingleVariables[ 3] = 1.;
4170  fCandidateSingleVariables[ 4] = v0->MassLambda();
4171  }else{
4172  fCandidateSingleVariables[ 3] = -1.;
4173  fCandidateSingleVariables[ 4] = v0->MassAntiLambda();
4174  }
4180  if(fUseEventPlane==4){
4181  //Double_t evplane = GetEventPlaneForCandidate(0,v0,event->GetEventplane(),fQ,fQSub1,fQSub2); // remove autocorrelations
4182  //fCandidateSingleVariables[10] = evplane;
4184 
4185  }else{
4187  }
4188  fCandidateSingleVariables[11] = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
4189  fCandidateSingleVariables[12] = cptrack->GetID();
4190  fCandidateSingleVariables[13] = cntrack->GetID();
4191  fCandidateSingleVariables[14] = v0->DcaV0ToPrimVertex();
4192  fCandidateSingleVariables[15] = v0->DcaV0Daughters();
4193 
4194  fCandidateSingleVariables[16] = v0pdgcode;
4195  fCandidateSingleVariables[17] = pdgarray_v0[0];
4196  fCandidateSingleVariables[18] = pdgarray_v0[1];
4197  fCandidateSingleVariables[19] = -9999;//mcinfo[0];
4198  fCandidateSingleVariables[20] = -9999;//mcinfo[1];
4199 
4200  fCandidateSingleVariables[21] = v0->DcaPosToPrimVertex();
4201  fCandidateSingleVariables[22] = v0->DcaNegToPrimVertex();
4202  fCandidateSingleVariables[23] = v0->CosPointingAngle(posVtx);
4203 // Float_t fracsharedpostpc = -9999;
4204 // if(cptrack->GetTPCNcls()>0) fracsharedpostpc = (Float_t)cptrack->GetTPCnclsS()/(Float_t)cptrack->GetTPCncls();
4205 // Float_t fracsharednegtpc = -9999;
4206 // if(cntrack->GetTPCNcls()>0) fracsharednegtpc = (Float_t)cntrack->GetTPCnclsS()/(Float_t)cntrack->GetTPCncls();
4207 // fCandidateSingleVariables[24] = fracsharedpostpc;
4208 // fCandidateSingleVariables[25] = fracsharednegtpc;
4209 
4210  fCandidateSingleVariables[24] = v0->PtArmV0();
4211  fCandidateSingleVariables[25] = v0->AlphaV0();
4212 
4213  if(fAnalCuts->GetUseLambdaPID())
4214  {
4215  if(isparticle){
4216  fCandidateSingleVariables[26] = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
4217  fCandidateSingleVariables[27] = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
4218  fCandidateSingleVariables[28] = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
4219  fCandidateSingleVariables[29] = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
4220  }else{
4221  fCandidateSingleVariables[26] = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
4222  fCandidateSingleVariables[27] = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
4223  fCandidateSingleVariables[28] = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
4224  fCandidateSingleVariables[29] = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
4225  }
4226  }
4227 
4228 // if(fUseMCInfo){
4229 // fCandidateSingleVariables[10] = pdgarray_v0[0];
4230 // fCandidateSingleVariables[14] = labelarray_v0[0];
4231 // fCandidateSingleVariables[15] = pdgarray_v0[1];
4232 // fCandidateSingleVariables[16] = labelarray_v0[1];
4233 // }
4234 
4235  fSingleVariablesTree->Fill();
4236 // fCandidateV0Variables[ 0] = v0->Px();
4237 // fCandidateV0Variables[ 1] = v0->Py();
4238 // fCandidateV0Variables[ 2] = v0->Pz();
4239 // fCandidateV0Variables[ 3] = v0->MassLambda();
4240 // fCandidateV0Variables[ 4] = v0->MassAntiLambda();
4241 //
4242 // Bool_t isparticle = kTRUE;
4243 // if(fabs(v0->MassAntiLambda()-mlamPDG)<fAnalCuts->GetProdV0MassTolLambdaRough()) isparticle=kFALSE;
4244 //
4245 // if(isparticle){
4246 // fCandidateV0Variables[ 5] = v0->MomPosX(); //cptrack->Px();
4247 // fCandidateV0Variables[ 6] = v0->MomPosY(); //cptrack->Py();
4248 // fCandidateV0Variables[ 7] = v0->MomPosZ(); //cptrack->Pz();
4249 // fCandidateV0Variables[ 8] = v0->MomNegX(); //cntrack->Px();
4250 // fCandidateV0Variables[ 9] = v0->MomNegY(); //cntrack->Py();
4251 // fCandidateV0Variables[10] = v0->MomNegZ(); //cntrack->Pz();
4252 // }else{
4253 // fCandidateV0Variables[ 5] = v0->MomNegX(); //cntrack->Px();
4254 // fCandidateV0Variables[ 6] = v0->MomNegY(); //cntrack->Py();
4255 // fCandidateV0Variables[ 7] = v0->MomNegZ(); //cntrack->Pz();
4256 // fCandidateV0Variables[ 8] = v0->MomPosX(); //cptrack->Px();
4257 // fCandidateV0Variables[ 9] = v0->MomPosY(); //cptrack->Py();
4258 // fCandidateV0Variables[10] = v0->MomPosZ(); //cptrack->Pz();
4259 // }
4260 //
4261 // Double_t lPosV0[3];
4262 // lPosV0[0] = v0->DecayVertexV0X();
4263 // lPosV0[1] = v0->DecayVertexV0Y();
4264 // lPosV0[2] = v0->DecayVertexV0Z();
4265 // Double_t decayvertV0 = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
4266 // fCandidateV0Variables[11] = decayvertV0;
4267 //
4268 // Double_t lDcaPosToPrimVertex = v0->DcaPosToPrimVertex();
4269 // Double_t lDcaNegToPrimVertex = v0->DcaNegToPrimVertex();
4270 // if(isparticle){
4271 // fCandidateV0Variables[12] = lDcaPosToPrimVertex;
4272 // fCandidateV0Variables[13] = lDcaNegToPrimVertex;
4273 // }else{
4274 // fCandidateV0Variables[12] = lDcaNegToPrimVertex;
4275 // fCandidateV0Variables[13] = lDcaPosToPrimVertex;
4276 // }
4277 // fCandidateV0Variables[14] = v0->DcaV0Daughters();
4278 // fCandidateV0Variables[15] = v0->CosPointingAngle(posVtx);
4279 // fCandidateV0Variables[16] = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
4280 // fCandidateV0Variables[17] = v0->MassK0Short();
4281 //
4282 // if(fAnalCuts->GetUseLambdaPID())
4283 // {
4284 // if(isparticle){
4285 // Double_t nSigmaTPCv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
4286 // Double_t nSigmaTPCv0pi = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
4287 // fCandidateV0Variables[18] = nSigmaTPCv0pr;
4288 // fCandidateV0Variables[19] = nSigmaTPCv0pi;
4289 // }else{
4290 // Double_t nSigmaTPCv0pr = fAnalCuts->GetPidProton()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
4291 // Double_t nSigmaTPCv0pi = fAnalCuts->GetPidPion()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
4292 // fCandidateV0Variables[18] = nSigmaTPCv0pr;
4293 // fCandidateV0Variables[19] = nSigmaTPCv0pi;
4294 // }
4295 // }
4296 // if(isparticle){
4297 // fCandidateV0Variables[20] = cptrack->GetTPCClusterInfo(2,1);
4298 // fCandidateV0Variables[21] = cntrack->GetTPCClusterInfo(2,1);
4299 // if(cptrack->GetTPCNclsF()>0)
4300 // fCandidateV0Variables[22] = (Float_t) cptrack->GetTPCClusterInfo(2,1)/(Float_t)cptrack->GetTPCNclsF();
4301 // if(cntrack->GetTPCNclsF()>0)
4302 // fCandidateV0Variables[23] =(Float_t) cntrack->GetTPCClusterInfo(2,1)/(Float_t)cntrack->GetTPCNclsF();
4303 // }else{
4304 // fCandidateV0Variables[20] = cntrack->GetTPCClusterInfo(2,1);
4305 // fCandidateV0Variables[21] = cptrack->GetTPCClusterInfo(2,1);
4306 // if(cntrack->GetTPCNclsF()>0)
4307 // fCandidateV0Variables[22] = (Float_t) cntrack->GetTPCClusterInfo(2,1)/(Float_t)cntrack->GetTPCNclsF();
4308 // if(cptrack->GetTPCNclsF()>0)
4309 // fCandidateV0Variables[23] = (Float_t) cptrack->GetTPCClusterInfo(2,1)/(Float_t)cptrack->GetTPCNclsF();
4310 // }
4311 // fCandidateV0Variables[24] = v0pdgcode;
4312 // fCandidateV0Variables[25] = v0motherpdgcode;
4313 // fCandidateV0Variables[26] = mcv0px;
4314 // fCandidateV0Variables[27] = mcv0py;
4315 // fCandidateV0Variables[28] = mcv0pz;
4316 // fCandidateV0Variables[29] = mcv0vertx;
4317 // fCandidateV0Variables[30] = mcv0verty;
4318 // fCandidateV0Variables[31] = mcv0vertz;
4319 // fCandidateV0Variables[32] = fEvNumberCounter;
4320 // fCandidateV0Variables[33] = fCentrality;
4321 // fCandidateV0Variables[34] = fVtxZ;
4322 // fCandidateV0Variables[35] = fRunNumber;
4323 //
4324 //
4325 // fV0VariablesTree->Fill();
4326 }
4329 {
4333 
4334  const char* nameoutput = GetOutputSlot(7)->GetContainer()->GetName();
4335  fMCVariablesTree = new TTree(nameoutput,"MC variables tree");
4336  Int_t nVar = 11;
4338  TString * fCandidateVariableNames = new TString[nVar];
4339 
4340  fCandidateVariableNames[ 0]="Centrality";
4341  fCandidateVariableNames[ 1]="DecayType";
4342  fCandidateVariableNames[ 2]="LcPx";
4343  fCandidateVariableNames[ 3]="LcPy";
4344  fCandidateVariableNames[ 4]="LcPz";
4345  fCandidateVariableNames[ 5]="ElePx";
4346  fCandidateVariableNames[ 6]="ElePy";
4347  fCandidateVariableNames[ 7]="ElePz";
4348  fCandidateVariableNames[ 8]="V0Px";
4349  fCandidateVariableNames[ 9]="V0Py";
4350  fCandidateVariableNames[10]="V0Pz";
4351 
4352  for (Int_t ivar=0; ivar<nVar; ivar++) {
4353  fMCVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
4354  }
4355  return;
4356 }
4358 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillMCROOTObjects(AliAODMCParticle *mcpart, AliAODMCParticle *mcepart, AliAODMCParticle *mcv0part, Int_t decaytype)
4359 {
4360  //
4362  //
4363  if(!mcpart) return;
4364  if(!mcepart) return;
4365  if(!mcv0part) return;
4366 
4367  for(Int_t i=0;i<11;i++){
4368  fCandidateMCVariables[i] = -9999.;
4369  }
4370 
4372  fCandidateMCVariables[ 1] = (Float_t) decaytype;
4373  fCandidateMCVariables[ 2] = mcpart->Px();
4374  fCandidateMCVariables[ 3] = mcpart->Py();
4375  fCandidateMCVariables[ 4] = mcpart->Pz();
4376  fCandidateMCVariables[ 5] = mcepart->Px();
4377  fCandidateMCVariables[ 6] = mcepart->Py();
4378  fCandidateMCVariables[ 7] = mcepart->Pz();
4379  fCandidateMCVariables[ 8] = mcv0part->Px();
4380  fCandidateMCVariables[ 9] = mcv0part->Py();
4381  fCandidateMCVariables[10] = mcv0part->Pz();
4382 
4383  Double_t epx = mcepart->Px();
4384  Double_t epy = mcepart->Py();
4385  Double_t epz = mcepart->Pz();
4386  Double_t eE = sqrt(epx*epx+epy*epy+epz*epz+0.000511*0.000511);
4387  Double_t v0px = mcv0part->Px();
4388  Double_t v0py = mcv0part->Py();
4389  Double_t v0pz = mcv0part->Pz();
4390  Double_t v0E = sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz+1.1157*1.1157);
4391 
4392  Double_t InvMassEleLambda = sqrt(pow(eE+v0E,2)-pow(epx+v0px,2)-pow(epy+v0py,2)-pow(epz+v0pz,2));
4393 
4394  Double_t cont[3];
4395  cont[0] = InvMassEleLambda;
4396  cont[1] = mcpart->Pt();
4397  cont[2] = fCentrality;
4398  Double_t cont2[3];
4399  cont2[0] = InvMassEleLambda;
4400  cont2[1] = mcepart->Pt();
4401  cont2[2] = fCentrality;
4402  Double_t cont_eleptvseta[3];
4403  cont_eleptvseta[0] = mcepart->Pt();
4404  cont_eleptvseta[1] = mcepart->Eta();
4405  cont_eleptvseta[2] = fCentrality;
4406  Double_t cont_eleptvslambdapt[3];
4407  cont_eleptvslambdapt[0] = mcepart->Pt();
4408  cont_eleptvslambdapt[1] = mcv0part->Pt();
4409  cont_eleptvslambdapt[2] = fCentrality;
4410  Double_t cont_eleptvslambdaptvslcpt[4];
4411  cont_eleptvslambdaptvslcpt[0] = mcepart->Pt();
4412  cont_eleptvslambdaptvslcpt[1] = mcv0part->Pt();
4413  cont_eleptvslambdaptvslcpt[2] = mcpart->Pt();
4414  cont_eleptvslambdaptvslcpt[3] = fCentrality;
4415  Double_t contmc[3];
4416  contmc[0] = mcpart->Pt();
4417  contmc[1] = mcpart->Y();
4418  contmc[2] = fCentrality;
4419  Double_t contmcele[3];
4420  contmcele[0] = mcepart->Pt();
4421  contmcele[1] = mcepart->Eta();
4422  contmcele[2] = fCentrality;
4423  Double_t contmc_withele[3];
4424  contmc_withele[0] = mcpart->Pt();
4425  contmc_withele[1] = mcpart->Y();
4426  contmc_withele[2] = mcepart->Y();
4427 
4428  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
4430  esdcuts->GetEtaRange(etamin,etamax);
4431 
4432  if(decaytype==0){
4433  fHistoLcMCGen->Fill(contmc);
4434  if(mcpart->GetPdgCode()>0) fHistoLcMCGen1->Fill(contmc);
4435  if(mcpart->GetPdgCode()<0) fHistoLcMCGen2->Fill(contmc);
4436  fHistoLcMCGenWithEleA->Fill(contmc_withele);
4437  if(fabs(mcepart->Eta())<0.8){
4438  fHistoLcMCGenWithEleB->Fill(mcpart->Pt(),mcepart->Pt());
4439  }
4440  fHistoLcElectronMCGen->Fill(contmcele);
4441  if(mcepart->GetPdgCode()<0) fHistoLcElectronMCGen1->Fill(contmcele);
4442  if(mcepart->GetPdgCode()>0) fHistoLcElectronMCGen2->Fill(contmcele);
4443  fHistoEleLambdaMassMCGen->Fill(cont);
4444  if(fabs(mcepart->Eta())<etamax){
4445  fHistoEleLambdaMassvsElePtMCGen->Fill(cont2);
4446  if(mcepart->GetPdgCode()<0) fHistoEleLambdaMassvsElePtMCGen1->Fill(cont2);
4447  else fHistoEleLambdaMassvsElePtMCGen2->Fill(cont2);
4448  if(InvMassEleLambda<fAnalCuts->GetEleLambdaMassMax()){
4449  fHistoElePtMCGen->Fill(mcepart->Pt(),fCentrality);
4450  fHistoElePtvsEtaMCGen->Fill(cont_eleptvseta);
4451  fHistoElePtvsLambdaPtMCGen->Fill(cont_eleptvslambdapt);
4452  }
4453  }
4454  if(fabs(mcpart->Y())<0.7){
4455  if(InvMassEleLambda<fAnalCuts->GetEleLambdaMassMax()){
4456  fHistoElePtvsLambdaPtMCLcGen->Fill(cont_eleptvslambdapt);
4457  fHistoElePtvsLambdaPtvsLcPtMCGen->Fill(cont_eleptvslambdaptvslcpt);
4458  }
4459  }
4460  }else if(decaytype==1){
4461  fHistoFeedDownXic0MCGen->Fill(contmc);
4462  if(mcpart->GetPdgCode()>0) fHistoFeedDownXic0MCGen1->Fill(contmc);
4463  if(mcpart->GetPdgCode()<0) fHistoFeedDownXic0MCGen2->Fill(contmc);
4465  fHistoElectronFeedDownXic0MCGen->Fill(contmcele);
4466  if(mcepart->GetPdgCode()<0) fHistoElectronFeedDownXic0MCGen1->Fill(contmcele);
4467  if(mcepart->GetPdgCode()>0) fHistoElectronFeedDownXic0MCGen2->Fill(contmcele);
4468  if(fabs(mcepart->Eta())<etamax){
4470  if(mcepart->GetPdgCode()<0) fHistoEleLambdaMassvsElePtFeeddownXic0MCGen1->Fill(cont2);
4472  if(InvMassEleLambda<fAnalCuts->GetEleLambdaMassMax()){
4473  fHistoElePtFeeddownXic0MCGen->Fill(mcepart->Pt(),fCentrality);
4474  fHistoElePtvsEtaFeeddownXic0MCGen->Fill(cont_eleptvseta);
4475  fHistoElePtvsLambdaPtFeeddownXic0MCGen->Fill(cont_eleptvslambdapt);
4476  }
4477  }
4478  }else if(decaytype==2){
4479  fHistoFeedDownXicPlusMCGen->Fill(contmc);
4480  if(mcpart->GetPdgCode()>0) fHistoFeedDownXicPlusMCGen1->Fill(contmc);
4481  if(mcpart->GetPdgCode()<0) fHistoFeedDownXicPlusMCGen2->Fill(contmc);
4483  fHistoElectronFeedDownXicPlusMCGen->Fill(contmcele);
4484  if(mcepart->GetPdgCode()<0) fHistoElectronFeedDownXicPlusMCGen1->Fill(contmcele);
4485  if(mcepart->GetPdgCode()>0) fHistoElectronFeedDownXicPlusMCGen2->Fill(contmcele);
4486  if(fabs(mcepart->Eta())<etamax){
4488  if(mcepart->GetPdgCode()<0) fHistoEleLambdaMassvsElePtFeeddownXicPlusMCGen1->Fill(cont2);
4490  if(InvMassEleLambda<fAnalCuts->GetEleLambdaMassMax()){
4491  fHistoElePtFeeddownXicPlusMCGen->Fill(mcepart->Pt(),fCentrality);
4492  fHistoElePtvsEtaFeeddownXicPlusMCGen->Fill(cont_eleptvseta);
4493  fHistoElePtvsLambdaPtFeeddownXicPlusMCGen->Fill(cont_eleptvslambdapt);
4494  }
4495  }
4496  }else if(decaytype==3){
4497  fHistoFeedDownSigmaMCGen->Fill(contmc);
4498  if(mcpart->GetPdgCode()>0) fHistoFeedDownSigmaMCGen1->Fill(contmc);
4499  if(mcpart->GetPdgCode()<0) fHistoFeedDownSigmaMCGen2->Fill(contmc);
4500  }else if(decaytype==10){
4501  fHistoLbElectronMCGen->Fill(contmcele);
4502  if(mcepart->GetPdgCode()<0) fHistoLbElectronMCGen1->Fill(contmcele);
4503  if(mcepart->GetPdgCode()>0) fHistoLbElectronMCGen2->Fill(contmcele);
4504  fHistoLbMCGen->Fill(contmc);
4505  if(mcpart->GetPdgCode()>0) fHistoLbMCGen1->Fill(contmc);
4506  if(mcpart->GetPdgCode()<0) fHistoLbMCGen2->Fill(contmc);
4507 
4508  fHistoLcMCGenWithEleA->Fill(contmc_withele);
4509  if(fabs(mcepart->Eta())<0.8){
4510  fHistoLcMCGenWithEleB->Fill(mcpart->Pt(),mcepart->Pt());
4511  }
4512  }else if(decaytype==11){
4513  fHistoElectronFeedDownXibMCGen->Fill(contmcele);
4514  if(mcepart->GetPdgCode()<0) fHistoElectronFeedDownXibMCGen1->Fill(contmcele);
4515  if(mcepart->GetPdgCode()>0) fHistoElectronFeedDownXibMCGen2->Fill(contmcele);
4516  }
4517 
4519  fMCVariablesTree->Fill();
4520 }
4523 {
4524  //
4525  // Define electron tree variables
4526  //
4527 
4528  const char* nameoutput = GetOutputSlot(9)->GetContainer()->GetName();
4529  fMCEleVariablesTree = new TTree(nameoutput,"MC Ele variables tree");
4530  Int_t nVar = 8;
4532  TString * fCandidateVariableNames = new TString[nVar];
4533 
4534  fCandidateVariableNames[ 0]="Centrality";
4535  fCandidateVariableNames[ 1]="ElePx";
4536  fCandidateVariableNames[ 2]="ElePy";
4537  fCandidateVariableNames[ 3]="ElePz";
4538  fCandidateVariableNames[ 4]="ElePdgCode";
4539  fCandidateVariableNames[ 5]="EleMotherPdgCode";
4540  fCandidateVariableNames[ 6]="RunNumber";
4541  fCandidateVariableNames[ 7]="EvNumber";
4542 
4543  for (Int_t ivar=0; ivar<nVar; ivar++) {
4544  fMCEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
4545  }
4546  return;
4547 }
4549 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
4550 {
4551  //
4552  // Fill tree depending on fWriteMCVariableTree
4553  //
4554  if(!mcepart) return;
4555 
4556  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;
4557  GetMCDecayHistory(mcepart,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
4558  Bool_t ele_from_bottom = HaveBottomInHistory(pdgarray_ele);
4559  Bool_t ele_from_charm = HaveCharmInHistory(pdgarray_ele);
4560  //Int_t semi_flag = FromSemileptonicDecays(pdgarray_ele);
4561  Int_t semi_flag = 0;
4562  if(pdgarray_ele[0]>400&&pdgarray_ele[0]<450) semi_flag = 1;
4563  if(pdgarray_ele[0]>4000&&pdgarray_ele[0]<4500) semi_flag = 1;
4564  if(pdgarray_ele[0]>500&&pdgarray_ele[0]<550) semi_flag = 2;
4565  if(pdgarray_ele[0]>5000&&pdgarray_ele[0]<5500) semi_flag = 2;
4566 
4567  Double_t contmc[3];
4568  contmc[0] = mcepart->Pt();
4569  contmc[1] = mcepart->Eta();
4570  contmc[2] = fCentrality;
4571 
4572  if(semi_flag==1 && !ele_from_bottom){
4573  fHistoCharmElectronMCGen->Fill(contmc);
4574  }
4575  if(semi_flag==1 && ele_from_bottom){
4576  fHistoBottomElectronMCGen->Fill(contmc);
4577  }
4578  if(semi_flag==2 ){
4579  fHistoBottomElectronMCGen->Fill(contmc);
4580  }
4581 
4582  Bool_t hfe_flag = kFALSE;
4583  Int_t labemother = mcepart->GetMother();
4584  Int_t pdgmotherele = -9999;
4585  if(labemother>=0){
4586  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
4587  pdgmotherele = motherele->GetPdgCode();
4588  if(abs(pdgmotherele)>4000&&abs(pdgmotherele)<4400){
4589  hfe_flag = kTRUE;
4590  }
4591  }
4592 
4593  if(!hfe_flag) return;
4594 
4595  fHistoElectronMCGen->Fill(contmc);
4596 
4597  for(Int_t i=0;i<8;i++){
4598  fCandidateMCEleVariables[i] = -9999.;
4599  }
4600 
4602  fCandidateMCEleVariables[ 1] = mcepart->Px();
4603  fCandidateMCEleVariables[ 2] = mcepart->Py();
4604  fCandidateMCEleVariables[ 3] = mcepart->Pz();
4605  fCandidateMCEleVariables[ 4] = mcepart->GetPdgCode();
4606  fCandidateMCEleVariables[ 5] = pdgmotherele;
4609 
4610 // if(fWriteMCVariableTree && fWriteEachVariableTree && mcepart->Pt()>0.4 && fabs(mcepart->Eta())<1.0 )
4611 // fMCEleVariablesTree->Fill();
4612 
4613 }
4616 {
4617  //
4618  // Define Mc v0 tree variables
4619  //
4620 
4621  const char* nameoutput = GetOutputSlot(10)->GetContainer()->GetName();
4622  fMCV0VariablesTree = new TTree(nameoutput,"MC v0 variables tree");
4623  Int_t nVar = 8;
4625  TString * fCandidateVariableNames = new TString[nVar];
4626 
4627  fCandidateVariableNames[ 0]="Centrality";
4628  fCandidateVariableNames[ 1]="V0Px";
4629  fCandidateVariableNames[ 2]="V0Py";
4630  fCandidateVariableNames[ 3]="V0Pz";
4631  fCandidateVariableNames[ 4]="V0PdgCode";
4632  fCandidateVariableNames[ 5]="V0MotherPdgCode";
4633  fCandidateVariableNames[ 6]="RunNumber";
4634  fCandidateVariableNames[ 7]="EvNumber";
4635 
4636  for (Int_t ivar=0; ivar<nVar; ivar++) {
4637  fMCV0VariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCV0Variables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
4638  }
4639  return;
4640 }
4642 void AliAnalysisTaskSELc2eleLambdafromAODtracks::FillMCV0ROOTObjects(AliAODMCParticle *mcv0part, TClonesArray *mcArray)
4643 {
4644  //
4645  // Fill histograms or tree depending on fWriteMCVariableTree
4646  //
4647  if(!mcv0part) return;
4648 
4649  for(Int_t i=0;i<8;i++){
4650  fCandidateMCV0Variables[i] = -9999.;
4651  }
4652 
4653  Bool_t hfv0_flag = kFALSE;
4654  Int_t labv0mother = mcv0part->GetMother();
4655  Int_t pdgmotherv0 = -9999;
4656  if(labv0mother>=0){
4657  AliAODMCParticle *motherv0 = (AliAODMCParticle*)mcArray->At(labv0mother);
4658  if(motherv0){
4659  pdgmotherv0 = motherv0->GetPdgCode();
4660  if(abs(pdgmotherv0)>4000&&abs(pdgmotherv0)<4400){
4661  hfv0_flag = kTRUE;
4662  }
4663  }
4664  }
4665  if(!hfv0_flag) return;
4666 
4667  Double_t contmc[3];
4668  contmc[0] = mcv0part->Pt();
4669  contmc[1] = mcv0part->Eta();
4670  contmc[2] = fCentrality;
4671  fHistoLambdaMCGen->Fill(contmc);
4672 
4674  fCandidateMCV0Variables[ 1] = mcv0part->Px();
4675  fCandidateMCV0Variables[ 2] = mcv0part->Py();
4676  fCandidateMCV0Variables[ 3] = mcv0part->Pz();
4677  fCandidateMCV0Variables[ 4] = mcv0part->GetPdgCode();
4678  fCandidateMCV0Variables[ 5] = pdgmotherv0;
4681 
4682  if(fWriteMCVariableTree && fWriteEachVariableTree && mcv0part->Pt()>0.4 && fabs(mcv0part->Eta())<1.0 )
4683  fMCV0VariablesTree->Fill();
4684 }
4685 
4686 
4689  //
4691  //
4692 
4693  fCEvents = new TH1F("fCEvents","conter",20,-0.5,19.5);
4694  fCEvents->SetStats(kTRUE);
4695  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
4696  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
4697  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
4698  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
4699  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
4700  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
4701  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
4702  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
4703  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
4704  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
4705  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
4706  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
4707  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
4708  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
4709  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
4710  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
4711  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
4712  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
4713  fCEvents->GetXaxis()->SetBinLabel(19,"No RP");
4714  fCEvents->GetXaxis()->SetBinLabel(20,"No Qvector (only for TPC event plane)");
4715  //fCEvents->GetXaxis()->SetTitle("");
4716  fCEvents->GetYaxis()->SetTitle("counts");
4717 
4718  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
4719  fHTrigger->SetStats(kTRUE);
4720  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
4721  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
4722  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
4723  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
4724  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
4725  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
4726  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
4727  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
4728  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
4729  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
4730  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
4731  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
4732 
4733  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
4734  fHEventPlane = new TH1F("fHEventPlane","conter",100,-3.14,3.14);
4735  fHNTrackletvsZ = new TH2F("fHNTrackletvsZ","N_{tracklet} vs z",30,-15.,15.,120,-0.5,119.5);
4736  fHNTrackletCorrvsZ = new TH2F("fHNTrackletCorrvsZ","N_{tracklet} vs z",30,-15.,15.,120,-0.5,119.5);
4737  fHistoPoolMonitor = new TH2F("fHistoPoolMonitor","Pool ID vs depth",4000,-0.5,3999.5,50,-0.5,49.5);
4738  fHistoPoolIDCounter = new TH1F("fHistoPoolIDCounter","Pool ID",4003,-3.5,3999.5);
4739 
4740  fOutput->Add(fCEvents);
4741  fOutput->Add(fHTrigger);
4742  fOutput->Add(fHCentrality);
4743  fOutput->Add(fHEventPlane);
4744  fOutput->Add(fHNTrackletvsZ);
4746  fOutput->Add(fHistoPoolMonitor);
4748 
4749  return;
4750 }
4751 //__________________________________________________________________________
4753 {
4754  //
4756  //
4757 
4758  //------------------------------------------------
4759  // Basic histogram
4760  //------------------------------------------------
4761  Int_t bins_base[3]= {23,100 ,10};
4762  Double_t xmin_base[3]={1.1,0 ,0.00};
4763  Double_t xmax_base[3]={5.7,20. ,100};
4764  fHistoEleLambdaMass = new THnSparseF("fHistoEleLambdaMass","",3,bins_base,xmin_base,xmax_base);
4766  fHistoEleLambdaMassRS = new THnSparseF("fHistoEleLambdaMassRS","",3,bins_base,xmin_base,xmax_base);
4768  fHistoEleLambdaMassRS1 = new THnSparseF("fHistoEleLambdaMassRS1","",3,bins_base,xmin_base,xmax_base);
4770  fHistoEleLambdaMassRS2 = new THnSparseF("fHistoEleLambdaMassRS2","",3,bins_base,xmin_base,xmax_base);
4772  fHistoEleLambdaMassWS = new THnSparseF("fHistoEleLambdaMassWS","",3,bins_base,xmin_base,xmax_base);
4774  fHistoEleLambdaMassWS1 = new THnSparseF("fHistoEleLambdaMassWS1","",3,bins_base,xmin_base,xmax_base);
4776  fHistoEleLambdaMassWS2 = new THnSparseF("fHistoEleLambdaMassWS2","",3,bins_base,xmin_base,xmax_base);
4778  fHistoEleLambdaMassRSMix = new THnSparseF("fHistoEleLambdaMassRSMix","",3,bins_base,xmin_base,xmax_base);
4780  fHistoEleLambdaMassRSMix1 = new THnSparseF("fHistoEleLambdaMassRSMix1","",3,bins_base,xmin_base,xmax_base);
4782  fHistoEleLambdaMassRSMix2 = new THnSparseF("fHistoEleLambdaMassRSMix2","",3,bins_base,xmin_base,xmax_base);
4784  fHistoEleLambdaMassWSMix = new THnSparseF("fHistoEleLambdaMassWSMix","",3,bins_base,xmin_base,xmax_base);
4786  fHistoEleLambdaMassWSMix1 = new THnSparseF("fHistoEleLambdaMassWSMix1","",3,bins_base,xmin_base,xmax_base);
4788  fHistoEleLambdaMassWSMix2 = new THnSparseF("fHistoEleLambdaMassWSMix2","",3,bins_base,xmin_base,xmax_base);
4790  fHistoEleLambdaMassRSSide = new THnSparseF("fHistoEleLambdaMassRSSide","",3,bins_base,xmin_base,xmax_base);
4792  fHistoEleLambdaMassRSSide1 = new THnSparseF("fHistoEleLambdaMassRSSide1","",3,bins_base,xmin_base,xmax_base);
4794  fHistoEleLambdaMassRSSide2 = new THnSparseF("fHistoEleLambdaMassRSSide2","",3,bins_base,xmin_base,xmax_base);
4796  fHistoEleLambdaMassWSSide = new THnSparseF("fHistoEleLambdaMassWSSide","",3,bins_base,xmin_base,xmax_base);
4798  fHistoEleLambdaMassWSSide1 = new THnSparseF("fHistoEleLambdaMassWSSide1","",3,bins_base,xmin_base,xmax_base);
4800  fHistoEleLambdaMassWSSide2 = new THnSparseF("fHistoEleLambdaMassWSSide2","",3,bins_base,xmin_base,xmax_base);
4802 
4803  fHistoEleLambdaMassRSAway = new THnSparseF("fHistoEleLambdaMassRSAway","",3,bins_base,xmin_base,xmax_base);
4805  fHistoEleLambdaMassRS1Away = new THnSparseF("fHistoEleLambdaMassRS1Away","",3,bins_base,xmin_base,xmax_base);
4807  fHistoEleLambdaMassRS2Away = new THnSparseF("fHistoEleLambdaMassRS2Away","",3,bins_base,xmin_base,xmax_base);
4809  fHistoEleLambdaMassWSAway = new THnSparseF("fHistoEleLambdaMassWSAway","",3,bins_base,xmin_base,xmax_base);
4811  fHistoEleLambdaMassWS1Away = new THnSparseF("fHistoEleLambdaMassWS1Away","",3,bins_base,xmin_base,xmax_base);
4813  fHistoEleLambdaMassWS2Away = new THnSparseF("fHistoEleLambdaMassWS2Away","",3,bins_base,xmin_base,xmax_base);
4815  fHistoEleLambdaMassRSMixAway = new THnSparseF("fHistoEleLambdaMassRSMixAway","",3,bins_base,xmin_base,xmax_base);
4817  fHistoEleLambdaMassRSMix1Away = new THnSparseF("fHistoEleLambdaMassRSMix1Away","",3,bins_base,xmin_base,xmax_base);
4819  fHistoEleLambdaMassRSMix2Away = new THnSparseF("fHistoEleLambdaMassRSMix2Away","",3,bins_base,xmin_base,xmax_base);
4821  fHistoEleLambdaMassWSMixAway = new THnSparseF("fHistoEleLambdaMassWSMixAway","",3,bins_base,xmin_base,xmax_base);
4823  fHistoEleLambdaMassWSMix1Away = new THnSparseF("fHistoEleLambdaMassWSMix1Away","",3,bins_base,xmin_base,xmax_base);
4825  fHistoEleLambdaMassWSMix2Away = new THnSparseF("fHistoEleLambdaMassWSMix2Away","",3,bins_base,xmin_base,xmax_base);
4827  fHistoEleLambdaMassRSSideAway = new THnSparseF("fHistoEleLambdaMassRSSideAway","",3,bins_base,xmin_base,xmax_base);
4829  fHistoEleLambdaMassRSSide1Away = new THnSparseF("fHistoEleLambdaMassRSSide1Away","",3,bins_base,xmin_base,xmax_base);
4831  fHistoEleLambdaMassRSSide2Away = new THnSparseF("fHistoEleLambdaMassRSSide2Away","",3,bins_base,xmin_base,xmax_base);
4833  fHistoEleLambdaMassWSSideAway = new THnSparseF("fHistoEleLambdaMassWSSideAway","",3,bins_base,xmin_base,xmax_base);
4835  fHistoEleLambdaMassWSSide1Away = new THnSparseF("fHistoEleLambdaMassWSSide1Away","",3,bins_base,xmin_base,xmax_base);
4837  fHistoEleLambdaMassWSSide2Away = new THnSparseF("fHistoEleLambdaMassWSSide2Away","",3,bins_base,xmin_base,xmax_base);
4839 
4840  Int_t bins_base_elept[3]= {10,100 ,10};
4841  Double_t xmin_base_elept[3]={1.1,0 ,0.00};
4842  Double_t xmax_base_elept[3]={3.1,10. ,100};
4843  fHistoEleLambdaMassvsElePtRS = new THnSparseF("fHistoEleLambdaMassvsElePtRS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4845  fHistoEleLambdaMassvsElePtWS = new THnSparseF("fHistoEleLambdaMassvsElePtWS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4847  fHistoEleLambdaMassvsElePtRSMix = new THnSparseF("fHistoEleLambdaMassvsElePtRSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4849  fHistoEleLambdaMassvsElePtWSMix = new THnSparseF("fHistoEleLambdaMassvsElePtWSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4851  fHistoEleLambdaMassvsElePtRSSide = new THnSparseF("fHistoEleLambdaMassvsElePtRSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4853  fHistoEleLambdaMassvsElePtWSSide = new THnSparseF("fHistoEleLambdaMassvsElePtWSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4855  fHistoEleLambdaMassvsElePtRS1 = new THnSparseF("fHistoEleLambdaMassvsElePtRS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4857  fHistoEleLambdaMassvsElePtWS1 = new THnSparseF("fHistoEleLambdaMassvsElePtWS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4859  fHistoEleLambdaMassvsElePtRSMix1 = new THnSparseF("fHistoEleLambdaMassvsElePtRSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4861  fHistoEleLambdaMassvsElePtWSMix1 = new THnSparseF("fHistoEleLambdaMassvsElePtWSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4863  fHistoEleLambdaMassvsElePtRSSide1 = new THnSparseF("fHistoEleLambdaMassvsElePtRSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4865  fHistoEleLambdaMassvsElePtWSSide1 = new THnSparseF("fHistoEleLambdaMassvsElePtWSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4867  fHistoEleLambdaMassvsElePtRS2 = new THnSparseF("fHistoEleLambdaMassvsElePtRS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4869  fHistoEleLambdaMassvsElePtWS2 = new THnSparseF("fHistoEleLambdaMassvsElePtWS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4871  fHistoEleLambdaMassvsElePtRSMix2 = new THnSparseF("fHistoEleLambdaMassvsElePtRSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4873  fHistoEleLambdaMassvsElePtWSMix2 = new THnSparseF("fHistoEleLambdaMassvsElePtWSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4875  fHistoEleLambdaMassvsElePtRSSide2 = new THnSparseF("fHistoEleLambdaMassvsElePtRSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4877  fHistoEleLambdaMassvsElePtWSSide2 = new THnSparseF("fHistoEleLambdaMassvsElePtWSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4879 
4880  fHistoEleLambdaMassMCS = new THnSparseF("fHistoEleLambdaMassMCS","",3,bins_base,xmin_base,xmax_base);
4882  fHistoEleLambdaMassLambdabMCS = new THnSparseF("fHistoEleLambdaMassLambdabMCS","",3,bins_base,xmin_base,xmax_base);
4884  fHistoEleLambdaMassXibMCS = new THnSparseF("fHistoEleLambdaMassXibMCS","",3,bins_base,xmin_base,xmax_base);
4886  fHistoEleLambdaMassMCGen = new THnSparseF("fHistoEleLambdaMassMCGen","",3,bins_base,xmin_base,xmax_base);
4888  fHistoEleLambdaMassvsElePtMCS = new THnSparseF("fHistoEleLambdaMassvsElePtMCS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4890  fHistoEleLambdaMassvsElePtMCGen = new THnSparseF("fHistoEleLambdaMassvsElePtMCGen","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4892  fHistoEleLambdaMassvsElePtMCS1 = new THnSparseF("fHistoEleLambdaMassvsElePtMCS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4894  fHistoEleLambdaMassvsElePtMCGen1 = new THnSparseF("fHistoEleLambdaMassvsElePtMCGen1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4896  fHistoEleLambdaMassvsElePtMCS2 = new THnSparseF("fHistoEleLambdaMassvsElePtMCS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4898  fHistoEleLambdaMassvsElePtMCGen2 = new THnSparseF("fHistoEleLambdaMassvsElePtMCGen2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4900 
4901  fHistoElePtRS = new TH2F("fHistoElePtRS","",100,0,10,10,0,100);
4902  fOutputAll->Add(fHistoElePtRS);
4903  fHistoElePtWS = new TH2F("fHistoElePtWS","",100,0.,10.,10,0,100);
4904  fOutputAll->Add(fHistoElePtWS);
4905  fHistoElePtRSMix = new TH2F("fHistoElePtRSMix","",100,0.,10.,10,0,100);
4907  fHistoElePtWSMix = new TH2F("fHistoElePtWSMix","",100,0.,10.,10,0,100);
4909  fHistoElePtMCS = new TH2F("fHistoElePtMCS","",100,0,10,10,0,100);
4910  fOutputAll->Add(fHistoElePtMCS);
4911  fHistoElePtMCGen = new TH2F("fHistoElePtMCGen","",100,0,10,10,0,100);
4913 
4914  Int_t bins_eleptvseta[3]= {10,10 ,10};
4915  Double_t xmin_eleptvseta[3]={0.,-1. ,0.0};
4916  Double_t xmax_eleptvseta[3]={5.,1. ,100};
4917 
4918  fHistoElePtvsEtaRS = new THnSparseF("fHistoElePtvsEtaRS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4920  fHistoElePtvsEtaWS = new THnSparseF("fHistoElePtvsEtaWS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4922  fHistoElePtvsEtaRSMix = new THnSparseF("fHistoElePtvsEtaRSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4924  fHistoElePtvsEtaWSMix = new THnSparseF("fHistoElePtvsEtaWSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4926  fHistoElePtvsEtaMCS = new THnSparseF("fHistoElePtvsEtaMCS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4928  fHistoElePtvsEtaMCGen = new THnSparseF("fHistoElePtvsEtaMCGen","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
4930 
4931  Int_t bins_eleptvslambdapt[3]= {10,10 ,10};
4932  Double_t xmin_eleptvslambdapt[3]={0.,0. ,0.0};
4933  Double_t xmax_eleptvslambdapt[3]={5.,5. ,100};
4934 
4935  fHistoElePtvsLambdaPtRS = new THnSparseF("fHistoElePtvsLambdaPtRS","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4937  fHistoElePtvsLambdaPtWS = new THnSparseF("fHistoElePtvsLambdaPtWS","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4939  fHistoElePtvsLambdaPtRSMix = new THnSparseF("fHistoElePtvsLambdaPtRSMix","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4941  fHistoElePtvsLambdaPtWSMix = new THnSparseF("fHistoElePtvsLambdaPtWSMix","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4943  fHistoElePtvsLambdaPtMCS = new THnSparseF("fHistoElePtvsLambdaPtMCS","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4945  fHistoElePtvsLambdaPtMCGen = new THnSparseF("fHistoElePtvsLambdaPtMCGen","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4947  fHistoElePtvsLambdaPtMCLcGen = new THnSparseF("fHistoElePtvsLambdaPtMCLcGen","",3,bins_eleptvslambdapt,xmin_eleptvslambdapt,xmax_eleptvslambdapt);
4949 
4950  Int_t bins_eleptvslambdaptvslcpt[4]= {10,10,10,10};
4951  Double_t xmin_eleptvslambdaptvslcpt[4]={0.,0.,0.,0.0};
4952  Double_t xmax_eleptvslambdaptvslcpt[4]={5.,5.,10.,100};
4953  fHistoElePtvsLambdaPtvsLcPtMCS = new THnSparseF("fHistoElePtvsLambdaPtvsLcPtMCS","",4,bins_eleptvslambdaptvslcpt,xmin_eleptvslambdaptvslcpt,xmax_eleptvslambdaptvslcpt);
4955  fHistoElePtvsLambdaPtvsLcPtMCGen = new THnSparseF("fHistoElePtvsLambdaPtvsLcPtMCGen","",4,bins_eleptvslambdaptvslcpt,xmin_eleptvslambdaptvslcpt,xmax_eleptvslambdaptvslcpt);
4957 
4958  Int_t bins_allpt[4]= {10,10,20,20};
4959  Double_t xmin_allpt[4]={0.,0.,0.,0.0};
4960  Double_t xmax_allpt[4]={20.,20.,10.,10};
4961  fHistoLcPtvseleLambdaPtvsElePtvsLambdaPt = new THnSparseF("fHistoLcPtvseleLambdaPtvsElePtvsLambdaPt","",4,bins_allpt,xmin_allpt,xmax_allpt);
4963 
4964  fHistoEleLambdaPtvsRapidityRS=new TH2F("fHistoEleLambdaPtvsRapidityRS","EleLambda pt vs rap",20,0.,20.,40,-2.,2.);
4966  fHistoEleLambdaPtvsRapidityWS=new TH2F("fHistoEleLambdaPtvsRapidityWS","EleLambda pt vs rap",20,0.,20.,40,-2.,2.);
4968  fHistoEleLambdaPtvsRapidityMCS=new TH2F("fHistoEleLambdaPtvsRapidityMCS","EleLambda pt vs rap",20,0.,20.,40,-2.,2.);
4970 
4971  Int_t bins_eleptvsd0[3]= {10 ,10 ,10};
4972  Double_t xmin_eleptvsd0[3]={0.,-0.2 ,0.0};
4973  Double_t xmax_eleptvsd0[3]={5.,0.2 ,100};
4974 
4975  fHistoElePtvsd0RS = new THnSparseF("fHistoElePtvsd0RS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4977  fHistoElePtvsd0WS = new THnSparseF("fHistoElePtvsd0WS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4979  fHistoElePtvsd0RSMix = new THnSparseF("fHistoElePtvsd0RSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4981  fHistoElePtvsd0WSMix = new THnSparseF("fHistoElePtvsd0WSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4983  fHistoElePtvsd0MCS = new THnSparseF("fHistoElePtvsd0MCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4985  fHistoElePtvsd0PromptMCS = new THnSparseF("fHistoElePtvsd0PromptMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4987  fHistoElePtvsd0BFeeddownMCS = new THnSparseF("fHistoElePtvsd0BFeeddownMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
4989 
4990 
4991  //Feeddown from Xic0
4992  fHistoEleLambdaMassFeeddownXic0MCS = new THnSparseF("fHistoEleLambdaMassFeeddownXic0MCS","",3,bins_base,xmin_base,xmax_base);
4994  fHistoEleLambdaMassFeeddownXic0MCGen = new THnSparseF("fHistoEleLambdaMassFeeddownXic0MCGen","",3,bins_base,xmin_base,xmax_base);
4996  fHistoEleLambdaMassvsElePtFeeddownXic0MCS = new THnSparseF("fHistoEleLambdaMassvsElePtFeeddownXic0MCS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
4998  fHistoEleLambdaMassvsElePtFeeddownXic0MCGen = new THnSparseF("fHistoEleLambdaMassvsElePtFeeddownXic0MCGen","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
5000  fHistoEleLambdaMassvsElePtFeeddownXic0MCS1 = new THnSparseF("fHistoEleLambdaMassvsElePtFeeddownXic0MCS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
5001