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