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