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