AliPhysics  e6d2b2b (e6d2b2b)
AliAnalysisTaskSEOmegac2eleOmegafromAODtracks.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 // Omegac->eOmega analysis code
21 //
22 // Input: AOD
23 // Output: TTree or THnSparse (mass vs pT vs Centrality)
24 //
25 //-------------------------------------------------------------------------
26 //
27 // Authors: Y.S Watanabe(a)
28 // (a) CNS, the University of Tokyo
29 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
30 //-------------------------------------------------------------------------
31 
32 #include <TSystem.h>
33 #include <TParticle.h>
34 #include <TParticlePDG.h>
35 #include <TH1F.h>
36 #include <TH1F.h>
37 #include <TH2F.h>
38 #include <THnSparse.h>
39 #include <TLorentzVector.h>
40 #include <TTree.h>
41 #include "TROOT.h"
42 #include <TDatabasePDG.h>
43 #include <AliAnalysisDataSlot.h>
44 #include <AliAnalysisDataContainer.h>
45 #include "AliMCEvent.h"
46 #include "AliAnalysisManager.h"
47 #include "AliAODMCHeader.h"
48 #include "AliAODHandler.h"
49 #include "AliLog.h"
50 #include "AliExternalTrackParam.h"
51 #include "AliAODVertex.h"
52 #include "AliESDVertex.h"
53 #include "AliAODRecoDecay.h"
54 #include "AliAODRecoDecayHF.h"
55 #include "AliAODRecoCascadeHF.h"
56 #include "AliESDtrack.h"
57 #include "AliAODTrack.h"
58 #include "AliAODv0.h"
59 #include "AliAODcascade.h"
60 #include "AliAODMCParticle.h"
61 #include "AliAnalysisTaskSE.h"
63 #include "AliPIDResponse.h"
64 #include "AliPIDCombined.h"
65 #include "AliTOFPIDResponse.h"
66 #include "AliAODPidHF.h"
67 #include "AliInputEventHandler.h"
68 #include "AliESDtrackCuts.h"
69 #include "AliNeutralTrackParam.h"
70 #include "AliKFParticle.h"
71 #include "AliKFVertex.h"
72 #include "AliExternalTrackParam.h"
73 #include "AliESDtrack.h"
74 #include "AliCentrality.h"
75 #include "AliVertexerTracks.h"
76 #include "AliEventPoolManager.h"
78 
79 using std::cout;
80 using std::endl;
81 
85 
86 //__________________________________________________________________________
89  fUseMCInfo(kFALSE),
90  fOutput(0),
91  fOutputAll(0),
92  fListCuts(0),
93  fCEvents(0),
94  fHTrigger(0),
95  fHCentrality(0),
96  fAnalCuts(0),
97  fIsEventSelected(kFALSE),
98  fWriteVariableTree(kFALSE),
99  fWriteEachVariableTree(kFALSE),
100  fWriteMCVariableTree(kFALSE),
101  fVariablesTree(0),
102  fEleVariablesTree(0),
103  fCascVariablesTree(0),
104  fMCVariablesTree(0),
105  fReconstructPrimVert(kFALSE),
106  fIsMB(kFALSE),
107  fIsSemi(kFALSE),
108  fIsCent(kFALSE),
109  fIsINT7(kFALSE),
110  fIsEMC7(kFALSE),
111  fCandidateVariables(),
112  fCandidateEleVariables(),
113  fCandidateCascVariables(),
114  fCandidateMCVariables(),
115  fVtx1(0),
116  fV1(0),
117  fVtxZ(0),
118  fBzkG(0),
119  fCentrality(0),
120  fTriggerCheck(0),
121  fUseCentralityV0M(kFALSE),
122  fEvNumberCounter(0),
123  fHistoEleOmegaMass(0),
124  fHistoEleOmegaMassRS(0),
125  fHistoEleOmegaMassWS(0),
126  fHistoEleOmegaMassRSMix(0),
127  fHistoEleOmegaMassWSMix(0),
128  fHistoEleOmegaMassvsElePtRS(0),
129  fHistoEleOmegaMassvsElePtWS(0),
130  fHistoEleOmegaMassvsElePtRSMix(0),
131  fHistoEleOmegaMassvsElePtWSMix(0),
132  fHistoElePtRS(0),
133  fHistoElePtWS(0),
134  fHistoElePtRSMix(0),
135  fHistoElePtWSMix(0),
136  fHistoEleOmegaMassMCS(0),
137  fHistoEleOmegaMassMCGen(0),
138  fHistoEleOmegaMassvsElePtMCS(0),
139  fHistoEleOmegaMassvsElePtMCGen(0),
140  fHistoElePtMCS(0),
141  fHistoElePtMCGen(0),
142  fHistoElePtvsEtaRS(0),
143  fHistoElePtvsEtaWS(0),
144  fHistoElePtvsEtaRSMix(0),
145  fHistoElePtvsEtaWSMix(0),
146  fHistoElePtvsEtaMCS(0),
147  fHistoElePtvsEtaMCGen(0),
148  fHistoElePtvsOmegaPtRS(0),
149  fHistoElePtvsOmegaPtWS(0),
150  fHistoElePtvsOmegaPtRSMix(0),
151  fHistoElePtvsOmegaPtWSMix(0),
152  fHistoElePtvsOmegaPtMCS(0),
153  fHistoElePtvsOmegaPtMCGen(0),
154  fHistoElePtvsd0RS(0),
155  fHistoElePtvsd0WS(0),
156  fHistoElePtvsd0RSMix(0),
157  fHistoElePtvsd0WSMix(0),
158  fHistoElePtvsd0MCS(0),
159  fHistoBachPt(0),
160  fHistoBachPtMCS(0),
161  fHistoBachPtMCGen(0),
162  fHistod0Bach(0),
163  fHistoXiMassvsPt(0),
164  fHistoOmegaMassvsPt(0),
165  fHistoOmegaMassvsPtMCS(0),
166  fHistoOmegaMassvsPtMCGen(0),
167  fHistoElectronTPCPID(0),
168  fHistoElectronTOFPID(0),
169  fHistoElectronTPCSelPID(0),
170  fHistoElectronTOFSelPID(0),
171  fHistoElectronTPCPIDSelTOF(0),
172  fHistoElectronTPCPIDSelTOFSmallEta(0),
173  fHistoElectronTPCPIDSelTOFLargeEta(0),
174  fCounter(0),
175  fHistonEvtvsRunNumber(0),
176  fHistonElevsRunNumber(0),
177  fHistonOmegavsRunNumber(0),
178  fDoEventMixing(0),
179  fNumberOfEventsForMixing (5),
180  fNzVtxBins (0),
181  fNCentBins (0),
182  fNOfPools(1),
183  fEventBuffer(0x0),
184  fEventInfo(0x0),
185  fElectronTracks(0x0)
186 {
187  //
188  // Default Constructor.
189  //
190 }
191 
192 //___________________________________________________________________________
195  Bool_t writeVariableTree) :
196  AliAnalysisTaskSE(name),
197  fUseMCInfo(kFALSE),
198  fOutput(0),
199  fOutputAll(0),
200  fListCuts(0),
201  fCEvents(0),
202  fHTrigger(0),
203  fHCentrality(0),
204  fAnalCuts(analCuts),
205  fIsEventSelected(kFALSE),
206  fWriteVariableTree(writeVariableTree),
207  fWriteEachVariableTree(kFALSE),
208  fWriteMCVariableTree(kFALSE),
209  fVariablesTree(0),
212  fMCVariablesTree(0),
213  fReconstructPrimVert(kFALSE),
214  fIsMB(kFALSE),
215  fIsSemi(kFALSE),
216  fIsCent(kFALSE),
217  fIsINT7(kFALSE),
218  fIsEMC7(kFALSE),
223  fVtx1(0),
224  fV1(0),
225  fVtxZ(0),
226  fBzkG(0),
227  fCentrality(0),
228  fTriggerCheck(0),
229  fUseCentralityV0M(kFALSE),
230  fEvNumberCounter(0),
240  fHistoElePtRS(0),
241  fHistoElePtWS(0),
242  fHistoElePtRSMix(0),
243  fHistoElePtWSMix(0),
248  fHistoElePtMCS(0),
249  fHistoElePtMCGen(0),
267  fHistoBachPt(0),
268  fHistoBachPtMCS(0),
270  fHistod0Bach(0),
271  fHistoXiMassvsPt(0),
282  fCounter(0),
286  fDoEventMixing(0),
288  fNzVtxBins (0),
289  fNCentBins (0),
290  fNOfPools(1),
291  fEventBuffer(0x0),
292  fEventInfo(0x0),
293  fElectronTracks(0x0)
294 {
295  //
296  // Constructor. Initialization of Inputs and Outputs
297  //
298  Info("AliAnalysisTaskSEOmegac2eleOmegafromAODtracks","Calling Constructor");
299 
300  DefineOutput(1,TList::Class()); //conters
301  DefineOutput(2,TList::Class());
302  DefineOutput(3,TList::Class()); //conters
303  DefineOutput(4,TTree::Class()); //My private output
304  DefineOutput(5,TTree::Class()); //My private output
305  DefineOutput(6,TTree::Class()); //My private output
306  DefineOutput(7,TTree::Class()); //My private output
307  DefineOutput(8,AliNormalizationCounter::Class());
308 }
309 
310 //___________________________________________________________________________
312  //
313  // destructor
314  //
315  Info("~AliAnalysisTaskSEOmegac2eleOmegafromAODtracks","Calling Destructor");
316 
317  if (fOutput) {
318  delete fOutput;
319  fOutput = 0;
320  }
321 
322  if (fOutputAll) {
323  delete fOutputAll;
324  fOutputAll = 0;
325  }
326 
327  if (fListCuts) {
328  delete fListCuts;
329  fListCuts = 0;
330  }
331 
332 
333  if (fAnalCuts) {
334  delete fAnalCuts;
335  fAnalCuts = 0;
336  }
337 
338  if (fVariablesTree) {
339  delete fVariablesTree;
340  fVariablesTree = 0;
341  }
342  if (fEleVariablesTree) {
343  delete fEleVariablesTree;
344  fEleVariablesTree = 0;
345  }
346  if (fCascVariablesTree) {
347  delete fCascVariablesTree;
348  fCascVariablesTree = 0;
349  }
350  if (fMCVariablesTree) {
351  delete fMCVariablesTree;
352  fMCVariablesTree = 0;
353  }
354 
355 
356 }
357 
358 //_________________________________________________
360  //
361  // Initialization
362  //
363  //
364 
365  fIsEventSelected=kFALSE;
366 
367  if (fDebug > 1) AliInfo("Init");
368 
369  fListCuts = new TList();
370  fListCuts->SetOwner();
371  fListCuts->SetName("ListCuts");
373  PostData(2,fListCuts);
374 
375  return;
376 }
377 
378 //_________________________________________________
380 {
381  //
382  // UserExec
383  //
384 
385  if (!fInputEvent) {
386  AliError("NO EVENT FOUND!");
387  return;
388  }
389  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
390 
391  fCEvents->Fill(1);
392 
393  //------------------------------------------------
394  // First check if the event has proper vertex and B
395  //------------------------------------------------
396 
397  fBzkG = (Double_t)aodEvent->GetMagneticField();
398  AliKFParticle::SetField(fBzkG);
399  if (TMath::Abs(fBzkG)<0.001) {
400  return;
401  }
402  fCEvents->Fill(2);
403 
406 
407  //------------------------------------------------
408  // MC analysis setting
409  //------------------------------------------------
410  TClonesArray *mcArray = 0;
411  AliAODMCHeader *mcHeader=0;
412  if (fUseMCInfo) {
413  // MC array need for maching
414  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
415  if (!mcArray) {
416  AliError("Could not find Monte-Carlo in AOD");
417  return;
418  }
419  fCEvents->Fill(6); // in case of MC events
420 
421  // load MC header
422  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
423  if (!mcHeader) {
424  AliError("AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::UserExec: MC header branch not found!\n");
425  return;
426  }
427  fCEvents->Fill(7); // in case of MC events
428 
429  Double_t zMCVertex = mcHeader->GetVtxZ();
430  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
431  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
432  return;
433  } else {
434  fCEvents->Fill(17); // in case of MC events
435  }
436  if ((TMath::Abs(zMCVertex) < fAnalCuts->GetMaxVtxZ()) && (!fAnalCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnalCuts->IsEventRejectedDueToTrigger())) {
437  MakeMCAnalysis(mcArray);
438  }
439  }
440 
441  //------------------------------------------------
442  // Event selection
443  //------------------------------------------------
444  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
445  if (!fVtx1) return;
446 
447  Double_t pos[3],cov[6];
448  fVtx1->GetXYZ(pos);
449  fVtx1->GetCovarianceMatrix(cov);
450  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
451  fVtxZ = pos[2];
452 
453  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
454  if(!fIsTriggerNotOK) fCEvents->Fill(3);
455  if(!fIsEventSelected) {
456  delete fV1;
457  return;
458  }
459  fCEvents->Fill(4);
460 
461  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
462  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
463  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
464  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
465  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
467  if(fIsMB) fHTrigger->Fill(1);
468  if(fIsSemi) fHTrigger->Fill(2);
469  if(fIsCent) fHTrigger->Fill(3);
470  if(fIsINT7) fHTrigger->Fill(4);
471  if(fIsEMC7) fHTrigger->Fill(5);
472  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
473  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
474  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
475  if(fIsMB&fIsCent) fHTrigger->Fill(11);
476  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
477 
478  if(fUseCentralityV0M){
479  AliCentrality *cent = aodEvent->GetCentrality();
480  fCentrality = cent->GetCentralityPercentile("V0M");
481  }else{
482  fCentrality = 1.;
483  }
484  if(fCentrality<0.||fCentrality>100.-0.0000001) {
485  delete fV1;
486  return;
487  }
488  fHCentrality->Fill(fCentrality);
490 
491  Int_t runnumber_offset = 0;
492  Int_t runnumber = aodEvent->GetRunNumber();
493  if(runnumber<=117222&&runnumber>=114931){
494  runnumber_offset = 114931;//lhc10b
495  }else if(runnumber<=120829&&runnumber>=119159){
496  runnumber_offset = 119159;//lhc10c
497  }else if(runnumber<=126437&&runnumber>=122374){
498  runnumber_offset = 122374;//lhc10d
499  }else if(runnumber<=130840&&runnumber>=127712){
500  runnumber_offset = 127712;//lhc10e
501  }else if(runnumber<=195483&&runnumber>=195344){
502  runnumber_offset = 195344;//lhc13b
503  }else if(runnumber<=195677&&runnumber>=195529){
504  runnumber_offset = 195529;//lhc13c
505  }else if(runnumber<=170593&&runnumber>=167902){
506  runnumber_offset = 167902;//lhc11h
507  }
508  fHistonEvtvsRunNumber->Fill(runnumber-runnumber_offset,1.);
509 
510  //------------------------------------------------
511  // Check if the event has v0 candidate
512  //------------------------------------------------
513  //Int_t nv0 = aodEvent->GetNumberOfV0s();
514  fCEvents->Fill(5);
515 
516 
517  //------------------------------------------------
518  // Main analysis done in this function
519  //------------------------------------------------
520  MakeAnalysis(aodEvent,mcArray);
521 
522 
523  PostData(1,fOutput);
524  PostData(3,fOutputAll);
525  PostData(4,fVariablesTree);
526  PostData(5,fEleVariablesTree);
527  PostData(6,fCascVariablesTree);
528  PostData(7,fMCVariablesTree);
529  PostData(8,fCounter);
530 
531  fIsEventSelected=kFALSE;
532 
533  delete fV1;
534  return;
535 }
536 
537 //________________________________________ terminate ___________________________
539 {
540  // The Terminate() function is the last function to be called during
541  // a query. It always runs on the client, it can be used to present
542  // the results graphically or save the results to file.
543 
544  //AliInfo("Terminate","");
545  AliAnalysisTaskSE::Terminate();
546 
547  fOutput = dynamic_cast<TList*> (GetOutputData(1));
548  if (!fOutput) {
549  AliError("fOutput not available");
550  return;
551  }
552 
553  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
554  if (!fOutputAll) {
555  AliError("fOutputAll not available");
556  return;
557  }
558 
559  return;
560 }
561 
562 //___________________________________________________________________________
564 {
565  //
566  // UserCreateOutputObject
567  //
568  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
569 
570  //------------------------------------------------
571  // output object setting
572  //------------------------------------------------
573  fOutput = new TList();
574  fOutput->SetOwner();
575  fOutput->SetName("chist0");
576  DefineGeneralHistograms(); // define general histograms
577  PostData(1,fOutput);
578 
579  fOutputAll = new TList();
580  fOutputAll->SetOwner();
581  fOutputAll->SetName("anahisto");
582  DefineAnalysisHistograms(); // define general histograms
583  PostData(3,fOutputAll);
584 
586  PostData(4,fVariablesTree);
587 
589  PostData(5,fEleVariablesTree);
590 
592  PostData(6,fCascVariablesTree);
593 
595  PostData(7,fMCVariablesTree);
596 
597  //Counter for Normalization
598  TString normName="NormalizationCounter";
599  AliAnalysisDataContainer *cont = GetOutputSlot(8)->GetContainer();
600  if(cont)normName=(TString)cont->GetName();
601  fCounter = new AliNormalizationCounter(normName.Data());
602  fCounter->Init();
603  PostData(8,fCounter);
604 
605  if(fDoEventMixing){
606  fElectronTracks = new TObjArray();
607  fElectronTracks->SetOwner();
608 
610  fEventBuffer = new TTree*[fNOfPools];
611  for(Int_t i=0; i<fNOfPools; i++){
612  fEventBuffer[i]=new TTree(Form("EventBuffer_%d",i), "Temporary buffer for event mixing");
613  fEventBuffer[i]->Branch("zVertex", &fVtxZ);
614  fEventBuffer[i]->Branch("centrality", &fCentrality);
615  fEventBuffer[i]->Branch("eventInfo", "TObjString",&fEventInfo);
616  fEventBuffer[i]->Branch("earray", "TObjArray", &fElectronTracks);
617  }
618  }
619 
620 
621  return;
622 }
623 
624 //-------------------------------------------------------------------------------
626 (
627  AliAODEvent *aodEvent, TClonesArray *mcArray
628  )
629 {
630  //
631  // Main Analysis part
632  //
633  //------------------------------------------------
634  // Select good track before hand to save time
635  //------------------------------------------------
637 
638  Int_t nCascs= aodEvent->GetNumberOfCascades();
639  Int_t nTracks= aodEvent->GetNumberOfTracks();
640 
641  Bool_t seleTrkFlags[nTracks];
642  Int_t nSeleTrks=0;
643  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags,mcArray);
644 
645  Bool_t seleCascFlags[nCascs];
646  Int_t nSeleCasc=0;
647  SelectCascade(aodEvent,nCascs,nSeleCasc,seleCascFlags,mcArray);
648 
649  Int_t runnumber_offset = 0;
650  Int_t runnumber = aodEvent->GetRunNumber();
651  if(runnumber<=117222&&runnumber>=114931){
652  runnumber_offset = 114931;//lhc10b
653  }else if(runnumber<=120829&&runnumber>=119159){
654  runnumber_offset = 119159;//lhc10c
655  }else if(runnumber<=126437&&runnumber>=122374){
656  runnumber_offset = 122374;//lhc10d
657  }else if(runnumber<=130840&&runnumber>=127712){
658  runnumber_offset = 127712;//lhc10e
659  }else if(runnumber<=195483&&runnumber>=195344){
660  runnumber_offset = 195344;//lhc13b
661  }else if(runnumber<=195677&&runnumber>=195529){
662  runnumber_offset = 195529;//lhc13c
663  }else if(runnumber<=170593&&runnumber>=167902){
664  runnumber_offset = 167902;//lhc11h
665  }
666  fHistonElevsRunNumber->Fill(runnumber-runnumber_offset,nSeleTrks);
667  fHistonOmegavsRunNumber->Fill(runnumber-runnumber_offset,nSeleCasc);
668 
669  //------------------------------------------------
670  // Cascade loop
671  //------------------------------------------------
672  for (Int_t icasc = 0; icasc<nCascs; icasc++) {
673  if(!seleCascFlags[icasc]) continue;
674  AliAODcascade *casc = aodEvent->GetCascade(icasc);
675  if(!casc) continue;
676 
677  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
678  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
679  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
680 
681  //------------------------------------------------
682  // track loop
683  //------------------------------------------------
684  for (Int_t itrk = 0; itrk<nTracks; itrk++) {
685  if(!seleTrkFlags[itrk]) continue;
686  AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
687  if(trk->GetID()<0) continue;
688 
689  Int_t cpid = cptrack->GetID();
690  Int_t cnid = cntrack->GetID();
691  Int_t cbid = cbtrack->GetID();
692  Int_t lpid = trk->GetID();
693  if((cpid==lpid)||(cnid==lpid)||(cbid==lpid)) continue;
694 
695  //if(!fAnalCuts->SelectWithRoughCuts(v0,trk)) continue;
696 
697  AliAODVertex *secVert = ReconstructSecondaryVertex(casc,trk,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
698  if(!secVert) continue;
699 
700  AliAODRecoCascadeHF *exobj = MakeCascadeHF(casc,trk,aodEvent,secVert,false);
701  if(!exobj) {
702  continue;
703  }
704 
705  FillROOTObjects(exobj, casc,trk,mcArray,false);
706 
707  exobj->GetSecondaryVtx()->RemoveDaughters();
708  exobj->UnsetOwnPrimaryVtx();
709  delete exobj;exobj=NULL;
710  delete secVert;
711  }
712  }
713 
714  if(fDoEventMixing){
715  fEventInfo->SetString(Form("Ev%d_esd%d_E%d",AliAnalysisManager::GetAnalysisManager()->GetNcalls(),((AliAODHeader*)aodEvent->GetHeader())->GetEventNumberESDFile(),fElectronTracks->GetEntries()));
717  if(ind>=0 && ind<fNOfPools){
718  if(fEventBuffer[ind]->GetEntries() >= fNumberOfEventsForMixing){
719  DoEventMixingWithPools(ind,aodEvent,seleCascFlags);
720  //ResetPool(ind);
721  }
722  fEventBuffer[ind]->Fill();
723  }
724  }
725 }
726 
727 
730 {
731  //
732  // Define tree variables
733  //
734 
735  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
736  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
737  Int_t nVar = 64;
739  TString * fCandidateVariableNames = new TString[nVar];
740 
741  fCandidateVariableNames[ 0]="Centrality";
742  fCandidateVariableNames[ 1]="InvMassEleOmega";
743  fCandidateVariableNames[ 2]="EleOmegaPt";
744  fCandidateVariableNames[ 3]="EleOmegaPx";
745  fCandidateVariableNames[ 4]="EleOmegaPy";
746  fCandidateVariableNames[ 5]="EleOmegaPz";
747  fCandidateVariableNames[ 6]="ElePx";
748  fCandidateVariableNames[ 7]="ElePy";
749  fCandidateVariableNames[ 8]="ElePz";
750  fCandidateVariableNames[ 9]="OmegaPx";
751  fCandidateVariableNames[10]="OmegaPy";
752  fCandidateVariableNames[11]="OmegaPz";
753  fCandidateVariableNames[12]="OmegaCharge";
754  fCandidateVariableNames[13]="MassOmega";
755  fCandidateVariableNames[14]="MassLambda";
756  fCandidateVariableNames[15]="Eled0";
757  fCandidateVariableNames[16]="Omegad0";
758  fCandidateVariableNames[17]="nSigmaTPCele";
759  fCandidateVariableNames[18]="nSigmaTOFele";
760  fCandidateVariableNames[19]="nSigmaTPCpr_etrk";
761  fCandidateVariableNames[20]="nSigmaTOFpr_etrk";
762  fCandidateVariableNames[21]="nSigmaTPCka_etrk";
763  fCandidateVariableNames[22]="nSigmaTOFka_etrk";
764  fCandidateVariableNames[23]="nSigmaTPCv0pr";
765  fCandidateVariableNames[24]="nSigmaTOFv0pr";
766  fCandidateVariableNames[25]="nSigmaTPCv0pi";
767  fCandidateVariableNames[26]="nSigmaTOFv0pi";
768  fCandidateVariableNames[27]="nSigmaTPCbachka";
769  fCandidateVariableNames[28]="nSigmaTOFbachka";
770  fCandidateVariableNames[29]="EleCharge";
771  fCandidateVariableNames[30]="Mixing";
772  fCandidateVariableNames[31]="DcaOmegaDaughters";
773  fCandidateVariableNames[32]="DcaV0Daughters";
774  fCandidateVariableNames[33]="DecayLengthXi";
775  fCandidateVariableNames[34]="CosPointingAngleXi";
776  fCandidateVariableNames[35]="DcaV0toPrimVertex";
777  fCandidateVariableNames[36]="DcaPostoPrimVertex";
778  fCandidateVariableNames[37]="DcaNegtoPrimVertex";
779  fCandidateVariableNames[38]="DcaBachtoPrimVertex";
780  fCandidateVariableNames[39]="DecayLengthV0";
781  fCandidateVariableNames[40]="CosPointingAngleV0";
782 
783  fCandidateVariableNames[41]="mcpdgomegac";
784  fCandidateVariableNames[42]="mclabomegac";
785  fCandidateVariableNames[43]="mcomegacpx";
786  fCandidateVariableNames[44]="mcomegacpy";
787  fCandidateVariableNames[45]="mcomegacpz";
788  fCandidateVariableNames[46]="mcelepx";
789  fCandidateVariableNames[47]="mcelepy";
790  fCandidateVariableNames[48]="mcelepz";
791  fCandidateVariableNames[49]="mccascpx";
792  fCandidateVariableNames[50]="mccascpy";
793  fCandidateVariableNames[51]="mccascpz";
794 
795  fCandidateVariableNames[52]="mcpdgele";
796  fCandidateVariableNames[53]="mcpdgcasc";
797  fCandidateVariableNames[54]="mcpdgmomele";
798  fCandidateVariableNames[55]="mcpdgmomcasc";
799  fCandidateVariableNames[56]="mcpdggrmomele";
800  fCandidateVariableNames[57]="mcpdggrmomcasc";
801  fCandidateVariableNames[58]="mcngenele";
802  fCandidateVariableNames[59]="mcngencasc";
803 
804  fCandidateVariableNames[60]="nSigmaTPCpi_etrk";
805  fCandidateVariableNames[61]="nSigmaTOFpi_etrk";
806  fCandidateVariableNames[62]="MassXi";
807 
808  fCandidateVariableNames[63]="EvNumber";
809 
810  for (Int_t ivar=0; ivar<nVar; ivar++) {
811  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
812  }
813 
814  return;
815 }
816 
818 void AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *exobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray, Bool_t mixing_flag)
819 {
820  //
821  // Fill histograms or tree depending on fWriteVariableTree
822  //
823  if(!trk) return;
824  if(!casc) return;
825 
826  for(Int_t i=0;i<64;i++){
827  fCandidateVariables[i] = -9999.;
828  }
829 
830 
831  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
832  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
833  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
834  Double_t posVtx[3] = {0.,0.,0.};
835  fVtx1->GetXYZ(posVtx);
836 
837 
839  UInt_t pdgdg[2]={11,3334};
840  fCandidateVariables[ 1] = exobj->InvMass(2,pdgdg);
841  fCandidateVariables[ 2] = exobj->Pt();
842  fCandidateVariables[ 3] = exobj->Px();
843  fCandidateVariables[ 4] = exobj->Py();
844  fCandidateVariables[ 5] = exobj->Pz();
845  fCandidateVariables[ 6] = exobj->PxProng(0);
846  fCandidateVariables[ 7] = exobj->PyProng(0);
847  fCandidateVariables[ 8] = exobj->PzProng(0);
848  fCandidateVariables[ 9] = exobj->PxProng(1);
849  fCandidateVariables[10] = exobj->PyProng(1);
850  fCandidateVariables[11] = exobj->PzProng(1);
851  fCandidateVariables[12] = casc->ChargeXi();
852  fCandidateVariables[13] = casc->MassOmega();
853  if(casc->ChargeXi()<0)
854  fCandidateVariables[14] = casc->MassLambda();
855  else
856  fCandidateVariables[14] = casc->MassAntiLambda();
857  fCandidateVariables[15] = exobj->Getd0Prong(0);
858  fCandidateVariables[16] = exobj->Getd0Prong(1);
859 
860  if(fAnalCuts->GetIsUsePID()&&!mixing_flag)
861  {
862  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
863  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
864  fCandidateVariables[17] = nSigmaTPCele;
865  fCandidateVariables[18] = nSigmaTOFele;
866 
867  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
868  Double_t nSigmaTOFpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kProton);
869  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
870  Double_t nSigmaTOFka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kKaon);
871  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
872  Double_t nSigmaTOFpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kPion);
873  fCandidateVariables[19] = nSigmaTPCpr_etrk;
874  fCandidateVariables[20] = nSigmaTOFpr_etrk;
875  fCandidateVariables[21] = nSigmaTPCka_etrk;
876  fCandidateVariables[22] = nSigmaTOFka_etrk;
877  fCandidateVariables[60] = nSigmaTPCpi_etrk;
878  fCandidateVariables[61] = nSigmaTOFpi_etrk;
879  }
880 
881  if(fAnalCuts->GetUseCascadePID()&&!mixing_flag)
882  {
883  Double_t nSigmaTPCv0pr=-9999.;
884  Double_t nSigmaTOFv0pr=-9999.;
885  Double_t nSigmaTPCv0pi=-9999.;
886  Double_t nSigmaTOFv0pi=-9999.;
887  Double_t nSigmaTPCbachka=-9999.;
888  Double_t nSigmaTOFbachka=-9999.;
889  if(casc->ChargeXi()>0){
890  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
891  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kProton);
892  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
893  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kPion);
894  nSigmaTPCbachka = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kKaon);
895  nSigmaTOFbachka = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kKaon);
896  }else{
897  nSigmaTPCv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
898  nSigmaTOFv0pr = fAnalCuts->GetPidCascPr()->GetPidResponse()->NumberOfSigmasTOF(cptrack,AliPID::kProton);
899  nSigmaTPCv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
900  nSigmaTOFv0pi = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cntrack,AliPID::kPion);
901  nSigmaTPCbachka = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTPC(cbtrack,AliPID::kKaon);
902  nSigmaTOFbachka = fAnalCuts->GetPidCascPi()->GetPidResponse()->NumberOfSigmasTOF(cbtrack,AliPID::kKaon);
903  }
904  fCandidateVariables[23] = nSigmaTPCv0pr;
905  fCandidateVariables[24] = nSigmaTOFv0pr;
906  fCandidateVariables[25] = nSigmaTPCv0pi;
907  fCandidateVariables[26] = nSigmaTOFv0pi;
908  fCandidateVariables[27] = nSigmaTPCbachka;
909  fCandidateVariables[28] = nSigmaTOFbachka;
910  }
911  fCandidateVariables[29] = trk->Charge();
912  fCandidateVariables[30] = (Float_t) mixing_flag;
913  fCandidateVariables[31] = casc->DcaXiDaughters();
914  fCandidateVariables[32] = casc->DcaV0Daughters();
915  fCandidateVariables[33] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
916  fCandidateVariables[34] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
917  fCandidateVariables[35] = casc->DcaV0ToPrimVertex();
918  fCandidateVariables[36] = casc->DcaPosToPrimVertex();
919  fCandidateVariables[37] = casc->DcaNegToPrimVertex();
920  fCandidateVariables[38] = casc->DcaBachToPrimVertex();
921  fCandidateVariables[39] = casc->DecayLengthV0();
922  fCandidateVariables[40] = casc->CosPointingAngle(casc->GetDecayVertexXi());
923 
924  AliAODMCParticle *mcomegac = 0;
925  AliAODMCParticle *mcele = 0;
926  AliAODMCParticle *mccasc = 0;
927  Int_t mclabomegac = 0;
928  Int_t mcpdgele_array[100];
929  Int_t mcpdgcasc_array[100];
930  Int_t mclabelele_array[100];
931  Int_t mclabelcasc_array[100];
932  Int_t mcngen_ele = -9999;
933  Int_t mcngen_casc = -9999;
934 
935  if(fUseMCInfo && mcArray){
936 
937  mclabomegac = MatchToMC(exobj,mcArray,mcpdgele_array, mcpdgcasc_array,mclabelele_array,mclabelcasc_array,mcngen_ele,mcngen_casc);
938 
939  if(mclabomegac>-1){
940  mcomegac = (AliAODMCParticle*) mcArray->At(mclabomegac);
941  if(mclabelele_array[0]>=0)
942  mcele = (AliAODMCParticle*) mcArray->At(mclabelele_array[0]);
943  if(mclabelcasc_array[0]>=0)
944  mccasc = (AliAODMCParticle*) mcArray->At(mclabelcasc_array[0]);
945  if(mcomegac){
946  fCandidateVariables[41] = mcomegac->GetPdgCode();
947  fCandidateVariables[42] = mcomegac->Label();
948  fCandidateVariables[43] = mcomegac->Px();
949  fCandidateVariables[44] = mcomegac->Py();
950  fCandidateVariables[45] = mcomegac->Pz();
951  }
952  if(mcele){
953  fCandidateVariables[46] = mcele->Px();
954  fCandidateVariables[47] = mcele->Py();
955  fCandidateVariables[48] = mcele->Pz();
956  }
957  if(mccasc){
958  fCandidateVariables[49] = mccasc->Px();
959  fCandidateVariables[50] = mccasc->Py();
960  fCandidateVariables[51] = mccasc->Pz();
961  }
962  }
963  fCandidateVariables[52] = mcpdgele_array[0];
964  fCandidateVariables[53] = mcpdgcasc_array[0];
965  fCandidateVariables[54] = mcpdgele_array[1];
966  fCandidateVariables[55] = mcpdgcasc_array[1];
967  fCandidateVariables[56] = mcpdgele_array[2];
968  fCandidateVariables[57] = mcpdgcasc_array[2];
969  fCandidateVariables[58] = mcngen_ele;
970  fCandidateVariables[59] = mcngen_casc;
971  }
972 
973  fCandidateVariables[62] = casc->MassXi();
975 
976 
978  fVariablesTree->Fill();
979 
981  {
982  Double_t cont[3];
983  cont[0] = exobj->InvMass(2,pdgdg);
984  cont[1] = exobj->Pt();
985  cont[2] = fCentrality;
986  fHistoEleOmegaMass->Fill(cont);
987 
988  Double_t cont2[3];
989  cont2[0] = exobj->InvMass(2,pdgdg);
990  cont2[1] = trk->Pt();
991  cont2[2] = fCentrality;
992 
993  Double_t cont_eleptvseta[3];
994  cont_eleptvseta[0] = trk->Pt();
995  cont_eleptvseta[1] = trk->Eta();
996  cont_eleptvseta[2] = fCentrality;
997 
998  Double_t cont_eleptvsomegapt[3];
999  cont_eleptvsomegapt[0] = trk->Pt();
1000  cont_eleptvsomegapt[1] = sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY());
1001  cont_eleptvsomegapt[2] = fCentrality;
1002 
1003  Double_t cont_eleptvsd0[3];
1004  cont_eleptvsd0[0] = trk->Pt();
1005  cont_eleptvsd0[1] = exobj->Getd0Prong(0);
1006  cont_eleptvsd0[2] = fCentrality;
1007 
1008  if(mixing_flag){
1009  if(trk->Charge()*casc->ChargeXi()<0){
1010  fHistoEleOmegaMassRSMix->Fill(cont);
1011  fHistoEleOmegaMassvsElePtRSMix->Fill(cont2);
1012  if(cont[0]<2.7){
1013  fHistoElePtRSMix->Fill(trk->Pt(),fCentrality);
1014  fHistoElePtvsEtaRSMix->Fill(cont_eleptvseta);
1015  fHistoElePtvsOmegaPtRSMix->Fill(cont_eleptvsomegapt);
1016  fHistoElePtvsd0RSMix->Fill(cont_eleptvsd0);
1017  }
1018  }else{
1019  fHistoEleOmegaMassWSMix->Fill(cont);
1020  fHistoEleOmegaMassvsElePtWSMix->Fill(cont2);
1021  if(cont[0]<2.7){
1022  fHistoElePtWSMix->Fill(trk->Pt(),fCentrality);
1023  fHistoElePtvsEtaWSMix->Fill(cont_eleptvseta);
1024  fHistoElePtvsOmegaPtWSMix->Fill(cont_eleptvsomegapt);
1025  fHistoElePtvsd0WSMix->Fill(cont_eleptvsd0);
1026  }
1027  }
1028  }else{
1029  if(trk->Charge()*casc->ChargeXi()<0){
1030  fHistoEleOmegaMassRS->Fill(cont);
1031  fHistoEleOmegaMassvsElePtRS->Fill(cont2);
1032  if(cont[0]<2.7){
1033  fHistoElePtRS->Fill(trk->Pt(),fCentrality);
1034  fHistoElePtvsEtaRS->Fill(cont_eleptvseta);
1035  fHistoElePtvsOmegaPtRS->Fill(cont_eleptvsomegapt);
1036  fHistoElePtvsd0RS->Fill(cont_eleptvsd0);
1037  }
1038  }else{
1039  fHistoEleOmegaMassWS->Fill(cont);
1040  fHistoEleOmegaMassvsElePtWS->Fill(cont2);
1041  if(cont[0]<2.7){
1042  fHistoElePtWS->Fill(trk->Pt(),fCentrality);
1043  fHistoElePtvsEtaWS->Fill(cont_eleptvseta);
1044  fHistoElePtvsOmegaPtWS->Fill(cont_eleptvsomegapt);
1045  fHistoElePtvsd0WS->Fill(cont_eleptvsd0);
1046  }
1047  }
1048  }
1049 
1050  if(fUseMCInfo){
1051  if(mcomegac){
1052  Int_t pdgcode = mcomegac->GetPdgCode();
1053  if(abs(pdgcode)==4332 && abs(mcpdgele_array[1])==4332 && abs(mcpdgcasc_array[1])==4332){
1054  fHistoEleOmegaMassMCS->Fill(cont);
1055  fHistoEleOmegaMassvsElePtMCS->Fill(cont2);
1056  if(cont[0]<2.7){
1057  fHistoElePtMCS->Fill(trk->Pt(),fCentrality);
1058  fHistoElePtvsEtaMCS->Fill(cont_eleptvseta);
1059  fHistoElePtvsOmegaPtMCS->Fill(cont_eleptvsomegapt);
1060  fHistoElePtvsd0MCS->Fill(cont_eleptvsd0);
1061  }
1062  }
1063  }
1064  }
1065  }
1066 
1067  return;
1068 }
1069 
1072 {
1073  //
1074  // Define electron tree variables
1075  //
1076 
1077  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
1078  fEleVariablesTree = new TTree(nameoutput,"electron variables tree");
1079  Int_t nVar = 19;
1081  TString * fCandidateVariableNames = new TString[nVar];
1082 
1083  fCandidateVariableNames[ 0]="ElePx";
1084  fCandidateVariableNames[ 1]="ElePy";
1085  fCandidateVariableNames[ 2]="ElePz";
1086  fCandidateVariableNames[ 3]="TPCChi2overNDF";
1087  fCandidateVariableNames[ 4]="ITSNcls";
1088  fCandidateVariableNames[ 5]="TPCNcls";
1089  fCandidateVariableNames[ 6]="TPCNclsPID";
1090  fCandidateVariableNames[ 7]="TPCNclsRatio";
1091  fCandidateVariableNames[ 8]="d0R";
1092  fCandidateVariableNames[ 9]="d0Z";
1093  fCandidateVariableNames[10]="ITSClusterMap";
1094  fCandidateVariableNames[11]="nSigmaTPCele";
1095  fCandidateVariableNames[12]="nSigmaTOFele";
1096  fCandidateVariableNames[13]="nSigmaTPCpi";
1097  fCandidateVariableNames[14]="nSigmaTPCka";
1098  fCandidateVariableNames[15]="nSigmaTPCpr";
1099  fCandidateVariableNames[16]="EvNumber";
1100  fCandidateVariableNames[17]="EleCharge";
1101  fCandidateVariableNames[18]="Centrality";
1102 
1103  for (Int_t ivar=0; ivar<nVar; ivar++) {
1104  fEleVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateEleVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1105  }
1106 
1107  return;
1108 }
1111 {
1112  //
1113  // Fill histograms or tree depending on fWriteVariableTree
1114  //
1115 
1116  if(!trk) return;
1117 
1118  fHistoBachPt->Fill(trk->Pt());
1119 
1120  if(fUseMCInfo)
1121  {
1122  Int_t labEle = trk->GetLabel();
1123  if(labEle>=0){
1124  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
1125  if(mcetrk){
1126  Int_t pdgEle = mcetrk->GetPdgCode();
1127  if(abs(pdgEle)==11){
1128  fHistoBachPtMCS->Fill(trk->Pt());
1129  }
1130  }
1131  }
1132  }
1133 
1134  if(!fWriteEachVariableTree) return;
1135 
1136  for(Int_t i=0;i<19;i++){
1137  fCandidateEleVariables[i] = -9999.;
1138  }
1139 
1140  fCandidateEleVariables[ 0] = trk->Px();
1141  fCandidateEleVariables[ 1] = trk->Py();
1142  fCandidateEleVariables[ 2] = trk->Pz();
1143  fCandidateEleVariables[ 3] = trk->Chi2perNDF();
1144  fCandidateEleVariables[ 4] = trk->GetITSNcls();
1145  fCandidateEleVariables[ 5] = trk->GetTPCncls();
1146  fCandidateEleVariables[ 6] = trk->GetTPCsignalN();
1147  if(trk->GetTPCNclsF()>0)
1148  fCandidateEleVariables[ 7] = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
1149 
1150  Double_t d0z0[2],covd0z0[3];
1151  trk->PropagateToDCA(fVtx1,fBzkG,kVeryBig,d0z0,covd0z0);
1152 
1153  fCandidateEleVariables[ 8] = d0z0[0];
1154  fCandidateEleVariables[ 9] = d0z0[1];
1155  Int_t itsmap = trk->GetITSClusterMap();
1156  Int_t bit1 = 1;
1157  Int_t bit2 = 2;
1158  Bool_t spdfirst = (itsmap & bit1) == bit1;
1159  Bool_t spdsecond = (itsmap & bit2) == bit2;
1160  fCandidateEleVariables[10] = ((Int_t)spdfirst) + 2 * ((Int_t)spdsecond);
1161 
1162  if(fAnalCuts->GetIsUsePID())
1163  {
1164  Double_t nSigmaTPCele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
1165  Double_t nSigmaTOFele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
1166  Double_t nSigmaTPCpi_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
1167  Double_t nSigmaTPCka_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
1168  Double_t nSigmaTPCpr_etrk = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
1169  fCandidateEleVariables[11] = nSigmaTPCele;
1170  fCandidateEleVariables[12] = nSigmaTOFele;
1171  fCandidateEleVariables[13] = nSigmaTPCpi_etrk;
1172  fCandidateEleVariables[14] = nSigmaTPCka_etrk;
1173  fCandidateEleVariables[15] = nSigmaTPCpr_etrk;
1174  }
1176  fCandidateEleVariables[17] = trk->Charge();
1178 
1179  fHistod0Bach->Fill(d0z0[0]);
1180 
1181  fEleVariablesTree->Fill();
1182 }
1185 {
1186  //
1187  // Define V0 tree variables
1188  //
1189 
1190  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
1191  fCascVariablesTree = new TTree(nameoutput,"cascade variables tree");
1192  Int_t nVar = 17;
1194  TString * fCandidateVariableNames = new TString[nVar];
1195 
1196  fCandidateVariableNames[ 0]="Centrality";
1197  fCandidateVariableNames[ 1]="InvMassOmega";
1198  fCandidateVariableNames[ 2]="OmegaPx";
1199  fCandidateVariableNames[ 3]="OmegaPy";
1200  fCandidateVariableNames[ 4]="OmegaPz";
1201  fCandidateVariableNames[ 5]="InvMassLambda";
1202  fCandidateVariableNames[ 6]="DcaOmegaDaughters";
1203  fCandidateVariableNames[ 7]="DcaV0Daughters";
1204  fCandidateVariableNames[ 8]="DecayLengthOmega";
1205  fCandidateVariableNames[ 9]="CosPointingAngleOmega";
1206  fCandidateVariableNames[10]="DcaV0toPrimVertex";
1207  fCandidateVariableNames[11]="DcaPostoPrimVertex";
1208  fCandidateVariableNames[12]="DcaNegtoPrimVertex";
1209  fCandidateVariableNames[13]="DcaBachtoPrimVertex";
1210  fCandidateVariableNames[14]="DecayLengthV0";
1211  fCandidateVariableNames[15]="CosPointingAngleV0";
1212  fCandidateVariableNames[16]="OmegaCharge";
1213 
1214  for (Int_t ivar=0; ivar<nVar; ivar++) {
1215  fCascVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateCascVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1216  }
1217 
1218  return;
1219 }
1220 
1222 void AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
1223 {
1224  //
1225  // Fill histograms or tree depending on fWriteVariableTree (tree not implemented yet)
1226  //
1227  if(!casc) return;
1228  fHistoXiMassvsPt->Fill(casc->MassXi(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1229  fHistoOmegaMassvsPt->Fill(casc->MassOmega(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1230 
1231  if(fUseMCInfo){
1232  Int_t pdgDgcasc[2]={321,3122};
1233  Int_t pdgDgv0[2]={2212,211};
1234  Int_t labcasc = MatchToMCCascade(casc,3334,pdgDgcasc,pdgDgv0,mcArray); // the cascade
1235  if(labcasc>=0){
1236  fHistoOmegaMassvsPtMCS->Fill(casc->MassOmega(),sqrt(casc->MomXiX()*casc->MomXiX()+casc->MomXiY()*casc->MomXiY()));
1237  }
1238  }
1239 
1240  if(!fWriteEachVariableTree) return;
1241 
1242 
1243  for(Int_t i=0;i<16;i++){
1244  fCandidateCascVariables[i] = -9999.;
1245  }
1246  Double_t posVtx[3] = {0.,0.,0.};
1247  fVtx1->GetXYZ(posVtx);
1248 
1250  fCandidateCascVariables[ 1] = casc->MassOmega();
1251  fCandidateCascVariables[ 2] = casc->MomXiX();
1252  fCandidateCascVariables[ 3] = casc->MomXiY();
1253  fCandidateCascVariables[ 4] = casc->MomXiZ();
1254  if(casc->ChargeXi()<0)
1255  fCandidateCascVariables[ 5] = casc->MassLambda();
1256  else
1257  fCandidateCascVariables[ 5] = casc->MassAntiLambda();
1258 
1259  fCandidateCascVariables[ 6] = casc->DcaXiDaughters();
1260  fCandidateCascVariables[ 7] = casc->DcaV0Daughters();
1261  fCandidateCascVariables[ 8] = casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
1262  fCandidateCascVariables[ 9] = casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
1263  fCandidateCascVariables[10] = casc->DcaV0ToPrimVertex();
1264  fCandidateCascVariables[11] = casc->DcaPosToPrimVertex();
1265  fCandidateCascVariables[12] = casc->DcaNegToPrimVertex();
1266  fCandidateCascVariables[13] = casc->DcaBachToPrimVertex();
1267  fCandidateCascVariables[14] = casc->DecayLengthV0();
1268  fCandidateCascVariables[15] = casc->CosPointingAngle(casc->GetDecayVertexXi());
1269  fCandidateCascVariables[16] = casc->ChargeXi();
1270 
1271 
1272  fCascVariablesTree->Fill();
1273 }
1276 {
1277  //
1278  // Define electron tree variables
1279  //
1280 
1281  const char* nameoutput = GetOutputSlot(7)->GetContainer()->GetName();
1282  fMCVariablesTree = new TTree(nameoutput,"MC variables tree");
1283  Int_t nVar = 14;
1285  TString * fCandidateVariableNames = new TString[nVar];
1286 
1287  fCandidateVariableNames[ 0]="Centrality";
1288  fCandidateVariableNames[ 1]="DecayType";
1289  fCandidateVariableNames[ 2]="LcPx";
1290  fCandidateVariableNames[ 3]="LcPy";
1291  fCandidateVariableNames[ 4]="LcPz";
1292  fCandidateVariableNames[ 5]="ElePx";
1293  fCandidateVariableNames[ 6]="ElePy";
1294  fCandidateVariableNames[ 7]="ElePz";
1295  fCandidateVariableNames[ 8]="CascPx";
1296  fCandidateVariableNames[ 9]="CascPy";
1297  fCandidateVariableNames[10]="CascPz";
1298  fCandidateVariableNames[11]="PdgCode";
1299  fCandidateVariableNames[12]="ElePdgCode";
1300  fCandidateVariableNames[13]="CascPdgCode";
1301 
1302  for (Int_t ivar=0; ivar<nVar; ivar++) {
1303  fMCVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateMCVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1304  }
1305  return;
1306 }
1308 void AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::FillMCROOTObjects(AliAODMCParticle *mcpart, AliAODMCParticle *mcepart, AliAODMCParticle *mccascpart, Int_t decaytype)
1309 {
1310  //
1311  // Fill histograms or tree depending on fWriteMCVariableTree
1312  //
1313  if(!mcpart) return;
1314  if(!mcepart) return;
1315  if(!mccascpart) return;
1316 
1317  for(Int_t i=0;i<14;i++){
1318  fCandidateMCVariables[i] = -9999.;
1319  }
1320 
1322  fCandidateMCVariables[ 1] = decaytype;
1323  fCandidateMCVariables[ 2] = mcpart->Px();
1324  fCandidateMCVariables[ 3] = mcpart->Py();
1325  fCandidateMCVariables[ 4] = mcpart->Pz();
1326  fCandidateMCVariables[ 5] = mcepart->Px();
1327  fCandidateMCVariables[ 6] = mcepart->Py();
1328  fCandidateMCVariables[ 7] = mcepart->Pz();
1329  fCandidateMCVariables[ 8] = mccascpart->Px();
1330  fCandidateMCVariables[ 9] = mccascpart->Py();
1331  fCandidateMCVariables[10] = mccascpart->Pz();
1332  fCandidateMCVariables[11] = mcpart->GetPdgCode();
1333  fCandidateMCVariables[12] = mcepart->GetPdgCode();
1334  fCandidateMCVariables[13] = mccascpart->GetPdgCode();
1335 
1336  Double_t epx = mcepart->Px();
1337  Double_t epy = mcepart->Py();
1338  Double_t epz = mcepart->Pz();
1339  Double_t eE = sqrt(epx*epx+epy*epy+epz*epz+0.000511*0.000511);
1340  Double_t cascpx = mccascpart->Px();
1341  Double_t cascpy = mccascpart->Py();
1342  Double_t cascpz = mccascpart->Pz();
1343  Double_t cascE = sqrt(cascpx*cascpx+cascpy*cascpy+cascpz*cascpz+1.67245*1.67245);
1344 
1345  Double_t InvMassEleOmega = sqrt(pow(eE+cascE,2)-pow(epx+cascpx,2)-pow(epy+cascpy,2)-pow(epz+cascpz,2));
1346 
1347  Double_t cont[3];
1348  cont[0] = InvMassEleOmega;
1349  cont[1] = mcpart->Pt();
1350  cont[2] = fCentrality;
1351  Double_t cont2[3];
1352  cont2[0] = InvMassEleOmega;
1353  cont2[1] = mcepart->Pt();
1354  cont2[2] = fCentrality;
1355  Double_t cont_eleptvseta[3];
1356  cont_eleptvseta[0] = mcepart->Pt();
1357  cont_eleptvseta[1] = mcepart->Eta();
1358  cont_eleptvseta[2] = fCentrality;
1359  Double_t cont_eleptvsomegapt[3];
1360  cont_eleptvsomegapt[0] = mcepart->Pt();
1361  cont_eleptvsomegapt[1] = mccascpart->Pt();
1362  cont_eleptvsomegapt[2] = fCentrality;
1363 
1364  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
1366  esdcuts->GetEtaRange(etamin,etamax);
1367 
1368  if(decaytype==0){
1369  fHistoEleOmegaMassMCGen->Fill(cont);
1370  if(fabs(mcepart->Eta())<etamax){
1371  fHistoEleOmegaMassvsElePtMCGen->Fill(cont2);
1372  if(InvMassEleOmega<2.7){
1373  fHistoElePtMCGen->Fill(mcepart->Pt(),fCentrality);
1374  fHistoElePtvsEtaMCGen->Fill(cont_eleptvseta);
1375  fHistoElePtvsOmegaPtMCGen->Fill(cont_eleptvsomegapt);
1376  }
1377  }
1378  }
1379 
1381  fMCVariablesTree->Fill();
1382 }
1383 
1386  //
1387  // This is to define general histograms
1388  //
1389 
1390  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
1391  fCEvents->SetStats(kTRUE);
1392  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
1393  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
1394  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
1395  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
1396  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
1397  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
1398  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
1399  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
1400  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
1401  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
1402  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
1403  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
1404  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
1405  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
1406  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
1407  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
1408  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
1409  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
1410  //fCEvents->GetXaxis()->SetTitle("");
1411  fCEvents->GetYaxis()->SetTitle("counts");
1412 
1413  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
1414  fHTrigger->SetStats(kTRUE);
1415  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
1416  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
1417  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
1418  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
1419  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
1420  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
1421  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
1422  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
1423  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
1424  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
1425  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
1426  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
1427 
1428  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
1429 
1430  fOutput->Add(fCEvents);
1431  fOutput->Add(fHTrigger);
1432  fOutput->Add(fHCentrality);
1433 
1434  return;
1435 }
1436 //__________________________________________________________________________
1438 {
1439  //
1440  // Define analyis histograms
1441  //
1442 
1443  //------------------------------------------------
1444  // Basic histogram
1445  //------------------------------------------------
1446  Int_t bins_base[3]= {16 ,100 ,10};
1447  Double_t xmin_base[3]={1.6,0 ,0.00};
1448  Double_t xmax_base[3]={3.6,10. ,100};
1449  fHistoEleOmegaMass = new THnSparseF("fHistoEleOmegaMass","",3,bins_base,xmin_base,xmax_base);
1451  fHistoEleOmegaMassRS = new THnSparseF("fHistoEleOmegaMassRS","",3,bins_base,xmin_base,xmax_base);
1453  fHistoEleOmegaMassWS = new THnSparseF("fHistoEleOmegaMassWS","",3,bins_base,xmin_base,xmax_base);
1455  fHistoEleOmegaMassRSMix = new THnSparseF("fHistoEleOmegaMassRSMix","",3,bins_base,xmin_base,xmax_base);
1457  fHistoEleOmegaMassWSMix = new THnSparseF("fHistoEleOmegaMassWSMix","",3,bins_base,xmin_base,xmax_base);
1459 
1460  fHistoEleOmegaMassvsElePtRS = new THnSparseF("fHistoEleOmegaMassvsElePtRS","",3,bins_base,xmin_base,xmax_base);
1462  fHistoEleOmegaMassvsElePtWS = new THnSparseF("fHistoEleOmegaMassvsElePtWS","",3,bins_base,xmin_base,xmax_base);
1464  fHistoEleOmegaMassvsElePtRSMix = new THnSparseF("fHistoEleOmegaMassvsElePtRSMix","",3,bins_base,xmin_base,xmax_base);
1466  fHistoEleOmegaMassvsElePtWSMix = new THnSparseF("fHistoEleOmegaMassvsElePtWSMix","",3,bins_base,xmin_base,xmax_base);
1468 
1469  fHistoElePtRS=new TH2F("fHistoElePtRS","Right-sign e pt",100,0.,10.,10,0.,100.);
1470  fOutputAll->Add(fHistoElePtRS);
1471  fHistoElePtWS=new TH2F("fHistoElePtWS","Wrong-sign e pt",100,0.,10.,10,0.,100.);
1472  fOutputAll->Add(fHistoElePtWS);
1473  fHistoElePtRSMix=new TH2F("fHistoElePtRSMix","Right-sign e pt",100,0.,10.,10,0.,100.);
1475  fHistoElePtWSMix=new TH2F("fHistoElePtWSMix","Wrong-sign e pt",100,0.,10.,10,0.,100.);
1477 
1478  fHistoEleOmegaMassMCS = new THnSparseF("fHistoEleOmegaMassMCS","",3,bins_base,xmin_base,xmax_base);
1480  fHistoEleOmegaMassMCGen = new THnSparseF("fHistoEleOmegaMassMCGen","",3,bins_base,xmin_base,xmax_base);
1482  fHistoEleOmegaMassvsElePtMCS = new THnSparseF("fHistoEleOmegaMassvsElePtMCS","",3,bins_base,xmin_base,xmax_base);
1484  fHistoEleOmegaMassvsElePtMCGen = new THnSparseF("fHistoEleOmegaMassvsElePtMCGen","",3,bins_base,xmin_base,xmax_base);
1486  fHistoElePtMCS=new TH2F("fHistoElePtMCS","MC S e pt",100,0.,10.,10,0.,100.);
1487  fOutputAll->Add(fHistoElePtMCS);
1488  fHistoElePtMCGen=new TH2F("fHistoElePtMCGen","MC Gen e pt",100,0.,10.,10,0.,100.);
1490 
1491  Int_t bins_eleptvseta[3]= {50,20 ,10};
1492  Double_t xmin_eleptvseta[3]={0.,-1. ,0.0};
1493  Double_t xmax_eleptvseta[3]={5.,1. ,100};
1494 
1495  fHistoElePtvsEtaRS = new THnSparseF("fHistoElePtvsEtaRS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1497  fHistoElePtvsEtaWS = new THnSparseF("fHistoElePtvsEtaWS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1499  fHistoElePtvsEtaRSMix = new THnSparseF("fHistoElePtvsEtaRSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1501  fHistoElePtvsEtaWSMix = new THnSparseF("fHistoElePtvsEtaWSMix","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1503  fHistoElePtvsEtaMCS = new THnSparseF("fHistoElePtvsEtaMCS","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1505  fHistoElePtvsEtaMCGen = new THnSparseF("fHistoElePtvsEtaMCGen","",3,bins_eleptvseta,xmin_eleptvseta,xmax_eleptvseta);
1507 
1508  Int_t bins_eleptvsomegapt[3]= {50,20 ,10};
1509  Double_t xmin_eleptvsomegapt[3]={0.,0. ,0.0};
1510  Double_t xmax_eleptvsomegapt[3]={5.,5. ,100};
1511 
1512  fHistoElePtvsOmegaPtRS = new THnSparseF("fHistoElePtvsOmegaPtRS","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1514  fHistoElePtvsOmegaPtWS = new THnSparseF("fHistoElePtvsOmegaPtWS","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1516  fHistoElePtvsOmegaPtRSMix = new THnSparseF("fHistoElePtvsOmegaPtRSMix","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1518  fHistoElePtvsOmegaPtWSMix = new THnSparseF("fHistoElePtvsOmegaPtWSMix","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1520  fHistoElePtvsOmegaPtMCS = new THnSparseF("fHistoElePtvsOmegaPtMCS","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1522  fHistoElePtvsOmegaPtMCGen = new THnSparseF("fHistoElePtvsOmegaPtMCGen","",3,bins_eleptvsomegapt,xmin_eleptvsomegapt,xmax_eleptvsomegapt);
1524 
1525  Int_t bins_eleptvsd0[3]= {50 ,50 ,10};
1526  Double_t xmin_eleptvsd0[3]={0.,-0.2 ,0.0};
1527  Double_t xmax_eleptvsd0[3]={5.,0.2 ,100};
1528 
1529  fHistoElePtvsd0RS = new THnSparseF("fHistoElePtvsd0RS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
1531  fHistoElePtvsd0WS = new THnSparseF("fHistoElePtvsd0WS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
1533  fHistoElePtvsd0RSMix = new THnSparseF("fHistoElePtvsd0RSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
1535  fHistoElePtvsd0WSMix = new THnSparseF("fHistoElePtvsd0WSMix","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
1537  fHistoElePtvsd0MCS = new THnSparseF("fHistoElePtvsd0MCS","",3,bins_eleptvsd0,xmin_eleptvsd0,xmax_eleptvsd0);
1539 
1540  //------------------------------------------------
1541  // checking histograms
1542  //------------------------------------------------
1543  fHistoBachPt = new TH1F("fHistoBachPt","Bachelor p_{T}",100,0.0,5.0);
1544  fOutputAll->Add(fHistoBachPt);
1545  fHistoBachPtMCS = new TH1F("fHistoBachPtMCS","Bachelor p_{T}",100,0.0,5.0);
1547  fHistoBachPtMCGen = new TH1F("fHistoBachPtMCGen","Bachelor p_{T}",100,0.0,5.0);
1549  fHistod0Bach = new TH1F("fHistod0Bach","Bachelor d_{0}",100,-0.5,0.5);
1550  fOutputAll->Add(fHistod0Bach);
1551  fHistoXiMassvsPt=new TH2F("fHistoXiMassvsPt","Xi mass",100,1.32-0.05,1.32+0.05,20,0.,10.);
1553  fHistoOmegaMassvsPt=new TH2F("fHistoOmegaMassvsPt","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
1555  fHistoOmegaMassvsPtMCS=new TH2F("fHistoOmegaMassvsPtMCS","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
1557  fHistoOmegaMassvsPtMCGen=new TH2F("fHistoOmegaMassvsPtMCGen","Omega mass",100,1.67-0.05,1.67+0.05,20,0.,10.);
1559 
1560  fHistoElectronTPCPID=new TH2F("fHistoElectronTPCPID","",50,0.,5.,50,-20.,20.);
1562  fHistoElectronTOFPID=new TH2F("fHistoElectronTOFPID","",50,0.,5.,50,-20.,20.);
1564  fHistoElectronTPCSelPID=new TH2F("fHistoElectronTPCSelPID","",50,0.,5.,50,-20.,20.);
1566  fHistoElectronTOFSelPID=new TH2F("fHistoElectronTOFSelPID","",50,0.,5.,50,-20.,20.);
1568  fHistoElectronTPCPIDSelTOF=new TH2F("fHistoElectronTPCPIDSelTOF","",10,0.,5.,500,-10.,10.);
1570  fHistoElectronTPCPIDSelTOFSmallEta=new TH2F("fHistoElectronTPCPIDSelTOFSmallEta","",10,0.,5.,500,-10.,10.);
1572  fHistoElectronTPCPIDSelTOFLargeEta=new TH2F("fHistoElectronTPCPIDSelTOFLargeEta","",10,0.,5.,500,-10.,10.);
1574 
1575  fHistonEvtvsRunNumber=new TH1F("fHistonEvtvsRunNumber","",5000,-0.5,4999.5);
1577  fHistonElevsRunNumber=new TH1F("fHistonElevsRunNumber","",5000,-0.5,4999.5);
1579  fHistonOmegavsRunNumber=new TH1F("fHistonOmegavsRunNumber","",5000,-0.5,4999.5);
1581 
1582  return;
1583 }
1584 
1585 //________________________________________________________________________
1586 AliAODRecoCascadeHF* AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::MakeCascadeHF(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod, AliAODVertex *secVert, Bool_t mixing)
1587 {
1588  //
1589  // Create AliAODRecoCascadeHF object from the argument
1590  //
1591 
1592  if(!casc) return 0x0;
1593  if(!part) return 0x0;
1594  if(!aod) return 0x0;
1595 
1596  //------------------------------------------------
1597  // PrimaryVertex
1598  //------------------------------------------------
1599  AliAODVertex *primVertexAOD;
1600  Bool_t unsetvtx = kFALSE;
1602  primVertexAOD = CallPrimaryVertex(casc,part,aod);
1603  if(!primVertexAOD){
1604  primVertexAOD = fVtx1;
1605  }else{
1606  unsetvtx = kTRUE;
1607  }
1608  }else{
1609  primVertexAOD = fVtx1;
1610  }
1611  if(!primVertexAOD) return 0x0;
1612  Double_t posprim[3]; primVertexAOD->GetXYZ(posprim);
1613 
1614  //------------------------------------------------
1615  // DCA between tracks
1616  //------------------------------------------------
1617  AliESDtrack *esdtrack = new AliESDtrack((AliVTrack*)part);
1618 
1619  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
1620  xyz[0]=casc->DecayVertexXiX();
1621  xyz[1]=casc->DecayVertexXiY();
1622  xyz[2]=casc->DecayVertexXiZ();
1623  pxpypz[0]=casc->MomXiX();
1624  pxpypz[1]=casc->MomXiY();
1625  pxpypz[2]=casc->MomXiZ();
1626  casc->GetCovarianceXYZPxPyPz(cv);
1627  sign=casc->ChargeXi();
1628  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
1629 
1630  Double_t xdummy, ydummy;
1631  Double_t dca = esdtrack->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
1632 
1633 
1634  //------------------------------------------------
1635  // Propagate all tracks to the secondary vertex and calculate momentum there
1636  //------------------------------------------------
1637 
1638  Double_t d0z0bach[2],covd0z0bach[3];
1639  if(sqrt(pow(secVert->GetX(),2)+pow(secVert->GetY(),2))<1.){
1640  part->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
1641  trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
1642  }else{
1643  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
1644  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
1645  }
1646  Double_t momcasc_new[3]={-9999,-9999,-9999.};
1647  trackCasc->GetPxPyPz(momcasc_new);
1648 
1649  Double_t px[2],py[2],pz[2];
1650  px[0] = part->Px(); py[0] = part->Py(); pz[0] = part->Pz();
1651  px[1] = momcasc_new[0]; py[1] = momcasc_new[1]; pz[1] = momcasc_new[2];
1652 
1653  //------------------------------------------------
1654  // d0
1655  //------------------------------------------------
1656  Double_t d0[3],d0err[3];
1657 
1658  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
1659  d0[0]= d0z0bach[0];
1660  d0err[0] = TMath::Sqrt(covd0z0bach[0]);
1661 
1662  Double_t d0z0casc[2],covd0z0casc[3];
1663  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0casc,covd0z0casc);
1664  d0[1]= d0z0casc[0];
1665  d0err[1] = TMath::Sqrt(covd0z0casc[0]);
1666 
1667  //------------------------------------------------
1668  // Create AliAODRecoCascadeHF
1669  //------------------------------------------------
1670  Short_t charge = part->Charge();
1671  AliAODRecoCascadeHF *theCascade = new AliAODRecoCascadeHF(secVert,charge,px,py,pz,d0,d0err,dca);
1672  if(!theCascade)
1673  {
1674  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
1675  if(esdtrack) delete esdtrack;
1676  if(trackCasc) delete trackCasc;
1677  return 0x0;
1678  }
1679  theCascade->SetOwnPrimaryVtx(primVertexAOD);
1680  UShort_t id[2]={(UShort_t)part->GetID(),(UShort_t)trackCasc->GetID()};
1681  theCascade->SetProngIDs(2,id);
1682 
1683  if(!mixing){
1684  theCascade->GetSecondaryVtx()->AddDaughter(part);
1685  theCascade->GetSecondaryVtx()->AddDaughter(casc);
1686  }
1687 
1688  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
1689  if(esdtrack) delete esdtrack;
1690  if(trackCasc) delete trackCasc;
1691 
1692  return theCascade;
1693 }
1694 
1695 //________________________________________________________________________
1696 AliAODVertex* AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent* aod)
1697 {
1698  //
1699  // Make an array of tracks which should not be used in primary vertex calculation and
1700  // Call PrimaryVertex function
1701  //
1702 
1703  TObjArray *TrackArray = new TObjArray(3);
1704 
1705  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk);
1706  TrackArray->AddAt(cptrk1,0);
1707 
1708  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
1709  TrackArray->AddAt(cascptrack,1);
1710  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
1711  TrackArray->AddAt(cascntrack,2);
1712  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
1713  TrackArray->AddAt(cascbtrack,3);
1714 
1715  AliAODVertex *newvert = PrimaryVertex(TrackArray,aod);
1716 
1717  for(Int_t i=0;i<4;i++)
1718  {
1719  AliESDtrack *tesd = (AliESDtrack*)TrackArray->UncheckedAt(i);
1720  delete tesd;
1721  }
1722  TrackArray->Clear();
1723  delete TrackArray;
1724 
1725  return newvert;
1726 }
1727 
1728 //________________________________________________________________________
1730  AliVEvent *event)
1731 {
1732  //
1733  //Used only for pp
1734  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
1735  //
1736 
1737  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
1738  Bool_t fRmTrksFromPrimVtx = kFALSE;
1739 
1740  AliESDVertex *vertexESD = 0;
1741  AliAODVertex *vertexAOD = 0;
1742 
1743  //vertexESD = new AliESDVertex(*fV1);
1744 
1745 
1746  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
1747  // primary vertex from the input event
1748 
1749  vertexESD = new AliESDVertex(*fV1);
1750 
1751  } else {
1752  // primary vertex specific to this candidate
1753 
1754  Int_t nTrks = trkArray->GetEntriesFast();
1755  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
1756 
1757  if(fRecoPrimVtxSkippingTrks) {
1758  // recalculating the vertex
1759 
1760  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
1761  Float_t diamondcovxy[3];
1762  event->GetDiamondCovXY(diamondcovxy);
1763  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
1764  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
1765  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
1766  vertexer->SetVtxStart(diamond);
1767  delete diamond; diamond=NULL;
1768  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter"))
1769  vertexer->SetOnlyFitter();
1770  }
1771  Int_t skipped[1000];
1772  Int_t nTrksToSkip=0,id;
1773  AliExternalTrackParam *t = 0;
1774  for(Int_t i=0; i<nTrks; i++) {
1775  t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
1776  id = (Int_t)t->GetID();
1777  if(id<0) continue;
1778  skipped[nTrksToSkip++] = id;
1779  }
1780  // TEMPORARY FIX
1781  // For AOD, skip also tracks without covariance matrix
1782  Double_t covtest[21];
1783  for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
1784  AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
1785  if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
1786  id = (Int_t)vtrack->GetID();
1787  if(id<0) continue;
1788  skipped[nTrksToSkip++] = id;
1789  }
1790  }
1791  for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
1792  //
1793  vertexer->SetSkipTracks(nTrksToSkip,skipped);
1794  vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
1795 
1796  } else if(fRmTrksFromPrimVtx && nTrks>0) {
1797  // removing the prongs tracks
1798 
1799  TObjArray rmArray(nTrks);
1800  UShort_t *rmId = new UShort_t[nTrks];
1801  AliESDtrack *esdTrack = 0;
1802  AliESDtrack *t = 0;
1803  for(Int_t i=0; i<nTrks; i++) {
1804  t = (AliESDtrack*)trkArray->UncheckedAt(i);
1805  esdTrack = new AliESDtrack(*t);
1806  rmArray.AddLast(esdTrack);
1807  if(esdTrack->GetID()>=0) {
1808  rmId[i]=(UShort_t)esdTrack->GetID();
1809  } else {
1810  rmId[i]=9999;
1811  }
1812  }
1813  Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
1814  vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
1815  delete [] rmId; rmId=NULL;
1816  rmArray.Delete();
1817 
1818  }
1819 
1820  delete vertexer; vertexer=NULL;
1821  if(!vertexESD) return vertexAOD;
1822  if(vertexESD->GetNContributors()<=0) {
1823  //AliDebug(2,"vertexing failed");
1824  delete vertexESD; vertexESD=NULL;
1825  return vertexAOD;
1826  }
1827 
1828 
1829  }
1830 
1831  // convert to AliAODVertex
1832  Double_t pos[3],cov[6],chi2perNDF;
1833  vertexESD->GetXYZ(pos); // position
1834  vertexESD->GetCovMatrix(cov); //covariance matrix
1835  chi2perNDF = vertexESD->GetChi2toNDF();
1836  delete vertexESD; vertexESD=NULL;
1837 
1838  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
1839 
1840  return vertexAOD;
1841 }
1842 
1843 //________________________________________________________________________
1844 AliAODVertex* AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *part, AliAODEvent * aod)
1845 {
1846  //
1847  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
1848  //
1849 
1850  AliAODVertex *primVertexAOD;
1851  Bool_t unsetvtx = kFALSE;
1853  primVertexAOD = CallPrimaryVertex(casc,part,aod);
1854  if(!primVertexAOD){
1855  primVertexAOD = fVtx1;
1856  }else{
1857  unsetvtx = kTRUE;
1858  }
1859  }else{
1860  primVertexAOD = fVtx1;
1861  }
1862  if(!primVertexAOD) return 0x0;
1863 
1864  AliESDVertex * vertexESD = new AliESDVertex(*fV1);
1865 
1866  Double_t pos[3],cov[6],chi2perNDF;
1867  vertexESD->GetXYZ(pos); // position
1868  vertexESD->GetCovMatrix(cov); //covariance matrix
1869  chi2perNDF = vertexESD->GetChi2toNDF();
1870  delete vertexESD; vertexESD=NULL;
1871 
1872  AliAODVertex *secVert = new AliAODVertex(pos,cov,chi2perNDF);
1873 
1874  return secVert;
1875 }
1876 //________________________________________________________________________
1877 Int_t AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::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)
1878 {
1879  //
1880  // Match to MC
1881  //
1882  for(Int_t i=0;i<100;i++){
1883  pdgarray_ele[i] = -9999;
1884  labelarray_ele[i] = -9999;
1885  pdgarray_casc[i] = -9999;
1886  labelarray_casc[i] = -9999;
1887  }
1888  ngen_ele = 0;
1889  ngen_casc = 0;
1890 
1891  AliVTrack *trk = dynamic_cast<AliVTrack*>(exobj->GetBachelor());
1892  if(!trk) return -1;
1893  Int_t labEle = trk->GetLabel();
1894  if(labEle<0) return -1;
1895  AliAODMCParticle *mcetrk = (AliAODMCParticle*)mcArray->At(labEle);
1896  if(!mcetrk) return -1;
1897  labelarray_ele[0] = labEle;
1898  pdgarray_ele[0] = mcetrk->GetPdgCode();
1899  ngen_ele ++;
1900 
1901  AliAODMCParticle *mcprimele=0;
1902  mcprimele = mcetrk;
1903  while(mcprimele->GetMother()>=0) {
1904  Int_t labprim_ele=mcprimele->GetMother();
1905  AliAODMCParticle *tmcprimele = (AliAODMCParticle*)mcArray->At(labprim_ele);
1906  if(!tmcprimele) {
1907  break;
1908  }
1909 
1910  mcprimele = tmcprimele;
1911  pdgarray_ele[ngen_ele] = mcprimele->GetPdgCode();
1912  labelarray_ele[ngen_ele] = labprim_ele;
1913  ngen_ele ++;
1914  if(ngen_ele==100) break;
1915  }
1916 
1917  AliAODcascade *theCascade = dynamic_cast<AliAODcascade*>(exobj->GetCascade());
1918  if(!theCascade) return -1;
1919 
1920  Int_t pdgDgcasc[2]={321,3122};
1921  Int_t pdgDgv0[2]={2212,211};
1922  Int_t labcasc = MatchToMCCascade(theCascade,3334,pdgDgcasc,pdgDgv0,mcArray); // the cascade
1923  if(labcasc<0) return -1;
1924 
1925  AliAODMCParticle *mccasc = (AliAODMCParticle*)mcArray->At(labcasc);
1926  if(!mccasc) return -1;
1927  labelarray_casc[0] = labcasc;
1928  pdgarray_casc[0] = mccasc->GetPdgCode();
1929  ngen_casc ++;
1930 
1931  AliAODMCParticle *mcprimcasc=0;
1932  mcprimcasc = mccasc;
1933  while(mcprimcasc->GetMother()>=0) {
1934  Int_t labprim_casc=mcprimcasc->GetMother();
1935  AliAODMCParticle *tmcprimcasc = (AliAODMCParticle*)mcArray->At(labprim_casc);
1936  if(!tmcprimcasc) {
1937  break;
1938  }
1939 
1940  mcprimcasc = tmcprimcasc;
1941  pdgarray_casc[ngen_casc] = mcprimcasc->GetPdgCode();
1942  labelarray_casc[ngen_casc] = labprim_casc;
1943  ngen_casc ++;
1944  if(ngen_casc==100) break;
1945  }
1946 
1947  Bool_t same_flag = kFALSE;
1948  Int_t matchedlabel=-9999;
1949  for(Int_t iemc=0;iemc<ngen_ele;iemc++){
1950  for(Int_t ivmc=0;ivmc<ngen_casc;ivmc++){
1951  if(labelarray_ele[iemc]==labelarray_casc[ivmc]){
1952  same_flag = kTRUE;
1953  matchedlabel = labelarray_ele[iemc];
1954  break;
1955  }
1956  }
1957  if(same_flag) break;
1958  }
1959 
1960  return matchedlabel;
1961 
1962 }
1963 //________________________________________________________________________
1964 Int_t AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const // the cascade
1965 {
1966  //
1967  // Matching to MC of cascade
1968  //
1969 
1970  AliAODTrack *cptrack = (AliAODTrack*) theCascade->GetDaughter(0);
1971  if(!cptrack) return -1;
1972  Int_t label_p = cptrack->GetLabel();
1973  if(label_p<0) return -1;
1974  AliAODTrack *cntrack = (AliAODTrack*) theCascade->GetDaughter(1);
1975  if(!cntrack) return -1;
1976  Int_t label_n = cntrack->GetLabel();
1977  if(label_n<0) return -1;
1978  Int_t labv0 = theCascade->MatchToMC(pdgDgcasc[1],mcArray,2,pdgDgv0);
1979  if(labv0<0) return -1;
1980  AliAODMCParticle *mcpartv0= (AliAODMCParticle*) mcArray->At(labv0);
1981 
1982  AliAODTrack *cbtrack = (AliAODTrack*) theCascade->GetDecayVertexXi()->GetDaughter(0);
1983  if(!cbtrack) return -1;
1984 
1985  Int_t label_b = cbtrack->GetLabel();
1986  if(label_b<0) return -1;
1987 
1988  AliAODMCParticle *mcpartb= (AliAODMCParticle*) mcArray->At(label_b);
1989  Int_t pdgb = TMath::Abs(mcpartb->GetPdgCode());
1990  if(pdgb!=pdgDgcasc[0]) return -1;
1991 
1992  AliAODMCParticle *mcmotherv0=mcpartv0;
1993  Bool_t isFromXiv0 = kFALSE;
1994  Int_t labxiv0 = mcmotherv0->GetMother();
1995  if(labxiv0<0) return -1;
1996  mcmotherv0 = (AliAODMCParticle*) mcArray->At(labxiv0);
1997  if(mcmotherv0){
1998  Int_t pdg = TMath::Abs(mcmotherv0 ->GetPdgCode());
1999  if(pdg==pdgabscasc){
2000  isFromXiv0 = kTRUE;
2001  }
2002  }
2003  if(!isFromXiv0) return -1;
2004 
2005  AliAODMCParticle *mcmotherb=mcpartb;
2006  Bool_t isFromXib = kFALSE;
2007  Int_t labxib = mcmotherb->GetMother();
2008  if(labxib<0) return -1;
2009  mcmotherb = (AliAODMCParticle*) mcArray->At(labxib);
2010  if(mcmotherb){
2011  Int_t pdg = TMath::Abs(mcmotherb ->GetPdgCode());
2012  if(pdg==pdgabscasc){
2013  isFromXib = kTRUE;
2014  }
2015  }
2016  if(!isFromXib) return -1;
2017 
2018  if(labxiv0!=labxib) return -1;//Bachelor and V0 should come from the same Xi
2019 
2020  return labxib;
2021 }
2022 //________________________________________________________________________
2023 void AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags, TClonesArray *mcArray)
2024 {
2025  //
2026  // Select good tracks using fAnalCuts (AliRDHFCuts object) and return the array of their ids
2027  //
2028 
2029  //const Int_t entries = event->GetNumberOfTracks();
2030  if(trkEntries==0) return;
2031 
2032  nSeleTrks=0;
2033  for(Int_t i=0; i<trkEntries; i++) {
2034  seleFlags[i] = kFALSE;
2035 
2036  AliVTrack *track;
2037  track = (AliVTrack*)event->GetTrack(i);
2038 
2039  if(track->GetID()<0) continue;
2040  Double_t covtest[21];
2041  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
2042 
2043  AliAODTrack *aodt = (AliAODTrack*)track;
2044  Double_t nsigma_tpcele = -9999;
2045  Double_t nsigma_tofele = -9999;
2046  if(fAnalCuts->GetIsUsePID()){
2047  nsigma_tpcele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(aodt,AliPID::kElectron);
2048  nsigma_tofele = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(aodt,AliPID::kElectron);
2049  }
2050 
2051  if(!fAnalCuts) continue;
2052  if(fAnalCuts->SingleTrkCuts(aodt,fVtx1)){
2053  seleFlags[i]=kTRUE;
2054  nSeleTrks++;
2055  fHistoElectronTPCSelPID->Fill(aodt->Pt(),nsigma_tpcele);
2056  fHistoElectronTOFSelPID->Fill(aodt->Pt(),nsigma_tofele);
2057  FillElectronROOTObjects(aodt,mcArray);
2058  if(fDoEventMixing){
2059  fElectronTracks->AddLast(new AliAODTrack(*aodt));
2060  }
2061  }
2062  fHistoElectronTPCPID->Fill(aodt->Pt(),nsigma_tpcele);
2063  fHistoElectronTOFPID->Fill(aodt->Pt(),nsigma_tofele);
2064  if(fabs(nsigma_tofele)<3.){
2065  fHistoElectronTPCPIDSelTOF->Fill(aodt->Pt(),nsigma_tpcele);
2066  Double_t eleeta = aodt->Eta();
2067  if(fabs(eleeta)<0.6)
2068  fHistoElectronTPCPIDSelTOFSmallEta->Fill(aodt->Pt(),nsigma_tpcele);
2069  if(fabs(eleeta)>0.6 && fabs(eleeta)<0.8)
2070  fHistoElectronTPCPIDSelTOFLargeEta->Fill(aodt->Pt(),nsigma_tpcele);
2071  }
2072  } // end loop on tracks
2073 }
2074 //________________________________________________________________________
2075 void AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascs,Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
2076 {
2077  //
2078  // Select good Casc using fAnalCuts (AliRDHFCuts object) and return the array of their ids
2079  //
2080 
2081  Double_t primVtx[3];
2082  fVtx1->GetXYZ(primVtx);
2083 
2084  nSeleCasc = 0;
2085  for(Int_t icasc=0;icasc<nCascs;icasc++)
2086  {
2087  seleCascFlags[icasc] = kFALSE;
2088  AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
2089 
2090  if(!fAnalCuts) continue;
2091  if(fAnalCuts->SingleCascadeCuts(casc,primVtx)){
2092  seleCascFlags[icasc] = kTRUE;
2093  nSeleCasc++;
2094 
2095  FillCascROOTObjects(casc, mcArray);
2096  }
2097  }
2098 }
2099 //_________________________________________________________________
2101  //
2102  // check in which of the pools the current event falls
2103  //
2104 
2105  Int_t theBinZ=TMath::BinarySearch(fNzVtxBins,fZvtxBins,zvert);
2106  if(theBinZ<0 || theBinZ>=fNzVtxBins) return -1;
2107  Int_t theBinM=TMath::BinarySearch(fNCentBins,fCentBins,mult);
2108  if(theBinM<0 || theBinM>=fNCentBins) return -1;
2109  return fNCentBins*theBinZ+theBinM;
2110 }
2111 //_________________________________________________________________
2113  //
2114  // delete the contets of the pool
2115  //
2116  if(poolIndex<0 || poolIndex>=fNOfPools) return;
2117  delete fEventBuffer[poolIndex];
2118  fEventBuffer[poolIndex]=new TTree(Form("EventBuffer_%d",poolIndex), "Temporary buffer for event mixing");
2119 
2120  fEventBuffer[poolIndex]->Branch("zVertex", &fVtxZ);
2121  fEventBuffer[poolIndex]->Branch("centrality", &fCentrality);
2122  fEventBuffer[poolIndex]->Branch("eventInfo", "TObjString",&fEventInfo);
2123  fEventBuffer[poolIndex]->Branch("earray", "TObjArray", &fElectronTracks);
2124 
2125  return;
2126 }
2127 //_________________________________________________________________
2129 {
2130  //
2131  // perform mixed event analysis
2132  //
2133 
2134  if(poolIndex<0 || poolIndex>fNzVtxBins*fNCentBins) return;
2135  if(fEventBuffer[poolIndex]->GetEntries()<fNumberOfEventsForMixing) return;
2136 
2137  Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
2138 
2139  TObjArray* earray=0x0;
2140  Float_t zVertex,cent;
2141  TObjString* eventInfo=0x0;
2142  fEventBuffer[poolIndex]->SetBranchAddress("earray", &earray);
2143  fEventBuffer[poolIndex]->SetBranchAddress("eventInfo",&eventInfo);
2144  fEventBuffer[poolIndex]->SetBranchAddress("zVertex", &zVertex);
2145  fEventBuffer[poolIndex]->SetBranchAddress("centrality", &cent);
2146  for (Int_t i=0; i<aodEvent->GetNumberOfCascades(); i++)
2147  {
2148  if(!seleFlags[i]) continue;
2149  AliAODcascade* casc = aodEvent->GetCascade(i);
2150  if(!casc)continue;
2151 
2152  for(Int_t iEv=0; iEv<fNumberOfEventsForMixing; iEv++){
2153  fEventBuffer[poolIndex]->GetEvent(iEv + nEvents - fNumberOfEventsForMixing);
2154  TObjArray* earray1=(TObjArray*)earray->Clone();
2155  //Float_t zVertex1=zVertex;
2156  //Float_t mult1=cent;
2157  Int_t nElectrons=earray1->GetEntries();
2158  //Int_t evId1,esdId1,ne1;
2159  //sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_K%d",&evId1,&esdId1,&ne1);
2160 // if(ne1!=nElectrons){
2161 // printf("AliAnalysisTaskSEOmegac2eleOmegafromAODtracks::DoMixingWithPools ERROR: read event does not match to the stored one\n");
2162 // delete earray1;
2163 // continue;
2164 // }
2165  for(Int_t iTr1=0; iTr1<nElectrons; iTr1++){
2166  AliAODTrack* trk1=(AliAODTrack*)earray1->At(iTr1);
2167  if(!trk1) continue;
2168 
2169  AliAODVertex *secVert = ReconstructSecondaryVertex(casc,trk1,aodEvent);//Fake, prim vertex is just used as secondary vertex. place holder for future
2170  if(!secVert) continue;
2171 
2172  AliAODRecoCascadeHF *exobj = MakeCascadeHF(casc,trk1,aodEvent,secVert,true);
2173  if(!exobj) {
2174  continue;
2175  }
2176 
2177  TClonesArray *fake = 0;
2178  FillROOTObjects(exobj,casc,trk1,fake,true);
2179 
2180  exobj->GetSecondaryVtx()->RemoveDaughters();
2181  exobj->UnsetOwnPrimaryVtx();
2182  delete exobj;exobj=NULL;
2183  delete secVert;
2184  }//track loop
2185 
2186  delete earray1;
2187  }//event loop
2188 
2189  }//v0 loop
2190 }
2191 //_________________________________________________________________
2193 {
2194  //
2195  // Analyze AliAODmcparticle
2196  //
2197 
2198  Int_t nmcpart = mcArray->GetEntriesFast();
2199  for(Int_t i=0;i<nmcpart;i++)
2200  {
2201  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(i);
2202  if(TMath::Abs(mcpart->GetPdgCode())==4332){
2203  Bool_t e_flag = kFALSE;
2204  Bool_t xi_flag = kFALSE;
2205  AliAODMCParticle *mcepart = 0;
2206  AliAODMCParticle *mccascpart = 0;
2207  for(Int_t idau=mcpart->GetFirstDaughter();idau<mcpart->GetLastDaughter()+1;idau++)
2208  {
2209  if(idau<0) break;
2210  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
2211  if(!mcdau) continue;
2212  if(TMath::Abs(mcdau->GetPdgCode())==11){
2213  e_flag = kTRUE;
2214  mcepart = mcdau;
2215  }
2216  if(TMath::Abs(mcdau->GetPdgCode())==3334){
2217  xi_flag = kTRUE;
2218  mccascpart = mcdau;
2219  }
2220  }
2221 
2222  Int_t decaytype = -9999;
2223  if(e_flag && xi_flag) decaytype = 0;
2224 
2225  FillMCROOTObjects(mcpart,mcepart,mccascpart,decaytype);
2226  }
2227  if(TMath::Abs(mcpart->GetPdgCode())==11 && mcpart->GetStatus()==1){
2228  AliESDtrackCuts *esdcuts = fAnalCuts->GetTrackCuts();
2230  esdcuts->GetEtaRange(etamin,etamax);
2231  if(fabs(mcpart->Eta())<etamax)
2232  fHistoBachPtMCGen->Fill(mcpart->Pt());
2233  }
2234  if(TMath::Abs(mcpart->GetPdgCode())==3334){
2235  Double_t etamin, etamax, rapmin, rapmax;
2236  fAnalCuts->GetProdCascEtaRange(etamin,etamax);
2237  fAnalCuts->GetProdCascRapRange(rapmin,rapmax);
2238 
2239  if((fabs(mcpart->Y())<rapmax) && (fabs(mcpart->Eta())<etamax))
2240  fHistoOmegaMassvsPtMCGen->Fill(1.67245, mcpart->Pt());
2241  }
2242  }
2243  return;
2244 }
THnSparse * fHistoEleOmegaMassRSMix
! e-Omega mass spectra (right-sign)
Int_t charge
THnSparse * fHistoEleOmegaMassvsElePtWSMix
! e-Omega mass-ept spectra (wrong-sign)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Int_t pdg
THnSparse * fHistoEleOmegaMassRS
! e-Omega mass spectra (right-sign)
double Double_t
Definition: External.C:58
void FillCascROOTObjects(AliAODcascade *casc, TClonesArray *mcArray)
THnSparse * fHistoEleOmegaMassMCGen
! e-Omega mass spectra (Efficiency denominator)
THnSparse * fHistoElePtvsOmegaPtMCGen
! e-Omega spectra (wrong-sign) efficiency denominator
THnSparse * fHistoEleOmegaMassvsElePtMCGen
! e-Omega mass-ept spectra (Efficiency denominator)
Definition: External.C:236
TH2F * fHistoElectronTPCPIDSelTOFSmallEta
! TPC electron PID after TOF 3 sigma cut (|eta|<0.6)
Bool_t SingleCascadeCuts(AliAODcascade *casc, Double_t *vert)
AliNormalizationCounter * fCounter
!Counter for normalization
TH2F * fHistoElectronTPCPIDSelTOF
! TPC electron PID after TOF 3 sigma cut
char Char_t
Definition: External.C:18
AliAODVertex * CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *evt)
Int_t MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
Int_t fNzVtxBins
maximum number of events to be used in event mixing
AliAODRecoCascadeHF * MakeCascadeHF(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod, AliAODVertex *vert, Bool_t mixing)
Bool_t fWriteMCVariableTree
flag to decide whether to write the candidate variables on a tree variables
TTree * fMCVariablesTree
! tree of the candidate variables after track selection on output slot 4
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:257
void FillMCROOTObjects(AliAODMCParticle *part, AliAODMCParticle *mcepart, AliAODMCParticle *mcv0part, Int_t decaytype)
AliAODVertex * PrimaryVertex(const TObjArray *trkArray, AliVEvent *event)
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:247
THnSparse * fHistoEleOmegaMassvsElePtMCS
! e-Omega mass-ept spectra (Efficiency numerator)
TTree * fEleVariablesTree
flag to decide whether to write the candidate variables on a tree variables
THnSparse * fHistoElePtvsEtaMCGen
! e spectra (wrong-sign) efficiency denominator
const Double_t etamin
THnSparse * fHistoEleOmegaMassWSMix
! e-Omega mass spectra (wrong-sign)
Float_t * fCandidateEleVariables
! variables to be written to the tree
THnSparse * fHistoElePtvsOmegaPtRSMix
! e-Omega spectra (right-sign, mix)
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)
void SelectCascade(const AliVEvent *event, Int_t nCasc, Int_t &nSeleCasc, Bool_t *seleCascFlags, TClonesArray *mcArray)
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
virtual void UserCreateOutputObjects()
Implementation of interface methods.
THnSparse * fHistoElePtvsEtaMCS
! e spectra (right-sign) efficiency numerator
THnSparse * fHistoEleOmegaMassMCS
! e-Omega mass spectra (Efficiency numerator)
THnSparse * fHistoElePtvsOmegaPtWSMix
! e-Omega spectra (wrong-sign, mix)
THnSparse * fHistoEleOmegaMassvsElePtWS
! e-Omega mass spectra (wrong-sign)
AliAODTrack * GetBachelor() const
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:262
void SetProngIDs(Int_t nIDs, UShort_t *id)
Double_t nEvents
plot quality messages
TObjArray * fElectronTracks
unique event id for mixed event check
Float_t * fCandidateCascVariables
! variables to be written to the tree
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
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)
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)
TTree * fVariablesTree
! tree of the candidate variables after track selection on output slot 4
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:350
short Short_t
Definition: External.C:23
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
AliAODcascade * GetCascade() const
TH1F * fHistoBachPtMCGen
! Bachelor pT histogram (efficiency denominator)
THnSparse * fHistoEleOmegaMassWS
! e-Omega mass spectra (wrong-sign)
Bool_t SingleTrkCuts(AliAODTrack *trk, AliAODVertex *primvert)
Bool_t IsEventSelected(AliVEvent *event)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH1F * fHistoBachPtMCS
! Bachelor pT histogram (efficiency numerator)
TTree * fCascVariablesTree
! tree of the candidate variables after track selection on output slot 4
const Int_t nVar
TList * fOutputAll
! User Output slot 3 //analysis histograms
THnSparse * fHistoElePtvsOmegaPtMCS
! e-Omega spectra (right-sign) efficiency numerator
THnSparse * fHistoEleOmegaMassvsElePtRS
! e-Omega mass spectra (right-sign)
const Double_t etamax
unsigned short UShort_t
Definition: External.C:28
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:270
const char Option_t
Definition: External.C:48
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:317
bool Bool_t
Definition: External.C:53
THnSparse * fHistoElePtvsd0WSMix
! e pt-d0 spectra (wrong-sign, mix)
THnSparse * fHistoElePtvsd0RSMix
! e pt-d0 spectra (right-sign, mix)
void FillROOTObjects(AliAODRecoCascadeHF *elobj, AliAODcascade *casc, AliAODTrack *trk, TClonesArray *mcArray, Bool_t mixing)
TH2F * fHistoElectronTPCPIDSelTOFLargeEta
! TPC electron PID after TOF 3 sigma cut (0.8>|eta|>0.6)
void DoEventMixingWithPools(Int_t index, AliAODEvent *aodEvent, Bool_t *seleFlags)
AliAODVertex * ReconstructSecondaryVertex(AliAODcascade *casc, AliAODTrack *trk, AliAODEvent *aod)
THnSparse * fHistoEleOmegaMassvsElePtRSMix
! e-Omega mass-ept spectra (right-sign)