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