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