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