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