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