AliPhysics  vAN-20151014 (f894c76)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskSEXic2eleXifromAODtracks.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appeuear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //
19 //
20 // Xic->eXi analysis code
21 //
22 // Input: AOD
23 // Output: TTree or THnSparse (mass vs pT vs Centrality)
24 //
25 //-------------------------------------------------------------------------
26 //
27 // Authors: Y.S Watanabe(a)
28 // (a) CNS, the University of Tokyo
29 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
30 //-------------------------------------------------------------------------
31 
32 #include <TSystem.h>
33 #include <TParticle.h>
34 #include <TParticlePDG.h>
35 #include <TH1F.h>
36 #include <TH1F.h>
37 #include <TH2F.h>
38 #include <THnSparse.h>
39 #include <TLorentzVector.h>
40 #include <TTree.h>
41 #include "TROOT.h"
42 #include <TDatabasePDG.h>
43 #include <AliAnalysisDataSlot.h>
44 #include <AliAnalysisDataContainer.h>
45 #include "AliStack.h"
46 #include "AliMCEvent.h"
47 #include "AliAnalysisManager.h"
48 #include "AliAODMCHeader.h"
49 #include "AliAODHandler.h"
50 #include "AliLog.h"
51 #include "AliExternalTrackParam.h"
52 #include "AliAODVertex.h"
53 #include "AliESDVertex.h"
54 #include "AliAODRecoDecay.h"
55 #include "AliAODRecoDecayHF.h"
56 #include "AliAODRecoCascadeHF.h"
57 #include "AliESDtrack.h"
58 #include "AliAODTrack.h"
59 #include "AliAODv0.h"
60 #include "AliAODcascade.h"
61 #include "AliAODMCParticle.h"
62 #include "AliAnalysisTaskSE.h"
64 #include "AliPIDResponse.h"
65 #include "AliPIDCombined.h"
66 #include "AliTOFPIDResponse.h"
67 #include "AliAODPidHF.h"
68 #include "AliInputEventHandler.h"
69 #include "AliESDtrackCuts.h"
70 #include "AliNeutralTrackParam.h"
71 #include "AliKFParticle.h"
72 #include "AliKFVertex.h"
73 #include "AliExternalTrackParam.h"
74 #include "AliESDtrack.h"
75 #include "AliCentrality.h"
76 #include "AliVertexerTracks.h"
77 #include "AliEventPoolManager.h"
79 
80 using std::cout;
81 using std::endl;
82 
86 
87 //__________________________________________________________________________
89  AliAnalysisTaskSE(),
90  fUseMCInfo(kFALSE),
91  fOutput(0),
92  fOutputAll(0),
93  fListCuts(0),
94  fCEvents(0),
95  fHTrigger(0),
96  fHCentrality(0),
97  fAnalCuts(0),
98  fIsEventSelected(kFALSE),
99  fWriteVariableTree(kFALSE),
100  fWriteEachVariableTree(kFALSE),
101  fWriteMCVariableTree(kFALSE),
102  fVariablesTree(0),
103  fEleVariablesTree(0),
104  fCascVariablesTree(0),
105  fMCVariablesTree(0),
106  fMCEleVariablesTree(0),
107  fMCCascVariablesTree(0),
108  fReconstructPrimVert(kFALSE),
109  fIsMB(kFALSE),
110  fIsSemi(kFALSE),
111  fIsCent(kFALSE),
112  fIsINT7(kFALSE),
113  fIsEMC7(kFALSE),
114  fCandidateVariables(),
115  fCandidateEleVariables(),
116  fCandidateCascVariables(),
117  fCandidateMCVariables(),
118  fCandidateMCEleVariables(),
119  fCandidateMCCascVariables(),
120  fVtx1(0),
121  fV1(0),
122  fVtxZ(0),
123  fBzkG(0),
124  fCentrality(0),
125  fRunNumber(0),
126  fTriggerCheck(0),
127  fUseCentralityV0M(kFALSE),
128  fEvNumberCounter(0),
129  fHistoEleXiMass(0),
130  fHistoEleXiMassRS(0),
131  fHistoEleXiMassWS(0),
132  fHistoEleXiMassRSMix(0),
133  fHistoEleXiMassWSMix(0),
134  fHistoEleXiMassRSSide(0),
135  fHistoEleXiMassWSSide(0),
136  fHistoEleXiMassRS1(0),
137  fHistoEleXiMassWS1(0),
138  fHistoEleXiMassRSMix1(0),
139  fHistoEleXiMassWSMix1(0),
140  fHistoEleXiMassRSSide1(0),
141  fHistoEleXiMassWSSide1(0),
142  fHistoEleXiMassRS2(0),
143  fHistoEleXiMassWS2(0),
144  fHistoEleXiMassRSMix2(0),
145  fHistoEleXiMassWSMix2(0),
146  fHistoEleXiMassRSSide2(0),
147  fHistoEleXiMassWSSide2(0),
148  fHistoEleXiMassvsElePtRS(0),
149  fHistoEleXiMassvsElePtWS(0),
150  fHistoEleXiMassvsElePtRSMix(0),
151  fHistoEleXiMassvsElePtWSMix(0),
152  fHistoEleXiMassvsElePtRSSide(0),
153  fHistoEleXiMassvsElePtWSSide(0),
154  fHistoEleXiMassvsElePtRS1(0),
155  fHistoEleXiMassvsElePtWS1(0),
156  fHistoEleXiMassvsElePtRSMix1(0),
157  fHistoEleXiMassvsElePtWSMix1(0),
158  fHistoEleXiMassvsElePtRSSide1(0),
159  fHistoEleXiMassvsElePtWSSide1(0),
160  fHistoEleXiMassvsElePtRS2(0),
161  fHistoEleXiMassvsElePtWS2(0),
162  fHistoEleXiMassvsElePtRSMix2(0),
163  fHistoEleXiMassvsElePtWSMix2(0),
164  fHistoEleXiMassvsElePtRSSide2(0),
165  fHistoEleXiMassvsElePtWSSide2(0),
166  fHistoElePtRS(0),
167  fHistoElePtWS(0),
168  fHistoElePtRSMix(0),
169  fHistoElePtWSMix(0),
170  fHistoEleXiMassMCS(0),
171  fHistoEleXiMassMCGen(0),
172  fHistoEleXiMassvsElePtMCS(0),
173  fHistoEleXiMassvsElePtMCGen(0),
174  fHistoEleXiMassvsElePtMCS1(0),
175  fHistoEleXiMassvsElePtMCGen1(0),
176  fHistoEleXiMassvsElePtMCS2(0),
177  fHistoEleXiMassvsElePtMCGen2(0),
178  fHistoElePtMCS(0),
179  fHistoElePtMCGen(0),
180  fHistoElePtvsEtaRS(0),
181  fHistoElePtvsEtaWS(0),
182  fHistoElePtvsEtaRSMix(0),
183  fHistoElePtvsEtaWSMix(0),
184  fHistoElePtvsEtaMCS(0),
185  fHistoElePtvsEtaMCGen(0),
186  fHistoElePtvsXiPtRS(0),
187  fHistoElePtvsXiPtWS(0),
188  fHistoElePtvsXiPtRSMix(0),
189  fHistoElePtvsXiPtWSMix(0),
190  fHistoElePtvsXiPtMCS(0),
191  fHistoElePtvsXiPtvsXicPtMCS(0),
192  fHistoElePtvsXiPtMCGen(0),
193  fHistoElePtvsXiPtvsXicPtMCGen(0),
194  fHistoElePtvsXiPtMCXicGen(0),
195  fHistoElePtvsd0RS(0),
196  fHistoElePtvsd0WS(0),
197  fHistoElePtvsd0RSMix(0),
198  fHistoElePtvsd0WSMix(0),
199  fHistoElePtvsd0MCS(0),
200  fHistoElePtvsd0PromptMCS(0),
201  fHistoElePtvsd0BFeeddownMCS(0),
202  fHistoBachPt(0),
203  fHistoBachPtMCS(0),
204  fHistoBachPtMCGen(0),
205  fHistod0Bach(0),
206  fHistoXiMassvsPt(0),
207  fHistoXiMassvsPtMCS(0),
208  fHistoXiMassvsPtMCGen(0),
209  fHistoOmegaMassvsPt(0),
210  fHistoElectronTPCPID(0),
211  fHistoElectronTOFPID(0),
212  fHistoElectronTPCSelPID(0),
213  fHistoElectronTOFSelPID(0),
214  fHistoElectronTPCPIDSelTOF(0),
215  fHistoElectronTOFPIDSelTPC(0),
216  fHistoElectronTPCPIDSelTOFSmallEta(0),
217  fHistoElectronTPCPIDSelTOFLargeEta(0),
218  fHistoElectronQovPtvsPhi(0),
219  fHistoXiQovPtvsPhi(0),
220  fHistoXicMCGen(0),
221  fHistoXicMCGen1(0),
222  fHistoXicMCGen2(0),
223  fHistoXicMCS(0),
224  fHistoXicMCS1(0),
225  fHistoXicMCS2(0),
226  fHistoXicElectronMCGen(0),
227  fHistoXicElectronMCGen1(0),
228  fHistoXicElectronMCGen2(0),
229  fHistoXicElectronMCS(0),
230  fHistoXicElectronMCS1(0),
231  fHistoXicElectronMCS2(0),
232  fHistoElectronMCGen(0),
233  fHistoXiMCGen(0),
234  fHistoLambdaPtvsDl(0),
235  fHistoLambdaPtvsDlSide(0),
236  fHistoLambdaPtvsDlMCS(0),
237  fHistoResponseElePt(0),
238  fHistoResponseEleXiPt(0),
239  fCounter(0),
240  fHistonEvtvsRunNumber(0),
241  fHistonElevsRunNumber(0),
242  fHistonXivsRunNumber(0),
243  fDoEventMixing(0),
244  fNumberOfEventsForMixing (5),
245  fNzVtxBins (0),
246  fNCentBins (0),
247  fNOfPools(1),
248  fEventBuffer(0x0),
249  fEventInfo(0x0),
250  fElectronTracks(0x0),
251  fCascadeTracks1(0x0),
252  fCascadeTracks2(0x0)
253 {
254  //
255  // Default Constructor.
256  //
257  for(Int_t i=0;i<23;i++){
258  fHistoElePtvsCutVarsRS[i] = 0;
259  fHistoElePtvsCutVarsWS[i] = 0;
261  }
262  for(Int_t i=0;i<8;i++){
264  }
265 }
266 
267 //___________________________________________________________________________
270  Bool_t writeVariableTree) :
271  AliAnalysisTaskSE(name),
272  fUseMCInfo(kFALSE),
273  fOutput(0),
274  fOutputAll(0),
275  fListCuts(0),
276  fCEvents(0),
277  fHTrigger(0),
278  fHCentrality(0),
279  fAnalCuts(analCuts),
280  fIsEventSelected(kFALSE),
281  fWriteVariableTree(writeVariableTree),
282  fWriteEachVariableTree(kFALSE),
283  fWriteMCVariableTree(kFALSE),
284  fVariablesTree(0),
285  fEleVariablesTree(0),
286  fCascVariablesTree(0),
287  fMCVariablesTree(0),
288  fMCEleVariablesTree(0),
289  fMCCascVariablesTree(0),
290  fReconstructPrimVert(kFALSE),
291  fIsMB(kFALSE),
292  fIsSemi(kFALSE),
293  fIsCent(kFALSE),
294  fIsINT7(kFALSE),
295  fIsEMC7(kFALSE),
296  fCandidateVariables(),
297  fCandidateEleVariables(),
298  fCandidateCascVariables(),
299  fCandidateMCVariables(),
300  fCandidateMCEleVariables(),
301  fCandidateMCCascVariables(),
302  fVtx1(0),
303  fV1(0),
304  fVtxZ(0),
305  fBzkG(0),
306  fCentrality(0),
307  fRunNumber(0),
308  fTriggerCheck(0),
309  fUseCentralityV0M(kFALSE),
310  fEvNumberCounter(0),
311  fHistoEleXiMass(0),
312  fHistoEleXiMassRS(0),
313  fHistoEleXiMassWS(0),
314  fHistoEleXiMassRSMix(0),
315  fHistoEleXiMassWSMix(0),
316  fHistoEleXiMassRSSide(0),
317  fHistoEleXiMassWSSide(0),
318  fHistoEleXiMassRS1(0),
319  fHistoEleXiMassWS1(0),
320  fHistoEleXiMassRSMix1(0),
321  fHistoEleXiMassWSMix1(0),
322  fHistoEleXiMassRSSide1(0),
323  fHistoEleXiMassWSSide1(0),
324  fHistoEleXiMassRS2(0),
325  fHistoEleXiMassWS2(0),
326  fHistoEleXiMassRSMix2(0),
327  fHistoEleXiMassWSMix2(0),
328  fHistoEleXiMassRSSide2(0),
329  fHistoEleXiMassWSSide2(0),
330  fHistoEleXiMassvsElePtRS(0),
331  fHistoEleXiMassvsElePtWS(0),
332  fHistoEleXiMassvsElePtRSMix(0),
333  fHistoEleXiMassvsElePtWSMix(0),
334  fHistoEleXiMassvsElePtRSSide(0),
335  fHistoEleXiMassvsElePtWSSide(0),
336  fHistoEleXiMassvsElePtRS1(0),
337  fHistoEleXiMassvsElePtWS1(0),
338  fHistoEleXiMassvsElePtRSMix1(0),
339  fHistoEleXiMassvsElePtWSMix1(0),
340  fHistoEleXiMassvsElePtRSSide1(0),
341  fHistoEleXiMassvsElePtWSSide1(0),
342  fHistoEleXiMassvsElePtRS2(0),
343  fHistoEleXiMassvsElePtWS2(0),
344  fHistoEleXiMassvsElePtRSMix2(0),
345  fHistoEleXiMassvsElePtWSMix2(0),
346  fHistoEleXiMassvsElePtRSSide2(0),
347  fHistoEleXiMassvsElePtWSSide2(0),
348  fHistoElePtRS(0),
349  fHistoElePtWS(0),
350  fHistoElePtRSMix(0),
351  fHistoElePtWSMix(0),
352  fHistoEleXiMassMCS(0),
353  fHistoEleXiMassMCGen(0),
354  fHistoEleXiMassvsElePtMCS(0),
355  fHistoEleXiMassvsElePtMCGen(0),
356  fHistoEleXiMassvsElePtMCS1(0),
357  fHistoEleXiMassvsElePtMCGen1(0),
358  fHistoEleXiMassvsElePtMCS2(0),
359  fHistoEleXiMassvsElePtMCGen2(0),
360  fHistoElePtMCS(0),
361  fHistoElePtMCGen(0),
362  fHistoElePtvsEtaRS(0),
363  fHistoElePtvsEtaWS(0),
364  fHistoElePtvsEtaRSMix(0),
365  fHistoElePtvsEtaWSMix(0),
366  fHistoElePtvsEtaMCS(0),
367  fHistoElePtvsEtaMCGen(0),
368  fHistoElePtvsXiPtRS(0),
369  fHistoElePtvsXiPtWS(0),
370  fHistoElePtvsXiPtRSMix(0),
371  fHistoElePtvsXiPtWSMix(0),
372  fHistoElePtvsXiPtMCS(0),
373  fHistoElePtvsXiPtvsXicPtMCS(0),
374  fHistoElePtvsXiPtMCGen(0),
375  fHistoElePtvsXiPtvsXicPtMCGen(0),
376  fHistoElePtvsXiPtMCXicGen(0),
377  fHistoElePtvsd0RS(0),
378  fHistoElePtvsd0WS(0),
379  fHistoElePtvsd0RSMix(0),
380  fHistoElePtvsd0WSMix(0),
381  fHistoElePtvsd0MCS(0),
382  fHistoElePtvsd0PromptMCS(0),
383  fHistoElePtvsd0BFeeddownMCS(0),
384  fHistoBachPt(0),
385  fHistoBachPtMCS(0),
386  fHistoBachPtMCGen(0),
387  fHistod0Bach(0),
388  fHistoXiMassvsPt(0),
389  fHistoXiMassvsPtMCS(0),
390  fHistoXiMassvsPtMCGen(0),
391  fHistoOmegaMassvsPt(0),
392  fHistoElectronTPCPID(0),
393  fHistoElectronTOFPID(0),
394  fHistoElectronTPCSelPID(0),
395  fHistoElectronTOFSelPID(0),
396  fHistoElectronTPCPIDSelTOF(0),
397  fHistoElectronTOFPIDSelTPC(0),
398  fHistoElectronTPCPIDSelTOFSmallEta(0),
399  fHistoElectronTPCPIDSelTOFLargeEta(0),
400  fHistoElectronQovPtvsPhi(0),
401  fHistoXiQovPtvsPhi(0),
402  fHistoXicMCGen(0),
403  fHistoXicMCGen1(0),
404  fHistoXicMCGen2(0),
405  fHistoXicMCS(0),
406  fHistoXicMCS1(0),
407  fHistoXicMCS2(0),
408  fHistoXicElectronMCGen(0),
409  fHistoXicElectronMCGen1(0),
410  fHistoXicElectronMCGen2(0),
411  fHistoXicElectronMCS(0),
412  fHistoXicElectronMCS1(0),
413  fHistoXicElectronMCS2(0),
414  fHistoElectronMCGen(0),
415  fHistoXiMCGen(0),
416  fHistoLambdaPtvsDl(0),
417  fHistoLambdaPtvsDlSide(0),
418  fHistoLambdaPtvsDlMCS(0),
419  fHistoResponseElePt(0),
420  fHistoResponseEleXiPt(0),
421  fCounter(0),
422  fHistonEvtvsRunNumber(0),
423  fHistonElevsRunNumber(0),
424  fHistonXivsRunNumber(0),
425  fDoEventMixing(0),
426  fNumberOfEventsForMixing (5),
427  fNzVtxBins (0),
428  fNCentBins (0),
429  fNOfPools(1),
430  fEventBuffer(0x0),
431  fEventInfo(0x0),
432  fElectronTracks(0x0),
433  fCascadeTracks1(0x0),
434  fCascadeTracks2(0x0)
435 {
436  //
437  // Constructor. Initialization of Inputs and Outputs
438  //
439  Info("AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Constructor");
440 
441  for(Int_t i=0;i<23;i++){
442  fHistoElePtvsCutVarsRS[i] = 0;
443  fHistoElePtvsCutVarsWS[i] = 0;
445  }
446  for(Int_t i=0;i<8;i++){
448  }
449 
450  DefineOutput(1,TList::Class()); //conters
451  DefineOutput(2,TList::Class());
452  DefineOutput(3,TList::Class()); //conters
453  DefineOutput(4,TTree::Class()); //My private output
454  DefineOutput(5,TTree::Class()); //My private output
455  DefineOutput(6,TTree::Class()); //My private output
456  DefineOutput(7,TTree::Class()); //My private output
457  DefineOutput(8,AliNormalizationCounter::Class());
458  DefineOutput(9,TTree::Class()); //My private output
459  DefineOutput(10,TTree::Class()); //My private output
460 }
461 
462 //___________________________________________________________________________
464  //
465  // destructor
466  //
467  Info("~AliAnalysisTaskSEXic2eleXifromAODtracks","Calling Destructor");
468 
469  if (fOutput) {
470  delete fOutput;
471  fOutput = 0;
472  }
473 
474  if (fOutputAll) {
475  delete fOutputAll;
476  fOutputAll = 0;
477  }
478 
479  if (fListCuts) {
480  delete fListCuts;
481  fListCuts = 0;
482  }
483 
484 
485  if (fAnalCuts) {
486  delete fAnalCuts;
487  fAnalCuts = 0;
488  }
489 
490  if (fVariablesTree) {
491  delete fVariablesTree;
492  fVariablesTree = 0;
493  }
494  if (fEleVariablesTree) {
495  delete fEleVariablesTree;
496  fEleVariablesTree = 0;
497  }
498  if (fCascVariablesTree) {
499  delete fCascVariablesTree;
500  fCascVariablesTree = 0;
501  }
502  if (fMCVariablesTree) {
503  delete fMCVariablesTree;
504  fMCVariablesTree = 0;
505  }
506  if (fMCEleVariablesTree) {
507  delete fMCEleVariablesTree;
509  }
510  if (fMCCascVariablesTree) {
511  delete fMCCascVariablesTree;
513  }
514  if(fCounter){
515  delete fCounter;
516  fCounter = 0;
517  }
518 
519  if(fElectronTracks) fElectronTracks->Delete();
520  delete fElectronTracks;
521  if(fCascadeTracks1) fCascadeTracks1->Delete();
522  delete fCascadeTracks1;
523  if(fCascadeTracks2) fCascadeTracks2->Delete();
524  delete fCascadeTracks2;
525  if(fEventBuffer){
526  for(Int_t i=0; i<fNOfPools; i++) delete fEventBuffer[i];
527  delete fEventBuffer;
528  }
529  delete fEventInfo;
530 }
531 
532 //_________________________________________________
534  //
535  // Initialization
536  //
537  //
538 
539  fIsEventSelected=kFALSE;
540 
541  if (fDebug > 1) AliInfo("Init");
542 
543  fListCuts = new TList();
544  fListCuts->SetOwner();
545  fListCuts->SetName("ListCuts");
547  PostData(2,fListCuts);
548 
549  return;
550 }
551 
552 //_________________________________________________
554 {
555  //
556  // UserExec
557  //
558 
559  if (!fInputEvent) {
560  AliError("NO EVENT FOUND!");
561  return;
562  }
563  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
564 
565  fCEvents->Fill(1);
567 
568  //------------------------------------------------
569  // First check if the event has proper B
570  //------------------------------------------------
571  fBzkG = (Double_t)aodEvent->GetMagneticField();
572  AliKFParticle::SetField(fBzkG);
573  if (TMath::Abs(fBzkG)<0.001) {
574  return;
575  }
576  fCEvents->Fill(2);
577 
580 
581  //------------------------------------------------
582  // MC analysis setting
583  //------------------------------------------------
584  TClonesArray *mcArray = 0;
585  AliAODMCHeader *mcHeader=0;
586  if (fUseMCInfo) {
587  // MC array need for maching
588  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
589  if (!mcArray) {
590  AliError("Could not find Monte-Carlo in AOD");
591  return;
592  }
593  fCEvents->Fill(6); // in case of MC events
594 
595  // load MC header
596  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
597  if (!mcHeader) {
598  AliError("AliAnalysisTaskSEXic2eleXifromAODtracks::UserExec: MC header branch not found!\n");
599  return;
600  }
601  fCEvents->Fill(7); // in case of MC events
602 
603  Double_t zMCVertex = mcHeader->GetVtxZ();
604  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
605  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
606  return;
607  } else {
608  fCEvents->Fill(17); // in case of MC events
609  }
610  if ((TMath::Abs(zMCVertex) < fAnalCuts->GetMaxVtxZ()) && (!fAnalCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnalCuts->IsEventRejectedDueToTrigger())) {
611  MakeMCAnalysis(mcArray);
612  }
613  }
614 
615  //------------------------------------------------
616  // Event selection
617  //------------------------------------------------
618  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
619  if (!fVtx1) return;
620 
621  Double_t pos[3],cov[6];
622  fVtx1->GetXYZ(pos);
623  fVtx1->GetCovarianceMatrix(cov);
624  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
625  fVtxZ = pos[2];
626 
627  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
628  Bool_t fIsPhysSelNotOK = fAnalCuts->IsEventRejectedDuePhysicsSelection();
629  Bool_t fIsNoVertex = fAnalCuts->IsEventRejectedDueToNotRecoVertex();
630  if(!fIsTriggerNotOK && !fIsPhysSelNotOK && !fIsNoVertex && fabs(fVtx1->GetZ())<fAnalCuts->GetMaxVtxZ()) fCEvents->Fill(3);
631  if(!fIsEventSelected) {
632  delete fV1;
633  return;
634  }
635  fCEvents->Fill(4);
636 
637  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
638  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
639  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
640  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
641  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
643  if(fIsMB) fHTrigger->Fill(1);
644  if(fIsSemi) fHTrigger->Fill(2);
645  if(fIsCent) fHTrigger->Fill(3);
646  if(fIsINT7) fHTrigger->Fill(4);
647  if(fIsEMC7) fHTrigger->Fill(5);
648  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
649  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
650  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
651  if(fIsMB&fIsCent) fHTrigger->Fill(11);
652  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
653 
654  if(fUseCentralityV0M){
655  AliCentrality *cent = aodEvent->GetCentrality();
656  fCentrality = cent->GetCentralityPercentile("V0M");
657  }else{
658  fCentrality = 1.;
659  }
660  if(fCentrality<0.||fCentrality>100.-0.0000001) {
661  delete fV1;
662  return;
663  }
664  fHCentrality->Fill(fCentrality);
665  fRunNumber = aodEvent->GetRunNumber();
666 
667  Int_t runnumber_offset = 0;
668  Int_t runnumber = aodEvent->GetRunNumber();
669  if(runnumber<=131000&&runnumber>=114000){
670  runnumber_offset = 114000;//lhc10bcde
671  }else if(runnumber<=196000&&runnumber>=195000){
672  runnumber_offset = 195000;//lhc13bc
673  }else if(runnumber<=170593&&runnumber>=167902){
674  runnumber_offset = 167902;//lhc11h
675  }
676  fHistonEvtvsRunNumber->Fill(runnumber-runnumber_offset,1.);
677 
678  //------------------------------------------------
679  // Check if the event has v0 candidate
680  //------------------------------------------------
681  //Int_t nv0 = aodEvent->GetNumberOfV0s();
682  fCEvents->Fill(5);
683 
684 
685  //------------------------------------------------
686  // Main analysis done in this function
687  //------------------------------------------------
688  MakeAnalysis(aodEvent,mcArray);
689 
690 
691  PostData(1,fOutput);
692  PostData(3,fOutputAll);
693  PostData(4,fVariablesTree);
694  PostData(5,fEleVariablesTree);
695  PostData(6,fCascVariablesTree);
696  PostData(7,fMCVariablesTree);
697  PostData(8,fCounter);
698  PostData(9,fMCEleVariablesTree);
699  PostData(10,fMCCascVariablesTree);
700 
701  fIsEventSelected=kFALSE;
702 
703  delete fV1;
704  return;
705 }
706 
707 //________________________________________ terminate ___________________________
709 {
710  // The Terminate() function is the last function to be called during
711  // a query. It always runs on the client, it can be used to present
712  // the results graphically or save the results to file.
713 
714  //AliInfo("Terminate","");
715  AliAnalysisTaskSE::Terminate();
716 
717  fOutput = dynamic_cast<TList*> (GetOutputData(1));
718  if (!fOutput) {
719  AliError("fOutput not available");
720  return;
721  }
722 
723  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
724  if (!fOutputAll) {
725  AliError("fOutputAll not available");
726  return;
727  }
728 
729  return;
730 }
731 
732 //___________________________________________________________________________
734 {
735  //
736  // UserCreateOutputObject
737  //
738  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
739 
740  //------------------------------------------------
741  // output object setting
742  //------------------------------------------------
743  fOutput = new TList();
744  fOutput->SetOwner();
745  fOutput->SetName("chist0");
746  DefineGeneralHistograms(); // define general histograms
747  PostData(1,fOutput);
748 
749  fOutputAll = new TList();
750  fOutputAll->SetOwner();
751  fOutputAll->SetName("anahisto");
752  DefineAnalysisHistograms(); // define general histograms
753  PostData(3,fOutputAll);
754 
756  PostData(4,fVariablesTree);
757 
759  PostData(5,fEleVariablesTree);
760 
762  PostData(6,fCascVariablesTree);
763 
765  PostData(7,fMCVariablesTree);
766 
768  PostData(9,fMCEleVariablesTree);
769 
771  PostData(10,fMCCascVariablesTree);
772 
773  //Counter for Normalization
774  TString normName="NormalizationCounter";
775  AliAnalysisDataContainer *cont = GetOutputSlot(8)->GetContainer();
776  if(cont)normName=(TString)cont->GetName();
777  fCounter = new AliNormalizationCounter(normName.Data());
778  fCounter->Init();
779  PostData(8,fCounter);
780 
781  if(fDoEventMixing){
782  fElectronTracks = new TObjArray();
783  fElectronTracks->SetOwner();
784  fCascadeTracks1 = new TObjArray();
785  fCascadeTracks1->SetOwner();
786  fCascadeTracks2 = new TObjArray();
787  fCascadeTracks2->SetOwner();
788 
790  fEventBuffer = new TTree*[fNOfPools];
791  for(Int_t i=0; i<fNOfPools; i++){
792  fEventBuffer[i]=new TTree(Form("EventBuffer_%d",i), "Temporary buffer for event mixing");
793  fEventBuffer[i]->Branch("zVertex", &fVtxZ);
794  fEventBuffer[i]->Branch("centrality", &fCentrality);
795  fEventBuffer[i]->Branch("eventInfo", "TObjString",&fEventInfo);
796  fEventBuffer[i]->Branch("c1array", "TObjArray", &fCascadeTracks1);
797  fEventBuffer[i]->Branch("c2array", "TObjArray", &fCascadeTracks2);
798  }
799  }
800 
801 
802  return;
803 }
804 
805 //-------------------------------------------------------------------------------
807 (
808  AliAODEvent *aodEvent, TClonesArray *mcArray
809  )
810 {
811  //
812  // Main Analysis part
813  //
814  //------------------------------------------------
815  // Select good track before hand to save time
816  //------------------------------------------------
817  if(fDoEventMixing && fElectronTracks) fElectronTracks->Delete();
818  if(fDoEventMixing && fCascadeTracks1) fCascadeTracks1->Delete();
819  if(fDoEventMixing && fCascadeTracks2) fCascadeTracks2->Delete();
820 
821  Int_t nCascs= aodEvent->GetNumberOfCascades();
822  Int_t nTracks= aodEvent->GetNumberOfTracks();
823 
824  Bool_t seleTrkFlags[nTracks];
825  Int_t nSeleTrks=0;
826  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags,mcArray);
827 
828  Bool_t seleCascFlags[nCascs];
829  Int_t nSeleCasc=0;
830  SelectCascade(aodEvent,nCascs,nSeleCasc,seleCascFlags,mcArray);
831 
832  Int_t runnumber_offset = 0;
833  Int_t runnumber = aodEvent->GetRunNumber();
834  if(runnumber<=131000&&runnumber>=114000){
835  runnumber_offset = 114000;//lhc10bcde
836  }else if(runnumber<=196000&&runnumber>=195000){
837  runnumber_offset = 195000;//lhc13bc
838  }else if(runnumber<=170593&&runnumber>=167902){
839  runnumber_offset = 167902;//lhc11h
840  }
841  fHistonElevsRunNumber->Fill(runnumber-runnumber_offset,nSeleTrks);
842  fHistonXivsRunNumber->Fill(runnumber-runnumber_offset,nSeleCasc);
843 
844  //------------------------------------------------
845  // Cascade loop
846  //------------------------------------------------
847  for (Int_t icasc = 0; icasc<nCascs; icasc++) {
848  if(!seleCascFlags[icasc]) continue;
849  AliAODcascade *casc = aodEvent->GetCascade(icasc);
850  if(!casc) continue;
851 
852  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
853  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
854  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
855 
856  //------------------------------------------------
857  // track loop
858  //------------------------------------------------
859  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
860  if(!seleTrkFlags[itrk]) continue;
861  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
862  if(trk->GetID()<0) continue;
863 
864  Int_t cpid = cptrack->GetID();
865  Int_t cnid = cntrack->GetID();
866  Int_t cbid = cbtrack->GetID();
867  Int_t lpid = trk->GetID();
868  if((cpid==lpid)||(cnid==lpid)||(cbid==lpid)) continue;
869 
870  //if(!fAnalCuts->SelectWithRoughCuts(v0,trk)) continue;
871 
872  AliAODVertex *secVert = ReconstructSecondaryVertex(casc,trk,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
873  if(!secVert) continue;
874 
875  AliAODRecoCascadeHF *exobj = MakeCascadeHF(casc,trk,aodEvent,secVert);
876  if(!exobj) {
877  continue;
878  }
879 
880  FillROOTObjects(exobj, casc,trk,mcArray);
881 
882  exobj->GetSecondaryVtx()->RemoveDaughters();
883  exobj->UnsetOwnPrimaryVtx();
884  delete exobj;exobj=NULL;
885  delete secVert;
886  }
887  }
888 
889  if(fDoEventMixing){
890  fEventInfo->SetString(Form("Ev%d_esd%d_E%d_C%d",AliAnalysisManager::GetAnalysisManager()->GetNcalls(),((AliAODHeader*)aodEvent->GetHeader())->GetEventNumberESDFile(),fElectronTracks->GetEntries(),fCascadeTracks1->GetEntries()+fCascadeTracks2->GetEntries()));
891  Int_t ind=GetPoolIndex(fVtxZ,fCentrality);
892  if(ind>=0 && ind<fNOfPools){
893  if(fEventBuffer[ind]->GetEntries() >= fNumberOfEventsForMixing){
894  DoEventMixingWithPools(ind);
895  if(fEventBuffer[ind]->GetEntries() >= 20*fNumberOfEventsForMixing){
896  ResetPool(ind);
897  }
898  }
899  fEventBuffer[ind]->Fill();
900  }
901  }
902 }
903 
904 
907 {
908  //
909  // Define tree variables
910  //
911 
912  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
913  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
914  Int_t nVar = 90;
915  fCandidateVariables = new Float_t [nVar];
916  TString * fCandidateVariableNames = new TString[nVar];
917 
918  fCandidateVariableNames[ 0]="Centrality";
919  fCandidateVariableNames[ 1]="InvMassEleXi";
920  fCandidateVariableNames[ 2]="EleXiPt";
921  fCandidateVariableNames[ 3]="EleXiPx";
922  fCandidateVariableNames[ 4]="EleXiPy";
923  fCandidateVariableNames[ 5]="EleXiPz";
924  fCandidateVariableNames[ 6]="ElePx";
925  fCandidateVariableNames[ 7]="ElePy";
926  fCandidateVariableNames[ 8]="ElePz";
927  fCandidateVariableNames[ 9]="XiPx";
928  fCandidateVariableNames[10]="XiPy";
929  fCandidateVariableNames[11]="XiPz";
930  fCandidateVariableNames[12]="XiCharge";
931  fCandidateVariableNames[13]="MassXi";
932  fCandidateVariableNames[14]="MassLambda";
933  fCandidateVariableNames[15]="Eled0";
934  fCandidateVariableNames[16]="Xid0";
935  fCandidateVariableNames[17]="nSigmaTPCele";
936  fCandidateVariableNames[18]="nSigmaTOFele";
937  fCandidateVariableNames[19]="nSigmaTPCpr_etrk";
938  fCandidateVariableNames[20]="nSigmaTOFpr_etrk";
939  fCandidateVariableNames[21]="nSigmaTPCka_etrk";
940  fCandidateVariableNames[22]="nSigmaTOFka_etrk";
941  fCandidateVariableNames[23]="nSigmaTPCv0pr";
942  fCandidateVariableNames[24]="nSigmaTOFv0pr";
943  fCandidateVariableNames[25]="nSigmaTPCv0pi";
944  fCandidateVariableNames[26]="nSigmaTOFv0pi";
945  fCandidateVariableNames[27]="nSigmaTPCbachpi";
946  fCandidateVariableNames[28]="nSigmaTOFbachpi";
947  fCandidateVariableNames[29]="EleCharge";
948  fCandidateVariableNames[30]="Mixing";
949  fCandidateVariableNames[31]="DcaXiDaughters";
950  fCandidateVariableNames[32]="DcaV0Daughters";
951  fCandidateVariableNames[33]="DecayLengthXi";
952  fCandidateVariableNames[34]="CosPointingAngleXi";
953  fCandidateVariableNames[35]="DcaV0toPrimVertex";
954  fCandidateVariableNames[36]="DcaPostoPrimVertex";
955  fCandidateVariableNames[37]="DcaNegtoPrimVertex";
956  fCandidateVariableNames[38]="DcaBachtoPrimVertex";
957  fCandidateVariableNames[39]="DecayLengthV0";
958  fCandidateVariableNames[40]="CosPointingAngleV0";
959 
960  fCandidateVariableNames[41]="mcpdgxic";
961  fCandidateVariableNames[42]="mclabxic";
962  fCandidateVariableNames[43]="mcxicpx";
963  fCandidateVariableNames[44]="mcxicpy";
964  fCandidateVariableNames[45]="mcxicpz";
965  fCandidateVariableNames[46]="mcelepx";
966  fCandidateVariableNames[47]="mcelepy";
967  fCandidateVariableNames[48]="mcelepz";
968  fCandidateVariableNames[49]="mccascpx";
969  fCandidateVariableNames[50]="mccascpy";
970  fCandidateVariableNames[51]="mccascpz";
971 
972  fCandidateVariableNames[52]="mcpdgele";
973  fCandidateVariableNames[53]="mcpdgcasc";
974  fCandidateVariableNames[54]="mcpdgmomele";
975  fCandidateVariableNames[55]="mcpdgmomcasc";
976  fCandidateVariableNames[56]="mcpdggrmomele";
977  fCandidateVariableNames[57]="mcpdggrmomcasc";
978  fCandidateVariableNames[58]="mcngenele";
979  fCandidateVariableNames[59]="mcngencasc";
980 
981  fCandidateVariableNames[60]="nSigmaTPCpi_etrk";
982  fCandidateVariableNames[61]="nSigmaTOFpi_etrk";
983 
984  fCandidateVariableNames[62]="V0PosPx";
985  fCandidateVariableNames[63]="V0PosPy";
986  fCandidateVariableNames[64]="V0PosPz";
987  fCandidateVariableNames[65]="V0NegPx";
988  fCandidateVariableNames[66]="V0NegPy";
989  fCandidateVariableNames[67]="V0NegPz";
990  fCandidateVariableNames[68]="V0VertX";
991  fCandidateVariableNames[69]="V0VertY";
992  fCandidateVariableNames[70]="V0VertZ";
993  fCandidateVariableNames[71]="BachPx";
994  fCandidateVariableNames[72]="BachPy";
995  fCandidateVariableNames[73]="BachPz";
996  fCandidateVariableNames[74]="XiVertX";
997  fCandidateVariableNames[75]="XiVertY";
998  fCandidateVariableNames[76]="XiVertZ";
999  fCandidateVariableNames[77]="PrimVertX";
1000  fCandidateVariableNames[78]="PrimVertY";
1001  fCandidateVariableNames[79]="PrimVertZ";
1002 
1003  fCandidateVariableNames[80]="MassOmega";
1004 
1005  fCandidateVariableNames[81]= "EleITSMatch";
1006  fCandidateVariableNames[82]= "BachITSMatch";
1007  fCandidateVariableNames[83]= "V0PosITSMatch";
1008  fCandidateVariableNames[84]= "V0NegITSMatch";
1009 
1010  fCandidateVariableNames[85]= "TPCNclsF";
1011  fCandidateVariableNames[86]= "TPCNcls";
1012  fCandidateVariableNames[87]= "TPCNclsS";
1013  fCandidateVariableNames[88]= "IsXiPeakReagion";
1014 
1015 
1016  fCandidateVariableNames[89]="EvNumber";
1017 
1018  for (Int_t ivar=0; ivar<nVar; ivar++) {
1019  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1020  }
1021 
1022  return;
1023 }
1024 
1026 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *exobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray)
1027 {
1028  //
1029  // Fill histograms or tree depending on fWriteVariableTree
1030  //
1031  if(!trk) return;
1032  if(!casc) return;
1033 
1034  for(Int_t i=0;i<90;i++){
1035  fCandidateVariables[i] = -9999.;
1036  }
1037 
1038 
1039  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
1040  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
1041  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
1042  if(cptrack->Charge()<0 && cntrack->Charge()>0){
1043  cptrack = (AliAODTrack*)(casc->GetDaughter(1));
1044  cntrack = (AliAODTrack*)(casc->GetDaughter(0));
1045  }
1046 // Double_t d0z0[2],covd0z0[3];
1047 // cptrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1048 // cntrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1049 // cbtrack->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);//propagate to primary vertex for debugging
1050 
1051  Double_t posVtx[3] = {0.,0.,0.};
1052  fVtx1->GetXYZ(posVtx);
1053 
1054 
1056  UInt_t pdgdg[2]={11,3312};
1057  fCandidateVariables[ 1] = exobj->InvMass(2,pdgdg);
1058  fCandidateVariables[ 2] = exobj->Pt();
1059  fCandidateVariables[ 3] = exobj->Px();
1060  fCandidateVariables[ 4] = exobj->Py();
1061  fCandidateVariables[ 5] = exobj->Pz();
1062  fCandidateVariables[ 6] = exobj->PxProng(0);
1063  fCandidateVariables[ 7] = exobj->PyProng(0);
1064  fCandidateVariables[ 8] = exobj->PzProng(0);
1065  fCandidateVariables[ 9] = exobj->PxProng(1);
1066  fCandidateVariables[10] = exobj->PyProng(1);
1067  fCandidateVariables[11] = exobj->PzProng(1);
1068  fCandidateVariables[12] = casc->ChargeXi();
1069  fCandidateVariables[13] = casc->MassXi();
1070  if(casc->ChargeXi()<0)
1071  fCandidateVariables[14] = casc->MassLambda();
1072  else
1073  fCandidateVariables[14] = casc->MassAntiLambda();
1074  fCandidateVariables[15] = exobj->Getd0Prong(0);
1075  fCandidateVariables[16] = exobj->Getd0Prong(1);
1076 
1077  Double_t nSigmaTPCele = -9999.;
1078  Double_t nSigmaTOFele = -9999.;
1079  if(fAnalCuts->GetIsUsePID())
1080  {
1081  nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
1082  nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
1083  fCandidateVariables[17] = nSigmaTPCele;
1084  fCandidateVariables[18] = nSigmaTOFele;
1085 
1086  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
1087  Double_t nSigmaTOFpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kProton);
1088  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
1089  Double_t nSigmaTOFka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kKaon);
1090  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
1091  Double_t nSigmaTOFpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kPion);
1092  fCandidateVariables[19] = nSigmaTPCpr_etrk;
1093  fCandidateVariables[20] = nSigmaTOFpr_etrk;
1094  fCandidateVariables[21] = nSigmaTPCka_etrk;
1095  fCandidateVariables[22] = nSigmaTOFka_etrk;
1096  fCandidateVariables[60] = nSigmaTPCpi_etrk;
1097  fCandidateVariables[61] = nSigmaTOFpi_etrk;
1098  }
1099 
1100  Double_t nSigmaTPCv0pr=-9999.;
1101  Double_t nSigmaTOFv0pr=-9999.;
1102  Double_t nSigmaTPCv0pi=-9999.;
1103  Double_t nSigmaTOFv0pi=-9999.;
1104  Double_t nSigmaTPCbachpi=-9999.;
1105  Double_t nSigmaTOFbachpi=-9999.;
1107  {
1108  if(casc->ChargeXi()>0){
1109  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
1110  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
1111  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
1112  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
1113  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1114  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1115  }else{
1116  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
1117  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
1118  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
1119  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
1120  nSigmaTPCbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kPion);
1121  nSigmaTOFbachpi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kPion);
1122  }
1123  fCandidateVariables[23] = nSigmaTPCv0pr;
1124  fCandidateVariables[24] = nSigmaTOFv0pr;
1125  fCandidateVariables[25] = nSigmaTPCv0pi;
1126  fCandidateVariables[26] = nSigmaTOFv0pi;
1127  fCandidateVariables[27] = nSigmaTPCbachpi;
1128  fCandidateVariables[28] = nSigmaTOFbachpi;
1129  }
1130  fCandidateVariables[29] = trk->Charge();
1131  fCandidateVariables[30] = 0;
1132  fCandidateVariables[31] = casc->DcaXiDaughters();
1133  fCandidateVariables[32] = casc->DcaV0Daughters();
1134  fCandidateVariables[33] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
1135  fCandidateVariables[34] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1136  fCandidateVariables[35] = casc->DcaV0ToPrimVertex();
1137  fCandidateVariables[36] = casc->DcaPosToPrimVertex();
1138  fCandidateVariables[37] = casc->DcaNegToPrimVertex();
1139  fCandidateVariables[38] = casc->DcaBachToPrimVertex();
1140  fCandidateVariables[39] = casc->DecayLengthV0();
1141  fCandidateVariables[40] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1142 
1143  AliAODMCParticle *mcxic = 0;
1144  AliAODMCParticle *mcele = 0;
1145  AliAODMCParticle *mccasc = 0;
1146  Int_t mclabxic = 0;
1147  Int_t mcpdgele_array[100];
1148  Int_t mcpdgcasc_array[100];
1149  Int_t mclabelele_array[100];
1150  Int_t mclabelcasc_array[100];
1151  Int_t mcngen_ele = -9999;
1152  Int_t mcngen_casc = -9999;
1153 
1154  if(fUseMCInfo && mcArray){
1155 
1156  mclabxic = MatchToMC(exobj,mcArray,mcpdgele_array, mcpdgcasc_array,mclabelele_array,mclabelcasc_array,mcngen_ele,mcngen_casc);
1157 
1158  if(mclabxic>-1){
1159  mcxic = (AliAODMCParticle*) mcArray->At(mclabxic);
1160  if(mclabelele_array[0]>=0)
1161  mcele = (AliAODMCParticle*) mcArray->At(mclabelele_array[0]);
1162  if(mclabelcasc_array[0]>=0)
1163  mccasc = (AliAODMCParticle*) mcArray->At(mclabelcasc_array[0]);
1164  if(mcxic){
1165  fCandidateVariables[41] = mcxic->GetPdgCode();
1166  fCandidateVariables[42] = mcxic->Label();
1167  fCandidateVariables[43] = mcxic->Px();
1168  fCandidateVariables[44] = mcxic->Py();
1169  fCandidateVariables[45] = mcxic->Pz();
1170  }
1171  if(mcele){
1172  fCandidateVariables[46] = mcele->Px();
1173  fCandidateVariables[47] = mcele->Py();
1174  fCandidateVariables[48] = mcele->Pz();
1175  }
1176  if(mccasc){
1177  fCandidateVariables[49] = mccasc->Px();
1178  fCandidateVariables[50] = mccasc->Py();
1179  fCandidateVariables[51] = mccasc->Pz();
1180  }
1181  }
1182  fCandidateVariables[52] = mcpdgele_array[0];
1183  fCandidateVariables[53] = mcpdgcasc_array[0];
1184  fCandidateVariables[54] = mcpdgele_array[1];
1185  fCandidateVariables[55] = mcpdgcasc_array[1];
1186  fCandidateVariables[56] = mcpdgele_array[2];
1187  fCandidateVariables[57] = mcpdgcasc_array[2];
1188  fCandidateVariables[58] = mcngen_ele;
1189  fCandidateVariables[59] = mcngen_casc;
1190  }
1191  fCandidateVariables[62] = casc->MomPosX();
1192  fCandidateVariables[63] = casc->MomPosY();
1193  fCandidateVariables[64] = casc->MomPosZ();
1194  fCandidateVariables[65] = casc->MomNegX();
1195  fCandidateVariables[66] = casc->MomNegY();
1196  fCandidateVariables[67] = casc->MomNegZ();
1197  fCandidateVariables[68] = casc->DecayVertexV0X();
1198  fCandidateVariables[69] = casc->DecayVertexV0Y();
1199  fCandidateVariables[70] = casc->DecayVertexV0Z();
1200  fCandidateVariables[71] = casc->MomBachX();
1201  fCandidateVariables[72] = casc->MomBachY();
1202  fCandidateVariables[73] = casc->MomBachZ();
1203  fCandidateVariables[74] = casc->DecayVertexXiX();
1204  fCandidateVariables[75] = casc->DecayVertexXiY();
1205  fCandidateVariables[76] = casc->DecayVertexXiZ();
1206  fCandidateVariables[77] = fVtx1->GetX();
1207  fCandidateVariables[78] = fVtx1->GetY();
1208  fCandidateVariables[79] = fVtx1->GetZ();
1209 
1210  fCandidateVariables[80] = casc->MassOmega();
1211 
1212  if(trk) fCandidateVariables[81] = trk->GetITSClusterMap();
1213  if(cbtrack) fCandidateVariables[82] = cbtrack->GetITSClusterMap();
1214  if(cptrack) fCandidateVariables[83] = cptrack->GetITSClusterMap();
1215  if(cntrack) fCandidateVariables[84] = cntrack->GetITSClusterMap();
1216 
1217  fCandidateVariables[85] = trk->GetTPCNclsF();
1218  fCandidateVariables[86] = trk->GetTPCNcls();
1219  fCandidateVariables[87] = trk->GetTPCnclsS();
1221 
1223 
1224  if(fWriteVariableTree)
1225  fVariablesTree->Fill();
1226 
1227  Double_t cont[3];
1228  cont[0] = exobj->InvMass(2,pdgdg);
1229  cont[1] = exobj->Pt();
1230  cont[2] = fCentrality;
1231  fHistoEleXiMass->Fill(cont);
1232 
1233  Double_t cont2[3];
1234  cont2[0] = exobj->InvMass(2,pdgdg);
1235  cont2[1] = trk->Pt();
1236  cont2[2] = fCentrality;
1237 
1238  Double_t cont_eleptvseta[3];
1239  cont_eleptvseta[0] = trk->Pt();
1240  cont_eleptvseta[1] = trk->Eta();
1241  cont_eleptvseta[2] = fCentrality;
1242 
1243  Double_t cont_eleptvsxipt[3];
1244  cont_eleptvsxipt[0] = trk->Pt();
1245  cont_eleptvsxipt[1] = sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY());
1246  cont_eleptvsxipt[2] = fCentrality;
1247 
1248  Double_t cont_eleptvsd0[3];
1249  cont_eleptvsd0[0] = trk->Pt();
1250  cont_eleptvsd0[1] = exobj->Getd0Prong(0)*trk->Charge();
1251  cont_eleptvsd0[2] = fCentrality;
1252 
1254  {
1255  if(trk->Charge()*casc->ChargeXi()<0){
1256  fHistoEleXiMassRS->Fill(cont);
1257  if(trk->Charge()>0) fHistoEleXiMassRS1->Fill(cont);
1258  else fHistoEleXiMassRS2->Fill(cont);
1259  fHistoEleXiMassvsElePtRS->Fill(cont2);
1260  if(trk->Charge()>0) fHistoEleXiMassvsElePtRS1->Fill(cont2);
1261  else fHistoEleXiMassvsElePtRS2->Fill(cont2);
1262  if(cont[0]<2.5){
1263  fHistoElePtRS->Fill(trk->Pt(),fCentrality);
1264  fHistoElePtvsEtaRS->Fill(cont_eleptvseta);
1265  fHistoElePtvsXiPtRS->Fill(cont_eleptvsxipt);
1266  fHistoElePtvsd0RS->Fill(cont_eleptvsd0);
1267  for(Int_t ih=0;ih<23;ih++){
1268  Double_t cont_eleptvscutvars[3];
1269  cont_eleptvscutvars[0] = trk->Pt();
1270  cont_eleptvscutvars[2] = fCentrality;
1271 
1272  if(ih==0){
1273  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1274  }else if(ih==1){
1275  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1276  }else if(ih==2){
1277  cont_eleptvscutvars[1] = nSigmaTPCele;
1278  }else if(ih==3){
1279  cont_eleptvscutvars[1] = nSigmaTOFele;
1280  }else if(ih==4){
1281  cont_eleptvscutvars[1] = trk->Eta();
1282  }else if(ih==5){
1283  cont_eleptvscutvars[1] = trk->GetITSNcls();
1284  }else if(ih==6){
1285  if(casc->ChargeXi()<0)
1286  cont_eleptvscutvars[1] = casc->MassLambda();
1287  else
1288  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1289  }else if(ih==7){
1290  cont_eleptvscutvars[1] = casc->MassXi();
1291  }else if(ih==8){
1292  Double_t lPosV0[3];
1293  lPosV0[0] = casc->DecayVertexV0X();
1294  lPosV0[1] = casc->DecayVertexV0Y();
1295  lPosV0[2] = casc->DecayVertexV0Z();
1296  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1297  }else if(ih==9){
1298  Double_t lPosXi[3];
1299  lPosXi[0] = casc->DecayVertexXiX();
1300  lPosXi[1] = casc->DecayVertexXiY();
1301  lPosXi[2] = casc->DecayVertexXiZ();
1302  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1303  }else if(ih==10){
1304  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1305  }else if(ih==11){
1306  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1307  }else if(ih==12){
1308  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1309  }else if(ih==13){
1310  if(casc->ChargeXi()<0.)
1311  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1312  else
1313  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1314  }else if(ih==14){
1315  if(casc->ChargeXi()>0.)
1316  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1317  else
1318  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1319  }else if(ih==15){
1320  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1321  }else if(ih==16){
1322  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1323  }else if(ih==17){
1324  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1325  }else if(ih==18){
1326  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1327  }else if(ih==19){
1328  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1329  }else if(ih==20){
1330  cont_eleptvscutvars[1] = casc->Eta();
1331  }else if(ih==21){
1332  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1333  }else if(ih==22){
1334  Double_t xipx = exobj->PxProng(1);
1335  Double_t xipy = exobj->PyProng(1);
1336  Double_t xipz = exobj->PzProng(1);
1337  Double_t epx = exobj->PxProng(0);
1338  Double_t epy = exobj->PyProng(0);
1339  Double_t epz = exobj->PzProng(0);
1340  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1341  }else{
1342  cont_eleptvscutvars[1] = -9999.;
1343  }
1344 
1345  fHistoElePtvsCutVarsRS[ih]->Fill(cont_eleptvscutvars);
1346  }
1347  }
1348  }else{
1349  fHistoEleXiMassWS->Fill(cont);
1350  if(trk->Charge()>0) fHistoEleXiMassWS1->Fill(cont);
1351  else fHistoEleXiMassWS2->Fill(cont);
1352  fHistoEleXiMassvsElePtWS->Fill(cont2);
1353  if(trk->Charge()>0) fHistoEleXiMassvsElePtWS1->Fill(cont2);
1354  else fHistoEleXiMassvsElePtWS2->Fill(cont2);
1355  if(cont[0]<2.5){
1356  fHistoElePtWS->Fill(trk->Pt(),fCentrality);
1357  fHistoElePtvsEtaWS->Fill(cont_eleptvseta);
1358  fHistoElePtvsXiPtWS->Fill(cont_eleptvsxipt);
1359  fHistoElePtvsd0WS->Fill(cont_eleptvsd0);
1360 
1361  for(Int_t ih=0;ih<23;ih++){
1362  Double_t cont_eleptvscutvars[3];
1363  cont_eleptvscutvars[0] = trk->Pt();
1364  cont_eleptvscutvars[2] = fCentrality;
1365 
1366  if(ih==0){
1367  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1368  }else if(ih==1){
1369  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1370  }else if(ih==2){
1371  cont_eleptvscutvars[1] = nSigmaTPCele;
1372  }else if(ih==3){
1373  cont_eleptvscutvars[1] = nSigmaTOFele;
1374  }else if(ih==4){
1375  cont_eleptvscutvars[1] = trk->Eta();
1376  }else if(ih==5){
1377  cont_eleptvscutvars[1] = trk->GetITSNcls();
1378  }else if(ih==6){
1379  if(casc->ChargeXi()<0)
1380  cont_eleptvscutvars[1] = casc->MassLambda();
1381  else
1382  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1383  }else if(ih==7){
1384  cont_eleptvscutvars[1] = casc->MassXi();
1385  }else if(ih==8){
1386  Double_t lPosV0[3];
1387  lPosV0[0] = casc->DecayVertexV0X();
1388  lPosV0[1] = casc->DecayVertexV0Y();
1389  lPosV0[2] = casc->DecayVertexV0Z();
1390  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1391  }else if(ih==9){
1392  Double_t lPosXi[3];
1393  lPosXi[0] = casc->DecayVertexXiX();
1394  lPosXi[1] = casc->DecayVertexXiY();
1395  lPosXi[2] = casc->DecayVertexXiZ();
1396  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1397  }else if(ih==10){
1398  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1399  }else if(ih==11){
1400  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1401  }else if(ih==12){
1402  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1403  }else if(ih==13){
1404  if(casc->ChargeXi()<0.)
1405  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1406  else
1407  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1408  }else if(ih==14){
1409  if(casc->ChargeXi()>0.)
1410  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1411  else
1412  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1413  }else if(ih==15){
1414  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1415  }else if(ih==16){
1416  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1417  }else if(ih==17){
1418  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1419  }else if(ih==18){
1420  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1421  }else if(ih==19){
1422  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1423  }else if(ih==20){
1424  cont_eleptvscutvars[1] = casc->Eta();
1425  }else if(ih==21){
1426  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1427  }else if(ih==22){
1428  Double_t xipx = exobj->PxProng(1);
1429  Double_t xipy = exobj->PyProng(1);
1430  Double_t xipz = exobj->PzProng(1);
1431  Double_t epx = exobj->PxProng(0);
1432  Double_t epy = exobj->PyProng(0);
1433  Double_t epz = exobj->PzProng(0);
1434  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1435  }else{
1436  cont_eleptvscutvars[1] = -9999.;
1437  }
1438 
1439  fHistoElePtvsCutVarsWS[ih]->Fill(cont_eleptvscutvars);
1440  }
1441  }
1442  }
1443 
1444  if(fUseMCInfo){
1445  if(mcxic){
1446  Int_t pdgcode = mcxic->GetPdgCode();
1447  cont2[1] = mcele->Pt();
1448  if(abs(pdgcode)==4132 && abs(mcpdgele_array[1])==4132 && abs(mcpdgcasc_array[1])==4132){
1449  fHistoEleXiMassMCS->Fill(cont);
1450  fHistoEleXiMassvsElePtMCS->Fill(cont2);
1451  if(trk->Charge()>0) fHistoEleXiMassvsElePtMCS1->Fill(cont2);
1452  else fHistoEleXiMassvsElePtMCS2->Fill(cont2);
1453  if(cont[0]<2.5){
1454  fHistoElePtMCS->Fill(mcele->Pt(),fCentrality);
1455  fHistoElePtvsEtaMCS->Fill(cont_eleptvseta);
1456  fHistoElePtvsXiPtMCS->Fill(cont_eleptvsxipt);
1457  fHistoElePtvsd0MCS->Fill(cont_eleptvsd0);
1458 
1459  Double_t cont_xic[3];
1460  cont_xic[0] = mcxic->Pt();
1461  cont_xic[1] = mcxic->Y();
1462  cont_xic[2] = fCentrality;
1463  fHistoXicMCS->Fill(cont_xic);
1464  if(trk->Charge()>0) fHistoXicMCS1->Fill(cont_xic);
1465  else fHistoXicMCS2->Fill(cont_xic);
1466 
1467  Double_t cont_mcele[3];
1468  cont_mcele[0] = mcele->Pt();
1469  cont_mcele[1] = mcele->Eta();
1470  cont_mcele[2] = fCentrality;
1471  fHistoXicElectronMCS->Fill(cont_mcele);
1472  if(trk->Charge()>0) fHistoXicElectronMCS1->Fill(cont_mcele);
1473  else fHistoXicElectronMCS2->Fill(cont_mcele);
1474 
1475  fHistoResponseElePt->Fill(mcele->Pt(),trk->Pt());
1476  fHistoResponseEleXiPt->Fill(mcxic->Pt(),exobj->Pt());
1477 
1478  Double_t cont_eleptvsxiptvsxicpt[4];
1479  cont_eleptvsxiptvsxicpt[0] = cont_eleptvsxipt[0];
1480  cont_eleptvsxiptvsxicpt[1] = cont_eleptvsxipt[1];
1481  cont_eleptvsxiptvsxicpt[2] = mcxic->Pt();
1482  cont_eleptvsxiptvsxicpt[3] = cont_eleptvsxipt[2];
1483  fHistoElePtvsXiPtvsXicPtMCS->Fill(cont_eleptvsxiptvsxicpt);
1484 
1485  Int_t labmotherxic = mcxic->GetMother();
1486  if(labmotherxic>=0){
1487  AliAODMCParticle *motherxic = (AliAODMCParticle*)mcArray->At(labmotherxic);
1488  Int_t pdgmotherxic = motherxic->GetPdgCode();
1489  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){
1490  fHistoElePtvsd0BFeeddownMCS->Fill(cont_eleptvsd0);
1491  }else{
1492  fHistoElePtvsd0PromptMCS->Fill(cont_eleptvsd0);
1493  }
1494  }else{
1495  fHistoElePtvsd0PromptMCS->Fill(cont_eleptvsd0);
1496  }
1497 
1498  for(Int_t ih=0;ih<23;ih++){
1499  Double_t cont_eleptvscutvars[3];
1500  cont_eleptvscutvars[0] = trk->Pt();
1501  cont_eleptvscutvars[2] = fCentrality;
1502 
1503  if(ih==0){
1504  cont_eleptvscutvars[1] = trk->GetTPCNcls();
1505  }else if(ih==1){
1506  cont_eleptvscutvars[1] = trk->GetTPCsignalN();
1507  }else if(ih==2){
1508  cont_eleptvscutvars[1] = nSigmaTPCele;
1509  }else if(ih==3){
1510  cont_eleptvscutvars[1] = nSigmaTOFele;
1511  }else if(ih==4){
1512  cont_eleptvscutvars[1] = trk->Eta();
1513  }else if(ih==5){
1514  cont_eleptvscutvars[1] = trk->GetITSNcls();
1515  }else if(ih==6){
1516  if(casc->ChargeXi()<0)
1517  cont_eleptvscutvars[1] = casc->MassLambda();
1518  else
1519  cont_eleptvscutvars[1] = casc->MassAntiLambda();
1520  }else if(ih==7){
1521  cont_eleptvscutvars[1] = casc->MassXi();
1522  }else if(ih==8){
1523  Double_t lPosV0[3];
1524  lPosV0[0] = casc->DecayVertexV0X();
1525  lPosV0[1] = casc->DecayVertexV0Y();
1526  lPosV0[2] = casc->DecayVertexV0Z();
1527  cont_eleptvscutvars[1] = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
1528  }else if(ih==9){
1529  Double_t lPosXi[3];
1530  lPosXi[0] = casc->DecayVertexXiX();
1531  lPosXi[1] = casc->DecayVertexXiY();
1532  lPosXi[2] = casc->DecayVertexXiZ();
1533  cont_eleptvscutvars[1] = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
1534  }else if(ih==10){
1535  cont_eleptvscutvars[1] = casc->DcaV0Daughters();
1536  }else if(ih==11){
1537  cont_eleptvscutvars[1] = casc->DcaXiDaughters();
1538  }else if(ih==12){
1539  cont_eleptvscutvars[1] = casc->DcaBachToPrimVertex();
1540  }else if(ih==13){
1541  if(casc->ChargeXi()<0.)
1542  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1543  else
1544  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1545  }else if(ih==14){
1546  if(casc->ChargeXi()>0.)
1547  cont_eleptvscutvars[1] = casc->DcaPosToPrimVertex();
1548  else
1549  cont_eleptvscutvars[1] = casc->DcaNegToPrimVertex();
1550  }else if(ih==15){
1551  cont_eleptvscutvars[1] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1552  }else if(ih==16){
1553  cont_eleptvscutvars[1] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1554  }else if(ih==17){
1555  cont_eleptvscutvars[1] = nSigmaTPCv0pr;
1556  }else if(ih==18){
1557  cont_eleptvscutvars[1] = nSigmaTPCv0pi;
1558  }else if(ih==19){
1559  cont_eleptvscutvars[1] = nSigmaTPCbachpi;
1560  }else if(ih==20){
1561  cont_eleptvscutvars[1] = casc->Eta();
1562  }else if(ih==21){
1563  cont_eleptvscutvars[1] = 0.5*TMath::Log((sqrt(casc->Ptot2Xi())+casc->MomXiZ())/(sqrt(casc->Ptot2Xi())-casc->MomXiZ()));
1564  }else if(ih==22){
1565  Double_t xipx = exobj->PxProng(1);
1566  Double_t xipy = exobj->PyProng(1);
1567  Double_t xipz = exobj->PzProng(1);
1568  Double_t epx = exobj->PxProng(0);
1569  Double_t epy = exobj->PyProng(0);
1570  Double_t epz = exobj->PzProng(0);
1571  cont_eleptvscutvars[1] = acos((xipx*epx+xipy*epy+xipz*epz)/sqrt(xipx*xipx+xipy*xipy+xipz*xipz)/sqrt(epx*epx+epy*epy+epz*epz));
1572  }else{
1573  cont_eleptvscutvars[1] = -9999.;
1574  }
1575 
1576  fHistoElePtvsCutVarsMCS[ih]->Fill(cont_eleptvscutvars);
1577  }
1578  }
1579  }
1580  }
1581  }
1582  }
1583 
1585  {
1586  if(trk->Charge()*casc->ChargeXi()<0){
1587  fHistoEleXiMassRSSide->Fill(cont);
1588  if(trk->Charge()>0) fHistoEleXiMassRSSide1->Fill(cont);
1589  else fHistoEleXiMassRSSide2->Fill(cont);
1590  fHistoEleXiMassvsElePtRSSide->Fill(cont2);
1591  if(trk->Charge()>0) fHistoEleXiMassvsElePtRSSide1->Fill(cont2);
1592  else fHistoEleXiMassvsElePtRSSide2->Fill(cont2);
1593  }else{
1594  fHistoEleXiMassWSSide->Fill(cont);
1595  if(trk->Charge()>0) fHistoEleXiMassWSSide1->Fill(cont);
1596  else fHistoEleXiMassWSSide2->Fill(cont);
1597  fHistoEleXiMassvsElePtWSSide->Fill(cont2);
1598  if(trk->Charge()>0) fHistoEleXiMassvsElePtWSSide1->Fill(cont2);
1599  else fHistoEleXiMassvsElePtWSSide2->Fill(cont2);
1600  }
1601  }
1602 
1603  return;
1604 }
1605 
1607 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMixROOTObjects(TLorentzVector *trke, TLorentzVector *casc, Int_t chargexi)
1608 {
1609  //
1610  // Fill histograms or tree depending on fWriteVariableTree
1611  //
1612  if(!trke) return;
1613  if(!casc) return;
1614 
1615 
1616  for(Int_t i=0;i<89;i++){
1617  fCandidateVariables[i] = -9999.;
1618  }
1619 
1620  Double_t pxe = trke->Px();
1621  Double_t pye = trke->Py();
1622  Double_t pze = trke->Pz();
1623  Double_t mome = sqrt(pxe*pxe+pye*pye+pze*pze);
1624  Double_t Ee = sqrt(mome*mome+0.000510998928*0.000510998928);
1625 
1626  Double_t pxv = casc->Px();
1627  Double_t pyv = casc->Py();
1628  Double_t pzv = casc->Pz();
1629  Double_t momv = sqrt(pxv*pxv+pyv*pyv+pzv*pzv);
1630  Double_t Ev = sqrt(momv*momv+1.32171*1.32171);
1631 
1632  Double_t cosoa = (pxe*pxv+pye*pyv+pze*pzv)/mome/momv;
1633 
1634  Double_t pxsum = pxe + pxv;
1635  Double_t pysum = pye + pyv;
1636  Double_t pzsum = pze + pzv;
1637  Double_t Esum = Ee + Ev;
1638 
1639  Double_t mexi = sqrt(Esum*Esum-pxsum*pxsum-pysum*pysum-pzsum*pzsum);
1640 
1641  Double_t posVtx[3] = {0.,0.,0.};
1642  fVtx1->GetXYZ(posVtx);
1643 
1645  UInt_t pdgdg[2]={11,3312};
1646  fCandidateVariables[ 1] = mexi;
1647  fCandidateVariables[ 2] = sqrt(pxsum*pxsum+pysum*pysum);
1648  fCandidateVariables[ 3] = pxsum;
1649  fCandidateVariables[ 4] = pysum;
1650  fCandidateVariables[ 5] = pzsum;
1651  fCandidateVariables[ 6] = pxe;
1652  fCandidateVariables[ 7] = pye;
1653  fCandidateVariables[ 8] = pze;
1654  fCandidateVariables[ 9] = pxv;
1655  fCandidateVariables[10] = pyv;
1656  fCandidateVariables[11] = pzv;
1657  fCandidateVariables[12] = chargexi;
1658  fCandidateVariables[13] = casc->M();
1659  fCandidateVariables[29] = trke->T();
1660  fCandidateVariables[30] = 1;//mixing
1661  fCandidateVariables[77] = fVtx1->GetX();
1662  fCandidateVariables[78] = fVtx1->GetY();
1663  fCandidateVariables[79] = fVtx1->GetZ();
1665 
1666  if(fWriteVariableTree)
1667  fVariablesTree->Fill();
1668 
1669 
1670  if(cosoa>0. && fAnalCuts->IsPeakRegion(casc))
1671  {
1672  Double_t cont[3];
1673  cont[0] = mexi;
1674  cont[1] = sqrt(pxsum*pxsum+pysum*pysum);
1675  cont[2] = fCentrality;
1676  fHistoEleXiMass->Fill(cont);
1677 
1678  Double_t cont2[3];
1679  cont2[0] = mexi;
1680  cont2[1] = sqrt(pxe*pxe+pye*pye);
1681  cont2[2] = fCentrality;
1682 
1683  Double_t cont_eleptvseta[3];
1684  cont_eleptvseta[0] = trke->Pt();
1685  cont_eleptvseta[1] = trke->Eta();
1686  cont_eleptvseta[2] = fCentrality;
1687 
1688  Double_t cont_eleptvsxipt[3];
1689  cont_eleptvsxipt[0] = trke->Pt();
1690  cont_eleptvsxipt[1] = casc->Pt();
1691  cont_eleptvsxipt[2] = fCentrality;
1692 
1693  Double_t cont_eleptvsd0[3];
1694  cont_eleptvsd0[0] = trke->Pt();
1695  cont_eleptvsd0[1] = 0.;
1696  cont_eleptvsd0[2] = fCentrality;
1697 
1698  if(((int)trke->T())*chargexi<0){
1699  fHistoEleXiMassRSMix->Fill(cont);
1700  if(trke->T()>0) fHistoEleXiMassRSMix1->Fill(cont);
1701  else fHistoEleXiMassRSMix2->Fill(cont);
1702  fHistoEleXiMassvsElePtRSMix->Fill(cont2);
1703  if(trke->T()>0) fHistoEleXiMassvsElePtRSMix1->Fill(cont2);
1704  else fHistoEleXiMassvsElePtRSMix2->Fill(cont2);
1705  if(cont[0]<2.5){
1706  fHistoElePtRSMix->Fill(trke->Pt(),fCentrality);
1707  fHistoElePtvsEtaRSMix->Fill(cont_eleptvseta);
1708  fHistoElePtvsXiPtRSMix->Fill(cont_eleptvsxipt);
1709  fHistoElePtvsd0RSMix->Fill(cont_eleptvsd0);
1710  }
1711  }else{
1712  fHistoEleXiMassWSMix->Fill(cont);
1713  if(trke->T()>0) fHistoEleXiMassWSMix1->Fill(cont);
1714  else fHistoEleXiMassWSMix2->Fill(cont);
1715  fHistoEleXiMassvsElePtWSMix->Fill(cont2);
1716  if(trke->T()>0) fHistoEleXiMassvsElePtWSMix1->Fill(cont2);
1717  else fHistoEleXiMassvsElePtWSMix2->Fill(cont2);
1718  if(cont[0]<2.5){
1719  fHistoElePtWSMix->Fill(trke->Pt(),fCentrality);
1720  fHistoElePtvsEtaWSMix->Fill(cont_eleptvseta);
1721  fHistoElePtvsXiPtWSMix->Fill(cont_eleptvsxipt);
1722  fHistoElePtvsd0WSMix->Fill(cont_eleptvsd0);
1723  }
1724  }
1725  }
1726 
1727  return;
1728 }
1729 
1732 {
1733  //
1734  // Define electron tree variables
1735  //
1736 
1737  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
1738  fEleVariablesTree = new TTree(nameoutput,"electron variables tree");
1739  Int_t nVar = 26;
1740  fCandidateEleVariables = new Float_t [nVar];
1741  TString * fCandidateVariableNames = new TString[nVar];
1742 
1743  fCandidateVariableNames[ 0]="ElePx";
1744  fCandidateVariableNames[ 1]="ElePy";
1745  fCandidateVariableNames[ 2]="ElePz";
1746  fCandidateVariableNames[ 3]="TPCChi2overNDF";
1747  fCandidateVariableNames[ 4]="ITSNcls";
1748  fCandidateVariableNames[ 5]="TPCNcls";
1749  fCandidateVariableNames[ 6]="TPCNclsPID";
1750  fCandidateVariableNames[ 7]="TPCNclsRatio";
1751  fCandidateVariableNames[ 8]="d0R";
1752  fCandidateVariableNames[ 9]="d0Z";
1753  fCandidateVariableNames[10]="ITSClusterMap";
1754  fCandidateVariableNames[11]="nSigmaTPCele";
1755  fCandidateVariableNames[12]="nSigmaTOFele";
1756  fCandidateVariableNames[13]="nSigmaTPCpi";
1757  fCandidateVariableNames[14]="nSigmaTPCka";
1758  fCandidateVariableNames[15]="nSigmaTPCpr";
1759  fCandidateVariableNames[16]="EvNumber";
1760  fCandidateVariableNames[17]="EleCharge";
1761  fCandidateVariableNames[18]="ElePdgCode";
1762  fCandidateVariableNames[19]="EleMotherPdgCode";
1763  fCandidateVariableNames[20]="mcelepx";
1764  fCandidateVariableNames[21]="mcelepy";
1765  fCandidateVariableNames[22]="mcelepz";
1766  fCandidateVariableNames[23]="Centrality";
1767  fCandidateVariableNames[24]="PrimVertZ";
1768  fCandidateVariableNames[25]="RunNumber";
1769 
1770  for (Int_t ivar=0; ivar<nVar; ivar++) {
1771  fEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1772  }
1773 
1774  return;
1775 }
1777 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillElectronROOTObjects(AliAODTrack *trk, TClonesArray *mcArray)
1778 {
1779  //
1780  // Fill histograms or tree depending on fWriteVariableTree
1781  //
1782 
1783  if(!trk) return;
1784 
1785  fHistoBachPt->Fill(trk->Pt());
1786  fHistoElectronQovPtvsPhi->Fill(trk->Phi(),(Double_t)trk->Charge()/trk->Pt());
1787 
1788  if(fDoEventMixing){
1789  fElectronTracks->AddLast(new TLorentzVector(trk->Px(),trk->Py(),trk->Pz(),trk->Charge()));
1790  }
1791 
1792  if(!fWriteEachVariableTree) return;
1793 
1794  Int_t pdgEle = -9999;
1795  Int_t pdgEleMother = -9999;
1796  Float_t mcepx = -9999;
1797  Float_t mcepy = -9999;
1798  Float_t mcepz = -9999;
1799  if(fUseMCInfo)
1800  {
1801  Int_t labEle = trk->GetLabel();
1802  if(labEle<0) return;
1803  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
1804  if(!mcetrk) return;
1805  pdgEle = mcetrk->GetPdgCode();
1806  if(abs(pdgEle)!=11) return;
1807 
1808  fHistoBachPtMCS->Fill(trk->Pt());
1809 
1810  Bool_t hfe_flag = kFALSE;
1811  Int_t labemother = mcetrk->GetMother();
1812  if(labemother>=0){
1813  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
1814  if(!motherele) return;
1815  pdgEleMother = motherele->GetPdgCode();
1816  if(abs(pdgEleMother)>4000&&abs(pdgEleMother)<4400){
1817  hfe_flag = kTRUE;
1818  }
1819  }
1820  if(!hfe_flag) return;
1821  mcepx = mcetrk->Px();
1822  mcepy = mcetrk->Py();
1823  mcepz = mcetrk->Pz();
1824  }
1825 
1826 
1827  for(Int_t i=0;i<26;i++){
1828  fCandidateEleVariables[i] = -9999.;
1829  }
1830 
1831  fCandidateEleVariables[ 0] = trk->Px();
1832  fCandidateEleVariables[ 1] = trk->Py();
1833  fCandidateEleVariables[ 2] = trk->Pz();
1834  fCandidateEleVariables[ 3] = trk->Chi2perNDF();
1835  fCandidateEleVariables[ 4] = trk->GetITSNcls();
1836  fCandidateEleVariables[ 5] = trk->GetTPCncls();
1837  fCandidateEleVariables[ 6] = trk->GetTPCsignalN();
1838  if(trk->GetTPCNclsF()>0)
1839  fCandidateEleVariables[ 7] = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
1840 
1841  Double_t d0z0[2],covd0z0[3];
1842  trk->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);
1843 
1844  fCandidateEleVariables[ 8] = d0z0[0];
1845  fCandidateEleVariables[ 9] = d0z0[1];
1846  Int_t itsmap = trk->GetITSClusterMap();
1847  Int_t bit1 = 1;
1848  Int_t bit2 = 2;
1849  Bool_t spdfirst = (itsmap & bit1) == bit1;
1850  Bool_t spdsecond = (itsmap & bit2) == bit2;
1851  fCandidateEleVariables[10] = ((Int_t)spdfirst) + 2 * ((Int_t)spdsecond);
1852 
1853  if(fAnalCuts->GetIsUsePID())
1854  {
1855  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
1856  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
1857  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
1858  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
1859  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
1860  fCandidateEleVariables[11] = nSigmaTPCele;
1861  fCandidateEleVariables[12] = nSigmaTOFele;
1862  fCandidateEleVariables[13] = nSigmaTPCpi_etrk;
1863  fCandidateEleVariables[14] = nSigmaTPCka_etrk;
1864  fCandidateEleVariables[15] = nSigmaTPCpr_etrk;
1865  }
1867  fCandidateEleVariables[17] = trk->Charge();
1868  fCandidateEleVariables[18] = pdgEle;
1869  fCandidateEleVariables[19] = pdgEleMother;
1870  fCandidateEleVariables[20] = mcepx;
1871  fCandidateEleVariables[21] = mcepy;
1872  fCandidateEleVariables[22] = mcepz;
1876 
1877  fHistod0Bach->Fill(d0z0[0]);
1878 
1879  fEleVariablesTree->Fill();
1880 }
1883 {
1884  //
1885  // Define V0 tree variables
1886  //
1887 
1888  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
1889  fCascVariablesTree = new TTree(nameoutput,"cascade variables tree");
1890  Int_t nVar = 25;
1891  fCandidateCascVariables = new Float_t [nVar];
1892  TString * fCandidateVariableNames = new TString[nVar];
1893 
1894  fCandidateVariableNames[ 0]="Centrality";
1895  fCandidateVariableNames[ 1]="InvMassXi";
1896  fCandidateVariableNames[ 2]="XiPx";
1897  fCandidateVariableNames[ 3]="XiPy";
1898  fCandidateVariableNames[ 4]="XiPz";
1899  fCandidateVariableNames[ 5]="InvMassLambda";
1900  fCandidateVariableNames[ 6]="DcaXiDaughters";
1901  fCandidateVariableNames[ 7]="DcaV0Daughters";
1902  fCandidateVariableNames[ 8]="DecayLengthXi";
1903  fCandidateVariableNames[ 9]="CosPointingAngleXi";
1904  fCandidateVariableNames[10]="DcaV0toPrimVertex";
1905  fCandidateVariableNames[11]="DcaPostoPrimVertex";
1906  fCandidateVariableNames[12]="DcaNegtoPrimVertex";
1907  fCandidateVariableNames[13]="DcaBachtoPrimVertex";
1908  fCandidateVariableNames[14]="DecayLengthV0";
1909  fCandidateVariableNames[15]="CosPointingAngleV0";
1910  fCandidateVariableNames[16]="XiCharge";
1911  fCandidateVariableNames[17]="XiPdgCode";
1912  fCandidateVariableNames[18]="XiMotherPdgCode";
1913  fCandidateVariableNames[19]="mcxipx";
1914  fCandidateVariableNames[20]="mcxipy";
1915  fCandidateVariableNames[21]="mcxipz";
1916  fCandidateVariableNames[22]="RunNumber";
1917  fCandidateVariableNames[23]="PrimVertZ";
1918  fCandidateVariableNames[24]="EvNumber";
1919 
1920  for (Int_t ivar=0; ivar<nVar; ivar++) {
1921  fCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1922  }
1923 
1924  return;
1925 }
1926 
1928 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
1929 {
1930  //
1931  // Fill histograms or tree depending on fWriteVariableTree (tree not implemented yet)
1932  //
1933  if(!casc) return;
1934  fHistoXiMassvsPt->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1935  fHistoOmegaMassvsPt->Fill(casc->MassOmega(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1936  Double_t momxix = casc->MomXiX();
1937  Double_t momxiy = casc->MomXiY();
1938  Double_t phi_alice = atan2(momxiy,momxix);
1939  if(phi_alice<0.) phi_alice += 2 * M_PI;
1940  fHistoXiQovPtvsPhi->Fill(phi_alice,(Double_t)casc->ChargeXi()/sqrt(momxix*momxix+momxiy*momxiy));
1941 
1942  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1943  Double_t posVtx[3] = {0.,0.,0.};
1944  fVtx1->GetXYZ(posVtx);
1945  Double_t ptotlam = TMath::Sqrt(pow(casc->Px(),2)+pow(casc->Py(),2)+pow(casc->Pz(),2));
1946  Double_t v0propdl = sqrt(pow(casc->DecayVertexV0X()-posVtx[0],2)+pow(casc->DecayVertexV0Y()-posVtx[1],2)+pow(casc->DecayVertexV0Z()-posVtx[2],2))*mlamPDG/ptotlam;
1947  if(fAnalCuts->IsPeakRegion(casc)){
1948  fHistoLambdaPtvsDl->Fill(casc->Pt(),v0propdl);
1949  }
1950  if(fAnalCuts->IsSideBand(casc)){
1951  fHistoLambdaPtvsDlSide->Fill(casc->Pt(),v0propdl);
1952  }
1953 
1954  Int_t xipdgcode = -9999;
1955  Int_t ximotherpdgcode = -9999;
1956  Float_t mcxipx = -9999.;
1957  Float_t mcxipy = -9999.;
1958  Float_t mcxipz = -9999.;
1959  if(fUseMCInfo){
1960  Int_t pdgDgcasc[2]={211,3122};
1961  Int_t pdgDgv0[2]={2212,211};
1962  Int_t labcasc = MatchToMCCascade(casc,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
1963  if(labcasc<0) return;
1964 
1965  fHistoXiMassvsPtMCS->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1966 
1967  AliAODMCParticle *mccasctrk = (AliAODMCParticle*)mcArray->At(labcasc);
1968  if(!mccasctrk) return;
1969 
1970  fHistoLambdaPtvsDlMCS->Fill(casc->Pt(),v0propdl);
1971 
1972  Bool_t hfxi_flag = kFALSE;
1973  xipdgcode = mccasctrk->GetPdgCode();
1974  Int_t labcascmother = mccasctrk->GetMother();
1975  if(labcascmother>=0){
1976  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
1977  if(mothercasc){
1978  ximotherpdgcode = mothercasc->GetPdgCode();
1979  if(abs(ximotherpdgcode)>4000&&abs(ximotherpdgcode)<4400){
1980  hfxi_flag = kTRUE;
1981  }
1982  }
1983  }
1984  if(!hfxi_flag) return;
1985  mcxipx = mccasctrk->Px();
1986  mcxipy = mccasctrk->Py();
1987  mcxipz = mccasctrk->Pz();
1988  }
1989 
1990 
1991  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
1992  xyz[0]=casc->DecayVertexXiX();
1993  xyz[1]=casc->DecayVertexXiY();
1994  xyz[2]=casc->DecayVertexXiZ();
1995  pxpypz[0]=casc->MomXiX();
1996  pxpypz[1]=casc->MomXiY();
1997  pxpypz[2]=casc->MomXiZ();
1998  casc->GetCovarianceXYZPxPyPz(cv);
1999  sign=casc->ChargeXi();
2000  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
2001  trackCasc->PropagateToDCA(fVtx1,fBzkG,kVeryBig);
2002  Double_t momcasc_new[3]={-9999,-9999,-9999.};
2003  trackCasc->GetPxPyPz(momcasc_new);
2004 
2005  if(fDoEventMixing){
2006  TLorentzVector *lv = new TLorentzVector();
2007  lv->SetXYZM(momcasc_new[0],momcasc_new[1],momcasc_new[2],casc->MassXi());
2008  if(casc->ChargeXi()>0)
2009  fCascadeTracks1->AddLast(lv);
2010  else
2011  fCascadeTracks2->AddLast(lv);
2012  }
2013 
2014  if(!fWriteEachVariableTree) return;
2015 
2016  for(Int_t i=0;i<25;i++){
2017  fCandidateCascVariables[i] = -9999.;
2018  }
2019 
2021  fCandidateCascVariables[ 1] = casc->MassXi();
2022  fCandidateCascVariables[ 2] = momcasc_new[0];//casc->MomXiX();
2023  fCandidateCascVariables[ 3] = momcasc_new[1];//casc->MomXiY();
2024  fCandidateCascVariables[ 4] = momcasc_new[2];//casc->MomXiZ();
2025  if(casc->ChargeXi()<0)
2026  fCandidateCascVariables[ 5] = casc->MassLambda();
2027  else
2028  fCandidateCascVariables[ 5] = casc->MassAntiLambda();
2029 
2030  fCandidateCascVariables[ 6] = casc->DcaXiDaughters();
2031  fCandidateCascVariables[ 7] = casc->DcaV0Daughters();
2032  fCandidateCascVariables[ 8] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
2033  fCandidateCascVariables[ 9] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
2034  fCandidateCascVariables[10] = casc->DcaV0ToPrimVertex();
2035  fCandidateCascVariables[11] = casc->DcaPosToPrimVertex();
2036  fCandidateCascVariables[12] = casc->DcaNegToPrimVertex();
2037  fCandidateCascVariables[13] = casc->DcaBachToPrimVertex();
2038  fCandidateCascVariables[14] = casc->DecayLengthV0();
2039  fCandidateCascVariables[15] = casc->CosPointingAngle(casc->GetDecayVertexXi());
2040  fCandidateCascVariables[16] = casc->ChargeXi();
2041  fCandidateCascVariables[17] = xipdgcode;
2042  fCandidateCascVariables[18] = ximotherpdgcode;
2043  fCandidateCascVariables[19] = mcxipx;
2044  fCandidateCascVariables[20] = mcxipy;
2045  fCandidateCascVariables[21] = mcxipz;
2049 
2050 
2051  fCascVariablesTree->Fill();
2052 }
2055 {
2056  //
2057  // Define electron tree variables
2058  //
2059 
2060  const char* nameoutput = GetOutputSlot(7)->GetContainer()->GetName();
2061  fMCVariablesTree = new TTree(nameoutput,"MC variables tree");
2062  Int_t nVar = 16;
2063  fCandidateMCVariables = new Float_t [nVar];
2064  TString * fCandidateVariableNames = new TString[nVar];
2065 
2066  fCandidateVariableNames[ 0]="Centrality";
2067  fCandidateVariableNames[ 1]="DecayType";
2068  fCandidateVariableNames[ 2]="XicPx";
2069  fCandidateVariableNames[ 3]="XicPy";
2070  fCandidateVariableNames[ 4]="XicPz";
2071  fCandidateVariableNames[ 5]="ElePx";
2072  fCandidateVariableNames[ 6]="ElePy";
2073  fCandidateVariableNames[ 7]="ElePz";
2074  fCandidateVariableNames[ 8]="CascPx";
2075  fCandidateVariableNames[ 9]="CascPy";
2076  fCandidateVariableNames[10]="CascPz";
2077  fCandidateVariableNames[11]="PdgCode";
2078  fCandidateVariableNames[12]="ElePdgCode";
2079  fCandidateVariableNames[13]="CascPdgCode";
2080  fCandidateVariableNames[14]="RunNumber";
2081  fCandidateVariableNames[15]="EvNumber";
2082 
2083  for (Int_t ivar=0; ivar<nVar; ivar++) {
2084  fMCVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2085  }
2086  return;
2087 }
2089 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCROOTObjects(AliAODMCParticle *mcpart, AliAODMCParticle *mcepart, AliAODMCParticle *mccascpart, Int_t decaytype)
2090 {
2091  //
2092  // Fill histograms or tree depending on fWriteMCVariableTree
2093  //
2094  if(!mcpart) return;
2095  if(!mcepart) return;
2096  if(!mccascpart) return;
2097 
2098  for(Int_t i=0;i<14;i++){
2099  fCandidateMCVariables[i] = -9999.;
2100  }
2101 
2103  fCandidateMCVariables[ 1] = decaytype;
2104  fCandidateMCVariables[ 2] = mcpart->Px();
2105  fCandidateMCVariables[ 3] = mcpart->Py();
2106  fCandidateMCVariables[ 4] = mcpart->Pz();
2107  fCandidateMCVariables[ 5] = mcepart->Px();
2108  fCandidateMCVariables[ 6] = mcepart->Py();
2109  fCandidateMCVariables[ 7] = mcepart->Pz();
2110  fCandidateMCVariables[ 8] = mccascpart->Px();
2111  fCandidateMCVariables[ 9] = mccascpart->Py();
2112  fCandidateMCVariables[10] = mccascpart->Pz();
2113  fCandidateMCVariables[11] = mcpart->GetPdgCode();
2114  fCandidateMCVariables[12] = mcepart->GetPdgCode();
2115  fCandidateMCVariables[13] = mccascpart->GetPdgCode();
2118 
2119  Double_t epx = mcepart->Px();
2120  Double_t epy = mcepart->Py();
2121  Double_t epz = mcepart->Pz();
2122  Double_t eE = sqrt(epx*epx+epy*epy+epz*epz+0.000511*0.000511);
2123  Double_t cascpx = mccascpart->Px();
2124  Double_t cascpy = mccascpart->Py();
2125  Double_t cascpz = mccascpart->Pz();
2126  Double_t cascE = sqrt(cascpx*cascpx+cascpy*cascpy+cascpz*cascpz+1.32171*1.32171);
2127 
2128  Double_t InvMassEleXi = sqrt(pow(eE+cascE,2)-pow(epx+cascpx,2)-pow(epy+cascpy,2)-pow(epz+cascpz,2));
2129 
2130  Double_t cont[3];
2131  cont[0] = InvMassEleXi;
2132  cont[1] = mcpart->Pt();
2133  cont[2] = fCentrality;
2134  Double_t cont2[3];
2135  cont2[0] = InvMassEleXi;
2136  cont2[1] = mcepart->Pt();
2137  cont2[2] = fCentrality;
2138  Double_t cont_eleptvseta[3];
2139  cont_eleptvseta[0] = mcepart->Pt();
2140  cont_eleptvseta[1] = mcepart->Eta();
2141  cont_eleptvseta[2] = fCentrality;
2142  Double_t cont_eleptvsxipt[3];
2143  cont_eleptvsxipt[0] = mcepart->Pt();
2144  cont_eleptvsxipt[1] = mccascpart->Pt();
2145  cont_eleptvsxipt[2] = fCentrality;
2146  Double_t cont_eleptvsxiptvsxicpt[4];
2147  cont_eleptvsxiptvsxicpt[0] = mcepart->Pt();
2148  cont_eleptvsxiptvsxicpt[1] = mccascpart->Pt();
2149  cont_eleptvsxiptvsxicpt[2] = mcpart->Pt();
2150  cont_eleptvsxiptvsxicpt[3] = fCentrality;
2151 
2152  Double_t contmc[3];
2153  contmc[0] = mcpart->Pt();
2154  contmc[1] = mcpart->Y();
2155  contmc[2] = fCentrality;
2156  Double_t contmcele[3];
2157  contmcele[0] = mcepart->Pt();
2158  contmcele[1] = mcepart->Eta();
2159  contmcele[2] = fCentrality;
2160 
2161 
2162  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
2163  Float_t etamin, etamax;
2164  esdcuts->GetEtaRange(etamin,etamax);
2165 
2166  if(decaytype==0){
2167  fHistoXicMCGen->Fill(contmc);
2168  if(mcpart->GetPdgCode()>0) fHistoXicMCGen1->Fill(contmc);//4132 is particle
2169  if(mcpart->GetPdgCode()<0) fHistoXicMCGen2->Fill(contmc);//-4132 is anti-particle
2170  fHistoXicElectronMCGen->Fill(contmcele);
2171  if(mcepart->GetPdgCode()<0) fHistoXicElectronMCGen1->Fill(contmcele);//-11 is positron
2172  if(mcepart->GetPdgCode()>0) fHistoXicElectronMCGen2->Fill(contmcele);//11 is electron
2173  fHistoEleXiMassMCGen->Fill(cont);
2174  if(fabs(mcepart->Eta())<etamax){
2175  fHistoEleXiMassvsElePtMCGen->Fill(cont2);
2176  if(mcepart->GetPdgCode()<0) fHistoEleXiMassvsElePtMCGen1->Fill(cont2);//-11 is positron
2177  if(mcepart->GetPdgCode()>0) fHistoEleXiMassvsElePtMCGen2->Fill(cont2);//11 is electron
2178  if(InvMassEleXi<2.5){
2179  fHistoElePtMCGen->Fill(mcepart->Pt(),fCentrality);
2180  fHistoElePtvsEtaMCGen->Fill(cont_eleptvseta);
2181  fHistoElePtvsXiPtMCGen->Fill(cont_eleptvsxipt);
2182  }
2183  }
2184  if(fabs(mcpart->Y())<0.7){
2185  if(InvMassEleXi<2.5){
2186  fHistoElePtvsXiPtMCXicGen->Fill(cont_eleptvsxipt);
2187  fHistoElePtvsXiPtvsXicPtMCGen->Fill(cont_eleptvsxiptvsxicpt);
2188  }
2189  }
2190  }
2191 
2193  fMCVariablesTree->Fill();
2194 }
2197 {
2198  //
2199  // Define mc gen electron tree variables
2200  //
2201 
2202  const char* nameoutput = GetOutputSlot(9)->GetContainer()->GetName();
2203  fMCEleVariablesTree = new TTree(nameoutput,"MC Ele variables tree");
2204  Int_t nVar = 8;
2205  fCandidateMCEleVariables = new Float_t [nVar];
2206  TString * fCandidateVariableNames = new TString[nVar];
2207 
2208  fCandidateVariableNames[ 0]="Centrality";
2209  fCandidateVariableNames[ 1]="ElePx";
2210  fCandidateVariableNames[ 2]="ElePy";
2211  fCandidateVariableNames[ 3]="ElePz";
2212  fCandidateVariableNames[ 4]="ElePdgCode";
2213  fCandidateVariableNames[ 5]="EleMotherPdgCode";
2214  fCandidateVariableNames[ 6]="RunNumber";
2215  fCandidateVariableNames[ 7]="EvNumber";
2216 
2217  for (Int_t ivar=0; ivar<nVar; ivar++) {
2218  fMCEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2219  }
2220  return;
2221 }
2223 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
2224 {
2225  //
2226  // Fill tree depending on fWriteMCVariableTree
2227  //
2228  if(!mcepart) return;
2229 
2230 
2231  Bool_t hfe_flag = kFALSE;
2232  Int_t labemother = mcepart->GetMother();
2233  Int_t pdgmotherele = -9999;
2234  if(labemother>=0){
2235  AliAODMCParticle *motherele = (AliAODMCParticle*)mcArray->At(labemother);
2236  pdgmotherele = motherele->GetPdgCode();
2237  if(abs(pdgmotherele)>4000&&abs(pdgmotherele)<4400){
2238  hfe_flag = kTRUE;
2239  }
2240  }
2241  if(!hfe_flag) return;
2242 
2243  Double_t contmc[3];
2244  contmc[0] = mcepart->Pt();
2245  contmc[1] = mcepart->Eta();
2246  contmc[2] = fCentrality;
2247  fHistoElectronMCGen->Fill(contmc);
2248 
2249  for(Int_t i=0;i<8;i++){
2250  fCandidateMCEleVariables[i] = -9999.;
2251  }
2252 
2254  fCandidateMCEleVariables[ 1] = mcepart->Px();
2255  fCandidateMCEleVariables[ 2] = mcepart->Py();
2256  fCandidateMCEleVariables[ 3] = mcepart->Pz();
2257  fCandidateMCEleVariables[ 4] = mcepart->GetPdgCode();
2258  fCandidateMCEleVariables[ 5] = pdgmotherele;
2261 
2262  // This function makes output too heavy (do not use if you have output size limitation)
2263  //if(fWriteMCVariableTree && fWriteEachVariableTree && mcepart->Pt()>0.4 && fabs(mcepart->Eta())<1.0)
2264  //fMCEleVariablesTree->Fill();
2265 }
2268 {
2269  //
2270  // Define Mc cascade tree variables
2271  //
2272 
2273  const char* nameoutput = GetOutputSlot(10)->GetContainer()->GetName();
2274  fMCCascVariablesTree = new TTree(nameoutput,"MC cascade variables tree");
2275  Int_t nVar = 8;
2276  fCandidateMCCascVariables = new Float_t [nVar];
2277  TString * fCandidateVariableNames = new TString[nVar];
2278 
2279  fCandidateVariableNames[ 0]="Centrality";
2280  fCandidateVariableNames[ 1]="CascPx";
2281  fCandidateVariableNames[ 2]="CascPy";
2282  fCandidateVariableNames[ 3]="CascPz";
2283  fCandidateVariableNames[ 4]="CascPdgCode";
2284  fCandidateVariableNames[ 5]="CascMotherPdgCode";
2285  fCandidateVariableNames[ 6]="RunNumber";
2286  fCandidateVariableNames[ 7]="EvNumber";
2287 
2288  for (Int_t ivar=0; ivar<nVar; ivar++) {
2289  fMCCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
2290  }
2291  return;
2292 }
2294 void AliAnalysisTaskSEXic2eleXifromAODtracks::FillMCCascROOTObjects(AliAODMCParticle *mccascpart, TClonesArray *mcArray)
2295 {
2296  //
2297  // Fill histograms or tree depending on fWriteMCVariableTree
2298  //
2299  if(!mccascpart) return;
2300 
2301  for(Int_t i=0;i<8;i++){
2302  fCandidateMCCascVariables[i] = -9999.;
2303  }
2304 
2305  Bool_t hfxi_flag = kFALSE;
2306  Int_t labcascmother = mccascpart->GetMother();
2307  Int_t pdgmothercasc = -9999;
2308  if(labcascmother>=0){
2309  AliAODMCParticle *mothercasc = (AliAODMCParticle*)mcArray->At(labcascmother);
2310  if(mothercasc){
2311  pdgmothercasc = mothercasc->GetPdgCode();
2312  if(abs(pdgmothercasc)>4000&&abs(pdgmothercasc)<4400){
2313  hfxi_flag = kTRUE;
2314  }
2315  }
2316  }
2317  if(!hfxi_flag) return;
2318 
2319  Double_t contmc[3];
2320  contmc[0] = mccascpart->Pt();
2321  contmc[1] = mccascpart->Eta();
2322  contmc[2] = fCentrality;
2323  fHistoXiMCGen->Fill(contmc);
2324 
2326  fCandidateMCCascVariables[ 1] = mccascpart->Px();
2327  fCandidateMCCascVariables[ 2] = mccascpart->Py();
2328  fCandidateMCCascVariables[ 3] = mccascpart->Pz();
2329  fCandidateMCCascVariables[ 4] = mccascpart->GetPdgCode();
2330  fCandidateMCCascVariables[ 5] = pdgmothercasc;
2333 
2334  // This function makes output too heavy (do not use if you have output size limitation)
2335  //if(fWriteMCVariableTree && fWriteEachVariableTree && mccascpart->Pt()>0.4 && fabs(mccascpart->Eta())<1.0)
2336  //fMCCascVariablesTree->Fill();
2337 }
2338 
2341  //
2342  // This is to define general histograms
2343  //
2344 
2345  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
2346  fCEvents->SetStats(kTRUE);
2347  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
2348  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
2349  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
2350  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
2351  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
2352  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
2353  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
2354  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
2355  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
2356  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
2357  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
2358  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
2359  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
2360  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
2361  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2362  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
2363  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
2364  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
2365  //fCEvents->GetXaxis()->SetTitle("");
2366  fCEvents->GetYaxis()->SetTitle("counts");
2367 
2368  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
2369  fHTrigger->SetStats(kTRUE);
2370  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
2371  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
2372  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
2373  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
2374  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
2375  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
2376  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
2377  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
2378  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
2379  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
2380  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
2381  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
2382 
2383  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
2384 
2385 
2386  fOutput->Add(fCEvents);
2387  fOutput->Add(fHTrigger);
2388  fOutput->Add(fHCentrality);
2389 
2390  return;
2391 }
2392 //__________________________________________________________________________
2394 {
2395  //
2396  // Define analyis histograms
2397  //
2398 
2399  //------------------------------------------------
2400  // Basic histogram
2401  //------------------------------------------------
2402  Int_t bins_base[3]= {10 ,100 ,10};
2403  Double_t xmin_base[3]={1.3,0 ,0.00};
2404  Double_t xmax_base[3]={3.3,20. ,100};
2405 
2406  fHistoEleXiMass = new THnSparseF("fHistoEleXiMass","",3,bins_base,xmin_base,xmax_base);
2408  fHistoEleXiMassRS = new THnSparseF("fHistoEleXiMassRS","",3,bins_base,xmin_base,xmax_base);
2410  fHistoEleXiMassWS = new THnSparseF("fHistoEleXiMassWS","",3,bins_base,xmin_base,xmax_base);
2412  fHistoEleXiMassRSMix = new THnSparseF("fHistoEleXiMassRSMix","",3,bins_base,xmin_base,xmax_base);
2414  fHistoEleXiMassWSMix = new THnSparseF("fHistoEleXiMassWSMix","",3,bins_base,xmin_base,xmax_base);
2416  fHistoEleXiMassRSSide = new THnSparseF("fHistoEleXiMassRSSide","",3,bins_base,xmin_base,xmax_base);
2418  fHistoEleXiMassWSSide = new THnSparseF("fHistoEleXiMassWSSide","",3,bins_base,xmin_base,xmax_base);
2420  fHistoEleXiMassRS1 = new THnSparseF("fHistoEleXiMassRS1","",3,bins_base,xmin_base,xmax_base);
2422  fHistoEleXiMassWS1 = new THnSparseF("fHistoEleXiMassWS1","",3,bins_base,xmin_base,xmax_base);
2424  fHistoEleXiMassRSMix1 = new THnSparseF("fHistoEleXiMassRSMix1","",3,bins_base,xmin_base,xmax_base);
2426  fHistoEleXiMassWSMix1 = new THnSparseF("fHistoEleXiMassWSMix1","",3,bins_base,xmin_base,xmax_base);
2428  fHistoEleXiMassRSSide1 = new THnSparseF("fHistoEleXiMassRSSide1","",3,bins_base,xmin_base,xmax_base);
2430  fHistoEleXiMassWSSide1 = new THnSparseF("fHistoEleXiMassWSSide1","",3,bins_base,xmin_base,xmax_base);
2432  fHistoEleXiMassRS2 = new THnSparseF("fHistoEleXiMassRS2","",3,bins_base,xmin_base,xmax_base);
2434  fHistoEleXiMassWS2 = new THnSparseF("fHistoEleXiMassWS2","",3,bins_base,xmin_base,xmax_base);
2436  fHistoEleXiMassRSMix2 = new THnSparseF("fHistoEleXiMassRSMix2","",3,bins_base,xmin_base,xmax_base);
2438  fHistoEleXiMassWSMix2 = new THnSparseF("fHistoEleXiMassWSMix2","",3,bins_base,xmin_base,xmax_base);
2440  fHistoEleXiMassRSSide2 = new THnSparseF("fHistoEleXiMassRSSide2","",3,bins_base,xmin_base,xmax_base);
2442  fHistoEleXiMassWSSide2 = new THnSparseF("fHistoEleXiMassWSSide2","",3,bins_base,xmin_base,xmax_base);
2444 
2445  Int_t bins_base_elept[3]= {10 ,100 ,10};
2446  Double_t xmin_base_elept[3]={1.3,0 ,0.00};
2447  Double_t xmax_base_elept[3]={3.3,10. ,100};
2448 
2449  fHistoEleXiMassvsElePtRS = new THnSparseF("fHistoEleXiMassvsElePtRS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2451  fHistoEleXiMassvsElePtWS = new THnSparseF("fHistoEleXiMassvsElePtWS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2453  fHistoEleXiMassvsElePtRSMix = new THnSparseF("fHistoEleXiMassvsElePtRSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2455  fHistoEleXiMassvsElePtWSMix = new THnSparseF("fHistoEleXiMassvsElePtWSMix","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2457  fHistoEleXiMassvsElePtRSSide = new THnSparseF("fHistoEleXiMassvsElePtRSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2459  fHistoEleXiMassvsElePtWSSide = new THnSparseF("fHistoEleXiMassvsElePtWSSide","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2461  fHistoEleXiMassvsElePtRS1 = new THnSparseF("fHistoEleXiMassvsElePtRS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2463  fHistoEleXiMassvsElePtWS1 = new THnSparseF("fHistoEleXiMassvsElePtWS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2465  fHistoEleXiMassvsElePtRSMix1 = new THnSparseF("fHistoEleXiMassvsElePtRSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2467  fHistoEleXiMassvsElePtWSMix1 = new THnSparseF("fHistoEleXiMassvsElePtWSMix1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2469  fHistoEleXiMassvsElePtRSSide1 = new THnSparseF("fHistoEleXiMassvsElePtRSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2471  fHistoEleXiMassvsElePtWSSide1 = new THnSparseF("fHistoEleXiMassvsElePtWSSide1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2473  fHistoEleXiMassvsElePtRS2 = new THnSparseF("fHistoEleXiMassvsElePtRS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2475  fHistoEleXiMassvsElePtWS2 = new THnSparseF("fHistoEleXiMassvsElePtWS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2477  fHistoEleXiMassvsElePtRSMix2 = new THnSparseF("fHistoEleXiMassvsElePtRSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2479  fHistoEleXiMassvsElePtWSMix2 = new THnSparseF("fHistoEleXiMassvsElePtWSMix2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2481  fHistoEleXiMassvsElePtRSSide2 = new THnSparseF("fHistoEleXiMassvsElePtRSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2483  fHistoEleXiMassvsElePtWSSide2 = new THnSparseF("fHistoEleXiMassvsElePtWSSide2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2485 
2486  fHistoElePtRS=new TH2F("fHistoElePtRS","Right-sign e pt",100,0.,10.,10,0.,100.);
2487  fOutputAll->Add(fHistoElePtRS);
2488  fHistoElePtWS=new TH2F("fHistoElePtWS","Wrong-sign e pt",100,0.,10.,10,0.,100.);
2489  fOutputAll->Add(fHistoElePtWS);
2490  fHistoElePtRSMix=new TH2F("fHistoElePtRSMix","Right-sign e pt",100,0.,10.,10,0.,100.);
2492  fHistoElePtWSMix=new TH2F("fHistoElePtWSMix","Wrong-sign e pt",100,0.,10.,10,0.,100.);
2494 
2495  fHistoEleXiMassMCS = new THnSparseF("fHistoEleXiMassMCS","",3,bins_base,xmin_base,xmax_base);
2497  fHistoEleXiMassMCGen = new THnSparseF("fHistoEleXiMassMCGen","",3,bins_base,xmin_base,xmax_base);
2499  fHistoEleXiMassvsElePtMCS = new THnSparseF("fHistoEleXiMassvsElePtMCS","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2501  fHistoEleXiMassvsElePtMCGen = new THnSparseF("fHistoEleXiMassvsElePtMCGen","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2503  fHistoEleXiMassvsElePtMCS1 = new THnSparseF("fHistoEleXiMassvsElePtMCS1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2505  fHistoEleXiMassvsElePtMCGen1 = new THnSparseF("fHistoEleXiMassvsElePtMCGen1","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2507  fHistoEleXiMassvsElePtMCS2 = new THnSparseF("fHistoEleXiMassvsElePtMCS2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2509  fHistoEleXiMassvsElePtMCGen2 = new THnSparseF("fHistoEleXiMassvsElePtMCGen2","",3,bins_base_elept,xmin_base_elept,xmax_base_elept);
2511  fHistoElePtMCS=new TH2F("fHistoElePtMCS","MC S e pt",100,0.,10.,10,0.,100.);
2512  fOutputAll->Add(fHistoElePtMCS);
2513  fHistoElePtMCGen=new TH2F("fHistoElePtMCGen","MC Gen e pt",100,0.,10.,10,0.,100.);
2515 
2516  Int_t bins_eleptvseta[3]= {50,20 ,10};
2517  Double_t xmin_eleptvseta[3]={0.,-1. ,0.0};
2518  Double_t xmax_eleptvseta[3]={5.,1. ,100};
2519 
2520  fHistoElePtvsEtaRS = new THnSparseF("fHistoElePtvsEtaRS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2522  fHistoElePtvsEtaWS = new THnSparseF("fHistoElePtvsEtaWS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2524  fHistoElePtvsEtaRSMix = new THnSparseF("fHistoElePtvsEtaRSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2526  fHistoElePtvsEtaWSMix = new THnSparseF("fHistoElePtvsEtaWSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2528  fHistoElePtvsEtaMCS = new THnSparseF("fHistoElePtvsEtaMCS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2530  fHistoElePtvsEtaMCGen = new THnSparseF("fHistoElePtvsEtaMCGen","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
2532 
2533  Int_t bins_eleptvsxipt[3]= {50,20 ,10};
2534  Double_t xmin_eleptvsxipt[3]={0.,0. ,0.0};
2535  Double_t xmax_eleptvsxipt[3]={5.,5. ,100};
2536 
2537  fHistoElePtvsXiPtRS = new THnSparseF("fHistoElePtvsXiPtRS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2539  fHistoElePtvsXiPtWS = new THnSparseF("fHistoElePtvsXiPtWS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2541  fHistoElePtvsXiPtRSMix = new THnSparseF("fHistoElePtvsXiPtRSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2543  fHistoElePtvsXiPtWSMix = new THnSparseF("fHistoElePtvsXiPtWSMix","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2545  fHistoElePtvsXiPtMCS = new THnSparseF("fHistoElePtvsXiPtMCS","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2547  fHistoElePtvsXiPtMCGen = new THnSparseF("fHistoElePtvsXiPtMCGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2549  fHistoElePtvsXiPtMCXicGen = new THnSparseF("fHistoElePtvsXiPtMCXicGen","",3,bins_eleptvsxipt,xmin_eleptvsxipt,xmax_eleptvsxipt);
2551 
2552  Int_t bins_eleptvsxiptvsxicpt[4]= {50,20,10,10};
2553  Double_t xmin_eleptvsxiptvsxicpt[4]={0.,0.,0.,0.0};
2554  Double_t xmax_eleptvsxiptvsxicpt[4]={5.,5.,10.,100};
2555  fHistoElePtvsXiPtvsXicPtMCS = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCS","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
2557  fHistoElePtvsXiPtvsXicPtMCGen = new THnSparseF("fHistoElePtvsXiPtvsXicPtMCGen","",4,bins_eleptvsxiptvsxicpt,xmin_eleptvsxiptvsxicpt,xmax_eleptvsxiptvsxicpt);
2559 
2560  Int_t bins_eleptvsd0[3]= {50 ,50 ,10};
2561  Double_t xmin_eleptvsd0[3]={0.,-0.2 ,0.0};
2562  Double_t xmax_eleptvsd0[3]={5.,0.2 ,100};
2563 
2564  fHistoElePtvsd0RS = new THnSparseF("fHistoElePtvsd0RS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2566  fHistoElePtvsd0WS = new THnSparseF("fHistoElePtvsd0WS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2568  fHistoElePtvsd0RSMix = new THnSparseF("fHistoElePtvsd0RSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2570  fHistoElePtvsd0WSMix = new THnSparseF("fHistoElePtvsd0WSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2572  fHistoElePtvsd0MCS = new THnSparseF("fHistoElePtvsd0MCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2574  fHistoElePtvsd0PromptMCS = new THnSparseF("fHistoElePtvsd0PromptMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2576  fHistoElePtvsd0BFeeddownMCS = new THnSparseF("fHistoElePtvsd0BFeeddownMCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
2578 
2579  //------------------------------------------------
2580  // checking histograms
2581  //------------------------------------------------
2582  fHistoBachPt = new TH1F("fHistoBachPt","Bachelor p_{T}",100,0.0,5.0);
2583  fOutputAll->Add(fHistoBachPt);
2584  fHistoBachPtMCS = new TH1F("fHistoBachPtMCS","Bachelor p_{T}",100,0.0,5.0);
2586  fHistoBachPtMCGen = new TH1F("fHistoBachPtMCGen","Bachelor p_{T}",100,0.0,5.0);
2588  fHistod0Bach = new TH1F("fHistod0Bach","Bachelor d_{0}",100,-0.5,0.5);
2589  fOutputAll->Add(fHistod0Bach);
2590  fHistoXiMassvsPt=new TH2F("fHistoXiMassvsPt","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2592  fHistoXiMassvsPtMCS=new TH2F("fHistoXiMassvsPtMCS","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2594  fHistoXiMassvsPtMCGen=new TH2F("fHistoXiMassvsPtMCGen","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
2596  fHistoOmegaMassvsPt=new TH2F("fHistoOmegaMassvsPt","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
2598 
2599  fHistoElectronTPCPID=new TH2F("fHistoElectronTPCPID","",50,0.,5.,50,-20.,20.);
2601  fHistoElectronTOFPID=new TH2F("fHistoElectronTOFPID","",50,0.,5.,50,-20.,20.);
2603  fHistoElectronTPCSelPID=new TH2F("fHistoElectronTPCSelPID","",50,0.,5.,50,-20.,20.);
2605  fHistoElectronTOFSelPID=new TH2F("fHistoElectronTOFSelPID","",50,0.,5.,50,-20.,20.);
2607  fHistoElectronTPCPIDSelTOF=new TH2F("fHistoElectronTPCPIDSelTOF","",10,0.,5.,500,-10.,10.);
2609  fHistoElectronTOFPIDSelTPC=new TH2F("fHistoElectronTOFPIDSelTPC","",10,0.,5.,500,-10.,10.);
2611  fHistoElectronTPCPIDSelTOFSmallEta=new TH2F("fHistoElectronTPCPIDSelTOFSmallEta","",10,0.,5.,500,-10.,10.);
2613  fHistoElectronTPCPIDSelTOFLargeEta=new TH2F("fHistoElectronTPCPIDSelTOFLargeEta","",10,0.,5.,500,-10.,10.);
2615 
2616  for(Int_t i=0;i<8;i++){
2617  fHistoElectronTPCPIDSelTOFEtaDep[i]=new TH2F(Form("fHistoElectronTPCPIDSelTOFEtaDep[%d]",i),"",10,0.,5.,500,-10.,10.);
2619  }
2620 
2621  fHistoElectronQovPtvsPhi=new TH2F("fHistoElectronQovPtvsPhi","",70,0.,7.,50,-2.,2.);
2623  fHistoXiQovPtvsPhi=new TH2F("fHistoXiQovPtvsPhi","",70,0.,7.,50,-2.,2.);
2625 
2626  Int_t bins_xicmcgen[3]= {100 ,20 ,10};
2627  Double_t xmin_xicmcgen[3]={0.,-1.0 ,0.0};
2628  Double_t xmax_xicmcgen[3]={20.,1.0 ,100};
2629  fHistoXicMCGen = new THnSparseF("fHistoXicMCGen","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2630  fOutputAll->Add(fHistoXicMCGen);
2631  fHistoXicMCGen1 = new THnSparseF("fHistoXicMCGen1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2633  fHistoXicMCGen2 = new THnSparseF("fHistoXicMCGen2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2635  fHistoXicMCS = new THnSparseF("fHistoXicMCS","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2636  fOutputAll->Add(fHistoXicMCS);
2637  fHistoXicMCS1 = new THnSparseF("fHistoXicMCS1","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2638  fOutputAll->Add(fHistoXicMCS1);
2639  fHistoXicMCS2 = new THnSparseF("fHistoXicMCS2","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
2640  fOutputAll->Add(fHistoXicMCS2);
2641 
2642  Int_t bins_elemcgen[3]= {100 ,20 ,10};
2643  Double_t xmin_elemcgen[3]={0.,-1.0 ,0.0};
2644  Double_t xmax_elemcgen[3]={10.,1.0 ,100};
2645  fHistoElectronMCGen = new THnSparseF("fHistoElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2647  fHistoXicElectronMCGen = new THnSparseF("fHistoXicElectronMCGen","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2649  fHistoXicElectronMCGen1 = new THnSparseF("fHistoXicElectronMCGen1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2651  fHistoXicElectronMCGen2 = new THnSparseF("fHistoXicElectronMCGen2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2653  fHistoXicElectronMCS = new THnSparseF("fHistoXicElectronMCS","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2655  fHistoXicElectronMCS1 = new THnSparseF("fHistoXicElectronMCS1","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2657  fHistoXicElectronMCS2 = new THnSparseF("fHistoXicElectronMCS2","",3,bins_elemcgen,xmin_elemcgen,xmax_elemcgen);
2659 
2660  Int_t bins_ximcgen[3]= {50 ,20 ,10};
2661  Double_t xmin_ximcgen[3]={0.,-1.0 ,0.0};
2662  Double_t xmax_ximcgen[3]={10.,1.0 ,100};
2663  fHistoXiMCGen = new THnSparseF("fHistoXiMCGen","",3,bins_ximcgen,xmin_ximcgen,xmax_ximcgen);
2664  fOutputAll->Add(fHistoXiMCGen);
2665 
2666  fHistoLambdaPtvsDl=new TH2F("fHistoLambdaPtvsDl","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2668  fHistoLambdaPtvsDlSide=new TH2F("fHistoLambdaPtvsDlSide","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2670  fHistoLambdaPtvsDlMCS=new TH2F("fHistoLambdaPtvsDlMCS","Lambda pt vs dl",20,0.,10.,20,0.,40.);
2672 
2673  fHistoResponseElePt = new TH2D("fHistoResponseElePt","",100,0.,10.,100,0.,10.);
2675  fHistoResponseEleXiPt = new TH2D("fHistoResponseEleXiPt","",100,0.,20.,100,0.,20.);
2677 
2678 
2679  fHistonEvtvsRunNumber=new TH1F("fHistonEvtvsRunNumber","",20000,-0.5,19999.5);
2681  fHistonElevsRunNumber=new TH1F("fHistonElevsRunNumber","",20000,-0.5,19999.5);
2683  fHistonXivsRunNumber=new TH1F("fHistonXivsRunNumber","",20000,-0.5,19999.5);
2685 
2686  for(Int_t ih=0;ih<23;ih++){
2687  Int_t bins_eleptvscutvars[3];
2688  Double_t xmin_eleptvscutvars[3];
2689  Double_t xmax_eleptvscutvars[3];
2690 
2691  bins_eleptvscutvars[0] = 50;//electron pT bin
2692  xmin_eleptvscutvars[0] = 0.;
2693  xmax_eleptvscutvars[0] = 5.;
2694  bins_eleptvscutvars[2] = 10;//centrality bin
2695  xmin_eleptvscutvars[2] = 0.;
2696  xmax_eleptvscutvars[2] = 100.;
2697 
2698  if(ih==0 || ih==1){
2699  //0: TPC Ncluster 1: TPC ncluster PID
2700  bins_eleptvscutvars[1] = 40;
2701  xmin_eleptvscutvars[1] = 0.;
2702  xmax_eleptvscutvars[1] = 160.;
2703  }else if(ih==2 || ih==3){
2704  //2: nSigma(TPC,e) 3: nSigma(TOF,e)
2705  bins_eleptvscutvars[1] = 20;
2706  xmin_eleptvscutvars[1] = -5.;
2707  xmax_eleptvscutvars[1] = 5.;
2708  }else if(ih==4){
2709  //4: eta
2710  bins_eleptvscutvars[1] = 30;
2711  xmin_eleptvscutvars[1] = -1.5;
2712  xmax_eleptvscutvars[1] = 1.5;
2713  }else if(ih==5){
2714  //5: nITS cluster
2715  bins_eleptvscutvars[1] = 7;
2716  xmin_eleptvscutvars[1] = -0.5;
2717  xmax_eleptvscutvars[1] = 6.5;
2718  }else if(ih==6){
2719  //6: Lambda mass
2720  bins_eleptvscutvars[1] = 50;
2721  xmin_eleptvscutvars[1] = 1.1156-0.03;
2722  xmax_eleptvscutvars[1] = 1.1156+0.03;
2723  }else if(ih==7){
2724  //7: Xi mass
2725  bins_eleptvscutvars[1] = 50;
2726  xmin_eleptvscutvars[1] = 1.32-0.03;
2727  xmax_eleptvscutvars[1] = 1.32+0.03;
2728  }else if(ih==8 || ih==9){
2729  //8: Rfid Lambda, 9: Rfid Xi
2730  bins_eleptvscutvars[1] = 20;
2731  xmin_eleptvscutvars[1] = 0.;
2732  xmax_eleptvscutvars[1] = 5.;
2733  }else if(ih==10 || ih==11){
2734  //11: DCA Xi, 10: Dca V0
2735  bins_eleptvscutvars[1] = 20;
2736  xmin_eleptvscutvars[1] = 0.;
2737  xmax_eleptvscutvars[1] = 2.;
2738  }else if(ih==12 || ih==13 || ih==14){
2739  //12: DCA Bachto prim, 13: DCA V0pr to prim 14: DCA V0pi to prim
2740  bins_eleptvscutvars[1] = 20;
2741  xmin_eleptvscutvars[1] = 0.;
2742  xmax_eleptvscutvars[1] = 0.5;
2743  }else if(ih==15 || ih==16){
2744  //16: CosPAXi, 15: CosPAv0
2745  bins_eleptvscutvars[1] = 20;
2746  xmin_eleptvscutvars[1] = 0.95;
2747  xmax_eleptvscutvars[1] = 1.0;
2748  }else if(ih==17 || ih==18 || ih==19){
2749  //17: nSigma(TPC, bach) 18: nSigma(TPC, v0pr), 19: nSigma(TPC,v0pi)
2750  bins_eleptvscutvars[1] = 20;
2751  xmin_eleptvscutvars[1] = -5.;
2752  xmax_eleptvscutvars[1] = 5.;
2753  }else if(ih==20 || ih==21){
2754  //20: V0 eta 21: Xi eta
2755  bins_eleptvscutvars[1] = 30;
2756  xmin_eleptvscutvars[1] = -1.5;
2757  xmax_eleptvscutvars[1] = 1.5;
2758  }else if(ih==22){
2759  //20: Opening angle
2760  bins_eleptvscutvars[1] = 20;
2761  xmin_eleptvscutvars[1] = 0.;
2762  xmax_eleptvscutvars[1] = 3.141592/2;
2763  }
2764 
2765  fHistoElePtvsCutVarsRS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsRS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
2767  fHistoElePtvsCutVarsWS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsWS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
2769  fHistoElePtvsCutVarsMCS[ih] = new THnSparseF(Form("fHistoElePtvsCutVarsMCS[%d]",ih),"",3,bins_eleptvscutvars,xmin_eleptvscutvars,xmax_eleptvscutvars);
2771  }
2772 
2773  return;
2774 }
2775 
2776 //________________________________________________________________________
2777 AliAODRecoCascadeHF* AliAnalysisTaskSEXic2eleXifromAODtracks::MakeCascadeHF(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod, AliAODVertex *secVert)
2778 {
2779  //
2780  // Create AliAODRecoCascadeHF object from the argument
2781  //
2782 
2783  if(!casc) return 0x0;
2784  if(!part) return 0x0;
2785  if(!aod) return 0x0;
2786 
2787  //------------------------------------------------
2788  // PrimaryVertex
2789  //------------------------------------------------
2790  AliAODVertex *primVertexAOD;
2791  Bool_t unsetvtx = kFALSE;
2793  primVertexAOD = CallPrimaryVertex(casc,part,aod);
2794  if(!primVertexAOD){
2795  primVertexAOD = fVtx1;
2796  }else{
2797  unsetvtx = kTRUE;
2798  }
2799  }else{
2800  primVertexAOD = fVtx1;
2801  }
2802  if(!primVertexAOD) return 0x0;
2803  Double_t posprim[3]; primVertexAOD->GetXYZ(posprim);
2804 
2805  //------------------------------------------------
2806  // DCA between tracks
2807  //------------------------------------------------
2808  AliESDtrack *esdtrack = new AliESDtrack((AliVTrack*)part);
2809 
2810  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
2811  xyz[0]=casc->DecayVertexXiX();
2812  xyz[1]=casc->DecayVertexXiY();
2813  xyz[2]=casc->DecayVertexXiZ();
2814  pxpypz[0]=casc->MomXiX();
2815  pxpypz[1]=casc->MomXiY();
2816  pxpypz[2]=casc->MomXiZ();
2817  casc->GetCovarianceXYZPxPyPz(cv);
2818  sign=casc->ChargeXi();
2819  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
2820 
2821  Double_t xdummy, ydummy;
2822  Double_t dca = esdtrack->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
2823 
2824 
2825  //------------------------------------------------
2826  // Propagate all tracks to the secondary vertex and calculate momentum there
2827  //------------------------------------------------
2828 
2829  Double_t d0z0bach[2],covd0z0bach[3];
2830  if(sqrt(pow(secVert->GetX(),2)+pow(secVert->GetY(),2))<1.){
2831  part->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
2832  trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
2833  }else{
2834  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
2835  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
2836  }
2837  Double_t momcasc_new[3]={-9999,-9999,-9999.};
2838  trackCasc->GetPxPyPz(momcasc_new);
2839 
2840  Double_t px[2],py[2],pz[2];
2841  px[0] = part->Px(); py[0] = part->Py(); pz[0] = part->Pz();
2842  px[1] = momcasc_new[0]; py[1] = momcasc_new[1]; pz[1] = momcasc_new[2];
2843 
2844  //------------------------------------------------
2845  // d0
2846  //------------------------------------------------
2847  Double_t d0[3],d0err[3];
2848 
2849  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
2850  d0[0]= d0z0bach[0];
2851  d0err[0] = TMath::Sqrt(covd0z0bach[0]);
2852 
2853  Double_t d0z0casc[2],covd0z0casc[3];
2854  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0casc,covd0z0casc);
2855  d0[1]= d0z0casc[0];
2856  d0err[1] = TMath::Sqrt(covd0z0casc[0]);
2857 
2858  //------------------------------------------------
2859  // Create AliAODRecoCascadeHF
2860  //------------------------------------------------
2861  Short_t charge = part->Charge();
2862  AliAODRecoCascadeHF *theCascade = new AliAODRecoCascadeHF(secVert,charge,px,py,pz,d0,d0err,dca);
2863  if(!theCascade)
2864  {
2865  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
2866  if(esdtrack) delete esdtrack;
2867  if(trackCasc) delete trackCasc;
2868  return 0x0;
2869  }
2870  theCascade->SetOwnPrimaryVtx(primVertexAOD);
2871  UShort_t id[2]={(UShort_t)part->GetID(),(UShort_t)trackCasc->GetID()};
2872  theCascade->SetProngIDs(2,id);
2873 
2874  theCascade->GetSecondaryVtx()->AddDaughter(part);
2875  theCascade->GetSecondaryVtx()->AddDaughter(casc);
2876  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
2877  if(esdtrack) delete esdtrack;
2878  if(trackCasc) delete trackCasc;
2879 
2880  return theCascade;
2881 }
2882 
2883 //________________________________________________________________________
2884 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent* aod)
2885 {
2886  //
2887  // Make an array of tracks which should not be used in primary vertex calculation and
2888  // Call PrimaryVertex function
2889  //
2890 
2891  TObjArray *TrackArray = new TObjArray(3);
2892 
2893  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk);
2894  TrackArray->AddAt(cptrk1,0);
2895 
2896  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
2897  TrackArray->AddAt(cascptrack,1);
2898  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
2899  TrackArray->AddAt(cascntrack,2);
2900  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
2901  TrackArray->AddAt(cascbtrack,3);
2902 
2903  AliAODVertex *newvert = PrimaryVertex(TrackArray,aod);
2904 
2905  for(Int_t i=0;i<4;i++)
2906  {
2907  AliESDtrack *tesd = (AliESDtrack*)TrackArray->UncheckedAt(i);
2908  delete tesd;
2909  }
2910  TrackArray->Clear();
2911  delete TrackArray;
2912 
2913  return newvert;
2914 }
2915 
2916 //________________________________________________________________________
2917 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::PrimaryVertex(const TObjArray *trkArray,
2918  AliVEvent *event)
2919 {
2920  //
2921  //Used only for pp
2922  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
2923  //
2924 
2925  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
2926  Bool_t fRmTrksFromPrimVtx = kFALSE;
2927 
2928  AliESDVertex *vertexESD = 0;
2929  AliAODVertex *vertexAOD = 0;
2930 
2931  //vertexESD = new AliESDVertex(*fV1);
2932 
2933 
2934  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
2935  // primary vertex from the input event
2936 
2937  vertexESD = new AliESDVertex(*fV1);
2938 
2939  } else {
2940  // primary vertex specific to this candidate
2941 
2942  Int_t nTrks = trkArray->GetEntriesFast();
2943  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
2944 
2945  if(fRecoPrimVtxSkippingTrks) {
2946  // recalculating the vertex
2947 
2948  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
2949  Float_t diamondcovxy[3];
2950  event->GetDiamondCovXY(diamondcovxy);
2951  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
2952  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
2953  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
2954  vertexer->SetVtxStart(diamond);
2955  delete diamond; diamond=NULL;
2956  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter"))
2957  vertexer->SetOnlyFitter();
2958  }
2959  Int_t skipped[1000];
2960  Int_t nTrksToSkip=0,id;
2961  AliExternalTrackParam *t = 0;
2962  for(Int_t i=0; i<nTrks; i++) {
2963  t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
2964  id = (Int_t)t->GetID();
2965  if(id<0) continue;
2966  skipped[nTrksToSkip++] = id;
2967  }
2968  // TEMPORARY FIX
2969  // For AOD, skip also tracks without covariance matrix
2970  Double_t covtest[21];
2971  for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
2972  AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
2973  if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
2974  id = (Int_t)vtrack->GetID();
2975  if(id<0) continue;
2976  skipped[nTrksToSkip++] = id;
2977  }
2978  }
2979  for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
2980  //
2981  vertexer->SetSkipTracks(nTrksToSkip,skipped);
2982  vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
2983 
2984  } else if(fRmTrksFromPrimVtx && nTrks>0) {
2985  // removing the prongs tracks
2986 
2987  TObjArray rmArray(nTrks);
2988  UShort_t *rmId = new UShort_t[nTrks];
2989  AliESDtrack *esdTrack = 0;
2990  AliESDtrack *t = 0;
2991  for(Int_t i=0; i<nTrks; i++) {
2992  t = (AliESDtrack*)trkArray->UncheckedAt(i);
2993  esdTrack = new AliESDtrack(*t);
2994  rmArray.AddLast(esdTrack);
2995  if(esdTrack->GetID()>=0) {
2996  rmId[i]=(UShort_t)esdTrack->GetID();
2997  } else {
2998  rmId[i]=9999;
2999  }
3000  }
3001  Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
3002  vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
3003  delete [] rmId; rmId=NULL;
3004  rmArray.Delete();
3005 
3006  }
3007 
3008  delete vertexer; vertexer=NULL;
3009  if(!vertexESD) return vertexAOD;
3010  if(vertexESD->GetNContributors()<=0) {
3011  //AliDebug(2,"vertexing failed");
3012  delete vertexESD; vertexESD=NULL;
3013  return vertexAOD;
3014  }
3015 
3016 
3017  }
3018 
3019  // convert to AliAODVertex
3020  Double_t pos[3],cov[6],chi2perNDF;
3021  vertexESD->GetXYZ(pos); // position
3022  vertexESD->GetCovMatrix(cov); //covariance matrix
3023  chi2perNDF = vertexESD->GetChi2toNDF();
3024  delete vertexESD; vertexESD=NULL;
3025 
3026  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
3027 
3028  return vertexAOD;
3029 }
3030 
3031 //________________________________________________________________________
3032 AliAODVertex* AliAnalysisTaskSEXic2eleXifromAODtracks::ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod)
3033 {
3034  //
3035  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
3036  //
3037 
3038  AliAODVertex *primVertexAOD;
3039  Bool_t unsetvtx = kFALSE;
3041  primVertexAOD = CallPrimaryVertex(casc,part,aod);
3042  if(!primVertexAOD){
3043  primVertexAOD = fVtx1;
3044  }else{
3045  unsetvtx = kTRUE;
3046  }
3047  }else{
3048  primVertexAOD = fVtx1;
3049  }
3050  if(!primVertexAOD) return 0x0;
3051 
3052  AliESDVertex * vertexESD = new AliESDVertex(*fV1);
3053 
3054  Double_t pos[3],cov[6],chi2perNDF;
3055  vertexESD->GetXYZ(pos); // position
3056  vertexESD->GetCovMatrix(cov); //covariance matrix
3057  chi2perNDF = vertexESD->GetChi2toNDF();
3058  delete vertexESD; vertexESD=NULL;
3059 
3060  AliAODVertex *secVert = new AliAODVertex(pos,cov,chi2perNDF);
3061 
3062  return secVert;
3063 }
3064 //________________________________________________________________________
3065 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)
3066 {
3067  //
3068  // Match to MC
3069  //
3070  for(Int_t i=0;i<100;i++){
3071  pdgarray_ele[i] = -9999;
3072  labelarray_ele[i] = -9999;
3073  pdgarray_casc[i] = -9999;
3074  labelarray_casc[i] = -9999;
3075  }
3076  ngen_ele = 0;
3077  ngen_casc = 0;
3078 
3079  AliVTrack *trk = dynamic_cast<AliVTrack*>(exobj->GetBachelor());
3080  if(!trk) return -1;
3081  Int_t labEle = trk->GetLabel();
3082  if(labEle<0) return -1;
3083  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
3084  if(!mcetrk) return -1;
3085  labelarray_ele[0] = labEle;
3086  pdgarray_ele[0] = mcetrk->GetPdgCode();
3087  ngen_ele ++;
3088 
3089  AliAODMCParticle *mcprimele=0;
3090  mcprimele = mcetrk;
3091  while(mcprimele->GetMother()>=0) {
3092  Int_t labprim_ele=mcprimele->GetMother();
3093  AliAODMCParticle *tmcprimele = (AliAODMCParticle*)mcArray->At(labprim_ele);
3094  if(!tmcprimele) {
3095  break;
3096  }
3097 
3098  mcprimele = tmcprimele;
3099  pdgarray_ele[ngen_ele] = mcprimele->GetPdgCode();
3100  labelarray_ele[ngen_ele] = labprim_ele;
3101  ngen_ele ++;
3102  if(ngen_ele==100) break;
3103  }
3104 
3105  AliAODcascade *theCascade = dynamic_cast<AliAODcascade*>(exobj->GetCascade());
3106  if(!theCascade) return -1;
3107 
3108  Int_t pdgDgcasc[2]={211,3122};
3109  Int_t pdgDgv0[2]={2212,211};
3110  Int_t labcasc = MatchToMCCascade(theCascade,3312,pdgDgcasc,pdgDgv0,mcArray); // the cascade
3111  if(labcasc<0) return -1;
3112 
3113  AliAODMCParticle *mccasc = (AliAODMCParticle*)mcArray->At(labcasc);
3114  if(!mccasc) return -1;
3115  labelarray_casc[0] = labcasc;
3116  pdgarray_casc[0] = mccasc->GetPdgCode();
3117  ngen_casc ++;
3118 
3119  AliAODMCParticle *mcprimcasc=0;
3120  mcprimcasc = mccasc;
3121  while(mcprimcasc->GetMother()>=0) {
3122  Int_t labprim_casc=mcprimcasc->GetMother();
3123  AliAODMCParticle *tmcprimcasc = (AliAODMCParticle*)mcArray->At(labprim_casc);
3124  if(!tmcprimcasc) {
3125  break;
3126  }
3127 
3128  mcprimcasc = tmcprimcasc;
3129  pdgarray_casc[ngen_casc] = mcprimcasc->GetPdgCode();
3130  labelarray_casc[ngen_casc] = labprim_casc;
3131  ngen_casc ++;
3132  if(ngen_casc==100) break;
3133  }
3134 
3135  Bool_t same_flag = kFALSE;
3136  Int_t matchedlabel=-9999;
3137  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
3138  for(Int_t ivmc=0;ivmc<ngen_casc;ivmc++){
3139  if(labelarray_ele[iemc]==labelarray_casc[ivmc]){
3140  same_flag = kTRUE;
3141  matchedlabel = labelarray_ele[iemc];
3142  break;
3143  }
3144  }
3145  if(same_flag) break;
3146  }
3147 
3148  return matchedlabel;
3149 
3150 }
3151 //________________________________________________________________________
3152 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const // the cascade
3153 {
3154  //
3155  // Matching to MC of cascade
3156  //
3157 
3158  AliAODTrack *cptrack = (AliAODTrack*) theCascade->GetDaughter(0);
3159  if(!cptrack) return -1;
3160  Int_t label_p = cptrack->GetLabel();
3161  if(label_p<0) return -1;
3162  AliAODTrack *cntrack = (AliAODTrack*) theCascade->GetDaughter(1);
3163  if(!cntrack) return -1;
3164  Int_t label_n = cntrack->GetLabel();
3165  if(label_n<0) return -1;
3166  Int_t labv0 = theCascade->MatchToMC(pdgDgcasc[1],mcArray,2,pdgDgv0);
3167  if(labv0<0) return -1;
3168  AliAODMCParticle *mcpartv0= (AliAODMCParticle*) mcArray->At(labv0);
3169 
3170  AliAODTrack *cbtrack = (AliAODTrack*) theCascade->GetDecayVertexXi()->GetDaughter(0);
3171  if(!cbtrack) return -1;
3172 
3173  Int_t label_b = cbtrack->GetLabel();
3174  if(label_b<0) return -1;
3175 
3176  AliAODMCParticle *mcpartb= (AliAODMCParticle*) mcArray->At(label_b);
3177  Int_t pdgb = TMath::Abs(mcpartb->GetPdgCode());
3178  if(pdgb!=pdgDgcasc[0]) return -1;
3179 
3180  AliAODMCParticle *mcmotherv0=mcpartv0;
3181  Bool_t isFromXiv0 = kFALSE;
3182  Int_t labxiv0 = mcmotherv0->GetMother();
3183  if(labxiv0<0) return -1;
3184  mcmotherv0 = (AliAODMCParticle*) mcArray->At(labxiv0);
3185  if(mcmotherv0){
3186  Int_t pdg = TMath::Abs(mcmotherv0 ->GetPdgCode());
3187  if(pdg==pdgabscasc){
3188  isFromXiv0 = kTRUE;
3189  }
3190  }
3191  if(!isFromXiv0) return -1;
3192 
3193  AliAODMCParticle *mcmotherb=mcpartb;
3194  Bool_t isFromXib = kFALSE;
3195  Int_t labxib = mcmotherb->GetMother();
3196  if(labxib<0) return -1;
3197  mcmotherb = (AliAODMCParticle*) mcArray->At(labxib);
3198  if(mcmotherb){
3199  Int_t pdg = TMath::Abs(mcmotherb ->GetPdgCode());
3200  if(pdg==pdgabscasc){
3201  isFromXib = kTRUE;
3202  }
3203  }
3204  if(!isFromXib) return -1;
3205 
3206  if(labxiv0!=labxib) return -1;//Bachelor and V0 should come from the same Xi
3207 
3208  return labxib;
3209 }
3210 //________________________________________________________________________
3211 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags, TClonesArray *mcArray)
3212 {
3213  //
3214  // Select good tracks using fAnalCuts (AliRDHFCuts object) and return the array of their ids
3215  //
3216 
3217  //const Int_t entries = event->GetNumberOfTracks();
3218  if(trkEntries==0) return;
3219 
3220  nSeleTrks=0;
3221  for(Int_t i=0; i<trkEntries; i++) {
3222  seleFlags[i] = kFALSE;
3223 
3224  AliVTrack *track;
3225  track = (AliVTrack*)event->GetTrack(i);
3226 
3227  if(track->GetID()<0) continue;
3228  Double_t covtest[21];
3229  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
3230 
3231  AliAODTrack *aodt = (AliAODTrack*)track;
3232  Double_t nsigma_tpcele = -9999;
3233  Double_t nsigma_tofele = -9999;
3234  if(fAnalCuts->GetIsUsePID()){
3235  nsigma_tpcele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(aodt,AliPID::kElectron);
3236  nsigma_tofele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(aodt,AliPID::kElectron);
3237  }
3238 
3239  if(!fAnalCuts) continue;
3240  if(fAnalCuts->SingleTrkCutsNoPID(aodt,fVtx1)){
3241  fHistoElectronTPCPID->Fill(aodt->Pt(),nsigma_tpcele);
3242  fHistoElectronTOFPID->Fill(aodt->Pt(),nsigma_tofele);
3243  if(fabs(nsigma_tofele)<3.){
3244  fHistoElectronTPCPIDSelTOF->Fill(aodt->Pt(),nsigma_tpcele);
3245  Double_t eleeta = aodt->Eta();
3246  if(fabs(eleeta)<0.6)
3247  fHistoElectronTPCPIDSelTOFSmallEta->Fill(aodt->Pt(),nsigma_tpcele);
3248  if(fabs(eleeta)>0.6 && fabs(eleeta)<0.8)
3249  fHistoElectronTPCPIDSelTOFLargeEta->Fill(aodt->Pt(),nsigma_tpcele);
3250  if(eleeta>-0.8 && eleeta<-0.6){
3251  fHistoElectronTPCPIDSelTOFEtaDep[0]->Fill(aodt->Pt(),nsigma_tpcele);
3252  }else if(eleeta>-0.6&&eleeta<-0.4){
3253  fHistoElectronTPCPIDSelTOFEtaDep[1]->Fill(aodt->Pt(),nsigma_tpcele);
3254  }else if(eleeta>-0.4&&eleeta<-0.2){
3255  fHistoElectronTPCPIDSelTOFEtaDep[2]->Fill(aodt->Pt(),nsigma_tpcele);
3256  }else if(eleeta>-0.2&&eleeta<0.0){
3257  fHistoElectronTPCPIDSelTOFEtaDep[3]->Fill(aodt->Pt(),nsigma_tpcele);
3258  }else if(eleeta>0.0&&eleeta<0.2){
3259  fHistoElectronTPCPIDSelTOFEtaDep[4]->Fill(aodt->Pt(),nsigma_tpcele);
3260  }else if(eleeta>0.2&&eleeta<0.4){
3261  fHistoElectronTPCPIDSelTOFEtaDep[5]->Fill(aodt->Pt(),nsigma_tpcele);
3262  }else if(eleeta>0.4&&eleeta<0.6){
3263  fHistoElectronTPCPIDSelTOFEtaDep[6]->Fill(aodt->Pt(),nsigma_tpcele);
3264  }else if(eleeta>0.6&&eleeta<0.8){
3265  fHistoElectronTPCPIDSelTOFEtaDep[7]->Fill(aodt->Pt(),nsigma_tpcele);
3266  }
3267  }
3268  if(nsigma_tpcele>-0.5&&nsigma_tpcele<3.){
3269  fHistoElectronTOFPIDSelTPC->Fill(aodt->Pt(),nsigma_tofele);
3270  }
3271  }
3272  if(fAnalCuts->SingleTrkCuts(aodt,fVtx1)){
3273  seleFlags[i]=kTRUE;
3274  nSeleTrks++;
3275  fHistoElectronTPCSelPID->Fill(aodt->Pt(),nsigma_tpcele);
3276  fHistoElectronTOFSelPID->Fill(aodt->Pt(),nsigma_tofele);
3277  FillElectronROOTObjects(aodt,mcArray);
3278  }
3279  } // end loop on tracks
3280 }
3281 //________________________________________________________________________
3282 void AliAnalysisTaskSEXic2eleXifromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascs,Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
3283 {
3284  //
3285  // Select good Casc using fAnalCuts (AliRDHFCuts object) and return the array of their ids
3286  //
3287 
3288  Double_t primVtx[3];
3289  fVtx1->GetXYZ(primVtx);
3290 
3291  nSeleCasc = 0;
3292  for(Int_t icasc=0;icasc<nCascs;icasc++)
3293  {
3294  seleCascFlags[icasc] = kFALSE;
3295  AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
3296 
3297  if(!fAnalCuts) continue;
3298  if(fAnalCuts->SingleCascadeCuts(casc,primVtx)){
3299  seleCascFlags[icasc] = kTRUE;
3300  nSeleCasc++;
3301 
3302  FillCascROOTObjects(casc,mcArray);
3303  }
3304  }
3305 }
3306 //_________________________________________________________________
3307 Int_t AliAnalysisTaskSEXic2eleXifromAODtracks::GetPoolIndex(Double_t zvert, Double_t mult){
3308  //
3309  // check in which of the pools the current event falls
3310  //
3311 
3312  Int_t theBinZ=TMath::BinarySearch(fNzVtxBins,fZvtxBins,zvert);
3313  if(theBinZ<0 || theBinZ>=fNzVtxBins) return -1;
3314  Int_t theBinM=TMath::BinarySearch(fNCentBins,fCentBins,mult);
3315  if(theBinM<0 || theBinM>=fNCentBins) return -1;
3316  return fNCentBins*theBinZ+theBinM;
3317 }
3318 //_________________________________________________________________
3320  //
3321  // delete the contets of the pool
3322  //
3323  if(poolIndex<0 || poolIndex>=fNOfPools) return;
3324  delete fEventBuffer[poolIndex];
3325  fEventBuffer[poolIndex]=new TTree(Form("EventBuffer_%d",poolIndex), "Temporary buffer for event mixing");
3326 
3327  fEventBuffer[poolIndex]->Branch("zVertex", &fVtxZ);
3328  fEventBuffer[poolIndex]->Branch("centrality", &fCentrality);
3329  fEventBuffer[poolIndex]->Branch("eventInfo", "TObjString",&fEventInfo);
3330  fEventBuffer[poolIndex]->Branch("c1array", "TObjArray", &fCascadeTracks1);
3331  fEventBuffer[poolIndex]->Branch("c2array", "TObjArray", &fCascadeTracks2);
3332 
3333  return;
3334 }
3335 //_________________________________________________________________
3337 {
3338  //
3339  // perform mixed event analysis
3340  //
3341 
3342  if(poolIndex<0 || poolIndex>fNzVtxBins*fNCentBins) return;
3343  if(fEventBuffer[poolIndex]->GetEntries()<fNumberOfEventsForMixing) return;
3344 
3345  Int_t nEle = fElectronTracks->GetEntries();
3346  Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
3347 
3348  TObjArray* c1array=0x0;
3349  TObjArray* c2array=0x0;
3350  Float_t zVertex,cent;
3351  TObjString* eventInfo=0x0;
3352  fEventBuffer[poolIndex]->SetBranchAddress("zVertex", &zVertex);
3353  fEventBuffer[poolIndex]->SetBranchAddress("eventInfo",&eventInfo);
3354  fEventBuffer[poolIndex]->SetBranchAddress("centrality", &cent);
3355  fEventBuffer[poolIndex]->SetBranchAddress("c1array", &c1array);
3356  fEventBuffer[poolIndex]->SetBranchAddress("c2array", &c2array);
3357  for (Int_t i=0; i<nEle; i++)
3358  {
3359  TLorentzVector* trke=(TLorentzVector*) fElectronTracks->At(i);
3360  if(!trke)continue;
3361 
3362  for(Int_t iEv=0; iEv<fNumberOfEventsForMixing; iEv++){
3363  fEventBuffer[poolIndex]->GetEvent(iEv + nEvents - fNumberOfEventsForMixing);
3364  TObjArray* c1array1=(TObjArray*)c1array->Clone();
3365  Int_t nCascs1=c1array1->GetEntries();
3366  //Float_t zVertex1=zVertex;
3367  //Float_t mult1=cent;
3368 // Int_t evId1,esdId1,ne1,nv1;
3369 // sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_E%d_C%d",&evId1,&esdId1,&ne1,&nv1);
3370 // if(nv1!=(nCascs1+nCascs2)){
3371 // printf("AliAnalysisTaskSEXic2eleXifromAODtracks::DoMixingWithPools ERROR: read event does not match to the stored one\n");
3372 // delete c1array1;
3373 // delete c2array1;
3374 // continue;
3375 // }
3376  for(Int_t iTr1=0; iTr1<nCascs1; iTr1++){
3377  TLorentzVector* casc1=(TLorentzVector*) c1array1->At(iTr1);
3378  if(!casc1) continue;
3379  FillMixROOTObjects(trke,casc1,1);
3380  }//casc loop
3381 
3382  TObjArray* c2array1=(TObjArray*)c2array->Clone();
3383  Int_t nCascs2=c2array1->GetEntries();
3384  for(Int_t iTr2=0; iTr2<nCascs2; iTr2++){
3385  TLorentzVector* casc2=(TLorentzVector*) c2array1->At(iTr2);
3386  if(!casc2) continue;
3387  FillMixROOTObjects(trke,casc2,-1);
3388  }//casc loop
3389 
3390  delete c1array1;
3391  delete c2array1;
3392  }//event loop
3393  }//track loop
3394 }
3395 //_________________________________________________________________
3397 {
3398  //
3399  // Analyze AliAODmcparticle
3400  //
3401 
3402  Int_t nmcpart = mcArray->GetEntriesFast();
3403  for(Int_t i=0;i<nmcpart;i++)
3404  {
3405  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
3406  if(TMath::Abs(mcpart->GetPdgCode())==4132){
3407  Bool_t e_flag = kFALSE;
3408  Bool_t xi_flag = kFALSE;
3409  AliAODMCParticle *mcepart = 0;
3410  AliAODMCParticle *mccascpart = 0;
3411  for(Int_t idau=mcpart->GetFirstDaughter();idau<mcpart->GetLastDaughter()+1;idau++)
3412  {
3413  if(idau<0) break;
3414  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
3415  if(!mcdau) continue;
3416  if(TMath::Abs(mcdau->GetPdgCode())==11){
3417  e_flag = kTRUE;
3418  mcepart = mcdau;
3419  }
3420  if(TMath::Abs(mcdau->GetPdgCode())==3312){
3421  xi_flag = kTRUE;
3422  mccascpart = mcdau;
3423  }
3424  }
3425 
3426  Int_t decaytype = -9999;
3427  if(e_flag && xi_flag) decaytype = 0;
3428 
3429  FillMCROOTObjects(mcpart,mcepart,mccascpart,decaytype);
3430  }
3431  if(TMath::Abs(mcpart->GetPdgCode())==11 && mcpart->GetStatus()==1){
3432  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
3433  Float_t etamin, etamax;
3434  esdcuts->GetEtaRange(etamin,etamax);
3435  if(fabs(mcpart->Eta())<etamax){
3436  fHistoBachPtMCGen->Fill(mcpart->Pt());
3437  }
3438  FillMCEleROOTObjects(mcpart, mcArray);
3439  }
3440  if(TMath::Abs(mcpart->GetPdgCode())==3312){
3441  Double_t etamin, etamax, rapmin, rapmax;
3442  fAnalCuts->GetProdCascEtaRange(etamin,etamax);
3443  fAnalCuts->GetProdCascRapRange(rapmin,rapmax);
3444 
3445  if((fabs(mcpart->Y())<rapmax) && (fabs(mcpart->Eta())<etamax)){
3446  fHistoXiMassvsPtMCGen->Fill(1.32171, mcpart->Pt());
3447  }
3448  FillMCCascROOTObjects(mcpart, mcArray);
3449  }
3450  }
3451  return;
3452 }
Int_t charge
THnSparse * fHistoEleXiMassvsElePtWS2
! e-Xi mass spectra (wrong-sign)
Int_t pdg
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TH2F * fHistoLambdaPtvsDl
! Lambda proper life time distribution
THnSparse * fHistoElePtvsXiPtMCGen
! e-Xi spectra efficiency denominator
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:298
Bool_t SingleCascadeCuts(AliAODcascade *casc, Double_t *vert)
TH1F * fHistoBachPtMCGen
! Bachelor pT histogram (efficiency denominator)
TH2D * fHistoResponseEleXiPt
! Response function e-Xi pT <- XicPt
THnSparse * fHistoElePtvsd0RS
! e pt-d0 spectra (right-sign)
THnSparse * fHistoEleXiMassWSMix2
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTPCPIDSelTOFEtaDep[8]
! TPC electron PID after TOF 3 sigma cut Eta dep
THnSparse * fHistoEleXiMassRSMix1
! e-Xi mass spectra (right-sign)
void FillROOTObjects(AliAODRecoCascadeHF *elobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray)
Bool_t fWriteMCVariableTree
flag to decide whether to write the candidate variables on a tree variables
Int_t MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
Float_t * fCandidateCascVariables
! variables to be written to the tree
THnSparse * fHistoEleXiMassvsElePtRSSide1
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassRSMix2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsXiPtRSMix
! e-Xi spectra (right-sign, mix)
Float_t * fCandidateMCVariables
! variables to be written to the tree
void SelectTrack(const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks, Bool_t *seleFlags, TClonesArray *mcArray)
THnSparse * fHistoElePtvsCutVarsRS[23]
! e pt- cut variables (Right-sign)
void FillMCEleROOTObjects(AliAODMCParticle *mcepart, TClonesArray *mcArray)
TList * fOutputAll
! User Output slot 3 //analysis histograms
THnSparse * fHistoElePtvsd0MCS
! e pt-d0 spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtRS2
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsd0PromptMCS
! e pt-d0 spectra (right-sign)
THnSparse * fHistoElePtvsXiPtvsXicPtMCS
! e-Xi spectra efficiency numerator
THnSparse * fHistoEleXiMassWSSide
! e-Xi mass spectra (wrong-sign)
TTree * fMCCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
THnSparse * fHistoEleXiMassvsElePtMCGen
! e-Xi mass-ept spectra (Efficiency denominator)
THnSparse * fHistoElectronMCGen
! electron in mcArray (only from charmed baryon)
THnSparse * fHistoEleXiMassvsElePtRS
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtMCS1
! e-Xi mass-ept spectra (Efficiency numerator)
void FillElectronROOTObjects(AliAODTrack *trk, TClonesArray *mcArray)
THnSparse * fHistoEleXiMassRS
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsEtaWSMix
! e spectra (wrong-sign, mix)
THnSparse * fHistoEleXiMassvsElePtRSMix2
! e-Xi mass-ept spectra (right-sign)
Int_t MatchToMC(AliAODRecoCascadeHF *elobj, TClonesArray *mcArray, Int_t *pdgarray_ele, Int_t *pdgarray_casc, Int_t *labelarray_ele, Int_t *labelarray_casc, Int_t &ngen_ele, Int_t &ngen_casc)
THnSparse * fHistoElePtvsXiPtWSMix
! e-Xi spectra (wrong-sign, mix)
TTree * fCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
THnSparse * fHistoEleXiMassvsElePtWSMix2
! e-Xi mass-ept spectra (wrong-sign)
virtual void UserCreateOutputObjects()
Implementation of interface methods.
THnSparse * fHistoElePtvsd0WS
! e pt-d0 spectra (wrong-sign)
Float_t * fCandidateEleVariables
! variables to be written to the tree
TTree * fMCEleVariablesTree
! tree of the candidate variables after track selection on output slot 4
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
THnSparse * fHistoEleXiMassvsElePtWSSide
! e-Xi mass-ept spectra (wrong-sign)
void FillMCROOTObjects(AliAODMCParticle *part, AliAODMCParticle *mcepart, AliAODMCParticle *mcv0part, Int_t decaytype)
THnSparse * fHistoElePtvsEtaMCGen
! e spectra efficiency denominator
THnSparse * fHistoEleXiMassMCGen
! e-Xi mass spectra (Efficiency denominator)
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
THnSparse * fHistoElePtvsEtaMCS
! e spectra efficiency numerator
TTree * fMCVariablesTree
! tree of the candidate variables after track selection on output slot 4
Bool_t SingleTrkCuts(AliAODTrack *trk, AliAODVertex *primvert)
THnSparse * fHistoElePtvsXiPtMCS
! e-Xi spectra efficiency numerator
THnSparse * fHistoEleXiMassWS
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTOFPIDSelTPC
! TOF electron PID after TPC cut
THnSparse * fHistoElePtvsCutVarsWS[23]
! e pt- cut variables (Wrong-sign)
const Double_t etamin
TH1F * fHistoBachPtMCS
! Bachelor pT histogram (efficiency numerator)
void MakeAnalysis(AliAODEvent *aod, TClonesArray *mcArray)
AliAODVertex * PrimaryVertex(const TObjArray *trkArray, AliVEvent *event)
THnSparse * fHistoEleXiMassRSSide2
! e-Xi mass spectra (right-sign)
TH2F * fHistoLambdaPtvsDlMCS
! Lambda proper life time distribution (mc)
THnSparse * fHistoEleXiMassvsElePtMCS
! e-Xi mass-ept spectra (Efficiency numerator)
THnSparse * fHistoEleXiMassvsElePtMCS2
! e-Xi mass-ept spectra (Efficiency numerator)
void FillMCCascROOTObjects(AliAODMCParticle *mccpart, TClonesArray *mcArray)
THnSparse * fHistoElePtvsCutVarsMCS[23]
! e pt- cut variables (MCS)
THnSparse * fHistoXiMCGen
! Xi in mcArray (only from charmed baryon)
THnSparse * fHistoElePtvsXiPtRS
! e-Xi spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtRSMix1
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtWSMix1
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtMCGen1
! e-Xi mass-ept spectra (Efficiency denominator)
TH2F * fHistoElePtMCS
! e spectra (Efficiency numerator)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
TH2F * fHistoElectronTOFSelPID
! TOF electron PID after selection
Float_t * fCandidateMCCascVariables
! variables to be written to the tree
AliAODTrack * GetBachelor() const
Float_t * fCandidateMCEleVariables
! variables to be written to the tree
THnSparse * fHistoEleXiMassMCS
! e-Xi mass spectra (Efficiency numerator)
TObjArray * fCascadeTracks2
array of xi+compatible tracks
TTree * fEleVariablesTree
flag to decide whether to write the candidate variables on a tree variables
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:245
TObjArray * fElectronTracks
unique event id for mixed event check
TH1F * fCEvents
! Histogram to check selected events
void SetProngIDs(Int_t nIDs, UShort_t *id)
TH2F * fHistoElectronTPCPIDSelTOFSmallEta
! TPC electron PID after TOF 3 sigma cut (|eta|<0.6)
THnSparse * fHistoElePtvsd0WSMix
! e pt-d0 spectra (wrong-sign, mix)
TH2F * fHistoElectronTPCPIDSelTOF
! TPC electron PID after TOF 3 sigma cut
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
THnSparse * fHistoEleXiMassvsElePtWSSide2
! e-Xi mass-ept spectra (wrong-sign)
AliNormalizationCounter * fCounter
! Counter for normalization
Int_t fNzVtxBins
maximum number of events to be used in event mixing
TObjArray * fCascadeTracks1
array of e-compatible tracks
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
THnSparse * fHistoEleXiMassRSSide
! e-Xi mass spectra (right-sign)
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:319
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
AliAODcascade * GetCascade() const
TH2F * fHistoElePtMCGen
! e spectra (Efficiency denominator)
THnSparse * fHistoEleXiMassvsElePtMCGen2
! e-Xi mass-ept spectra (Efficiency denominator)
THnSparse * fHistoElePtvsd0RSMix
! e pt-d0 spectra (right-sign, mix)
AliAODRecoCascadeHF * MakeCascadeHF(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod, AliAODVertex *vert)
THnSparse * fHistoEleXiMassRS2
! e-Xi mass spectra (right-sign)
void FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
Bool_t IsEventSelected(AliVEvent *event)
THnSparse * fHistoEleXiMassWSMix1
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsXiPtWS
! e-Xi spectra (wrong-sign)
AliAODVertex * ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod)
Float_t nEvents[nProd]
AliAODVertex * CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *evt)
THnSparse * fHistoEleXiMassvsElePtWS1
! e-Xi mass spectra (wrong-sign)
TH2F * fHistoElectronTPCPIDSelTOFLargeEta
! TPC electron PID after TOF 3 sigma cut (0.8>|eta|>0.6)
THnSparse * fHistoEleXiMassvsElePtWSMix
! e-Xi mass-ept spectra (wrong-sign)
Bool_t fIsMB
Reconstruct primary vertex excluding candidate tracks.
THnSparse * fHistoElePtvsEtaRSMix
! e spectra (right-sign, mix)
THnSparse * fHistoEleXiMassvsElePtRSMix
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassWSSide1
! e-Xi mass spectra (wrong-sign)
const Double_t etamax
THnSparse * fHistoEleXiMassWS2
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoElePtvsd0BFeeddownMCS
! e pt-d0 spectra (right-sign)
Bool_t SingleTrkCutsNoPID(AliAODTrack *trk, AliAODVertex *primvert)
THnSparse * fHistoEleXiMassvsElePtRSSide2
! e-Xi mass-ept spectra (right-sign)
THnSparse * fHistoEleXiMassWS1
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassWSSide2
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtRS1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtRSSide
! e-Xi mass-ept spectra (right-sign)
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:253
void SelectCascade(const AliVEvent *event, Int_t nCasc, Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:295
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999)
TH2F * fHistoElectronTPCSelPID
! TPC electron PID after selection
void FillMixROOTObjects(TLorentzVector *et, TLorentzVector *ev, Int_t charge)
THnSparse * fHistoEleXiMassRSSide1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassRSMix
! e-Xi mass spectra (right-sign)
THnSparse * fHistoEleXiMassvsElePtWSSide1
! e-Xi mass-ept spectra (wrong-sign)
THnSparse * fHistoEleXiMassvsElePtWS
! e-Xi mass spectra (wrong-sign)
THnSparse * fHistoEleXiMassWSMix
! e-Xi mass spectra (wrong-sign)
TH2D * fHistoResponseElePt
! Response function electron pT <- True ept
THnSparse * fHistoElePtvsXiPtMCXicGen
! e-Xi spectra efficiency denominator
THnSparse * fHistoEleXiMassRS1
! e-Xi mass spectra (right-sign)
THnSparse * fHistoElePtvsXiPtvsXicPtMCGen
! e-Xi spectra efficiency numerator
TH2F * fHistoLambdaPtvsDlSide
! Lambda proper life time distribution (sideband)
TTree * fVariablesTree
flag to decide whether to write the candidate variables on a tree variables