AliPhysics  8bb951a (8bb951a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEXic2eleXifromAODtracks.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 // Xic->eXi analysis code
21 //
22 // Input: AOD
23 // Output: TTree or THnSparse (mass vs pT vs Centrality)
24 //
25 //-------------------------------------------------------------------------
26 //
27 // Authors: Y.S Watanabe(a)
28 // (a) CNS, the University of Tokyo
29 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
30 //-------------------------------------------------------------------------
31 
32 #include <TSystem.h>
33 #include <TParticle.h>
34 #include <TParticlePDG.h>
35 #include <TH1F.h>
36 #include <TH1F.h>
37 #include <TH2F.h>
38 #include <THnSparse.h>
39 #include <TLorentzVector.h>
40 #include <TTree.h>
41 #include "TROOT.h"
42 #include <TDatabasePDG.h>
43 #include <AliAnalysisDataSlot.h>
44 #include <AliAnalysisDataContainer.h>
45 #include "AliStack.h"
46 #include "AliMCEvent.h"
47 #include "AliAnalysisManager.h"
48 #include "AliAODMCHeader.h"
49 #include "AliAODHandler.h"
50 #include "AliLog.h"
51 #include "AliExternalTrackParam.h"
52 #include "AliAODVertex.h"
53 #include "AliESDVertex.h"
54 #include "AliAODRecoDecay.h"
55 #include "AliAODRecoDecayHF.h"
56 #include "AliAODRecoCascadeHF.h"
57 #include "AliESDtrack.h"
58 #include "AliAODTrack.h"
59 #include "AliAODv0.h"
60 #include "AliAODcascade.h"
61 #include "AliAODMCParticle.h"
62 #include "AliAnalysisTaskSE.h"
64 #include "AliPIDResponse.h"
65 #include "AliPIDCombined.h"
66 #include "AliTOFPIDResponse.h"
67 #include "AliAODPidHF.h"
68 #include "AliInputEventHandler.h"
69 #include "AliESDtrackCuts.h"
70 #include "AliNeutralTrackParam.h"
71 #include "AliKFParticle.h"
72 #include "AliKFVertex.h"
73 #include "AliExternalTrackParam.h"
74 #include "AliESDtrack.h"
75 #include "AliCentrality.h"
76 #include "AliVertexerTracks.h"
77 #include "AliEventPoolManager.h"
79 
80 using std::cout;
81 using std::endl;
82 
86 
87 //__________________________________________________________________________
89  AliAnalysisTaskSE(),
90  fUseMCInfo(kFALSE),
91  fOutput(0),
92  fOutputAll(0),
93  fListCuts(0),
94  fCEvents(0),
95  fHTrigger(0),
96  fHCentrality(0),
97  fAnalCuts(0),
98  fIsEventSelected(kFALSE),
99  fWriteVariableTree(kFALSE),
100  fWriteEachVariableTree(kFALSE),
101  fWriteMCVariableTree(kFALSE),
102  fVariablesTree(0),
103  fEleVariablesTree(0),
104  fCascVariablesTree(0),
105  fMCVariablesTree(0),
106  fMCEleVariablesTree(0),
107  fMCCascVariablesTree(0),
108  fMCGenPairVariablesTree(0),
109  fCorrelationVariablesTree(0),
110  fReconstructPrimVert(kFALSE),
111  fIsMB(kFALSE),
112  fIsSemi(kFALSE),
113  fIsCent(kFALSE),
114  fIsINT7(kFALSE),
115  fIsEMC7(kFALSE),
116  fCandidateVariables(),
117  fCandidateEleVariables(),
118  fCandidateCascVariables(),
119  fCandidateMCVariables(),
120  fCandidateMCEleVariables(),
121  fCandidateMCCascVariables(),
122  fCandidateMCGenPairVariables(),
123  fCorrelationVariables(),
124  fVtx1(0),
125  fV1(0),
126  fVtxZ(0),
127  fBzkG(0),
128  fCentrality(0),
129  fRunNumber(0),
130  fTriggerCheck(0),
131  fUseCentralityV0M(kFALSE),
132  fEvNumberCounter(0),
133  fMCEventType(-9999),
134  fMCDoPairAnalysis(kFALSE),
135  fHistoEleXiMass(0),
136  fHistoEleXiMassRS(0),
137  fHistoEleXiMassWS(0),
138  fHistoEleXiMassRSMix(0),
139  fHistoEleXiMassWSMix(0),
140  fHistoEleXiMassRSSide(0),
141  fHistoEleXiMassWSSide(0),
142  fHistoEleXiMassRS1(0),
143  fHistoEleXiMassWS1(0),
144  fHistoEleXiMassRSMix1(0),
145  fHistoEleXiMassWSMix1(0),
146  fHistoEleXiMassRSSide1(0),
147  fHistoEleXiMassWSSide1(0),
148  fHistoEleXiMassRS2(0),
149  fHistoEleXiMassWS2(0),
150  fHistoEleXiMassRSMix2(0),
151  fHistoEleXiMassWSMix2(0),
152  fHistoEleXiMassRSSide2(0),
153  fHistoEleXiMassWSSide2(0),
154  fHistoEleXiMassAway(0),
155  fHistoEleXiMassRSAway(0),
156  fHistoEleXiMassWSAway(0),
157  fHistoEleXiMassRSMixAway(0),
158  fHistoEleXiMassWSMixAway(0),
159  fHistoEleXiMassRSSideAway(0),
160  fHistoEleXiMassWSSideAway(0),
161  fHistoEleXiMassRS1Away(0),
162  fHistoEleXiMassWS1Away(0),
163  fHistoEleXiMassRSMix1Away(0),
164  fHistoEleXiMassWSMix1Away(0),
165  fHistoEleXiMassRSSide1Away(0),
166  fHistoEleXiMassWSSide1Away(0),
167  fHistoEleXiMassRS2Away(0),
168  fHistoEleXiMassWS2Away(0),
169  fHistoEleXiMassRSMix2Away(0),
170  fHistoEleXiMassWSMix2Away(0),
171  fHistoEleXiMassRSSide2Away(0),
172  fHistoEleXiMassWSSide2Away(0),
173  fHistoEleXiMassvsElePtRS(0),
174  fHistoEleXiMassvsElePtWS(0),
175  fHistoEleXiMassvsElePtRSMix(0),
176  fHistoEleXiMassvsElePtWSMix(0),
177  fHistoEleXiMassvsElePtRSSide(0),
178  fHistoEleXiMassvsElePtWSSide(0),
179  fHistoEleXiMassvsElePtRS1(0),
180  fHistoEleXiMassvsElePtWS1(0),
181  fHistoEleXiMassvsElePtRSMix1(0),
182  fHistoEleXiMassvsElePtWSMix1(0),
183  fHistoEleXiMassvsElePtRSSide1(0),
184  fHistoEleXiMassvsElePtWSSide1(0),
185  fHistoEleXiMassvsElePtRS2(0),
186  fHistoEleXiMassvsElePtWS2(0),
187  fHistoEleXiMassvsElePtRSMix2(0),
188  fHistoEleXiMassvsElePtWSMix2(0),
189  fHistoEleXiMassvsElePtRSSide2(0),
190  fHistoEleXiMassvsElePtWSSide2(0),
191  fHistoElePtRS(0),
192  fHistoElePtWS(0),
193  fHistoElePtRSMix(0),
194  fHistoElePtWSMix(0),
195  fHistoEleXiMassMCS(0),
196  fHistoEleXiMassMCS1(0),
197  fHistoEleXiMassMCS2(0),
198  fHistoEleXiMassXibMCS(0),
199  fHistoEleXiMassXibMCS1(0),
200  fHistoEleXiMassXibMCS2(0),
201  fHistoEleXiMassPromptMCS(0),
202  fHistoEleXiMassPromptMCS1(0),
203  fHistoEleXiMassPromptMCS2(0),
204  fHistoEleXiMassBFeeddownMCS(0),
205  fHistoEleXiMassBFeeddownMCS1(0),
206  fHistoEleXiMassBFeeddownMCS2(0),
207  fHistoEleXiMassMCGen(0),
208  fHistoEleXiMassvsElePtMCS(0),
209  fHistoEleXiMassvsElePtMCGen(0),
210  fHistoEleXiMassvsElePtMCS1(0),
211  fHistoEleXiMassvsElePtMCGen1(0),
212  fHistoEleXiMassvsElePtMCS2(0),
213  fHistoEleXiMassvsElePtMCGen2(0),
214  fHistoElePtMCS(0),
215  fHistoElePtMCGen(0),
216  fHistoElePtvsEtaRS(0),
217  fHistoElePtvsEtaWS(0),
218  fHistoElePtvsEtaRSMix(0),
219  fHistoElePtvsEtaWSMix(0),
220  fHistoElePtvsEtaMCS(0),
221  fHistoElePtvsEtaMCGen(0),
222  fHistoElePtvsXiPtRS(0),
223  fHistoElePtvsXiPtWS(0),
224  fHistoElePtvsXiPtRSMix(0),
225  fHistoElePtvsXiPtWSMix(0),
226  fHistoElePtvsXiPtMCS(0),
227  fHistoElePtvsXiPtvsXicPtMCS(0),
228  fHistoElePtvsXiPtMCGen(0),
229  fHistoElePtvsXiPtvsXicPtMCGen(0),
230  fHistoElePtvsXiPtMCXicGen(0),
231  fHistoElePtvsd0RS(0),
232  fHistoElePtvsd0WS(0),
233  fHistoElePtvsd0RSMix(0),
234  fHistoElePtvsd0WSMix(0),
235  fHistoElePtvsd0MCS(0),
236  fHistoElePtvsd0PromptMCS(0),
237  fHistoElePtvsd0BFeeddownMCS(0),
238  fHistoBachPt(0),
239  fHistoBachPtMCS(0),
240  fHistoBachPtMCGen(0),
241  fHistod0Bach(0),
242  fHistoXiMassvsPt(0),
243  fHistoXiMassvsPtMCS(0),
244  fHistoXiMassvsPtMCGen(0),
245  fHistoOmegaMassvsPt(0),
246  fHistoElectronTPCPID(0),
247  fHistoElectronTOFPID(0),
248  fHistoElectronTPCSelPID(0),
249  fHistoElectronTOFSelPID(0),
250  fHistoElectronTPCPIDSelTOF(0),
251  fHistoElectronTOFPIDSelTPC(0),
252  fHistoElectronTPCPIDSelTOFSmallEta(0),
253  fHistoElectronTPCPIDSelTOFLargeEta(0),
254  fHistoMassConversionsMin(0),
255  fHistoMassConversionsSameSignMin(0),
256  fHistoElectronQovPtvsPhi(0),
257  fHistoXiQovPtvsPhi(0),
258  fHistoXicMCGen(0),
259  fHistoXicMCGen1(0),
260  fHistoXicMCGen2(0),
261  fHistoXicMCS(0),
262  fHistoXicMCS1(0),
263  fHistoXicMCS2(0),
264  fHistoXicElectronMCGen(0),
265  fHistoXicElectronMCGen1(0),
266  fHistoXicElectronMCGen2(0),
267  fHistoXicElectronMCS(0),
268  fHistoXicElectronMCS1(0),
269  fHistoXicElectronMCS2(0),
270  fHistoElectronMCGen(0),
271  fHistoBottomElectronMCGen(0),
272  fHistoCharmElectronMCGen(0),
273  fHistoXiMCGen(0),
274  fHistoLambdaPtvsDl(0),
275  fHistoLambdaPtvsDlSide(0),
276  fHistoLambdaPtvsDlMCS(0),
277  fHistoLambdaPtvsDR(0),
278  fHistoLambdaPtvsDRSide(0),
279  fHistoLambdaPtvsDRMCS(0),
280  fHistoEleXiPtvsRapidityRS(0),
281  fHistoEleXiPtvsRapidityWS(0),
282  fHistoEleXiPtvsRapidityMCS(0),
283  fHistoResponseElePt(0),
284  fHistoResponseXiPt(0),
285  fHistoResponseEleXiPt(0),
286  fHistoElectronPi0Total(0),
287  fHistoElectronPi0Tag(0),
288  fHistoElectronEtaTotal(0),
289  fHistoElectronEtaTag(0),
290  fCounter(0),
291  fHistonEvtvsRunNumber(0),
292  fHistonElevsRunNumber(0),
293  fHistonXivsRunNumber(0),
294  fHistoMCEventType(0),
295  fHistoMCXic0Decays(0),
296  fHistoMCDeltaPhiccbar(0),
297  fHistoMCNccbar(0),
298  fGTI(0),fGTIndex(0), fTrackBuffSize(19000),
299  fHistodPhiSdEtaSElectronProtonR125RS(0),
300  fHistodPhiSdEtaSElectronProtonR125WS(0),
301  fHistodPhiSdEtaSElectronProtonR125RSMix(0),
302  fHistodPhiSdEtaSElectronProtonR125WSMix(0),
303  fHistodPhiSdEtaSElectronPionR125RS(0),
304  fHistodPhiSdEtaSElectronPionR125WS(0),
305  fHistodPhiSdEtaSElectronPionR125RSMix(0),
306  fHistodPhiSdEtaSElectronPionR125WSMix(0),
307  fHistodPhiSdEtaSElectronBachelorR125RS(0),
308  fHistodPhiSdEtaSElectronBachelorR125WS(0),
309  fHistodPhiSdEtaSElectronBachelorR125RSMix(0),
310  fHistodPhiSdEtaSElectronBachelorR125WSMix(0),
311  fDoEventMixing(0),
312  fMixWithoutConversionFlag(kTRUE),
313  fNumberOfEventsForMixing (5),
314  fNzVtxBins (0),
315  fNCentBins (0),
316  fNOfPools(1),
317  fEventBuffer(0x0),
318  fEventInfo(0x0),
319  fElectronTracks(0x0),
320  fCascadeTracks1(0x0),
321  fCascadeTracks2(0x0),
322  fElectronCutVarsArray(0x0),
323  fCascadeCutVarsArray1(0x0),
324  fCascadeCutVarsArray2(0x0)
325 {
326  //
327  // Default Constructor.
328  //
329  for(Int_t i=0;i<23;i++){
330  fHistoElePtvsCutVarsRS[i] = 0;
331  fHistoElePtvsCutVarsWS[i] = 0;
333  }
334  for(Int_t i=0;i<8;i++){
336  }
337 }
338 
339 //___________________________________________________________________________
342  Bool_t writeVariableTree) :
343  AliAnalysisTaskSE(name),
344  fUseMCInfo(kFALSE),
345  fOutput(0),
346  fOutputAll(0),
347  fListCuts(0),
348  fCEvents(0),
349  fHTrigger(0),
350  fHCentrality(0),
351  fAnalCuts(analCuts),
352  fIsEventSelected(kFALSE),
353  fWriteVariableTree(writeVariableTree),
354  fWriteEachVariableTree(kFALSE),
355  fWriteMCVariableTree(kFALSE),
356  fVariablesTree(0),
357  fEleVariablesTree(0),
358  fCascVariablesTree(0),
359  fMCVariablesTree(0),
360  fMCEleVariablesTree(0),
361  fMCCascVariablesTree(0),
362  fMCGenPairVariablesTree(0),
363  fCorrelationVariablesTree(0),
364  fReconstructPrimVert(kFALSE),
365  fIsMB(kFALSE),
366  fIsSemi(kFALSE),
367  fIsCent(kFALSE),
368  fIsINT7(kFALSE),
369  fIsEMC7(kFALSE),
370  fCandidateVariables(),
371  fCandidateEleVariables(),
372  fCandidateCascVariables(),
373  fCandidateMCVariables(),
374  fCandidateMCEleVariables(),
375  fCandidateMCCascVariables(),
376  fCandidateMCGenPairVariables(),
377  fCorrelationVariables(),
378  fVtx1(0),
379  fV1(0),
380  fVtxZ(0),
381  fBzkG(0),
382  fCentrality(0),
383  fRunNumber(0),
384  fTriggerCheck(0),
385  fUseCentralityV0M(kFALSE),
386  fEvNumberCounter(0),
387  fMCEventType(-9999),
388  fMCDoPairAnalysis(kFALSE),
389  fHistoEleXiMass(0),
390  fHistoEleXiMassRS(0),
391  fHistoEleXiMassWS(0),
392  fHistoEleXiMassRSMix(0),
393  fHistoEleXiMassWSMix(0),
394  fHistoEleXiMassRSSide(0),
395  fHistoEleXiMassWSSide(0),
396  fHistoEleXiMassRS1(0),
397  fHistoEleXiMassWS1(0),
398  fHistoEleXiMassRSMix1(0),
399  fHistoEleXiMassWSMix1(0),
400  fHistoEleXiMassRSSide1(0),
401  fHistoEleXiMassWSSide1(0),
402  fHistoEleXiMassRS2(0),
403  fHistoEleXiMassWS2(0),
404  fHistoEleXiMassRSMix2(0),
405  fHistoEleXiMassWSMix2(0),
406  fHistoEleXiMassRSSide2(0),
407  fHistoEleXiMassWSSide2(0),
408  fHistoEleXiMassAway(0),
409  fHistoEleXiMassRSAway(0),
410  fHistoEleXiMassWSAway(0),
411  fHistoEleXiMassRSMixAway(0),
412  fHistoEleXiMassWSMixAway(0),
413  fHistoEleXiMassRSSideAway(0),
414  fHistoEleXiMassWSSideAway(0),
415  fHistoEleXiMassRS1Away(0),
416  fHistoEleXiMassWS1Away(0),
417  fHistoEleXiMassRSMix1Away(0),
418  fHistoEleXiMassWSMix1Away(0),
419  fHistoEleXiMassRSSide1Away(0),
420  fHistoEleXiMassWSSide1Away(0),
421  fHistoEleXiMassRS2Away(0),
422  fHistoEleXiMassWS2Away(0),
423  fHistoEleXiMassRSMix2Away(0),
424  fHistoEleXiMassWSMix2Away(0),
425  fHistoEleXiMassRSSide2Away(0),
426  fHistoEleXiMassWSSide2Away(0),
427  fHistoEleXiMassvsElePtRS(0),
428  fHistoEleXiMassvsElePtWS(0),
429  fHistoEleXiMassvsElePtRSMix(0),
430  fHistoEleXiMassvsElePtWSMix(0),
431  fHistoEleXiMassvsElePtRSSide(0),
432  fHistoEleXiMassvsElePtWSSide(0),
433  fHistoEleXiMassvsElePtRS1(0),
434  fHistoEleXiMassvsElePtWS1(0),
435  fHistoEleXiMassvsElePtRSMix1(0),
436  fHistoEleXiMassvsElePtWSMix1(0),
437  fHistoEleXiMassvsElePtRSSide1(0),
438  fHistoEleXiMassvsElePtWSSide1(0),
439  fHistoEleXiMassvsElePtRS2(0),
440  fHistoEleXiMassvsElePtWS2(0),
441  fHistoEleXiMassvsElePtRSMix2(0),
442  fHistoEleXiMassvsElePtWSMix2(0),
443  fHistoEleXiMassvsElePtRSSide2(0),
444  fHistoEleXiMassvsElePtWSSide2(0),
445  fHistoElePtRS(0),
446  fHistoElePtWS(0),
447  fHistoElePtRSMix(0),
448  fHistoElePtWSMix(0),
449  fHistoEleXiMassMCS(0),
450  fHistoEleXiMassMCS1(0),
451  fHistoEleXiMassMCS2(0),
452  fHistoEleXiMassXibMCS(0),
453  fHistoEleXiMassXibMCS1(0),
454  fHistoEleXiMassXibMCS2(0),
455  fHistoEleXiMassPromptMCS(0),
456  fHistoEleXiMassPromptMCS1(0),
457  fHistoEleXiMassPromptMCS2(0),
458  fHistoEleXiMassBFeeddownMCS(0),
459  fHistoEleXiMassBFeeddownMCS1(0),
460  fHistoEleXiMassBFeeddownMCS2(0),
461  fHistoEleXiMassMCGen(0),
462  fHistoEleXiMassvsElePtMCS(0),
463  fHistoEleXiMassvsElePtMCGen(0),
464  fHistoEleXiMassvsElePtMCS1(0),
465  fHistoEleXiMassvsElePtMCGen1(0),
466  fHistoEleXiMassvsElePtMCS2(0),
467  fHistoEleXiMassvsElePtMCGen2(0),
468  fHistoElePtMCS(0),
469  fHistoElePtMCGen(0),
470  fHistoElePtvsEtaRS(0),
471  fHistoElePtvsEtaWS(0),
472  fHistoElePtvsEtaRSMix(0),
473  fHistoElePtvsEtaWSMix(0),
474  fHistoElePtvsEtaMCS(0),
475  fHistoElePtvsEtaMCGen(0),
476  fHistoElePtvsXiPtRS(0),
477  fHistoElePtvsXiPtWS(0),
478  fHistoElePtvsXiPtRSMix(0),
479  fHistoElePtvsXiPtWSMix(0),
480  fHistoElePtvsXiPtMCS(0),
481  fHistoElePtvsXiPtvsXicPtMCS(0),
482  fHistoElePtvsXiPtMCGen(0),
483  fHistoElePtvsXiPtvsXicPtMCGen(0),
484  fHistoElePtvsXiPtMCXicGen(0),
485  fHistoElePtvsd0RS(0),
486  fHistoElePtvsd0WS(0),
487  fHistoElePtvsd0RSMix(0),
488  fHistoElePtvsd0WSMix(0),
489  fHistoElePtvsd0MCS(0),
490  fHistoElePtvsd0PromptMCS(0),
491  fHistoElePtvsd0BFeeddownMCS(0),
492  fHistoBachPt(0),
493  fHistoBachPtMCS(0),
494  fHistoBachPtMCGen(0),
495  fHistod0Bach(0),
496  fHistoXiMassvsPt(0),
497  fHistoXiMassvsPtMCS(0),
498  fHistoXiMassvsPtMCGen(0),
499  fHistoOmegaMassvsPt(0),
500  fHistoElectronTPCPID(0),
501  fHistoElectronTOFPID(0),
502  fHistoElectronTPCSelPID(0),
503  fHistoElectronTOFSelPID(0),
504  fHistoElectronTPCPIDSelTOF(0),
505  fHistoElectronTOFPIDSelTPC(0),
506  fHistoElectronTPCPIDSelTOFSmallEta(0),
507  fHistoElectronTPCPIDSelTOFLargeEta(0),
508  fHistoMassConversionsMin(0),
509  fHistoMassConversionsSameSignMin(0),
510  fHistoElectronQovPtvsPhi(0),
511  fHistoXiQovPtvsPhi(0),
512  fHistoXicMCGen(0),
513  fHistoXicMCGen1(0),
514  fHistoXicMCGen2(0),
515  fHistoXicMCS(0),
516  fHistoXicMCS1(0),
517  fHistoXicMCS2(0),
518  fHistoXicElectronMCGen(0),
519  fHistoXicElectronMCGen1(0),
520  fHistoXicElectronMCGen2(0),
521  fHistoXicElectronMCS(0),
522  fHistoXicElectronMCS1(0),
523  fHistoXicElectronMCS2(0),
524  fHistoElectronMCGen(0),
525  fHistoBottomElectronMCGen(0),
526  fHistoCharmElectronMCGen(0),
527  fHistoXiMCGen(0),
528  fHistoLambdaPtvsDl(0),
529  fHistoLambdaPtvsDlSide(0),
530  fHistoLambdaPtvsDlMCS(0),
531  fHistoLambdaPtvsDR(0),
532  fHistoLambdaPtvsDRSide(0),
533  fHistoLambdaPtvsDRMCS(0),
534  fHistoEleXiPtvsRapidityRS(0),
535  fHistoEleXiPtvsRapidityWS(0),
536  fHistoEleXiPtvsRapidityMCS(0),
537  fHistoResponseElePt(0),
538  fHistoResponseXiPt(0),
539  fHistoResponseEleXiPt(0),
540  fHistoElectronPi0Total(0),
541  fHistoElectronPi0Tag(0),
542  fHistoElectronEtaTotal(0),
543  fHistoElectronEtaTag(0),
544  fCounter(0),
545  fHistonEvtvsRunNumber(0),
546  fHistonElevsRunNumber(0),
547  fHistonXivsRunNumber(0),
548  fHistoMCEventType(0),
549  fHistoMCXic0Decays(0),
550  fHistoMCDeltaPhiccbar(0),
551  fHistoMCNccbar(0),
552  fGTI(0),fGTIndex(0), fTrackBuffSize(19000),
553  fHistodPhiSdEtaSElectronProtonR125RS(0),
554  fHistodPhiSdEtaSElectronProtonR125WS(0),
555  fHistodPhiSdEtaSElectronProtonR125RSMix(0),
556  fHistodPhiSdEtaSElectronProtonR125WSMix(0),
557  fHistodPhiSdEtaSElectronPionR125RS(0),
558  fHistodPhiSdEtaSElectronPionR125WS(0),
559  fHistodPhiSdEtaSElectronPionR125RSMix(0),
560  fHistodPhiSdEtaSElectronPionR125WSMix(0),
561  fHistodPhiSdEtaSElectronBachelorR125RS(0),
562  fHistodPhiSdEtaSElectronBachelorR125WS(0),
563  fHistodPhiSdEtaSElectronBachelorR125RSMix(0),
564  fHistodPhiSdEtaSElectronBachelorR125WSMix(0),
565  fDoEventMixing(0),
566  fMixWithoutConversionFlag(kTRUE),
567  fNumberOfEventsForMixing (5),
568  fNzVtxBins (0),
569  fNCentBins (0),
570  fNOfPools(1),
571  fEventBuffer(0x0),
572  fEventInfo(0x0),
573  fElectronTracks(0x0),
574  fCascadeTracks1(0x0),
575  fCascadeTracks2(0x0),
576  fElectronCutVarsArray(0x0),
577  fCascadeCutVarsArray1(0x0),
578  fCascadeCutVarsArray2(0x0)
579 {
580  //
581  // Constructor. Initialization of Inputs and Outputs
582  //
583  Info("AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Constructor");
584 
585  for(Int_t i=0;i<23;i++){
586  fHistoElePtvsCutVarsRS[i] = 0;
587  fHistoElePtvsCutVarsWS[i] = 0;
589  }
590  for(Int_t i=0;i<8;i++){
592  }
593 
594  DefineOutput(1,TList::Class()); //conters
595  DefineOutput(2,TList::Class());
596  DefineOutput(3,TList::Class()); //conters
597  DefineOutput(4,TTree::Class()); //My private output
598  DefineOutput(5,TTree::Class()); //My private output
599  DefineOutput(6,TTree::Class()); //My private output
600  DefineOutput(7,TTree::Class()); //My private output
601  DefineOutput(8,AliNormalizationCounter::Class());
602  DefineOutput(9,TTree::Class()); //My private output
603  DefineOutput(10,TTree::Class()); //My private output
604  DefineOutput(11,TTree::Class()); //My private output
605  DefineOutput(12,TTree::Class()); //My private output
606 }
607 
608 //___________________________________________________________________________
610  //
611  // destructor
612  //
613  Info("~AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Destructor");
614 
615  if (fOutput) {
616  delete fOutput;
617  fOutput = 0;
618  }
619 
620  if (fOutputAll) {
621  delete fOutputAll;
622  fOutputAll = 0;
623  }
624 
625  if (fListCuts) {
626  delete fListCuts;
627  fListCuts = 0;
628  }
629 
630 
631  if (fAnalCuts) {
632  delete fAnalCuts;
633  fAnalCuts = 0;
634  }
635 
636  if (fVariablesTree) {
637  delete fVariablesTree;
638  fVariablesTree = 0;
639  }
640  if (fEleVariablesTree) {
641  delete fEleVariablesTree;
642  fEleVariablesTree = 0;
643  }
644  if (fCascVariablesTree) {
645  delete fCascVariablesTree;
646  fCascVariablesTree = 0;
647  }
648  if (fMCVariablesTree) {
649  delete fMCVariablesTree;
650  fMCVariablesTree = 0;
651  }
652  if (fMCEleVariablesTree) {
653  delete fMCEleVariablesTree;
655  }
656  if (fMCCascVariablesTree) {
657  delete fMCCascVariablesTree;
659  }
663  }
667  }
668  if(fCounter){
669  delete fCounter;
670  fCounter = 0;
671  }
672 
673  if(fElectronTracks) fElectronTracks->Delete();
674  delete fElectronTracks;
675  if(fCascadeTracks1) fCascadeTracks1->Delete();
676  delete fCascadeTracks1;
677  if(fCascadeTracks2) fCascadeTracks2->Delete();
678  delete fCascadeTracks2;
679  if(fEventBuffer){
680  for(Int_t i=0; i<fNOfPools; i++) delete fEventBuffer[i];
681  delete fEventBuffer;
682  }
683  delete fEventInfo;
684 
686  delete fElectronCutVarsArray;
688  delete fCascadeCutVarsArray1;
690  delete fCascadeCutVarsArray2;
691 
692  if (fGTI)
693  delete[] fGTI;
694  fGTI=0;
695  if (fGTIndex)
696  delete[] fGTIndex;
697  fGTIndex=0;
698 }
699 
700 //_________________________________________________
702  //
703  // Initialization
704  //
705  //
706 
707  fIsEventSelected=kFALSE;
708 
709  if (fDebug > 1) AliInfo("Init");
710 
711  fListCuts = new TList();
712  fListCuts->SetOwner();
713  fListCuts->SetName("ListCuts");
715  PostData(2,fListCuts);
716 
717  return;
718 }
719 
720 //_________________________________________________
722 {
723  //
724  // UserExec
725  //
726 
727  if (!fInputEvent) {
728  AliError("NO EVENT FOUND!");
729  return;
730  }
731  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
732 
733  fCEvents->Fill(1);
735 
736  //------------------------------------------------
737  // First check if the event has proper B
738  //------------------------------------------------
739  fBzkG = (Double_t)aodEvent->GetMagneticField();
740  AliKFParticle::SetField(fBzkG);
741  if (TMath::Abs(fBzkG)<0.001) {
742  return;
743  }
744  fCEvents->Fill(2);
745 
748 
749  //------------------------------------------------
750  // MC analysis setting
751  //------------------------------------------------
752  TClonesArray *mcArray = 0;
753  AliAODMCHeader *mcHeader=0;
754  if (fUseMCInfo) {
755  // MC array need for maching
756  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
757  if (!mcArray) {
758  AliError("Could not find Monte-Carlo in AOD");
759  return;
760  }
761  fCEvents->Fill(6); // in case of MC events
762 
763  // load MC header
764  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
765  if (!mcHeader) {
766  AliError("AliAnalysisTaskSEXic2eleXifromAODtracks::UserExec: MC header branch not found!\n");
767  return;
768  }
769  fCEvents->Fill(7); // in case of MC events
770 
771  Double_t zMCVertex = mcHeader->GetVtxZ();
772  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
773  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
774  return;
775  } else {
776  fCEvents->Fill(17); // in case of MC events
777  }
778  if ((TMath::Abs(zMCVertex) < fAnalCuts->GetMaxVtxZ()) && (!fAnalCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnalCuts->IsEventRejectedDueToTrigger())) {
779  Bool_t selevt = MakeMCAnalysis(mcArray);
780  if(!selevt) return;
781  }
782  }
783 
784  //------------------------------------------------
785  // Event selection
786  //------------------------------------------------
787  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
788  if (!fVtx1) return;
789 
790  Double_t pos[3],cov[6];
791  fVtx1->GetXYZ(pos);
792  fVtx1->GetCovarianceMatrix(cov);
793  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
794  fVtxZ = pos[2];
795 
796  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
797  Bool_t fIsPhysSelNotOK = fAnalCuts->IsEventRejectedDuePhysicsSelection();
798  Bool_t fIsNoVertex = fAnalCuts->IsEventRejectedDueToNotRecoVertex();
799  if(!fIsTriggerNotOK && !fIsPhysSelNotOK && !fIsNoVertex && fabs(fVtx1->GetZ())<fAnalCuts->GetMaxVtxZ()) fCEvents->Fill(3);
800  if(!fIsEventSelected) {
801  delete fV1;
802  return;
803  }
804  fCEvents->Fill(4);
805 
806  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
807  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
808  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
809  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
810  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
812  if(fIsMB) fHTrigger->Fill(1);
813  if(fIsSemi) fHTrigger->Fill(2);
814  if(fIsCent) fHTrigger->Fill(3);
815  if(fIsINT7) fHTrigger->Fill(4);
816  if(fIsEMC7) fHTrigger->Fill(5);
817  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
818  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
819  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
820  if(fIsMB&fIsCent) fHTrigger->Fill(11);
821  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
822 
823  if(fUseCentralityV0M){
824  AliCentrality *cent = aodEvent->GetCentrality();
825  fCentrality = cent->GetCentralityPercentile("V0M");
826  }else{
827  fCentrality = 1.;
828  }
829  if(fCentrality<0.||fCentrality>100.-0.0000001) {
830  delete fV1;
831  return;
832  }
833  fHCentrality->Fill(fCentrality);
834  fRunNumber = aodEvent->GetRunNumber();
835 
836  Int_t runnumber_offset = 0;
837  Int_t runnumber = aodEvent->GetRunNumber();
838  if(runnumber<=131000&&runnumber>=114000){
839  runnumber_offset = 114000;//lhc10bcde
840  }else if(runnumber<=196000&&runnumber>=195000){
841  runnumber_offset = 195000;//lhc13bc
842  }else if(runnumber<=170593&&runnumber>=167902){
843  runnumber_offset = 167902;//lhc11h
844  }
845  fHistonEvtvsRunNumber->Fill(runnumber-runnumber_offset,1.);
846 
847  //------------------------------------------------
848  // Check if the event has v0 candidate
849  //------------------------------------------------
850  //Int_t nv0 = aodEvent->GetNumberOfV0s();
851  fCEvents->Fill(5);
852 
853 
854  //------------------------------------------------
855  // Main analysis done in this function
856  //------------------------------------------------
859  MakeAnalysis(aodEvent,mcArray);
860 
861 
862  PostData(1,fOutput);
863  PostData(3,fOutputAll);
864  PostData(4,fVariablesTree);
865  PostData(5,fEleVariablesTree);
866  PostData(6,fCascVariablesTree);
867  PostData(7,fMCVariablesTree);
868  PostData(8,fCounter);
869  PostData(9,fMCEleVariablesTree);
870  PostData(10,fMCCascVariablesTree);
871  PostData(11,fMCGenPairVariablesTree);
872  PostData(12,fCorrelationVariablesTree);
873 
874  fIsEventSelected=kFALSE;
875 
876  delete fV1;
877  return;
878 }
879 
880 //________________________________________ terminate ___________________________
882 {
883  // The Terminate() function is the last function to be called during
884  // a query. It always runs on the client, it can be used to present
885  // the results graphically or save the results to file.
886 
887  //AliInfo("Terminate","");
888  AliAnalysisTaskSE::Terminate();
889 
890  fOutput = dynamic_cast<TList*> (GetOutputData(1));
891  if (!fOutput) {
892  AliError("fOutput not available");
893  return;
894  }
895 
896  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
897  if (!fOutputAll) {
898  AliError("fOutputAll not available");
899  return;
900  }
901 
902  return;
903 }
904 
905 //___________________________________________________________________________
907 {
908  //
909  // UserCreateOutputObject
910  //
911  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
912 
913  //------------------------------------------------
914  // output object setting
915  //------------------------------------------------
916  fOutput = new TList();
917  fOutput->SetOwner();
918  fOutput->SetName("chist0");
919  DefineGeneralHistograms(); // define general histograms
920  PostData(1,fOutput);
921 
922  fOutputAll = new TList();
923  fOutputAll->SetOwner();
924  fOutputAll->SetName("anahisto");
925  DefineAnalysisHistograms(); // define general histograms
926  PostData(3,fOutputAll);
927 
929  PostData(4,fVariablesTree);
930 
932  PostData(5,fEleVariablesTree);
933 
935  PostData(6,fCascVariablesTree);
936 
938  PostData(7,fMCVariablesTree);
939 
941  PostData(9,fMCEleVariablesTree);
942 
944  PostData(10,fMCCascVariablesTree);
945 
947  PostData(11,fMCGenPairVariablesTree);
948 
950  PostData(12,fCorrelationVariablesTree);
951 
952 
953  //Counter for Normalization
954  TString normName="NormalizationCounter";
955  AliAnalysisDataContainer *cont = GetOutputSlot(8)->GetContainer();
956  if(cont)normName=(TString)cont->GetName();
957  fCounter = new AliNormalizationCounter(normName.Data());
958  fCounter->Init();
959  PostData(8,fCounter);
960 
961  if(fDoEventMixing){
962  fElectronTracks = new TObjArray();
963  fElectronTracks->SetOwner();
964  fCascadeTracks1 = new TObjArray();
965  fCascadeTracks1->SetOwner();
966  fCascadeTracks2 = new TObjArray();
967  fCascadeTracks2->SetOwner();
968  fElectronCutVarsArray = new TObjArray();
969  fElectronCutVarsArray->SetOwner();
970  fCascadeCutVarsArray1 = new TObjArray();
971  fCascadeCutVarsArray1->SetOwner();
972  fCascadeCutVarsArray2 = new TObjArray();
973  fCascadeCutVarsArray2->SetOwner();
974 
976  fEventBuffer = new TTree*[fNOfPools];
977  for(Int_t i=0; i<fNOfPools; i++){
978  fEventBuffer[i]=new TTree(Form("EventBuffer_%d",i), "Temporary buffer for event mixing");
979  fEventBuffer[i]->Branch("zVertex", &fVtxZ);
980  fEventBuffer[i]->Branch("centrality", &fCentrality);
981  fEventBuffer[i]->Branch("eventInfo", "TObjString",&fEventInfo);
982  fEventBuffer[i]->Branch("c1array", "TObjArray", &fCascadeTracks1);
983  fEventBuffer[i]->Branch("c2array", "TObjArray", &fCascadeTracks2);
984  fEventBuffer[i]->Branch("c1varsarray", "TObjArray", &fCascadeCutVarsArray1);
985  fEventBuffer[i]->Branch("c2varsarray", "TObjArray", &fCascadeCutVarsArray2);
986  }
987  }
988 
989  fGTI = new AliAODTrack *[fTrackBuffSize]; // Array of pointers
990  fGTIndex = new Int_t [fTrackBuffSize]; // Array of index
991 
992  return;
993 }
994 
995 //-------------------------------------------------------------------------------
997 (
998  AliAODEvent *aodEvent, TClonesArray *mcArray
999  )
1000 {
1001  //
1002  // Main Analysis part
1003  //
1004  //------------------------------------------------
1005  // Select good track before hand to save time
1006  //------------------------------------------------
1007  if(fDoEventMixing && fElectronTracks) fElectronTracks->Delete();
1008  if(fDoEventMixing && fCascadeTracks1) fCascadeTracks1->Delete();
1009  if(fDoEventMixing && fCascadeTracks2) fCascadeTracks2->Delete();
1010  if(fDoEventMixing && fCascadeCutVarsArray1) fCascadeCutVarsArray1->Delete();
1011  if(fDoEventMixing && fCascadeCutVarsArray2) fCascadeCutVarsArray2->Delete();
1012 
1013  ResetGlobalTrackReference();
1014  // ..and set it
1015  for (Int_t iTrack=0;iTrack<aodEvent->GetNumberOfTracks();iTrack++){
1016  // cast needed since the event now returns AliVTrack instead of AliAODTrack
1017  AliAODTrack *track = dynamic_cast<AliAODTrack *>(aodEvent->GetTrack(iTrack));
1018  if (!track) continue;
1019 
1020  // Store the reference of the global tracks
1021  StoreGlobalTrackReference(track,iTrack);
1022  }
1023 
1024 
1025  Int_t nCascs= aodEvent->GetNumberOfCascades();
1026  Int_t nTracks= aodEvent->GetNumberOfTracks();
1027 
1028  Bool_t seleTrkFlags[nTracks];
1029  Int_t nSeleTrks=0;
1030  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags,mcArray);
1031 
1032  Bool_t seleCascFlags[nCascs];
1033  Int_t nSeleCasc=0;
1034  SelectCascade(aodEvent,nCascs,nSeleCasc,seleCascFlags,mcArray);
1035 
1036  Int_t runnumber_offset = 0;
1037  Int_t runnumber = aodEvent->GetRunNumber();
1038  if(runnumber<=131000&&runnumber>=114000){
1039  runnumber_offset = 114000;//lhc10bcde
1040  }else if(runnumber<=196000&&runnumber>=195000){
1041  runnumber_offset = 195000;//lhc13bc
1042  }else if(runnumber<=170593&&runnumber>=167902){
1043  runnumber_offset = 167902;//lhc11h
1044  }
1045  fHistonElevsRunNumber->Fill(runnumber-runnumber_offset,nSeleTrks);
1046  fHistonXivsRunNumber->Fill(runnumber-runnumber_offset,nSeleCasc);
1047 
1048  //------------------------------------------------
1049  // Cascade loop
1050  //------------------------------------------------
1051  for (Int_t icasc = 0; icasc<nCascs; icasc++) {
1052  if(!seleCascFlags[icasc]) continue;
1053  AliAODcascade *casc = aodEvent->GetCascade(icasc);
1054  if(!casc) continue;
1055 
1056  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
1057  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
1058  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
1059 
1060  //------------------------------------------------
1061  // track loop
1062  //------------------------------------------------
1063  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
1064  if(!seleTrkFlags[itrk]) continue;
1065  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
1066  //if(trk->GetID()<0) continue;
1067 
1068  //if(!fAnalCuts->SelectWithRoughCuts(v0,trk)) continue;
1069 
1070  //TPC only track (BIT 7) does not have PID information
1071  //In addition to that, TPC only tracks does not have good DCA resolution
1072  //(according to femtoscopy code)
1073  AliAODTrack *trkpid = 0;
1074  if(fAnalCuts->GetProdAODFilterBit()==7){
1075  trkpid = fGTI[-trk->GetID()-1];
1076  }else{
1077  trkpid = trk;
1078  }
1079 
1080  Int_t cpid = cptrack->GetID();
1081  Int_t cnid = cntrack->GetID();
1082  Int_t cbid = cbtrack->GetID();
1083  Int_t lpid = trkpid->GetID();
1084  if((cpid==lpid)||(cnid==lpid)||(cbid==lpid)) continue;
1085 
1086  AliAODVertex *secVert = ReconstructSecondaryVertex(casc,trk,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
1087  if(!secVert) continue;
1088 
1089  AliAODRecoCascadeHF *exobj = MakeCascadeHF(casc,trk,trkpid,aodEvent,secVert);
1090  if(!exobj) {
1091  continue;
1092  }
1093 
1094  FillROOTObjects(exobj, casc,trk,trkpid,aodEvent,mcArray);
1095 
1096  exobj->GetSecondaryVtx()->RemoveDaughters();
1097  exobj->UnsetOwnPrimaryVtx();
1098  delete exobj;exobj=NULL;
1099  delete secVert;
1100  }
1101  }
1102 
1103  if(fDoEventMixing){
1104  fEventInfo->SetString(Form("Ev%d_esd%d_E%d_C%d",AliAnalysisManager::GetAnalysisManager()->GetNcalls(),((AliAODHeader*)aodEvent->GetHeader())->GetEventNumberESDFile(),fElectronTracks->GetEntries(),fCascadeTracks1->GetEntries()+fCascadeTracks2->GetEntries()));
1105  Int_t ind=GetPoolIndex(fVtxZ,fCentrality);
1106  if(ind>=0 && ind<fNOfPools){
1107  if(fEventBuffer[ind]->GetEntries() >= fNumberOfEventsForMixing){
1108  DoEventMixingWithPools(ind);
1109  if(fEventBuffer[ind]->GetEntries() >= 20*fNumberOfEventsForMixing){
1110  ResetPool(ind);
1111  }
1112  }
1113  fEventBuffer[ind]->Fill();
1114  }
1115  }
1116 }
1117 
1118 
1121 {
1122  //
1123  // Define tree variables
1124  //
1125 
1126  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
1127  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
1128  Int_t nVar = 92;
1129  fCandidateVariables = new Float_t [nVar];
1130  TString * fCandidateVariableNames = new TString[nVar];
1131 
1132  fCandidateVariableNames[ 0]="Centrality";
1133  fCandidateVariableNames[ 1]="InvMassEleXi";
1134  fCandidateVariableNames[ 2]="EleXiPt";
1135  fCandidateVariableNames[ 3]="EleXiPx";
1136  fCandidateVariableNames[ 4]="EleXiPy";
1137  fCandidateVariableNames[ 5]="EleXiPz";
1138  fCandidateVariableNames[ 6]="ElePx";
1139  fCandidateVariableNames[ 7]="ElePy";
1140  fCandidateVariableNames[ 8]="ElePz";
1141  fCandidateVariableNames[ 9]="XiPx";
1142  fCandidateVariableNames[10]="XiPy";
1143  fCandidateVariableNames[11]="XiPz";
1144  fCandidateVariableNames[12]="XiCharge";
1145  fCandidateVariableNames[13]="MassXi";
1146  fCandidateVariableNames[14]="MassLambda";
1147  fCandidateVariableNames[15]="Eled0";
1148  fCandidateVariableNames[16]="Xid0";
1149  fCandidateVariableNames[17]="nSigmaTPCele";
1150  fCandidateVariableNames[18]="nSigmaTOFele";
1151  fCandidateVariableNames[19]="nSigmaTPCpr_etrk";
1152  fCandidateVariableNames[20]="nSigmaTOFpr_etrk";
1153  fCandidateVariableNames[21]="nSigmaTPCka_etrk";
1154  fCandidateVariableNames[22]="nSigmaTOFka_etrk";
1155  fCandidateVariableNames[23]="nSigmaTPCv0pr";
1156  fCandidateVariableNames[24]="nSigmaTOFv0pr";
1157  fCandidateVariableNames[25]="nSigmaTPCv0pi";
1158  fCandidateVariableNames[26]="nSigmaTOFv0pi";
1159  fCandidateVariableNames[27]="nSigmaTPCbachpi";
1160  fCandidateVariableNames[28]="nSigmaTOFbachpi";
1161  fCandidateVariableNames[29]="EleCharge";
1162  fCandidateVariableNames[30]="Mixing";
1163  fCandidateVariableNames[31]="DcaXiDaughters";
1164  fCandidateVariableNames[32]="DcaV0Daughters";
1165  fCandidateVariableNames[33]="DecayLengthXi";
1166  fCandidateVariableNames[34]="CosPointingAngleXi";
1167  fCandidateVariableNames[35]="DcaV0toPrimVertex";
1168  fCandidateVariableNames[36]="DcaPostoPrimVertex";
1169  fCandidateVariableNames[37]="DcaNegtoPrimVertex";
1170  fCandidateVariableNames[38]="DcaBachtoPrimVertex";
1171  fCandidateVariableNames[39]="DecayLengthV0";
1172  fCandidateVariableNames[40]="CosPointingAngleV0";
1173 
1174  fCandidateVariableNames[41]="mcpdgxic";
1175  fCandidateVariableNames[42]="mclabxic";
1176  fCandidateVariableNames[43]="mcxicpx";
1177  fCandidateVariableNames[44]="mcxicpy";
1178  fCandidateVariableNames[45]="mcxicpz";
1179  fCandidateVariableNames[46]="mcelepx";
1180  fCandidateVariableNames[47]="mcelepy";
1181  fCandidateVariableNames[48]="mcelepz";
1182  fCandidateVariableNames[49]="mccascpx";
1183  fCandidateVariableNames[50]="mccascpy";
1184  fCandidateVariableNames[51]="mccascpz";
1185 
1186  fCandidateVariableNames[52]="mcpdgele";
1187  fCandidateVariableNames[53]="mcpdgcasc";
1188  fCandidateVariableNames[54]="mcpdgmomele";
1189  fCandidateVariableNames[55]="mcpdgmomcasc";
1190  fCandidateVariableNames[56]="mcpdggrmomele";
1191  fCandidateVariableNames[57]="mcpdggrmomcasc";
1192  fCandidateVariableNames[58]="mcngenele";
1193  fCandidateVariableNames[59]="mcngencasc";
1194 
1195  fCandidateVariableNames[60]="nSigmaTPCpi_etrk";
1196  fCandidateVariableNames[61]="nSigmaTOFpi_etrk";
1197 
1198  fCandidateVariableNames[62]="V0PosPx";
1199  fCandidateVariableNames[63]="V0PosPy";
1200  fCandidateVariableNames[64]="V0PosPz";
1201  fCandidateVariableNames[65]="V0NegPx";
1202  fCandidateVariableNames[66]="V0NegPy";
1203  fCandidateVariableNames[67]="V0NegPz";
1204  fCandidateVariableNames[68]="V0VertX";
1205  fCandidateVariableNames[69]="V0VertY";
1206  fCandidateVariableNames[70]="V0VertZ";
1207  fCandidateVariableNames[71]="BachPx";
1208  fCandidateVariableNames[72]="BachPy";
1209  fCandidateVariableNames[73]="BachPz";
1210  fCandidateVariableNames[74]="XiVertX";
1211  fCandidateVariableNames[75]="XiVertY";
1212  fCandidateVariableNames[76]="XiVertZ";
1213  fCandidateVariableNames[77]="PrimVertX";
1214  fCandidateVariableNames[78]="PrimVertY";
1215  fCandidateVariableNames[79]="PrimVertZ";
1216 
1217  fCandidateVariableNames[80]="MassOmega";
1218 
1219  fCandidateVariableNames[81]= "EleITSMatch";
1220  fCandidateVariableNames[82]= "BachITSMatch";
1221  fCandidateVariableNames[83]= "V0PosITSMatch";
1222  fCandidateVariableNames[84]= "V0NegITSMatch";
1223 
1224  fCandidateVariableNames[85]= "TPCNclsF";
1225  fCandidateVariableNames[86]= "TPCNcls";
1226  fCandidateVariableNames[87]= "TPCNclsS";
1227  fCandidateVariableNames[88]= "IsXiPeakReagion";
1228 
1229 
1230  fCandidateVariableNames[89]="MagneticField";
1231  fCandidateVariableNames[90]="EvNumber";
1232  fCandidateVariableNames[91]="RunNumber";
1233 
1234  for (Int_t ivar=0; ivar<nVar; ivar++) {
1235  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1236  }
1237 
1238  return;
1239 }
1240 
1242 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *exobj, AliAODcascade *casc, AliAODTrack *trk, AliAODTrack *trkpid, AliAODEvent *event, TClonesArray *mcArray)
1243 {
1244  //
1245  // Fill histograms or tree depending on fWriteVariableTree
1246  //
1247  if(!trk) return;
1248  if(!trkpid) return;
1249  if(!casc) return;
1250 
1251  for(Int_t i=0;i<92;i++){
1252  fCandidateVariables[i] = -9999.;
1253  }
1254 
1255 
1256  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
1257  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
1258  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
1259 // if(cptrack->Charge()<0 && cntrack->Charge()>0){
1260 // cptrack = (AliAODTrack*)(casc->GetDaughter(1));
1261 // cntrack = (AliAODTrack*)(casc->GetDaughter(0));
1262 // }
1263 // Double_t d0z0[2],covd0z0[3];
1264 // cptrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1265 // cntrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1266 // cbtrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1267 
1268  Double_t pxe = exobj->PxProng(0);
1269  Double_t pye = exobj->PyProng(0);
1270  Double_t pze = exobj->PzProng(0);
1271  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
1272  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
1273  Double_t pxv = exobj->PxProng(1);
1274  Double_t pyv = exobj->PyProng(1);
1275  Double_t pzv = exobj->PzProng(1);
1276  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
1277  Double_t Ev = sqrt(momv*momv+1.32171*1.32171);
1278  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
1279  Double_t Esum = Ee + Ev;
1280 
1281  Double_t uxe = pxe/mome;
1282  Double_t uye = pye/mome;
1283  Double_t uze = pze/mome;
1284  Double_t lf = -2.*(pxv*uxe+pyv*uye+pzv*uze);
1285  Double_t pxv_flip = pxv + lf * uxe;
1286  Double_t pyv_flip = pyv + lf * uye;
1287  Double_t pzv_flip = pzv + lf * uze;
1288  Double_t pxsum_flip = pxe + pxv_flip;
1289  Double_t pysum_flip = pye + pyv_flip;
1290  Double_t pzsum_flip = pze + pzv_flip;
1291  Double_t mexi_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
1292  Double_t ptexi_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
1293 
1294  Double_t minmass_ee = 9999.;
1295  Bool_t isconv = fAnalCuts->TagConversions(trk,fGTIndex,(AliAODEvent*)event,event->GetNumberOfTracks(),minmass_ee);
1296  Double_t minmasslike_ee = 9999.;
1297  Bool_t isconv_like = fAnalCuts->TagConversionsSameSign(trk,fGTIndex,(AliAODEvent*)event,event->GetNumberOfTracks(),minmasslike_ee);
1298 
1299 
1300  Double_t posVtx[3] = {0.,0.,0.};
1301  fVtx1->GetXYZ(posVtx);
1302 
1304  UInt_t pdgdg[2]={11,3312};
1305  fCandidateVariables[ 1] = exobj->InvMass(2,pdgdg);
1306  fCandidateVariables[ 2] = exobj->Pt();
1307  fCandidateVariables[ 3] = exobj->Px();
1308  fCandidateVariables[ 4] = exobj->Py();
1309  fCandidateVariables[ 5] = exobj->Pz();
1310  fCandidateVariables[ 6] = exobj->PxProng(0);
1311  fCandidateVariables[ 7] = exobj->PyProng(0);
1312  fCandidateVariables[ 8] = exobj->PzProng(0);
1313  fCandidateVariables[ 9] = exobj->PxProng(1);
1314  fCandidateVariables[10] = exobj->PyProng(1);
1315  fCandidateVariables[11] = exobj->PzProng(1);
1316  fCandidateVariables[12] = casc->ChargeXi();
1317  fCandidateVariables[13] = casc->MassXi();
1318  if(casc->ChargeXi()<0)
1319  fCandidateVariables[14] = casc->MassLambda();
1320  else
1321  fCandidateVariables[14] = casc->MassAntiLambda();
1322  fCandidateVariables[15] = exobj->Getd0Prong(0);
1323  fCandidateVariables[16] = exobj->Getd0Prong(1);
1324 
1325  Double_t nSigmaTPCele = -9999.;
1326  Double_t nSigmaTOFele = -9999.;
1327  if(fAnalCuts->GetIsUsePID())
1328  {
1329  nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kElectron);
1330  nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kElectron);
1331  fCandidateVariables[17] = nSigmaTPCele;
1332  fCandidateVariables[18] = nSigmaTOFele;
1333 
1334  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kProton);
1335  Double_t nSigmaTOFpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kProton);
1336  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kKaon);
1337  Double_t nSigmaTOFka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kKaon);
1338  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kPion);
1339  Double_t nSigmaTOFpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kPion);
1340  fCandidateVariables[19] = nSigmaTPCpr_etrk;
1341  fCandidateVariables[20] = nSigmaTOFpr_etrk;
1342  fCandidateVariables[21] = nSigmaTPCka_etrk;
1343  fCandidateVariables[22] = nSigmaTOFka_etrk;
1344  fCandidateVariables[60] = nSigmaTPCpi_etrk;
1345  fCandidateVariables[61] = nSigmaTOFpi_etrk;
1346  }
1347 
1348  Double_t nSigmaTPCv0pr=-9999.;
1349  Double_t nSigmaTOFv0pr=-9999.;
1350  Double_t nSigmaTPCv0pi=-9999.;
1351  Double_t nSigmaTOFv0pi=-9999.;
1352  Double_t nSigmaTPCbachpi=-9999.;
1353  Double_t nSigmaTOFbachpi=-9999.;
1355  {
1356  if(casc->ChargeXi()>0){
1357  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
1358  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
1359  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
1360  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
1361  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1362  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1363  }else{
1364  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
1365  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
1366  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
1367  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
1368  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1369  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1370  }
1371  fCandidateVariables[23] = nSigmaTPCv0pr;
1372  fCandidateVariables[24] = nSigmaTOFv0pr;
1373  fCandidateVariables[25] = nSigmaTPCv0pi;
1374  fCandidateVariables[26] = nSigmaTOFv0pi;
1375  fCandidateVariables[27] = nSigmaTPCbachpi;
1376  fCandidateVariables[28] = nSigmaTOFbachpi;
1377  }
1378  fCandidateVariables[29] = trk->Charge();
1379  fCandidateVariables[30] = 0;
1380  fCandidateVariables[31] = casc->DcaXiDaughters();
1381  fCandidateVariables[32] = casc->DcaV0Daughters();
1382  fCandidateVariables[33] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
1383  fCandidateVariables[34] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1384  fCandidateVariables[35] = casc->DcaV0ToPrimVertex();
1385  fCandidateVariables[36] = casc->DcaPosToPrimVertex();
1386  fCandidateVariables[37] = casc->DcaNegToPrimVertex();
1387  fCandidateVariables[38] = casc->DcaBachToPrimVertex();
1388  fCandidateVariables[39] = casc->DecayLengthV0();
1389  fCandidateVariables[40] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1390 
1391  AliAODMCParticle *mcxic = 0;
1392  AliAODMCParticle *mcele = 0;
1393  AliAODMCParticle *mccasc = 0;
1394  Int_t mclabxic = 0;
1395  Int_t mcpdgele_array[100];
1396  Int_t mcpdgcasc_array[100];
1397  Int_t mclabelele_array[100];
1398  Int_t mclabelcasc_array[100];
1399  Int_t mcngen_ele = -9999;
1400  Int_t mcngen_casc = -9999;
1401 
1402  if(fUseMCInfo && mcArray){
1403  mclabxic = MatchToMC(exobj,mcArray,mcpdgele_array, mcpdgcasc_array,mclabelele_array,mclabelcasc_array,mcngen_ele,mcngen_casc);
1404 
1405  if(mclabxic>-1){
1406  mcxic = (AliAODMCParticle*) mcArray->At(mclabxic);
1407  if(mclabelele_array[0]>=0)
1408  mcele = (AliAODMCParticle*) mcArray->At(mclabelele_array[0]);
1409  if(mclabelcasc_array[0]>=0)
1410  mccasc = (AliAODMCParticle*) mcArray->At(mclabelcasc_array[0]);
1411  if(mcxic){
1412  fCandidateVariables[41] = mcxic->GetPdgCode();
1413  fCandidateVariables[42] = mcxic->Label();
1414  fCandidateVariables[43] = mcxic->Px();
1415  fCandidateVariables[44] = mcxic->Py();
1416  fCandidateVariables[45] = mcxic->Pz();
1417  }
1418  if(mcele){
1419  fCandidateVariables[46] = mcele->Px();
1420  fCandidateVariables[47] = mcele->Py();
1421  fCandidateVariables[48] = mcele->Pz();
1422  }
1423  if(mccasc){
1424  fCandidateVariables[49] = mccasc->Px();
1425  fCandidateVariables[50] = mccasc->Py();
1426  fCandidateVariables[51] = mccasc->Pz();
1427  }
1428  }
1429  fCandidateVariables[52] = mcpdgele_array[0];
1430  fCandidateVariables[53] = mcpdgcasc_array[0];
1431  fCandidateVariables[54] = mcpdgele_array[1];
1432  fCandidateVariables[55] = mcpdgcasc_array[1];
1433  fCandidateVariables[56] = mcpdgele_array[2];
1434  fCandidateVariables[57] = mcpdgcasc_array[2];
1435  fCandidateVariables[58] = mcngen_ele;
1436  fCandidateVariables[59] = mcngen_casc;
1437  }
1438  fCandidateVariables[62] = casc->MomPosX();
1439  fCandidateVariables[63] = casc->MomPosY();
1440  fCandidateVariables[64] = casc->MomPosZ();
1441  fCandidateVariables[65] = casc->MomNegX();
1442  fCandidateVariables[66] = casc->MomNegY();
1443  fCandidateVariables[67] = casc->MomNegZ();
1444  fCandidateVariables[68] = casc->DecayVertexV0X();
1445  fCandidateVariables[69] = casc->DecayVertexV0Y();
1446  fCandidateVariables[70] = casc->DecayVertexV0Z();
1447  fCandidateVariables[71] = casc->MomBachX();
1448  fCandidateVariables[72] = casc->MomBachY();
1449  fCandidateVariables[73] = casc->MomBachZ();
1450  fCandidateVariables[74] = casc->DecayVertexXiX();
1451  fCandidateVariables[75] = casc->DecayVertexXiY();
1452  fCandidateVariables[76] = casc->DecayVertexXiZ();
1453  fCandidateVariables[77] = fVtx1->GetX();
1454  fCandidateVariables[78] = fVtx1->GetY();
1455  fCandidateVariables[79] = fVtx1->GetZ();
1456 
1457  fCandidateVariables[80] = casc->MassOmega();
1458 
1459  if(trk) fCandidateVariables[81] = trk->GetITSClusterMap();
1460  if(cbtrack) fCandidateVariables[82] = cbtrack->GetITSClusterMap();
1461  if(cptrack) fCandidateVariables[83] = cptrack->GetITSClusterMap();
1462  if(cntrack) fCandidateVariables[84] = cntrack->GetITSClusterMap();
1463 
1464  fCandidateVariables[85] = trk->GetTPCNclsF();
1465  fCandidateVariables[86] = trk->GetTPCNcls();
1466  fCandidateVariables[87] = trk->GetTPCnclsS();
1468 
1469  fCandidateVariables[89] = fBzkG;
1472 
1473 
1474  if(fWriteVariableTree)
1475  fVariablesTree->Fill();
1476 
1477  Double_t dphis_ele_pr, detas_ele_pr,dphis_ele_pi, detas_ele_pi, dphis_ele_bach, detas_ele_bach;
1478  dphis_ele_pr = 9999.;detas_ele_pr = 9999.;dphis_ele_pi = 9999.;detas_ele_pi = 9999.;dphis_ele_bach=9999.;detas_ele_bach=9999.;
1479  //fAnalCuts->GetdPhiSdEtaSR125(trk,cptrack,cntrack,cbtrack,fBzkG,posVtx, dphis_ele_pr,detas_ele_pr,dphis_ele_pi,detas_ele_pi, dphis_ele_bach, detas_ele_bach);
1480 
1481 
1482  Double_t cont[4];
1483  cont[0] = exobj->InvMass(2,pdgdg);
1484  cont[1] = exobj->Pt();
1485  cont[2] = exobj->Getd0Prong(0)*trk->Charge();
1486  cont[3] = fCentrality;
1487  fHistoEleXiMass->Fill(cont);
1488 
1489  Double_t cont_flip[4];
1490  cont_flip[0] = mexi_flip;
1491  cont_flip[1] = ptexi_flip;
1492  cont_flip[2] = 0.0;
1493  cont_flip[3] = fCentrality;
1494 
1495  Double_t cont2[3];
1496  cont2[0] = exobj->InvMass(2,pdgdg);
1497  cont2[1] = trk->Pt();
1498  cont2[2] = fCentrality;
1499 
1500  Double_t cont_eleptvseta[3];
1501  cont_eleptvseta[0] = trk->Pt();
1502  cont_eleptvseta[1] = trk->Eta();
1503  cont_eleptvseta[2] = fCentrality;
1504 
1505  Double_t cont_eleptvsxipt[3];
1506  cont_eleptvsxipt[0] = trk->Pt();
1507  cont_eleptvsxipt[1] = sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY());
1508  cont_eleptvsxipt[2] = fCentrality;
1509 
1510  Double_t cont_eleptvsd0[3];
1511  cont_eleptvsd0[0] = trk->Pt();
1512  cont_eleptvsd0[1] = exobj->Getd0Prong(0)*trk->Charge();
1513  cont_eleptvsd0[2] = fCentrality;
1514 
1515  Double_t exobj_mass = exobj->InvMass(2,pdgdg);
1516  Double_t exobj_px = exobj->Px();
1517  Double_t exobj_py = exobj->Py();
1518  Double_t exobj_pz = exobj->Pz();
1519  Double_t exobj_E = sqrt(exobj_mass*exobj_mass+exobj_px*exobj_px+exobj_py*exobj_py+exobj_pz*exobj_pz);
1520  Double_t exobj_rap = 0.5*log((exobj_E+exobj_pz)/(exobj_E-exobj_pz));
1521 
1522  //
1523  // Old strategy only look at mass and pairpt
1524  //
1526  {
1527  if(trk->Charge()*casc->ChargeXi()<0){
1528  fHistoEleXiMassRS->Fill(cont);
1529  if(trk->Charge()>0) fHistoEleXiMassRS1->Fill(cont);
1530  else fHistoEleXiMassRS2->Fill(cont);
1531  fHistoEleXiMassvsElePtRS->Fill(cont2);
1532  if(trk->Charge()>0) fHistoEleXiMassvsElePtRS1->Fill(cont2);
1533  else fHistoEleXiMassvsElePtRS2->Fill(cont2);
1534  if(cont[0]<2.5){
1535  fHistoEleXiPtvsRapidityRS->Fill(exobj->Pt(),exobj_rap);
1536  fHistoElePtRS->Fill(trk->Pt(),fCentrality);
1537  fHistoElePtvsEtaRS->Fill(cont_eleptvseta);
1538  fHistoElePtvsXiPtRS->Fill(cont_eleptvsxipt);
1539  fHistoElePtvsd0RS->Fill(cont_eleptvsd0);
1540  for(Int_t ih=0;ih<23;ih++){
1541  Double_t cont_eleptvscutvars[3];
1542  cont_eleptvscutvars[0] = exobj->Pt();
1543  cont_eleptvscutvars[2] = fCentrality;
1544 
1545  if(ih==0){
1546  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1547  }else if(ih==1){
1548  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1549  }else if(ih==2){
1550  cont_eleptvscutvars[1] = nSigmaTPCele;
1551  }else if(ih==3){
1552  cont_eleptvscutvars[1] = nSigmaTOFele;
1553  }else if(ih==4){
1554  cont_eleptvscutvars[1] = trk->Eta();
1555  }else if(ih==5){
1556  cont_eleptvscutvars[1] = trk->GetITSNcls();
1557  }else if(ih==6){
1558  if(casc->ChargeXi()<0)
1559  cont_eleptvscutvars[1] = casc->MassLambda();
1560  else
1561  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1562  }else if(ih==7){
1563  cont_eleptvscutvars[1] = casc->MassXi();
1564  }else if(ih==8){
1565  Double_t lPosV0[3];
1566  lPosV0[0] = casc->DecayVertexV0X();
1567  lPosV0[1] = casc->DecayVertexV0Y();
1568  lPosV0[2] = casc->DecayVertexV0Z();
1569  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1570  }else if(ih==9){
1571  Double_t lPosXi[3];
1572  lPosXi[0] = casc->DecayVertexXiX();
1573  lPosXi[1] = casc->DecayVertexXiY();
1574  lPosXi[2] = casc->DecayVertexXiZ();
1575  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1576  }else if(ih==10){
1577  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1578  }else if(ih==11){
1579  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1580  }else if(ih==12){
1581  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1582  }else if(ih==13){
1583  if(casc->ChargeXi()<0.)
1584  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1585  else
1586  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1587  }else if(ih==14){
1588  if(casc->ChargeXi()>0.)
1589  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1590  else
1591  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1592  }else if(ih==15){
1593  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1594  }else if(ih==16){
1595  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1596  }else if(ih==17){
1597  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1598  }else if(ih==18){
1599  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1600  }else if(ih==19){
1601  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1602  }else if(ih==20){
1603  cont_eleptvscutvars[1] = casc->Eta();
1604  }else if(ih==21){
1605  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1606  }else if(ih==22){
1607  Double_t xipx = exobj->PxProng(1);
1608  Double_t xipy = exobj->PyProng(1);
1609  Double_t xipz = exobj->PzProng(1);
1610  Double_t epx = exobj->PxProng(0);
1611  Double_t epy = exobj->PyProng(0);
1612  Double_t epz = exobj->PzProng(0);
1613  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1614  }else{
1615  cont_eleptvscutvars[1] = -9999.;
1616  }
1617 
1618  fHistoElePtvsCutVarsRS[ih]->Fill(cont_eleptvscutvars);
1619  }
1620  }
1621  if(fUseMCInfo){
1622  if(mcxic){
1623  Int_t pdgcode = mcxic->GetPdgCode();
1624  cont2[1] = mcele->Pt();
1625  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgcasc_array[1])==4132){
1626  Int_t labmotherxic = mcxic->GetMother();
1627  Bool_t isbottomfd = kFALSE;
1628  if(labmotherxic>=0)
1629  {
1630  AliAODMCParticle *motherxic = (AliAODMCParticle*)mcArray->At(labmotherxic);
1631  Int_t pdgmotherxic = motherxic->GetPdgCode();
1632  if(TMath::Abs(pdgmotherxic)==511||TMath::Abs(pdgmotherxic)==521||TMath::Abs(pdgmotherxic)==5122||TMath::Abs(pdgmotherxic)==5132||TMath::Abs(pdgmotherxic)==5232||TMath::Abs(pdgmotherxic)==5332){
1633  isbottomfd = kTRUE;
1634  }
1635  }
1636 
1637  fHistoEleXiMassMCS->Fill(cont);
1638  if(trk->Charge()>0) fHistoEleXiMassMCS1->Fill(cont);
1639  else fHistoEleXiMassMCS2->Fill(cont);
1640 
1641  if(isbottomfd){
1642  fHistoEleXiMassBFeeddownMCS->Fill(cont);
1643  if(trk->Charge()>0) fHistoEleXiMassBFeeddownMCS1->Fill(cont);
1644  else fHistoEleXiMassBFeeddownMCS2->Fill(cont);
1645  }else{
1646  fHistoEleXiMassPromptMCS->Fill(cont);
1647  if(trk->Charge()>0) fHistoEleXiMassPromptMCS1->Fill(cont);
1648  else fHistoEleXiMassPromptMCS2->Fill(cont);
1649  }
1650 
1651  fHistoEleXiMassvsElePtMCS->Fill(cont2);
1652  if(trk->Charge()>0) fHistoEleXiMassvsElePtMCS1->Fill(cont2);
1653  else fHistoEleXiMassvsElePtMCS2->Fill(cont2);
1654  if(cont[0]<2.5){
1655  fHistoEleXiPtvsRapidityMCS->Fill(exobj->Pt(),exobj_rap);
1656  fHistoElePtMCS->Fill(mcele->Pt(),fCentrality);
1657  fHistoElePtvsEtaMCS->Fill(cont_eleptvseta);
1658  fHistoElePtvsXiPtMCS->Fill(cont_eleptvsxipt);
1659  fHistoElePtvsd0MCS->Fill(cont_eleptvsd0);
1660 
1661  Double_t cont_xic[3];
1662  cont_xic[0] = mcxic->Pt();
1663  cont_xic[1] = mcxic->Y();
1664  cont_xic[2] = fCentrality;
1665  fHistoXicMCS->Fill(cont_xic);
1666  if(trk->Charge()>0) fHistoXicMCS1->Fill(cont_xic);
1667  else fHistoXicMCS2->Fill(cont_xic);
1668 
1669  Double_t cont_mcele[3];
1670  cont_mcele[0] = mcele->Pt();
1671  cont_mcele[1] = mcele->Eta();
1672  cont_mcele[2] = fCentrality;
1673  fHistoXicElectronMCS->Fill(cont_mcele);
1674  if(trk->Charge()>0) fHistoXicElectronMCS1->Fill(cont_mcele);
1675  else fHistoXicElectronMCS2->Fill(cont_mcele);
1676 
1677  fHistoResponseElePt->Fill(mcxic->Pt(),trk->Pt());
1678  fHistoResponseXiPt->Fill(mcxic->Pt(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1679  fHistoResponseEleXiPt->Fill(mcxic->Pt(),exobj->Pt());
1680 
1681  Double_t cont_eleptvsxiptvsxicpt[4];
1682  cont_eleptvsxiptvsxicpt[0] = cont_eleptvsxipt[0];
1683  cont_eleptvsxiptvsxicpt[1] = cont_eleptvsxipt[1];
1684  cont_eleptvsxiptvsxicpt[2] = mcxic->Pt();
1685  cont_eleptvsxiptvsxicpt[3] = cont_eleptvsxipt[2];
1686  fHistoElePtvsXiPtvsXicPtMCS->Fill(cont_eleptvsxiptvsxicpt);
1687 
1688  if(isbottomfd){
1689  fHistoElePtvsd0BFeeddownMCS->Fill(cont_eleptvsd0);
1690  }else{
1691  fHistoElePtvsd0PromptMCS->Fill(cont_eleptvsd0);
1692  }
1693 
1694  for(Int_t ih=0;ih<23;ih++){
1695  Double_t cont_eleptvscutvars[3];
1696  cont_eleptvscutvars[0] = exobj->Pt();
1697  cont_eleptvscutvars[2] = fCentrality;
1698 
1699  if(ih==0){
1700  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1701  }else if(ih==1){
1702  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1703  }else if(ih==2){
1704  cont_eleptvscutvars[1] = nSigmaTPCele;
1705  }else if(ih==3){
1706  cont_eleptvscutvars[1] = nSigmaTOFele;
1707  }else if(ih==4){
1708  cont_eleptvscutvars[1] = trk->Eta();
1709  }else if(ih==5){
1710  cont_eleptvscutvars[1] = trk->GetITSNcls();
1711  }else if(ih==6){
1712  if(casc->ChargeXi()<0)
1713  cont_eleptvscutvars[1] = casc->MassLambda();
1714  else
1715  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1716  }else if(ih==7){
1717  cont_eleptvscutvars[1] = casc->MassXi();
1718  }else if(ih==8){
1719  Double_t lPosV0[3];
1720  lPosV0[0] = casc->DecayVertexV0X();
1721  lPosV0[1] = casc->DecayVertexV0Y();
1722  lPosV0[2] = casc->DecayVertexV0Z();
1723  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1724  }else if(ih==9){
1725  Double_t lPosXi[3];
1726  lPosXi[0] = casc->DecayVertexXiX();
1727  lPosXi[1] = casc->DecayVertexXiY();
1728  lPosXi[2] = casc->DecayVertexXiZ();
1729  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1730  }else if(ih==10){
1731  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1732  }else if(ih==11){
1733  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1734  }else if(ih==12){
1735  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1736  }else if(ih==13){
1737  if(casc->ChargeXi()<0.)
1738  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1739  else
1740  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1741  }else if(ih==14){
1742  if(casc->ChargeXi()>0.)
1743  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1744  else
1745  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1746  }else if(ih==15){
1747  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1748  }else if(ih==16){
1749  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1750  }else if(ih==17){
1751  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1752  }else if(ih==18){
1753  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1754  }else if(ih==19){
1755  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1756  }else if(ih==20){
1757  cont_eleptvscutvars[1] = casc->Eta();
1758  }else if(ih==21){
1759  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1760  }else if(ih==22){
1761  Double_t xipx = exobj->PxProng(1);
1762  Double_t xipy = exobj->PyProng(1);
1763  Double_t xipz = exobj->PzProng(1);
1764  Double_t epx = exobj->PxProng(0);
1765  Double_t epy = exobj->PyProng(0);
1766  Double_t epz = exobj->PzProng(0);
1767  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1768  }else{
1769  cont_eleptvscutvars[1] = -9999.;
1770  }
1771 
1772  fHistoElePtvsCutVarsMCS[ih]->Fill(cont_eleptvscutvars);
1773  }
1774  }
1775  }
1776  }
1777  }
1778  fHistodPhiSdEtaSElectronProtonR125RS->Fill(dphis_ele_pr,detas_ele_pr);
1779  fHistodPhiSdEtaSElectronPionR125RS->Fill(dphis_ele_pi,detas_ele_pi);
1780  fHistodPhiSdEtaSElectronBachelorR125RS->Fill(dphis_ele_bach,detas_ele_bach);
1781  }else{
1782  fHistoEleXiMassWS->Fill(cont);
1783  if(trk->Charge()>0) fHistoEleXiMassWS1->Fill(cont);
1784  else fHistoEleXiMassWS2->Fill(cont);
1785  fHistoEleXiMassvsElePtWS->Fill(cont2);
1786  if(trk->Charge()>0) fHistoEleXiMassvsElePtWS1->Fill(cont2);
1787  else fHistoEleXiMassvsElePtWS2->Fill(cont2);
1788  if(cont[0]<2.5){
1789  fHistoEleXiPtvsRapidityWS->Fill(exobj->Pt(),exobj_rap);
1790  fHistoElePtWS->Fill(trk->Pt(),fCentrality);
1791  fHistoElePtvsEtaWS->Fill(cont_eleptvseta);
1792  fHistoElePtvsXiPtWS->Fill(cont_eleptvsxipt);
1793  fHistoElePtvsd0WS->Fill(cont_eleptvsd0);
1794 
1795  for(Int_t ih=0;ih<23;ih++){
1796  Double_t cont_eleptvscutvars[3];
1797  cont_eleptvscutvars[0] = exobj->Pt();
1798  cont_eleptvscutvars[2] = fCentrality;
1799 
1800  if(ih==0){
1801  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1802  }else if(ih==1){
1803  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1804  }else if(ih==2){
1805  cont_eleptvscutvars[1] = nSigmaTPCele;
1806  }else if(ih==3){
1807  cont_eleptvscutvars[1] = nSigmaTOFele;
1808  }else if(ih==4){
1809  cont_eleptvscutvars[1] = trk->Eta();
1810  }else if(ih==5){
1811  cont_eleptvscutvars[1] = trk->GetITSNcls();
1812  }else if(ih==6){
1813  if(casc->ChargeXi()<0)
1814  cont_eleptvscutvars[1] = casc->MassLambda();
1815  else
1816  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1817  }else if(ih==7){
1818  cont_eleptvscutvars[1] = casc->MassXi();
1819  }else if(ih==8){
1820  Double_t lPosV0[3];
1821  lPosV0[0] = casc->DecayVertexV0X();
1822  lPosV0[1] = casc->DecayVertexV0Y();
1823  lPosV0[2] = casc->DecayVertexV0Z();
1824  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1825  }else if(ih==9){
1826  Double_t lPosXi[3];
1827  lPosXi[0] = casc->DecayVertexXiX();
1828  lPosXi[1] = casc->DecayVertexXiY();
1829  lPosXi[2] = casc->DecayVertexXiZ();
1830  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1831  }else if(ih==10){
1832  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1833  }else if(ih==11){
1834  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1835  }else if(ih==12){
1836  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1837  }else if(ih==13){
1838  if(casc->ChargeXi()<0.)
1839  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1840  else
1841  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1842  }else if(ih==14){
1843  if(casc->ChargeXi()>0.)
1844  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1845  else
1846  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1847  }else if(ih==15){
1848  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1849  }else if(ih==16){
1850  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1851  }else if(ih==17){
1852  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1853  }else if(ih==18){
1854  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1855  }else if(ih==19){
1856  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1857  }else if(ih==20){
1858  cont_eleptvscutvars[1] = casc->Eta();
1859  }else if(ih==21){
1860  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1861  }else if(ih==22){
1862  Double_t xipx = exobj->PxProng(1);
1863  Double_t xipy = exobj->PyProng(1);
1864  Double_t xipz = exobj->PzProng(1);
1865  Double_t epx = exobj->PxProng(0);
1866  Double_t epy = exobj->PyProng(0);
1867  Double_t epz = exobj->PzProng(0);
1868  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1869  }else{
1870  cont_eleptvscutvars[1] = -9999.;
1871  }
1872 
1873  fHistoElePtvsCutVarsWS[ih]->Fill(cont_eleptvscutvars);
1874  }
1875  }
1876  if(fUseMCInfo){
1877  if(mcxic){
1878  Int_t pdgcode = mcxic->GetPdgCode();
1879  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgcasc_array[1])==4132 && abs(mcpdgcasc_array[2])==5132){
1880  fHistoEleXiMassXibMCS->Fill(cont);
1881  if(trk->Charge()>0) fHistoEleXiMassXibMCS1->Fill(cont);
1882  else fHistoEleXiMassXibMCS2->Fill(cont);
1883  }
1884  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgcasc_array[1])==4232 && abs(mcpdgcasc_array[2])==5132){
1885  fHistoEleXiMassXibMCS->Fill(cont);
1886  if(trk->Charge()>0) fHistoEleXiMassXibMCS1->Fill(cont);
1887  else fHistoEleXiMassXibMCS2->Fill(cont);
1888  }
1889  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgcasc_array[1])==4132 && abs(mcpdgcasc_array[2])==5232){
1890  fHistoEleXiMassXibMCS->Fill(cont);
1891  if(trk->Charge()>0) fHistoEleXiMassXibMCS1->Fill(cont);
1892  else fHistoEleXiMassXibMCS2->Fill(cont);
1893  }
1894  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgcasc_array[1])==4232 && abs(mcpdgcasc_array[2])==5232){
1895  fHistoEleXiMassXibMCS->Fill(cont);
1896  if(trk->Charge()>0) fHistoEleXiMassXibMCS1->Fill(cont);
1897  else fHistoEleXiMassXibMCS2->Fill(cont);
1898  }
1899  }
1900  }
1901  fHistodPhiSdEtaSElectronProtonR125WS->Fill(dphis_ele_pr,detas_ele_pr);
1902  fHistodPhiSdEtaSElectronPionR125WS->Fill(dphis_ele_pi,detas_ele_pi);
1903  fHistodPhiSdEtaSElectronBachelorR125WS->Fill(dphis_ele_bach,detas_ele_bach);
1904  }
1905 
1906  }
1907 
1908  //if( exobj->InvMass(2,pdgdg)<10. && cosoa < 0. && fAnalCuts->IsPeakRegion(casc))
1909  if( mexi_flip <10. && cosoa < 0. && fAnalCuts->IsPeakRegion(casc))
1910  {
1911  if(trk->Charge()*casc->ChargeXi()<0){
1912  fHistoEleXiMassRSAway->Fill(cont_flip);
1913  if(trk->Charge()>0) fHistoEleXiMassRS1Away->Fill(cont_flip);
1914  else fHistoEleXiMassRS2Away->Fill(cont_flip);
1915  }else{
1916  fHistoEleXiMassWSAway->Fill(cont_flip);
1917  if(trk->Charge()>0) fHistoEleXiMassWS1Away->Fill(cont_flip);
1918  else fHistoEleXiMassWS2Away->Fill(cont_flip);
1919  }
1920  }
1921 
1923  {
1924  if(trk->Charge()*casc->ChargeXi()<0){
1925  fHistoEleXiMassRSSide->Fill(cont);
1926  if(trk->Charge()>0) fHistoEleXiMassRSSide1->Fill(cont);
1927  else fHistoEleXiMassRSSide2->Fill(cont);
1928  fHistoEleXiMassvsElePtRSSide->Fill(cont2);
1929  if(trk->Charge()>0) fHistoEleXiMassvsElePtRSSide1->Fill(cont2);
1930  else fHistoEleXiMassvsElePtRSSide2->Fill(cont2);
1931  }else{
1932  fHistoEleXiMassWSSide->Fill(cont);
1933  if(trk->Charge()>0) fHistoEleXiMassWSSide1->Fill(cont);
1934  else fHistoEleXiMassWSSide2->Fill(cont);
1935  fHistoEleXiMassvsElePtWSSide->Fill(cont2);
1936  if(trk->Charge()>0) fHistoEleXiMassvsElePtWSSide1->Fill(cont2);
1937  else fHistoEleXiMassvsElePtWSSide2->Fill(cont2);
1938  }
1939  }
1940 
1941  //if( exobj->InvMass(2,pdgdg)<10. && cosoa < 0. && fAnalCuts->IsSideBand(casc))
1942  if( mexi_flip< 10. && cosoa < 0. && fAnalCuts->IsSideBand(casc))
1943  {
1944  if(trk->Charge()*casc->ChargeXi()<0){
1945  fHistoEleXiMassRSSideAway->Fill(cont_flip);
1946  if(trk->Charge()>0) fHistoEleXiMassRSSide1Away->Fill(cont_flip);
1947  else fHistoEleXiMassRSSide2Away->Fill(cont_flip);
1948  }else{
1949  fHistoEleXiMassWSSideAway->Fill(cont_flip);
1950  if(trk->Charge()>0) fHistoEleXiMassWSSide1Away->Fill(cont_flip);
1951  else fHistoEleXiMassWSSide2Away->Fill(cont_flip);
1952  }
1953  }
1954 
1955  //
1956  // New strategy: Fully analyze correlation
1957  //
1958  for(Int_t iv=0;iv<11;iv++){
1959  fCorrelationVariables[iv] = -9999.;
1960  }
1961 
1962  fCorrelationVariables[0] = sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2));
1963  fCorrelationVariables[1] = trk->Pt();
1964  fCorrelationVariables[2] = fAnalCuts->DeltaPhi(casc,trk);
1965  fCorrelationVariables[3] = fAnalCuts->DeltaEta(casc,trk);
1966  fCorrelationVariables[5] = exobj->Getd0Prong(0);
1967  if(!fUseMCInfo) fCorrelationVariables[6] = 0;
1968  else fCorrelationVariables[6] = 1;
1969  if(trk->Charge()>0){
1970  if(casc->ChargeXi()<0) fCorrelationVariables[7] = 0;
1971  else fCorrelationVariables[7] = 2;
1972  }else if(trk->Charge()<0){
1973  if(casc->ChargeXi()<0) fCorrelationVariables[7] = 1;
1974  else fCorrelationVariables[7] = 3;
1975  }
1976  fCorrelationVariables[8] = (Int_t)isconv + 2 * (Int_t)isconv_like;
1978 
1979  if(fUseMCInfo && FromSemileptonicDecays(mcpdgele_array)>0){
1980  if(mcxic){
1981  Int_t pdgcode = mcxic->GetPdgCode();
1982  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgcasc_array[1])==4132){
1983  fCorrelationVariables[9] = 1;
1984  }
1985  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgcasc_array[1])==4132 && abs(mcpdgcasc_array[2])==5132){
1986  fCorrelationVariables[9] = 11;
1987  }
1988  if(abs(pdgcode)==5132 && abs(mcpdgele_array[1])==5132 && abs(mcpdgcasc_array[1])==4232 && abs(mcpdgcasc_array[2])==5132){
1989  fCorrelationVariables[9] = 12;
1990  }
1991  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgcasc_array[1])==4132 && abs(mcpdgcasc_array[2])==5232){
1992  fCorrelationVariables[9] = 13;
1993  }
1994  if(abs(pdgcode)==5232 && abs(mcpdgele_array[1])==5232 && abs(mcpdgcasc_array[1])==4232 && abs(mcpdgcasc_array[2])==5232){
1995  fCorrelationVariables[9] = 14;
1996  }
1997  }
1998  if(fCorrelationVariables[9]<0){
1999  Bool_t lam_from_bottom = HaveBottomInHistory(mcpdgcasc_array);
2000  Bool_t lam_from_charm = HaveCharmInHistory(mcpdgcasc_array);
2001  if(FromSemileptonicDecays(mcpdgele_array)==1){
2002  if(lam_from_bottom) fCorrelationVariables[9] = 1011;
2003  else if(lam_from_charm) fCorrelationVariables[9] = 1012;
2004  else fCorrelationVariables[9] = 1013;
2005  }else if(FromSemileptonicDecays(mcpdgele_array)==2){
2006  if(lam_from_bottom) fCorrelationVariables[9] = 1014;
2007  else if(lam_from_charm) fCorrelationVariables[9] = 1015;
2008  else fCorrelationVariables[9] = 1016;
2009  }
2010  }
2011  }
2012 
2014  {
2015  fCorrelationVariablesTree->Fill();
2016  }
2017 
2018 
2019  return;
2020 }
2021 
2023 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMixROOTObjects(TLorentzVector *trke, TLorentzVector *casc, TVector *elevars, TVector *cascvars, Int_t chargexi)
2024 {
2025  //
2026  // Fill histograms or tree depending on fWriteVariableTree
2027  //
2028  if(!trke) return;
2029  if(!casc) return;
2030 
2031 
2032  for(Int_t i=0;i<90;i++){
2033  fCandidateVariables[i] = -9999.;
2034  }
2035 
2036  Double_t pxe = trke->Px();
2037  Double_t pye = trke->Py();
2038  Double_t pze = trke->Pz();
2039  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
2040  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
2041 
2042  Double_t pxv = casc->Px();
2043  Double_t pyv = casc->Py();
2044  Double_t pzv = casc->Pz();
2045  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
2046  Double_t Ev = sqrt(momv*momv+1.32171*1.32171);
2047 
2048  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
2049 
2050  Double_t pxsum = pxe + pxv;
2051  Double_t pysum = pye + pyv;
2052  Double_t pzsum = pze + pzv;
2053  Double_t Esum = Ee + Ev;
2054  Double_t mexi = sqrt(Esum*Esum-pxsum*pxsum-pysum*pysum-pzsum*pzsum);
2055 
2056  Double_t uxe = pxe/mome;
2057  Double_t uye = pye/mome;
2058  Double_t uze = pze/mome;
2059  Double_t lf = -2.*(pxv*uxe+pyv*uye+pzv*uze);
2060  Double_t pxv_flip = pxv + lf * uxe;
2061  Double_t pyv_flip = pyv + lf * uye;
2062  Double_t pzv_flip = pzv + lf * uze;
2063  Double_t pxsum_flip = pxe + pxv_flip;
2064  Double_t pysum_flip = pye + pyv_flip;
2065  Double_t pzsum_flip = pze + pzv_flip;
2066  Double_t mexi_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
2067  Double_t ptexi_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
2068 
2069  Double_t posVtx[3] = {0.,0.,0.};
2070  fVtx1->GetXYZ(posVtx);
2071 
2073  UInt_t pdgdg[2]={11,3312};
2074  fCandidateVariables[ 1] = mexi;
2075  fCandidateVariables[ 2] = sqrt(pxsum*pxsum+pysum*pysum);
2076  fCandidateVariables[ 3] = pxsum;
2077  fCandidateVariables[ 4] = pysum;
2078  fCandidateVariables[ 5] = pzsum;
2079  fCandidateVariables[ 6] = pxe;
2080  fCandidateVariables[ 7] = pye;
2081  fCandidateVariables[ 8] = pze;
2082  fCandidateVariables[ 9] = pxv;
2083  fCandidateVariables[10] = pyv;
2084  fCandidateVariables[11] = pzv;
2085  fCandidateVariables[12] = chargexi;
2086  fCandidateVariables[13] = casc->M();
2087  fCandidateVariables[29] = trke->T();
2088  fCandidateVariables[30] = 1;//mixing
2089  fCandidateVariables[77] = fVtx1->GetX();
2090  fCandidateVariables[78] = fVtx1->GetY();
2091  fCandidateVariables[79] = fVtx1->GetZ();
2093 
2094  if(fWriteVariableTree)
2095  fVariablesTree->Fill();
2096 
2097  Double_t cont[4];
2098  cont[0] = mexi;
2099  cont[1] = sqrt(pxsum*pxsum+pysum*pysum);
2100  cont[2] = 0.0;
2101  cont[3] = fCentrality;
2102 
2103  Double_t cont_flip[4];
2104  cont_flip[0] = mexi_flip;
2105  cont_flip[1] = ptexi_flip;
2106  cont_flip[2] = 0.0;
2107  cont_flip[3] = fCentrality;
2108 
2109  Double_t cont2[3];
2110  cont2[0] = mexi;
2111  cont2[1] = sqrt(pxe*pxe+pye*pye);
2112  cont2[2] = fCentrality;
2113 
2114  Double_t cont_eleptvseta[3];
2115  cont_eleptvseta[0] = trke->Pt();
2116  cont_eleptvseta[1] = trke->Eta();
2117  cont_eleptvseta[2] = fCentrality;
2118 
2119  Double_t cont_eleptvsxipt[3];
2120  cont_eleptvsxipt[0] = trke->Pt();
2121  cont_eleptvsxipt[1] = casc->Pt();
2122  cont_eleptvsxipt[2] = fCentrality;
2123 
2124  Double_t cont_eleptvsd0[3];
2125  cont_eleptvsd0[0] = trke->Pt();
2126  cont_eleptvsd0[1] = 0.;
2127  cont_eleptvsd0[2] = fCentrality;
2128 
2129  Double_t xyzR125_ele[3], xyzR125_pr[3], xyzR125_pi[3], xyzR125_bach[3];
2130  xyzR125_ele[0] = (*elevars)[0];
2131  xyzR125_ele[1] = (*elevars)[1];
2132  xyzR125_ele[2] = (*elevars)[2];
2133  xyzR125_pr[0] = (*cascvars)[0];
2134  xyzR125_pr[1] = (*cascvars)[1];
2135  xyzR125_pr[2] = (*cascvars)[2];
2136  xyzR125_pi[0] = (*cascvars)[3];
2137  xyzR125_pi[1] = (*cascvars)[4];
2138  xyzR125_pi[2] = (*cascvars)[5];
2139  xyzR125_bach[0] = (*cascvars)[6];
2140  xyzR125_bach[1] = (*cascvars)[7];
2141  xyzR125_bach[2] = (*cascvars)[8];
2142 
2143  Double_t rdhfcutvars[12];
2144  rdhfcutvars[0] = xyzR125_ele[0];
2145  rdhfcutvars[1] = xyzR125_ele[1];
2146  rdhfcutvars[2] = xyzR125_ele[2];
2147  rdhfcutvars[3] = xyzR125_pr[0];
2148  rdhfcutvars[4] = xyzR125_pr[1];
2149  rdhfcutvars[5] = xyzR125_pr[2];
2150  rdhfcutvars[6] = xyzR125_pi[0];
2151  rdhfcutvars[7] = xyzR125_pi[1];
2152  rdhfcutvars[8] = xyzR125_pi[2];
2153  rdhfcutvars[9] = xyzR125_bach[0];
2154  rdhfcutvars[10] = xyzR125_bach[1];
2155  rdhfcutvars[11] = xyzR125_bach[2];
2156 
2157  Double_t dphis_ele_pr = fAnalCuts->dPhiSR125(xyzR125_ele,xyzR125_pr);
2158  Double_t detas_ele_pr = fAnalCuts->dEtaSR125(xyzR125_ele,xyzR125_pr);
2159  Double_t dphis_ele_pi = fAnalCuts->dPhiSR125(xyzR125_ele,xyzR125_pi);
2160  Double_t detas_ele_pi = fAnalCuts->dEtaSR125(xyzR125_ele,xyzR125_pi);
2161  Double_t dphis_ele_bach = fAnalCuts->dPhiSR125(xyzR125_ele,xyzR125_bach);
2162  Double_t detas_ele_bach = fAnalCuts->dEtaSR125(xyzR125_ele,xyzR125_bach);
2163 
2164  //if(mexi<10. && cosoa>0. && fAnalCuts->IsPeakRegion(casc))
2165  if(fAnalCuts->IsSelected(trke,casc,rdhfcutvars,AliRDHFCuts::kCandidate) && fAnalCuts->IsPeakRegion(casc))
2166  {
2167  if(((int)trke->T())*chargexi<0){
2168  fHistoEleXiMassRSMix->Fill(cont);
2169  if(trke->T()>0) fHistoEleXiMassRSMix1->Fill(cont);
2170  else fHistoEleXiMassRSMix2->Fill(cont);
2171  fHistoEleXiMassvsElePtRSMix->Fill(cont2);
2172  if(trke->T()>0) fHistoEleXiMassvsElePtRSMix1->Fill(cont2);
2173  else fHistoEleXiMassvsElePtRSMix2->Fill(cont2);
2174  if(cont[0]<2.5){
2175  fHistoElePtRSMix->Fill(trke->Pt(),fCentrality);
2176  fHistoElePtvsEtaRSMix->Fill(cont_eleptvseta);
2177  fHistoElePtvsXiPtRSMix->Fill(cont_eleptvsxipt);
2178  fHistoElePtvsd0RSMix->Fill(cont_eleptvsd0);
2179  }
2180  fHistodPhiSdEtaSElectronProtonR125RSMix->Fill(dphis_ele_pr,detas_ele_pr);
2181  fHistodPhiSdEtaSElectronPionR125RSMix->Fill(dphis_ele_pi,detas_ele_pi);
2182  fHistodPhiSdEtaSElectronBachelorR125RSMix->Fill(dphis_ele_bach,detas_ele_bach);
2183  }else{
2184  fHistoEleXiMassWSMix->Fill(cont);
2185  if(trke->T()>0) fHistoEleXiMassWSMix1->Fill(cont);
2186  else fHistoEleXiMassWSMix2->Fill(cont);
2187  fHistoEleXiMassvsElePtWSMix->Fill(cont2);
2188  if(trke->T()>0) fHistoEleXiMassvsElePtWSMix1->Fill(cont2);
2189  else fHistoEleXiMassvsElePtWSMix2->Fill(cont2);
2190  if(cont[0]<2.5){
2191  fHistoElePtWSMix->Fill(trke->Pt(),fCentrality);
2192  fHistoElePtvsEtaWSMix->Fill(cont_eleptvseta);
2193  fHistoElePtvsXiPtWSMix->Fill(cont_eleptvsxipt);
2194  fHistoElePtvsd0WSMix->Fill(cont_eleptvsd0);
2195  }
2196  fHistodPhiSdEtaSElectronProtonR125WSMix->Fill(dphis_ele_pr,detas_ele_pr);
2197  fHistodPhiSdEtaSElectronPionR125WSMix->Fill(dphis_ele_pi,detas_ele_pi);
2198  fHistodPhiSdEtaSElectronBachelorR125WSMix->Fill(dphis_ele_bach,detas_ele_bach);
2199  }
2200  }
2201 
2202  //if(mexi < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(casc))
2203  if(mexi_flip < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(casc))
2204  {
2205  if(((int)trke->T())*chargexi<0){
2206  fHistoEleXiMassRSMixAway->Fill(cont_flip);
2207  if(trke->T()>0) fHistoEleXiMassRSMix1Away->Fill(cont_flip);
2208  else fHistoEleXiMassRSMix2Away->Fill(cont_flip);
2209  }else{
2210  fHistoEleXiMassWSMixAway->Fill(cont_flip);
2211  if(trke->T()>0) fHistoEleXiMassWSMix1Away->Fill(cont_flip);
2212  else fHistoEleXiMassWSMix2Away->Fill(cont_flip);
2213  }
2214  }
2215 
2216  //
2217  // New strategy: Fully analyze correlation
2218  //
2219  for(Int_t iv=0;iv<11;iv++){
2220  fCorrelationVariables[iv] = -9999.;
2221  }
2222 
2223  fCorrelationVariables[0] = casc->Pt();
2224  fCorrelationVariables[1] = trke->Pt();
2225  fCorrelationVariables[2] = TVector2::Phi_mpi_pi(casc->Phi()-trke->Phi());
2226  fCorrelationVariables[3] = casc->Eta()-trke->Eta();
2227  fCorrelationVariables[5] = (*elevars)[5];
2228  fCorrelationVariables[6] = 2;
2229  if(trke->T()>0){
2230  if(chargexi<0) fCorrelationVariables[7] = 0;
2231  else fCorrelationVariables[7] = 2;
2232  }else if(trke->T()<0){
2233  if(chargexi<0) fCorrelationVariables[7] = 1;
2234  else fCorrelationVariables[7] = 3;
2235  }
2236  fCorrelationVariables[10] = fCentrality;
2237 
2238  if(fAnalCuts->IsSelected(trke,casc,rdhfcutvars,AliRDHFCuts::kCandidate) && fAnalCuts->IsPeakRegion(casc))
2239  {
2240  fCorrelationVariablesTree->Fill();
2241  }
2242 
2243 
2244  return;
2245 }
2246 
2249 {
2250  //
2251  // Define electron tree variables
2252  //
2253 
2254  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
2255  fEleVariablesTree = new TTree(nameoutput,"electron variables tree");
2256  Int_t nVar = 26;
2257  fCandidateEleVariables = new Float_t [nVar];
2258  TString * fCandidateVariableNames = new TString[nVar];
2259 
2260  fCandidateVariableNames[ 0]="ElePx";
2261  fCandidateVariableNames[ 1]="ElePy";
2262  fCandidateVariableNames[ 2]="ElePz";
2263  fCandidateVariableNames[ 3]="TPCChi2overNDF";
2264  fCandidateVariableNames[ 4]="ITSNcls";
2265  fCandidateVariableNames[ 5]="TPCNcls";
2266  fCandidateVariableNames[ 6]="TPCNclsPID";
2267  fCandidateVariableNames[ 7]="TPCNclsRatio";
2268  fCandidateVariableNames[ 8]="d0R";
2269  fCandidateVariableNames[ 9]="d0Z";
2270  fCandidateVariableNames[10]="ITSClusterMap";
2271  fCandidateVariableNames[11]="nSigmaTPCele";
2272  fCandidateVariableNames[12]="nSigmaTOFele";
2273  fCandidateVariableNames[13]="nSigmaTPCpi";
2274  fCandidateVariableNames[14]="nSigmaTPCka";
2275  fCandidateVariableNames[15]="nSigmaTPCpr";
2276  fCandidateVariableNames[16]="EvNumber";
2277  fCandidateVariableNames[17]="EleCharge";
2278  fCandidateVariableNames[18]="ElePdgCode";
2279  fCandidateVariableNames[19]="EleMotherPdgCode";
2280  fCandidateVariableNames[20]="mcelepx";
2281  fCandidateVariableNames[21]="mcelepy";
2282  fCandidateVariableNames[22]="mcelepz";
2283  fCandidateVariableNames[23]="Centrality";
2284  fCandidateVariableNames[24]="PrimVertZ";
2285  fCandidateVariableNames[25]="RunNumber";
2286 
2287  for (Int_t ivar=0; ivar<nVar; ivar++) {
2288  fEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2289  }
2290 
2291  return;
2292 }
2294 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillElectronROOTObjects(AliAODTrack *trk, AliAODTrack *trkpid, AliAODEvent *event, TClonesArray *mcArray)
2295 {
2296  //
2297  // Fill histograms or tree depending on fWriteVariableTree
2298  //
2299 
2300  if(!trk) return;
2301 
2302  fHistoBachPt->Fill(trk->Pt());
2303  fHistoElectronQovPtvsPhi->Fill(trk->Phi(),(Double_t)trk->Charge()/trk->Pt());
2304 
2305  Double_t d0z0[2],covd0z0[3];
2306  trk->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);
2307 
2308  if(fDoEventMixing){
2309  Double_t pv[3];
2310  pv[0] = fVtx1->GetX();
2311  pv[1] = fVtx1->GetY();
2312  pv[2] = fVtx1->GetZ();
2313  Double_t xyzR125[3] = {9999.,9999.,9999.};
2314  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.) fAnalCuts->SetSftPosR125(trk,fBzkG,pv,xyzR125);
2315  TVector *varvec = new TVector(6);
2316  (*varvec)[0] = xyzR125[0];
2317  (*varvec)[1] = xyzR125[1];
2318  (*varvec)[2] = xyzR125[2];
2319  (*varvec)[3] = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkpid,AliPID::kElectron);
2320  (*varvec)[4] = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trkpid,AliPID::kElectron);
2321  (*varvec)[5] = d0z0[0];
2322  fElectronTracks->AddLast(new TLorentzVector(trk->Px(),trk->Py(),trk->Pz(),trk->Charge()));
2323  fElectronCutVarsArray->AddLast(varvec);
2324  }
2325 
2326 
2327  Int_t pdgEle = -9999;
2328  Int_t pdgEleMother = -9999;
2329  Float_t mcepx = -9999;
2330  Float_t mcepy = -9999;
2331  Float_t mcepz = -9999;
2332  if(fUseMCInfo)
2333  {
2334  Int_t labEle = trk->GetLabel();
2335  if(labEle<0) return;
2336  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
2337  if(!mcetrk) return;
2338  pdgEle = mcetrk->GetPdgCode();
2339  mcepx = mcetrk->Px();
2340  mcepy = mcetrk->Py();
2341  mcepz = mcetrk->Pz();
2342  }
2343 
2344 
2345  if(!fWriteEachVariableTree) return;
2346 
2347 
2348  for(Int_t i=0;i<26;i++){
2349  fCandidateEleVariables[i] = -9999.;
2350  }
2351 
2352  fCandidateEleVariables[ 0] = trk->Px();
2353  fCandidateEleVariables[ 1] = trk->Py();
2354  fCandidateEleVariables[ 2] = trk->Pz();
2355  fCandidateEleVariables[ 3] = trk->Chi2perNDF();
2356  fCandidateEleVariables[ 4] = trk->GetITSNcls();
2357  fCandidateEleVariables[ 5] = trk->GetTPCncls();
2358  fCandidateEleVariables[ 6] = trk->GetTPCsignalN();
2359  if(trk->GetTPCNclsF()>0)
2360  fCandidateEleVariables[ 7] = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
2361 
2362  fCandidateEleVariables[ 8] = d0z0[0];
2363  fCandidateEleVariables[ 9] = d0z0[1];
2364  Int_t itsmap = trk->GetITSClusterMap();
2365  Int_t bit1 = 1;
2366  Int_t bit2 = 2;
2367  Bool_t spdfirst = (itsmap & bit1) == bit1;
2368  Bool_t spdsecond = (itsmap & bit2) == bit2;
2369  fCandidateEleVariables[10] = ((Int_t)spdfirst) + 2 * ((Int_t)spdsecond);
2370 
2371  if(fAnalCuts->GetIsUsePID())
2372  {
2373  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
2374  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
2375  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
2376  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
2377  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
2378  fCandidateEleVariables[11] = nSigmaTPCele;
2379  fCandidateEleVariables[12] = nSigmaTOFele;
2380  fCandidateEleVariables[13] = nSigmaTPCpi_etrk;
2381  fCandidateEleVariables[14] = nSigmaTPCka_etrk;
2382  fCandidateEleVariables[15] = nSigmaTPCpr_etrk;
2383  }
2385  fCandidateEleVariables[17] = trk->Charge();
2386  fCandidateEleVariables[18] = pdgEle;
2387  fCandidateEleVariables[19] = pdgEleMother;
2388  fCandidateEleVariables[20] = mcepx;
2389  fCandidateEleVariables[21] = mcepy;
2390  fCandidateEleVariables[22] = mcepz;
2394 
2395  fHistod0Bach->Fill(d0z0[0]);
2396 
2397  fEleVariablesTree->Fill();
2398 }
2401 {
2402  //
2403  // Define V0 tree variables
2404  //
2405 
2406  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
2407  fCascVariablesTree = new TTree(nameoutput,"cascade variables tree");
2408  Int_t nVar = 26;
2409  fCandidateCascVariables = new Float_t [nVar];
2410  TString * fCandidateVariableNames = new TString[nVar];
2411 
2412  fCandidateVariableNames[ 0]="Centrality";
2413  fCandidateVariableNames[ 1]="InvMassXi";
2414  fCandidateVariableNames[ 2]="XiPx";
2415  fCandidateVariableNames[ 3]="XiPy";
2416  fCandidateVariableNames[ 4]="XiPz";
2417  fCandidateVariableNames[ 5]="InvMassLambda";
2418  fCandidateVariableNames[ 6]="DcaXiDaughters";
2419  fCandidateVariableNames[ 7]="DcaV0Daughters";
2420  fCandidateVariableNames[ 8]="DecayLengthXi";
2421  fCandidateVariableNames[ 9]="CosPointingAngleXi";
2422  fCandidateVariableNames[10]="DcaV0toPrimVertex";
2423  fCandidateVariableNames[11]="DcaPostoPrimVertex";
2424  fCandidateVariableNames[12]="DcaNegtoPrimVertex";
2425  fCandidateVariableNames[13]="DcaBachtoPrimVertex";
2426  fCandidateVariableNames[14]="DecayLengthV0";
2427  fCandidateVariableNames[15]="CosPointingAngleV0";
2428  fCandidateVariableNames[16]="XiCharge";
2429  fCandidateVariableNames[17]="XiPdgCode";
2430  fCandidateVariableNames[18]="XiMotherPdgCode";
2431  fCandidateVariableNames[19]="mcxipx";
2432  fCandidateVariableNames[20]="mcxipy";
2433  fCandidateVariableNames[21]="mcxipz";
2434  fCandidateVariableNames[22]="labcasc";
2435  fCandidateVariableNames[23]="RunNumber";
2436  fCandidateVariableNames[24]="PrimVertZ";
2437  fCandidateVariableNames[25]="EvNumber";
2438 
2439  for (Int_t ivar=0; ivar<nVar; ivar++) {
2440  fCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2441  }
2442 
2443  return;
2444 }
2445 
2447 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
2448 {
2449  //
2450  // Fill histograms or tree depending on fWriteVariableTree (tree not implemented yet)
2451  //
2452  if(!casc) return;
2453  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
2454  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
2455  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
2456  if(!cptrack) return;
2457  if(!cntrack) return;
2458  if(!cbtrack) return;
2459 
2460  fHistoXiMassvsPt->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2461  fHistoOmegaMassvsPt->Fill(casc->MassOmega(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2462  Double_t momxix = casc->MomXiX();
2463  Double_t momxiy = casc->MomXiY();
2464  Double_t phi_alice = atan2(momxiy,momxix);
2465  if(phi_alice<0.) phi_alice += 2 * M_PI;
2466  fHistoXiQovPtvsPhi->Fill(phi_alice,(Double_t)casc->ChargeXi()/sqrt(momxix*momxix+momxiy*momxiy));
2467 
2468  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2469  Double_t posVtx[3] = {0.,0.,0.};
2470  fVtx1->GetXYZ(posVtx);
2471  Double_t ptotlam = TMath::Sqrt(pow(casc->Px(),2)+pow(casc->Py(),2)+pow(casc->Pz(),2));
2472  Double_t dl = sqrt(pow(casc->DecayVertexV0X()-posVtx[0],2)+pow(casc->DecayVertexV0Y()-posVtx[1],2)+pow(casc->DecayVertexV0Z()-posVtx[2],2));
2473  Double_t v0propdl = dl*mlamPDG/ptotlam;
2474  if(fAnalCuts->IsPeakRegion(casc)){
2475  fHistoLambdaPtvsDl->Fill(casc->Pt(),v0propdl);
2476  fHistoLambdaPtvsDR->Fill(casc->Pt(),dl);
2477  }
2478  if(fAnalCuts->IsSideBand(casc)){
2479  fHistoLambdaPtvsDlSide->Fill(casc->Pt(),v0propdl);
2480  fHistoLambdaPtvsDRSide->Fill(casc->Pt(),dl);
2481  }
2482 
2483  Int_t xipdgcode = -9999;
2484  Int_t ximotherpdgcode = -9999;
2485  Float_t mcxipx = -9999.;
2486  Float_t mcxipy = -9999.;
2487  Float_t mcxipz = -9999.;
2488  Int_t labcasc = -9999.;
2489  if(fUseMCInfo){
2490  Int_t pdgDgcasc[2]={211,3122};
2491  Int_t pdgDgv0[2]={2212,211};
2492  labcasc = MatchToMCCascade(casc,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
2493  if(labcasc<0) return;
2494 
2495  fHistoXiMassvsPtMCS->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2496 
2497  AliAODMCParticle *mccasctrk = (AliAODMCParticle*)mcArray->At(labcasc);
2498  if(!mccasctrk) return;
2499 
2500  fHistoLambdaPtvsDlMCS->Fill(casc->Pt(),v0propdl);
2501  fHistoLambdaPtvsDRMCS->Fill(casc->Pt(),dl);
2502 
2503  Bool_t hfxi_flag = kFALSE;
2504  xipdgcode = mccasctrk->GetPdgCode();
2505  Int_t labcascmother = mccasctrk->GetMother();
2506  if(labcascmother>=0){
2507  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
2508  if(mothercasc){
2509  ximotherpdgcode = mothercasc->GetPdgCode();
2510  if(abs(ximotherpdgcode)>4000&&abs(ximotherpdgcode)<4400){
2511  hfxi_flag = kTRUE;
2512  }
2513  }
2514  }
2515  if(!hfxi_flag) return;
2516  mcxipx = mccasctrk->Px();
2517  mcxipy = mccasctrk->Py();
2518  mcxipz = mccasctrk->Pz();
2519  }
2520 
2521 
2522  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
2523  xyz[0]=casc->DecayVertexXiX();
2524  xyz[1]=casc->DecayVertexXiY();
2525  xyz[2]=casc->DecayVertexXiZ();
2526  pxpypz[0]=casc->MomXiX();
2527  pxpypz[1]=casc->MomXiY();
2528  pxpypz[2]=casc->MomXiZ();
2529  casc->GetCovarianceXYZPxPyPz(cv);
2530  sign=casc->ChargeXi();
2531  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
2532  trackCasc->PropagateToDCA(fVtx1,fBzkG,kVeryBig);
2533  Double_t momcasc_new[3]={-9999,-9999,-9999.};
2534  trackCasc->GetPxPyPz(momcasc_new);
2535 
2536  if(fDoEventMixing){
2537  TLorentzVector *lv = new TLorentzVector();
2538  lv->SetXYZM(momcasc_new[0],momcasc_new[1],momcasc_new[2],casc->MassXi());
2539  Double_t xyzR125pr[3]={9999.,9999.,9999.};
2540  Double_t xyzR125pi[3]={9999.,9999.,9999.};
2541  Double_t xyzR125bach[3]={9999.,9999.,9999.};
2542  if(casc->ChargeXi()>0){
2543  fCascadeTracks1->AddLast(lv);
2544  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.){
2545  fAnalCuts->SetSftPosR125(cptrack,fBzkG,posVtx,xyzR125pr);
2546  fAnalCuts->SetSftPosR125(cntrack,fBzkG,posVtx,xyzR125pi);
2547  fAnalCuts->SetSftPosR125(cbtrack,fBzkG,posVtx,xyzR125bach);
2548  }
2549  TVector *varvec = new TVector(9);
2550  (*varvec)[0] = xyzR125pr[0];
2551  (*varvec)[1] = xyzR125pr[1];
2552  (*varvec)[2] = xyzR125pr[2];
2553  (*varvec)[3] = xyzR125pi[0];
2554  (*varvec)[4] = xyzR125pi[1];
2555  (*varvec)[5] = xyzR125pi[2];
2556  (*varvec)[6] = xyzR125bach[0];
2557  (*varvec)[7] = xyzR125bach[1];
2558  (*varvec)[8] = xyzR125bach[2];
2559  fCascadeCutVarsArray1->AddLast(varvec);
2560  }else{
2561  fCascadeTracks2->AddLast(lv);
2562  if(fAnalCuts->GetCuts()[2]>0. || fAnalCuts->GetCuts()[3]>0.){
2563  fAnalCuts->SetSftPosR125(cntrack,fBzkG,posVtx,xyzR125pr);
2564  fAnalCuts->SetSftPosR125(cptrack,fBzkG,posVtx,xyzR125pi);
2565  fAnalCuts->SetSftPosR125(cbtrack,fBzkG,posVtx,xyzR125bach);
2566  }
2567  TVector *varvec = new TVector(9);
2568  (*varvec)[0] = xyzR125pr[0];
2569  (*varvec)[1] = xyzR125pr[1];
2570  (*varvec)[2] = xyzR125pr[2];
2571  (*varvec)[3] = xyzR125pi[0];
2572  (*varvec)[4] = xyzR125pi[1];
2573  (*varvec)[5] = xyzR125pi[2];
2574  (*varvec)[6] = xyzR125bach[0];
2575  (*varvec)[7] = xyzR125bach[1];
2576  (*varvec)[8] = xyzR125bach[2];
2577  fCascadeCutVarsArray2->AddLast(varvec);
2578  }
2579  }
2580 
2581  if(!fWriteEachVariableTree) return;
2582 
2583  for(Int_t i=0;i<26;i++){
2584  fCandidateCascVariables[i] = -9999.;
2585  }
2586 
2588  fCandidateCascVariables[ 1] = casc->MassXi();
2589  fCandidateCascVariables[ 2] = momcasc_new[0];//casc->MomXiX();
2590  fCandidateCascVariables[ 3] = momcasc_new[1];//casc->MomXiY();
2591  fCandidateCascVariables[ 4] = momcasc_new[2];//casc->MomXiZ();
2592  if(casc->ChargeXi()<0)
2593  fCandidateCascVariables[ 5] = casc->MassLambda();
2594  else
2595  fCandidateCascVariables[ 5] = casc->MassAntiLambda();
2596 
2597  fCandidateCascVariables[ 6] = casc->DcaXiDaughters();
2598  fCandidateCascVariables[ 7] = casc->DcaV0Daughters();
2599  fCandidateCascVariables[ 8] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
2600  fCandidateCascVariables[ 9] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
2601  fCandidateCascVariables[10] = casc->DcaV0ToPrimVertex();
2602  fCandidateCascVariables[11] = casc->DcaPosToPrimVertex();
2603  fCandidateCascVariables[12] = casc->DcaNegToPrimVertex();
2604  fCandidateCascVariables[13] = casc->DcaBachToPrimVertex();
2605  fCandidateCascVariables[14] = casc->DecayLengthV0();
2606  fCandidateCascVariables[15] = casc->CosPointingAngle(casc->GetDecayVertexXi());
2607  fCandidateCascVariables[16] = casc->ChargeXi();
2608  fCandidateCascVariables[17] = xipdgcode;
2609  fCandidateCascVariables[18] = ximotherpdgcode;
2610  fCandidateCascVariables[19] = mcxipx;
2611  fCandidateCascVariables[20] = mcxipy;
2612  fCandidateCascVariables[21] = mcxipz;
2613  fCandidateCascVariables[22] = labcasc;
2617 
2618 
2619  fCascVariablesTree->Fill();
2620 }
2623 {
2624  //
2625  // Define electron tree variables
2626  //
2627 
2628  const char* nameoutput = GetOutputSlot(7)->GetContainer()->GetName();
2629  fMCVariablesTree = new TTree(nameoutput,"MC variables tree");
2630  Int_t nVar = 16;
2631  fCandidateMCVariables = new Float_t [nVar];
2632  TString * fCandidateVariableNames = new TString[nVar];
2633 
2634  fCandidateVariableNames[ 0]="Centrality";
2635  fCandidateVariableNames[ 1]="DecayType";
2636  fCandidateVariableNames[ 2]="XicPx";
2637  fCandidateVariableNames[ 3]="XicPy";
2638  fCandidateVariableNames[ 4]="XicPz";
2639  fCandidateVariableNames[ 5]="ElePx";
2640  fCandidateVariableNames[ 6]="ElePy";
2641  fCandidateVariableNames[ 7]="ElePz";
2642  fCandidateVariableNames[ 8]="CascPx";
2643  fCandidateVariableNames[ 9]="CascPy";
2644  fCandidateVariableNames[10]="CascPz";
2645  fCandidateVariableNames[11]="PdgCode";
2646  fCandidateVariableNames[12]="ElePdgCode";
2647  fCandidateVariableNames[13]="CascPdgCode";
2648  fCandidateVariableNames[14]="RunNumber";
2649  fCandidateVariableNames[15]="EvNumber";
2650 
2651  for (Int_t ivar=0; ivar<nVar; ivar++) {
2652  fMCVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2653  }
2654  return;
2655 }
2657 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCROOTObjects(AliAODMCParticle *mcpart, AliAODMCParticle *mcepart, AliAODMCParticle *mccascpart, Int_t decaytype)
2658 {
2659  //
2660  // Fill histograms or tree depending on fWriteMCVariableTree
2661  //
2662  if(!mcpart) return;
2663  if(!mcepart) return;
2664  if(!mccascpart) return;
2665 
2666  for(Int_t i=0;i<14;i++){
2667  fCandidateMCVariables[i] = -9999.;
2668  }
2669 
2671  fCandidateMCVariables[ 1] = decaytype;
2672  fCandidateMCVariables[ 2] = mcpart->Px();
2673  fCandidateMCVariables[ 3] = mcpart->Py();
2674  fCandidateMCVariables[ 4] = mcpart->Pz();
2675  fCandidateMCVariables[ 5] = mcepart->Px();
2676  fCandidateMCVariables[ 6] = mcepart->Py();
2677  fCandidateMCVariables[ 7] = mcepart->Pz();
2678  fCandidateMCVariables[ 8] = mccascpart->Px();
2679  fCandidateMCVariables[ 9] = mccascpart->Py();
2680  fCandidateMCVariables[10] = mccascpart->Pz();
2681  fCandidateMCVariables[11] = mcpart->GetPdgCode();
2682  fCandidateMCVariables[12] = mcepart->GetPdgCode();
2683  fCandidateMCVariables[13] = mccascpart->GetPdgCode();
2686 
2687  Double_t epx = mcepart->Px();
2688  Double_t epy = mcepart->Py();
2689  Double_t epz = mcepart->Pz();
2690  Double_t eE = sqrt(epx*epx+epy*epy+epz*epz+0.000511*0.000511);
2691  Double_t cascpx = mccascpart->Px();
2692  Double_t cascpy = mccascpart->Py();
2693  Double_t cascpz = mccascpart->Pz();
2694  Double_t cascE = sqrt(cascpx*cascpx+cascpy*cascpy+cascpz*cascpz+1.32171*1.32171);
2695 
2696  Double_t InvMassEleXi = sqrt(pow(eE+cascE,2)-pow(epx+cascpx,2)-pow(epy+cascpy,2)-pow(epz+cascpz,2));
2697 
2698  Double_t cont[4];
2699  cont[0] = InvMassEleXi;
2700  cont[1] = mcpart->Pt();
2701  cont[2] = 0.0;
2702  cont[3] = fCentrality;
2703  Double_t cont2[3];
2704  cont2[0] = InvMassEleXi;
2705  cont2[1] = mcepart->Pt();
2706  cont2[2] = fCentrality;
2707  Double_t cont_eleptvseta[3];
2708  cont_eleptvseta[0] = mcepart->Pt();
2709  cont_eleptvseta[1] = mcepart->Eta();
2710  cont_eleptvseta[2] = fCentrality;
2711  Double_t cont_eleptvsxipt[3];
2712  cont_eleptvsxipt[0] = mcepart->Pt();
2713  cont_eleptvsxipt[1] = mccascpart->Pt();
2714  cont_eleptvsxipt[2] = fCentrality;
2715  Double_t cont_eleptvsxiptvsxicpt[4];
2716  cont_eleptvsxiptvsxicpt[0] = mcepart->Pt();
2717  cont_eleptvsxiptvsxicpt[1] = mccascpart->Pt();
2718  cont_eleptvsxiptvsxicpt[2] = mcpart->Pt();
2719  cont_eleptvsxiptvsxicpt[3] = fCentrality;
2720 
2721  Double_t contmc[3];
2722  contmc[0] = mcpart->Pt();
2723  contmc[1] = mcpart->Y();
2724  contmc[2] = fCentrality;
2725  Double_t contmcele[3];
2726  contmcele[0] = mcepart->Pt();
2727  contmcele[1] = mcepart->Eta();
2728  contmcele[2] = fCentrality;
2729 
2730 
2731  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
2732  Float_t etamin, etamax;
2733  esdcuts->GetEtaRange(etamin,etamax);
2734 
2735  if(decaytype==0){
2736  fHistoXicMCGen->Fill(contmc);
2737  if(mcpart->GetPdgCode()>0) fHistoXicMCGen1->Fill(contmc);//4132 is particle
2738  if(mcpart->GetPdgCode()<0) fHistoXicMCGen2->Fill(contmc);//-4132 is anti-particle
2739  fHistoXicElectronMCGen->Fill(contmcele);
2740  if(mcepart->GetPdgCode()<0) fHistoXicElectronMCGen1->Fill(contmcele);//-11 is positron
2741  if(mcepart->GetPdgCode()>0) fHistoXicElectronMCGen2->Fill(contmcele);//11 is electron
2742  fHistoEleXiMassMCGen->Fill(cont);
2743  if(fabs(mcepart->Eta())<etamax){
2744  fHistoEleXiMassvsElePtMCGen->Fill(cont2);
2745  if(mcepart->GetPdgCode()<0) fHistoEleXiMassvsElePtMCGen1->Fill(cont2);//-11 is positron
2746  if(mcepart->GetPdgCode()>0) fHistoEleXiMassvsElePtMCGen2->Fill(cont2);//11 is electron
2747  if(InvMassEleXi<2.5){
2748  fHistoElePtMCGen->Fill(mcepart->Pt(),fCentrality);
2749  fHistoElePtvsEtaMCGen->Fill(cont_eleptvseta);
2750  fHistoElePtvsXiPtMCGen->Fill(cont_eleptvsxipt);
2751  }
2752  }
2753  if(fabs(mcpart->Y())<0.7){
2754  if(InvMassEleXi<2.5){
2755  fHistoElePtvsXiPtMCXicGen->Fill(cont_eleptvsxipt);
2756  fHistoElePtvsXiPtvsXicPtMCGen->Fill(cont_eleptvsxiptvsxicpt);
2757  }
2758  }
2759  }
2760 
2762  fMCVariablesTree->Fill();
2763 }
2766 {
2767  //
2768  // Define mc gen electron tree variables
2769  //
2770 
2771  const char* nameoutput = GetOutputSlot(9)->GetContainer()->GetName();
2772  fMCEleVariablesTree = new TTree(nameoutput,"MC Ele variables tree");
2773  Int_t nVar = 8;
2774  fCandidateMCEleVariables = new Float_t [nVar];
2775  TString * fCandidateVariableNames = new TString[nVar];
2776 
2777  fCandidateVariableNames[ 0]="Centrality";
2778  fCandidateVariableNames[ 1]="ElePx";
2779  fCandidateVariableNames[ 2]="ElePy";
2780  fCandidateVariableNames[ 3]="ElePz";
2781  fCandidateVariableNames[ 4]="ElePdgCode";
2782  fCandidateVariableNames[ 5]="EleMotherPdgCode";
2783  fCandidateVariableNames[ 6]="RunNumber";
2784  fCandidateVariableNames[ 7]="EvNumber";
2785 
2786  for (Int_t ivar=0; ivar<nVar; ivar++) {
2787  fMCEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2788  }
2789  return;
2790 }
2792 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
2793 {
2794  //
2795  // Fill tree depending on fWriteMCVariableTree
2796  //
2797  if(!mcepart) return;
2798 
2799  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;
2800  GetMCDecayHistory(mcepart,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
2801  Bool_t ele_from_bottom = HaveBottomInHistory(pdgarray_ele);
2802  Bool_t ele_from_charm = HaveCharmInHistory(pdgarray_ele);
2803 
2804  Double_t contmc[3];
2805  contmc[0] = mcepart->Pt();
2806  contmc[1] = mcepart->Eta();
2807  contmc[2] = fCentrality;
2808 
2809  if(ele_from_bottom){
2810  fHistoBottomElectronMCGen->Fill(contmc);
2811  }else if(ele_from_charm){
2812  fHistoCharmElectronMCGen->Fill(contmc);
2813  }
2814 
2815 
2816  Bool_t hfe_flag = kFALSE;
2817  Int_t labemother = mcepart->GetMother();
2818  Int_t pdgmotherele = -9999;
2819  if(labemother>=0){
2820  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
2821  pdgmotherele = motherele->GetPdgCode();
2822  if(abs(pdgmotherele)>4000&&abs(pdgmotherele)<4400){
2823  hfe_flag = kTRUE;
2824  }
2825  }
2826  if(!hfe_flag) return;
2827 
2828  fHistoElectronMCGen->Fill(contmc);
2829 
2830  for(Int_t i=0;i<8;i++){
2831  fCandidateMCEleVariables[i] = -9999.;
2832  }
2833 
2835  fCandidateMCEleVariables[ 1] = mcepart->Px();
2836  fCandidateMCEleVariables[ 2] = mcepart->Py();
2837  fCandidateMCEleVariables[ 3] = mcepart->Pz();
2838  fCandidateMCEleVariables[ 4] = mcepart->GetPdgCode();
2839  fCandidateMCEleVariables[ 5] = pdgmotherele;
2842 
2843  // This function makes output too heavy (do not use if you have output size limitation)
2844  //if(fWriteMCVariableTree && fWriteEachVariableTree && mcepart->Pt()>0.4 && fabs(mcepart->Eta())<1.0)
2845  //fMCEleVariablesTree->Fill();
2846 }
2849 {
2850  //
2851  // Define Mc cascade tree variables
2852  //
2853 
2854  const char* nameoutput = GetOutputSlot(10)->GetContainer()->GetName();
2855  fMCCascVariablesTree = new TTree(nameoutput,"MC cascade variables tree");
2856  Int_t nVar = 8;
2857  fCandidateMCCascVariables = new Float_t [nVar];
2858  TString * fCandidateVariableNames = new TString[nVar];
2859 
2860  fCandidateVariableNames[ 0]="Centrality";
2861  fCandidateVariableNames[ 1]="CascPx";
2862  fCandidateVariableNames[ 2]="CascPy";
2863  fCandidateVariableNames[ 3]="CascPz";
2864  fCandidateVariableNames[ 4]="CascPdgCode";
2865  fCandidateVariableNames[ 5]="CascMotherPdgCode";
2866  fCandidateVariableNames[ 6]="RunNumber";
2867  fCandidateVariableNames[ 7]="EvNumber";
2868 
2869  for (Int_t ivar=0; ivar<nVar; ivar++) {
2870  fMCCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2871  }
2872  return;
2873 }
2875 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCCascROOTObjects(AliAODMCParticle *mccascpart, TClonesArray *mcArray)
2876 {
2877  //
2878  // Fill histograms or tree depending on fWriteMCVariableTree
2879  //
2880  if(!mccascpart) return;
2881 
2882  for(Int_t i=0;i<8;i++){
2883  fCandidateMCCascVariables[i] = -9999.;
2884  }
2885 
2886  Bool_t hfxi_flag = kFALSE;
2887  Int_t labcascmother = mccascpart->GetMother();
2888  Int_t pdgmothercasc = -9999;
2889  if(labcascmother>=0){
2890  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
2891  if(mothercasc){
2892  pdgmothercasc = mothercasc->GetPdgCode();
2893  if(abs(pdgmothercasc)>4000&&abs(pdgmothercasc)<4400){
2894  hfxi_flag = kTRUE;
2895  }
2896  }
2897  }
2898  if(!hfxi_flag) return;
2899 
2900  Double_t contmc[3];
2901  contmc[0] = mccascpart->Pt();
2902  contmc[1] = mccascpart->Eta();
2903  contmc[2] = fCentrality;
2904  fHistoXiMCGen->Fill(contmc);
2905 
2907  fCandidateMCCascVariables[ 1] = mccascpart->Px();
2908  fCandidateMCCascVariables[ 2] = mccascpart->Py();
2909  fCandidateMCCascVariables[ 3] = mccascpart->Pz();
2910  fCandidateMCCascVariables[ 4] = mccascpart->GetPdgCode();
2911  fCandidateMCCascVariables[ 5] = pdgmothercasc;
2914 
2915  // This function makes output too heavy (do not use if you have output size limitation)
2916  //if(fWriteMCVariableTree && fWriteEachVariableTree && mccascpart->Pt()>0.4 && fabs(mccascpart->Eta())<1.0)
2917  //fMCCascVariablesTree->Fill();
2918 }
2919 
2922  //
2923  // This is to define general histograms
2924  //
2925 
2926  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
2927  fCEvents->SetStats(kTRUE);
2928  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
2929  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
2930  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
2931  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
2932  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
2933  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
2934  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
2935  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
2936  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
2937  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
2938  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
2939  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
2940  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
2941  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
2942  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2943  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
2944  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
2945  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2946  //fCEvents->GetXaxis()->SetTitle("");
2947  fCEvents->GetYaxis()->SetTitle("counts");
2948 
2949  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
2950  fHTrigger->SetStats(kTRUE);
2951  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
2952  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
2953  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
2954  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
2955  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
2956  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
2957  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
2958  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
2959  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
2960  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
2961  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
2962  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
2963 
2964  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
2965 
2966 
2967  fOutput->Add(fCEvents);
2968  fOutput->Add(fHTrigger);
2969  fOutput->Add(fHCentrality);
2970 
2971  return;
2972 }
2973 //__________________________________________________________________________
2975 {
2976  //
2977  // Define analyis histograms
2978  //
2979 
2980  //------------------------------------------------
2981  // Basic histogram
2982  //------------------------------------------------
2983  Int_t bins_base[4]= {22 ,100 , 100 ,10};
2984  Double_t xmin_base[4]={1.3,0 , -0.5 ,0.00};
2985  Double_t xmax_base[4]={5.7,20. , 0.5 ,100};
2986 
2987  fHistoEleXiMass = new THnSparseF("fHistoEleXiMass","",4,bins_base,xmin_base,xmax_base);
2989  fHistoEleXiMassRS = new THnSparseF("fHistoEleXiMassRS","",4,bins_base,xmin_base,xmax_base);
2991  fHistoEleXiMassWS = new THnSparseF("fHistoEleXiMassWS","",4,bins_base,xmin_base,xmax_base);
2993  fHistoEleXiMassRSMix = new THnSparseF("fHistoEleXiMassRSMix","",4,bins_base,xmin_base,xmax_base);
2995  fHistoEleXiMassWSMix = new THnSparseF("fHistoEleXiMassWSMix","",4,bins_base,xmin_base,xmax_base);
2997  fHistoEleXiMassRSSide = new THnSparseF("fHistoEleXiMassRSSide","",4,bins_base,xmin_base,xmax_base);
2999  fHistoEleXiMassWSSide = new THnSparseF("fHistoEleXiMassWSSide","",4,bins_base,xmin_base,xmax_base);
3001  fHistoEleXiMassRS1 = new THnSparseF("fHistoEleXiMassRS1","",4,bins_base,xmin_base,xmax_base);
3003  fHistoEleXiMassWS1 = new THnSparseF("fHistoEleXiMassWS1","",4,bins_base,xmin_base,xmax_base);
3005  fHistoEleXiMassRSMix1 = new THnSparseF("fHistoEleXiMassRSMix1","",4,bins_base,xmin_base,xmax_base);
3007  fHistoEleXiMassWSMix1 = new THnSparseF("fHistoEleXiMassWSMix1","",4,bins_base,xmin_base,xmax_base);
3009  fHistoEleXiMassRSSide1 = new THnSparseF("fHistoEleXiMassRSSide1","",4,bins_base,xmin_base,xmax_base);
3011  fHistoEleXiMassWSSide1 = new THnSparseF("fHistoEleXiMassWSSide1","",4,bins_base,xmin_base,xmax_base);
3013  fHistoEleXiMassRS2 = new THnSparseF("fHistoEleXiMassRS2","",4,bins_base,xmin_base,xmax_base);
3015  fHistoEleXiMassWS2 = new THnSparseF("fHistoEleXiMassWS2","",4,bins_base,xmin_base,xmax_base);
3017  fHistoEleXiMassRSMix2 = new THnSparseF("fHistoEleXiMassRSMix2","",4,bins_base,xmin_base,xmax_base);
3019  fHistoEleXiMassWSMix2 = new THnSparseF("fHistoEleXiMassWSMix2","",4,bins_base,xmin_base,xmax_base);
3021  fHistoEleXiMassRSSide2 = new THnSparseF("fHistoEleXiMassRSSide2","",4,bins_base,xmin_base,xmax_base);
3023  fHistoEleXiMassWSSide2 = new THnSparseF("fHistoEleXiMassWSSide2","",4,bins_base,xmin_base,xmax_base);
3025 
3026  fHistoEleXiMassRSAway = new THnSparseF("fHistoEleXiMassRSAway","",4,bins_base,xmin_base,xmax_base);
3028  fHistoEleXiMassWSAway = new THnSparseF("fHistoEleXiMassWSAway","",4,bins_base,xmin_base,xmax_base);
3030  fHistoEleXiMassRSMixAway = new THnSparseF("fHistoEleXiMassRSMixAway","",4,bins_base,xmin_base,xmax_base);
3032  fHistoEleXiMassWSMixAway = new THnSparseF("fHistoEleXiMassWSMixAway","",4,bins_base,xmin_base,xmax_base);
3034  fHistoEleXiMassRSSideAway = new THnSparseF("fHistoEleXiMassRSSideAway","",4,bins_base,xmin_base,xmax_base);
3036  fHistoEleXiMassWSSideAway = new THnSparseF("fHistoEleXiMassWSSideAway","",4,bins_base,xmin_base,xmax_base);
3038  fHistoEleXiMassRS1Away = new THnSparseF("fHistoEleXiMassRS1Away","",4,bins_base,xmin_base,xmax_base);
3040  fHistoEleXiMassWS1Away = new THnSparseF("fHistoEleXiMassWS1Away","",4,bins_base,xmin_base,xmax_base);
3042  fHistoEleXiMassRSMix1Away = new THnSparseF("fHistoEleXiMassRSMix1Away","",4,bins_base,xmin_base,xmax_base);
3044  fHistoEleXiMassWSMix1Away = new THnSparseF("fHistoEleXiMassWSMix1Away","",4,bins_base,xmin_base,xmax_base);
3046  fHistoEleXiMassRSSide1Away = new THnSparseF("fHistoEleXiMassRSSide1Away","",4,bins_base,xmin_base,xmax_base);
3048  fHistoEleXiMassWSSide1Away = new THnSparseF("fHistoEleXiMassWSSide1Away","",4,bins_base,xmin_base,xmax_base);
3050  fHistoEleXiMassRS2Away = new THnSparseF("fHistoEleXiMassRS2Away","",4,bins_base,xmin_base,xmax_base);
3052  fHistoEleXiMassWS2Away = new THnSparseF("fHistoEleXiMassWS2Away","",4,bins_base,xmin_base,xmax_base);
3054  fHistoEleXiMassRSMix2Away = new THnSparseF("fHistoEleXiMassRSMix2Away","",4,bins_base,xmin_base,xmax_base);
3056  fHistoEleXiMassWSMix2Away = new THnSparseF("fHistoEleXiMassWSMix2Away","",4,bins_base,xmin_base,xmax_base);
3058  fHistoEleXiMassRSSide2Away = new THnSparseF("fHistoEleXiMassRSSide2Away","",4,bins_base,xmin_base,xmax_base);
3060  fHistoEleXiMassWSSide2Away = new THnSparseF("fHistoEleXiMassWSSide2Away","",4,bins_base,xmin_base,xmax_base);
3062 
3063  Int_t bins_base_elept[3]= {10 ,100 ,10};
3064  Double_t xmin_base_elept[3]={1.3,0 ,0.00};
3065  Double_t xmax_base_elept[3]={3.3,10. ,100};
3066 
3067  fHistoEleXiMassvsElePtRS = new THnSparseF("fHistoEleXiMassvsElePtRS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3069  fHistoEleXiMassvsElePtWS = new THnSparseF("fHistoEleXiMassvsElePtWS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3071  fHistoEleXiMassvsElePtRSMix = new THnSparseF("fHistoEleXiMassvsElePtRSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3073  fHistoEleXiMassvsElePtWSMix = new THnSparseF("fHistoEleXiMassvsElePtWSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3075  fHistoEleXiMassvsElePtRSSide = new THnSparseF("fHistoEleXiMassvsElePtRSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3077  fHistoEleXiMassvsElePtWSSide = new THnSparseF("fHistoEleXiMassvsElePtWSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3079  fHistoEleXiMassvsElePtRS1 = new THnSparseF("fHistoEleXiMassvsElePtRS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3081  fHistoEleXiMassvsElePtWS1 = new THnSparseF("fHistoEleXiMassvsElePtWS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3083  fHistoEleXiMassvsElePtRSMix1 = new THnSparseF("fHistoEleXiMassvsElePtRSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3085  fHistoEleXiMassvsElePtWSMix1 = new THnSparseF("fHistoEleXiMassvsElePtWSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3087  fHistoEleXiMassvsElePtRSSide1 = new THnSparseF("fHistoEleXiMassvsElePtRSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3089  fHistoEleXiMassvsElePtWSSide1 = new THnSparseF("fHistoEleXiMassvsElePtWSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3091  fHistoEleXiMassvsElePtRS2 = new THnSparseF("fHistoEleXiMassvsElePtRS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3093  fHistoEleXiMassvsElePtWS2 = new THnSparseF("fHistoEleXiMassvsElePtWS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3095  fHistoEleXiMassvsElePtRSMix2 = new THnSparseF("fHistoEleXiMassvsElePtRSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3097  fHistoEleXiMassvsElePtWSMix2 = new THnSparseF("fHistoEleXiMassvsElePtWSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3099  fHistoEleXiMassvsElePtRSSide2 = new THnSparseF("fHistoEleXiMassvsElePtRSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3101  fHistoEleXiMassvsElePtWSSide2 = new THnSparseF("fHistoEleXiMassvsElePtWSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3103 
3104  fHistoElePtRS=new TH2F("fHistoElePtRS","Right-sign e pt",100,0.,10.,10,0.,100.);
3105  fOutputAll->Add(fHistoElePtRS);
3106  fHistoElePtWS=new TH2F("fHistoElePtWS","Wrong-sign e pt",100,0.,10.,10,0.,100.);
3107  fOutputAll->Add(fHistoElePtWS);
3108  fHistoElePtRSMix=new TH2F("fHistoElePtRSMix","Right-sign e pt",100,0.,10.,10,0.,100.);
3110  fHistoElePtWSMix=new TH2F("fHistoElePtWSMix","Wrong-sign e pt",100,0.,10.,10,0.,100.);
3112 
3113  fHistoEleXiMassMCS = new THnSparseF("fHistoEleXiMassMCS","",4,bins_base,xmin_base,xmax_base);
3115  fHistoEleXiMassMCS1 = new THnSparseF("fHistoEleXiMassMCS1","",4,bins_base,xmin_base,xmax_base);
3117  fHistoEleXiMassMCS2 = new THnSparseF("fHistoEleXiMassMCS2","",4,bins_base,xmin_base,xmax_base);
3119  fHistoEleXiMassXibMCS = new THnSparseF("fHistoEleXiMassXibMCS","",4,bins_base,xmin_base,xmax_base);
3121  fHistoEleXiMassXibMCS1 = new THnSparseF("fHistoEleXiMassXibMCS1","",4,bins_base,xmin_base,xmax_base);
3123  fHistoEleXiMassXibMCS2 = new THnSparseF("fHistoEleXiMassXibMCS2","",4,bins_base,xmin_base,xmax_base);
3125  fHistoEleXiMassPromptMCS = new THnSparseF("fHistoEleXiMassPromptMCS","",4,bins_base,xmin_base,xmax_base);
3127  fHistoEleXiMassPromptMCS1 = new THnSparseF("fHistoEleXiMassPromptMCS1","",4,bins_base,xmin_base,xmax_base);
3129  fHistoEleXiMassPromptMCS2 = new THnSparseF("fHistoEleXiMassPromptMCS2","",4,bins_base,xmin_base,xmax_base);
3131  fHistoEleXiMassBFeeddownMCS = new THnSparseF("fHistoEleXiMassBFeeddownMCS","",4,bins_base,xmin_base,xmax_base);
3133  fHistoEleXiMassBFeeddownMCS1 = new THnSparseF("fHistoEleXiMassBFeeddownMCS1","",4,bins_base,xmin_base,xmax_base);
3135  fHistoEleXiMassBFeeddownMCS2 = new THnSparseF("fHistoEleXiMassBFeeddownMCS2","",4,bins_base,xmin_base,xmax_base);
3137  fHistoEleXiMassMCGen = new THnSparseF("fHistoEleXiMassMCGen","",4,bins_base,xmin_base,xmax_base);
3139  fHistoEleXiMassvsElePtMCS = new THnSparseF("fHistoEleXiMassvsElePtMCS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3141  fHistoEleXiMassvsElePtMCGen = new THnSparseF("fHistoEleXiMassvsElePtMCGen","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3143  fHistoEleXiMassvsElePtMCS1 = new THnSparseF("fHistoEleXiMassvsElePtMCS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3145  fHistoEleXiMassvsElePtMCGen1 = new THnSparseF("fHistoEleXiMassvsElePtMCGen1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3147  fHistoEleXiMassvsElePtMCS2 = new THnSparseF("fHistoEleXiMassvsElePtMCS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3149  fHistoEleXiMassvsElePtMCGen2 = new THnSparseF("fHistoEleXiMassvsElePtMCGen2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
3151  fHistoElePtMCS=new TH2F("fHistoElePtMCS","MC S e pt",100,0.,10.,10,0.,100.);
3152  fOutputAll->Add(fHistoElePtMCS);
3153  fHistoElePtMCGen=new TH2F("fHistoElePtMCGen","MC Gen e pt",100,0.,10.,10,0.,100.);
3155 
3156  Int_t bins_eleptvseta[3]= {50,20 ,10};
3157  Double_t xmin_eleptvseta[3]={0.,-1. ,0.0};
3158  Double_t xmax_eleptvseta[3]={5.,1. ,100};
3159 
3160  fHistoElePtvsEtaRS = new THnSparseF("fHistoElePtvsEtaRS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3162  fHistoElePtvsEtaWS = new THnSparseF("fHistoElePtvsEtaWS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3164  fHistoElePtvsEtaRSMix = new THnSparseF("fHistoElePtvsEtaRSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3166  fHistoElePtvsEtaWSMix = new THnSparseF("fHistoElePtvsEtaWSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3168  fHistoElePtvsEtaMCS = new THnSparseF("fHistoElePtvsEtaMCS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3170  fHistoElePtvsEtaMCGen = new THnSparseF("fHistoElePtvsEtaMCGen","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
3172 
3173  Int_t bins_eleptvsxipt[3]= {50,20 ,10};
3174  Double_t xmin_eleptvsxipt[3]={0.,0. ,0.0};
3175  Double_t xmax_eleptvsxipt[3]={5.,5. ,100};
3176 
3177  fHistoElePtvsXiPtRS = new THnSparseF("fHistoElePtvsXiPtRS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3179  fHistoElePtvsXiPtWS = new THnSparseF("fHistoElePtvsXiPtWS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3181  fHistoElePtvsXiPtRSMix = new THnSparseF("fHistoElePtvsXiPtRSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3183  fHistoElePtvsXiPtWSMix = new THnSparseF("fHistoElePtvsXiPtWSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3185  fHistoElePtvsXiPtMCS = new THnSparseF("fHistoElePtvsXiPtMCS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3187  fHistoElePtvsXiPtMCGen = new THnSparseF("fHistoElePtvsXiPtMCGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3189  fHistoElePtvsXiPtMCXicGen = new THnSparseF("fHistoElePtvsXiPtMCXicGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
3191 
3192  Int_t bins_eleptvsxiptvsxicpt[4]= {50,20,10,10};
3193  Double_t xmin_eleptvsxiptvsxicpt[4]={0.,0.,0.,0.0};
3194  Double_t xmax_eleptvsxiptvsxicpt[4]={5.,5.,10.,100};
3195  fHistoElePtvsXiPtvsXicPtMCS = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCS","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
3197  fHistoElePtvsXiPtvsXicPtMCGen = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCGen","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
3199 
3200  Int_t bins_eleptvsd0[3]= {50 ,50 ,10};
3201  Double_t xmin_eleptvsd0[3]={0.,-0.2 ,0.0};
3202  Double_t xmax_eleptvsd0[3]={5.,0.2 ,100};
3203 
3204  fHistoElePtvsd0RS = new THnSparseF("fHistoElePtvsd0RS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3206  fHistoElePtvsd0WS = new THnSparseF("fHistoElePtvsd0WS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3208  fHistoElePtvsd0RSMix = new THnSparseF("fHistoElePtvsd0RSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3210  fHistoElePtvsd0WSMix = new THnSparseF("fHistoElePtvsd0WSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3212  fHistoElePtvsd0MCS = new THnSparseF("fHistoElePtvsd0MCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3214  fHistoElePtvsd0PromptMCS = new THnSparseF("fHistoElePtvsd0PromptMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3216  fHistoElePtvsd0BFeeddownMCS = new THnSparseF("fHistoElePtvsd0BFeeddownMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
3218 
3219  //------------------------------------------------
3220  // checking histograms
3221  //------------------------------------------------
3222  fHistoBachPt = new TH1F("fHistoBachPt","Bachelor p_{T}",100,0.0,5.0);
3223  fOutputAll->Add(fHistoBachPt);
3224  fHistoBachPtMCS = new TH1F("fHistoBachPtMCS","Bachelor p_{T}",100,0.0,5.0);
3226  fHistoBachPtMCGen = new TH1F("fHistoBachPtMCGen","Bachelor p_{T}",100,0.0,5.0);
3228  fHistod0Bach = new TH1F("fHistod0Bach","Bachelor d_{0}",100,-0.5,0.5);
3229  fOutputAll->Add(fHistod0Bach);
3230  fHistoXiMassvsPt=new TH2F("fHistoXiMassvsPt","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
3232  fHistoXiMassvsPtMCS=new TH2F("fHistoXiMassvsPtMCS","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
3234  fHistoXiMassvsPtMCGen=new TH2F("fHistoXiMassvsPtMCGen","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
3236  fHistoOmegaMassvsPt=new TH2F("fHistoOmegaMassvsPt","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
3238 
3239  fHistoElectronTPCPID=new TH2F("fHistoElectronTPCPID","",50,0.,5.,50,-20.,20.);
3241  fHistoElectronTOFPID=new TH2F("fHistoElectronTOFPID","",50,0.,5.,50,-20.,20.);
3243  fHistoElectronTPCSelPID=new TH2F("fHistoElectronTPCSelPID","",50,0.,5.,50,-20.,20.);
3245  fHistoElectronTOFSelPID=new TH2F("fHistoElectronTOFSelPID","",50,0.,5.,50,-20.,20.);
3247  fHistoElectronTPCPIDSelTOF=new TH2F("fHistoElectronTPCPIDSelTOF","",10,0.,5.,500,-10.,10.);
3249  fHistoElectronTOFPIDSelTPC=new TH2F("fHistoElectronTOFPIDSelTPC","",10,0.,5.,500,-10.,10.);
3251  fHistoElectronTPCPIDSelTOFSmallEta=new TH2F("fHistoElectronTPCPIDSelTOFSmallEta","",10,0.,5.,500,-10.,10.);
3253  fHistoElectronTPCPIDSelTOFLargeEta=new TH2F("fHistoElectronTPCPIDSelTOFLargeEta","",10,0.,5.,500,-10.,10.);
3255  fHistoMassConversionsMin=new TH1F("fHistoMassConversionsMin","",500,0,0.5);
3257  fHistoMassConversionsSameSignMin=new TH1F("fHistoMassConversionsSameSignMin","",500,0,0.5);
3259 
3260  for(Int_t i=0;i<8;i++){
3261  fHistoElectronTPCPIDSelTOFEtaDep[i]=new TH2F(Form("fHistoElectronTPCPIDSelTOFEtaDep[%d]",i),"",10,0.,5.,500,-10.,10.);
3263  }
3264 
3265  fHistoElectronQovPtvsPhi=new TH2F("fHistoElectronQovPtvsPhi","",70,0.,7.,50,-2.,2.);
3267  fHistoXiQovPtvsPhi=new TH2F("fHistoXiQovPtvsPhi","",70,0.,7.,50,-2.,2.);
3269 
3270  Int_t bins_xicmcgen[3]= {100 ,20 ,10};
3271  Double_t xmin_xicmcgen[3]={0.,-1.0 ,0.0};
3272  Double_t xmax_xicmcgen[3]={20.,1.0 ,100};
3273  fHistoXicMCGen = new THnSparseF("fHistoXicMCGen","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3274  fOutputAll->Add(fHistoXicMCGen);
3275  fHistoXicMCGen1 = new THnSparseF("fHistoXicMCGen1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3277  fHistoXicMCGen2 = new THnSparseF("fHistoXicMCGen2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3279  fHistoXicMCS = new THnSparseF("fHistoXicMCS","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3280  fOutputAll->Add(fHistoXicMCS);
3281  fHistoXicMCS1 = new THnSparseF("fHistoXicMCS1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3282  fOutputAll->Add(fHistoXicMCS1);
3283  fHistoXicMCS2 = new THnSparseF("fHistoXicMCS2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
3284  fOutputAll->Add(fHistoXicMCS2);
3285 
3286  Int_t bins_elemcgen[3]= {100 ,20 ,10};
3287  Double_t xmin_elemcgen[3]={0.,-1.0 ,0.0};
3288  Double_t xmax_elemcgen[3]={10.,1.0 ,100};
3289  fHistoElectronMCGen = new THnSparseF("fHistoElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3291  fHistoBottomElectronMCGen = new THnSparseF("fHistoBottomElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3293  fHistoCharmElectronMCGen = new THnSparseF("fHistoCharmElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3295  fHistoXicElectronMCGen = new THnSparseF("fHistoXicElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3297  fHistoXicElectronMCGen1 = new THnSparseF("fHistoXicElectronMCGen1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3299  fHistoXicElectronMCGen2 = new THnSparseF("fHistoXicElectronMCGen2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3301  fHistoXicElectronMCS = new THnSparseF("fHistoXicElectronMCS","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3303  fHistoXicElectronMCS1 = new THnSparseF("fHistoXicElectronMCS1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3305  fHistoXicElectronMCS2 = new THnSparseF("fHistoXicElectronMCS2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
3307 
3308  Int_t bins_ximcgen[3]= {50 ,20 ,10};
3309  Double_t xmin_ximcgen[3]={0.,-1.0 ,0.0};
3310  Double_t xmax_ximcgen[3]={10.,1.0 ,100};
3311  fHistoXiMCGen = new THnSparseF("fHistoXiMCGen","",3,bins_ximcgen,xmin_ximcgen,xmax_ximcgen);
3312  fOutputAll->Add(fHistoXiMCGen);
3313 
3314  fHistoLambdaPtvsDl=new TH2F("fHistoLambdaPtvsDl","Lambda pt vs dl",20,0.,10.,20,0.,40.);
3316  fHistoLambdaPtvsDlSide=new TH2F("fHistoLambdaPtvsDlSide","Lambda pt vs dl",20,0.,10.,20,0.,40.);
3318  fHistoLambdaPtvsDlMCS=new TH2F("fHistoLambdaPtvsDlMCS","Lambda pt vs dl",20,0.,10.,20,0.,40.);
3320  fHistoLambdaPtvsDR=new TH2F("fHistoLambdaPtvsDR","Lambda pt vs dl",20,0.,10.,80,0.,160.);
3322  fHistoLambdaPtvsDRSide=new TH2F("fHistoLambdaPtvsDRSide","Lambda pt vs dl",20,0.,10.,80,0.,160.);
3324  fHistoLambdaPtvsDRMCS=new TH2F("fHistoLambdaPtvsDRMCS","Lambda pt vs dl",20,0.,10.,80,0.,160.);
3326 
3327  fHistoEleXiPtvsRapidityRS=new TH2F("fHistoEleXiPtvsRapidityRS","EleXi pt vs rap",20,0.,20.,40,-2.,2.);
3329  fHistoEleXiPtvsRapidityWS=new TH2F("fHistoEleXiPtvsRapidityWS","EleXi pt vs rap",20,0.,20.,40,-2.,2.);
3331  fHistoEleXiPtvsRapidityMCS=new TH2F("fHistoEleXiPtvsRapidityMCS","EleXi pt vs rap",20,0.,20.,40,-2.,2.);
3333 
3334  fHistoResponseElePt = new TH2D("fHistoResponseElePt","",100,0.,20.,100,0.,10.);
3336  fHistoResponseXiPt = new TH2D("fHistoResponseXiPt","",100,0.,20.,100,0.,20.);
3338  fHistoResponseEleXiPt = new TH2D("fHistoResponseEleXiPt","",100,0.,20.,100,0.,20.);
3340 
3341 
3342  fHistonEvtvsRunNumber=new TH1F("fHistonEvtvsRunNumber","",20000,-0.5,19999.5);
3344  fHistonElevsRunNumber=new TH1F("fHistonElevsRunNumber","",20000,-0.5,19999.5);
3346  fHistonXivsRunNumber=new TH1F("fHistonXivsRunNumber","",20000,-0.5,19999.5);
3348  fHistoMCEventType=new TH1F("fHistoMCEventType","",4,-0.5,3.5);
3350  fHistoMCXic0Decays=new TH1F("fHistoMCXic0Decays","",4,0.5,4.5);
3352  fHistoMCDeltaPhiccbar=new TH1F("fHistoMCDeltaPhiccbar","",100,0.,3.2);
3354  fHistoMCNccbar=new TH1F("fHistoMCNccbar","",100,-0.5,99.5);
3355  fOutputAll->Add(fHistoMCNccbar);
3356 
3357  fHistodPhiSdEtaSElectronProtonR125RS = new TH2D("fHistodPhiSdEtaSElectronProtonR125RS","",50,0.,0.2,50,0.,0.2);
3359  fHistodPhiSdEtaSElectronProtonR125WS = new TH2D("fHistodPhiSdEtaSElectronProtonR125WS","",50,0.,0.2,50,0.,0.2);
3361  fHistodPhiSdEtaSElectronProtonR125RSMix = new TH2D("fHistodPhiSdEtaSElectronProtonR125RSMix","",50,0.,0.2,50,0.,0.2);
3363  fHistodPhiSdEtaSElectronProtonR125WSMix = new TH2D("fHistodPhiSdEtaSElectronProtonR125WSMix","",50,0.,0.2,50,0.,0.2);
3365  fHistodPhiSdEtaSElectronPionR125RS = new TH2D("fHistodPhiSdEtaSElectronPionR125RS","",50,0.,0.2,50,0.,0.2);
3367  fHistodPhiSdEtaSElectronPionR125WS = new TH2D("fHistodPhiSdEtaSElectronPionR125WS","",50,0.,0.2,50,0.,0.2);
3369  fHistodPhiSdEtaSElectronPionR125RSMix = new TH2D("fHistodPhiSdEtaSElectronPionR125RSMix","",50,0.,0.2,50,0.,0.2);
3371  fHistodPhiSdEtaSElectronPionR125WSMix = new TH2D("fHistodPhiSdEtaSElectronPionR125WSMix","",50,0.,0.2,50,0.,0.2);
3373  fHistodPhiSdEtaSElectronBachelorR125RS = new TH2D("fHistodPhiSdEtaSElectronBachelorR125RS","",50,0.,0.2,50,0.,0.2);
3375  fHistodPhiSdEtaSElectronBachelorR125WS = new TH2D("fHistodPhiSdEtaSElectronBachelorR125WS","",50,0.,0.2,50,0.,0.2);
3377  fHistodPhiSdEtaSElectronBachelorR125RSMix = new TH2D("fHistodPhiSdEtaSElectronBachelorR125RSMix","",50,0.,0.2,50,0.,0.2);
3379  fHistodPhiSdEtaSElectronBachelorR125WSMix = new TH2D("fHistodPhiSdEtaSElectronBachelorR125WSMix","",50,0.,0.2,50,0.,0.2);
3381 
3382  for(Int_t ih=0;ih<23;ih++){
3383  Int_t bins_eleptvscutvars[3];
3384  Double_t xmin_eleptvscutvars[3];
3385  Double_t xmax_eleptvscutvars[3];
3386 
3387  bins_eleptvscutvars[0] = 20;//electron pT bin
3388  xmin_eleptvscutvars[0] = 0.;
3389  xmax_eleptvscutvars[0] = 20.;
3390  bins_eleptvscutvars[2] = 10;//centrality bin
3391  xmin_eleptvscutvars[2] = 0.;
3392  xmax_eleptvscutvars[2] = 100.;
3393 
3394  if(ih==0 || ih==1){
3395  //0: TPC Ncluster 1: TPC ncluster PID
3396  bins_eleptvscutvars[1] = 40;
3397  xmin_eleptvscutvars[1] = 0.;
3398  xmax_eleptvscutvars[1] = 160.;
3399  }else if(ih==2 || ih==3){
3400  //2: nSigma(TPC,e) 3: nSigma(TOF,e)
3401  bins_eleptvscutvars[1] = 20;
3402  xmin_eleptvscutvars[1] = -5.;
3403  xmax_eleptvscutvars[1] = 5.;
3404  }else if(ih==4){
3405  //4: eta
3406  bins_eleptvscutvars[1] = 30;
3407  xmin_eleptvscutvars[1] = -1.5;
3408  xmax_eleptvscutvars[1] = 1.5;
3409  }else if(ih==5){
3410  //5: nITS cluster
3411  bins_eleptvscutvars[1] = 7;
3412  xmin_eleptvscutvars[1] = -0.5;
3413  xmax_eleptvscutvars[1] = 6.5;
3414  }else if(ih==6){
3415  //6: Lambda mass
3416  bins_eleptvscutvars[1] = 50;
3417  xmin_eleptvscutvars[1] = 1.1156-0.03;
3418  xmax_eleptvscutvars[1] = 1.1156+0.03;
3419  }else if(ih==7){
3420  //7: Xi mass
3421  bins_eleptvscutvars[1] = 50;
3422  xmin_eleptvscutvars[1] = 1.32-0.03;
3423  xmax_eleptvscutvars[1] = 1.32+0.03;
3424  }else if(ih==8 || ih==9){
3425  //8: Rfid Lambda, 9: Rfid Xi
3426  bins_eleptvscutvars[1] = 20;
3427  xmin_eleptvscutvars[1] = 0.;
3428  xmax_eleptvscutvars[1] = 5.;
3429  }else if(ih==10 || ih==11){
3430  //11: DCA Xi, 10: Dca V0
3431  bins_eleptvscutvars[1] = 20;
3432  xmin_eleptvscutvars[1] = 0.;
3433  xmax_eleptvscutvars[1] = 2.;
3434  }else if(ih==12 || ih==13 || ih==14){
3435  //12: DCA Bachto prim, 13: DCA V0pr to prim 14: DCA V0pi to prim
3436  bins_eleptvscutvars[1] = 20;
3437  xmin_eleptvscutvars[1] = 0.;
3438  xmax_eleptvscutvars[1] = 0.5;
3439  }else if(ih==15 || ih==16){
3440  //16: CosPAXi, 15: CosPAv0
3441  bins_eleptvscutvars[1] = 20;
3442  xmin_eleptvscutvars[1] = 0.95;
3443  xmax_eleptvscutvars[1] = 1.0;
3444  }else if(ih==17 || ih==18 || ih==19){
3445  //17: nSigma(TPC, bach) 18: nSigma(TPC, v0pr), 19: nSigma(TPC,v0pi)
3446  bins_eleptvscutvars[1] = 20;
3447  xmin_eleptvscutvars[1] = -5.;
3448  xmax_eleptvscutvars[1] = 5.;
3449  }else if(ih==20 || ih==21){
3450  //20: V0 eta 21: Xi eta
3451  bins_eleptvscutvars[1] = 30;
3452  xmin_eleptvscutvars[1] = -1.5;
3453  xmax_eleptvscutvars[1] = 1.5;
3454  }else if(ih==22){
3455  //20: Opening angle
3456  bins_eleptvscutvars[1] = 20;
3457  xmin_eleptvscutvars[1] = 0.;
3458  xmax_eleptvscutvars[1] = 3.141592/2;
3459  }
3460 
3461  fHistoElePtvsCutVarsRS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsRS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3463  fHistoElePtvsCutVarsWS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsWS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3465  fHistoElePtvsCutVarsMCS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsMCS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3467  }
3468 
3469  Int_t bins_eletag[3]= {20 ,40 ,10};
3470  Double_t xmin_eletag[3]={0.,0. ,0.0};
3471  Double_t xmax_eletag[3]={10.,20 ,100};
3472  fHistoElectronPi0Total = new THnSparseF("fHistoElectronPi0Total","",3,bins_eletag,xmin_eletag,xmax_eletag);
3474  fHistoElectronPi0Tag = new THnSparseF("fHistoElectronPi0Tag","",3,bins_eletag,xmin_eletag,xmax_eletag);
3476  fHistoElectronEtaTotal = new THnSparseF("fHistoElectronEtaTotal","",3,bins_eletag,xmin_eletag,xmax_eletag);
3478  fHistoElectronEtaTag = new THnSparseF("fHistoElectronEtaTag","",3,bins_eletag,xmin_eletag,xmax_eletag);
3480 
3481 
3482  return;
3483 }
3484 
3485 //________________________________________________________________________
3486 AliAODRecoCascadeHF* AliAnalysisTaskSEXic2eleXifromAODtracks::MakeCascadeHF(AliAODcascade *casc, AliAODTrack *part, AliAODTrack *partpid, AliAODEvent * aod, AliAODVertex *secVert)
3487 {
3488  //
3489  // Create AliAODRecoCascadeHF object from the argument
3490  //
3491 
3492  if(!casc) return 0x0;
3493  if(!part) return 0x0;
3494  if(!aod) return 0x0;
3495 
3496  //------------------------------------------------
3497  // PrimaryVertex
3498  //------------------------------------------------
3499  AliAODVertex *primVertexAOD;
3500  Bool_t unsetvtx = kFALSE;
3502  primVertexAOD = CallPrimaryVertex(casc,part,aod);
3503  if(!primVertexAOD){
3504  primVertexAOD = fVtx1;
3505  }else{
3506  unsetvtx = kTRUE;
3507  }
3508  }else{
3509  primVertexAOD = fVtx1;
3510  }
3511  if(!primVertexAOD) return 0x0;
3512  Double_t posprim[3]; primVertexAOD->GetXYZ(posprim);
3513 
3514  //------------------------------------------------
3515  // DCA between tracks
3516  //------------------------------------------------
3517  AliESDtrack *esdtrack = new AliESDtrack((AliVTrack*)partpid);
3518 
3519  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
3520  xyz[0]=casc->DecayVertexXiX();
3521  xyz[1]=casc->DecayVertexXiY();
3522  xyz[2]=casc->DecayVertexXiZ();
3523  pxpypz[0]=casc->MomXiX();
3524  pxpypz[1]=casc->MomXiY();
3525  pxpypz[2]=casc->MomXiZ();
3526  casc->GetCovarianceXYZPxPyPz(cv);
3527  sign=casc->ChargeXi();
3528  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
3529 
3530  Double_t xdummy, ydummy;
3531  Double_t dca = esdtrack->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
3532 
3533 
3534  //------------------------------------------------
3535  // Propagate all tracks to the secondary vertex and calculate momentum there
3536  //------------------------------------------------
3537 
3538  Double_t d0z0bach[2],covd0z0bach[3];
3539  if(sqrt(pow(secVert->GetX(),2)+pow(secVert->GetY(),2))<1.){
3540  part->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3541  trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
3542  }else{
3543  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3544  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
3545  }
3546  Double_t momcasc_new[3]={-9999,-9999,-9999.};
3547  trackCasc->GetPxPyPz(momcasc_new);
3548 
3549  Double_t px[2],py[2],pz[2];
3550  px[0] = part->Px(); py[0] = part->Py(); pz[0] = part->Pz();
3551  px[1] = momcasc_new[0]; py[1] = momcasc_new[1]; pz[1] = momcasc_new[2];
3552 
3553  //------------------------------------------------
3554  // d0
3555  //------------------------------------------------
3556  Double_t d0[3],d0err[3];
3557 
3558  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3559  d0[0]= d0z0bach[0];
3560  d0err[0] = TMath::Sqrt(covd0z0bach[0]);
3561 
3562  Double_t d0z0casc[2],covd0z0casc[3];
3563  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0casc,covd0z0casc);
3564  d0[1]= d0z0casc[0];
3565  d0err[1] = TMath::Sqrt(covd0z0casc[0]);
3566 
3567  //------------------------------------------------
3568  // Create AliAODRecoCascadeHF
3569  //------------------------------------------------
3570  Short_t charge = part->Charge();
3571  AliAODRecoCascadeHF *theCascade = new AliAODRecoCascadeHF(secVert,charge,px,py,pz,d0,d0err,dca);
3572  if(!theCascade)
3573  {
3574  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
3575  if(esdtrack) delete esdtrack;
3576  if(trackCasc) delete trackCasc;
3577  return 0x0;
3578  }
3579  theCascade->SetOwnPrimaryVtx(primVertexAOD);
3580  UShort_t id[2]={(UShort_t)part->GetID(),(UShort_t)trackCasc->GetID()};
3581  theCascade->SetProngIDs(2,id);
3582 
3583  theCascade->GetSecondaryVtx()->AddDaughter(part);
3584  theCascade->GetSecondaryVtx()->AddDaughter(casc);
3585  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
3586  if(esdtrack) delete esdtrack;
3587  if(trackCasc) delete trackCasc;
3588 
3589  return theCascade;
3590 }
3591 
3592 //________________________________________________________________________
3593 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent* aod)
3594 {
3595  //
3596  // Make an array of tracks which should not be used in primary vertex calculation and
3597  // Call PrimaryVertex function
3598  //
3599 
3600  TObjArray *TrackArray = new TObjArray(3);
3601 
3602  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk);
3603  TrackArray->AddAt(cptrk1,0);
3604 
3605  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
3606  TrackArray->AddAt(cascptrack,1);
3607  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
3608  TrackArray->AddAt(cascntrack,2);
3609  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
3610  TrackArray->AddAt(cascbtrack,3);
3611 
3612  AliAODVertex *newvert = PrimaryVertex(TrackArray,aod);
3613 
3614  for(Int_t i=0;i<4;i++)
3615  {
3616  AliESDtrack *tesd = (AliESDtrack*)TrackArray->UncheckedAt(i);
3617  delete tesd;
3618  }
3619  TrackArray->Clear();
3620  delete TrackArray;
3621 
3622  return newvert;
3623 }
3624 
3625 //________________________________________________________________________
3626 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::PrimaryVertex(const TObjArray *trkArray,
3627  AliVEvent *event)
3628 {
3629  //
3630  //Used only for pp
3631  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
3632  //
3633 
3634  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
3635  Bool_t fRmTrksFromPrimVtx = kFALSE;
3636 
3637  AliESDVertex *vertexESD = 0;
3638  AliAODVertex *vertexAOD = 0;
3639 
3640  //vertexESD = new AliESDVertex(*fV1);
3641 
3642 
3643  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
3644  // primary vertex from the input event
3645 
3646  vertexESD = new AliESDVertex(*fV1);
3647 
3648  } else {
3649  // primary vertex specific to this candidate
3650 
3651  Int_t nTrks = trkArray->GetEntriesFast();
3652  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
3653 
3654  if(fRecoPrimVtxSkippingTrks) {
3655  // recalculating the vertex
3656 
3657  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
3658  Float_t diamondcovxy[3];
3659  event->GetDiamondCovXY(diamondcovxy);
3660  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
3661  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
3662  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
3663  vertexer->SetVtxStart(diamond);
3664  delete diamond; diamond=NULL;
3665  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter"))
3666  vertexer->SetOnlyFitter();
3667  }
3668  Int_t skipped[1000];
3669  Int_t nTrksToSkip=0,id;
3670  AliExternalTrackParam *t = 0;
3671  for(Int_t i=0; i<nTrks; i++) {
3672  t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
3673  id = (Int_t)t->GetID();
3674  if(id<0) continue;
3675  skipped[nTrksToSkip++] = id;
3676  }
3677  // TEMPORARY FIX
3678  // For AOD, skip also tracks without covariance matrix
3679  Double_t covtest[21];
3680  for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
3681  AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
3682  if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
3683  id = (Int_t)vtrack->GetID();
3684  if(id<0) continue;
3685  skipped[nTrksToSkip++] = id;
3686  }
3687  }
3688  for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
3689  //
3690  vertexer->SetSkipTracks(nTrksToSkip,skipped);
3691  vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
3692 
3693  } else if(fRmTrksFromPrimVtx && nTrks>0) {
3694  // removing the prongs tracks
3695 
3696  TObjArray rmArray(nTrks);
3697  UShort_t *rmId = new UShort_t[nTrks];
3698  AliESDtrack *esdTrack = 0;
3699  AliESDtrack *t = 0;
3700  for(Int_t i=0; i<nTrks; i++) {
3701  t = (AliESDtrack*)trkArray->UncheckedAt(i);
3702  esdTrack = new AliESDtrack(*t);
3703  rmArray.AddLast(esdTrack);
3704  if(esdTrack->GetID()>=0) {
3705  rmId[i]=(UShort_t)esdTrack->GetID();
3706  } else {
3707  rmId[i]=9999;
3708  }
3709  }
3710  Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
3711  vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
3712  delete [] rmId; rmId=NULL;
3713  rmArray.Delete();
3714 
3715  }
3716 
3717  delete vertexer; vertexer=NULL;
3718  if(!vertexESD) return vertexAOD;
3719  if(vertexESD->GetNContributors()<=0) {
3720  //AliDebug(2,"vertexing failed");
3721  delete vertexESD; vertexESD=NULL;
3722  return vertexAOD;
3723  }
3724 
3725 
3726  }
3727 
3728  // convert to AliAODVertex
3729  Double_t pos[3],cov[6],chi2perNDF;
3730  vertexESD->GetXYZ(pos); // position
3731  vertexESD->GetCovMatrix(cov); //covariance matrix
3732  chi2perNDF = vertexESD->GetChi2toNDF();
3733  delete vertexESD; vertexESD=NULL;
3734 
3735  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
3736 
3737  return vertexAOD;
3738 }
3739 
3740 //________________________________________________________________________
3741 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod)
3742 {
3743  //
3744  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
3745  //
3746 
3747  AliAODVertex *primVertexAOD;
3748  Bool_t unsetvtx = kFALSE;
3750  primVertexAOD = CallPrimaryVertex(casc,part,aod);
3751  if(!primVertexAOD){
3752  primVertexAOD = fVtx1;
3753  }else{
3754  unsetvtx = kTRUE;
3755  }
3756  }else{
3757  primVertexAOD = fVtx1;
3758  }
3759  if(!primVertexAOD) return 0x0;
3760 
3761  AliESDVertex * vertexESD = new AliESDVertex(*fV1);
3762 
3763  Double_t pos[3],cov[6],chi2perNDF;
3764  vertexESD->GetXYZ(pos); // position
3765  vertexESD->GetCovMatrix(cov); //covariance matrix
3766  chi2perNDF = vertexESD->GetChi2toNDF();
3767  delete vertexESD; vertexESD=NULL;
3768 
3769  AliAODVertex *secVert = new AliAODVertex(pos,cov,chi2perNDF);
3770 
3771  return secVert;
3772 }
3773 //________________________________________________________________________
3774 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::MatchToMC(AliAODRecoCascadeHF *exobj, TClonesArray *mcArray, Int_t *pdgarray_ele, Int_t *pdgarray_casc, Int_t *labelarray_ele, Int_t *labelarray_casc, Int_t &ngen_ele, Int_t &ngen_casc)
3775 {
3776  //
3777  // Match to MC
3778  //
3779  for(Int_t i=0;i<100;i++){
3780  pdgarray_ele[i] = -9999;
3781  labelarray_ele[i] = -9999;
3782  pdgarray_casc[i] = -9999;
3783  labelarray_casc[i] = -9999;
3784  }
3785  ngen_ele = 0;
3786  ngen_casc = 0;
3787 
3788  AliVTrack *trk = dynamic_cast<AliVTrack*>(exobj->GetBachelor());
3789  if(!trk) return -1;
3790  Int_t labEle = trk->GetLabel();
3791  if(labEle<0) return -1;
3792  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
3793  if(!mcetrk) return -1;
3794  labelarray_ele[0] = labEle;
3795  pdgarray_ele[0] = mcetrk->GetPdgCode();
3796  ngen_ele ++;
3797 
3798  AliAODMCParticle *mcprimele=0;
3799  mcprimele = mcetrk;
3800  while(mcprimele->GetMother()>=0) {
3801  Int_t labprim_ele=mcprimele->GetMother();
3802  AliAODMCParticle *tmcprimele = (AliAODMCParticle*)mcArray->At(labprim_ele);
3803  if(!tmcprimele) {
3804  break;
3805  }
3806 
3807  mcprimele = tmcprimele;
3808  pdgarray_ele[ngen_ele] = mcprimele->GetPdgCode();
3809  labelarray_ele[ngen_ele] = labprim_ele;
3810  ngen_ele ++;
3811  if(ngen_ele==100) break;
3812  }
3813 
3814  AliAODcascade *theCascade = dynamic_cast<AliAODcascade*>(exobj->GetCascade());
3815  if(!theCascade) return -1;
3816 
3817  Int_t pdgDgcasc[2]={211,3122};
3818  Int_t pdgDgv0[2]={2212,211};
3819  Int_t labcasc = MatchToMCCascade(theCascade,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
3820  if(labcasc<0) return -1;
3821 
3822  AliAODMCParticle *mccasc = (AliAODMCParticle*)mcArray->At(labcasc);
3823  if(!mccasc) return -1;
3824  labelarray_casc[0] = labcasc;
3825  pdgarray_casc[0] = mccasc->GetPdgCode();
3826  ngen_casc ++;
3827 
3828  AliAODMCParticle *mcprimcasc=0;
3829  mcprimcasc = mccasc;
3830  while(mcprimcasc->GetMother()>=0) {
3831  Int_t labprim_casc=mcprimcasc->GetMother();
3832  AliAODMCParticle *tmcprimcasc = (AliAODMCParticle*)mcArray->At(labprim_casc);
3833  if(!tmcprimcasc) {
3834  break;
3835  }
3836 
3837  mcprimcasc = tmcprimcasc;
3838  pdgarray_casc[ngen_casc] = mcprimcasc->GetPdgCode();
3839  labelarray_casc[ngen_casc] = labprim_casc;
3840  ngen_casc ++;
3841  if(ngen_casc==100) break;
3842  }
3843 
3844  Bool_t same_flag = kFALSE;
3845  Int_t matchedlabel=-9999;
3846  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
3847  for(Int_t ivmc=0;ivmc<ngen_casc;ivmc++){
3848  if(labelarray_ele[iemc]==labelarray_casc[ivmc]){
3849  same_flag = kTRUE;
3850  matchedlabel = labelarray_ele[iemc];
3851  break;
3852  }
3853  }
3854  if(same_flag) break;
3855  }
3856 
3857  return matchedlabel;
3858 
3859 }
3860 //________________________________________________________________________
3861 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const // the cascade
3862 {
3863  //
3864  // Matching to MC of cascade
3865  //
3866 
3867  AliAODTrack *cptrack = (AliAODTrack*) theCascade->GetDaughter(0);
3868  if(!cptrack) return -1;
3869  Int_t label_p = TMath::Abs(cptrack->GetLabel());
3870  if(label_p<0) return -1;
3871  AliAODTrack *cntrack = (AliAODTrack*) theCascade->GetDaughter(1);
3872  if(!cntrack) return -1;
3873  Int_t label_n = TMath::Abs(cntrack->GetLabel());
3874  if(label_n<0) return -1;
3875  Int_t labv0 = theCascade->MatchToMC(pdgDgcasc[1],mcArray,2,pdgDgv0);
3876  if(labv0<0) return -1;
3877  AliAODMCParticle *mcpartv0= (AliAODMCParticle*) mcArray->At(labv0);
3878 
3879  AliAODTrack *cbtrack = (AliAODTrack*) theCascade->GetDecayVertexXi()->GetDaughter(0);
3880  if(!cbtrack) return -1;
3881 
3882  Int_t label_b = TMath::Abs(cbtrack->GetLabel());
3883  if(label_b<0) return -1;
3884 
3885  AliAODMCParticle *mcpartb= (AliAODMCParticle*) mcArray->At(label_b);
3886  Int_t pdgb = TMath::Abs(mcpartb->GetPdgCode());
3887  if(pdgb!=pdgDgcasc[0]) return -1;
3888 
3889  AliAODMCParticle *mcmotherv0=mcpartv0;
3890  Bool_t isFromXiv0 = kFALSE;
3891  Int_t labxiv0 = mcmotherv0->GetMother();
3892  if(labxiv0<0) return -1;
3893  mcmotherv0 = (AliAODMCParticle*) mcArray->At(labxiv0);
3894  if(mcmotherv0){
3895  Int_t pdg = TMath::Abs(mcmotherv0 ->GetPdgCode());
3896  if(pdg==pdgabscasc){
3897  isFromXiv0 = kTRUE;
3898  }
3899  }
3900  if(!isFromXiv0) return -1;
3901 
3902  AliAODMCParticle *mcmotherb=mcpartb;
3903  Bool_t isFromXib = kFALSE;
3904  Int_t labxib = mcmotherb->GetMother();
3905  if(labxib<0) return -1;
3906  mcmotherb = (AliAODMCParticle*) mcArray->At(labxib);
3907  if(mcmotherb){
3908  Int_t pdg = TMath::Abs(mcmotherb ->GetPdgCode());
3909  if(pdg==pdgabscasc){
3910  isFromXib = kTRUE;
3911  }
3912  }
3913  if(!isFromXib) return -1;
3914 
3915  if(labxiv0!=labxib) return -1;//Bachelor and V0 should come from the same Xi
3916 
3917  return labxib;
3918 }
3919 //________________________________________________________________________
3920 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags, TClonesArray *mcArray)
3921 {
3922  //
3923  // Select good tracks using fAnalCuts (AliRDHFCuts object) and return the array of their ids
3924  //
3925 
3926  //const Int_t entries = event->GetNumberOfTracks();
3927  if(trkEntries==0) return;
3928 
3929  nSeleTrks=0;
3930  for(Int_t i=0; i<trkEntries; i++) {
3931  seleFlags[i] = kFALSE;
3932 
3933  AliVTrack *track;
3934  track = (AliVTrack*)event->GetTrack(i);
3935 
3936  //if(track->GetID()<0) continue;
3937  Double_t covtest[21];
3938  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
3939 
3940  if(!fAnalCuts) continue;
3941 
3942  AliAODTrack *aodt = (AliAODTrack*)track;
3943 
3945  Int_t filterbit = fAnalCuts->GetProdAODFilterBit();
3946  if(filterbit==7){
3947  if(!aodt->TestFilterBit(BIT(filterbit))) continue;
3948  }else{
3949  if(!aodt->TestFilterMask(BIT(filterbit))) continue;
3950  }
3951  }
3952 
3953  AliAODTrack *aodtpid = 0;
3954  if(fAnalCuts->GetProdAODFilterBit()==7){
3955  aodtpid = fGTI[-aodt->GetID()-1];
3956  }else{
3957  aodtpid = aodt;
3958  }
3959 
3960  Double_t nsigma_tpcele = -9999;
3961  Double_t nsigma_tofele = -9999;
3962  if(fAnalCuts->GetIsUsePID()){
3963  nsigma_tpcele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(aodtpid,AliPID::kElectron);
3964  nsigma_tofele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(aodtpid,AliPID::kElectron);
3965  }
3966 
3967  if(fAnalCuts->SingleTrkCutsNoPID(aodt,aodtpid,fVtx1)){
3968  fHistoElectronTPCPID->Fill(aodt->Pt(),nsigma_tpcele);
3969  fHistoElectronTOFPID->Fill(aodt->Pt(),nsigma_tofele);
3970  if(fabs(nsigma_tofele)<3.){
3971  fHistoElectronTPCPIDSelTOF->Fill(aodt->Pt(),nsigma_tpcele);
3972  Double_t eleeta = aodt->Eta();
3973  if(fabs(eleeta)<0.6)
3974  fHistoElectronTPCPIDSelTOFSmallEta->Fill(aodt->Pt(),nsigma_tpcele);
3975  if(fabs(eleeta)>0.6 && fabs(eleeta)<0.8)
3976  fHistoElectronTPCPIDSelTOFLargeEta->Fill(aodt->Pt(),nsigma_tpcele);
3977  if(eleeta>-0.8 && eleeta<-0.6){
3978  fHistoElectronTPCPIDSelTOFEtaDep[0]->Fill(aodt->Pt(),nsigma_tpcele);
3979  }else if(eleeta>-0.6&&eleeta<-0.4){
3980  fHistoElectronTPCPIDSelTOFEtaDep[1]->Fill(aodt->Pt(),nsigma_tpcele);
3981  }else if(eleeta>-0.4&&eleeta<-0.2){
3982  fHistoElectronTPCPIDSelTOFEtaDep[2]->Fill(aodt->Pt(),nsigma_tpcele);
3983  }else if(eleeta>-0.2&&eleeta<0.0){
3984  fHistoElectronTPCPIDSelTOFEtaDep[3]->Fill(aodt->Pt(),nsigma_tpcele);
3985  }else if(eleeta>0.0&&eleeta<0.2){
3986  fHistoElectronTPCPIDSelTOFEtaDep[4]->Fill(aodt->Pt(),nsigma_tpcele);
3987  }else if(eleeta>0.2&&eleeta<0.4){
3988  fHistoElectronTPCPIDSelTOFEtaDep[5]->Fill(aodt->Pt(),nsigma_tpcele);
3989  }else if(eleeta>0.4&&eleeta<0.6){
3990  fHistoElectronTPCPIDSelTOFEtaDep[6]->Fill(aodt->Pt(),nsigma_tpcele);
3991  }else if(eleeta>0.6&&eleeta<0.8){
3992  fHistoElectronTPCPIDSelTOFEtaDep[7]->Fill(aodt->Pt(),nsigma_tpcele);
3993  }
3994  }
3995  if(nsigma_tpcele>-0.5&&nsigma_tpcele<3.){
3996  fHistoElectronTOFPIDSelTPC->Fill(aodt->Pt(),nsigma_tofele);
3997  }
3998  }
3999  if(fAnalCuts->SingleTrkCuts(aodt,aodtpid,fVtx1)){
4000  seleFlags[i]=kTRUE;
4001  nSeleTrks++;
4002  fHistoElectronTPCSelPID->Fill(aodt->Pt(),nsigma_tpcele);
4003  fHistoElectronTOFSelPID->Fill(aodt->Pt(),nsigma_tofele);
4004 
4005  Double_t minmass_ee = 9999.;
4006  Bool_t isconv = fAnalCuts->TagConversions(aodt,fGTIndex,(AliAODEvent*)event,event->GetNumberOfTracks(),minmass_ee);
4007 
4008  if(fUseMCInfo)
4009  {
4010  Int_t labEle = aodt->GetLabel();
4011  if(labEle<0){
4012  seleFlags[i]=kFALSE;
4013  continue;
4014  }
4015  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
4016  if(!mcetrk){
4017  seleFlags[i]=kFALSE;
4018  continue;
4019  }
4020  Int_t pdgEle = mcetrk->GetPdgCode();
4021  if(abs(pdgEle)!=11){
4022  seleFlags[i]=kFALSE;
4023  continue;
4024  }
4025 
4026  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;
4027  GetMCDecayHistory(mcetrk,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
4028 
4029  Bool_t hfe_flag = kFALSE;
4030  Bool_t gamma_flag = kFALSE;
4031  Bool_t pi0_flag = kFALSE;
4032  Bool_t eta_flag = kFALSE;
4033  Double_t pt_pi0 = -9999.;
4034  Double_t pt_eta = -9999.;
4035  if(abs(pdgarray_ele[0])>400&&abs(pdgarray_ele[0])<440){
4036  hfe_flag = kTRUE;
4037  }
4038  if(abs(pdgarray_ele[0])>4000&&abs(pdgarray_ele[0])<4400){
4039  hfe_flag = kTRUE;
4040  }
4041  if(abs(pdgarray_ele[0])>500&&abs(pdgarray_ele[0])<540){
4042  hfe_flag = kTRUE;
4043  }
4044  if(abs(pdgarray_ele[0])>5000&&abs(pdgarray_ele[0])<5400){
4045  hfe_flag = kTRUE;
4046  }
4047  if(abs(pdgarray_ele[0])==22){
4048  gamma_flag = kTRUE;
4049  }
4050  if(!gamma_flag){
4051  fHistoBachPtMCS->Fill(aodt->Pt());
4052  }
4053  if((abs(pdgarray_ele[0])==22) && (abs(pdgarray_ele[1])==111)){
4054  pi0_flag = kTRUE;
4055  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[1]);
4056  pt_pi0 = mctrkm->Pt();
4057  }
4058  if(abs(pdgarray_ele[0])==111){
4059  pi0_flag = kTRUE;
4060  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[0]);
4061  pt_pi0 = mctrkm->Pt();
4062  }
4063  if((abs(pdgarray_ele[0])==22) && (abs(pdgarray_ele[1])==221)){
4064  eta_flag = kTRUE;
4065  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[1]);
4066  pt_eta = mctrkm->Pt();
4067  }
4068  if(abs(pdgarray_ele[0])==221){
4069  eta_flag = kTRUE;
4070  AliAODMCParticle *mctrkm = (AliAODMCParticle*)mcArray->At(labelarray_ele[0]);
4071  pt_eta = mctrkm->Pt();
4072  }
4073 
4074  if(pi0_flag){
4075  Double_t cont_pi0[3];
4076  cont_pi0[0] = aodt->Pt();
4077  cont_pi0[1] = pt_pi0;
4078  cont_pi0[2] = fCentrality;
4079  fHistoElectronPi0Total->Fill(cont_pi0);
4080  if(isconv) fHistoElectronPi0Tag->Fill(cont_pi0);
4081  }
4082 
4083  if(eta_flag){
4084  Double_t cont_eta[3];
4085  cont_eta[0] = aodt->Pt();
4086  cont_eta[1] = pt_eta;
4087  cont_eta[2] = fCentrality;
4088  fHistoElectronEtaTotal->Fill(cont_eta);
4089  if(isconv) fHistoElectronEtaTag->Fill(cont_eta);
4090  }
4091 
4092  if(!hfe_flag){
4093  seleFlags[i]=kFALSE;
4094  continue;
4095  }
4096  }
4097 
4098  if(fMixWithoutConversionFlag && isconv){
4099  //seleFlags[i]=kFALSE;
4100  continue;
4101  }
4102 
4103  FillElectronROOTObjects(aodt,aodtpid,(AliAODEvent*)event,mcArray);
4104 
4105 // Double_t minmass = 9999.;
4106 // Bool_t isconv = fAnalCuts->TagConversions(aodt,fGTIndex,(AliAODEvent*)event,trkEntries,minmass);
4107 // fHistoMassConversionsMin->Fill(minmass);
4108 // if(isconv) seleFlags[i] = kFALSE;
4109 
4110 // if(fMixWithoutConversionFlag){
4111 // if(seleFlags[i]) FillElectronROOTObjects(aodt,mcArray);
4112 // }else{
4113 // FillElectronROOTObjects(aodt,mcArray);
4114 // }
4115 
4116 // Double_t minmasslike = 9999.;
4117 // fAnalCuts->TagConversionsSameSign(aodt,fGTIndex,(AliAODEvent*)event,trkEntries,minmasslike);
4118 // fHistoMassConversionsSameSignMin->Fill(minmasslike);
4119  }
4120  } // end loop on tracks
4121 }
4122 //________________________________________________________________________
4123 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascs,Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
4124 {
4125  //
4126  // Select good Casc using fAnalCuts (AliRDHFCuts object) and return the array of their ids
4127  //
4128 
4129  Double_t primVtx[3];
4130  fVtx1->GetXYZ(primVtx);
4131 
4132  nSeleCasc = 0;
4133  for(Int_t icasc=0;icasc<nCascs;icasc++)
4134  {
4135  seleCascFlags[icasc] = kFALSE;
4136  AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
4137 
4138  if(!fAnalCuts) continue;
4139  if(fAnalCuts->SingleCascadeCuts(casc,primVtx)){
4140  seleCascFlags[icasc] = kTRUE;
4141  nSeleCasc++;
4142 
4143  FillCascROOTObjects(casc,mcArray);
4144  }
4145  }
4146 }
4147 //_________________________________________________________________
4148 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::GetPoolIndex(Double_t zvert, Double_t mult){
4149  //
4150  // check in which of the pools the current event falls
4151  //
4152 
4153  Int_t theBinZ=TMath::BinarySearch(fNzVtxBins,fZvtxBins,zvert);
4154  if(theBinZ<0 || theBinZ>=fNzVtxBins) return -1;
4155  Int_t theBinM=TMath::BinarySearch(fNCentBins,fCentBins,mult);
4156  if(theBinM<0 || theBinM>=fNCentBins) return -1;
4157  return fNCentBins*theBinZ+theBinM;
4158 }
4159 //_________________________________________________________________
4161  //
4162  // delete the contets of the pool
4163  //
4164  if(poolIndex<0 || poolIndex>=fNOfPools) return;
4165  delete fEventBuffer[poolIndex];
4166  fEventBuffer[poolIndex]=new TTree(Form("EventBuffer_%d",poolIndex), "Temporary buffer for event mixing");
4167 
4168  fEventBuffer[poolIndex]->Branch("zVertex", &fVtxZ);
4169  fEventBuffer[poolIndex]->Branch("centrality", &fCentrality);
4170  fEventBuffer[poolIndex]->Branch("eventInfo", "TObjString",&fEventInfo);
4171  fEventBuffer[poolIndex]->Branch("c1array", "TObjArray", &fCascadeTracks1);
4172  fEventBuffer[poolIndex]->Branch("c2array", "TObjArray", &fCascadeTracks2);
4173  fEventBuffer[poolIndex]->Branch("c1varsarray", "TObjArray", &fCascadeCutVarsArray1);
4174  fEventBuffer[poolIndex]->Branch("c2varsarray", "TObjArray", &fCascadeCutVarsArray2);
4175 
4176  return;
4177 }
4178 //_________________________________________________________________
4180 {
4181  //
4182  // perform mixed event analysis
4183  //
4184 
4185  if(poolIndex<0 || poolIndex>fNzVtxBins*fNCentBins) return;
4186  if(fEventBuffer[poolIndex]->GetEntries()<fNumberOfEventsForMixing) return;
4187 
4188  Int_t nEle = fElectronTracks->GetEntries();
4189  Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
4190 
4191  TObjArray* c1array=0x0;
4192  TObjArray* c2array=0x0;
4193  TObjArray* c1varsarray=0x0;
4194  TObjArray* c2varsarray=0x0;
4195  Float_t zVertex,cent;
4196  TObjString* eventInfo=0x0;
4197  fEventBuffer[poolIndex]->SetBranchAddress("zVertex", &zVertex);
4198  fEventBuffer[poolIndex]->SetBranchAddress("eventInfo",&eventInfo);
4199  fEventBuffer[poolIndex]->SetBranchAddress("centrality", &cent);
4200  fEventBuffer[poolIndex]->SetBranchAddress("c1array", &c1array);
4201  fEventBuffer[poolIndex]->SetBranchAddress("c2array", &c2array);
4202  fEventBuffer[poolIndex]->SetBranchAddress("c1varsarray", &c1varsarray);
4203  fEventBuffer[poolIndex]->SetBranchAddress("c2varsarray", &c2varsarray);
4204  for (Int_t i=0; i<nEle; i++)
4205  {
4206  TLorentzVector* trke=(TLorentzVector*) fElectronTracks->At(i);
4207  if(!trke)continue;
4208  TVector *elevarsarray = (TVector*)fElectronCutVarsArray->At(i);
4209 
4210  for(Int_t iEv=0; iEv<fNumberOfEventsForMixing; iEv++){
4211  fEventBuffer[poolIndex]->GetEvent(iEv + nEvents - fNumberOfEventsForMixing);
4212  //TObjArray* c1array1=(TObjArray*)c1array->Clone();
4213  Int_t nCascs1=c1array->GetEntries();
4214  //Float_t zVertex1=zVertex;
4215  //Float_t mult1=cent;
4216 // Int_t evId1,esdId1,ne1,nv1;
4217 // sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_E%d_C%d",&evId1,&esdId1,&ne1,&nv1);
4218 // if(nv1!=(nCascs1+nCascs2)){
4219 // printf("AliAnalysisTaskSEXic2eleXifromAODtracks::DoMixingWithPools ERROR: read event does not match to the stored one\n");
4220 // delete c1array1;
4221 // delete c2array1;
4222 // continue;
4223 // }
4224  for(Int_t iTr1=0; iTr1<nCascs1; iTr1++){
4225  TLorentzVector* casc1=(TLorentzVector*) c1array->At(iTr1);
4226  if(!casc1) continue;
4227  TVector *cascvarsarray = (TVector*) c1varsarray->At(iTr1);
4228  FillMixROOTObjects(trke,casc1,elevarsarray,cascvarsarray,1);
4229  }//casc loop
4230 
4231  //TObjArray* c2array1=(TObjArray*)c2array->Clone();
4232  Int_t nCascs2=c2array->GetEntries();
4233  for(Int_t iTr2=0; iTr2<nCascs2; iTr2++){
4234  TLorentzVector* casc2=(TLorentzVector*) c2array->At(iTr2);
4235  if(!casc2) continue;
4236  TVector *cascvarsarray = (TVector*) c2varsarray->At(iTr2);
4237  FillMixROOTObjects(trke,casc2,elevarsarray,cascvarsarray,-1);
4238  }//casc loop
4239 
4240  //delete c1array1;
4241  //delete c2array1;
4242  }//event loop
4243  }//track loop
4244 }
4245 //_________________________________________________________________
4247 {
4248  //
4249  // Analyze AliAODmcparticle
4250  //
4251 
4252  Int_t nmcpart = mcArray->GetEntriesFast();
4253 
4254  Int_t mcevttype = 0;
4255  Int_t nccbar = 0;
4256  Bool_t sigmaevent = kFALSE;
4257  if(fMCEventType==1 || fMCEventType==2 || fMCEventType==11 || fMCEventType==12){
4258  //1: c quark event
4259  //2: b quark event
4260  //11: near side c-cbar event
4261  //12: away side c-cbar event
4262  Int_t ncquark = 0;
4263  Int_t ncbarquark = 0;
4264  Double_t phi_c = -9999.;
4265  Double_t phi_cbar = -9999.;
4266  for(Int_t i=0;i<nmcpart;i++)
4267  {
4268  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
4269  if(TMath::Abs(mcpart->GetPdgCode())==4){
4270  if(fabs(mcpart->Y())<1.5){
4271  if(mcpart->GetPdgCode()==4){
4272  phi_c = mcpart->Phi();
4273  ncquark++;
4274  }
4275  if(mcpart->GetPdgCode()==-4){
4276  phi_cbar = mcpart->Phi();
4277  ncbarquark++;
4278  }
4279  if(mcevttype==0){
4280  mcevttype = 1;
4281  }else if(mcevttype==1){
4282  mcevttype = 1;
4283  }else if(mcevttype==2){
4284  mcevttype = 3;
4285  }else if(mcevttype==3){
4286  mcevttype = 3;
4287  }
4288  nccbar++;
4289  }
4290  }
4291  if(TMath::Abs(mcpart->GetPdgCode())==5){
4292  if(!mcpart->IsPhysicalPrimary()) continue;
4293  if(fabs(mcpart->Y())<1.5){
4294  if(mcevttype==0){
4295  mcevttype = 2;
4296  }else if(mcevttype==1){
4297  mcevttype = 3;
4298  }else if(mcevttype==2){
4299  mcevttype = 2;
4300  }else if(mcevttype==3){
4301  mcevttype = 3;
4302  }
4303  }
4304  }
4305  }
4306 
4307  if(fMCEventType==1||fMCEventType==11||fMCEventType==12){
4308  if((mcevttype==2)||(mcevttype==0)||(mcevttype==3)) return kFALSE;
4309  }else if(fMCEventType==2){
4310  if((mcevttype==1)||(mcevttype==0)||(mcevttype==3)) return kFALSE;
4311  }
4312 
4313  if(fMCEventType>10){
4314  if(ncquark!=1) return kFALSE;
4315  if(ncbarquark!=1) return kFALSE;
4316  Double_t dphi = fabs(phi_c - phi_cbar);
4317  if(dphi>2*M_PI) dphi -= 2*M_PI;
4318  if(dphi>M_PI) dphi = 2*M_PI-dphi;
4319  if(fMCEventType==11 && dphi>M_PI/3.) return kFALSE;
4320  if(fMCEventType==12 && dphi<2*M_PI/3.) return kFALSE;
4321  fHistoMCDeltaPhiccbar->Fill(dphi);
4322  }
4323 
4324  fHistoMCEventType->Fill(mcevttype);
4325  fHistoMCNccbar->Fill(nccbar);
4326  }
4327 
4328  for(Int_t i=0;i<nmcpart;i++)
4329  {
4330  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
4331  if(TMath::Abs(mcpart->GetPdgCode())==4132){
4332  Bool_t e_flag = kFALSE;
4333  Bool_t xi_flag = kFALSE;
4334  AliAODMCParticle *mcepart = 0;
4335  AliAODMCParticle *mccascpart = 0;
4336  for(Int_t idau=mcpart->GetFirstDaughter();idau<mcpart->GetLastDaughter()+1;idau++)
4337  {
4338  if(idau<0) break;
4339  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
4340  if(!mcdau) continue;
4341  if(TMath::Abs(mcdau->GetPdgCode())==11){
4342  e_flag = kTRUE;
4343  mcepart = mcdau;
4344  }
4345  if(TMath::Abs(mcdau->GetPdgCode())==3312){
4346  xi_flag = kTRUE;
4347  mccascpart = mcdau;
4348  }
4349  }
4350 
4351  Int_t decaytype = -9999;
4352  if(e_flag && xi_flag) decaytype = 0;
4353 
4354  if(e_flag&&xi_flag)
4355  fHistoMCXic0Decays->Fill(1);
4356  if(!e_flag&&xi_flag)
4357  fHistoMCXic0Decays->Fill(2);
4358  if(e_flag&&!xi_flag)
4359  fHistoMCXic0Decays->Fill(3);
4360  if(!e_flag&&!xi_flag)
4361  fHistoMCXic0Decays->Fill(4);
4362 
4363  FillMCROOTObjects(mcpart,mcepart,mccascpart,decaytype);
4364  }
4365  if(TMath::Abs(mcpart->GetPdgCode())==11 && mcpart->GetStatus()==1){
4366  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
4367  Float_t etamin, etamax;
4368  esdcuts->GetEtaRange(etamin,etamax);
4369  if(fabs(mcpart->Eta())<etamax){
4370  Bool_t gamma_flag = kFALSE;
4371  Int_t labmother = mcpart->GetMother();
4372  if(labmother>=0){
4373  AliAODMCParticle *mcmother = (AliAODMCParticle*) mcArray->At(labmother);
4374  Int_t pdgmother = mcmother->GetPdgCode();
4375  if(TMath::Abs(pdgmother)==22) gamma_flag = kTRUE;
4376  }
4377  if(!gamma_flag) fHistoBachPtMCGen->Fill(mcpart->Pt());
4378  }
4379  FillMCEleROOTObjects(mcpart, mcArray);
4380  }
4381  if(TMath::Abs(mcpart->GetPdgCode())==3312){
4382  Double_t etamin, etamax, rapmin, rapmax;
4383  fAnalCuts->GetProdCascEtaRange(etamin,etamax);
4384  fAnalCuts->GetProdCascRapRange(rapmin,rapmax);
4385 
4386  if((fabs(mcpart->Y())<rapmax) && (fabs(mcpart->Eta())<etamax)){
4387  fHistoXiMassvsPtMCGen->Fill(1.32171, mcpart->Pt());
4388  }
4389  FillMCCascROOTObjects(mcpart, mcArray);
4390  }
4391  }
4392 
4393  if(fMCDoPairAnalysis)
4394  {
4395  for(Int_t i=0;i<nmcpart;i++)
4396  {
4397  AliAODMCParticle *mcparte = (AliAODMCParticle*) mcArray->At(i);
4398  if(!mcparte) continue;
4399  if(TMath::Abs(mcparte->GetPdgCode())!=11) continue;
4400  if(mcparte->GetStatus()!=1) continue;
4401  if(mcparte->Pt()<0.4) continue;//Apply rough cuts
4402  if(fabs(mcparte->Eta())>0.8) continue;//Apply rough cuts
4403  for(Int_t j=0;j<nmcpart;j++)
4404  {
4405  AliAODMCParticle *mcpartv = (AliAODMCParticle*) mcArray->At(j);
4406  if(!mcpartv) continue;
4407  if(TMath::Abs(mcpartv->GetPdgCode())!=3312) continue;
4408  if(mcpartv->Pt()<0.4) continue;//Apply rough cuts
4409  if(fabs(mcpartv->Eta())>0.8) continue;//Apply rough cuts
4410  if(mcpartv->GetNDaughters()!=2) continue;//Apply rough cuts
4411 
4412  FillMCGenPairROOTObjects(mcparte,mcpartv,mcArray);
4413  }
4414  }
4415  return kFALSE;
4416  }
4417 
4418  return kTRUE;
4419 }
4420 
4423 {
4424  //
4425  // Define mc pair tree variables
4426  //
4427 
4428  const char* nameoutput = GetOutputSlot(11)->GetContainer()->GetName();
4429  fMCGenPairVariablesTree = new TTree(nameoutput,"MC pair variables tree");
4430  Int_t nVar = 38;
4431  fCandidateMCGenPairVariables = new Float_t [nVar];
4432  TString * fCandidateVariableNames = new TString[nVar];
4433 
4434  fCandidateVariableNames[ 0] = "InvMassEleXi";
4435  fCandidateVariableNames[ 1] = "EleXiPx";
4436  fCandidateVariableNames[ 2] = "EleXiPy";
4437  fCandidateVariableNames[ 3] = "EleXiPz";
4438  fCandidateVariableNames[ 4] = "ElePdgCode";
4439  fCandidateVariableNames[ 5] = "ElePx";
4440  fCandidateVariableNames[ 6] = "ElePy";
4441  fCandidateVariableNames[ 7] = "ElePz";
4442  fCandidateVariableNames[ 8] = "XiPdgCode";
4443  fCandidateVariableNames[ 9] = "XiPx";
4444  fCandidateVariableNames[10] = "XiPy";
4445  fCandidateVariableNames[11] = "XiPz";
4446  fCandidateVariableNames[12] = "SameFlag";
4447  fCandidateVariableNames[13] = "EleNGeneration";
4448  fCandidateVariableNames[14] = "EleGen1PDG";
4449  fCandidateVariableNames[15] = "EleGen2PDG";
4450  fCandidateVariableNames[16] = "EleGen3PDG";
4451  fCandidateVariableNames[17] = "EleGen4PDG";
4452  fCandidateVariableNames[18] = "EleGen5PDG";
4453  fCandidateVariableNames[19] = "EleGen6PDG";
4454  fCandidateVariableNames[20] = "EleGen7PDG";
4455  fCandidateVariableNames[21] = "EleGen8PDG";
4456  fCandidateVariableNames[22] = "EleGen9PDG";
4457  fCandidateVariableNames[23] = "EleGen10PDG";
4458  fCandidateVariableNames[24] = "ElePrimPDG";
4459  fCandidateVariableNames[25] = "XiNGeneration";
4460  fCandidateVariableNames[26] = "XiGen1PDG";
4461  fCandidateVariableNames[27] = "XiGen2PDG";
4462  fCandidateVariableNames[28] = "XiGen3PDG";
4463  fCandidateVariableNames[29] = "XiGen4PDG";
4464  fCandidateVariableNames[30] = "XiGen5PDG";
4465  fCandidateVariableNames[31] = "XiGen6PDG";
4466  fCandidateVariableNames[32] = "XiGen7PDG";
4467  fCandidateVariableNames[33] = "XiGen8PDG";
4468  fCandidateVariableNames[34] = "XiGen9PDG";
4469  fCandidateVariableNames[35] = "XiGen10PDG";
4470  fCandidateVariableNames[36] = "XiPrimPDG";
4471  fCandidateVariableNames[37] = "MatchedPDG";
4472 
4473  for (Int_t ivar=0; ivar<nVar; ivar++) {
4474  fMCGenPairVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCGenPairVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
4475  }
4476  return;
4477 }
4478 
4480 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCGenPairROOTObjects(AliAODMCParticle *mcparte, AliAODMCParticle *mcpartv, TClonesArray *mcArray)
4481 {
4482  //
4483  // Fill histograms or mc pair analysis tree
4484  //
4485  for(Int_t i=0;i<38;i++){
4486  fCandidateMCGenPairVariables[i] = -9999.;
4487  }
4488 
4489  TLorentzVector vele, vxi, vexi;
4490  vele.SetXYZM(mcparte->Px(),mcparte->Py(),mcparte->Pz(),0.000510998928);
4491  vxi.SetXYZM(mcpartv->Px(),mcpartv->Py(),mcpartv->Pz(),1.32171);
4492  vexi = vele + vxi;
4493 
4494  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;
4495  Int_t pdgarray_xi[100], labelarray_xi[100], ngen_xi;
4496  GetMCDecayHistory(mcparte,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
4497  GetMCDecayHistory(mcpartv,mcArray,pdgarray_xi,labelarray_xi,ngen_xi);
4498 
4499  Bool_t same_flag = kFALSE;
4500  Int_t matched_pdg = -999999;
4501  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
4502  for(Int_t ivmc=0;ivmc<ngen_xi;ivmc++){
4503  if(labelarray_ele[iemc]==labelarray_xi[ivmc]){
4504  same_flag = kTRUE;
4505  matched_pdg = pdgarray_ele[iemc];
4506  break;
4507  }
4508  }
4509  if(same_flag) break;
4510  }
4511  Int_t pdgprim_ele = pdgarray_ele[ngen_ele-1];
4512  Int_t pdgprim_xi = pdgarray_xi[ngen_xi-1];
4513 
4514  fCandidateMCGenPairVariables[ 0] = vexi.M();
4515  fCandidateMCGenPairVariables[ 1] = vexi.Px();
4516  fCandidateMCGenPairVariables[ 2] = vexi.Py();
4517  fCandidateMCGenPairVariables[ 3] = vexi.Pz();
4518  fCandidateMCGenPairVariables[ 4] = mcparte->GetPdgCode();
4519  fCandidateMCGenPairVariables[ 5] = vele.Px();
4520  fCandidateMCGenPairVariables[ 6] = vele.Py();
4521  fCandidateMCGenPairVariables[ 7] = vele.Pz();
4522  fCandidateMCGenPairVariables[ 8] = mcpartv->GetPdgCode();
4523  fCandidateMCGenPairVariables[ 9] = vxi.Px();
4524  fCandidateMCGenPairVariables[10] = vxi.Py();
4525  fCandidateMCGenPairVariables[11] = vxi.Pz();
4526  fCandidateMCGenPairVariables[12] = (Float_t)same_flag;
4527  fCandidateMCGenPairVariables[13] = (Float_t)ngen_ele;
4528  fCandidateMCGenPairVariables[14] = (Float_t)pdgarray_ele[0];
4529  fCandidateMCGenPairVariables[15] = (Float_t)pdgarray_ele[1];
4530  fCandidateMCGenPairVariables[16] = (Float_t)pdgarray_ele[2];
4531  fCandidateMCGenPairVariables[17] = (Float_t)pdgarray_ele[3];
4532  fCandidateMCGenPairVariables[18] = (Float_t)pdgarray_ele[4];
4533  fCandidateMCGenPairVariables[19] = (Float_t)pdgarray_ele[5];
4534  fCandidateMCGenPairVariables[20] = (Float_t)pdgarray_ele[6];
4535  fCandidateMCGenPairVariables[21] = (Float_t)pdgarray_ele[7];
4536  fCandidateMCGenPairVariables[22] = (Float_t)pdgarray_ele[8];
4537  fCandidateMCGenPairVariables[23] = (Float_t)pdgarray_ele[9];
4538  fCandidateMCGenPairVariables[24] = (Float_t)pdgarray_ele[ngen_ele-1];
4539  fCandidateMCGenPairVariables[25] = (Float_t)ngen_xi;
4540  fCandidateMCGenPairVariables[26] = (Float_t)pdgarray_xi[0];
4541  fCandidateMCGenPairVariables[27] = (Float_t)pdgarray_xi[1];
4542  fCandidateMCGenPairVariables[28] = (Float_t)pdgarray_xi[2];
4543  fCandidateMCGenPairVariables[29] = (Float_t)pdgarray_xi[3];
4544  fCandidateMCGenPairVariables[30] = (Float_t)pdgarray_xi[4];
4545  fCandidateMCGenPairVariables[31] = (Float_t)pdgarray_xi[5];
4546  fCandidateMCGenPairVariables[32] = (Float_t)pdgarray_xi[6];
4547  fCandidateMCGenPairVariables[33] = (Float_t)pdgarray_xi[7];
4548  fCandidateMCGenPairVariables[34] = (Float_t)pdgarray_xi[8];
4549  fCandidateMCGenPairVariables[35] = (Float_t)pdgarray_xi[9];
4550  fCandidateMCGenPairVariables[36] = (Float_t)pdgarray_xi[ngen_xi-1];
4551  fCandidateMCGenPairVariables[37] = (Float_t) matched_pdg;
4552 
4553  fMCGenPairVariablesTree->Fill();
4554 }
4555 
4558 {
4559  //
4560  // Define mc pair tree variables
4561  //
4562 
4563  const char* nameoutput = GetOutputSlot(12)->GetContainer()->GetName();
4564  fCorrelationVariablesTree = new TTree(nameoutput,"Correlation variables tree");
4565  Int_t nVar = 11;
4566  fCorrelationVariables = new Float_t [nVar];
4567  TString * fCandidateVariableNames = new TString[nVar];
4568 
4569  fCandidateVariableNames[0] = "XiPt";
4570  fCandidateVariableNames[1] = "ElePt";
4571  fCandidateVariableNames[2] = "DeltaPhi";
4572  fCandidateVariableNames[3] = "DeltaEta";
4573  fCandidateVariableNames[4] = "V0ProperDecayLength";
4574  fCandidateVariableNames[5] = "Eled0";
4575  fCandidateVariableNames[6] = "FGMixMC";
4576  fCandidateVariableNames[7] = "SignType";
4577  fCandidateVariableNames[8] = "Convtype";
4578  fCandidateVariableNames[9] = "MCType";
4579  fCandidateVariableNames[10] = "Centrality";
4580 
4581 
4582  for (Int_t ivar=0; ivar<nVar; ivar++) {
4583  fCorrelationVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCorrelationVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
4584  }
4585  return;
4586 }
4587 
4589 void AliAnalysisTaskSEXic2eleXifromAODtracks::GetMCDecayHistory(AliAODMCParticle *mcpart, TClonesArray *mcArray, Int_t *pdgarray, Int_t *labelarray, Int_t &ngen)
4590 {
4591 //
4592 // MC decay history
4593 //
4594 
4595  for(Int_t i=0;i<100;i++){
4596  pdgarray[i] = -9999;
4597  labelarray[i] = -9999;
4598  }
4599  ngen = 0;
4600 
4601  AliAODMCParticle *mcprim = mcpart;
4602  while(mcprim->GetMother()>=0) {
4603  Int_t lab_prim=mcprim->GetMother();
4604 
4605  AliAODMCParticle *tmcprim = (AliAODMCParticle*)mcArray->At(lab_prim);
4606  if(!tmcprim) {
4607  break;
4608  }
4609  if((TMath::Abs(tmcprim->GetPdgCode())<10) || (TMath::Abs(tmcprim->GetPdgCode())==21)) break;
4610 
4611  mcprim = tmcprim;
4612 
4613  pdgarray[ngen] = mcprim->GetPdgCode();
4614  labelarray[ngen] = lab_prim;
4615 
4616  ngen ++;
4617  if(ngen == 100) break;
4618  }
4619 }
4620 //________________________________________________________________________
4622  //
4623  // Stores the pointer to the global track
4624  // copied from femtoscopy/k0analysis/plamanalysis
4625  //
4626 
4627  // Check that the id is positive
4628  if(track->GetID()<0){
4629  // printf("Warning: track has negative ID: %d\n",track->GetID());
4630  return;
4631  }
4632 
4633  // Check id is not too big for buffer
4634  if(track->GetID()>=fTrackBuffSize){
4635  printf("Warning: track ID too big for buffer: ID: %d, buffer %d\n"
4636  ,track->GetID(),fTrackBuffSize);
4637  return;
4638  }
4639 
4640  // Warn if we overwrite a track
4641  if(fGTI[track->GetID()]){
4642  // Seems like there are FilterMap 0 tracks
4643  // that have zero TPCNcls, don't store these!
4644  if( (!track->GetFilterMap()) &&
4645  (!track->GetTPCNcls()) )
4646  return;
4647 
4648  // Imagine the other way around,
4649  // the zero map zero clusters track
4650  // is stored and the good one wants
4651  // to be added. We ommit the warning
4652  // and just overwrite the 'bad' track
4653  if( fGTI[track->GetID()]->GetFilterMap() ||
4654  fGTI[track->GetID()]->GetTPCNcls() ){
4655  // If we come here, there's a problem
4656  printf("Warning! global track info already there!");
4657  printf(" TPCNcls track1 %u track2 %u",
4658  (fGTI[track->GetID()])->GetTPCNcls(),track->GetTPCNcls());
4659  printf(" FilterMap track1 %u track2 %u\n",
4660  (fGTI[track->GetID()])->GetFilterMap(),track->GetFilterMap());
4661  }
4662  } // Two tracks same id
4663 
4664  // // There are tracks with filter bit 0,
4665  // // do they have TPCNcls stored?
4666  // if(!track->GetFilterMap()){
4667  // printf("Filter map is zero, TPCNcls: %u\n"
4668  // ,track->GetTPCNcls());
4669  // }
4670 
4671  // Assign the pointer
4672  (fGTI[track->GetID()]) = track;
4673  (fGTIndex[track->GetID()]) = index;
4674 }
4675 //________________________________________________________________________
4677  // Sets all the pointers to zero. To be called at
4678  // the beginning or end of an event
4679  for(UShort_t i=0;i<fTrackBuffSize;i++){
4680  fGTI[i]=0;
4681  fGTIndex[i]=-9999;
4682  }
4683 }
4684 //________________________________________________________________________
4686  //
4687  // Check the mother
4688  //
4689  if(abs(history[1])==411) return 1;
4690  if(abs(history[1])==421) return 1;
4691  if(abs(history[1])==431) return 1;
4692  if(abs(history[1])==4122) return 1;
4693  if(abs(history[1])==4132) return 1;
4694  if(abs(history[1])==4232) return 1;
4695  if(abs(history[1])==4332) return 1;
4696 
4697  if(abs(history[1])==511) return 2;
4698  if(abs(history[1])==521) return 2;
4699  if(abs(history[1])==531) return 2;
4700  if(abs(history[1])==5122) return 2;
4701  if(abs(history[1])==5132) return 2;
4702  if(abs(history[1])==5232) return 2;
4703  if(abs(history[1])==5332) return 2;
4704 
4705  return 0;
4706 }
4707 //________________________________________________________________________
4709  //
4710  // Check if the particle is from charm hadrons
4711  //
4712  for(Int_t ih=0;ih<10;ih++){
4713  if(abs(history[ih])==411) return kTRUE;
4714  if(abs(history[ih])==421) return kTRUE;
4715  if(abs(history[ih])==431) return kTRUE;
4716  if(abs(history[ih])==4122) return kTRUE;
4717  if(abs(history[ih])==4132) return kTRUE;
4718  if(abs(history[ih])==4232) return kTRUE;
4719  if(abs(history[ih])==4332) return kTRUE;
4720  }
4721  return kFALSE;
4722 }
4723 //________________________________________________________________________
4725  //
4726  // Check if the particle is from Bottom hadrons
4727  //
4728  for(Int_t ih=0;ih<10;ih++){
4729  if(abs(history[ih])==511) return kTRUE;
4730  if(abs(history[ih])==521) return kTRUE;
4731  if(abs(history[ih])==531) return kTRUE;
4732  if(abs(history[ih])==5122) return kTRUE;
4733  if(abs(history[ih])==5132) return kTRUE;
4734  if(abs(history[ih])==5232) return kTRUE;
4735  if(abs(history[ih])==5332) return kTRUE;
4736  }
4737  return kFALSE;
4738 }
Int_t charge
THnSparse * fHistoEleXiMassvsElePtWS2
! e-Xi mass spectra (wrong-sign)
Int_t pdg
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TH2F * fHistoLambdaPtvsDl
! Lambda proper life time distribution
THnSparse * fHistoElePtvsXiPtMCGen
! e-Xi spectra efficiency denominator
THnSparse * fHistoEleXiMassBFeeddownMCS1
! e-Xi mass spectra (Efficiency numerator)
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:299
Bool_t SingleCascadeCuts(AliAODcascade *casc, Double_t *vert)
THnSparse * fHistoEleXiMassRSMixAway
! e-Xi mass spectra (right-sign)
Bool_t fMCDoPairAnalysis
MC eventtype to analyze 1: ccbar 2: bbbar.
Double_t dEtaSR125(Double_t *postrack1, Double_t *postrack2)
TH1F * fHistoBachPtMCGen
! Bachelor pT histogram (efficiency denominator)
TH2D * fHistoResponseEleXiPt
! Response function e-Xi pT <- XicPt
THnSparse * fHistoElePtvsd0RS
! e pt-d0 spectra (right-sign)
THnSparse * fHistoEleXiMassWSMix2
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTPCPIDSelTOFEtaDep[8]
! TPC electron PID after TOF 3 sigma cut Eta dep
Float_t * fCorrelationVariables
! Correlation variables to be written to the tree
THnSparse * fHistoEleXiMassWSSideAway
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassRSMix1
! e-Xi mass spectra (right-sign)
Bool_t fWriteMCVariableTree
flag to decide whether to write the candidate variables on a tree variables
Int_t MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
Float_t * fCandidateCascVariables
! variables to be written to the tree
THnSparse * fHistoEleXiMassvsElePtRSSide1
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassRSAway
! e-Xi mass spectra (right-sign)
TH2F * fHistoLambdaPtvsDR
! Lambda decay length distribution
THnSparse * fHistoEleXiMassRSMix2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsXiPtRSMix
! e-Xi spectra (right-sign, mix)
THnSparse * fHistoEleXiMassMCS2
! e-Xi mass spectra (Efficiency numerator)
TH2D * fHistodPhiSdEtaSElectronProtonR125RSMix
! dPhiS vs dEtaS R125 RS Mix
Float_t * fCandidateMCVariables
! variables to be written to the tree
THnSparse * fHistoCharmElectronMCGen
! electron in mcArray (only from charmed baryon)
void SelectTrack(const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks, Bool_t *seleFlags, TClonesArray *mcArray)
THnSparse * fHistoElePtvsCutVarsRS[23]
! e pt- cut variables (Right-sign)
THnSparse * fHistoEleXiMassRSSideAway
! e-Xi mass spectra (right-sign)
void FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
TList * fOutputAll
! User Output slot 3 //analysis histograms
THnSparse * fHistoElePtvsd0MCS
! e pt-d0 spectra (right-sign)
TH2F * fHistoLambdaPtvsDRMCS
! Lambda decay length distribution (mc)
THnSparse * fHistoEleXiMassvsElePtRS2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsd0PromptMCS
! e pt-d0 spectra (right-sign)
TH2D * fHistodPhiSdEtaSElectronBachelorR125WSMix
! dPhiS vs dEtaS R125 WS Mix
THnSparse * fHistoElePtvsXiPtvsXicPtMCS
! e-Xi spectra efficiency numerator
THnSparse * fHistoEleXiMassWSSide
! e-Xi mass spectra (wrong-sign)
TTree * fMCCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:238
void FillROOTObjects(AliAODRecoCascadeHF *elobj, AliAODcascade *casc, AliAODTrack *trk, AliAODTrack *trkpid, AliAODEvent *event, TClonesArray *mcArray)
THnSparse * fHistoEleXiMassWSMixAway
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtMCGen
! e-Xi mass-ept spectra (Efficiency denominator)
THnSparse * fHistoElectronMCGen
! electron in mcArray (only from charmed baryon)
THnSparse * fHistoEleXiMassvsElePtRS
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtMCS1
! e-Xi mass-ept spectra (Efficiency numerator)
TH2D * fHistodPhiSdEtaSElectronPionR125RSMix
! dPhiS vs dEtaS R125 RS Mix
THnSparse * fHistoEleXiMassRS
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsEtaWSMix
! e spectra (wrong-sign, mix)
Bool_t TagConversionsSameSign(AliAODTrack *etrk, Int_t *id2index, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
THnSparse * fHistoEleXiMassvsElePtRSMix2
! e-Xi mass-ept spectra (right-sign)
Int_t MatchToMC(AliAODRecoCascadeHF *elobj, TClonesArray *mcArray, Int_t *pdgarray_ele, Int_t *pdgarray_casc, Int_t *labelarray_ele, Int_t *labelarray_casc, Int_t &ngen_ele, Int_t &ngen_casc)
THnSparse * fHistoElePtvsXiPtWSMix
! e-Xi spectra (wrong-sign, mix)
TTree * fCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
THnSparse * fHistoEleXiMassvsElePtWSMix2
! e-Xi mass-ept spectra (wrong-sign)
virtual void UserCreateOutputObjects()
Implementation of interface methods.
THnSparse * fHistoElectronEtaTotal
! Number of electrons from eta
THnSparse * fHistoElePtvsd0WS
! e pt-d0 spectra (wrong-sign)
Float_t * fCandidateEleVariables
! variables to be written to the tree
Bool_t TagConversions(AliAODTrack *etrk, Int_t *id2index, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
TTree * fMCEleVariablesTree
! tree of the candidate variables after track selection on output slot 4
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
THnSparse * fHistoElectronPi0Total
! Number of electrons from pi0
THnSparse * fHistoEleXiMassvsElePtWSSide
! e-Xi mass-ept spectra (wrong-sign)
TObjArray * fCascadeCutVarsArray2
array of RDHF cut information
void FillMCROOTObjects(AliAODMCParticle *part, AliAODMCParticle *mcepart, AliAODMCParticle *mcv0part, Int_t decaytype)
THnSparse * fHistoEleXiMassPromptMCS1
! e-Xi mass spectra (Efficiency numerator)
THnSparse * fHistoElePtvsEtaMCGen
! e spectra efficiency denominator
THnSparse * fHistoEleXiMassMCGen
! e-Xi mass spectra (Efficiency denominator)
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
THnSparse * fHistoElePtvsEtaMCS
! e spectra efficiency numerator
TTree * fMCVariablesTree
! tree of the candidate variables after track selection on output slot 4
THnSparse * fHistoEleXiMassWS
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsXiPtMCS
! e-Xi spectra efficiency numerator
TH2F * fHistoElectronTOFPIDSelTPC
! TOF electron PID after TPC cut
THnSparse * fHistoElePtvsCutVarsWS[23]
! e pt- cut variables (Wrong-sign)
THnSparse * fHistoEleXiMassXibMCS2
! e-Xi mass spectra (Efficiency numerator)
const Double_t etamin
TH2D * fHistodPhiSdEtaSElectronProtonR125WSMix
! dPhiS vs dEtaS R125 WS Mix
THnSparse * fHistoEleXiMassPromptMCS
! e-Xi mass spectra (Efficiency numerator)
TH1F * fHistoBachPtMCS
! Bachelor pT histogram (efficiency numerator)
void MakeAnalysis(AliAODEvent *aod, TClonesArray *mcArray)
AliAODVertex * PrimaryVertex(const TObjArray *trkArray, AliVEvent *event)
THnSparse * fHistoEleXiMassRSSide2
! e-Xi mass spectra (right-sign)
TH2F * fHistoLambdaPtvsDlMCS
! Lambda proper life time distribution (mc)
THnSparse * fHistoEleXiMassvsElePtMCS
! e-Xi mass-ept spectra (Efficiency numerator)
THnSparse * fHistoEleXiMassvsElePtMCS2
! e-Xi mass-ept spectra (Efficiency numerator)
void FillMCCascROOTObjects(AliAODMCParticle *mccpart, TClonesArray *mcArray)
void FillMCGenPairROOTObjects(AliAODMCParticle *mcparte, AliAODMCParticle *mcpartv, TClonesArray *mcArray)
THnSparse * fHistoElePtvsCutVarsMCS[23]
! e pt- cut variables (MCS)
THnSparse * fHistoXiMCGen
! Xi in mcArray (only from charmed baryon)
THnSparse * fHistoBottomElectronMCGen
! electron in mcArray (only from charmed baryon)
THnSparse * fHistoElePtvsXiPtRS
! e-Xi spectra (right-sign)
const UShort_t fTrackBuffSize
Array of integers to keep the index of tpc only track.
THnSparse * fHistoEleXiMassvsElePtRSMix1
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtWSMix1
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtMCGen1
! e-Xi mass-ept spectra (Efficiency denominator)
TH2F * fHistoElePtMCS
! e spectra (Efficiency numerator)
THnSparse * fHistoEleXiMassWSMix1Away
! e-Xi mass spectra (wrong-sign)
void SetSftPosR125(AliAODTrack *track, Double_t bfield, Double_t priVtx[3], Double_t *XSftR125)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
TH2F * fHistoElectronTOFSelPID
! TOF electron PID after selection
Float_t * fCandidateMCCascVariables
! variables to be written to the tree
Float_t * fCandidateMCGenPairVariables
! variables to be written to the tree
AliAODTrack * GetBachelor() const
Float_t * fCandidateMCEleVariables
! variables to be written to the tree
THnSparse * fHistoEleXiMassMCS
! e-Xi mass spectra (Efficiency numerator)
TObjArray * fCascadeTracks2
array of xi+compatible tracks
TTree * fEleVariablesTree
flag to decide whether to write the candidate variables on a tree variables
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:246
TObjArray * fElectronTracks
unique event id for mixed event check
TH1F * fCEvents
! Histogram to check selected events
void SetProngIDs(Int_t nIDs, UShort_t *id)
TH2F * fHistoElectronTPCPIDSelTOFSmallEta
! TPC electron PID after TOF 3 sigma cut (|eta|<0.6)
THnSparse * fHistoEleXiMassPromptMCS2
! e-Xi mass spectra (Efficiency numerator)
THnSparse * fHistoElePtvsd0WSMix
! e pt-d0 spectra (wrong-sign, mix)
TH2F * fHistoElectronTPCPIDSelTOF
! TPC electron PID after TOF 3 sigma cut
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
TObjArray * fCascadeCutVarsArray1
array of RDHF cut information
THnSparse * fHistoEleXiMassvsElePtWSSide2
! e-Xi mass-ept spectra (wrong-sign)
TH2D * fHistoResponseXiPt
! Response function Lambda pT <- True ept
AliNormalizationCounter * fCounter
! Counter for normalization
Int_t fNzVtxBins
maximum number of events to be used in event mixing
THnSparse * fHistoEleXiMassWSAway
! e-Xi mass spectra (wrong-sign)
TObjArray * fCascadeTracks1
array of e-compatible tracks
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
THnSparse * fHistoEleXiMassRSSide
! e-Xi mass spectra (right-sign)
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:320
THnSparse * fHistoElectronEtaTag
! Number of electrons from eta and have partner
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
AliAODcascade * GetCascade() const
THnSparse * fHistoEleXiMassXibMCS
! e-Xi mass spectra (Efficiency numerator)
TH2F * fHistoElePtMCGen
! e spectra (Efficiency denominator)
THnSparse * fHistoEleXiMassvsElePtMCGen2
! e-Xi mass-ept spectra (Efficiency denominator)
THnSparse * fHistoElePtvsd0RSMix
! e pt-d0 spectra (right-sign, mix)
THnSparse * fHistoEleXiMassRS2
! e-Xi mass spectra (right-sign)
void FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
Bool_t IsEventSelected(AliVEvent *event)
THnSparse * fHistoEleXiMassWSMix1
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsXiPtWS
! e-Xi spectra (wrong-sign)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
AliAODVertex * ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod)
THnSparse * fHistoEleXiMassBFeeddownMCS2
! e-Xi mass spectra (Efficiency numerator)
Float_t nEvents[nProd]
AliAODVertex * CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *evt)
THnSparse * fHistoEleXiMassvsElePtWS1
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTPCPIDSelTOFLargeEta
! TPC electron PID after TOF 3 sigma cut (0.8>|eta|>0.6)
THnSparse * fHistoElectronPi0Tag
! Number of electrons from pi0 and have partner