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