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