AliPhysics  v5-07-15-01 (b3d7633)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskSEXic2eleXifromAODtracks.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appeuear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //
19 //
20 // Xic->eXi analysis code
21 //
22 // Input: AOD
23 // Output: TTree or THnSparse (mass vs pT vs Centrality)
24 //
25 //-------------------------------------------------------------------------
26 //
27 // Authors: Y.S Watanabe(a)
28 // (a) CNS, the University of Tokyo
29 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
30 //-------------------------------------------------------------------------
31 
32 #include <TSystem.h>
33 #include <TParticle.h>
34 #include <TParticlePDG.h>
35 #include <TH1F.h>
36 #include <TH1F.h>
37 #include <TH2F.h>
38 #include <THnSparse.h>
39 #include <TLorentzVector.h>
40 #include <TTree.h>
41 #include "TROOT.h"
42 #include <TDatabasePDG.h>
43 #include <AliAnalysisDataSlot.h>
44 #include <AliAnalysisDataContainer.h>
45 #include "AliStack.h"
46 #include "AliMCEvent.h"
47 #include "AliAnalysisManager.h"
48 #include "AliAODMCHeader.h"
49 #include "AliAODHandler.h"
50 #include "AliLog.h"
51 #include "AliExternalTrackParam.h"
52 #include "AliAODVertex.h"
53 #include "AliESDVertex.h"
54 #include "AliAODRecoDecay.h"
55 #include "AliAODRecoDecayHF.h"
56 #include "AliAODRecoCascadeHF.h"
57 #include "AliESDtrack.h"
58 #include "AliAODTrack.h"
59 #include "AliAODv0.h"
60 #include "AliAODcascade.h"
61 #include "AliAODMCParticle.h"
62 #include "AliAnalysisTaskSE.h"
64 #include "AliPIDResponse.h"
65 #include "AliPIDCombined.h"
66 #include "AliTOFPIDResponse.h"
67 #include "AliAODPidHF.h"
68 #include "AliInputEventHandler.h"
69 #include "AliESDtrackCuts.h"
70 #include "AliNeutralTrackParam.h"
71 #include "AliKFParticle.h"
72 #include "AliKFVertex.h"
73 #include "AliExternalTrackParam.h"
74 #include "AliESDtrack.h"
75 #include "AliCentrality.h"
76 #include "AliVertexerTracks.h"
77 #include "AliEventPoolManager.h"
79 
80 using std::cout;
81 using std::endl;
82 
86 
87 //__________________________________________________________________________
89  AliAnalysisTaskSE(),
90  fUseMCInfo(kFALSE),
91  fOutput(0),
92  fOutputAll(0),
93  fListCuts(0),
94  fCEvents(0),
95  fHTrigger(0),
96  fHCentrality(0),
97  fAnalCuts(0),
98  fIsEventSelected(kFALSE),
99  fWriteVariableTree(kFALSE),
100  fWriteEachVariableTree(kFALSE),
101  fWriteMCVariableTree(kFALSE),
102  fVariablesTree(0),
103  fEleVariablesTree(0),
104  fCascVariablesTree(0),
105  fMCVariablesTree(0),
106  fMCEleVariablesTree(0),
107  fMCCascVariablesTree(0),
108  fMCGenPairVariablesTree(0),
109  fReconstructPrimVert(kFALSE),
110  fIsMB(kFALSE),
111  fIsSemi(kFALSE),
112  fIsCent(kFALSE),
113  fIsINT7(kFALSE),
114  fIsEMC7(kFALSE),
115  fCandidateVariables(),
116  fCandidateEleVariables(),
117  fCandidateCascVariables(),
118  fCandidateMCVariables(),
119  fCandidateMCEleVariables(),
120  fCandidateMCCascVariables(),
121  fCandidateMCGenPairVariables(),
122  fVtx1(0),
123  fV1(0),
124  fVtxZ(0),
125  fBzkG(0),
126  fCentrality(0),
127  fRunNumber(0),
128  fTriggerCheck(0),
129  fUseCentralityV0M(kFALSE),
130  fEvNumberCounter(0),
131  fMCEventType(-9999),
132  fMCDoPairAnalysis(kFALSE),
133  fHistoEleXiMass(0),
134  fHistoEleXiMassRS(0),
135  fHistoEleXiMassWS(0),
136  fHistoEleXiMassRSMix(0),
137  fHistoEleXiMassWSMix(0),
138  fHistoEleXiMassRSSide(0),
139  fHistoEleXiMassWSSide(0),
140  fHistoEleXiMassRS1(0),
141  fHistoEleXiMassWS1(0),
142  fHistoEleXiMassRSMix1(0),
143  fHistoEleXiMassWSMix1(0),
144  fHistoEleXiMassRSSide1(0),
145  fHistoEleXiMassWSSide1(0),
146  fHistoEleXiMassRS2(0),
147  fHistoEleXiMassWS2(0),
148  fHistoEleXiMassRSMix2(0),
149  fHistoEleXiMassWSMix2(0),
150  fHistoEleXiMassRSSide2(0),
151  fHistoEleXiMassWSSide2(0),
152  fHistoEleXiMassAway(0),
153  fHistoEleXiMassRSAway(0),
154  fHistoEleXiMassWSAway(0),
155  fHistoEleXiMassRSMixAway(0),
156  fHistoEleXiMassWSMixAway(0),
157  fHistoEleXiMassRSSideAway(0),
158  fHistoEleXiMassWSSideAway(0),
159  fHistoEleXiMassRS1Away(0),
160  fHistoEleXiMassWS1Away(0),
161  fHistoEleXiMassRSMix1Away(0),
162  fHistoEleXiMassWSMix1Away(0),
163  fHistoEleXiMassRSSide1Away(0),
164  fHistoEleXiMassWSSide1Away(0),
165  fHistoEleXiMassRS2Away(0),
166  fHistoEleXiMassWS2Away(0),
167  fHistoEleXiMassRSMix2Away(0),
168  fHistoEleXiMassWSMix2Away(0),
169  fHistoEleXiMassRSSide2Away(0),
170  fHistoEleXiMassWSSide2Away(0),
171  fHistoEleXiMassvsElePtRS(0),
172  fHistoEleXiMassvsElePtWS(0),
173  fHistoEleXiMassvsElePtRSMix(0),
174  fHistoEleXiMassvsElePtWSMix(0),
175  fHistoEleXiMassvsElePtRSSide(0),
176  fHistoEleXiMassvsElePtWSSide(0),
177  fHistoEleXiMassvsElePtRS1(0),
178  fHistoEleXiMassvsElePtWS1(0),
179  fHistoEleXiMassvsElePtRSMix1(0),
180  fHistoEleXiMassvsElePtWSMix1(0),
181  fHistoEleXiMassvsElePtRSSide1(0),
182  fHistoEleXiMassvsElePtWSSide1(0),
183  fHistoEleXiMassvsElePtRS2(0),
184  fHistoEleXiMassvsElePtWS2(0),
185  fHistoEleXiMassvsElePtRSMix2(0),
186  fHistoEleXiMassvsElePtWSMix2(0),
187  fHistoEleXiMassvsElePtRSSide2(0),
188  fHistoEleXiMassvsElePtWSSide2(0),
189  fHistoElePtRS(0),
190  fHistoElePtWS(0),
191  fHistoElePtRSMix(0),
192  fHistoElePtWSMix(0),
193  fHistoEleXiMassMCS(0),
194  fHistoEleXiMassMCS1(0),
195  fHistoEleXiMassMCS2(0),
196  fHistoEleXiMassPromptMCS(0),
197  fHistoEleXiMassPromptMCS1(0),
198  fHistoEleXiMassPromptMCS2(0),
199  fHistoEleXiMassBFeeddownMCS(0),
200  fHistoEleXiMassBFeeddownMCS1(0),
201  fHistoEleXiMassBFeeddownMCS2(0),
202  fHistoEleXiMassMCGen(0),
203  fHistoEleXiMassvsElePtMCS(0),
204  fHistoEleXiMassvsElePtMCGen(0),
205  fHistoEleXiMassvsElePtMCS1(0),
206  fHistoEleXiMassvsElePtMCGen1(0),
207  fHistoEleXiMassvsElePtMCS2(0),
208  fHistoEleXiMassvsElePtMCGen2(0),
209  fHistoElePtMCS(0),
210  fHistoElePtMCGen(0),
211  fHistoElePtvsEtaRS(0),
212  fHistoElePtvsEtaWS(0),
213  fHistoElePtvsEtaRSMix(0),
214  fHistoElePtvsEtaWSMix(0),
215  fHistoElePtvsEtaMCS(0),
216  fHistoElePtvsEtaMCGen(0),
217  fHistoElePtvsXiPtRS(0),
218  fHistoElePtvsXiPtWS(0),
219  fHistoElePtvsXiPtRSMix(0),
220  fHistoElePtvsXiPtWSMix(0),
221  fHistoElePtvsXiPtMCS(0),
222  fHistoElePtvsXiPtvsXicPtMCS(0),
223  fHistoElePtvsXiPtMCGen(0),
224  fHistoElePtvsXiPtvsXicPtMCGen(0),
225  fHistoElePtvsXiPtMCXicGen(0),
226  fHistoElePtvsd0RS(0),
227  fHistoElePtvsd0WS(0),
228  fHistoElePtvsd0RSMix(0),
229  fHistoElePtvsd0WSMix(0),
230  fHistoElePtvsd0MCS(0),
231  fHistoElePtvsd0PromptMCS(0),
232  fHistoElePtvsd0BFeeddownMCS(0),
233  fHistoBachPt(0),
234  fHistoBachPtMCS(0),
235  fHistoBachPtMCGen(0),
236  fHistod0Bach(0),
237  fHistoXiMassvsPt(0),
238  fHistoXiMassvsPtMCS(0),
239  fHistoXiMassvsPtMCGen(0),
240  fHistoOmegaMassvsPt(0),
241  fHistoElectronTPCPID(0),
242  fHistoElectronTOFPID(0),
243  fHistoElectronTPCSelPID(0),
244  fHistoElectronTOFSelPID(0),
245  fHistoElectronTPCPIDSelTOF(0),
246  fHistoElectronTOFPIDSelTPC(0),
247  fHistoElectronTPCPIDSelTOFSmallEta(0),
248  fHistoElectronTPCPIDSelTOFLargeEta(0),
249  fHistoElectronQovPtvsPhi(0),
250  fHistoXiQovPtvsPhi(0),
251  fHistoXicMCGen(0),
252  fHistoXicMCGen1(0),
253  fHistoXicMCGen2(0),
254  fHistoXicMCS(0),
255  fHistoXicMCS1(0),
256  fHistoXicMCS2(0),
257  fHistoXicElectronMCGen(0),
258  fHistoXicElectronMCGen1(0),
259  fHistoXicElectronMCGen2(0),
260  fHistoXicElectronMCS(0),
261  fHistoXicElectronMCS1(0),
262  fHistoXicElectronMCS2(0),
263  fHistoElectronMCGen(0),
264  fHistoXiMCGen(0),
265  fHistoLambdaPtvsDl(0),
266  fHistoLambdaPtvsDlSide(0),
267  fHistoLambdaPtvsDlMCS(0),
268  fHistoResponseElePt(0),
269  fHistoResponseEleXiPt(0),
270  fCounter(0),
271  fHistonEvtvsRunNumber(0),
272  fHistonElevsRunNumber(0),
273  fHistonXivsRunNumber(0),
274  fHistoMCEventType(0),
275  fHistoMCXic0Decays(0),
276  fHistoMCDeltaPhiccbar(0),
277  fHistoMCNccbar(0),
278  fDoEventMixing(0),
279  fNumberOfEventsForMixing (5),
280  fNzVtxBins (0),
281  fNCentBins (0),
282  fNOfPools(1),
283  fEventBuffer(0x0),
284  fEventInfo(0x0),
285  fElectronTracks(0x0),
286  fCascadeTracks1(0x0),
287  fCascadeTracks2(0x0)
288 {
289  //
290  // Default Constructor.
291  //
292  for(Int_t i=0;i<23;i++){
293  fHistoElePtvsCutVarsRS[i] = 0;
294  fHistoElePtvsCutVarsWS[i] = 0;
296  }
297  for(Int_t i=0;i<8;i++){
299  }
300 }
301 
302 //___________________________________________________________________________
305  Bool_t writeVariableTree) :
306  AliAnalysisTaskSE(name),
307  fUseMCInfo(kFALSE),
308  fOutput(0),
309  fOutputAll(0),
310  fListCuts(0),
311  fCEvents(0),
312  fHTrigger(0),
313  fHCentrality(0),
314  fAnalCuts(analCuts),
315  fIsEventSelected(kFALSE),
316  fWriteVariableTree(writeVariableTree),
317  fWriteEachVariableTree(kFALSE),
318  fWriteMCVariableTree(kFALSE),
319  fVariablesTree(0),
320  fEleVariablesTree(0),
321  fCascVariablesTree(0),
322  fMCVariablesTree(0),
323  fMCEleVariablesTree(0),
324  fMCCascVariablesTree(0),
325  fMCGenPairVariablesTree(0),
326  fReconstructPrimVert(kFALSE),
327  fIsMB(kFALSE),
328  fIsSemi(kFALSE),
329  fIsCent(kFALSE),
330  fIsINT7(kFALSE),
331  fIsEMC7(kFALSE),
332  fCandidateVariables(),
333  fCandidateEleVariables(),
334  fCandidateCascVariables(),
335  fCandidateMCVariables(),
336  fCandidateMCEleVariables(),
337  fCandidateMCCascVariables(),
338  fCandidateMCGenPairVariables(),
339  fVtx1(0),
340  fV1(0),
341  fVtxZ(0),
342  fBzkG(0),
343  fCentrality(0),
344  fRunNumber(0),
345  fTriggerCheck(0),
346  fUseCentralityV0M(kFALSE),
347  fEvNumberCounter(0),
348  fMCEventType(-9999),
349  fMCDoPairAnalysis(kFALSE),
350  fHistoEleXiMass(0),
351  fHistoEleXiMassRS(0),
352  fHistoEleXiMassWS(0),
353  fHistoEleXiMassRSMix(0),
354  fHistoEleXiMassWSMix(0),
355  fHistoEleXiMassRSSide(0),
356  fHistoEleXiMassWSSide(0),
357  fHistoEleXiMassRS1(0),
358  fHistoEleXiMassWS1(0),
359  fHistoEleXiMassRSMix1(0),
360  fHistoEleXiMassWSMix1(0),
361  fHistoEleXiMassRSSide1(0),
362  fHistoEleXiMassWSSide1(0),
363  fHistoEleXiMassRS2(0),
364  fHistoEleXiMassWS2(0),
365  fHistoEleXiMassRSMix2(0),
366  fHistoEleXiMassWSMix2(0),
367  fHistoEleXiMassRSSide2(0),
368  fHistoEleXiMassWSSide2(0),
369  fHistoEleXiMassAway(0),
370  fHistoEleXiMassRSAway(0),
371  fHistoEleXiMassWSAway(0),
372  fHistoEleXiMassRSMixAway(0),
373  fHistoEleXiMassWSMixAway(0),
374  fHistoEleXiMassRSSideAway(0),
375  fHistoEleXiMassWSSideAway(0),
376  fHistoEleXiMassRS1Away(0),
377  fHistoEleXiMassWS1Away(0),
378  fHistoEleXiMassRSMix1Away(0),
379  fHistoEleXiMassWSMix1Away(0),
380  fHistoEleXiMassRSSide1Away(0),
381  fHistoEleXiMassWSSide1Away(0),
382  fHistoEleXiMassRS2Away(0),
383  fHistoEleXiMassWS2Away(0),
384  fHistoEleXiMassRSMix2Away(0),
385  fHistoEleXiMassWSMix2Away(0),
386  fHistoEleXiMassRSSide2Away(0),
387  fHistoEleXiMassWSSide2Away(0),
388  fHistoEleXiMassvsElePtRS(0),
389  fHistoEleXiMassvsElePtWS(0),
390  fHistoEleXiMassvsElePtRSMix(0),
391  fHistoEleXiMassvsElePtWSMix(0),
392  fHistoEleXiMassvsElePtRSSide(0),
393  fHistoEleXiMassvsElePtWSSide(0),
394  fHistoEleXiMassvsElePtRS1(0),
395  fHistoEleXiMassvsElePtWS1(0),
396  fHistoEleXiMassvsElePtRSMix1(0),
397  fHistoEleXiMassvsElePtWSMix1(0),
398  fHistoEleXiMassvsElePtRSSide1(0),
399  fHistoEleXiMassvsElePtWSSide1(0),
400  fHistoEleXiMassvsElePtRS2(0),
401  fHistoEleXiMassvsElePtWS2(0),
402  fHistoEleXiMassvsElePtRSMix2(0),
403  fHistoEleXiMassvsElePtWSMix2(0),
404  fHistoEleXiMassvsElePtRSSide2(0),
405  fHistoEleXiMassvsElePtWSSide2(0),
406  fHistoElePtRS(0),
407  fHistoElePtWS(0),
408  fHistoElePtRSMix(0),
409  fHistoElePtWSMix(0),
410  fHistoEleXiMassMCS(0),
411  fHistoEleXiMassMCS1(0),
412  fHistoEleXiMassMCS2(0),
413  fHistoEleXiMassPromptMCS(0),
414  fHistoEleXiMassPromptMCS1(0),
415  fHistoEleXiMassPromptMCS2(0),
416  fHistoEleXiMassBFeeddownMCS(0),
417  fHistoEleXiMassBFeeddownMCS1(0),
418  fHistoEleXiMassBFeeddownMCS2(0),
419  fHistoEleXiMassMCGen(0),
420  fHistoEleXiMassvsElePtMCS(0),
421  fHistoEleXiMassvsElePtMCGen(0),
422  fHistoEleXiMassvsElePtMCS1(0),
423  fHistoEleXiMassvsElePtMCGen1(0),
424  fHistoEleXiMassvsElePtMCS2(0),
425  fHistoEleXiMassvsElePtMCGen2(0),
426  fHistoElePtMCS(0),
427  fHistoElePtMCGen(0),
428  fHistoElePtvsEtaRS(0),
429  fHistoElePtvsEtaWS(0),
430  fHistoElePtvsEtaRSMix(0),
431  fHistoElePtvsEtaWSMix(0),
432  fHistoElePtvsEtaMCS(0),
433  fHistoElePtvsEtaMCGen(0),
434  fHistoElePtvsXiPtRS(0),
435  fHistoElePtvsXiPtWS(0),
436  fHistoElePtvsXiPtRSMix(0),
437  fHistoElePtvsXiPtWSMix(0),
438  fHistoElePtvsXiPtMCS(0),
439  fHistoElePtvsXiPtvsXicPtMCS(0),
440  fHistoElePtvsXiPtMCGen(0),
441  fHistoElePtvsXiPtvsXicPtMCGen(0),
442  fHistoElePtvsXiPtMCXicGen(0),
443  fHistoElePtvsd0RS(0),
444  fHistoElePtvsd0WS(0),
445  fHistoElePtvsd0RSMix(0),
446  fHistoElePtvsd0WSMix(0),
447  fHistoElePtvsd0MCS(0),
448  fHistoElePtvsd0PromptMCS(0),
449  fHistoElePtvsd0BFeeddownMCS(0),
450  fHistoBachPt(0),
451  fHistoBachPtMCS(0),
452  fHistoBachPtMCGen(0),
453  fHistod0Bach(0),
454  fHistoXiMassvsPt(0),
455  fHistoXiMassvsPtMCS(0),
456  fHistoXiMassvsPtMCGen(0),
457  fHistoOmegaMassvsPt(0),
458  fHistoElectronTPCPID(0),
459  fHistoElectronTOFPID(0),
460  fHistoElectronTPCSelPID(0),
461  fHistoElectronTOFSelPID(0),
462  fHistoElectronTPCPIDSelTOF(0),
463  fHistoElectronTOFPIDSelTPC(0),
464  fHistoElectronTPCPIDSelTOFSmallEta(0),
465  fHistoElectronTPCPIDSelTOFLargeEta(0),
466  fHistoElectronQovPtvsPhi(0),
467  fHistoXiQovPtvsPhi(0),
468  fHistoXicMCGen(0),
469  fHistoXicMCGen1(0),
470  fHistoXicMCGen2(0),
471  fHistoXicMCS(0),
472  fHistoXicMCS1(0),
473  fHistoXicMCS2(0),
474  fHistoXicElectronMCGen(0),
475  fHistoXicElectronMCGen1(0),
476  fHistoXicElectronMCGen2(0),
477  fHistoXicElectronMCS(0),
478  fHistoXicElectronMCS1(0),
479  fHistoXicElectronMCS2(0),
480  fHistoElectronMCGen(0),
481  fHistoXiMCGen(0),
482  fHistoLambdaPtvsDl(0),
483  fHistoLambdaPtvsDlSide(0),
484  fHistoLambdaPtvsDlMCS(0),
485  fHistoResponseElePt(0),
486  fHistoResponseEleXiPt(0),
487  fCounter(0),
488  fHistonEvtvsRunNumber(0),
489  fHistonElevsRunNumber(0),
490  fHistonXivsRunNumber(0),
491  fHistoMCEventType(0),
492  fHistoMCXic0Decays(0),
493  fHistoMCDeltaPhiccbar(0),
494  fHistoMCNccbar(0),
495  fDoEventMixing(0),
496  fNumberOfEventsForMixing (5),
497  fNzVtxBins (0),
498  fNCentBins (0),
499  fNOfPools(1),
500  fEventBuffer(0x0),
501  fEventInfo(0x0),
502  fElectronTracks(0x0),
503  fCascadeTracks1(0x0),
504  fCascadeTracks2(0x0)
505 {
506  //
507  // Constructor. Initialization of Inputs and Outputs
508  //
509  Info("AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Constructor");
510 
511  for(Int_t i=0;i<23;i++){
512  fHistoElePtvsCutVarsRS[i] = 0;
513  fHistoElePtvsCutVarsWS[i] = 0;
515  }
516  for(Int_t i=0;i<8;i++){
518  }
519 
520  DefineOutput(1,TList::Class()); //conters
521  DefineOutput(2,TList::Class());
522  DefineOutput(3,TList::Class()); //conters
523  DefineOutput(4,TTree::Class()); //My private output
524  DefineOutput(5,TTree::Class()); //My private output
525  DefineOutput(6,TTree::Class()); //My private output
526  DefineOutput(7,TTree::Class()); //My private output
527  DefineOutput(8,AliNormalizationCounter::Class());
528  DefineOutput(9,TTree::Class()); //My private output
529  DefineOutput(10,TTree::Class()); //My private output
530  DefineOutput(11,TTree::Class()); //My private output
531 }
532 
533 //___________________________________________________________________________
535  //
536  // destructor
537  //
538  Info("~AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Destructor");
539 
540  if (fOutput) {
541  delete fOutput;
542  fOutput = 0;
543  }
544 
545  if (fOutputAll) {
546  delete fOutputAll;
547  fOutputAll = 0;
548  }
549 
550  if (fListCuts) {
551  delete fListCuts;
552  fListCuts = 0;
553  }
554 
555 
556  if (fAnalCuts) {
557  delete fAnalCuts;
558  fAnalCuts = 0;
559  }
560 
561  if (fVariablesTree) {
562  delete fVariablesTree;
563  fVariablesTree = 0;
564  }
565  if (fEleVariablesTree) {
566  delete fEleVariablesTree;
567  fEleVariablesTree = 0;
568  }
569  if (fCascVariablesTree) {
570  delete fCascVariablesTree;
571  fCascVariablesTree = 0;
572  }
573  if (fMCVariablesTree) {
574  delete fMCVariablesTree;
575  fMCVariablesTree = 0;
576  }
577  if (fMCEleVariablesTree) {
578  delete fMCEleVariablesTree;
580  }
581  if (fMCCascVariablesTree) {
582  delete fMCCascVariablesTree;
584  }
588  }
589  if(fCounter){
590  delete fCounter;
591  fCounter = 0;
592  }
593 
594  if(fElectronTracks) fElectronTracks->Delete();
595  delete fElectronTracks;
596  if(fCascadeTracks1) fCascadeTracks1->Delete();
597  delete fCascadeTracks1;
598  if(fCascadeTracks2) fCascadeTracks2->Delete();
599  delete fCascadeTracks2;
600  if(fEventBuffer){
601  for(Int_t i=0; i<fNOfPools; i++) delete fEventBuffer[i];
602  delete fEventBuffer;
603  }
604  delete fEventInfo;
605 }
606 
607 //_________________________________________________
609  //
610  // Initialization
611  //
612  //
613 
614  fIsEventSelected=kFALSE;
615 
616  if (fDebug > 1) AliInfo("Init");
617 
618  fListCuts = new TList();
619  fListCuts->SetOwner();
620  fListCuts->SetName("ListCuts");
622  PostData(2,fListCuts);
623 
624  return;
625 }
626 
627 //_________________________________________________
629 {
630  //
631  // UserExec
632  //
633 
634  if (!fInputEvent) {
635  AliError("NO EVENT FOUND!");
636  return;
637  }
638  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
639 
640  fCEvents->Fill(1);
642 
643  //------------------------------------------------
644  // First check if the event has proper B
645  //------------------------------------------------
646  fBzkG = (Double_t)aodEvent->GetMagneticField();
647  AliKFParticle::SetField(fBzkG);
648  if (TMath::Abs(fBzkG)<0.001) {
649  return;
650  }
651  fCEvents->Fill(2);
652 
655 
656  //------------------------------------------------
657  // MC analysis setting
658  //------------------------------------------------
659  TClonesArray *mcArray = 0;
660  AliAODMCHeader *mcHeader=0;
661  if (fUseMCInfo) {
662  // MC array need for maching
663  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
664  if (!mcArray) {
665  AliError("Could not find Monte-Carlo in AOD");
666  return;
667  }
668  fCEvents->Fill(6); // in case of MC events
669 
670  // load MC header
671  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
672  if (!mcHeader) {
673  AliError("AliAnalysisTaskSEXic2eleXifromAODtracks::UserExec: MC header branch not found!\n");
674  return;
675  }
676  fCEvents->Fill(7); // in case of MC events
677 
678  Double_t zMCVertex = mcHeader->GetVtxZ();
679  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
680  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
681  return;
682  } else {
683  fCEvents->Fill(17); // in case of MC events
684  }
685  if ((TMath::Abs(zMCVertex) < fAnalCuts->GetMaxVtxZ()) && (!fAnalCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnalCuts->IsEventRejectedDueToTrigger())) {
686  Bool_t selevt = MakeMCAnalysis(mcArray);
687  if(!selevt) return;
688  }
689  }
690 
691  //------------------------------------------------
692  // Event selection
693  //------------------------------------------------
694  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
695  if (!fVtx1) return;
696 
697  Double_t pos[3],cov[6];
698  fVtx1->GetXYZ(pos);
699  fVtx1->GetCovarianceMatrix(cov);
700  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
701  fVtxZ = pos[2];
702 
703  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
704  Bool_t fIsPhysSelNotOK = fAnalCuts->IsEventRejectedDuePhysicsSelection();
705  Bool_t fIsNoVertex = fAnalCuts->IsEventRejectedDueToNotRecoVertex();
706  if(!fIsTriggerNotOK && !fIsPhysSelNotOK && !fIsNoVertex && fabs(fVtx1->GetZ())<fAnalCuts->GetMaxVtxZ()) fCEvents->Fill(3);
707  if(!fIsEventSelected) {
708  delete fV1;
709  return;
710  }
711  fCEvents->Fill(4);
712 
713  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
714  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
715  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
716  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
717  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
719  if(fIsMB) fHTrigger->Fill(1);
720  if(fIsSemi) fHTrigger->Fill(2);
721  if(fIsCent) fHTrigger->Fill(3);
722  if(fIsINT7) fHTrigger->Fill(4);
723  if(fIsEMC7) fHTrigger->Fill(5);
724  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
725  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
726  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
727  if(fIsMB&fIsCent) fHTrigger->Fill(11);
728  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
729 
730  if(fUseCentralityV0M){
731  AliCentrality *cent = aodEvent->GetCentrality();
732  fCentrality = cent->GetCentralityPercentile("V0M");
733  }else{
734  fCentrality = 1.;
735  }
736  if(fCentrality<0.||fCentrality>100.-0.0000001) {
737  delete fV1;
738  return;
739  }
740  fHCentrality->Fill(fCentrality);
741  fRunNumber = aodEvent->GetRunNumber();
742 
743  Int_t runnumber_offset = 0;
744  Int_t runnumber = aodEvent->GetRunNumber();
745  if(runnumber<=131000&&runnumber>=114000){
746  runnumber_offset = 114000;//lhc10bcde
747  }else if(runnumber<=196000&&runnumber>=195000){
748  runnumber_offset = 195000;//lhc13bc
749  }else if(runnumber<=170593&&runnumber>=167902){
750  runnumber_offset = 167902;//lhc11h
751  }
752  fHistonEvtvsRunNumber->Fill(runnumber-runnumber_offset,1.);
753 
754  //------------------------------------------------
755  // Check if the event has v0 candidate
756  //------------------------------------------------
757  //Int_t nv0 = aodEvent->GetNumberOfV0s();
758  fCEvents->Fill(5);
759 
760 
761  //------------------------------------------------
762  // Main analysis done in this function
763  //------------------------------------------------
764  MakeAnalysis(aodEvent,mcArray);
765 
766 
767  PostData(1,fOutput);
768  PostData(3,fOutputAll);
769  PostData(4,fVariablesTree);
770  PostData(5,fEleVariablesTree);
771  PostData(6,fCascVariablesTree);
772  PostData(7,fMCVariablesTree);
773  PostData(8,fCounter);
774  PostData(9,fMCEleVariablesTree);
775  PostData(10,fMCCascVariablesTree);
776  PostData(11,fMCGenPairVariablesTree);
777 
778  fIsEventSelected=kFALSE;
779 
780  delete fV1;
781  return;
782 }
783 
784 //________________________________________ terminate ___________________________
786 {
787  // The Terminate() function is the last function to be called during
788  // a query. It always runs on the client, it can be used to present
789  // the results graphically or save the results to file.
790 
791  //AliInfo("Terminate","");
792  AliAnalysisTaskSE::Terminate();
793 
794  fOutput = dynamic_cast<TList*> (GetOutputData(1));
795  if (!fOutput) {
796  AliError("fOutput not available");
797  return;
798  }
799 
800  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
801  if (!fOutputAll) {
802  AliError("fOutputAll not available");
803  return;
804  }
805 
806  return;
807 }
808 
809 //___________________________________________________________________________
811 {
812  //
813  // UserCreateOutputObject
814  //
815  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
816 
817  //------------------------------------------------
818  // output object setting
819  //------------------------------------------------
820  fOutput = new TList();
821  fOutput->SetOwner();
822  fOutput->SetName("chist0");
823  DefineGeneralHistograms(); // define general histograms
824  PostData(1,fOutput);
825 
826  fOutputAll = new TList();
827  fOutputAll->SetOwner();
828  fOutputAll->SetName("anahisto");
829  DefineAnalysisHistograms(); // define general histograms
830  PostData(3,fOutputAll);
831 
833  PostData(4,fVariablesTree);
834 
836  PostData(5,fEleVariablesTree);
837 
839  PostData(6,fCascVariablesTree);
840 
842  PostData(7,fMCVariablesTree);
843 
845  PostData(9,fMCEleVariablesTree);
846 
848  PostData(10,fMCCascVariablesTree);
849 
851  PostData(11,fMCGenPairVariablesTree);
852 
853  //Counter for Normalization
854  TString normName="NormalizationCounter";
855  AliAnalysisDataContainer *cont = GetOutputSlot(8)->GetContainer();
856  if(cont)normName=(TString)cont->GetName();
857  fCounter = new AliNormalizationCounter(normName.Data());
858  fCounter->Init();
859  PostData(8,fCounter);
860 
861  if(fDoEventMixing){
862  fElectronTracks = new TObjArray();
863  fElectronTracks->SetOwner();
864  fCascadeTracks1 = new TObjArray();
865  fCascadeTracks1->SetOwner();
866  fCascadeTracks2 = new TObjArray();
867  fCascadeTracks2->SetOwner();
868 
870  fEventBuffer = new TTree*[fNOfPools];
871  for(Int_t i=0; i<fNOfPools; i++){
872  fEventBuffer[i]=new TTree(Form("EventBuffer_%d",i), "Temporary buffer for event mixing");
873  fEventBuffer[i]->Branch("zVertex", &fVtxZ);
874  fEventBuffer[i]->Branch("centrality", &fCentrality);
875  fEventBuffer[i]->Branch("eventInfo", "TObjString",&fEventInfo);
876  fEventBuffer[i]->Branch("c1array", "TObjArray", &fCascadeTracks1);
877  fEventBuffer[i]->Branch("c2array", "TObjArray", &fCascadeTracks2);
878  }
879  }
880 
881 
882  return;
883 }
884 
885 //-------------------------------------------------------------------------------
887 (
888  AliAODEvent *aodEvent, TClonesArray *mcArray
889  )
890 {
891  //
892  // Main Analysis part
893  //
894  //------------------------------------------------
895  // Select good track before hand to save time
896  //------------------------------------------------
897  if(fDoEventMixing && fElectronTracks) fElectronTracks->Delete();
898  if(fDoEventMixing && fCascadeTracks1) fCascadeTracks1->Delete();
899  if(fDoEventMixing && fCascadeTracks2) fCascadeTracks2->Delete();
900 
901  Int_t nCascs= aodEvent->GetNumberOfCascades();
902  Int_t nTracks= aodEvent->GetNumberOfTracks();
903 
904  Bool_t seleTrkFlags[nTracks];
905  Int_t nSeleTrks=0;
906  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags,mcArray);
907 
908  Bool_t seleCascFlags[nCascs];
909  Int_t nSeleCasc=0;
910  SelectCascade(aodEvent,nCascs,nSeleCasc,seleCascFlags,mcArray);
911 
912  Int_t runnumber_offset = 0;
913  Int_t runnumber = aodEvent->GetRunNumber();
914  if(runnumber<=131000&&runnumber>=114000){
915  runnumber_offset = 114000;//lhc10bcde
916  }else if(runnumber<=196000&&runnumber>=195000){
917  runnumber_offset = 195000;//lhc13bc
918  }else if(runnumber<=170593&&runnumber>=167902){
919  runnumber_offset = 167902;//lhc11h
920  }
921  fHistonElevsRunNumber->Fill(runnumber-runnumber_offset,nSeleTrks);
922  fHistonXivsRunNumber->Fill(runnumber-runnumber_offset,nSeleCasc);
923 
924  //------------------------------------------------
925  // Cascade loop
926  //------------------------------------------------
927  for (Int_t icasc = 0; icasc<nCascs; icasc++) {
928  if(!seleCascFlags[icasc]) continue;
929  AliAODcascade *casc = aodEvent->GetCascade(icasc);
930  if(!casc) continue;
931 
932  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
933  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
934  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
935 
936  //------------------------------------------------
937  // track loop
938  //------------------------------------------------
939  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
940  if(!seleTrkFlags[itrk]) continue;
941  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
942  if(trk->GetID()<0) continue;
943 
944  Int_t cpid = cptrack->GetID();
945  Int_t cnid = cntrack->GetID();
946  Int_t cbid = cbtrack->GetID();
947  Int_t lpid = trk->GetID();
948  if((cpid==lpid)||(cnid==lpid)||(cbid==lpid)) continue;
949 
950  //if(!fAnalCuts->SelectWithRoughCuts(v0,trk)) continue;
951 
952  AliAODVertex *secVert = ReconstructSecondaryVertex(casc,trk,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
953  if(!secVert) continue;
954 
955  AliAODRecoCascadeHF *exobj = MakeCascadeHF(casc,trk,aodEvent,secVert);
956  if(!exobj) {
957  continue;
958  }
959 
960  FillROOTObjects(exobj, casc,trk,mcArray);
961 
962  exobj->GetSecondaryVtx()->RemoveDaughters();
963  exobj->UnsetOwnPrimaryVtx();
964  delete exobj;exobj=NULL;
965  delete secVert;
966  }
967  }
968 
969  if(fDoEventMixing){
970  fEventInfo->SetString(Form("Ev%d_esd%d_E%d_C%d",AliAnalysisManager::GetAnalysisManager()->GetNcalls(),((AliAODHeader*)aodEvent->GetHeader())->GetEventNumberESDFile(),fElectronTracks->GetEntries(),fCascadeTracks1->GetEntries()+fCascadeTracks2->GetEntries()));
971  Int_t ind=GetPoolIndex(fVtxZ,fCentrality);
972  if(ind>=0 && ind<fNOfPools){
973  if(fEventBuffer[ind]->GetEntries() >= fNumberOfEventsForMixing){
974  DoEventMixingWithPools(ind);
975  if(fEventBuffer[ind]->GetEntries() >= 20*fNumberOfEventsForMixing){
976  ResetPool(ind);
977  }
978  }
979  fEventBuffer[ind]->Fill();
980  }
981  }
982 }
983 
984 
987 {
988  //
989  // Define tree variables
990  //
991 
992  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
993  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
994  Int_t nVar = 90;
995  fCandidateVariables = new Float_t [nVar];
996  TString * fCandidateVariableNames = new TString[nVar];
997 
998  fCandidateVariableNames[ 0]="Centrality";
999  fCandidateVariableNames[ 1]="InvMassEleXi";
1000  fCandidateVariableNames[ 2]="EleXiPt";
1001  fCandidateVariableNames[ 3]="EleXiPx";
1002  fCandidateVariableNames[ 4]="EleXiPy";
1003  fCandidateVariableNames[ 5]="EleXiPz";
1004  fCandidateVariableNames[ 6]="ElePx";
1005  fCandidateVariableNames[ 7]="ElePy";
1006  fCandidateVariableNames[ 8]="ElePz";
1007  fCandidateVariableNames[ 9]="XiPx";
1008  fCandidateVariableNames[10]="XiPy";
1009  fCandidateVariableNames[11]="XiPz";
1010  fCandidateVariableNames[12]="XiCharge";
1011  fCandidateVariableNames[13]="MassXi";
1012  fCandidateVariableNames[14]="MassLambda";
1013  fCandidateVariableNames[15]="Eled0";
1014  fCandidateVariableNames[16]="Xid0";
1015  fCandidateVariableNames[17]="nSigmaTPCele";
1016  fCandidateVariableNames[18]="nSigmaTOFele";
1017  fCandidateVariableNames[19]="nSigmaTPCpr_etrk";
1018  fCandidateVariableNames[20]="nSigmaTOFpr_etrk";
1019  fCandidateVariableNames[21]="nSigmaTPCka_etrk";
1020  fCandidateVariableNames[22]="nSigmaTOFka_etrk";
1021  fCandidateVariableNames[23]="nSigmaTPCv0pr";
1022  fCandidateVariableNames[24]="nSigmaTOFv0pr";
1023  fCandidateVariableNames[25]="nSigmaTPCv0pi";
1024  fCandidateVariableNames[26]="nSigmaTOFv0pi";
1025  fCandidateVariableNames[27]="nSigmaTPCbachpi";
1026  fCandidateVariableNames[28]="nSigmaTOFbachpi";
1027  fCandidateVariableNames[29]="EleCharge";
1028  fCandidateVariableNames[30]="Mixing";
1029  fCandidateVariableNames[31]="DcaXiDaughters";
1030  fCandidateVariableNames[32]="DcaV0Daughters";
1031  fCandidateVariableNames[33]="DecayLengthXi";
1032  fCandidateVariableNames[34]="CosPointingAngleXi";
1033  fCandidateVariableNames[35]="DcaV0toPrimVertex";
1034  fCandidateVariableNames[36]="DcaPostoPrimVertex";
1035  fCandidateVariableNames[37]="DcaNegtoPrimVertex";
1036  fCandidateVariableNames[38]="DcaBachtoPrimVertex";
1037  fCandidateVariableNames[39]="DecayLengthV0";
1038  fCandidateVariableNames[40]="CosPointingAngleV0";
1039 
1040  fCandidateVariableNames[41]="mcpdgxic";
1041  fCandidateVariableNames[42]="mclabxic";
1042  fCandidateVariableNames[43]="mcxicpx";
1043  fCandidateVariableNames[44]="mcxicpy";
1044  fCandidateVariableNames[45]="mcxicpz";
1045  fCandidateVariableNames[46]="mcelepx";
1046  fCandidateVariableNames[47]="mcelepy";
1047  fCandidateVariableNames[48]="mcelepz";
1048  fCandidateVariableNames[49]="mccascpx";
1049  fCandidateVariableNames[50]="mccascpy";
1050  fCandidateVariableNames[51]="mccascpz";
1051 
1052  fCandidateVariableNames[52]="mcpdgele";
1053  fCandidateVariableNames[53]="mcpdgcasc";
1054  fCandidateVariableNames[54]="mcpdgmomele";
1055  fCandidateVariableNames[55]="mcpdgmomcasc";
1056  fCandidateVariableNames[56]="mcpdggrmomele";
1057  fCandidateVariableNames[57]="mcpdggrmomcasc";
1058  fCandidateVariableNames[58]="mcngenele";
1059  fCandidateVariableNames[59]="mcngencasc";
1060 
1061  fCandidateVariableNames[60]="nSigmaTPCpi_etrk";
1062  fCandidateVariableNames[61]="nSigmaTOFpi_etrk";
1063 
1064  fCandidateVariableNames[62]="V0PosPx";
1065  fCandidateVariableNames[63]="V0PosPy";
1066  fCandidateVariableNames[64]="V0PosPz";
1067  fCandidateVariableNames[65]="V0NegPx";
1068  fCandidateVariableNames[66]="V0NegPy";
1069  fCandidateVariableNames[67]="V0NegPz";
1070  fCandidateVariableNames[68]="V0VertX";
1071  fCandidateVariableNames[69]="V0VertY";
1072  fCandidateVariableNames[70]="V0VertZ";
1073  fCandidateVariableNames[71]="BachPx";
1074  fCandidateVariableNames[72]="BachPy";
1075  fCandidateVariableNames[73]="BachPz";
1076  fCandidateVariableNames[74]="XiVertX";
1077  fCandidateVariableNames[75]="XiVertY";
1078  fCandidateVariableNames[76]="XiVertZ";
1079  fCandidateVariableNames[77]="PrimVertX";
1080  fCandidateVariableNames[78]="PrimVertY";
1081  fCandidateVariableNames[79]="PrimVertZ";
1082 
1083  fCandidateVariableNames[80]="MassOmega";
1084 
1085  fCandidateVariableNames[81]= "EleITSMatch";
1086  fCandidateVariableNames[82]= "BachITSMatch";
1087  fCandidateVariableNames[83]= "V0PosITSMatch";
1088  fCandidateVariableNames[84]= "V0NegITSMatch";
1089 
1090  fCandidateVariableNames[85]= "TPCNclsF";
1091  fCandidateVariableNames[86]= "TPCNcls";
1092  fCandidateVariableNames[87]= "TPCNclsS";
1093  fCandidateVariableNames[88]= "IsXiPeakReagion";
1094 
1095 
1096  fCandidateVariableNames[89]="EvNumber";
1097 
1098  for (Int_t ivar=0; ivar<nVar; ivar++) {
1099  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1100  }
1101 
1102  return;
1103 }
1104 
1106 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *exobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray)
1107 {
1108  //
1109  // Fill histograms or tree depending on fWriteVariableTree
1110  //
1111  if(!trk) return;
1112  if(!casc) return;
1113 
1114  for(Int_t i=0;i<90;i++){
1115  fCandidateVariables[i] = -9999.;
1116  }
1117 
1118 
1119  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
1120  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
1121  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
1122  if(cptrack->Charge()<0 && cntrack->Charge()>0){
1123  cptrack = (AliAODTrack*)(casc->GetDaughter(1));
1124  cntrack = (AliAODTrack*)(casc->GetDaughter(0));
1125  }
1126 // Double_t d0z0[2],covd0z0[3];
1127 // cptrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1128 // cntrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1129 // cbtrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1130 
1131  Double_t pxe = exobj->PxProng(0);
1132  Double_t pye = exobj->PyProng(0);
1133  Double_t pze = exobj->PzProng(0);
1134  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
1135  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
1136  Double_t pxv = exobj->PxProng(1);
1137  Double_t pyv = exobj->PyProng(1);
1138  Double_t pzv = exobj->PzProng(1);
1139  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
1140  Double_t Ev = sqrt(momv*momv+1.32171*1.32171);
1141  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
1142  Double_t Esum = Ee + Ev;
1143 
1144  Double_t uxe = pxe/mome;
1145  Double_t uye = pye/mome;
1146  Double_t uze = pze/mome;
1147  Double_t lf = -2.*(pxv*uxe+pyv*uye+pzv*uze);
1148  Double_t pxv_flip = pxv + lf * uxe;
1149  Double_t pyv_flip = pyv + lf * uye;
1150  Double_t pzv_flip = pzv + lf * uze;
1151  Double_t pxsum_flip = pxe + pxv_flip;
1152  Double_t pysum_flip = pye + pyv_flip;
1153  Double_t pzsum_flip = pze + pzv_flip;
1154  Double_t mexi_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
1155  Double_t ptexi_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
1156 
1157  Double_t posVtx[3] = {0.,0.,0.};
1158  fVtx1->GetXYZ(posVtx);
1159 
1160 
1162  UInt_t pdgdg[2]={11,3312};
1163  fCandidateVariables[ 1] = exobj->InvMass(2,pdgdg);
1164  fCandidateVariables[ 2] = exobj->Pt();
1165  fCandidateVariables[ 3] = exobj->Px();
1166  fCandidateVariables[ 4] = exobj->Py();
1167  fCandidateVariables[ 5] = exobj->Pz();
1168  fCandidateVariables[ 6] = exobj->PxProng(0);
1169  fCandidateVariables[ 7] = exobj->PyProng(0);
1170  fCandidateVariables[ 8] = exobj->PzProng(0);
1171  fCandidateVariables[ 9] = exobj->PxProng(1);
1172  fCandidateVariables[10] = exobj->PyProng(1);
1173  fCandidateVariables[11] = exobj->PzProng(1);
1174  fCandidateVariables[12] = casc->ChargeXi();
1175  fCandidateVariables[13] = casc->MassXi();
1176  if(casc->ChargeXi()<0)
1177  fCandidateVariables[14] = casc->MassLambda();
1178  else
1179  fCandidateVariables[14] = casc->MassAntiLambda();
1180  fCandidateVariables[15] = exobj->Getd0Prong(0);
1181  fCandidateVariables[16] = exobj->Getd0Prong(1);
1182 
1183  Double_t nSigmaTPCele = -9999.;
1184  Double_t nSigmaTOFele = -9999.;
1185  if(fAnalCuts->GetIsUsePID())
1186  {
1187  nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
1188  nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
1189  fCandidateVariables[17] = nSigmaTPCele;
1190  fCandidateVariables[18] = nSigmaTOFele;
1191 
1192  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
1193  Double_t nSigmaTOFpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kProton);
1194  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
1195  Double_t nSigmaTOFka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kKaon);
1196  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
1197  Double_t nSigmaTOFpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kPion);
1198  fCandidateVariables[19] = nSigmaTPCpr_etrk;
1199  fCandidateVariables[20] = nSigmaTOFpr_etrk;
1200  fCandidateVariables[21] = nSigmaTPCka_etrk;
1201  fCandidateVariables[22] = nSigmaTOFka_etrk;
1202  fCandidateVariables[60] = nSigmaTPCpi_etrk;
1203  fCandidateVariables[61] = nSigmaTOFpi_etrk;
1204  }
1205 
1206  Double_t nSigmaTPCv0pr=-9999.;
1207  Double_t nSigmaTOFv0pr=-9999.;
1208  Double_t nSigmaTPCv0pi=-9999.;
1209  Double_t nSigmaTOFv0pi=-9999.;
1210  Double_t nSigmaTPCbachpi=-9999.;
1211  Double_t nSigmaTOFbachpi=-9999.;
1213  {
1214  if(casc->ChargeXi()>0){
1215  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
1216  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
1217  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
1218  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
1219  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1220  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1221  }else{
1222  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
1223  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
1224  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
1225  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
1226  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1227  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1228  }
1229  fCandidateVariables[23] = nSigmaTPCv0pr;
1230  fCandidateVariables[24] = nSigmaTOFv0pr;
1231  fCandidateVariables[25] = nSigmaTPCv0pi;
1232  fCandidateVariables[26] = nSigmaTOFv0pi;
1233  fCandidateVariables[27] = nSigmaTPCbachpi;
1234  fCandidateVariables[28] = nSigmaTOFbachpi;
1235  }
1236  fCandidateVariables[29] = trk->Charge();
1237  fCandidateVariables[30] = 0;
1238  fCandidateVariables[31] = casc->DcaXiDaughters();
1239  fCandidateVariables[32] = casc->DcaV0Daughters();
1240  fCandidateVariables[33] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
1241  fCandidateVariables[34] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1242  fCandidateVariables[35] = casc->DcaV0ToPrimVertex();
1243  fCandidateVariables[36] = casc->DcaPosToPrimVertex();
1244  fCandidateVariables[37] = casc->DcaNegToPrimVertex();
1245  fCandidateVariables[38] = casc->DcaBachToPrimVertex();
1246  fCandidateVariables[39] = casc->DecayLengthV0();
1247  fCandidateVariables[40] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1248 
1249  AliAODMCParticle *mcxic = 0;
1250  AliAODMCParticle *mcele = 0;
1251  AliAODMCParticle *mccasc = 0;
1252  Int_t mclabxic = 0;
1253  Int_t mcpdgele_array[100];
1254  Int_t mcpdgcasc_array[100];
1255  Int_t mclabelele_array[100];
1256  Int_t mclabelcasc_array[100];
1257  Int_t mcngen_ele = -9999;
1258  Int_t mcngen_casc = -9999;
1259 
1260  if(fUseMCInfo && mcArray){
1261 
1262  mclabxic = MatchToMC(exobj,mcArray,mcpdgele_array, mcpdgcasc_array,mclabelele_array,mclabelcasc_array,mcngen_ele,mcngen_casc);
1263 
1264  if(mclabxic>-1){
1265  mcxic = (AliAODMCParticle*) mcArray->At(mclabxic);
1266  if(mclabelele_array[0]>=0)
1267  mcele = (AliAODMCParticle*) mcArray->At(mclabelele_array[0]);
1268  if(mclabelcasc_array[0]>=0)
1269  mccasc = (AliAODMCParticle*) mcArray->At(mclabelcasc_array[0]);
1270  if(mcxic){
1271  fCandidateVariables[41] = mcxic->GetPdgCode();
1272  fCandidateVariables[42] = mcxic->Label();
1273  fCandidateVariables[43] = mcxic->Px();
1274  fCandidateVariables[44] = mcxic->Py();
1275  fCandidateVariables[45] = mcxic->Pz();
1276  }
1277  if(mcele){
1278  fCandidateVariables[46] = mcele->Px();
1279  fCandidateVariables[47] = mcele->Py();
1280  fCandidateVariables[48] = mcele->Pz();
1281  }
1282  if(mccasc){
1283  fCandidateVariables[49] = mccasc->Px();
1284  fCandidateVariables[50] = mccasc->Py();
1285  fCandidateVariables[51] = mccasc->Pz();
1286  }
1287  }
1288  fCandidateVariables[52] = mcpdgele_array[0];
1289  fCandidateVariables[53] = mcpdgcasc_array[0];
1290  fCandidateVariables[54] = mcpdgele_array[1];
1291  fCandidateVariables[55] = mcpdgcasc_array[1];
1292  fCandidateVariables[56] = mcpdgele_array[2];
1293  fCandidateVariables[57] = mcpdgcasc_array[2];
1294  fCandidateVariables[58] = mcngen_ele;
1295  fCandidateVariables[59] = mcngen_casc;
1296  }
1297  fCandidateVariables[62] = casc->MomPosX();
1298  fCandidateVariables[63] = casc->MomPosY();
1299  fCandidateVariables[64] = casc->MomPosZ();
1300  fCandidateVariables[65] = casc->MomNegX();
1301  fCandidateVariables[66] = casc->MomNegY();
1302  fCandidateVariables[67] = casc->MomNegZ();
1303  fCandidateVariables[68] = casc->DecayVertexV0X();
1304  fCandidateVariables[69] = casc->DecayVertexV0Y();
1305  fCandidateVariables[70] = casc->DecayVertexV0Z();
1306  fCandidateVariables[71] = casc->MomBachX();
1307  fCandidateVariables[72] = casc->MomBachY();
1308  fCandidateVariables[73] = casc->MomBachZ();
1309  fCandidateVariables[74] = casc->DecayVertexXiX();
1310  fCandidateVariables[75] = casc->DecayVertexXiY();
1311  fCandidateVariables[76] = casc->DecayVertexXiZ();
1312  fCandidateVariables[77] = fVtx1->GetX();
1313  fCandidateVariables[78] = fVtx1->GetY();
1314  fCandidateVariables[79] = fVtx1->GetZ();
1315 
1316  fCandidateVariables[80] = casc->MassOmega();
1317 
1318  if(trk) fCandidateVariables[81] = trk->GetITSClusterMap();
1319  if(cbtrack) fCandidateVariables[82] = cbtrack->GetITSClusterMap();
1320  if(cptrack) fCandidateVariables[83] = cptrack->GetITSClusterMap();
1321  if(cntrack) fCandidateVariables[84] = cntrack->GetITSClusterMap();
1322 
1323  fCandidateVariables[85] = trk->GetTPCNclsF();
1324  fCandidateVariables[86] = trk->GetTPCNcls();
1325  fCandidateVariables[87] = trk->GetTPCnclsS();
1327 
1329 
1330  if(fWriteVariableTree)
1331  fVariablesTree->Fill();
1332 
1333  Double_t cont[4];
1334  cont[0] = exobj->InvMass(2,pdgdg);
1335  cont[1] = exobj->Pt();
1336  cont[2] = exobj->Getd0Prong(0)*trk->Charge();
1337  cont[3] = fCentrality;
1338  fHistoEleXiMass->Fill(cont);
1339 
1340  Double_t cont_flip[4];
1341  cont_flip[0] = mexi_flip;
1342  cont_flip[1] = ptexi_flip;
1343  cont_flip[2] = 0.0;
1344  cont_flip[3] = fCentrality;
1345 
1346  Double_t cont2[3];
1347  cont2[0] = exobj->InvMass(2,pdgdg);
1348  cont2[1] = trk->Pt();
1349  cont2[2] = fCentrality;
1350 
1351  Double_t cont_eleptvseta[3];
1352  cont_eleptvseta[0] = trk->Pt();
1353  cont_eleptvseta[1] = trk->Eta();
1354  cont_eleptvseta[2] = fCentrality;
1355 
1356  Double_t cont_eleptvsxipt[3];
1357  cont_eleptvsxipt[0] = trk->Pt();
1358  cont_eleptvsxipt[1] = sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY());
1359  cont_eleptvsxipt[2] = fCentrality;
1360 
1361  Double_t cont_eleptvsd0[3];
1362  cont_eleptvsd0[0] = trk->Pt();
1363  cont_eleptvsd0[1] = exobj->Getd0Prong(0)*trk->Charge();
1364  cont_eleptvsd0[2] = fCentrality;
1365 
1367  {
1368  if(trk->Charge()*casc->ChargeXi()<0){
1369  fHistoEleXiMassRS->Fill(cont);
1370  if(trk->Charge()>0) fHistoEleXiMassRS1->Fill(cont);
1371  else fHistoEleXiMassRS2->Fill(cont);
1372  fHistoEleXiMassvsElePtRS->Fill(cont2);
1373  if(trk->Charge()>0) fHistoEleXiMassvsElePtRS1->Fill(cont2);
1374  else fHistoEleXiMassvsElePtRS2->Fill(cont2);
1375  if(cont[0]<2.5){
1376  fHistoElePtRS->Fill(trk->Pt(),fCentrality);
1377  fHistoElePtvsEtaRS->Fill(cont_eleptvseta);
1378  fHistoElePtvsXiPtRS->Fill(cont_eleptvsxipt);
1379  fHistoElePtvsd0RS->Fill(cont_eleptvsd0);
1380  for(Int_t ih=0;ih<23;ih++){
1381  Double_t cont_eleptvscutvars[3];
1382  cont_eleptvscutvars[0] = exobj->Pt();
1383  cont_eleptvscutvars[2] = fCentrality;
1384 
1385  if(ih==0){
1386  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1387  }else if(ih==1){
1388  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1389  }else if(ih==2){
1390  cont_eleptvscutvars[1] = nSigmaTPCele;
1391  }else if(ih==3){
1392  cont_eleptvscutvars[1] = nSigmaTOFele;
1393  }else if(ih==4){
1394  cont_eleptvscutvars[1] = trk->Eta();
1395  }else if(ih==5){
1396  cont_eleptvscutvars[1] = trk->GetITSNcls();
1397  }else if(ih==6){
1398  if(casc->ChargeXi()<0)
1399  cont_eleptvscutvars[1] = casc->MassLambda();
1400  else
1401  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1402  }else if(ih==7){
1403  cont_eleptvscutvars[1] = casc->MassXi();
1404  }else if(ih==8){
1405  Double_t lPosV0[3];
1406  lPosV0[0] = casc->DecayVertexV0X();
1407  lPosV0[1] = casc->DecayVertexV0Y();
1408  lPosV0[2] = casc->DecayVertexV0Z();
1409  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1410  }else if(ih==9){
1411  Double_t lPosXi[3];
1412  lPosXi[0] = casc->DecayVertexXiX();
1413  lPosXi[1] = casc->DecayVertexXiY();
1414  lPosXi[2] = casc->DecayVertexXiZ();
1415  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1416  }else if(ih==10){
1417  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1418  }else if(ih==11){
1419  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1420  }else if(ih==12){
1421  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1422  }else if(ih==13){
1423  if(casc->ChargeXi()<0.)
1424  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1425  else
1426  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1427  }else if(ih==14){
1428  if(casc->ChargeXi()>0.)
1429  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1430  else
1431  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1432  }else if(ih==15){
1433  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1434  }else if(ih==16){
1435  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1436  }else if(ih==17){
1437  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1438  }else if(ih==18){
1439  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1440  }else if(ih==19){
1441  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1442  }else if(ih==20){
1443  cont_eleptvscutvars[1] = casc->Eta();
1444  }else if(ih==21){
1445  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1446  }else if(ih==22){
1447  Double_t xipx = exobj->PxProng(1);
1448  Double_t xipy = exobj->PyProng(1);
1449  Double_t xipz = exobj->PzProng(1);
1450  Double_t epx = exobj->PxProng(0);
1451  Double_t epy = exobj->PyProng(0);
1452  Double_t epz = exobj->PzProng(0);
1453  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1454  }else{
1455  cont_eleptvscutvars[1] = -9999.;
1456  }
1457 
1458  fHistoElePtvsCutVarsRS[ih]->Fill(cont_eleptvscutvars);
1459  }
1460  }
1461  }else{
1462  fHistoEleXiMassWS->Fill(cont);
1463  if(trk->Charge()>0) fHistoEleXiMassWS1->Fill(cont);
1464  else fHistoEleXiMassWS2->Fill(cont);
1465  fHistoEleXiMassvsElePtWS->Fill(cont2);
1466  if(trk->Charge()>0) fHistoEleXiMassvsElePtWS1->Fill(cont2);
1467  else fHistoEleXiMassvsElePtWS2->Fill(cont2);
1468  if(cont[0]<2.5){
1469  fHistoElePtWS->Fill(trk->Pt(),fCentrality);
1470  fHistoElePtvsEtaWS->Fill(cont_eleptvseta);
1471  fHistoElePtvsXiPtWS->Fill(cont_eleptvsxipt);
1472  fHistoElePtvsd0WS->Fill(cont_eleptvsd0);
1473 
1474  for(Int_t ih=0;ih<23;ih++){
1475  Double_t cont_eleptvscutvars[3];
1476  cont_eleptvscutvars[0] = exobj->Pt();
1477  cont_eleptvscutvars[2] = fCentrality;
1478 
1479  if(ih==0){
1480  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1481  }else if(ih==1){
1482  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1483  }else if(ih==2){
1484  cont_eleptvscutvars[1] = nSigmaTPCele;
1485  }else if(ih==3){
1486  cont_eleptvscutvars[1] = nSigmaTOFele;
1487  }else if(ih==4){
1488  cont_eleptvscutvars[1] = trk->Eta();
1489  }else if(ih==5){
1490  cont_eleptvscutvars[1] = trk->GetITSNcls();
1491  }else if(ih==6){
1492  if(casc->ChargeXi()<0)
1493  cont_eleptvscutvars[1] = casc->MassLambda();
1494  else
1495  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1496  }else if(ih==7){
1497  cont_eleptvscutvars[1] = casc->MassXi();
1498  }else if(ih==8){
1499  Double_t lPosV0[3];
1500  lPosV0[0] = casc->DecayVertexV0X();
1501  lPosV0[1] = casc->DecayVertexV0Y();
1502  lPosV0[2] = casc->DecayVertexV0Z();
1503  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1504  }else if(ih==9){
1505  Double_t lPosXi[3];
1506  lPosXi[0] = casc->DecayVertexXiX();
1507  lPosXi[1] = casc->DecayVertexXiY();
1508  lPosXi[2] = casc->DecayVertexXiZ();
1509  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1510  }else if(ih==10){
1511  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1512  }else if(ih==11){
1513  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1514  }else if(ih==12){
1515  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1516  }else if(ih==13){
1517  if(casc->ChargeXi()<0.)
1518  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1519  else
1520  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1521  }else if(ih==14){
1522  if(casc->ChargeXi()>0.)
1523  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1524  else
1525  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1526  }else if(ih==15){
1527  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1528  }else if(ih==16){
1529  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1530  }else if(ih==17){
1531  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1532  }else if(ih==18){
1533  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1534  }else if(ih==19){
1535  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1536  }else if(ih==20){
1537  cont_eleptvscutvars[1] = casc->Eta();
1538  }else if(ih==21){
1539  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1540  }else if(ih==22){
1541  Double_t xipx = exobj->PxProng(1);
1542  Double_t xipy = exobj->PyProng(1);
1543  Double_t xipz = exobj->PzProng(1);
1544  Double_t epx = exobj->PxProng(0);
1545  Double_t epy = exobj->PyProng(0);
1546  Double_t epz = exobj->PzProng(0);
1547  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1548  }else{
1549  cont_eleptvscutvars[1] = -9999.;
1550  }
1551 
1552  fHistoElePtvsCutVarsWS[ih]->Fill(cont_eleptvscutvars);
1553  }
1554  }
1555  }
1556 
1557  if(fUseMCInfo){
1558  if(mcxic){
1559  Int_t pdgcode = mcxic->GetPdgCode();
1560  cont2[1] = mcele->Pt();
1561  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgcasc_array[1])==4132){
1562  Int_t labmotherxic = mcxic->GetMother();
1563  Bool_t isbottomfd = kFALSE;
1564  if(labmotherxic>=0)
1565  {
1566  AliAODMCParticle *motherxic = (AliAODMCParticle*)mcArray->At(labmotherxic);
1567  Int_t pdgmotherxic = motherxic->GetPdgCode();
1568  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){
1569  isbottomfd = kTRUE;
1570  }
1571  }
1572 
1573  fHistoEleXiMassMCS->Fill(cont);
1574  if(trk->Charge()>0) fHistoEleXiMassMCS1->Fill(cont);
1575  else fHistoEleXiMassMCS2->Fill(cont);
1576 
1577  if(isbottomfd){
1578  fHistoEleXiMassBFeeddownMCS->Fill(cont);
1579  if(trk->Charge()>0) fHistoEleXiMassBFeeddownMCS1->Fill(cont);
1580  else fHistoEleXiMassBFeeddownMCS2->Fill(cont);
1581  }else{
1582  fHistoEleXiMassPromptMCS->Fill(cont);
1583  if(trk->Charge()>0) fHistoEleXiMassPromptMCS1->Fill(cont);
1584  else fHistoEleXiMassPromptMCS2->Fill(cont);
1585  }
1586 
1587  fHistoEleXiMassvsElePtMCS->Fill(cont2);
1588  if(trk->Charge()>0) fHistoEleXiMassvsElePtMCS1->Fill(cont2);
1589  else fHistoEleXiMassvsElePtMCS2->Fill(cont2);
1590  if(cont[0]<2.5){
1591  fHistoElePtMCS->Fill(mcele->Pt(),fCentrality);
1592  fHistoElePtvsEtaMCS->Fill(cont_eleptvseta);
1593  fHistoElePtvsXiPtMCS->Fill(cont_eleptvsxipt);
1594  fHistoElePtvsd0MCS->Fill(cont_eleptvsd0);
1595 
1596  Double_t cont_xic[3];
1597  cont_xic[0] = mcxic->Pt();
1598  cont_xic[1] = mcxic->Y();
1599  cont_xic[2] = fCentrality;
1600  fHistoXicMCS->Fill(cont_xic);
1601  if(trk->Charge()>0) fHistoXicMCS1->Fill(cont_xic);
1602  else fHistoXicMCS2->Fill(cont_xic);
1603 
1604  Double_t cont_mcele[3];
1605  cont_mcele[0] = mcele->Pt();
1606  cont_mcele[1] = mcele->Eta();
1607  cont_mcele[2] = fCentrality;
1608  fHistoXicElectronMCS->Fill(cont_mcele);
1609  if(trk->Charge()>0) fHistoXicElectronMCS1->Fill(cont_mcele);
1610  else fHistoXicElectronMCS2->Fill(cont_mcele);
1611 
1612  fHistoResponseElePt->Fill(mcele->Pt(),trk->Pt());
1613  fHistoResponseEleXiPt->Fill(mcxic->Pt(),exobj->Pt());
1614 
1615  Double_t cont_eleptvsxiptvsxicpt[4];
1616  cont_eleptvsxiptvsxicpt[0] = cont_eleptvsxipt[0];
1617  cont_eleptvsxiptvsxicpt[1] = cont_eleptvsxipt[1];
1618  cont_eleptvsxiptvsxicpt[2] = mcxic->Pt();
1619  cont_eleptvsxiptvsxicpt[3] = cont_eleptvsxipt[2];
1620  fHistoElePtvsXiPtvsXicPtMCS->Fill(cont_eleptvsxiptvsxicpt);
1621 
1622  if(isbottomfd){
1623  fHistoElePtvsd0BFeeddownMCS->Fill(cont_eleptvsd0);
1624  }else{
1625  fHistoElePtvsd0PromptMCS->Fill(cont_eleptvsd0);
1626  }
1627 
1628  for(Int_t ih=0;ih<23;ih++){
1629  Double_t cont_eleptvscutvars[3];
1630  cont_eleptvscutvars[0] = exobj->Pt();
1631  cont_eleptvscutvars[2] = fCentrality;
1632 
1633  if(ih==0){
1634  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1635  }else if(ih==1){
1636  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1637  }else if(ih==2){
1638  cont_eleptvscutvars[1] = nSigmaTPCele;
1639  }else if(ih==3){
1640  cont_eleptvscutvars[1] = nSigmaTOFele;
1641  }else if(ih==4){
1642  cont_eleptvscutvars[1] = trk->Eta();
1643  }else if(ih==5){
1644  cont_eleptvscutvars[1] = trk->GetITSNcls();
1645  }else if(ih==6){
1646  if(casc->ChargeXi()<0)
1647  cont_eleptvscutvars[1] = casc->MassLambda();
1648  else
1649  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1650  }else if(ih==7){
1651  cont_eleptvscutvars[1] = casc->MassXi();
1652  }else if(ih==8){
1653  Double_t lPosV0[3];
1654  lPosV0[0] = casc->DecayVertexV0X();
1655  lPosV0[1] = casc->DecayVertexV0Y();
1656  lPosV0[2] = casc->DecayVertexV0Z();
1657  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1658  }else if(ih==9){
1659  Double_t lPosXi[3];
1660  lPosXi[0] = casc->DecayVertexXiX();
1661  lPosXi[1] = casc->DecayVertexXiY();
1662  lPosXi[2] = casc->DecayVertexXiZ();
1663  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1664  }else if(ih==10){
1665  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1666  }else if(ih==11){
1667  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1668  }else if(ih==12){
1669  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1670  }else if(ih==13){
1671  if(casc->ChargeXi()<0.)
1672  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1673  else
1674  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1675  }else if(ih==14){
1676  if(casc->ChargeXi()>0.)
1677  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1678  else
1679  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1680  }else if(ih==15){
1681  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1682  }else if(ih==16){
1683  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1684  }else if(ih==17){
1685  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1686  }else if(ih==18){
1687  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1688  }else if(ih==19){
1689  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1690  }else if(ih==20){
1691  cont_eleptvscutvars[1] = casc->Eta();
1692  }else if(ih==21){
1693  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1694  }else if(ih==22){
1695  Double_t xipx = exobj->PxProng(1);
1696  Double_t xipy = exobj->PyProng(1);
1697  Double_t xipz = exobj->PzProng(1);
1698  Double_t epx = exobj->PxProng(0);
1699  Double_t epy = exobj->PyProng(0);
1700  Double_t epz = exobj->PzProng(0);
1701  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1702  }else{
1703  cont_eleptvscutvars[1] = -9999.;
1704  }
1705 
1706  fHistoElePtvsCutVarsMCS[ih]->Fill(cont_eleptvscutvars);
1707  }
1708  }
1709  }
1710  }
1711  }
1712  }
1713 
1714  //if( exobj->InvMass(2,pdgdg)<10. && cosoa < 0. && fAnalCuts->IsPeakRegion(casc))
1715  if( mexi_flip <10. && cosoa < 0. && fAnalCuts->IsPeakRegion(casc))
1716  {
1717  if(trk->Charge()*casc->ChargeXi()<0){
1718  fHistoEleXiMassRSAway->Fill(cont_flip);
1719  if(trk->Charge()>0) fHistoEleXiMassRS1Away->Fill(cont_flip);
1720  else fHistoEleXiMassRS2Away->Fill(cont_flip);
1721  }else{
1722  fHistoEleXiMassWSAway->Fill(cont_flip);
1723  if(trk->Charge()>0) fHistoEleXiMassWS1Away->Fill(cont_flip);
1724  else fHistoEleXiMassWS2Away->Fill(cont_flip);
1725  }
1726  }
1727 
1729  {
1730  if(trk->Charge()*casc->ChargeXi()<0){
1731  fHistoEleXiMassRSSide->Fill(cont);
1732  if(trk->Charge()>0) fHistoEleXiMassRSSide1->Fill(cont);
1733  else fHistoEleXiMassRSSide2->Fill(cont);
1734  fHistoEleXiMassvsElePtRSSide->Fill(cont2);
1735  if(trk->Charge()>0) fHistoEleXiMassvsElePtRSSide1->Fill(cont2);
1736  else fHistoEleXiMassvsElePtRSSide2->Fill(cont2);
1737  }else{
1738  fHistoEleXiMassWSSide->Fill(cont);
1739  if(trk->Charge()>0) fHistoEleXiMassWSSide1->Fill(cont);
1740  else fHistoEleXiMassWSSide2->Fill(cont);
1741  fHistoEleXiMassvsElePtWSSide->Fill(cont2);
1742  if(trk->Charge()>0) fHistoEleXiMassvsElePtWSSide1->Fill(cont2);
1743  else fHistoEleXiMassvsElePtWSSide2->Fill(cont2);
1744  }
1745  }
1746 
1747  //if( exobj->InvMass(2,pdgdg)<10. && cosoa < 0. && fAnalCuts->IsSideBand(casc))
1748  if( mexi_flip< 10. && cosoa < 0. && fAnalCuts->IsSideBand(casc))
1749  {
1750  if(trk->Charge()*casc->ChargeXi()<0){
1751  fHistoEleXiMassRSSideAway->Fill(cont_flip);
1752  if(trk->Charge()>0) fHistoEleXiMassRSSide1Away->Fill(cont_flip);
1753  else fHistoEleXiMassRSSide2Away->Fill(cont_flip);
1754  }else{
1755  fHistoEleXiMassWSSideAway->Fill(cont_flip);
1756  if(trk->Charge()>0) fHistoEleXiMassWSSide1Away->Fill(cont_flip);
1757  else fHistoEleXiMassWSSide2Away->Fill(cont_flip);
1758  }
1759  }
1760 
1761  return;
1762 }
1763 
1765 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMixROOTObjects(TLorentzVector *trke, TLorentzVector *casc, Int_t chargexi)
1766 {
1767  //
1768  // Fill histograms or tree depending on fWriteVariableTree
1769  //
1770  if(!trke) return;
1771  if(!casc) return;
1772 
1773 
1774  for(Int_t i=0;i<90;i++){
1775  fCandidateVariables[i] = -9999.;
1776  }
1777 
1778  Double_t pxe = trke->Px();
1779  Double_t pye = trke->Py();
1780  Double_t pze = trke->Pz();
1781  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
1782  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
1783 
1784  Double_t pxv = casc->Px();
1785  Double_t pyv = casc->Py();
1786  Double_t pzv = casc->Pz();
1787  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
1788  Double_t Ev = sqrt(momv*momv+1.32171*1.32171);
1789 
1790  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
1791 
1792  Double_t pxsum = pxe + pxv;
1793  Double_t pysum = pye + pyv;
1794  Double_t pzsum = pze + pzv;
1795  Double_t Esum = Ee + Ev;
1796  Double_t mexi = sqrt(Esum*Esum-pxsum*pxsum-pysum*pysum-pzsum*pzsum);
1797 
1798  Double_t uxe = pxe/mome;
1799  Double_t uye = pye/mome;
1800  Double_t uze = pze/mome;
1801  Double_t lf = -2.*(pxv*uxe+pyv*uye+pzv*uze);
1802  Double_t pxv_flip = pxv + lf * uxe;
1803  Double_t pyv_flip = pyv + lf * uye;
1804  Double_t pzv_flip = pzv + lf * uze;
1805  Double_t pxsum_flip = pxe + pxv_flip;
1806  Double_t pysum_flip = pye + pyv_flip;
1807  Double_t pzsum_flip = pze + pzv_flip;
1808  Double_t mexi_flip = sqrt(Esum*Esum-pxsum_flip*pxsum_flip-pysum_flip*pysum_flip-pzsum_flip*pzsum_flip);
1809  Double_t ptexi_flip = sqrt(pxsum_flip*pxsum_flip+pysum_flip*pysum_flip);
1810 
1811  Double_t posVtx[3] = {0.,0.,0.};
1812  fVtx1->GetXYZ(posVtx);
1813 
1815  UInt_t pdgdg[2]={11,3312};
1816  fCandidateVariables[ 1] = mexi;
1817  fCandidateVariables[ 2] = sqrt(pxsum*pxsum+pysum*pysum);
1818  fCandidateVariables[ 3] = pxsum;
1819  fCandidateVariables[ 4] = pysum;
1820  fCandidateVariables[ 5] = pzsum;
1821  fCandidateVariables[ 6] = pxe;
1822  fCandidateVariables[ 7] = pye;
1823  fCandidateVariables[ 8] = pze;
1824  fCandidateVariables[ 9] = pxv;
1825  fCandidateVariables[10] = pyv;
1826  fCandidateVariables[11] = pzv;
1827  fCandidateVariables[12] = chargexi;
1828  fCandidateVariables[13] = casc->M();
1829  fCandidateVariables[29] = trke->T();
1830  fCandidateVariables[30] = 1;//mixing
1831  fCandidateVariables[77] = fVtx1->GetX();
1832  fCandidateVariables[78] = fVtx1->GetY();
1833  fCandidateVariables[79] = fVtx1->GetZ();
1835 
1836  if(fWriteVariableTree)
1837  fVariablesTree->Fill();
1838 
1839  Double_t cont[4];
1840  cont[0] = mexi;
1841  cont[1] = sqrt(pxsum*pxsum+pysum*pysum);
1842  cont[2] = 0.0;
1843  cont[3] = fCentrality;
1844 
1845  Double_t cont_flip[4];
1846  cont_flip[0] = mexi_flip;
1847  cont_flip[1] = ptexi_flip;
1848  cont_flip[2] = 0.0;
1849  cont_flip[3] = fCentrality;
1850 
1851  Double_t cont2[3];
1852  cont2[0] = mexi;
1853  cont2[1] = sqrt(pxe*pxe+pye*pye);
1854  cont2[2] = fCentrality;
1855 
1856  Double_t cont_eleptvseta[3];
1857  cont_eleptvseta[0] = trke->Pt();
1858  cont_eleptvseta[1] = trke->Eta();
1859  cont_eleptvseta[2] = fCentrality;
1860 
1861  Double_t cont_eleptvsxipt[3];
1862  cont_eleptvsxipt[0] = trke->Pt();
1863  cont_eleptvsxipt[1] = casc->Pt();
1864  cont_eleptvsxipt[2] = fCentrality;
1865 
1866  Double_t cont_eleptvsd0[3];
1867  cont_eleptvsd0[0] = trke->Pt();
1868  cont_eleptvsd0[1] = 0.;
1869  cont_eleptvsd0[2] = fCentrality;
1870 
1871  if(mexi<10. && cosoa>0. && fAnalCuts->IsPeakRegion(casc))
1872  {
1873  if(((int)trke->T())*chargexi<0){
1874  fHistoEleXiMassRSMix->Fill(cont);
1875  if(trke->T()>0) fHistoEleXiMassRSMix1->Fill(cont);
1876  else fHistoEleXiMassRSMix2->Fill(cont);
1877  fHistoEleXiMassvsElePtRSMix->Fill(cont2);
1878  if(trke->T()>0) fHistoEleXiMassvsElePtRSMix1->Fill(cont2);
1879  else fHistoEleXiMassvsElePtRSMix2->Fill(cont2);
1880  if(cont[0]<2.5){
1881  fHistoElePtRSMix->Fill(trke->Pt(),fCentrality);
1882  fHistoElePtvsEtaRSMix->Fill(cont_eleptvseta);
1883  fHistoElePtvsXiPtRSMix->Fill(cont_eleptvsxipt);
1884  fHistoElePtvsd0RSMix->Fill(cont_eleptvsd0);
1885  }
1886  }else{
1887  fHistoEleXiMassWSMix->Fill(cont);
1888  if(trke->T()>0) fHistoEleXiMassWSMix1->Fill(cont);
1889  else fHistoEleXiMassWSMix2->Fill(cont);
1890  fHistoEleXiMassvsElePtWSMix->Fill(cont2);
1891  if(trke->T()>0) fHistoEleXiMassvsElePtWSMix1->Fill(cont2);
1892  else fHistoEleXiMassvsElePtWSMix2->Fill(cont2);
1893  if(cont[0]<2.5){
1894  fHistoElePtWSMix->Fill(trke->Pt(),fCentrality);
1895  fHistoElePtvsEtaWSMix->Fill(cont_eleptvseta);
1896  fHistoElePtvsXiPtWSMix->Fill(cont_eleptvsxipt);
1897  fHistoElePtvsd0WSMix->Fill(cont_eleptvsd0);
1898  }
1899  }
1900  }
1901 
1902  //if(mexi < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(casc))
1903  if(mexi_flip < 10. && cosoa<0. && fAnalCuts->IsPeakRegion(casc))
1904  {
1905  if(((int)trke->T())*chargexi<0){
1906  fHistoEleXiMassRSMixAway->Fill(cont_flip);
1907  if(trke->T()>0) fHistoEleXiMassRSMix1Away->Fill(cont_flip);
1908  else fHistoEleXiMassRSMix2Away->Fill(cont_flip);
1909  }else{
1910  fHistoEleXiMassWSMixAway->Fill(cont_flip);
1911  if(trke->T()>0) fHistoEleXiMassWSMix1Away->Fill(cont_flip);
1912  else fHistoEleXiMassWSMix2Away->Fill(cont_flip);
1913  }
1914  }
1915 
1916  return;
1917 }
1918 
1921 {
1922  //
1923  // Define electron tree variables
1924  //
1925 
1926  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
1927  fEleVariablesTree = new TTree(nameoutput,"electron variables tree");
1928  Int_t nVar = 26;
1929  fCandidateEleVariables = new Float_t [nVar];
1930  TString * fCandidateVariableNames = new TString[nVar];
1931 
1932  fCandidateVariableNames[ 0]="ElePx";
1933  fCandidateVariableNames[ 1]="ElePy";
1934  fCandidateVariableNames[ 2]="ElePz";
1935  fCandidateVariableNames[ 3]="TPCChi2overNDF";
1936  fCandidateVariableNames[ 4]="ITSNcls";
1937  fCandidateVariableNames[ 5]="TPCNcls";
1938  fCandidateVariableNames[ 6]="TPCNclsPID";
1939  fCandidateVariableNames[ 7]="TPCNclsRatio";
1940  fCandidateVariableNames[ 8]="d0R";
1941  fCandidateVariableNames[ 9]="d0Z";
1942  fCandidateVariableNames[10]="ITSClusterMap";
1943  fCandidateVariableNames[11]="nSigmaTPCele";
1944  fCandidateVariableNames[12]="nSigmaTOFele";
1945  fCandidateVariableNames[13]="nSigmaTPCpi";
1946  fCandidateVariableNames[14]="nSigmaTPCka";
1947  fCandidateVariableNames[15]="nSigmaTPCpr";
1948  fCandidateVariableNames[16]="EvNumber";
1949  fCandidateVariableNames[17]="EleCharge";
1950  fCandidateVariableNames[18]="ElePdgCode";
1951  fCandidateVariableNames[19]="EleMotherPdgCode";
1952  fCandidateVariableNames[20]="mcelepx";
1953  fCandidateVariableNames[21]="mcelepy";
1954  fCandidateVariableNames[22]="mcelepz";
1955  fCandidateVariableNames[23]="Centrality";
1956  fCandidateVariableNames[24]="PrimVertZ";
1957  fCandidateVariableNames[25]="RunNumber";
1958 
1959  for (Int_t ivar=0; ivar<nVar; ivar++) {
1960  fEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1961  }
1962 
1963  return;
1964 }
1966 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillElectronROOTObjects(AliAODTrack *trk, TClonesArray *mcArray)
1967 {
1968  //
1969  // Fill histograms or tree depending on fWriteVariableTree
1970  //
1971 
1972  if(!trk) return;
1973 
1974  fHistoBachPt->Fill(trk->Pt());
1975  fHistoElectronQovPtvsPhi->Fill(trk->Phi(),(Double_t)trk->Charge()/trk->Pt());
1976 
1977  if(fDoEventMixing){
1978  fElectronTracks->AddLast(new TLorentzVector(trk->Px(),trk->Py(),trk->Pz(),trk->Charge()));
1979  }
1980 
1981 
1982  Int_t pdgEle = -9999;
1983  Int_t pdgEleMother = -9999;
1984  Float_t mcepx = -9999;
1985  Float_t mcepy = -9999;
1986  Float_t mcepz = -9999;
1987  if(fUseMCInfo)
1988  {
1989  Int_t labEle = trk->GetLabel();
1990  if(labEle<0) return;
1991  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
1992  if(!mcetrk) return;
1993  pdgEle = mcetrk->GetPdgCode();
1994  if(abs(pdgEle)!=11) return;
1995 
1996  Bool_t hfe_flag = kFALSE;
1997  Bool_t gamma_flag = kFALSE;
1998  Int_t labemother = mcetrk->GetMother();
1999  if(labemother>=0){
2000  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
2001  if(!motherele) return;
2002  pdgEleMother = motherele->GetPdgCode();
2003  if(abs(pdgEleMother)>4000&&abs(pdgEleMother)<4400){
2004  hfe_flag = kTRUE;
2005  }
2006  if(abs(pdgEleMother)==22){
2007  gamma_flag = kTRUE;
2008  }
2009  }
2010 
2011  if(!gamma_flag){
2012  fHistoBachPtMCS->Fill(trk->Pt());
2013  }
2014 
2015  if(!hfe_flag) return;
2016  mcepx = mcetrk->Px();
2017  mcepy = mcetrk->Py();
2018  mcepz = mcetrk->Pz();
2019  }
2020 
2021  if(!fWriteEachVariableTree) return;
2022 
2023 
2024  for(Int_t i=0;i<26;i++){
2025  fCandidateEleVariables[i] = -9999.;
2026  }
2027 
2028  fCandidateEleVariables[ 0] = trk->Px();
2029  fCandidateEleVariables[ 1] = trk->Py();
2030  fCandidateEleVariables[ 2] = trk->Pz();
2031  fCandidateEleVariables[ 3] = trk->Chi2perNDF();
2032  fCandidateEleVariables[ 4] = trk->GetITSNcls();
2033  fCandidateEleVariables[ 5] = trk->GetTPCncls();
2034  fCandidateEleVariables[ 6] = trk->GetTPCsignalN();
2035  if(trk->GetTPCNclsF()>0)
2036  fCandidateEleVariables[ 7] = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
2037 
2038  Double_t d0z0[2],covd0z0[3];
2039  trk->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);
2040 
2041  fCandidateEleVariables[ 8] = d0z0[0];
2042  fCandidateEleVariables[ 9] = d0z0[1];
2043  Int_t itsmap = trk->GetITSClusterMap();
2044  Int_t bit1 = 1;
2045  Int_t bit2 = 2;
2046  Bool_t spdfirst = (itsmap & bit1) == bit1;
2047  Bool_t spdsecond = (itsmap & bit2) == bit2;
2048  fCandidateEleVariables[10] = ((Int_t)spdfirst) + 2 * ((Int_t)spdsecond);
2049 
2050  if(fAnalCuts->GetIsUsePID())
2051  {
2052  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
2053  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
2054  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
2055  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
2056  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
2057  fCandidateEleVariables[11] = nSigmaTPCele;
2058  fCandidateEleVariables[12] = nSigmaTOFele;
2059  fCandidateEleVariables[13] = nSigmaTPCpi_etrk;
2060  fCandidateEleVariables[14] = nSigmaTPCka_etrk;
2061  fCandidateEleVariables[15] = nSigmaTPCpr_etrk;
2062  }
2064  fCandidateEleVariables[17] = trk->Charge();
2065  fCandidateEleVariables[18] = pdgEle;
2066  fCandidateEleVariables[19] = pdgEleMother;
2067  fCandidateEleVariables[20] = mcepx;
2068  fCandidateEleVariables[21] = mcepy;
2069  fCandidateEleVariables[22] = mcepz;
2073 
2074  fHistod0Bach->Fill(d0z0[0]);
2075 
2076  fEleVariablesTree->Fill();
2077 }
2080 {
2081  //
2082  // Define V0 tree variables
2083  //
2084 
2085  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
2086  fCascVariablesTree = new TTree(nameoutput,"cascade variables tree");
2087  Int_t nVar = 26;
2088  fCandidateCascVariables = new Float_t [nVar];
2089  TString * fCandidateVariableNames = new TString[nVar];
2090 
2091  fCandidateVariableNames[ 0]="Centrality";
2092  fCandidateVariableNames[ 1]="InvMassXi";
2093  fCandidateVariableNames[ 2]="XiPx";
2094  fCandidateVariableNames[ 3]="XiPy";
2095  fCandidateVariableNames[ 4]="XiPz";
2096  fCandidateVariableNames[ 5]="InvMassLambda";
2097  fCandidateVariableNames[ 6]="DcaXiDaughters";
2098  fCandidateVariableNames[ 7]="DcaV0Daughters";
2099  fCandidateVariableNames[ 8]="DecayLengthXi";
2100  fCandidateVariableNames[ 9]="CosPointingAngleXi";
2101  fCandidateVariableNames[10]="DcaV0toPrimVertex";
2102  fCandidateVariableNames[11]="DcaPostoPrimVertex";
2103  fCandidateVariableNames[12]="DcaNegtoPrimVertex";
2104  fCandidateVariableNames[13]="DcaBachtoPrimVertex";
2105  fCandidateVariableNames[14]="DecayLengthV0";
2106  fCandidateVariableNames[15]="CosPointingAngleV0";
2107  fCandidateVariableNames[16]="XiCharge";
2108  fCandidateVariableNames[17]="XiPdgCode";
2109  fCandidateVariableNames[18]="XiMotherPdgCode";
2110  fCandidateVariableNames[19]="mcxipx";
2111  fCandidateVariableNames[20]="mcxipy";
2112  fCandidateVariableNames[21]="mcxipz";
2113  fCandidateVariableNames[22]="labcasc";
2114  fCandidateVariableNames[23]="RunNumber";
2115  fCandidateVariableNames[24]="PrimVertZ";
2116  fCandidateVariableNames[25]="EvNumber";
2117 
2118  for (Int_t ivar=0; ivar<nVar; ivar++) {
2119  fCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2120  }
2121 
2122  return;
2123 }
2124 
2126 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
2127 {
2128  //
2129  // Fill histograms or tree depending on fWriteVariableTree (tree not implemented yet)
2130  //
2131  if(!casc) return;
2132  fHistoXiMassvsPt->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2133  fHistoOmegaMassvsPt->Fill(casc->MassOmega(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2134  Double_t momxix = casc->MomXiX();
2135  Double_t momxiy = casc->MomXiY();
2136  Double_t phi_alice = atan2(momxiy,momxix);
2137  if(phi_alice<0.) phi_alice += 2 * M_PI;
2138  fHistoXiQovPtvsPhi->Fill(phi_alice,(Double_t)casc->ChargeXi()/sqrt(momxix*momxix+momxiy*momxiy));
2139 
2140  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2141  Double_t posVtx[3] = {0.,0.,0.};
2142  fVtx1->GetXYZ(posVtx);
2143  Double_t ptotlam = TMath::Sqrt(pow(casc->Px(),2)+pow(casc->Py(),2)+pow(casc->Pz(),2));
2144  Double_t v0propdl = sqrt(pow(casc->DecayVertexV0X()-posVtx[0],2)+pow(casc->DecayVertexV0Y()-posVtx[1],2)+pow(casc->DecayVertexV0Z()-posVtx[2],2))*mlamPDG/ptotlam;
2145  if(fAnalCuts->IsPeakRegion(casc)){
2146  fHistoLambdaPtvsDl->Fill(casc->Pt(),v0propdl);
2147  }
2148  if(fAnalCuts->IsSideBand(casc)){
2149  fHistoLambdaPtvsDlSide->Fill(casc->Pt(),v0propdl);
2150  }
2151 
2152  Int_t xipdgcode = -9999;
2153  Int_t ximotherpdgcode = -9999;
2154  Float_t mcxipx = -9999.;
2155  Float_t mcxipy = -9999.;
2156  Float_t mcxipz = -9999.;
2157  Int_t labcasc = -9999.;
2158  if(fUseMCInfo){
2159  Int_t pdgDgcasc[2]={211,3122};
2160  Int_t pdgDgv0[2]={2212,211};
2161  labcasc = MatchToMCCascade(casc,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
2162  if(labcasc<0) return;
2163 
2164  fHistoXiMassvsPtMCS->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
2165 
2166  AliAODMCParticle *mccasctrk = (AliAODMCParticle*)mcArray->At(labcasc);
2167  if(!mccasctrk) return;
2168 
2169  fHistoLambdaPtvsDlMCS->Fill(casc->Pt(),v0propdl);
2170 
2171  Bool_t hfxi_flag = kFALSE;
2172  xipdgcode = mccasctrk->GetPdgCode();
2173  Int_t labcascmother = mccasctrk->GetMother();
2174  if(labcascmother>=0){
2175  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
2176  if(mothercasc){
2177  ximotherpdgcode = mothercasc->GetPdgCode();
2178  if(abs(ximotherpdgcode)>4000&&abs(ximotherpdgcode)<4400){
2179  hfxi_flag = kTRUE;
2180  }
2181  }
2182  }
2183  if(!hfxi_flag) return;
2184  mcxipx = mccasctrk->Px();
2185  mcxipy = mccasctrk->Py();
2186  mcxipz = mccasctrk->Pz();
2187  }
2188 
2189 
2190  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
2191  xyz[0]=casc->DecayVertexXiX();
2192  xyz[1]=casc->DecayVertexXiY();
2193  xyz[2]=casc->DecayVertexXiZ();
2194  pxpypz[0]=casc->MomXiX();
2195  pxpypz[1]=casc->MomXiY();
2196  pxpypz[2]=casc->MomXiZ();
2197  casc->GetCovarianceXYZPxPyPz(cv);
2198  sign=casc->ChargeXi();
2199  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
2200  trackCasc->PropagateToDCA(fVtx1,fBzkG,kVeryBig);
2201  Double_t momcasc_new[3]={-9999,-9999,-9999.};
2202  trackCasc->GetPxPyPz(momcasc_new);
2203 
2204  if(fDoEventMixing){
2205  TLorentzVector *lv = new TLorentzVector();
2206  lv->SetXYZM(momcasc_new[0],momcasc_new[1],momcasc_new[2],casc->MassXi());
2207  if(casc->ChargeXi()>0)
2208  fCascadeTracks1->AddLast(lv);
2209  else
2210  fCascadeTracks2->AddLast(lv);
2211  }
2212 
2213  if(!fWriteEachVariableTree) return;
2214 
2215  for(Int_t i=0;i<26;i++){
2216  fCandidateCascVariables[i] = -9999.;
2217  }
2218 
2220  fCandidateCascVariables[ 1] = casc->MassXi();
2221  fCandidateCascVariables[ 2] = momcasc_new[0];//casc->MomXiX();
2222  fCandidateCascVariables[ 3] = momcasc_new[1];//casc->MomXiY();
2223  fCandidateCascVariables[ 4] = momcasc_new[2];//casc->MomXiZ();
2224  if(casc->ChargeXi()<0)
2225  fCandidateCascVariables[ 5] = casc->MassLambda();
2226  else
2227  fCandidateCascVariables[ 5] = casc->MassAntiLambda();
2228 
2229  fCandidateCascVariables[ 6] = casc->DcaXiDaughters();
2230  fCandidateCascVariables[ 7] = casc->DcaV0Daughters();
2231  fCandidateCascVariables[ 8] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
2232  fCandidateCascVariables[ 9] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
2233  fCandidateCascVariables[10] = casc->DcaV0ToPrimVertex();
2234  fCandidateCascVariables[11] = casc->DcaPosToPrimVertex();
2235  fCandidateCascVariables[12] = casc->DcaNegToPrimVertex();
2236  fCandidateCascVariables[13] = casc->DcaBachToPrimVertex();
2237  fCandidateCascVariables[14] = casc->DecayLengthV0();
2238  fCandidateCascVariables[15] = casc->CosPointingAngle(casc->GetDecayVertexXi());
2239  fCandidateCascVariables[16] = casc->ChargeXi();
2240  fCandidateCascVariables[17] = xipdgcode;
2241  fCandidateCascVariables[18] = ximotherpdgcode;
2242  fCandidateCascVariables[19] = mcxipx;
2243  fCandidateCascVariables[20] = mcxipy;
2244  fCandidateCascVariables[21] = mcxipz;
2245  fCandidateCascVariables[22] = labcasc;
2249 
2250 
2251  fCascVariablesTree->Fill();
2252 }
2255 {
2256  //
2257  // Define electron tree variables
2258  //
2259 
2260  const char* nameoutput = GetOutputSlot(7)->GetContainer()->GetName();
2261  fMCVariablesTree = new TTree(nameoutput,"MC variables tree");
2262  Int_t nVar = 16;
2263  fCandidateMCVariables = new Float_t [nVar];
2264  TString * fCandidateVariableNames = new TString[nVar];
2265 
2266  fCandidateVariableNames[ 0]="Centrality";
2267  fCandidateVariableNames[ 1]="DecayType";
2268  fCandidateVariableNames[ 2]="XicPx";
2269  fCandidateVariableNames[ 3]="XicPy";
2270  fCandidateVariableNames[ 4]="XicPz";
2271  fCandidateVariableNames[ 5]="ElePx";
2272  fCandidateVariableNames[ 6]="ElePy";
2273  fCandidateVariableNames[ 7]="ElePz";
2274  fCandidateVariableNames[ 8]="CascPx";
2275  fCandidateVariableNames[ 9]="CascPy";
2276  fCandidateVariableNames[10]="CascPz";
2277  fCandidateVariableNames[11]="PdgCode";
2278  fCandidateVariableNames[12]="ElePdgCode";
2279  fCandidateVariableNames[13]="CascPdgCode";
2280  fCandidateVariableNames[14]="RunNumber";
2281  fCandidateVariableNames[15]="EvNumber";
2282 
2283  for (Int_t ivar=0; ivar<nVar; ivar++) {
2284  fMCVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2285  }
2286  return;
2287 }
2289 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCROOTObjects(AliAODMCParticle *mcpart, AliAODMCParticle *mcepart, AliAODMCParticle *mccascpart, Int_t decaytype)
2290 {
2291  //
2292  // Fill histograms or tree depending on fWriteMCVariableTree
2293  //
2294  if(!mcpart) return;
2295  if(!mcepart) return;
2296  if(!mccascpart) return;
2297 
2298  for(Int_t i=0;i<14;i++){
2299  fCandidateMCVariables[i] = -9999.;
2300  }
2301 
2303  fCandidateMCVariables[ 1] = decaytype;
2304  fCandidateMCVariables[ 2] = mcpart->Px();
2305  fCandidateMCVariables[ 3] = mcpart->Py();
2306  fCandidateMCVariables[ 4] = mcpart->Pz();
2307  fCandidateMCVariables[ 5] = mcepart->Px();
2308  fCandidateMCVariables[ 6] = mcepart->Py();
2309  fCandidateMCVariables[ 7] = mcepart->Pz();
2310  fCandidateMCVariables[ 8] = mccascpart->Px();
2311  fCandidateMCVariables[ 9] = mccascpart->Py();
2312  fCandidateMCVariables[10] = mccascpart->Pz();
2313  fCandidateMCVariables[11] = mcpart->GetPdgCode();
2314  fCandidateMCVariables[12] = mcepart->GetPdgCode();
2315  fCandidateMCVariables[13] = mccascpart->GetPdgCode();
2318 
2319  Double_t epx = mcepart->Px();
2320  Double_t epy = mcepart->Py();
2321  Double_t epz = mcepart->Pz();
2322  Double_t eE = sqrt(epx*epx+epy*epy+epz*epz+0.000511*0.000511);
2323  Double_t cascpx = mccascpart->Px();
2324  Double_t cascpy = mccascpart->Py();
2325  Double_t cascpz = mccascpart->Pz();
2326  Double_t cascE = sqrt(cascpx*cascpx+cascpy*cascpy+cascpz*cascpz+1.32171*1.32171);
2327 
2328  Double_t InvMassEleXi = sqrt(pow(eE+cascE,2)-pow(epx+cascpx,2)-pow(epy+cascpy,2)-pow(epz+cascpz,2));
2329 
2330  Double_t cont[4];
2331  cont[0] = InvMassEleXi;
2332  cont[1] = mcpart->Pt();
2333  cont[2] = 0.0;
2334  cont[3] = fCentrality;
2335  Double_t cont2[3];
2336  cont2[0] = InvMassEleXi;
2337  cont2[1] = mcepart->Pt();
2338  cont2[2] = fCentrality;
2339  Double_t cont_eleptvseta[3];
2340  cont_eleptvseta[0] = mcepart->Pt();
2341  cont_eleptvseta[1] = mcepart->Eta();
2342  cont_eleptvseta[2] = fCentrality;
2343  Double_t cont_eleptvsxipt[3];
2344  cont_eleptvsxipt[0] = mcepart->Pt();
2345  cont_eleptvsxipt[1] = mccascpart->Pt();
2346  cont_eleptvsxipt[2] = fCentrality;
2347  Double_t cont_eleptvsxiptvsxicpt[4];
2348  cont_eleptvsxiptvsxicpt[0] = mcepart->Pt();
2349  cont_eleptvsxiptvsxicpt[1] = mccascpart->Pt();
2350  cont_eleptvsxiptvsxicpt[2] = mcpart->Pt();
2351  cont_eleptvsxiptvsxicpt[3] = fCentrality;
2352 
2353  Double_t contmc[3];
2354  contmc[0] = mcpart->Pt();
2355  contmc[1] = mcpart->Y();
2356  contmc[2] = fCentrality;
2357  Double_t contmcele[3];
2358  contmcele[0] = mcepart->Pt();
2359  contmcele[1] = mcepart->Eta();
2360  contmcele[2] = fCentrality;
2361 
2362 
2363  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
2364  Float_t etamin, etamax;
2365  esdcuts->GetEtaRange(etamin,etamax);
2366 
2367  if(decaytype==0){
2368  fHistoXicMCGen->Fill(contmc);
2369  if(mcpart->GetPdgCode()>0) fHistoXicMCGen1->Fill(contmc);//4132 is particle
2370  if(mcpart->GetPdgCode()<0) fHistoXicMCGen2->Fill(contmc);//-4132 is anti-particle
2371  fHistoXicElectronMCGen->Fill(contmcele);
2372  if(mcepart->GetPdgCode()<0) fHistoXicElectronMCGen1->Fill(contmcele);//-11 is positron
2373  if(mcepart->GetPdgCode()>0) fHistoXicElectronMCGen2->Fill(contmcele);//11 is electron
2374  fHistoEleXiMassMCGen->Fill(cont);
2375  if(fabs(mcepart->Eta())<etamax){
2376  fHistoEleXiMassvsElePtMCGen->Fill(cont2);
2377  if(mcepart->GetPdgCode()<0) fHistoEleXiMassvsElePtMCGen1->Fill(cont2);//-11 is positron
2378  if(mcepart->GetPdgCode()>0) fHistoEleXiMassvsElePtMCGen2->Fill(cont2);//11 is electron
2379  if(InvMassEleXi<2.5){
2380  fHistoElePtMCGen->Fill(mcepart->Pt(),fCentrality);
2381  fHistoElePtvsEtaMCGen->Fill(cont_eleptvseta);
2382  fHistoElePtvsXiPtMCGen->Fill(cont_eleptvsxipt);
2383  }
2384  }
2385  if(fabs(mcpart->Y())<0.7){
2386  if(InvMassEleXi<2.5){
2387  fHistoElePtvsXiPtMCXicGen->Fill(cont_eleptvsxipt);
2388  fHistoElePtvsXiPtvsXicPtMCGen->Fill(cont_eleptvsxiptvsxicpt);
2389  }
2390  }
2391  }
2392 
2394  fMCVariablesTree->Fill();
2395 }
2398 {
2399  //
2400  // Define mc gen electron tree variables
2401  //
2402 
2403  const char* nameoutput = GetOutputSlot(9)->GetContainer()->GetName();
2404  fMCEleVariablesTree = new TTree(nameoutput,"MC Ele variables tree");
2405  Int_t nVar = 8;
2406  fCandidateMCEleVariables = new Float_t [nVar];
2407  TString * fCandidateVariableNames = new TString[nVar];
2408 
2409  fCandidateVariableNames[ 0]="Centrality";
2410  fCandidateVariableNames[ 1]="ElePx";
2411  fCandidateVariableNames[ 2]="ElePy";
2412  fCandidateVariableNames[ 3]="ElePz";
2413  fCandidateVariableNames[ 4]="ElePdgCode";
2414  fCandidateVariableNames[ 5]="EleMotherPdgCode";
2415  fCandidateVariableNames[ 6]="RunNumber";
2416  fCandidateVariableNames[ 7]="EvNumber";
2417 
2418  for (Int_t ivar=0; ivar<nVar; ivar++) {
2419  fMCEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2420  }
2421  return;
2422 }
2424 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
2425 {
2426  //
2427  // Fill tree depending on fWriteMCVariableTree
2428  //
2429  if(!mcepart) return;
2430 
2431 
2432  Bool_t hfe_flag = kFALSE;
2433  Int_t labemother = mcepart->GetMother();
2434  Int_t pdgmotherele = -9999;
2435  if(labemother>=0){
2436  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
2437  pdgmotherele = motherele->GetPdgCode();
2438  if(abs(pdgmotherele)>4000&&abs(pdgmotherele)<4400){
2439  hfe_flag = kTRUE;
2440  }
2441  }
2442  if(!hfe_flag) return;
2443 
2444  Double_t contmc[3];
2445  contmc[0] = mcepart->Pt();
2446  contmc[1] = mcepart->Eta();
2447  contmc[2] = fCentrality;
2448  fHistoElectronMCGen->Fill(contmc);
2449 
2450  for(Int_t i=0;i<8;i++){
2451  fCandidateMCEleVariables[i] = -9999.;
2452  }
2453 
2455  fCandidateMCEleVariables[ 1] = mcepart->Px();
2456  fCandidateMCEleVariables[ 2] = mcepart->Py();
2457  fCandidateMCEleVariables[ 3] = mcepart->Pz();
2458  fCandidateMCEleVariables[ 4] = mcepart->GetPdgCode();
2459  fCandidateMCEleVariables[ 5] = pdgmotherele;
2462 
2463  // This function makes output too heavy (do not use if you have output size limitation)
2464  //if(fWriteMCVariableTree && fWriteEachVariableTree && mcepart->Pt()>0.4 && fabs(mcepart->Eta())<1.0)
2465  //fMCEleVariablesTree->Fill();
2466 }
2469 {
2470  //
2471  // Define Mc cascade tree variables
2472  //
2473 
2474  const char* nameoutput = GetOutputSlot(10)->GetContainer()->GetName();
2475  fMCCascVariablesTree = new TTree(nameoutput,"MC cascade variables tree");
2476  Int_t nVar = 8;
2477  fCandidateMCCascVariables = new Float_t [nVar];
2478  TString * fCandidateVariableNames = new TString[nVar];
2479 
2480  fCandidateVariableNames[ 0]="Centrality";
2481  fCandidateVariableNames[ 1]="CascPx";
2482  fCandidateVariableNames[ 2]="CascPy";
2483  fCandidateVariableNames[ 3]="CascPz";
2484  fCandidateVariableNames[ 4]="CascPdgCode";
2485  fCandidateVariableNames[ 5]="CascMotherPdgCode";
2486  fCandidateVariableNames[ 6]="RunNumber";
2487  fCandidateVariableNames[ 7]="EvNumber";
2488 
2489  for (Int_t ivar=0; ivar<nVar; ivar++) {
2490  fMCCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2491  }
2492  return;
2493 }
2495 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCCascROOTObjects(AliAODMCParticle *mccascpart, TClonesArray *mcArray)
2496 {
2497  //
2498  // Fill histograms or tree depending on fWriteMCVariableTree
2499  //
2500  if(!mccascpart) return;
2501 
2502  for(Int_t i=0;i<8;i++){
2503  fCandidateMCCascVariables[i] = -9999.;
2504  }
2505 
2506  Bool_t hfxi_flag = kFALSE;
2507  Int_t labcascmother = mccascpart->GetMother();
2508  Int_t pdgmothercasc = -9999;
2509  if(labcascmother>=0){
2510  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
2511  if(mothercasc){
2512  pdgmothercasc = mothercasc->GetPdgCode();
2513  if(abs(pdgmothercasc)>4000&&abs(pdgmothercasc)<4400){
2514  hfxi_flag = kTRUE;
2515  }
2516  }
2517  }
2518  if(!hfxi_flag) return;
2519 
2520  Double_t contmc[3];
2521  contmc[0] = mccascpart->Pt();
2522  contmc[1] = mccascpart->Eta();
2523  contmc[2] = fCentrality;
2524  fHistoXiMCGen->Fill(contmc);
2525 
2527  fCandidateMCCascVariables[ 1] = mccascpart->Px();
2528  fCandidateMCCascVariables[ 2] = mccascpart->Py();
2529  fCandidateMCCascVariables[ 3] = mccascpart->Pz();
2530  fCandidateMCCascVariables[ 4] = mccascpart->GetPdgCode();
2531  fCandidateMCCascVariables[ 5] = pdgmothercasc;
2534 
2535  // This function makes output too heavy (do not use if you have output size limitation)
2536  //if(fWriteMCVariableTree && fWriteEachVariableTree && mccascpart->Pt()>0.4 && fabs(mccascpart->Eta())<1.0)
2537  //fMCCascVariablesTree->Fill();
2538 }
2539 
2542  //
2543  // This is to define general histograms
2544  //
2545 
2546  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
2547  fCEvents->SetStats(kTRUE);
2548  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
2549  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
2550  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
2551  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
2552  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
2553  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
2554  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
2555  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
2556  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
2557  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
2558  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
2559  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
2560  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
2561  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
2562  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2563  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
2564  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
2565  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2566  //fCEvents->GetXaxis()->SetTitle("");
2567  fCEvents->GetYaxis()->SetTitle("counts");
2568 
2569  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
2570  fHTrigger->SetStats(kTRUE);
2571  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
2572  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
2573  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
2574  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
2575  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
2576  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
2577  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
2578  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
2579  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
2580  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
2581  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
2582  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
2583 
2584  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
2585 
2586 
2587  fOutput->Add(fCEvents);
2588  fOutput->Add(fHTrigger);
2589  fOutput->Add(fHCentrality);
2590 
2591  return;
2592 }
2593 //__________________________________________________________________________
2595 {
2596  //
2597  // Define analyis histograms
2598  //
2599 
2600  //------------------------------------------------
2601  // Basic histogram
2602  //------------------------------------------------
2603  Int_t bins_base[4]= {10 ,100 , 20 ,10};
2604  Double_t xmin_base[4]={1.3,0 , -0.1 ,0.00};
2605  Double_t xmax_base[4]={3.3,20. , 0.1 ,100};
2606 
2607  fHistoEleXiMass = new THnSparseF("fHistoEleXiMass","",4,bins_base,xmin_base,xmax_base);
2609  fHistoEleXiMassRS = new THnSparseF("fHistoEleXiMassRS","",4,bins_base,xmin_base,xmax_base);
2611  fHistoEleXiMassWS = new THnSparseF("fHistoEleXiMassWS","",4,bins_base,xmin_base,xmax_base);
2613  fHistoEleXiMassRSMix = new THnSparseF("fHistoEleXiMassRSMix","",4,bins_base,xmin_base,xmax_base);
2615  fHistoEleXiMassWSMix = new THnSparseF("fHistoEleXiMassWSMix","",4,bins_base,xmin_base,xmax_base);
2617  fHistoEleXiMassRSSide = new THnSparseF("fHistoEleXiMassRSSide","",4,bins_base,xmin_base,xmax_base);
2619  fHistoEleXiMassWSSide = new THnSparseF("fHistoEleXiMassWSSide","",4,bins_base,xmin_base,xmax_base);
2621  fHistoEleXiMassRS1 = new THnSparseF("fHistoEleXiMassRS1","",4,bins_base,xmin_base,xmax_base);
2623  fHistoEleXiMassWS1 = new THnSparseF("fHistoEleXiMassWS1","",4,bins_base,xmin_base,xmax_base);
2625  fHistoEleXiMassRSMix1 = new THnSparseF("fHistoEleXiMassRSMix1","",4,bins_base,xmin_base,xmax_base);
2627  fHistoEleXiMassWSMix1 = new THnSparseF("fHistoEleXiMassWSMix1","",4,bins_base,xmin_base,xmax_base);
2629  fHistoEleXiMassRSSide1 = new THnSparseF("fHistoEleXiMassRSSide1","",4,bins_base,xmin_base,xmax_base);
2631  fHistoEleXiMassWSSide1 = new THnSparseF("fHistoEleXiMassWSSide1","",4,bins_base,xmin_base,xmax_base);
2633  fHistoEleXiMassRS2 = new THnSparseF("fHistoEleXiMassRS2","",4,bins_base,xmin_base,xmax_base);
2635  fHistoEleXiMassWS2 = new THnSparseF("fHistoEleXiMassWS2","",4,bins_base,xmin_base,xmax_base);
2637  fHistoEleXiMassRSMix2 = new THnSparseF("fHistoEleXiMassRSMix2","",4,bins_base,xmin_base,xmax_base);
2639  fHistoEleXiMassWSMix2 = new THnSparseF("fHistoEleXiMassWSMix2","",4,bins_base,xmin_base,xmax_base);
2641  fHistoEleXiMassRSSide2 = new THnSparseF("fHistoEleXiMassRSSide2","",4,bins_base,xmin_base,xmax_base);
2643  fHistoEleXiMassWSSide2 = new THnSparseF("fHistoEleXiMassWSSide2","",4,bins_base,xmin_base,xmax_base);
2645 
2646  fHistoEleXiMassRSAway = new THnSparseF("fHistoEleXiMassRSAway","",4,bins_base,xmin_base,xmax_base);
2648  fHistoEleXiMassWSAway = new THnSparseF("fHistoEleXiMassWSAway","",4,bins_base,xmin_base,xmax_base);
2650  fHistoEleXiMassRSMixAway = new THnSparseF("fHistoEleXiMassRSMixAway","",4,bins_base,xmin_base,xmax_base);
2652  fHistoEleXiMassWSMixAway = new THnSparseF("fHistoEleXiMassWSMixAway","",4,bins_base,xmin_base,xmax_base);
2654  fHistoEleXiMassRSSideAway = new THnSparseF("fHistoEleXiMassRSSideAway","",4,bins_base,xmin_base,xmax_base);
2656  fHistoEleXiMassWSSideAway = new THnSparseF("fHistoEleXiMassWSSideAway","",4,bins_base,xmin_base,xmax_base);
2658  fHistoEleXiMassRS1Away = new THnSparseF("fHistoEleXiMassRS1Away","",4,bins_base,xmin_base,xmax_base);
2660  fHistoEleXiMassWS1Away = new THnSparseF("fHistoEleXiMassWS1Away","",4,bins_base,xmin_base,xmax_base);
2662  fHistoEleXiMassRSMix1Away = new THnSparseF("fHistoEleXiMassRSMix1Away","",4,bins_base,xmin_base,xmax_base);
2664  fHistoEleXiMassWSMix1Away = new THnSparseF("fHistoEleXiMassWSMix1Away","",4,bins_base,xmin_base,xmax_base);
2666  fHistoEleXiMassRSSide1Away = new THnSparseF("fHistoEleXiMassRSSide1Away","",4,bins_base,xmin_base,xmax_base);
2668  fHistoEleXiMassWSSide1Away = new THnSparseF("fHistoEleXiMassWSSide1Away","",4,bins_base,xmin_base,xmax_base);
2670  fHistoEleXiMassRS2Away = new THnSparseF("fHistoEleXiMassRS2Away","",4,bins_base,xmin_base,xmax_base);
2672  fHistoEleXiMassWS2Away = new THnSparseF("fHistoEleXiMassWS2Away","",4,bins_base,xmin_base,xmax_base);
2674  fHistoEleXiMassRSMix2Away = new THnSparseF("fHistoEleXiMassRSMix2Away","",4,bins_base,xmin_base,xmax_base);
2676  fHistoEleXiMassWSMix2Away = new THnSparseF("fHistoEleXiMassWSMix2Away","",4,bins_base,xmin_base,xmax_base);
2678  fHistoEleXiMassRSSide2Away = new THnSparseF("fHistoEleXiMassRSSide2Away","",4,bins_base,xmin_base,xmax_base);
2680  fHistoEleXiMassWSSide2Away = new THnSparseF("fHistoEleXiMassWSSide2Away","",4,bins_base,xmin_base,xmax_base);
2682 
2683  Int_t bins_base_elept[3]= {10 ,100 ,10};
2684  Double_t xmin_base_elept[3]={1.3,0 ,0.00};
2685  Double_t xmax_base_elept[3]={3.3,10. ,100};
2686 
2687  fHistoEleXiMassvsElePtRS = new THnSparseF("fHistoEleXiMassvsElePtRS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2689  fHistoEleXiMassvsElePtWS = new THnSparseF("fHistoEleXiMassvsElePtWS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2691  fHistoEleXiMassvsElePtRSMix = new THnSparseF("fHistoEleXiMassvsElePtRSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2693  fHistoEleXiMassvsElePtWSMix = new THnSparseF("fHistoEleXiMassvsElePtWSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2695  fHistoEleXiMassvsElePtRSSide = new THnSparseF("fHistoEleXiMassvsElePtRSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2697  fHistoEleXiMassvsElePtWSSide = new THnSparseF("fHistoEleXiMassvsElePtWSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2699  fHistoEleXiMassvsElePtRS1 = new THnSparseF("fHistoEleXiMassvsElePtRS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2701  fHistoEleXiMassvsElePtWS1 = new THnSparseF("fHistoEleXiMassvsElePtWS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2703  fHistoEleXiMassvsElePtRSMix1 = new THnSparseF("fHistoEleXiMassvsElePtRSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2705  fHistoEleXiMassvsElePtWSMix1 = new THnSparseF("fHistoEleXiMassvsElePtWSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2707  fHistoEleXiMassvsElePtRSSide1 = new THnSparseF("fHistoEleXiMassvsElePtRSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2709  fHistoEleXiMassvsElePtWSSide1 = new THnSparseF("fHistoEleXiMassvsElePtWSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2711  fHistoEleXiMassvsElePtRS2 = new THnSparseF("fHistoEleXiMassvsElePtRS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2713  fHistoEleXiMassvsElePtWS2 = new THnSparseF("fHistoEleXiMassvsElePtWS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2715  fHistoEleXiMassvsElePtRSMix2 = new THnSparseF("fHistoEleXiMassvsElePtRSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2717  fHistoEleXiMassvsElePtWSMix2 = new THnSparseF("fHistoEleXiMassvsElePtWSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2719  fHistoEleXiMassvsElePtRSSide2 = new THnSparseF("fHistoEleXiMassvsElePtRSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2721  fHistoEleXiMassvsElePtWSSide2 = new THnSparseF("fHistoEleXiMassvsElePtWSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2723 
2724  fHistoElePtRS=new TH2F("fHistoElePtRS","Right-sign e pt",100,0.,10.,10,0.,100.);
2725  fOutputAll->Add(fHistoElePtRS);
2726  fHistoElePtWS=new TH2F("fHistoElePtWS","Wrong-sign e pt",100,0.,10.,10,0.,100.);
2727  fOutputAll->Add(fHistoElePtWS);
2728  fHistoElePtRSMix=new TH2F("fHistoElePtRSMix","Right-sign e pt",100,0.,10.,10,0.,100.);
2730  fHistoElePtWSMix=new TH2F("fHistoElePtWSMix","Wrong-sign e pt",100,0.,10.,10,0.,100.);
2732 
2733  fHistoEleXiMassMCS = new THnSparseF("fHistoEleXiMassMCS","",4,bins_base,xmin_base,xmax_base);
2735  fHistoEleXiMassMCS1 = new THnSparseF("fHistoEleXiMassMCS1","",4,bins_base,xmin_base,xmax_base);
2737  fHistoEleXiMassMCS2 = new THnSparseF("fHistoEleXiMassMCS2","",4,bins_base,xmin_base,xmax_base);
2739  fHistoEleXiMassPromptMCS = new THnSparseF("fHistoEleXiMassPromptMCS","",4,bins_base,xmin_base,xmax_base);
2741  fHistoEleXiMassPromptMCS1 = new THnSparseF("fHistoEleXiMassPromptMCS1","",4,bins_base,xmin_base,xmax_base);
2743  fHistoEleXiMassPromptMCS2 = new THnSparseF("fHistoEleXiMassPromptMCS2","",4,bins_base,xmin_base,xmax_base);
2745  fHistoEleXiMassBFeeddownMCS = new THnSparseF("fHistoEleXiMassBFeeddownMCS","",4,bins_base,xmin_base,xmax_base);
2747  fHistoEleXiMassBFeeddownMCS1 = new THnSparseF("fHistoEleXiMassBFeeddownMCS1","",4,bins_base,xmin_base,xmax_base);
2749  fHistoEleXiMassBFeeddownMCS2 = new THnSparseF("fHistoEleXiMassBFeeddownMCS2","",4,bins_base,xmin_base,xmax_base);
2751  fHistoEleXiMassMCGen = new THnSparseF("fHistoEleXiMassMCGen","",4,bins_base,xmin_base,xmax_base);
2753  fHistoEleXiMassvsElePtMCS = new THnSparseF("fHistoEleXiMassvsElePtMCS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2755  fHistoEleXiMassvsElePtMCGen = new THnSparseF("fHistoEleXiMassvsElePtMCGen","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2757  fHistoEleXiMassvsElePtMCS1 = new THnSparseF("fHistoEleXiMassvsElePtMCS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2759  fHistoEleXiMassvsElePtMCGen1 = new THnSparseF("fHistoEleXiMassvsElePtMCGen1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2761  fHistoEleXiMassvsElePtMCS2 = new THnSparseF("fHistoEleXiMassvsElePtMCS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2763  fHistoEleXiMassvsElePtMCGen2 = new THnSparseF("fHistoEleXiMassvsElePtMCGen2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2765  fHistoElePtMCS=new TH2F("fHistoElePtMCS","MC S e pt",100,0.,10.,10,0.,100.);
2766  fOutputAll->Add(fHistoElePtMCS);
2767  fHistoElePtMCGen=new TH2F("fHistoElePtMCGen","MC Gen e pt",100,0.,10.,10,0.,100.);
2769 
2770  Int_t bins_eleptvseta[3]= {50,20 ,10};
2771  Double_t xmin_eleptvseta[3]={0.,-1. ,0.0};
2772  Double_t xmax_eleptvseta[3]={5.,1. ,100};
2773 
2774  fHistoElePtvsEtaRS = new THnSparseF("fHistoElePtvsEtaRS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2776  fHistoElePtvsEtaWS = new THnSparseF("fHistoElePtvsEtaWS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2778  fHistoElePtvsEtaRSMix = new THnSparseF("fHistoElePtvsEtaRSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2780  fHistoElePtvsEtaWSMix = new THnSparseF("fHistoElePtvsEtaWSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2782  fHistoElePtvsEtaMCS = new THnSparseF("fHistoElePtvsEtaMCS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2784  fHistoElePtvsEtaMCGen = new THnSparseF("fHistoElePtvsEtaMCGen","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2786 
2787  Int_t bins_eleptvsxipt[3]= {50,20 ,10};
2788  Double_t xmin_eleptvsxipt[3]={0.,0. ,0.0};
2789  Double_t xmax_eleptvsxipt[3]={5.,5. ,100};
2790 
2791  fHistoElePtvsXiPtRS = new THnSparseF("fHistoElePtvsXiPtRS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2793  fHistoElePtvsXiPtWS = new THnSparseF("fHistoElePtvsXiPtWS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2795  fHistoElePtvsXiPtRSMix = new THnSparseF("fHistoElePtvsXiPtRSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2797  fHistoElePtvsXiPtWSMix = new THnSparseF("fHistoElePtvsXiPtWSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2799  fHistoElePtvsXiPtMCS = new THnSparseF("fHistoElePtvsXiPtMCS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2801  fHistoElePtvsXiPtMCGen = new THnSparseF("fHistoElePtvsXiPtMCGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2803  fHistoElePtvsXiPtMCXicGen = new THnSparseF("fHistoElePtvsXiPtMCXicGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2805 
2806  Int_t bins_eleptvsxiptvsxicpt[4]= {50,20,10,10};
2807  Double_t xmin_eleptvsxiptvsxicpt[4]={0.,0.,0.,0.0};
2808  Double_t xmax_eleptvsxiptvsxicpt[4]={5.,5.,10.,100};
2809  fHistoElePtvsXiPtvsXicPtMCS = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCS","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
2811  fHistoElePtvsXiPtvsXicPtMCGen = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCGen","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
2813 
2814  Int_t bins_eleptvsd0[3]= {50 ,50 ,10};
2815  Double_t xmin_eleptvsd0[3]={0.,-0.2 ,0.0};
2816  Double_t xmax_eleptvsd0[3]={5.,0.2 ,100};
2817 
2818  fHistoElePtvsd0RS = new THnSparseF("fHistoElePtvsd0RS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2820  fHistoElePtvsd0WS = new THnSparseF("fHistoElePtvsd0WS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2822  fHistoElePtvsd0RSMix = new THnSparseF("fHistoElePtvsd0RSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2824  fHistoElePtvsd0WSMix = new THnSparseF("fHistoElePtvsd0WSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2826  fHistoElePtvsd0MCS = new THnSparseF("fHistoElePtvsd0MCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2828  fHistoElePtvsd0PromptMCS = new THnSparseF("fHistoElePtvsd0PromptMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2830  fHistoElePtvsd0BFeeddownMCS = new THnSparseF("fHistoElePtvsd0BFeeddownMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2832 
2833  //------------------------------------------------
2834  // checking histograms
2835  //------------------------------------------------
2836  fHistoBachPt = new TH1F("fHistoBachPt","Bachelor p_{T}",100,0.0,5.0);
2837  fOutputAll->Add(fHistoBachPt);
2838  fHistoBachPtMCS = new TH1F("fHistoBachPtMCS","Bachelor p_{T}",100,0.0,5.0);
2840  fHistoBachPtMCGen = new TH1F("fHistoBachPtMCGen","Bachelor p_{T}",100,0.0,5.0);
2842  fHistod0Bach = new TH1F("fHistod0Bach","Bachelor d_{0}",100,-0.5,0.5);
2843  fOutputAll->Add(fHistod0Bach);
2844  fHistoXiMassvsPt=new TH2F("fHistoXiMassvsPt","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2846  fHistoXiMassvsPtMCS=new TH2F("fHistoXiMassvsPtMCS","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2848  fHistoXiMassvsPtMCGen=new TH2F("fHistoXiMassvsPtMCGen","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2850  fHistoOmegaMassvsPt=new TH2F("fHistoOmegaMassvsPt","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
2852 
2853  fHistoElectronTPCPID=new TH2F("fHistoElectronTPCPID","",50,0.,5.,50,-20.,20.);
2855  fHistoElectronTOFPID=new TH2F("fHistoElectronTOFPID","",50,0.,5.,50,-20.,20.);
2857  fHistoElectronTPCSelPID=new TH2F("fHistoElectronTPCSelPID","",50,0.,5.,50,-20.,20.);
2859  fHistoElectronTOFSelPID=new TH2F("fHistoElectronTOFSelPID","",50,0.,5.,50,-20.,20.);
2861  fHistoElectronTPCPIDSelTOF=new TH2F("fHistoElectronTPCPIDSelTOF","",10,0.,5.,500,-10.,10.);
2863  fHistoElectronTOFPIDSelTPC=new TH2F("fHistoElectronTOFPIDSelTPC","",10,0.,5.,500,-10.,10.);
2865  fHistoElectronTPCPIDSelTOFSmallEta=new TH2F("fHistoElectronTPCPIDSelTOFSmallEta","",10,0.,5.,500,-10.,10.);
2867  fHistoElectronTPCPIDSelTOFLargeEta=new TH2F("fHistoElectronTPCPIDSelTOFLargeEta","",10,0.,5.,500,-10.,10.);
2869 
2870  for(Int_t i=0;i<8;i++){
2871  fHistoElectronTPCPIDSelTOFEtaDep[i]=new TH2F(Form("fHistoElectronTPCPIDSelTOFEtaDep[%d]",i),"",10,0.,5.,500,-10.,10.);
2873  }
2874 
2875  fHistoElectronQovPtvsPhi=new TH2F("fHistoElectronQovPtvsPhi","",70,0.,7.,50,-2.,2.);
2877  fHistoXiQovPtvsPhi=new TH2F("fHistoXiQovPtvsPhi","",70,0.,7.,50,-2.,2.);
2879 
2880  Int_t bins_xicmcgen[3]= {100 ,20 ,10};
2881  Double_t xmin_xicmcgen[3]={0.,-1.0 ,0.0};
2882  Double_t xmax_xicmcgen[3]={20.,1.0 ,100};
2883  fHistoXicMCGen = new THnSparseF("fHistoXicMCGen","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2884  fOutputAll->Add(fHistoXicMCGen);
2885  fHistoXicMCGen1 = new THnSparseF("fHistoXicMCGen1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2887  fHistoXicMCGen2 = new THnSparseF("fHistoXicMCGen2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2889  fHistoXicMCS = new THnSparseF("fHistoXicMCS","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2890  fOutputAll->Add(fHistoXicMCS);
2891  fHistoXicMCS1 = new THnSparseF("fHistoXicMCS1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2892  fOutputAll->Add(fHistoXicMCS1);
2893  fHistoXicMCS2 = new THnSparseF("fHistoXicMCS2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2894  fOutputAll->Add(fHistoXicMCS2);
2895 
2896  Int_t bins_elemcgen[3]= {100 ,20 ,10};
2897  Double_t xmin_elemcgen[3]={0.,-1.0 ,0.0};
2898  Double_t xmax_elemcgen[3]={10.,1.0 ,100};
2899  fHistoElectronMCGen = new THnSparseF("fHistoElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2901  fHistoXicElectronMCGen = new THnSparseF("fHistoXicElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2903  fHistoXicElectronMCGen1 = new THnSparseF("fHistoXicElectronMCGen1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2905  fHistoXicElectronMCGen2 = new THnSparseF("fHistoXicElectronMCGen2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2907  fHistoXicElectronMCS = new THnSparseF("fHistoXicElectronMCS","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2909  fHistoXicElectronMCS1 = new THnSparseF("fHistoXicElectronMCS1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2911  fHistoXicElectronMCS2 = new THnSparseF("fHistoXicElectronMCS2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2913 
2914  Int_t bins_ximcgen[3]= {50 ,20 ,10};
2915  Double_t xmin_ximcgen[3]={0.,-1.0 ,0.0};
2916  Double_t xmax_ximcgen[3]={10.,1.0 ,100};
2917  fHistoXiMCGen = new THnSparseF("fHistoXiMCGen","",3,bins_ximcgen,xmin_ximcgen,xmax_ximcgen);
2918  fOutputAll->Add(fHistoXiMCGen);
2919 
2920  fHistoLambdaPtvsDl=new TH2F("fHistoLambdaPtvsDl","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2922  fHistoLambdaPtvsDlSide=new TH2F("fHistoLambdaPtvsDlSide","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2924  fHistoLambdaPtvsDlMCS=new TH2F("fHistoLambdaPtvsDlMCS","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2926 
2927  fHistoResponseElePt = new TH2D("fHistoResponseElePt","",100,0.,10.,100,0.,10.);
2929  fHistoResponseEleXiPt = new TH2D("fHistoResponseEleXiPt","",100,0.,20.,100,0.,20.);
2931 
2932 
2933  fHistonEvtvsRunNumber=new TH1F("fHistonEvtvsRunNumber","",20000,-0.5,19999.5);
2935  fHistonElevsRunNumber=new TH1F("fHistonElevsRunNumber","",20000,-0.5,19999.5);
2937  fHistonXivsRunNumber=new TH1F("fHistonXivsRunNumber","",20000,-0.5,19999.5);
2939  fHistoMCEventType=new TH1F("fHistoMCEventType","",4,-0.5,3.5);
2941  fHistoMCXic0Decays=new TH1F("fHistoMCXic0Decays","",4,0.5,4.5);
2943  fHistoMCDeltaPhiccbar=new TH1F("fHistoMCDeltaPhiccbar","",100,0.,3.2);
2945  fHistoMCNccbar=new TH1F("fHistoMCNccbar","",100,-0.5,99.5);
2946  fOutputAll->Add(fHistoMCNccbar);
2947 
2948  for(Int_t ih=0;ih<23;ih++){
2949  Int_t bins_eleptvscutvars[3];
2950  Double_t xmin_eleptvscutvars[3];
2951  Double_t xmax_eleptvscutvars[3];
2952 
2953  bins_eleptvscutvars[0] = 20;//electron pT bin
2954  xmin_eleptvscutvars[0] = 0.;
2955  xmax_eleptvscutvars[0] = 20.;
2956  bins_eleptvscutvars[2] = 10;//centrality bin
2957  xmin_eleptvscutvars[2] = 0.;
2958  xmax_eleptvscutvars[2] = 100.;
2959 
2960  if(ih==0 || ih==1){
2961  //0: TPC Ncluster 1: TPC ncluster PID
2962  bins_eleptvscutvars[1] = 40;
2963  xmin_eleptvscutvars[1] = 0.;
2964  xmax_eleptvscutvars[1] = 160.;
2965  }else if(ih==2 || ih==3){
2966  //2: nSigma(TPC,e) 3: nSigma(TOF,e)
2967  bins_eleptvscutvars[1] = 20;
2968  xmin_eleptvscutvars[1] = -5.;
2969  xmax_eleptvscutvars[1] = 5.;
2970  }else if(ih==4){
2971  //4: eta
2972  bins_eleptvscutvars[1] = 30;
2973  xmin_eleptvscutvars[1] = -1.5;
2974  xmax_eleptvscutvars[1] = 1.5;
2975  }else if(ih==5){
2976  //5: nITS cluster
2977  bins_eleptvscutvars[1] = 7;
2978  xmin_eleptvscutvars[1] = -0.5;
2979  xmax_eleptvscutvars[1] = 6.5;
2980  }else if(ih==6){
2981  //6: Lambda mass
2982  bins_eleptvscutvars[1] = 50;
2983  xmin_eleptvscutvars[1] = 1.1156-0.03;
2984  xmax_eleptvscutvars[1] = 1.1156+0.03;
2985  }else if(ih==7){
2986  //7: Xi mass
2987  bins_eleptvscutvars[1] = 50;
2988  xmin_eleptvscutvars[1] = 1.32-0.03;
2989  xmax_eleptvscutvars[1] = 1.32+0.03;
2990  }else if(ih==8 || ih==9){
2991  //8: Rfid Lambda, 9: Rfid Xi
2992  bins_eleptvscutvars[1] = 20;
2993  xmin_eleptvscutvars[1] = 0.;
2994  xmax_eleptvscutvars[1] = 5.;
2995  }else if(ih==10 || ih==11){
2996  //11: DCA Xi, 10: Dca V0
2997  bins_eleptvscutvars[1] = 20;
2998  xmin_eleptvscutvars[1] = 0.;
2999  xmax_eleptvscutvars[1] = 2.;
3000  }else if(ih==12 || ih==13 || ih==14){
3001  //12: DCA Bachto prim, 13: DCA V0pr to prim 14: DCA V0pi to prim
3002  bins_eleptvscutvars[1] = 20;
3003  xmin_eleptvscutvars[1] = 0.;
3004  xmax_eleptvscutvars[1] = 0.5;
3005  }else if(ih==15 || ih==16){
3006  //16: CosPAXi, 15: CosPAv0
3007  bins_eleptvscutvars[1] = 20;
3008  xmin_eleptvscutvars[1] = 0.95;
3009  xmax_eleptvscutvars[1] = 1.0;
3010  }else if(ih==17 || ih==18 || ih==19){
3011  //17: nSigma(TPC, bach) 18: nSigma(TPC, v0pr), 19: nSigma(TPC,v0pi)
3012  bins_eleptvscutvars[1] = 20;
3013  xmin_eleptvscutvars[1] = -5.;
3014  xmax_eleptvscutvars[1] = 5.;
3015  }else if(ih==20 || ih==21){
3016  //20: V0 eta 21: Xi eta
3017  bins_eleptvscutvars[1] = 30;
3018  xmin_eleptvscutvars[1] = -1.5;
3019  xmax_eleptvscutvars[1] = 1.5;
3020  }else if(ih==22){
3021  //20: Opening angle
3022  bins_eleptvscutvars[1] = 20;
3023  xmin_eleptvscutvars[1] = 0.;
3024  xmax_eleptvscutvars[1] = 3.141592/2;
3025  }
3026 
3027  fHistoElePtvsCutVarsRS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsRS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3029  fHistoElePtvsCutVarsWS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsWS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3031  fHistoElePtvsCutVarsMCS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsMCS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
3033  }
3034 
3035  return;
3036 }
3037 
3038 //________________________________________________________________________
3039 AliAODRecoCascadeHF* AliAnalysisTaskSEXic2eleXifromAODtracks::MakeCascadeHF(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod, AliAODVertex *secVert)
3040 {
3041  //
3042  // Create AliAODRecoCascadeHF object from the argument
3043  //
3044 
3045  if(!casc) return 0x0;
3046  if(!part) return 0x0;
3047  if(!aod) return 0x0;
3048 
3049  //------------------------------------------------
3050  // PrimaryVertex
3051  //------------------------------------------------
3052  AliAODVertex *primVertexAOD;
3053  Bool_t unsetvtx = kFALSE;
3055  primVertexAOD = CallPrimaryVertex(casc,part,aod);
3056  if(!primVertexAOD){
3057  primVertexAOD = fVtx1;
3058  }else{
3059  unsetvtx = kTRUE;
3060  }
3061  }else{
3062  primVertexAOD = fVtx1;
3063  }
3064  if(!primVertexAOD) return 0x0;
3065  Double_t posprim[3]; primVertexAOD->GetXYZ(posprim);
3066 
3067  //------------------------------------------------
3068  // DCA between tracks
3069  //------------------------------------------------
3070  AliESDtrack *esdtrack = new AliESDtrack((AliVTrack*)part);
3071 
3072  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
3073  xyz[0]=casc->DecayVertexXiX();
3074  xyz[1]=casc->DecayVertexXiY();
3075  xyz[2]=casc->DecayVertexXiZ();
3076  pxpypz[0]=casc->MomXiX();
3077  pxpypz[1]=casc->MomXiY();
3078  pxpypz[2]=casc->MomXiZ();
3079  casc->GetCovarianceXYZPxPyPz(cv);
3080  sign=casc->ChargeXi();
3081  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
3082 
3083  Double_t xdummy, ydummy;
3084  Double_t dca = esdtrack->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
3085 
3086 
3087  //------------------------------------------------
3088  // Propagate all tracks to the secondary vertex and calculate momentum there
3089  //------------------------------------------------
3090 
3091  Double_t d0z0bach[2],covd0z0bach[3];
3092  if(sqrt(pow(secVert->GetX(),2)+pow(secVert->GetY(),2))<1.){
3093  part->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3094  trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
3095  }else{
3096  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3097  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
3098  }
3099  Double_t momcasc_new[3]={-9999,-9999,-9999.};
3100  trackCasc->GetPxPyPz(momcasc_new);
3101 
3102  Double_t px[2],py[2],pz[2];
3103  px[0] = part->Px(); py[0] = part->Py(); pz[0] = part->Pz();
3104  px[1] = momcasc_new[0]; py[1] = momcasc_new[1]; pz[1] = momcasc_new[2];
3105 
3106  //------------------------------------------------
3107  // d0
3108  //------------------------------------------------
3109  Double_t d0[3],d0err[3];
3110 
3111  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
3112  d0[0]= d0z0bach[0];
3113  d0err[0] = TMath::Sqrt(covd0z0bach[0]);
3114 
3115  Double_t d0z0casc[2],covd0z0casc[3];
3116  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0casc,covd0z0casc);
3117  d0[1]= d0z0casc[0];
3118  d0err[1] = TMath::Sqrt(covd0z0casc[0]);
3119 
3120  //------------------------------------------------
3121  // Create AliAODRecoCascadeHF
3122  //------------------------------------------------
3123  Short_t charge = part->Charge();
3124  AliAODRecoCascadeHF *theCascade = new AliAODRecoCascadeHF(secVert,charge,px,py,pz,d0,d0err,dca);
3125  if(!theCascade)
3126  {
3127  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
3128  if(esdtrack) delete esdtrack;
3129  if(trackCasc) delete trackCasc;
3130  return 0x0;
3131  }
3132  theCascade->SetOwnPrimaryVtx(primVertexAOD);
3133  UShort_t id[2]={(UShort_t)part->GetID(),(UShort_t)trackCasc->GetID()};
3134  theCascade->SetProngIDs(2,id);
3135 
3136  theCascade->GetSecondaryVtx()->AddDaughter(part);
3137  theCascade->GetSecondaryVtx()->AddDaughter(casc);
3138  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
3139  if(esdtrack) delete esdtrack;
3140  if(trackCasc) delete trackCasc;
3141 
3142  return theCascade;
3143 }
3144 
3145 //________________________________________________________________________
3146 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent* aod)
3147 {
3148  //
3149  // Make an array of tracks which should not be used in primary vertex calculation and
3150  // Call PrimaryVertex function
3151  //
3152 
3153  TObjArray *TrackArray = new TObjArray(3);
3154 
3155  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk);
3156  TrackArray->AddAt(cptrk1,0);
3157 
3158  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
3159  TrackArray->AddAt(cascptrack,1);
3160  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
3161  TrackArray->AddAt(cascntrack,2);
3162  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
3163  TrackArray->AddAt(cascbtrack,3);
3164 
3165  AliAODVertex *newvert = PrimaryVertex(TrackArray,aod);
3166 
3167  for(Int_t i=0;i<4;i++)
3168  {
3169  AliESDtrack *tesd = (AliESDtrack*)TrackArray->UncheckedAt(i);
3170  delete tesd;
3171  }
3172  TrackArray->Clear();
3173  delete TrackArray;
3174 
3175  return newvert;
3176 }
3177 
3178 //________________________________________________________________________
3179 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::PrimaryVertex(const TObjArray *trkArray,
3180  AliVEvent *event)
3181 {
3182  //
3183  //Used only for pp
3184  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
3185  //
3186 
3187  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
3188  Bool_t fRmTrksFromPrimVtx = kFALSE;
3189 
3190  AliESDVertex *vertexESD = 0;
3191  AliAODVertex *vertexAOD = 0;
3192 
3193  //vertexESD = new AliESDVertex(*fV1);
3194 
3195 
3196  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
3197  // primary vertex from the input event
3198 
3199  vertexESD = new AliESDVertex(*fV1);
3200 
3201  } else {
3202  // primary vertex specific to this candidate
3203 
3204  Int_t nTrks = trkArray->GetEntriesFast();
3205  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
3206 
3207  if(fRecoPrimVtxSkippingTrks) {
3208  // recalculating the vertex
3209 
3210  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
3211  Float_t diamondcovxy[3];
3212  event->GetDiamondCovXY(diamondcovxy);
3213  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
3214  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
3215  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
3216  vertexer->SetVtxStart(diamond);
3217  delete diamond; diamond=NULL;
3218  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter"))
3219  vertexer->SetOnlyFitter();
3220  }
3221  Int_t skipped[1000];
3222  Int_t nTrksToSkip=0,id;
3223  AliExternalTrackParam *t = 0;
3224  for(Int_t i=0; i<nTrks; i++) {
3225  t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
3226  id = (Int_t)t->GetID();
3227  if(id<0) continue;
3228  skipped[nTrksToSkip++] = id;
3229  }
3230  // TEMPORARY FIX
3231  // For AOD, skip also tracks without covariance matrix
3232  Double_t covtest[21];
3233  for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
3234  AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
3235  if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
3236  id = (Int_t)vtrack->GetID();
3237  if(id<0) continue;
3238  skipped[nTrksToSkip++] = id;
3239  }
3240  }
3241  for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
3242  //
3243  vertexer->SetSkipTracks(nTrksToSkip,skipped);
3244  vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
3245 
3246  } else if(fRmTrksFromPrimVtx && nTrks>0) {
3247  // removing the prongs tracks
3248 
3249  TObjArray rmArray(nTrks);
3250  UShort_t *rmId = new UShort_t[nTrks];
3251  AliESDtrack *esdTrack = 0;
3252  AliESDtrack *t = 0;
3253  for(Int_t i=0; i<nTrks; i++) {
3254  t = (AliESDtrack*)trkArray->UncheckedAt(i);
3255  esdTrack = new AliESDtrack(*t);
3256  rmArray.AddLast(esdTrack);
3257  if(esdTrack->GetID()>=0) {
3258  rmId[i]=(UShort_t)esdTrack->GetID();
3259  } else {
3260  rmId[i]=9999;
3261  }
3262  }
3263  Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
3264  vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
3265  delete [] rmId; rmId=NULL;
3266  rmArray.Delete();
3267 
3268  }
3269 
3270  delete vertexer; vertexer=NULL;
3271  if(!vertexESD) return vertexAOD;
3272  if(vertexESD->GetNContributors()<=0) {
3273  //AliDebug(2,"vertexing failed");
3274  delete vertexESD; vertexESD=NULL;
3275  return vertexAOD;
3276  }
3277 
3278 
3279  }
3280 
3281  // convert to AliAODVertex
3282  Double_t pos[3],cov[6],chi2perNDF;
3283  vertexESD->GetXYZ(pos); // position
3284  vertexESD->GetCovMatrix(cov); //covariance matrix
3285  chi2perNDF = vertexESD->GetChi2toNDF();
3286  delete vertexESD; vertexESD=NULL;
3287 
3288  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
3289 
3290  return vertexAOD;
3291 }
3292 
3293 //________________________________________________________________________
3294 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod)
3295 {
3296  //
3297  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
3298  //
3299 
3300  AliAODVertex *primVertexAOD;
3301  Bool_t unsetvtx = kFALSE;
3303  primVertexAOD = CallPrimaryVertex(casc,part,aod);
3304  if(!primVertexAOD){
3305  primVertexAOD = fVtx1;
3306  }else{
3307  unsetvtx = kTRUE;
3308  }
3309  }else{
3310  primVertexAOD = fVtx1;
3311  }
3312  if(!primVertexAOD) return 0x0;
3313 
3314  AliESDVertex * vertexESD = new AliESDVertex(*fV1);
3315 
3316  Double_t pos[3],cov[6],chi2perNDF;
3317  vertexESD->GetXYZ(pos); // position
3318  vertexESD->GetCovMatrix(cov); //covariance matrix
3319  chi2perNDF = vertexESD->GetChi2toNDF();
3320  delete vertexESD; vertexESD=NULL;
3321 
3322  AliAODVertex *secVert = new AliAODVertex(pos,cov,chi2perNDF);
3323 
3324  return secVert;
3325 }
3326 //________________________________________________________________________
3327 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)
3328 {
3329  //
3330  // Match to MC
3331  //
3332  for(Int_t i=0;i<100;i++){
3333  pdgarray_ele[i] = -9999;
3334  labelarray_ele[i] = -9999;
3335  pdgarray_casc[i] = -9999;
3336  labelarray_casc[i] = -9999;
3337  }
3338  ngen_ele = 0;
3339  ngen_casc = 0;
3340 
3341  AliVTrack *trk = dynamic_cast<AliVTrack*>(exobj->GetBachelor());
3342  if(!trk) return -1;
3343  Int_t labEle = trk->GetLabel();
3344  if(labEle<0) return -1;
3345  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
3346  if(!mcetrk) return -1;
3347  labelarray_ele[0] = labEle;
3348  pdgarray_ele[0] = mcetrk->GetPdgCode();
3349  ngen_ele ++;
3350 
3351  AliAODMCParticle *mcprimele=0;
3352  mcprimele = mcetrk;
3353  while(mcprimele->GetMother()>=0) {
3354  Int_t labprim_ele=mcprimele->GetMother();
3355  AliAODMCParticle *tmcprimele = (AliAODMCParticle*)mcArray->At(labprim_ele);
3356  if(!tmcprimele) {
3357  break;
3358  }
3359 
3360  mcprimele = tmcprimele;
3361  pdgarray_ele[ngen_ele] = mcprimele->GetPdgCode();
3362  labelarray_ele[ngen_ele] = labprim_ele;
3363  ngen_ele ++;
3364  if(ngen_ele==100) break;
3365  }
3366 
3367  AliAODcascade *theCascade = dynamic_cast<AliAODcascade*>(exobj->GetCascade());
3368  if(!theCascade) return -1;
3369 
3370  Int_t pdgDgcasc[2]={211,3122};
3371  Int_t pdgDgv0[2]={2212,211};
3372  Int_t labcasc = MatchToMCCascade(theCascade,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
3373  if(labcasc<0) return -1;
3374 
3375  AliAODMCParticle *mccasc = (AliAODMCParticle*)mcArray->At(labcasc);
3376  if(!mccasc) return -1;
3377  labelarray_casc[0] = labcasc;
3378  pdgarray_casc[0] = mccasc->GetPdgCode();
3379  ngen_casc ++;
3380 
3381  AliAODMCParticle *mcprimcasc=0;
3382  mcprimcasc = mccasc;
3383  while(mcprimcasc->GetMother()>=0) {
3384  Int_t labprim_casc=mcprimcasc->GetMother();
3385  AliAODMCParticle *tmcprimcasc = (AliAODMCParticle*)mcArray->At(labprim_casc);
3386  if(!tmcprimcasc) {
3387  break;
3388  }
3389 
3390  mcprimcasc = tmcprimcasc;
3391  pdgarray_casc[ngen_casc] = mcprimcasc->GetPdgCode();
3392  labelarray_casc[ngen_casc] = labprim_casc;
3393  ngen_casc ++;
3394  if(ngen_casc==100) break;
3395  }
3396 
3397  Bool_t same_flag = kFALSE;
3398  Int_t matchedlabel=-9999;
3399  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
3400  for(Int_t ivmc=0;ivmc<ngen_casc;ivmc++){
3401  if(labelarray_ele[iemc]==labelarray_casc[ivmc]){
3402  same_flag = kTRUE;
3403  matchedlabel = labelarray_ele[iemc];
3404  break;
3405  }
3406  }
3407  if(same_flag) break;
3408  }
3409 
3410  return matchedlabel;
3411 
3412 }
3413 //________________________________________________________________________
3414 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const // the cascade
3415 {
3416  //
3417  // Matching to MC of cascade
3418  //
3419 
3420  AliAODTrack *cptrack = (AliAODTrack*) theCascade->GetDaughter(0);
3421  if(!cptrack) return -1;
3422  Int_t label_p = TMath::Abs(cptrack->GetLabel());
3423  if(label_p<0) return -1;
3424  AliAODTrack *cntrack = (AliAODTrack*) theCascade->GetDaughter(1);
3425  if(!cntrack) return -1;
3426  Int_t label_n = TMath::Abs(cntrack->GetLabel());
3427  if(label_n<0) return -1;
3428  Int_t labv0 = theCascade->MatchToMC(pdgDgcasc[1],mcArray,2,pdgDgv0);
3429  if(labv0<0) return -1;
3430  AliAODMCParticle *mcpartv0= (AliAODMCParticle*) mcArray->At(labv0);
3431 
3432  AliAODTrack *cbtrack = (AliAODTrack*) theCascade->GetDecayVertexXi()->GetDaughter(0);
3433  if(!cbtrack) return -1;
3434 
3435  Int_t label_b = TMath::Abs(cbtrack->GetLabel());
3436  if(label_b<0) return -1;
3437 
3438  AliAODMCParticle *mcpartb= (AliAODMCParticle*) mcArray->At(label_b);
3439  Int_t pdgb = TMath::Abs(mcpartb->GetPdgCode());
3440  if(pdgb!=pdgDgcasc[0]) return -1;
3441 
3442  AliAODMCParticle *mcmotherv0=mcpartv0;
3443  Bool_t isFromXiv0 = kFALSE;
3444  Int_t labxiv0 = mcmotherv0->GetMother();
3445  if(labxiv0<0) return -1;
3446  mcmotherv0 = (AliAODMCParticle*) mcArray->At(labxiv0);
3447  if(mcmotherv0){
3448  Int_t pdg = TMath::Abs(mcmotherv0 ->GetPdgCode());
3449  if(pdg==pdgabscasc){
3450  isFromXiv0 = kTRUE;
3451  }
3452  }
3453  if(!isFromXiv0) return -1;
3454 
3455  AliAODMCParticle *mcmotherb=mcpartb;
3456  Bool_t isFromXib = kFALSE;
3457  Int_t labxib = mcmotherb->GetMother();
3458  if(labxib<0) return -1;
3459  mcmotherb = (AliAODMCParticle*) mcArray->At(labxib);
3460  if(mcmotherb){
3461  Int_t pdg = TMath::Abs(mcmotherb ->GetPdgCode());
3462  if(pdg==pdgabscasc){
3463  isFromXib = kTRUE;
3464  }
3465  }
3466  if(!isFromXib) return -1;
3467 
3468  if(labxiv0!=labxib) return -1;//Bachelor and V0 should come from the same Xi
3469 
3470  return labxib;
3471 }
3472 //________________________________________________________________________
3473 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags, TClonesArray *mcArray)
3474 {
3475  //
3476  // Select good tracks using fAnalCuts (AliRDHFCuts object) and return the array of their ids
3477  //
3478 
3479  //const Int_t entries = event->GetNumberOfTracks();
3480  if(trkEntries==0) return;
3481 
3482  nSeleTrks=0;
3483  for(Int_t i=0; i<trkEntries; i++) {
3484  seleFlags[i] = kFALSE;
3485 
3486  AliVTrack *track;
3487  track = (AliVTrack*)event->GetTrack(i);
3488 
3489  if(track->GetID()<0) continue;
3490  Double_t covtest[21];
3491  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
3492 
3493  AliAODTrack *aodt = (AliAODTrack*)track;
3494  Double_t nsigma_tpcele = -9999;
3495  Double_t nsigma_tofele = -9999;
3496  if(fAnalCuts->GetIsUsePID()){
3497  nsigma_tpcele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(aodt,AliPID::kElectron);
3498  nsigma_tofele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(aodt,AliPID::kElectron);
3499  }
3500 
3501  if(!fAnalCuts) continue;
3502  if(fAnalCuts->SingleTrkCutsNoPID(aodt,fVtx1)){
3503  fHistoElectronTPCPID->Fill(aodt->Pt(),nsigma_tpcele);
3504  fHistoElectronTOFPID->Fill(aodt->Pt(),nsigma_tofele);
3505  if(fabs(nsigma_tofele)<3.){
3506  fHistoElectronTPCPIDSelTOF->Fill(aodt->Pt(),nsigma_tpcele);
3507  Double_t eleeta = aodt->Eta();
3508  if(fabs(eleeta)<0.6)
3509  fHistoElectronTPCPIDSelTOFSmallEta->Fill(aodt->Pt(),nsigma_tpcele);
3510  if(fabs(eleeta)>0.6 && fabs(eleeta)<0.8)
3511  fHistoElectronTPCPIDSelTOFLargeEta->Fill(aodt->Pt(),nsigma_tpcele);
3512  if(eleeta>-0.8 && eleeta<-0.6){
3513  fHistoElectronTPCPIDSelTOFEtaDep[0]->Fill(aodt->Pt(),nsigma_tpcele);
3514  }else if(eleeta>-0.6&&eleeta<-0.4){
3515  fHistoElectronTPCPIDSelTOFEtaDep[1]->Fill(aodt->Pt(),nsigma_tpcele);
3516  }else if(eleeta>-0.4&&eleeta<-0.2){
3517  fHistoElectronTPCPIDSelTOFEtaDep[2]->Fill(aodt->Pt(),nsigma_tpcele);
3518  }else if(eleeta>-0.2&&eleeta<0.0){
3519  fHistoElectronTPCPIDSelTOFEtaDep[3]->Fill(aodt->Pt(),nsigma_tpcele);
3520  }else if(eleeta>0.0&&eleeta<0.2){
3521  fHistoElectronTPCPIDSelTOFEtaDep[4]->Fill(aodt->Pt(),nsigma_tpcele);
3522  }else if(eleeta>0.2&&eleeta<0.4){
3523  fHistoElectronTPCPIDSelTOFEtaDep[5]->Fill(aodt->Pt(),nsigma_tpcele);
3524  }else if(eleeta>0.4&&eleeta<0.6){
3525  fHistoElectronTPCPIDSelTOFEtaDep[6]->Fill(aodt->Pt(),nsigma_tpcele);
3526  }else if(eleeta>0.6&&eleeta<0.8){
3527  fHistoElectronTPCPIDSelTOFEtaDep[7]->Fill(aodt->Pt(),nsigma_tpcele);
3528  }
3529  }
3530  if(nsigma_tpcele>-0.5&&nsigma_tpcele<3.){
3531  fHistoElectronTOFPIDSelTPC->Fill(aodt->Pt(),nsigma_tofele);
3532  }
3533  }
3534  if(fAnalCuts->SingleTrkCuts(aodt,fVtx1)){
3535  seleFlags[i]=kTRUE;
3536  nSeleTrks++;
3537  fHistoElectronTPCSelPID->Fill(aodt->Pt(),nsigma_tpcele);
3538  fHistoElectronTOFSelPID->Fill(aodt->Pt(),nsigma_tofele);
3539  FillElectronROOTObjects(aodt,mcArray);
3540  }
3541  } // end loop on tracks
3542 }
3543 //________________________________________________________________________
3544 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascs,Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
3545 {
3546  //
3547  // Select good Casc using fAnalCuts (AliRDHFCuts object) and return the array of their ids
3548  //
3549 
3550  Double_t primVtx[3];
3551  fVtx1->GetXYZ(primVtx);
3552 
3553  nSeleCasc = 0;
3554  for(Int_t icasc=0;icasc<nCascs;icasc++)
3555  {
3556  seleCascFlags[icasc] = kFALSE;
3557  AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
3558 
3559  if(!fAnalCuts) continue;
3560  if(fAnalCuts->SingleCascadeCuts(casc,primVtx)){
3561  seleCascFlags[icasc] = kTRUE;
3562  nSeleCasc++;
3563 
3564  FillCascROOTObjects(casc,mcArray);
3565  }
3566  }
3567 }
3568 //_________________________________________________________________
3569 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::GetPoolIndex(Double_t zvert, Double_t mult){
3570  //
3571  // check in which of the pools the current event falls
3572  //
3573 
3574  Int_t theBinZ=TMath::BinarySearch(fNzVtxBins,fZvtxBins,zvert);
3575  if(theBinZ<0 || theBinZ>=fNzVtxBins) return -1;
3576  Int_t theBinM=TMath::BinarySearch(fNCentBins,fCentBins,mult);
3577  if(theBinM<0 || theBinM>=fNCentBins) return -1;
3578  return fNCentBins*theBinZ+theBinM;
3579 }
3580 //_________________________________________________________________
3582  //
3583  // delete the contets of the pool
3584  //
3585  if(poolIndex<0 || poolIndex>=fNOfPools) return;
3586  delete fEventBuffer[poolIndex];
3587  fEventBuffer[poolIndex]=new TTree(Form("EventBuffer_%d",poolIndex), "Temporary buffer for event mixing");
3588 
3589  fEventBuffer[poolIndex]->Branch("zVertex", &fVtxZ);
3590  fEventBuffer[poolIndex]->Branch("centrality", &fCentrality);
3591  fEventBuffer[poolIndex]->Branch("eventInfo", "TObjString",&fEventInfo);
3592  fEventBuffer[poolIndex]->Branch("c1array", "TObjArray", &fCascadeTracks1);
3593  fEventBuffer[poolIndex]->Branch("c2array", "TObjArray", &fCascadeTracks2);
3594 
3595  return;
3596 }
3597 //_________________________________________________________________
3599 {
3600  //
3601  // perform mixed event analysis
3602  //
3603 
3604  if(poolIndex<0 || poolIndex>fNzVtxBins*fNCentBins) return;
3605  if(fEventBuffer[poolIndex]->GetEntries()<fNumberOfEventsForMixing) return;
3606 
3607  Int_t nEle = fElectronTracks->GetEntries();
3608  Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
3609 
3610  TObjArray* c1array=0x0;
3611  TObjArray* c2array=0x0;
3612  Float_t zVertex,cent;
3613  TObjString* eventInfo=0x0;
3614  fEventBuffer[poolIndex]->SetBranchAddress("zVertex", &zVertex);
3615  fEventBuffer[poolIndex]->SetBranchAddress("eventInfo",&eventInfo);
3616  fEventBuffer[poolIndex]->SetBranchAddress("centrality", &cent);
3617  fEventBuffer[poolIndex]->SetBranchAddress("c1array", &c1array);
3618  fEventBuffer[poolIndex]->SetBranchAddress("c2array", &c2array);
3619  for (Int_t i=0; i<nEle; i++)
3620  {
3621  TLorentzVector* trke=(TLorentzVector*) fElectronTracks->At(i);
3622  if(!trke)continue;
3623 
3624  for(Int_t iEv=0; iEv<fNumberOfEventsForMixing; iEv++){
3625  fEventBuffer[poolIndex]->GetEvent(iEv + nEvents - fNumberOfEventsForMixing);
3626  //TObjArray* c1array1=(TObjArray*)c1array->Clone();
3627  Int_t nCascs1=c1array->GetEntries();
3628  //Float_t zVertex1=zVertex;
3629  //Float_t mult1=cent;
3630 // Int_t evId1,esdId1,ne1,nv1;
3631 // sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_E%d_C%d",&evId1,&esdId1,&ne1,&nv1);
3632 // if(nv1!=(nCascs1+nCascs2)){
3633 // printf("AliAnalysisTaskSEXic2eleXifromAODtracks::DoMixingWithPools ERROR: read event does not match to the stored one\n");
3634 // delete c1array1;
3635 // delete c2array1;
3636 // continue;
3637 // }
3638  for(Int_t iTr1=0; iTr1<nCascs1; iTr1++){
3639  TLorentzVector* casc1=(TLorentzVector*) c1array->At(iTr1);
3640  if(!casc1) continue;
3641  FillMixROOTObjects(trke,casc1,1);
3642  }//casc loop
3643 
3644  //TObjArray* c2array1=(TObjArray*)c2array->Clone();
3645  Int_t nCascs2=c2array->GetEntries();
3646  for(Int_t iTr2=0; iTr2<nCascs2; iTr2++){
3647  TLorentzVector* casc2=(TLorentzVector*) c2array->At(iTr2);
3648  if(!casc2) continue;
3649  FillMixROOTObjects(trke,casc2,-1);
3650  }//casc loop
3651 
3652  //delete c1array1;
3653  //delete c2array1;
3654  }//event loop
3655  }//track loop
3656 }
3657 //_________________________________________________________________
3659 {
3660  //
3661  // Analyze AliAODmcparticle
3662  //
3663 
3664  Int_t nmcpart = mcArray->GetEntriesFast();
3665 
3666  Int_t mcevttype = 0;
3667  Int_t nccbar = 0;
3668  Bool_t sigmaevent = kFALSE;
3669  if(fMCEventType==1 || fMCEventType==2 || fMCEventType==11 || fMCEventType==12){
3670  //1: c quark event
3671  //2: b quark event
3672  //11: near side c-cbar event
3673  //12: away side c-cbar event
3674  Int_t ncquark = 0;
3675  Int_t ncbarquark = 0;
3676  Double_t phi_c = -9999.;
3677  Double_t phi_cbar = -9999.;
3678  for(Int_t i=0;i<nmcpart;i++)
3679  {
3680  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
3681  if(TMath::Abs(mcpart->GetPdgCode())==4){
3682  if(fabs(mcpart->Y())<1.5){
3683  if(mcpart->GetPdgCode()==4){
3684  phi_c = mcpart->Phi();
3685  ncquark++;
3686  }
3687  if(mcpart->GetPdgCode()==-4){
3688  phi_cbar = mcpart->Phi();
3689  ncbarquark++;
3690  }
3691  if(mcevttype==0){
3692  mcevttype = 1;
3693  }else if(mcevttype==1){
3694  mcevttype = 1;
3695  }else if(mcevttype==2){
3696  mcevttype = 3;
3697  }else if(mcevttype==3){
3698  mcevttype = 3;
3699  }
3700  nccbar++;
3701  }
3702  }
3703  if(TMath::Abs(mcpart->GetPdgCode())==5){
3704  if(!mcpart->IsPhysicalPrimary()) continue;
3705  if(fabs(mcpart->Y())<1.5){
3706  if(mcevttype==0){
3707  mcevttype = 2;
3708  }else if(mcevttype==1){
3709  mcevttype = 3;
3710  }else if(mcevttype==2){
3711  mcevttype = 2;
3712  }else if(mcevttype==3){
3713  mcevttype = 3;
3714  }
3715  }
3716  }
3717  }
3718 
3719  if(fMCEventType==1||fMCEventType==11||fMCEventType==12){
3720  if((mcevttype==2)||(mcevttype==0)||(mcevttype==3)) return kFALSE;
3721  }else if(fMCEventType==2){
3722  if((mcevttype==1)||(mcevttype==0)||(mcevttype==3)) return kFALSE;
3723  }
3724 
3725  if(fMCEventType>10){
3726  if(ncquark!=1) return kFALSE;
3727  if(ncbarquark!=1) return kFALSE;
3728  Double_t dphi = fabs(phi_c - phi_cbar);
3729  if(dphi>2*M_PI) dphi -= 2*M_PI;
3730  if(dphi>M_PI) dphi = 2*M_PI-dphi;
3731  if(fMCEventType==11 && dphi>M_PI/3.) return kFALSE;
3732  if(fMCEventType==12 && dphi<2*M_PI/3.) return kFALSE;
3733  fHistoMCDeltaPhiccbar->Fill(dphi);
3734  }
3735 
3736  fHistoMCEventType->Fill(mcevttype);
3737  fHistoMCNccbar->Fill(nccbar);
3738  }
3739 
3740  for(Int_t i=0;i<nmcpart;i++)
3741  {
3742  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
3743  if(TMath::Abs(mcpart->GetPdgCode())==4132){
3744  Bool_t e_flag = kFALSE;
3745  Bool_t xi_flag = kFALSE;
3746  AliAODMCParticle *mcepart = 0;
3747  AliAODMCParticle *mccascpart = 0;
3748  for(Int_t idau=mcpart->GetFirstDaughter();idau<mcpart->GetLastDaughter()+1;idau++)
3749  {
3750  if(idau<0) break;
3751  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
3752  if(!mcdau) continue;
3753  if(TMath::Abs(mcdau->GetPdgCode())==11){
3754  e_flag = kTRUE;
3755  mcepart = mcdau;
3756  }
3757  if(TMath::Abs(mcdau->GetPdgCode())==3312){
3758  xi_flag = kTRUE;
3759  mccascpart = mcdau;
3760  }
3761  }
3762 
3763  Int_t decaytype = -9999;
3764  if(e_flag && xi_flag) decaytype = 0;
3765 
3766  if(e_flag&&xi_flag)
3767  fHistoMCXic0Decays->Fill(1);
3768  if(!e_flag&&xi_flag)
3769  fHistoMCXic0Decays->Fill(2);
3770  if(e_flag&&!xi_flag)
3771  fHistoMCXic0Decays->Fill(3);
3772  if(!e_flag&&!xi_flag)
3773  fHistoMCXic0Decays->Fill(4);
3774 
3775  FillMCROOTObjects(mcpart,mcepart,mccascpart,decaytype);
3776  }
3777  if(TMath::Abs(mcpart->GetPdgCode())==11 && mcpart->GetStatus()==1){
3778  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
3779  Float_t etamin, etamax;
3780  esdcuts->GetEtaRange(etamin,etamax);
3781  if(fabs(mcpart->Eta())<etamax){
3782  Bool_t gamma_flag = kFALSE;
3783  Int_t labmother = mcpart->GetMother();
3784  if(labmother>=0){
3785  AliAODMCParticle *mcmother = (AliAODMCParticle*) mcArray->At(labmother);
3786  Int_t pdgmother = mcmother->GetPdgCode();
3787  if(TMath::Abs(pdgmother)==22) gamma_flag = kTRUE;
3788  }
3789  if(!gamma_flag) fHistoBachPtMCGen->Fill(mcpart->Pt());
3790  }
3791  FillMCEleROOTObjects(mcpart, mcArray);
3792  }
3793  if(TMath::Abs(mcpart->GetPdgCode())==3312){
3794  Double_t etamin, etamax, rapmin, rapmax;
3795  fAnalCuts->GetProdCascEtaRange(etamin,etamax);
3796  fAnalCuts->GetProdCascRapRange(rapmin,rapmax);
3797 
3798  if((fabs(mcpart->Y())<rapmax) && (fabs(mcpart->Eta())<etamax)){
3799  fHistoXiMassvsPtMCGen->Fill(1.32171, mcpart->Pt());
3800  }
3801  FillMCCascROOTObjects(mcpart, mcArray);
3802  }
3803  }
3804 
3805  if(fMCDoPairAnalysis)
3806  {
3807  for(Int_t i=0;i<nmcpart;i++)
3808  {
3809  AliAODMCParticle *mcparte = (AliAODMCParticle*) mcArray->At(i);
3810  if(!mcparte) continue;
3811  if(TMath::Abs(mcparte->GetPdgCode())!=11) continue;
3812  if(mcparte->GetStatus()!=1) continue;
3813  if(mcparte->Pt()<0.4) continue;//Apply rough cuts
3814  if(fabs(mcparte->Eta())>0.8) continue;//Apply rough cuts
3815  for(Int_t j=0;j<nmcpart;j++)
3816  {
3817  AliAODMCParticle *mcpartv = (AliAODMCParticle*) mcArray->At(j);
3818  if(!mcpartv) continue;
3819  if(TMath::Abs(mcpartv->GetPdgCode())!=3312) continue;
3820  if(mcpartv->Pt()<0.4) continue;//Apply rough cuts
3821  if(fabs(mcpartv->Eta())>0.8) continue;//Apply rough cuts
3822  if(mcpartv->GetNDaughters()!=2) continue;//Apply rough cuts
3823 
3824  FillMCGenPairROOTObjects(mcparte,mcpartv,mcArray);
3825  }
3826  }
3827  return kFALSE;
3828  }
3829 
3830  return kTRUE;
3831 }
3832 
3835 {
3836  //
3837  // Define mc pair tree variables
3838  //
3839 
3840  const char* nameoutput = GetOutputSlot(11)->GetContainer()->GetName();
3841  fMCGenPairVariablesTree = new TTree(nameoutput,"MC pair variables tree");
3842  Int_t nVar = 38;
3843  fCandidateMCGenPairVariables = new Float_t [nVar];
3844  TString * fCandidateVariableNames = new TString[nVar];
3845 
3846  fCandidateVariableNames[ 0] = "InvMassEleXi";
3847  fCandidateVariableNames[ 1] = "EleXiPx";
3848  fCandidateVariableNames[ 2] = "EleXiPy";
3849  fCandidateVariableNames[ 3] = "EleXiPz";
3850  fCandidateVariableNames[ 4] = "ElePdgCode";
3851  fCandidateVariableNames[ 5] = "ElePx";
3852  fCandidateVariableNames[ 6] = "ElePy";
3853  fCandidateVariableNames[ 7] = "ElePz";
3854  fCandidateVariableNames[ 8] = "XiPdgCode";
3855  fCandidateVariableNames[ 9] = "XiPx";
3856  fCandidateVariableNames[10] = "XiPy";
3857  fCandidateVariableNames[11] = "XiPz";
3858  fCandidateVariableNames[12] = "SameFlag";
3859  fCandidateVariableNames[13] = "EleNGeneration";
3860  fCandidateVariableNames[14] = "EleGen1PDG";
3861  fCandidateVariableNames[15] = "EleGen2PDG";
3862  fCandidateVariableNames[16] = "EleGen3PDG";
3863  fCandidateVariableNames[17] = "EleGen4PDG";
3864  fCandidateVariableNames[18] = "EleGen5PDG";
3865  fCandidateVariableNames[19] = "EleGen6PDG";
3866  fCandidateVariableNames[20] = "EleGen7PDG";
3867  fCandidateVariableNames[21] = "EleGen8PDG";
3868  fCandidateVariableNames[22] = "EleGen9PDG";
3869  fCandidateVariableNames[23] = "EleGen10PDG";
3870  fCandidateVariableNames[24] = "ElePrimPDG";
3871  fCandidateVariableNames[25] = "XiNGeneration";
3872  fCandidateVariableNames[26] = "XiGen1PDG";
3873  fCandidateVariableNames[27] = "XiGen2PDG";
3874  fCandidateVariableNames[28] = "XiGen3PDG";
3875  fCandidateVariableNames[29] = "XiGen4PDG";
3876  fCandidateVariableNames[30] = "XiGen5PDG";
3877  fCandidateVariableNames[31] = "XiGen6PDG";
3878  fCandidateVariableNames[32] = "XiGen7PDG";
3879  fCandidateVariableNames[33] = "XiGen8PDG";
3880  fCandidateVariableNames[34] = "XiGen9PDG";
3881  fCandidateVariableNames[35] = "XiGen10PDG";
3882  fCandidateVariableNames[36] = "XiPrimPDG";
3883  fCandidateVariableNames[37] = "MatchedPDG";
3884 
3885  for (Int_t ivar=0; ivar<nVar; ivar++) {
3886  fMCGenPairVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCGenPairVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
3887  }
3888  return;
3889 }
3890 
3892 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCGenPairROOTObjects(AliAODMCParticle *mcparte, AliAODMCParticle *mcpartv, TClonesArray *mcArray)
3893 {
3894  //
3895  // Fill histograms or mc pair analysis tree
3896  //
3897  for(Int_t i=0;i<38;i++){
3898  fCandidateMCGenPairVariables[i] = -9999.;
3899  }
3900 
3901  TLorentzVector vele, vxi, vexi;
3902  vele.SetXYZM(mcparte->Px(),mcparte->Py(),mcparte->Pz(),0.000510998928);
3903  vxi.SetXYZM(mcpartv->Px(),mcpartv->Py(),mcpartv->Pz(),1.32171);
3904  vexi = vele + vxi;
3905 
3906  Int_t pdgarray_ele[100], labelarray_ele[100], ngen_ele;
3907  Int_t pdgarray_xi[100], labelarray_xi[100], ngen_xi;
3908  GetMCDecayHistory(mcparte,mcArray,pdgarray_ele,labelarray_ele,ngen_ele);
3909  GetMCDecayHistory(mcpartv,mcArray,pdgarray_xi,labelarray_xi,ngen_xi);
3910 
3911  Bool_t same_flag = kFALSE;
3912  Int_t matched_pdg = -999999;
3913  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
3914  for(Int_t ivmc=0;ivmc<ngen_xi;ivmc++){
3915  if(labelarray_ele[iemc]==labelarray_xi[ivmc]){
3916  same_flag = kTRUE;
3917  matched_pdg = pdgarray_ele[iemc];
3918  break;
3919  }
3920  }
3921  if(same_flag) break;
3922  }
3923  Int_t pdgprim_ele = pdgarray_ele[ngen_ele-1];
3924  Int_t pdgprim_xi = pdgarray_xi[ngen_xi-1];
3925 
3926  fCandidateMCGenPairVariables[ 0] = vexi.M();
3927  fCandidateMCGenPairVariables[ 1] = vexi.Px();
3928  fCandidateMCGenPairVariables[ 2] = vexi.Py();
3929  fCandidateMCGenPairVariables[ 3] = vexi.Pz();
3930  fCandidateMCGenPairVariables[ 4] = mcparte->GetPdgCode();
3931  fCandidateMCGenPairVariables[ 5] = vele.Px();
3932  fCandidateMCGenPairVariables[ 6] = vele.Py();
3933  fCandidateMCGenPairVariables[ 7] = vele.Pz();
3934  fCandidateMCGenPairVariables[ 8] = mcpartv->GetPdgCode();
3935  fCandidateMCGenPairVariables[ 9] = vxi.Px();
3936  fCandidateMCGenPairVariables[10] = vxi.Py();
3937  fCandidateMCGenPairVariables[11] = vxi.Pz();
3938  fCandidateMCGenPairVariables[12] = (Float_t)same_flag;
3939  fCandidateMCGenPairVariables[13] = (Float_t)ngen_ele;
3940  fCandidateMCGenPairVariables[14] = (Float_t)pdgarray_ele[0];
3941  fCandidateMCGenPairVariables[15] = (Float_t)pdgarray_ele[1];
3942  fCandidateMCGenPairVariables[16] = (Float_t)pdgarray_ele[2];
3943  fCandidateMCGenPairVariables[17] = (Float_t)pdgarray_ele[3];
3944  fCandidateMCGenPairVariables[18] = (Float_t)pdgarray_ele[4];
3945  fCandidateMCGenPairVariables[19] = (Float_t)pdgarray_ele[5];
3946  fCandidateMCGenPairVariables[20] = (Float_t)pdgarray_ele[6];
3947  fCandidateMCGenPairVariables[21] = (Float_t)pdgarray_ele[7];
3948  fCandidateMCGenPairVariables[22] = (Float_t)pdgarray_ele[8];
3949  fCandidateMCGenPairVariables[23] = (Float_t)pdgarray_ele[9];
3950  fCandidateMCGenPairVariables[24] = (Float_t)pdgarray_ele[ngen_ele-1];
3951  fCandidateMCGenPairVariables[25] = (Float_t)ngen_xi;
3952  fCandidateMCGenPairVariables[26] = (Float_t)pdgarray_xi[0];
3953  fCandidateMCGenPairVariables[27] = (Float_t)pdgarray_xi[1];
3954  fCandidateMCGenPairVariables[28] = (Float_t)pdgarray_xi[2];
3955  fCandidateMCGenPairVariables[29] = (Float_t)pdgarray_xi[3];
3956  fCandidateMCGenPairVariables[30] = (Float_t)pdgarray_xi[4];
3957  fCandidateMCGenPairVariables[31] = (Float_t)pdgarray_xi[5];
3958  fCandidateMCGenPairVariables[32] = (Float_t)pdgarray_xi[6];
3959  fCandidateMCGenPairVariables[33] = (Float_t)pdgarray_xi[7];
3960  fCandidateMCGenPairVariables[34] = (Float_t)pdgarray_xi[8];
3961  fCandidateMCGenPairVariables[35] = (Float_t)pdgarray_xi[9];
3962  fCandidateMCGenPairVariables[36] = (Float_t)pdgarray_xi[ngen_xi-1];
3963  fCandidateMCGenPairVariables[37] = (Float_t) matched_pdg;
3964 
3965  fMCGenPairVariablesTree->Fill();
3966 }
3967 
3969 void AliAnalysisTaskSEXic2eleXifromAODtracks::GetMCDecayHistory(AliAODMCParticle *mcpart, TClonesArray *mcArray, Int_t *pdgarray, Int_t *labelarray, Int_t &ngen)
3970 {
3971 
3972  for(Int_t i=0;i<100;i++){
3973  pdgarray[i] = -9999;
3974  labelarray[i] = -9999;
3975  }
3976  ngen = 0;
3977 
3978  AliAODMCParticle *mcprim = mcpart;
3979  while(mcprim->GetMother()>=0) {
3980  Int_t lab_prim=mcprim->GetMother();
3981 
3982  AliAODMCParticle *tmcprim = (AliAODMCParticle*)mcArray->At(lab_prim);
3983  if(!tmcprim) {
3984  break;
3985  }
3986  if((TMath::Abs(tmcprim->GetPdgCode())<10) || (TMath::Abs(tmcprim->GetPdgCode())==21)) break;
3987 
3988  mcprim = tmcprim;
3989 
3990  pdgarray[ngen] = mcprim->GetPdgCode();
3991  labelarray[ngen] = lab_prim;
3992 
3993  ngen ++;
3994  if(ngen == 100) break;
3995  }
3996 }
Int_t charge
THnSparse * fHistoEleXiMassvsElePtWS2
! e-Xi mass spectra (wrong-sign)
Int_t pdg
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
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:298
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.
TH1F * fHistoBachPtMCGen
! Bachelor pT histogram (efficiency denominator)
TH2D * fHistoResponseEleXiPt
! Response function e-Xi pT <- XicPt
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
THnSparse * fHistoEleXiMassWSSideAway
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassRSMix1
! e-Xi mass spectra (right-sign)
void FillROOTObjects(AliAODRecoCascadeHF *elobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray)
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)
THnSparse * fHistoEleXiMassRSAway
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassRSMix2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsXiPtRSMix
! e-Xi spectra (right-sign, mix)
THnSparse * fHistoEleXiMassMCS2
! e-Xi mass spectra (Efficiency numerator)
Float_t * fCandidateMCVariables
! variables to be written to the tree
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)
THnSparse * fHistoEleXiMassvsElePtRS2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsd0PromptMCS
! e pt-d0 spectra (right-sign)
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
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)
void FillElectronROOTObjects(AliAODTrack *trk, TClonesArray *mcArray)
THnSparse * fHistoEleXiMassRS
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsEtaWSMix
! e spectra (wrong-sign, mix)
THnSparse * fHistoEleXiMassvsElePtRSMix2
! e-Xi mass-ept spectra (right-sign)
Int_t MatchToMC(AliAODRecoCascadeHF *elobj, TClonesArray *mcArray, Int_t *pdgarray_ele, Int_t *pdgarray_casc, Int_t *labelarray_ele, Int_t *labelarray_casc, Int_t &ngen_ele, Int_t &ngen_casc)
THnSparse * fHistoElePtvsXiPtWSMix
! e-Xi spectra (wrong-sign, mix)
TTree * fCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
THnSparse * fHistoEleXiMassvsElePtWSMix2
! e-Xi mass-ept spectra (wrong-sign)
virtual void UserCreateOutputObjects()
Implementation of interface methods.
THnSparse * fHistoElePtvsd0WS
! e pt-d0 spectra (wrong-sign)
Float_t * fCandidateEleVariables
! variables to be written to the tree
TTree * fMCEleVariablesTree
! tree of the candidate variables after track selection on output slot 4
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
THnSparse * fHistoEleXiMassvsElePtWSSide
! e-Xi mass-ept spectra (wrong-sign)
void FillMCROOTObjects(AliAODMCParticle *part, AliAODMCParticle *mcepart, AliAODMCParticle *mcv0part, Int_t decaytype)
THnSparse * fHistoEleXiMassPromptMCS1
! e-Xi mass spectra (Efficiency numerator)
THnSparse * fHistoElePtvsEtaMCGen
! e spectra efficiency denominator
THnSparse * fHistoEleXiMassMCGen
! e-Xi mass spectra (Efficiency denominator)
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
THnSparse * fHistoElePtvsEtaMCS
! e spectra efficiency numerator
TTree * fMCVariablesTree
! tree of the candidate variables after track selection on output slot 4
Bool_t SingleTrkCuts(AliAODTrack *trk, AliAODVertex *primvert)
THnSparse * fHistoElePtvsXiPtMCS
! e-Xi spectra efficiency numerator
THnSparse * fHistoEleXiMassWS
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTOFPIDSelTPC
! TOF electron PID after TPC cut
THnSparse * fHistoElePtvsCutVarsWS[23]
! e pt- cut variables (Wrong-sign)
const Double_t etamin
THnSparse * fHistoEleXiMassPromptMCS
! e-Xi mass spectra (Efficiency numerator)
TH1F * fHistoBachPtMCS
! Bachelor pT histogram (efficiency numerator)
void MakeAnalysis(AliAODEvent *aod, TClonesArray *mcArray)
AliAODVertex * PrimaryVertex(const TObjArray *trkArray, AliVEvent *event)
THnSparse * fHistoEleXiMassRSSide2
! e-Xi mass spectra (right-sign)
TH2F * fHistoLambdaPtvsDlMCS
! Lambda proper life time distribution (mc)
THnSparse * fHistoEleXiMassvsElePtMCS
! e-Xi mass-ept spectra (Efficiency numerator)
THnSparse * fHistoEleXiMassvsElePtMCS2
! e-Xi mass-ept spectra (Efficiency numerator)
void FillMCCascROOTObjects(AliAODMCParticle *mccpart, TClonesArray *mcArray)
void FillMCGenPairROOTObjects(AliAODMCParticle *mcparte, AliAODMCParticle *mcpartv, TClonesArray *mcArray)
THnSparse * fHistoElePtvsCutVarsMCS[23]
! e pt- cut variables (MCS)
THnSparse * fHistoXiMCGen
! Xi in mcArray (only from charmed baryon)
THnSparse * fHistoElePtvsXiPtRS
! e-Xi spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtRSMix1
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtWSMix1
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtMCGen1
! e-Xi mass-ept spectra (Efficiency denominator)
TH2F * fHistoElePtMCS
! e spectra (Efficiency numerator)
THnSparse * fHistoEleXiMassWSMix1Away
! e-Xi mass spectra (wrong-sign)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
TH2F * fHistoElectronTOFSelPID
! TOF electron PID after selection
Float_t * fCandidateMCCascVariables
! variables to be written to the tree
Float_t * fCandidateMCGenPairVariables
! variables to be written to the tree
AliAODTrack * GetBachelor() const
Float_t * fCandidateMCEleVariables
! variables to be written to the tree
THnSparse * fHistoEleXiMassMCS
! e-Xi mass spectra (Efficiency numerator)
TObjArray * fCascadeTracks2
array of xi+compatible tracks
TTree * fEleVariablesTree
flag to decide whether to write the candidate variables on a tree variables
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:245
TObjArray * fElectronTracks
unique event id for mixed event check
TH1F * fCEvents
! Histogram to check selected events
void SetProngIDs(Int_t nIDs, UShort_t *id)
TH2F * fHistoElectronTPCPIDSelTOFSmallEta
! TPC electron PID after TOF 3 sigma cut (|eta|<0.6)
THnSparse * fHistoEleXiMassPromptMCS2
! e-Xi mass spectra (Efficiency numerator)
THnSparse * fHistoElePtvsd0WSMix
! e pt-d0 spectra (wrong-sign, mix)
TH2F * fHistoElectronTPCPIDSelTOF
! TPC electron PID after TOF 3 sigma cut
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
THnSparse * fHistoEleXiMassvsElePtWSSide2
! e-Xi mass-ept spectra (wrong-sign)
AliNormalizationCounter * fCounter
! Counter for normalization
Int_t fNzVtxBins
maximum number of events to be used in event mixing
THnSparse * fHistoEleXiMassWSAway
! e-Xi mass spectra (wrong-sign)
TObjArray * fCascadeTracks1
array of e-compatible tracks
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
THnSparse * fHistoEleXiMassRSSide
! e-Xi mass spectra (right-sign)
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:319
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
AliAODcascade * GetCascade() const
TH2F * fHistoElePtMCGen
! e spectra (Efficiency denominator)
THnSparse * fHistoEleXiMassvsElePtMCGen2
! e-Xi mass-ept spectra (Efficiency denominator)
THnSparse * fHistoElePtvsd0RSMix
! e pt-d0 spectra (right-sign, mix)
AliAODRecoCascadeHF * MakeCascadeHF(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod, AliAODVertex *vert)
THnSparse * fHistoEleXiMassRS2
! e-Xi mass spectra (right-sign)
void FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
Bool_t IsEventSelected(AliVEvent *event)
THnSparse * fHistoEleXiMassWSMix1
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsXiPtWS
! e-Xi spectra (wrong-sign)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
AliAODVertex * ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod)
THnSparse * fHistoEleXiMassBFeeddownMCS2
! e-Xi mass spectra (Efficiency numerator)
Float_t nEvents[nProd]
AliAODVertex * CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *evt)
THnSparse * fHistoEleXiMassvsElePtWS1
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTPCPIDSelTOFLargeEta
! TPC electron PID after TOF 3 sigma cut (0.8>|eta|>0.6)
THnSparse * fHistoEleXiMassvsElePtWSMix
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassRS1Away
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassMCS1
! e-Xi mass spectra (Efficiency numerator)
Bool_t fIsMB
Reconstruct primary vertex excluding candidate tracks.
THnSparse * fHistoEleXiMassRSMix2Away
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassWS1Away
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsEtaRSMix
! e spectra (right-sign, mix)
TTree * fMCGenPairVariablesTree
! tree of mcArray analysis pair tree
THnSparse * fHistoEleXiMassvsElePtRSMix
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassWSMix2Away
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassWSSide1Away
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassRSSide2Away
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassWSSide1
! e-Xi mass spectra (wrong-sign)
const Double_t etamax
THnSparse * fHistoEleXiMassWS2
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsd0BFeeddownMCS
! e pt-d0 spectra (right-sign)
THnSparse * fHistoEleXiMassBFeeddownMCS
! e-Xi mass spectra (Efficiency numerator)
Bool_t SingleTrkCutsNoPID(AliAODTrack *trk, AliAODVertex *primvert)
THnSparse * fHistoEleXiMassvsElePtRSSide2
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassWS1
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassWSSide2
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtRS1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtRSSide
! e-Xi mass-ept spectra (right-sign)
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:253
void SelectCascade(const AliVEvent *event, Int_t nCasc, Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:295
THnSparse * fHistoEleXiMassWS2Away
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassRSMix1Away
! e-Xi mass spectra (right-sign)
TH2F * fHistoElectronTPCSelPID
! TPC electron PID after selection
void GetMCDecayHistory(AliAODMCParticle *mcpart, TClonesArray *mcArray, Int_t *pdgarray, Int_t *labelarray, Int_t &ngen)
void FillMixROOTObjects(TLorentzVector *et, TLorentzVector *ev, Int_t charge)
THnSparse * fHistoEleXiMassWSSide2Away
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassRS2Away
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassRSSide1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassRSSide1Away
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassRSMix
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtWSSide1
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtWS
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassWSMix
! e-Xi mass spectra (wrong-sign)
TH2D * fHistoResponseElePt
! Response function electron pT <- True ept
THnSparse * fHistoElePtvsXiPtMCXicGen
! e-Xi spectra efficiency denominator
THnSparse * fHistoEleXiMassRS1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsXiPtvsXicPtMCGen
! e-Xi spectra efficiency numerator
TH2F * fHistoLambdaPtvsDlSide
! Lambda proper life time distribution (sideband)
TTree * fVariablesTree
flag to decide whether to write the candidate variables on a tree variables