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