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