AliPhysics  608b256 (608b256)
AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.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 // XicPlus2XiPiPi analysis code
21 //
22 // Input: AOD
23 // Output: TTree or THnSparse (mass vs pT vs Centrality)
24 //
25 // Cuts:
26 // TTree: very loose cut
27 // THnSparse: One THnSparse is created per cut. One cut is specified by
28 // an array of bits, each bit corresponds to a cut in "Cut" function.
29 //
30 //-------------------------------------------------------------------------
31 //
32 // Authors: Y.S Watanabe(a)
33 // (a) CNS, the University of Tokyo
34 // Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
35 //-------------------------------------------------------------------------
36 
37 #include <TSystem.h>
38 #include <TParticle.h>
39 #include <TParticlePDG.h>
40 #include <THnSparse.h>
41 #include <TH1F.h>
42 #include <TH2F.h>
43 #include <TLorentzVector.h>
44 #include <TTree.h>
45 #include "TROOT.h"
46 #include <TDatabasePDG.h>
47 #include <AliAnalysisDataSlot.h>
48 #include <AliAnalysisDataContainer.h>
49 #include "AliMCEvent.h"
50 #include "AliAnalysisManager.h"
51 #include "AliAODMCHeader.h"
52 #include "AliAODHandler.h"
53 #include "AliLog.h"
54 #include "AliExternalTrackParam.h"
55 #include "AliAODVertex.h"
56 #include "AliESDVertex.h"
57 #include "AliAODRecoDecay.h"
58 #include "AliAODRecoDecayHF.h"
60 #include "AliESDtrack.h"
61 #include "AliAODTrack.h"
62 #include "AliAODv0.h"
63 #include "AliAODcascade.h"
64 #include "AliAODMCParticle.h"
65 #include "AliAnalysisTaskSE.h"
67 #include "AliPIDResponse.h"
68 #include "AliPIDCombined.h"
69 #include "AliAODPidHF.h"
70 #include "AliInputEventHandler.h"
71 #include "AliESDtrackCuts.h"
72 #include "AliNeutralTrackParam.h"
73 #include "AliKFParticle.h"
74 #include "AliKFVertex.h"
75 #include "AliExternalTrackParam.h"
76 #include "AliCentrality.h"
77 #include "AliVertexerTracks.h"
78 
79 using std::cout;
80 using std::endl;
81 
85 
86 //__________________________________________________________________________
89  fUseMCInfo(kFALSE),
90  fFillSignalOnly(kFALSE),
91  fFillBkgOnly(kFALSE),
92  fOutput(0),
93  fOutputAll(0),
94  fListCuts(0),
95  fCEvents(0),
96  fHTrigger(0),
97  fHCentrality(0),
98  fAnalCuts(0),
99  fIsEventSelected(kFALSE),
100  fWriteVariableTree(kFALSE),
101  fVariablesTree(0),
102  fReconstructPrimVert(kFALSE),
103  fIsMB(kFALSE),
104  fIsSemi(kFALSE),
105  fIsCent(kFALSE),
106  fIsINT7(kFALSE),
107  fIsEMC7(kFALSE),
108  fCandidateVariables(),
109  fVtx1(0),
110  fV1(0),
111  fBzkG(0),
112  fCentrality(0),
113  fTriggerCheck(0),
114  fHistoXicMass(0),
115  fHistoDcaPi1Pi2(0),
116  fHistoDcaPiCasc(0),
117  fHistoLikeDecayLength(0),
118  fHistoLikeDecayLengthXY(0),
119  fHistoXicCosPAXY(0),
120  fHistoXiMass(0),
121  fHistoCascDcaXiDaughters(0),
122  fHistoCascDcaV0Daughters(0),
123  fHistoCascDcaV0ToPrimVertex(0),
124  fHistoCascDcaPosToPrimVertex(0),
125  fHistoCascDcaNegToPrimVertex(0),
126  fHistoCascDcaBachToPrimVertex(0),
127  fHistoCascCosPAXiPrim(0),
128  fHistoXiPt(0),
129  fHistoPiPt(0),
130  fHistoPid0(0),
131  fHistonSigmaTPCpi(0),
132  fHistonSigmaTOFpi(0),
133  fHistoProbPion(0),
134  fHistoXiMassvsPtRef(0),
135  fHistoXiMassvsPtRef2(0),
136  fHistoXiMassvsPtRef3(0),
137  fHistoXiMassvsPtRef4(0),
138  fHistoXiMassvsPtRef5(0),
139  fHistoXiMassvsPtRef6(0),
140  fHistoPiPtRef(0)
141 {
142  //
143  // Default Constructor.
144  //
145 }
146 
147 //___________________________________________________________________________
150  Bool_t writeVariableTree) :
151  AliAnalysisTaskSE(name),
152  fUseMCInfo(kFALSE),
153  fFillSignalOnly(kFALSE),
154  fFillBkgOnly(kFALSE),
155  fOutput(0),
156  fOutputAll(0),
157  fListCuts(0),
158  fCEvents(0),
159  fHTrigger(0),
160  fHCentrality(0),
161  fAnalCuts(analCuts),
162  fIsEventSelected(kFALSE),
163  fWriteVariableTree(writeVariableTree),
164  fVariablesTree(0),
165  fReconstructPrimVert(kFALSE),
166  fIsMB(kFALSE),
167  fIsSemi(kFALSE),
168  fIsCent(kFALSE),
169  fIsINT7(kFALSE),
170  fIsEMC7(kFALSE),
172  fVtx1(0),
173  fV1(0),
174  fBzkG(0),
175  fCentrality(0),
176  fTriggerCheck(0),
177  fHistoXicMass(0),
178  fHistoDcaPi1Pi2(0),
179  fHistoDcaPiCasc(0),
182  fHistoXicCosPAXY(0),
183  fHistoXiMass(0),
191  fHistoXiPt(0),
192  fHistoPiPt(0),
193  fHistoPid0(0),
196  fHistoProbPion(0),
203  fHistoPiPtRef(0)
204 {
205  //
206  // Constructor. Initialization of Inputs and Outputs
207  //
208  Info("AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks","Calling Constructor");
209 
210  DefineOutput(1,TList::Class());
211  DefineOutput(2,TList::Class());
212  if(writeVariableTree){
213  DefineOutput(3,TTree::Class());
214  }else{
215  DefineOutput(3,TList::Class());
216  }
217 }
218 
219 //___________________________________________________________________________
221  //
222  // destructor
223  //
224  Info("~AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks","Calling Destructor");
225 
226 
227  if (fOutput) {
228  delete fOutput;
229  fOutput = 0;
230  }
231 
232  if (fOutputAll) {
233  delete fOutputAll;
234  fOutputAll = 0;
235  }
236 
237  if (fListCuts) {
238  delete fListCuts;
239  fListCuts = 0;
240  }
241 
242 
243  if (fAnalCuts) {
244  delete fAnalCuts;
245  fAnalCuts = 0;
246  }
247 
248  if (fVariablesTree) {
249  delete fVariablesTree;
250  fVariablesTree = 0;
251  }
252 
254  delete fCandidateVariables;
256  }
257 
258 }
259 
260 //_________________________________________________
262  //
263  // Initialization
264  //
265  //
266 
267  //Copied from $ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF.C
268 
269  fIsEventSelected=kFALSE;
270 
271  if (fDebug > 1) AliInfo("Init");
272 
273  fListCuts = new TList();
274  fListCuts->SetOwner();
275  fListCuts->SetName("ListCuts");
277  PostData(2,fListCuts);
278 
279  return;
280 }
281 
282 //_________________________________________________
284 {
285  //
286  // UserExec code
287  //
288 
289  if (!fInputEvent) {
290  AliError("NO EVENT FOUND!");
291  return;
292  }
293  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
294 
295 
296  fCEvents->Fill(1);
297  //------------------------------------------------
298  // First check if the event has proper vertex and B
299  //------------------------------------------------
300  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
301  if (!fVtx1) return;
302 
303  Double_t pos[3],cov[6];
304  fVtx1->GetXYZ(pos);
305  fVtx1->GetCovarianceMatrix(cov);
306  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
307 
308  fBzkG = (Double_t)aodEvent->GetMagneticField();
309  AliKFParticle::SetField(fBzkG);
310  if (TMath::Abs(fBzkG)<0.001) {
311  delete fV1;
312  return;
313  }
314  fCEvents->Fill(2);
315 
316  //------------------------------------------------
317  // Event selection
318  //------------------------------------------------
319  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
320  if(!fIsTriggerNotOK) fCEvents->Fill(3);
321 
323  if(!fIsEventSelected) {
324  //cout<<"Why: "<<fAnalCuts->GetWhyRejection()<<endl;
325  delete fV1;
326  return;
327  }
328 
329  //cout<<fabs(aodEvent->GetPrimaryVertex()->GetZ()-aodEvent->GetPrimaryVertexSPD()->GetZ())<<endl;
330 
331  fCEvents->Fill(4);
332 
333  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
334  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
335  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
336  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
337  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
339  if(fIsMB) fHTrigger->Fill(1);
340  if(fIsSemi) fHTrigger->Fill(2);
341  if(fIsCent) fHTrigger->Fill(3);
342  if(fIsINT7) fHTrigger->Fill(4);
343  if(fIsEMC7) fHTrigger->Fill(5);
344  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
345  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
346  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
347  if(fIsMB&fIsCent) fHTrigger->Fill(11);
348  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
349 
350  AliCentrality *cent = aodEvent->GetCentrality();
351  fCentrality = cent->GetCentralityPercentile("V0M");
352  fHCentrality->Fill(fCentrality);
353 
354  //------------------------------------------------
355  // Check if the event has cascade candidate
356  //------------------------------------------------
357  Int_t ncasc = aodEvent->GetNumberOfCascades();
358  Int_t nselecasc = 0.;
359  for(Int_t ic=0;ic<ncasc;ic++){
360  AliAODcascade *casc = aodEvent->GetCascade(ic);
361  if(!fAnalCuts) continue;
362  if(fAnalCuts->SingleCascadeCuts(casc,pos)) nselecasc++;
363  }
364 
365  if(nselecasc==0){
366  delete fV1;
367  return;
368  }
369 
370  fCEvents->Fill(5);
371 
372  //------------------------------------------------
373  // MC analysis setting
374  //------------------------------------------------
375  TClonesArray *mcArray = 0;
376  AliAODMCHeader *mcHeader=0;
377  if (fUseMCInfo) {
378  // MC array need for maching
379  mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
380  if (!mcArray) {
381  AliError("Could not find Monte-Carlo in AOD");
382  delete fV1;
383  return;
384  }
385  fCEvents->Fill(6); // in case of MC events
386 
387  // load MC header
388  mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
389  if (!mcHeader) {
390  AliError("AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::UserExec: MC header branch not found!\n");
391  delete fV1;
392  return;
393  }
394  fCEvents->Fill(7); // in case of MC events
395 
396  Double_t zMCVertex = mcHeader->GetVtxZ();
397  if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
398  AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
399  delete fV1;
400  return;
401  } else {
402  fCEvents->Fill(17); // in case of MC events
403  }
404  }
405 
406  //------------------------------------------------
407  // Main analysis done in this function
408  //------------------------------------------------
409  MakeAnalysis(aodEvent, mcArray);
410 
411  PostData(1,fOutput);
412  if(fWriteVariableTree){
413  PostData(3,fVariablesTree);
414  }else{
415  PostData(3,fOutputAll);
416  }
417 
418  fIsEventSelected=kFALSE;
419 
420  delete fV1;
421  return;
422 }
423 
424 //________________________________________ terminate ___________________________
426 {
427  // The Terminate() function is the last function to be called during
428  // a query. It always runs on the client, it can be used to present
429  // the results graphically or save the results to file.
430 
431  //AliInfo("Terminate","");
432  AliAnalysisTaskSE::Terminate();
433 
434  fOutput = dynamic_cast<TList*> (GetOutputData(1));
435  if (!fOutput) {
436  AliError("fOutput not available");
437  return;
438  }
439 
440  if(!fWriteVariableTree){
441  fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
442  if (!fOutputAll) {
443  AliError("fOutputAll not available");
444  return;
445  }
446  }
447 
448  return;
449 }
450 
451 //___________________________________________________________________________
453 {
454  //
455  // UserCreateOutputObjects
456  //
457 
458  AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
459 
460  //------------------------------------------------
461  // output object setting
462  //------------------------------------------------
463  fOutput = new TList();
464  fOutput->SetOwner();
465  fOutput->SetName("chist0");
466  DefineGeneralHistograms(); // define general histograms
467  PostData(1,fOutput);
468 
470  if (fWriteVariableTree) {
471  PostData(3,fVariablesTree);
472  }else{
473  fOutputAll = new TList();
474  fOutputAll->SetOwner();
475  fOutputAll->SetName("anahisto");
476  DefineAnalysisHistograms(); // define general histograms
477  PostData(3,fOutputAll);
478  }
479 
480 
481  return;
482 }
483 
484 //________________________________________________________________________
486 (
487  AliAODEvent *aodEvent, TClonesArray *mcArray
488  )
489 {
490  //
491  // Main analysis part called from UserExec
492  //
493 
494  Int_t nCascades= aodEvent->GetNumberOfCascades();
495  if (nCascades==0) {
496  return;
497  }
498  Int_t nTracks= aodEvent->GetNumberOfTracks();
499  if (nTracks==0) {
500  return;
501  }
502 
503  //------------------------------------------------
504  // Select good track before hand to save time
505  //------------------------------------------------
506  Bool_t seleTrkFlags[nTracks];
507  Int_t nSeleTrks=0;
508  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags);
509  Bool_t seleCascFlags[nCascades];
510  Int_t nSeleCasc=0;
511  SelectCascade(aodEvent,nCascades,nSeleCasc,seleCascFlags);
512 
513  Int_t usedmclab[20];//Used Xic Label: Assuming there are less than 20 Xic/evt
514  Int_t nusedmclab[20];//Number of times the Xic label is used: Assuming there are less than 20 Xic/evt
515  for(Int_t i=0;i<20;i++) {
516  usedmclab[i]=-9999;
517  nusedmclab[i]=0;
518  }
519 
520  //------------------------------------------------
521  // Cascade loop
522  //------------------------------------------------
523  for (Int_t icasc = 0; icasc<nCascades; icasc++) {
524  if(!seleCascFlags[icasc]) continue;
525  AliAODcascade *casc = aodEvent->GetCascade(icasc);
526  if(!casc) continue;
527 
528  AliAODTrack *cptrack = (AliAODTrack*)(casc->GetDaughter(0));
529  AliAODTrack *cntrack = (AliAODTrack*)(casc->GetDaughter(1));
530  AliAODTrack *cbtrack = (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
531  if(!cptrack || !cntrack || !cbtrack) continue;
532 
533  Int_t cpid = cptrack->GetID();
534  Int_t cnid = cntrack->GetID();
535  Int_t cbid = cbtrack->GetID();
536 
537  if(cptrack->Charge()==0) continue;
538  if(cntrack->Charge()==0) continue;
539  if(cbtrack->Charge()==0) continue;
540 
541  Short_t charge_casc = cptrack->Charge() + cntrack->Charge() + cbtrack->Charge();
542 
543  //------------------------------------------------
544  // Track1 loop
545  //------------------------------------------------
546  for (Int_t itrk1 = 0; itrk1<nTracks-1; itrk1++) {
547  if(!seleTrkFlags[itrk1]) continue;
548  AliAODTrack *trk1 = (AliAODTrack*)aodEvent->GetTrack(itrk1);
549  if(!trk1||trk1->GetID()<0) continue;
550 
551  //------------------------------------------------
552  // Track2 loop
553  //------------------------------------------------
554  for (Int_t itrk2 = itrk1+1; itrk2<nTracks; itrk2++) {
555  if(!seleTrkFlags[itrk2]) continue;
556  AliAODTrack *trk2 = (AliAODTrack*)aodEvent->GetTrack(itrk2);
557  if(!trk2||trk2->GetID()<0) continue;
558 
559  if(!SelectLikeSign(trk1,trk2)) continue;
560 
561  Int_t lpid1 = trk1->GetID();
562  Int_t lpid2 = trk2->GetID();
563  if((cpid==lpid1)||(cpid==lpid2)||(cnid==lpid1)||(cnid==lpid2)||(cbid==lpid1)||(cbid==lpid2)) continue;
564 
565 
566  Short_t charge_like1 = trk1->Charge();
567  Short_t charge_like2 = trk2->Charge();
568  Bool_t ok_charge = kFALSE;
569  if((charge_casc==-1)&&(charge_like1==1)&&(charge_like2==1)) ok_charge = kTRUE;
570  if((charge_casc==1)&&(charge_like1==-1)&&(charge_like2==-1)) ok_charge = kTRUE;
571  if(!ok_charge) continue;
572 
573  //------------------------------------------------
574  // Roughly select good candidates to speed up
575  //------------------------------------------------
576  if(!fAnalCuts->SelectWithRoughCuts(casc,trk1,trk2)) continue;
577 
578  //------------------------------------------------
579  // Secondary vertex calculation
580  //------------------------------------------------
581  Double_t dispersion;
582  AliAODVertex *secVert = CallReconstructSecondaryVertex(trk1,trk2,dispersion);
583  if(!secVert) continue;
584 
585  AliAODRecoCascadeHF3Prong *xicobj = MakeCascadeHF3Prong(casc,trk1,trk2,aodEvent,secVert,dispersion);
586  if(!xicobj) {
587  delete secVert;
588  continue;
589  }
590  AliAODMCParticle *mcxic = 0;
591  AliAODMCParticle *mcdaughter1 = 0;
592  AliAODMCParticle *mcdaughter2 = 0;
593  AliAODMCParticle *mcdaughterxi = 0;
594  Int_t mclabxic = 0;
595  Int_t nmclabxic = 0;
596  Bool_t isXic = kFALSE;
597  if(fUseMCInfo)
598  {
599  Int_t pdgDg[3]={211,3312,211};
600  Int_t pdgDgcasc[2]={211,3122};
601  Int_t pdgDgv0[2]={2212,211};
602  mclabxic = xicobj->MatchToMC(4232,pdgDg[1],pdgDg,pdgDgcasc,pdgDgv0,mcArray);
603  if(mclabxic>-1){
604  mcxic = (AliAODMCParticle*) mcArray->At(mclabxic);
605  for(Int_t ia=0;ia<20;ia++){
606  if(usedmclab[ia]==mclabxic){
607  nusedmclab[ia]++;
608  nmclabxic = nusedmclab[ia];
609  break;
610  }
611  if(usedmclab[ia]==-9999){
612  usedmclab[ia]=mclabxic;
613  nusedmclab[ia]++;
614  nmclabxic = nusedmclab[ia];
615  break;
616  }
617  }
618  isXic=kTRUE;
619  Int_t pi_counter = 0;
620  for(Int_t idau=mcxic->GetDaughterFirst();idau<mcxic->GetDaughterLast()+1;idau++)
621  {
622  //cout<<idau<<endl;
623  if(idau<0) break;
624  AliAODMCParticle *mcpart = (AliAODMCParticle*) mcArray->At(idau);
625  Int_t pdgcode = TMath::Abs(mcpart->GetPdgCode());
626  if(pdgcode==211 && pi_counter==0){
627  mcdaughter1 = mcpart;
628  pi_counter=1;
629  }else if(pdgcode==211 && pi_counter==1){
630  mcdaughter2 = mcpart;
631  pi_counter=2;
632  }else if(pdgcode==3312){
633  mcdaughterxi = mcpart;
634  }
635  }
636  //cout<<"pointer: "<<mcdaughter1<<" "<<mcdaughter2<<" "<<mcdaughterxi<<endl;
637  //cout<<"1: "<<mcdaughter1->GetPdgCode()<<endl;
638  //cout<<"2: "<<mcdaughter2->GetPdgCode()<<endl;
639  //cout<<"3: "<<mcdaughterxi->GetPdgCode()<<endl;
640 
641  }
642  }
643 
644  FillROOTObjects(xicobj,mcxic,mcdaughter1,mcdaughter2,mcdaughterxi,nmclabxic,isXic);
645  xicobj->GetSecondaryVtx()->RemoveDaughters();
646  xicobj->UnsetOwnPrimaryVtx();
647  delete xicobj;xicobj=NULL;
648  delete secVert;
649 
650  }//trk2
651  }//trk1
652  }//casc
653 }
654 
655 //________________________________________________________________________
656 void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::FillROOTObjects(AliAODRecoCascadeHF3Prong *xicobj, AliAODMCParticle *mcpart, AliAODMCParticle *mcdaughter1, AliAODMCParticle *mcdaughter2, AliAODMCParticle *mcdaughterxi, Int_t mcnused, Bool_t isXic)
657 {
658  //
659  // Fill histogram or Tree depending on fWriteVariableTree flag
660  //
661 
662  AliAODTrack *part1 = xicobj->GetBachelor1();
663  AliAODTrack *part2 = xicobj->GetBachelor2();
664  AliAODcascade *casc = xicobj->GetCascade();
665 
666  Double_t dca[3];
667  xicobj->GetDCAs(dca);
668 
669  if ((fUseMCInfo && fFillSignalOnly && !fFillBkgOnly && !isXic) || (fUseMCInfo && !fFillSignalOnly && fFillBkgOnly && isXic)) return;
670  else {
671 
672  // if (!fUseMCInfo || (fUseMCInfo && fFillSignalOnly && isXiC) || (fUseMCInfo && !fFillSignalOnly)){
673  fCandidateVariables[ 0] = xicobj->InvMassPiXiPi();
674  fCandidateVariables[ 1] = xicobj->Px();
675  fCandidateVariables[ 2] = xicobj->Py();
676  fCandidateVariables[ 3] = xicobj->Pz();
677  fCandidateVariables[ 4] = part1->Px();
678  fCandidateVariables[ 5] = part1->Py();
679  fCandidateVariables[ 6] = part1->Pz();
680  fCandidateVariables[ 7] = part2->Px();
681  fCandidateVariables[ 8] = part2->Py();
682  fCandidateVariables[ 9] = part2->Pz();
683  fCandidateVariables[10] = casc->MassXi();
684  fCandidateVariables[11] = casc->MomXiX();
685  fCandidateVariables[12] = casc->MomXiY();
686  fCandidateVariables[13] = casc->MomXiZ();
687  fCandidateVariables[14] = casc->MassLambda();
688  fCandidateVariables[15] = casc->MassAntiLambda();
689 
691  fCandidateVariables[17] = fVtx1->GetX();
692  fCandidateVariables[18] = fVtx1->GetY();
693  fCandidateVariables[19] = fVtx1->GetZ();
694  fCandidateVariables[20] = xicobj->GetOwnPrimaryVtx()->GetX();
695  fCandidateVariables[21] = xicobj->GetOwnPrimaryVtx()->GetY();
696  fCandidateVariables[22] = xicobj->GetOwnPrimaryVtx()->GetZ();
697 
698  fCandidateVariables[23] = xicobj->CascDcaXiDaughters();
699  fCandidateVariables[24] = xicobj->CascDcaV0Daughters();
700  fCandidateVariables[25] = xicobj->CascDecayLength();
706  fCandidateVariables[31] = xicobj->CascDecayLengthV0();
708 
709  fCandidateVariables[33] = dca[0];
710  fCandidateVariables[34] = dca[1];
711  fCandidateVariables[35] = dca[2];
712  fCandidateVariables[36] = xicobj->Getd0Prong(0);
713  fCandidateVariables[37] = xicobj->Getd0Prong(2);
714  fCandidateVariables[38] = xicobj->Getd0Prong(1);
715 
716  fCandidateVariables[39] = xicobj->DecayLength();
717  fCandidateVariables[40] = xicobj->DecayLengthXY();
719 
720  Double_t nSigmaTPCpi1=-9999.;
721  Double_t nSigmaTPCpi2=-9999.;
722  Double_t nSigmaTOFpi1=-9999.;
723  Double_t nSigmaTOFpi2=-9999.;
724  Double_t probPion1=-9999.;
725  Double_t probPion2=-9999.;
726 
727  if(fAnalCuts->GetIsUsePID())
728  {
729  nSigmaTPCpi1 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(part1,AliPID::kPion);
730  fCandidateVariables[42] = nSigmaTPCpi1;
731  nSigmaTPCpi2 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(part2,AliPID::kPion);
732  fCandidateVariables[43] = nSigmaTPCpi2;
733  nSigmaTOFpi1 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(part1,AliPID::kPion);
734  fCandidateVariables[44] = nSigmaTOFpi1;
735  nSigmaTOFpi2 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(part2,AliPID::kPion);
736  fCandidateVariables[45] = nSigmaTOFpi2;
737 
739  probPion1 = fAnalCuts->GetPionProbabilityTPCTOF(part1);
740  probPion2 = fAnalCuts->GetPionProbabilityTPCTOF(part2);
741  }
742  fCandidateVariables[46] = probPion1;
743  fCandidateVariables[47] = probPion2;
744  }
745  fCandidateVariables[48] = -9999;
746  fCandidateVariables[49] = -9999;
747  fCandidateVariables[50] = -9999;
748  fCandidateVariables[51] = -9999;
749  fCandidateVariables[52] = -9999;
750  fCandidateVariables[53] = -9999;
751  fCandidateVariables[54] = -9999;
752  fCandidateVariables[55] = -9999;
753  fCandidateVariables[56] = -9999;
754  fCandidateVariables[57] = -9999;
755  fCandidateVariables[65] = -9999;
756  fCandidateVariables[66] = -9999;
757  fCandidateVariables[67] = -9999;
758  fCandidateVariables[68] = -9999;
759  fCandidateVariables[69] = -9999;
760  fCandidateVariables[70] = -9999;
761  fCandidateVariables[71] = -9999;
762  fCandidateVariables[72] = -9999;
763  fCandidateVariables[73] = -9999;
764  fCandidateVariables[74] = -9999;
765  fCandidateVariables[75] = -9999;
766  fCandidateVariables[76] = -9999;
767 
768  if(fUseMCInfo){
769  if(mcpart){
770  fCandidateVariables[48] = mcpart->Label();
771  fCandidateVariables[49] = mcnused;
772  fCandidateVariables[50] = mcpart->GetPdgCode();
773  fCandidateVariables[54] = mcpart->Pt();
774  if(mcdaughter1&&mcdaughter2&&mcdaughterxi){
775  Double_t mcprimvertx = mcpart->Xv();
776  Double_t mcprimverty = mcpart->Yv();
777  Double_t mcsecvertx = mcdaughter1->Xv();
778  Double_t mcsecverty = mcdaughter1->Yv();
779  Double_t recosecvertx = xicobj->GetSecondaryVtx()->GetX();
780  Double_t recosecverty = xicobj->GetSecondaryVtx()->GetY();
781  fCandidateVariables[51] = TMath::Sqrt((mcsecvertx-mcprimvertx)*(mcsecvertx-mcprimvertx)+(mcsecverty-mcprimverty)*(mcsecverty-mcprimverty));
782  fCandidateVariables[52] = TMath::Sqrt((recosecvertx-mcprimvertx)*(recosecvertx-mcprimvertx)+(recosecverty-mcprimverty)*(recosecverty-mcprimverty));
783  Double_t vecx_vert = recosecvertx-mcprimvertx;
784  Double_t vecy_vert = recosecverty-mcprimverty;
785  Double_t vecl_vert = TMath::Sqrt(vecx_vert*vecx_vert+vecy_vert*vecy_vert);
786  Double_t vecx_mom = xicobj->Px();
787  Double_t vecy_mom = xicobj->Py();
788  Double_t vecl_mom = xicobj->Pt();
789  if(vecl_vert>0.&&vecl_mom>0.)
790  fCandidateVariables[53] = (vecx_vert*vecx_mom+vecy_vert*vecy_mom)/vecl_vert/vecl_mom;
791  fCandidateVariables[55] = mcdaughter1->Pt();
792  fCandidateVariables[56] = mcdaughter2->Pt();
793  fCandidateVariables[57] = mcdaughterxi->Pt();
794  fCandidateVariables[65] = mcpart->Px();
795  fCandidateVariables[66] = mcpart->Py();
796  fCandidateVariables[67] = mcpart->Pz();
797  fCandidateVariables[68] = mcdaughter1->Px();
798  fCandidateVariables[69] = mcdaughter1->Py();
799  fCandidateVariables[70] = mcdaughter1->Pz();
800  fCandidateVariables[71] = mcdaughter2->Px();
801  fCandidateVariables[72] = mcdaughter2->Py();
802  fCandidateVariables[73] = mcdaughter2->Pz();
803  fCandidateVariables[74] = mcdaughterxi->Px();
804  fCandidateVariables[75] = mcdaughterxi->Py();
805  fCandidateVariables[76] = mcdaughterxi->Pz();
806  }
807  }
808  }
809  fCandidateVariables[58] = casc->Px();
810  fCandidateVariables[59] = casc->Py();
811  fCandidateVariables[60] = casc->Pz();
812  fCandidateVariables[61] = -9999.;
813  fCandidateVariables[62] = -9999.;
814  fCandidateVariables[63] = -9999.;
815  if(TMath::Abs(casc->MassLambda()-1.115683)<0.02){
816  fCandidateVariables[61] = casc->MomPosX();
817  fCandidateVariables[62] = casc->MomPosY();
818  fCandidateVariables[63] = casc->MomPosZ();
819  }else{
820  fCandidateVariables[61] = casc->MomNegX();
821  fCandidateVariables[62] = casc->MomNegY();
822  fCandidateVariables[63] = casc->MomNegZ();
823  }
825 
826  fCandidateVariables[77] = casc->DecayVertexV0X();
827  fCandidateVariables[78] = casc->DecayVertexV0Y();
828  fCandidateVariables[79] = casc->DecayVertexV0Z();
829  fCandidateVariables[80] = casc->DecayVertexXiX();
830  fCandidateVariables[81] = casc->DecayVertexXiY();
831  fCandidateVariables[82] = casc->DecayVertexXiZ();
832  fCandidateVariables[83] = xicobj->GetSecondaryVtx()->GetX();
833  fCandidateVariables[84] = xicobj->GetSecondaryVtx()->GetY();
834  fCandidateVariables[85] = xicobj->GetSecondaryVtx()->GetZ();
835 
836  fCandidateVariables[86] = part1->GetTPCClusterInfo(2,1);
837  fCandidateVariables[87] = part2->GetTPCClusterInfo(2,1);
838  AliAODTrack *ptrack = (AliAODTrack*) (casc->GetDaughter(0));
839  AliAODTrack *ntrack = (AliAODTrack*) (casc->GetDaughter(1));
840  AliAODTrack *btrack = (AliAODTrack*) (casc->GetDecayVertexXi()->GetDaughter(0));
841 
842  fCandidateVariables[88] = btrack->GetTPCClusterInfo(2,1);
843  fCandidateVariables[89] = ptrack->GetTPCClusterInfo(2,1);
844  fCandidateVariables[90] = ntrack->GetTPCClusterInfo(2,1);
845  }//close if to check mc fill only signal
846 
847 
849  fVariablesTree->Fill();
850  else{
852  {
853  Double_t cont[3];
854  cont[0] = xicobj->InvMassPiXiPi();
855  cont[1] = xicobj->Pt();
856  cont[2] = fCentrality;
857  fHistoXicMass->Fill(cont);
858 
859  fHistoDcaPi1Pi2->Fill(dca[2]);
860  fHistoDcaPiCasc->Fill(dca[0]);
861  fHistoDcaPiCasc->Fill(dca[1]);
862  fHistoLikeDecayLength->Fill(xicobj->DecayLength());
863  fHistoLikeDecayLengthXY->Fill(xicobj->DecayLengthXY());
864  fHistoXicCosPAXY->Fill(xicobj->XicCosPointingAngle());
865  fHistoXiMass->Fill(xicobj->CascMassXi());
873  fHistoXiPt->Fill(xicobj->PtProng(1));
874  fHistoPiPt->Fill(xicobj->PtProng(0));
875  fHistoPiPt->Fill(xicobj->PtProng(2));
876  fHistoPid0->Fill(xicobj->Getd0Prong(0));
877  fHistoPid0->Fill(xicobj->Getd0Prong(2));
878 
879  Double_t nSigmaTPCpi1=-9999.;
880  Double_t nSigmaTPCpi2=-9999.;
881  Double_t nSigmaTOFpi1=-9999.;
882  Double_t nSigmaTOFpi2=-9999.;
883  Double_t probPion1=-9999.;
884  Double_t probPion2=-9999.;
885 
886  if(fAnalCuts->GetIsUsePID())
887  {
888  nSigmaTPCpi1 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(part1,AliPID::kPion);
889  nSigmaTPCpi2 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(part2,AliPID::kPion);
890  nSigmaTOFpi1 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(part1,AliPID::kPion);
891  nSigmaTOFpi2 = fAnalCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(part2,AliPID::kPion);
892 
894  probPion1 = fAnalCuts->GetPionProbabilityTPCTOF(part1);
895  probPion2 = fAnalCuts->GetPionProbabilityTPCTOF(part2);
896  }
897  }
898 
899  fHistonSigmaTPCpi->Fill(nSigmaTPCpi1);
900  fHistonSigmaTPCpi->Fill(nSigmaTPCpi2);
901  fHistonSigmaTOFpi->Fill(nSigmaTOFpi1);
902  fHistonSigmaTOFpi->Fill(nSigmaTOFpi2);
903  fHistoProbPion->Fill(probPion1);
904  fHistoProbPion->Fill(probPion2);
905  }
906 
907  }
908  return;
909 }
910 
911 //________________________________________________________________________
913 {
914  //
915  // This is to define tree variables
916  //
917  const char* nameoutput = GetOutputSlot(3)->GetContainer()->GetName();
918  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
919  Int_t nVar = 91;
920  fCandidateVariables = new Float_t [nVar];
921  TString * fCandidateVariableNames = new TString[nVar];
922 
923  fCandidateVariableNames[ 0]="InvMassXic";
924  fCandidateVariableNames[ 1]="XicPx";
925  fCandidateVariableNames[ 2]="XicPy";
926  fCandidateVariableNames[ 3]="XicPz";
927  fCandidateVariableNames[ 4]="Pi1Px";
928  fCandidateVariableNames[ 5]="Pi1Py";
929  fCandidateVariableNames[ 6]="Pi1Pz";
930  fCandidateVariableNames[ 7]="Pi2Px";
931  fCandidateVariableNames[ 8]="Pi2Py";
932  fCandidateVariableNames[ 9]="Pi2Pz";
933  fCandidateVariableNames[10]="MassXi";
934  fCandidateVariableNames[11]="XiPx";
935  fCandidateVariableNames[12]="XiPy";
936  fCandidateVariableNames[13]="XiPz";
937  fCandidateVariableNames[14]="MassLambda";
938  fCandidateVariableNames[15]="MassAntiLambda";
939 
940  fCandidateVariableNames[16]="Centrality";
941  fCandidateVariableNames[17]="PrimVtxX";
942  fCandidateVariableNames[18]="PrimVtxY";
943  fCandidateVariableNames[19]="PrimVtxZ";
944  fCandidateVariableNames[20]="NewPrimVtxX";
945  fCandidateVariableNames[21]="NewPrimVtxY";
946  fCandidateVariableNames[22]="NewPrimVtxZ";
947 
948  fCandidateVariableNames[23]="CascDcaXiDaughters";
949  fCandidateVariableNames[24]="CascDcaV0Daughters";
950  fCandidateVariableNames[25]="CascDecayLengthXi";
951  fCandidateVariableNames[26]="CascCosPointingAngleXi";
952  fCandidateVariableNames[27]="CascDcaV0ToPrimVertex";
953  fCandidateVariableNames[28]="CascDcaPosToPrimVertex";
954  fCandidateVariableNames[29]="CascDcaNegToPrimVertex";
955  fCandidateVariableNames[30]="CascDcaBachToPrimVertex";
956  fCandidateVariableNames[31]="CascDecayLengthV0";
957  fCandidateVariableNames[32]="CascCosPointingAngleV0";
958 
959  fCandidateVariableNames[33]="DcaPi1Casc";
960  fCandidateVariableNames[34]="DcaPi2Casc";
961  fCandidateVariableNames[35]="DcaPi1Pi2";
962 
963  fCandidateVariableNames[36]="Pi1d0";
964  fCandidateVariableNames[37]="Pi2d0";
965  fCandidateVariableNames[38]="Cascd0";
966 
967  fCandidateVariableNames[39]="DecayLength";
968  fCandidateVariableNames[40]="DecayLengthXY";
969  fCandidateVariableNames[41]="XicCosPAXY";
970 
971  fCandidateVariableNames[42]="nSigmaTPCpi1";
972  fCandidateVariableNames[43]="nSigmaTPCpi2";
973  fCandidateVariableNames[44]="nSigmaTOFpi1";
974  fCandidateVariableNames[45]="nSigmaTOFpi2";
975  fCandidateVariableNames[46]="probPion1";
976  fCandidateVariableNames[47]="probPion2";
977 
978  fCandidateVariableNames[48]="mcxicID";
979  fCandidateVariableNames[49]="mcnused";
980  fCandidateVariableNames[50]="mcpdgcode";
981  fCandidateVariableNames[51]="mcdecaylength";
982  fCandidateVariableNames[52]="mcdecaylength_secsmear";
983  fCandidateVariableNames[53]="mcxiccospaxy";
984  fCandidateVariableNames[54]="mcxicpt";
985  fCandidateVariableNames[55]="mcpi1pt";
986  fCandidateVariableNames[56]="mcpi2pt";
987  fCandidateVariableNames[57]="mcxipt";
988 
989  fCandidateVariableNames[58]="LambdaPx";
990  fCandidateVariableNames[59]="LambdaPy";
991  fCandidateVariableNames[60]="LambdaPz";
992  fCandidateVariableNames[61]="ProtonPx";
993  fCandidateVariableNames[62]="ProtonPy";
994  fCandidateVariableNames[63]="ProtonPz";
995  fCandidateVariableNames[64]="BachelorsCosPAXY";
996 
997  fCandidateVariableNames[65]="mcxicpx";
998  fCandidateVariableNames[66]="mcxicpy";
999  fCandidateVariableNames[67]="mcxicpz";
1000  fCandidateVariableNames[68]="mcpi1px";
1001  fCandidateVariableNames[69]="mcpi1py";
1002  fCandidateVariableNames[70]="mcpi1pz";
1003  fCandidateVariableNames[71]="mcpi2px";
1004  fCandidateVariableNames[72]="mcpi2py";
1005  fCandidateVariableNames[73]="mcpi2pz";
1006  fCandidateVariableNames[74]="mcxipx";
1007  fCandidateVariableNames[75]="mcxipy";
1008  fCandidateVariableNames[76]="mcxipz";
1009 
1010  fCandidateVariableNames[77]="LambdaVertX";
1011  fCandidateVariableNames[78]="LambdaVertY";
1012  fCandidateVariableNames[79]="LambdaVertZ";
1013  fCandidateVariableNames[80]="XiVertX";
1014  fCandidateVariableNames[81]="XiVertY";
1015  fCandidateVariableNames[82]="XiVertZ";
1016  fCandidateVariableNames[83]="XicVertX";
1017  fCandidateVariableNames[84]="XicVertY";
1018  fCandidateVariableNames[85]="XicVertZ";
1019 
1020  fCandidateVariableNames[86]="TPCClsP1";
1021  fCandidateVariableNames[87]="TPCClsP2";
1022  fCandidateVariableNames[88]="TPCClsCascBach";
1023  fCandidateVariableNames[89]="TPCClsV0trkPos";
1024  fCandidateVariableNames[90]="TPCClsV0trkNeg";
1025 
1026  for (Int_t ivar=0; ivar<nVar; ivar++) {
1027  fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
1028  }
1029 
1030  return;
1031 }
1032 
1033 //__________________________________________________________________________
1035  //
1036  // This is to define general histograms
1037  //
1038 
1039  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
1040  fCEvents->SetStats(kTRUE);
1041  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
1042  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
1043  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
1044  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
1045  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
1046  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
1047  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
1048  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
1049  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
1050  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
1051  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
1052  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
1053  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
1054  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
1055  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
1056  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
1057  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
1058  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
1059  //fCEvents->GetXaxis()->SetTitle("");
1060  fCEvents->GetYaxis()->SetTitle("counts");
1061 
1062  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
1063  fHTrigger->SetStats(kTRUE);
1064  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
1065  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
1066  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
1067  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
1068  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
1069  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
1070  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
1071  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
1072  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
1073  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
1074  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
1075  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
1076 
1077  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
1078 
1079  Double_t binx[101];
1080  for(Int_t ib=0;ib<101;ib++){
1081  binx[ib] = 1.322-0.05 + 0.1/100.*(Double_t)ib ;
1082  }
1083  Double_t biny[21]={0.0,0.60,0.80,0.90,1.00,1.1,1.2,1.3,1.4,1.5,1.7,1.9,2.2,2.6,3.1,3.9,4.9,6.0,7.2,8.5,10.};
1084  fHistoXiMassvsPtRef = new TH2F("fHistoXiMassvsPtRef","Reference #Xi spectrum",100,binx,20,biny);
1085  fHistoXiMassvsPtRef2 = new TH2F("fHistoXiMassvsPtRef2","Reference #Xi spectrum",100,binx,20,biny);
1086  fHistoXiMassvsPtRef3 = new TH2F("fHistoXiMassvsPtRef3","Reference #Xi spectrum",100,binx,20,biny);
1087  fHistoXiMassvsPtRef4 = new TH2F("fHistoXiMassvsPtRef4","Reference #Xi spectrum",100,binx,20,biny);
1088  fHistoXiMassvsPtRef5 = new TH2F("fHistoXiMassvsPtRef5","Reference #Xi spectrum",100,binx,20,biny);
1089  fHistoXiMassvsPtRef6 = new TH2F("fHistoXiMassvsPtRef6","Reference #Xi spectrum",100,binx,20,biny);
1090  fHistoPiPtRef = new TH1F("fHistoPiPtRef","Reference #pi spectrum",20,0.,10.);
1091 
1092  fOutput->Add(fCEvents);
1093  fOutput->Add(fHTrigger);
1094  fOutput->Add(fHCentrality);
1101  fOutput->Add(fHistoPiPtRef);
1102 
1103  return;
1104 }
1105 
1106 //__________________________________________________________________________
1108 {
1109  //
1110  // Define histograms
1111  //
1112 
1113  //------------------------------------------------
1114  // Basic histograms
1115  //------------------------------------------------
1116  Int_t bins_base[3]= {80 ,20 ,10};
1117  Double_t xmin_base[3]={2.468-0.2,0 ,0.00};
1118  Double_t xmax_base[3]={2.468+0.2,20. ,100};
1119  fHistoXicMass = new THnSparseF("fHistoXicMass","",3,bins_base,xmin_base,xmax_base);
1120  fOutputAll->Add(fHistoXicMass);
1121 
1122  //------------------------------------------------
1123  // Checking histograms
1124  //------------------------------------------------
1125  fHistoDcaPi1Pi2 = new TH1F("fHistoDcaPi1Pi2","DCA (#pi_{1}-#pi_{2})",100,0.0,1.0);
1127  fHistoDcaPiCasc = new TH1F("fHistoDcaPiCasc","DCA (#pi-#Xi)",100,0.0,1.0);
1129  fHistoLikeDecayLength = new TH1F("fHistoLikeDecayLength","Decay Length (#pi-#pi)",100,0.,0.2);
1131  fHistoLikeDecayLengthXY = new TH1F("fHistoLikeDecayLengthXY","Decay Length (#pi-#pi)",100,0.,0.2);
1133  fHistoXicCosPAXY = new TH1F("fHistoXicCosPAXY","#Xi_{c} cos(pa) ",100,-1.0,1.0);
1135  fHistoXiMass=new TH1F("fHistoXiMass","#Xi^{-} Mass",100,1.322-0.05,1.322+0.05);
1136  fOutputAll->Add(fHistoXiMass);
1137  fHistoCascDcaXiDaughters=new TH1F("fHistoCascDcaXiDaughters","DCA #Xi daughters ",100,0.0,1.0);
1139  fHistoCascDcaV0Daughters=new TH1F("fHistoCascDcaV0Daughters","DCA #Xi daughters ",100,0.0,1.0);
1141  fHistoCascDcaV0ToPrimVertex=new TH1F("fHistoCascDcaV0ToPrimVertex","DCA V0 daughters ",100,0.0,1.0);
1143  fHistoCascDcaPosToPrimVertex=new TH1F("fHistoCascDcaPosToPrimVertex","DCA Pos-Prim ",100,0.0,1.0);
1145  fHistoCascDcaNegToPrimVertex=new TH1F("fHistoCascDcaNegToPrimVertex","DCA Neg-Prim ",100,0.0,1.0);
1147  fHistoCascDcaBachToPrimVertex=new TH1F("fHistoCascDcaBachToPrimVertex","DCA Bach-Prim ",100,0.0,1.0);
1149  fHistoCascCosPAXiPrim=new TH1F("fHistoCascCosPAXiPrim","#Xi CosPA (prim)",100,0.8,1.0);
1151  fHistoXiPt=new TH1F("fHistoXiPt","#Xi^{-} p_{T}",100,0.,10.);
1152  fOutputAll->Add(fHistoXiPt);
1153  fHistoPiPt=new TH1F("fHistoPiPt","#pi p_{T}",100,0.,10);
1154  fOutputAll->Add(fHistoPiPt);
1155  fHistoPid0=new TH1F("fHistoPid0","#pi d_{0}",100,-0.1,0.1);
1156  fOutputAll->Add(fHistoPid0);
1157  fHistonSigmaTPCpi=new TH1F("fHistonSigmaTPCpi","n#sigma (TPC, pion)",100,-10.,10.);
1159  fHistonSigmaTOFpi=new TH1F("fHistonSigmaTOFpi","n#sigma (TOF, pion)",100,-10.,10.);
1161  fHistoProbPion=new TH1F("fHistoProbPion","Bayse Prob",100,0.0,1.);
1162  fOutputAll->Add(fHistoProbPion);
1163 
1164  return;
1165 }
1166 
1167 //________________________________________________________________________
1168 void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags)
1169 {
1170  //
1171  // Select good tracks using fAnalCuts (AliRDHFCuts object) and return the array of their ids
1172  //
1173 
1174  //const Int_t entries = event->GetNumberOfTracks();
1175  if(trkEntries==0) return;
1176 
1177  nSeleTrks=0;
1178  for(Int_t i=0; i<trkEntries; i++) {
1179  seleFlags[i] = kFALSE;
1180 
1181  AliVTrack *track;
1182  track = (AliVTrack*)event->GetTrack(i);
1183 
1184  if(track->GetID()<0) continue;
1185  Double_t covtest[21];
1186  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
1187 
1188  AliAODTrack *aodt = (AliAODTrack*)track;
1189 
1190  if(!fAnalCuts) continue;
1191  if(fAnalCuts->SingleTrkCuts(aodt)){
1192  seleFlags[i]=kTRUE;
1193  nSeleTrks++;
1194  fHistoPiPtRef->Fill(aodt->Pt());
1195  }
1196  } // end loop on tracks
1197 }
1198 
1199 //________________________________________________________________________
1200 void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascades,Int_t &nSeleCasc, Bool_t *seleCascFlags)
1201 {
1202  //
1203  // Select good cascade using fAnalCuts (AliRDHFCuts object) and return the array of their ids
1204  //
1205 
1206  Double_t primVtx[3];
1207  fVtx1->GetXYZ(primVtx);
1208 
1209  nSeleCasc = 0;
1210  for(Int_t icasc=0;icasc<nCascades;icasc++)
1211  {
1212  seleCascFlags[icasc] = kFALSE;
1213  AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
1214 
1215  if(!fAnalCuts) continue;
1216  if(fAnalCuts->SingleCascadeCuts(casc,primVtx)){
1217  seleCascFlags[icasc] = kTRUE;
1218  nSeleCasc++;
1219  }
1220  if(fAnalCuts->SingleCascadeCutsRef(casc,primVtx))
1221  {
1222  Double_t rapxi = casc->RapXi();
1223  if(rapxi>-1.5&&rapxi<-1.0){
1224  fHistoXiMassvsPtRef2->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1225  }
1226  if(rapxi>-1.0&&rapxi<-0.5){
1227  fHistoXiMassvsPtRef3->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1228  }
1229  if(rapxi>-0.5&&rapxi<0.0){
1230  fHistoXiMassvsPtRef->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1231  }
1232  if(rapxi>0.0&&rapxi<0.5){
1233  fHistoXiMassvsPtRef4->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1234  }
1235  if(rapxi>0.5&&rapxi<1.0){
1236  fHistoXiMassvsPtRef5->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1237  }
1238  if(rapxi>1.0&&rapxi<1.5){
1239  fHistoXiMassvsPtRef6->Fill(casc->MassXi(),sqrt(pow(casc->MomXiX(),2)+pow(casc->MomXiY(),2)));
1240  }
1241  }
1242  }
1243 }
1244 
1245 //________________________________________________________________________
1247 {
1248  //
1249  // Select LikeSign tracks
1250  //
1251 
1252  if(trk1->Charge()!=trk2->Charge()) return kFALSE;
1253  if(trk1->GetID()==trk2->GetID()) return kFALSE;
1254  return kTRUE;
1255 }
1256 
1257 //________________________________________________________________________
1258 AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent* aod)
1259 {
1260  //
1261  // Make an array of tracks which should not be used in primary vertex calculation and
1262  // Call PrimaryVertex function
1263  //
1264 
1265  TObjArray *twoTrackArrayPlusXi = new TObjArray(5);
1266 
1267  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk1);
1268  twoTrackArrayPlusXi->AddAt(cptrk1,0);
1269  AliESDtrack *cptrk2 = new AliESDtrack((AliVTrack*)trk2);
1270  twoTrackArrayPlusXi->AddAt(cptrk2,1);
1271 
1272  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
1273  twoTrackArrayPlusXi->AddAt(cascptrack,2);
1274  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
1275  twoTrackArrayPlusXi->AddAt(cascntrack,3);
1276  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
1277  twoTrackArrayPlusXi->AddAt(cascbtrack,4);
1278 
1279  AliAODVertex *newvert = PrimaryVertex(twoTrackArrayPlusXi,aod);
1280 
1281  for(Int_t i=0;i<5;i++)
1282  {
1283  AliESDtrack *tesd = (AliESDtrack*)twoTrackArrayPlusXi->UncheckedAt(i);
1284  delete tesd;
1285  }
1286  twoTrackArrayPlusXi->Clear();
1287  delete twoTrackArrayPlusXi;
1288 
1289  return newvert;
1290 }
1291 
1292 //________________________________________________________________________
1293 AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::CallReconstructSecondaryVertex(AliAODTrack *trk1, AliAODTrack *trk2, Double_t &dispersion)
1294 {
1295  //
1296  // Make an array of tracks which I want to use for vertex calculation and call ReconstructSecondaryVertex
1297  //
1298 
1299  TObjArray *trkArray;
1300  trkArray= new TObjArray(2);
1301 
1302  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk1);
1303  trkArray->AddAt(cptrk1,0);
1304  AliESDtrack *cptrk2 = new AliESDtrack((AliVTrack*)trk2);
1305  trkArray->AddAt(cptrk2,1);
1306 
1307  Double_t xdummy, ydummy;
1308  Double_t dcap1p2 = cptrk1->GetDCA(cptrk2,fBzkG,xdummy,ydummy);
1309 
1310  AliAODVertex *secvertex=0;
1311  if(dcap1p2<fAnalCuts->GetProdLikeSignDcaMax()){
1312  secvertex = ReconstructSecondaryVertex(trkArray,dispersion);
1313  }
1314 
1315  for(Int_t i=0;i<2;i++)
1316  {
1317  AliESDtrack *tesd = (AliESDtrack*)trkArray->UncheckedAt(i);
1318  delete tesd;
1319  }
1320  trkArray->Clear();
1321  delete trkArray;
1322 
1323  return secvertex;
1324 }
1325 
1326 //________________________________________________________________________
1328  AliVEvent *event)
1329 {
1330  //
1331  //Used only for pp
1332  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
1333  //
1334 
1335  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
1336  Bool_t fRmTrksFromPrimVtx = kFALSE;
1337 
1338  AliESDVertex *vertexESD = 0;
1339  AliAODVertex *vertexAOD = 0;
1340 
1341  //vertexESD = new AliESDVertex(*fV1);
1342 
1343 
1344  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
1345  // primary vertex from the input event
1346 
1347  vertexESD = new AliESDVertex(*fV1);
1348 
1349  } else {
1350  // primary vertex specific to this candidate
1351 
1352  Int_t nTrks = trkArray->GetEntriesFast();
1353  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
1354 
1355  if(fRecoPrimVtxSkippingTrks) {
1356  // recalculating the vertex
1357 
1358  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
1359  Float_t diamondcovxy[3];
1360  event->GetDiamondCovXY(diamondcovxy);
1361  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
1362  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
1363  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
1364  vertexer->SetVtxStart(diamond);
1365  delete diamond; diamond=NULL;
1366  if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter"))
1367  vertexer->SetOnlyFitter();
1368  }
1369  Int_t skipped[1000];
1370  Int_t nTrksToSkip=0,id;
1371  AliExternalTrackParam *t = 0;
1372  for(Int_t i=0; i<nTrks; i++) {
1373  t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
1374  id = (Int_t)t->GetID();
1375  if(id<0) continue;
1376  skipped[nTrksToSkip++] = id;
1377  }
1378  // TEMPORARY FIX
1379  // For AOD, skip also tracks without covariance matrix
1380  Double_t covtest[21];
1381  for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
1382  AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
1383  if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
1384  id = (Int_t)vtrack->GetID();
1385  if(id<0) continue;
1386  skipped[nTrksToSkip++] = id;
1387  }
1388  }
1389  for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
1390  //
1391  vertexer->SetSkipTracks(nTrksToSkip,skipped);
1392  vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
1393 
1394  } else if(fRmTrksFromPrimVtx && nTrks>0) {
1395  // removing the prongs tracks
1396 
1397  TObjArray rmArray(nTrks);
1398  UShort_t *rmId = new UShort_t[nTrks];
1399  AliESDtrack *esdTrack = 0;
1400  AliESDtrack *t = 0;
1401  for(Int_t i=0; i<nTrks; i++) {
1402  t = (AliESDtrack*)trkArray->UncheckedAt(i);
1403  esdTrack = new AliESDtrack(*t);
1404  rmArray.AddLast(esdTrack);
1405  if(esdTrack->GetID()>=0) {
1406  rmId[i]=(UShort_t)esdTrack->GetID();
1407  } else {
1408  rmId[i]=9999;
1409  }
1410  }
1411  Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
1412  vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
1413  delete [] rmId; rmId=NULL;
1414  rmArray.Delete();
1415 
1416  }
1417 
1418  delete vertexer; vertexer=NULL;
1419  if(!vertexESD) return vertexAOD;
1420  if(vertexESD->GetNContributors()<=0) {
1421  //AliDebug(2,"vertexing failed");
1422  delete vertexESD; vertexESD=NULL;
1423  return vertexAOD;
1424  }
1425 
1426 
1427  }
1428 
1429  // convert to AliAODVertex
1430  Double_t pos[3],cov[6],chi2perNDF;
1431  vertexESD->GetXYZ(pos); // position
1432  vertexESD->GetCovMatrix(cov); //covariance matrix
1433  chi2perNDF = vertexESD->GetChi2toNDF();
1434  delete vertexESD; vertexESD=NULL;
1435 
1436  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
1437 
1438  return vertexAOD;
1439 }
1440 
1441 //________________________________________________________________________
1443 {
1444  //
1445  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
1446  //
1447 
1448  AliESDVertex *vertexESD = 0;
1449  AliAODVertex *vertexAOD = 0;
1450 
1451  AliVertexerTracks *fVertexerTracks = new AliVertexerTracks(fBzkG);
1452 
1453  fVertexerTracks->SetVtxStart(fV1);
1454  vertexESD = (AliESDVertex*)fVertexerTracks->VertexForSelectedESDTracks(trkArray);
1455 
1456  delete fVertexerTracks; fVertexerTracks=NULL;
1457 
1458  if(!vertexESD) return vertexAOD;
1459 
1460  if(vertexESD->GetNContributors()!=trkArray->GetEntriesFast()) {
1461  //AliDebug(2,"vertexing failed");
1462  delete vertexESD; vertexESD=NULL;
1463  return vertexAOD;
1464  }
1465 
1466  Double_t vertRadius2=vertexESD->GetX()*vertexESD->GetX()+vertexESD->GetY()*vertexESD->GetY();
1467  if(vertRadius2>8.){
1468  // vertex outside beam pipe, reject candidate to avoid propagation through material
1469  delete vertexESD; vertexESD=NULL;
1470  return vertexAOD;
1471  }
1472 
1473 
1474  // convert to AliAODVertex
1475  Double_t pos[3],cov[6],chi2perNDF;
1476  vertexESD->GetXYZ(pos); // position
1477  vertexESD->GetCovMatrix(cov); //covariance matrix
1478  chi2perNDF = vertexESD->GetChi2toNDF();
1479  dispersion = vertexESD->GetDispersion();
1480  delete vertexESD; vertexESD=NULL;
1481 
1482  Int_t nprongs= (useTRefArray ? 0 : trkArray->GetEntriesFast());
1483  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
1484 
1485  return vertexAOD;
1486 }
1487 
1488 //________________________________________________________________________
1489 AliAODRecoCascadeHF3Prong* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::MakeCascadeHF3Prong(AliAODcascade *casc, AliAODTrack *part1, AliAODTrack *part2, AliAODEvent * aod, AliAODVertex *secVert, Double_t dispersion)
1490 {
1491  //
1492  // Make AliAODRecoCascadeHF3Prong object from the arguments
1493  //
1494 
1495  //------------------------------------------------
1496  // PrimaryVertex
1497  //------------------------------------------------
1498  AliAODVertex *primVertexAOD;
1499  Bool_t unsetvtx = kFALSE;
1501  primVertexAOD = CallPrimaryVertex(casc,part1,part2,aod);
1502  if(!primVertexAOD){
1503  primVertexAOD = fVtx1;
1504  }else{
1505  unsetvtx = kTRUE;
1506  }
1507  }else{
1508  primVertexAOD = fVtx1;
1509  }
1510  if(!primVertexAOD) return 0x0;
1511  Double_t pos[3]; primVertexAOD->GetXYZ(pos);
1512 
1513 
1514  //------------------------------------------------
1515  // DCA between tracks
1516  //------------------------------------------------
1517  AliESDtrack *esdtrack1 = new AliESDtrack((AliVTrack*)part1);
1518  AliESDtrack *esdtrack2 = new AliESDtrack((AliVTrack*)part2);
1519  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
1520  xyz[0]=casc->DecayVertexXiX();
1521  xyz[1]=casc->DecayVertexXiY();
1522  xyz[2]=casc->DecayVertexXiZ();
1523  pxpypz[0]=casc->MomXiX();
1524  pxpypz[1]=casc->MomXiY();
1525  pxpypz[2]=casc->MomXiZ();
1526  casc->GetCovarianceXYZPxPyPz(cv);
1527  sign=casc->ChargeXi();
1528  AliExternalTrackParam *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
1529 
1530  Double_t xdummy, ydummy;
1531  Double_t dcap1p2 = esdtrack1->GetDCA(esdtrack2,fBzkG,xdummy,ydummy);
1532  Double_t dcap1casc = esdtrack1->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
1533  Double_t dcap2casc = esdtrack2->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
1534  Double_t dca[3]={dcap1casc,dcap2casc,dcap1p2};
1535 
1536  //------------------------------------------------
1537  // Propagate all tracks to the secondary vertex and calculate momentum there
1538  //------------------------------------------------
1539 
1540  Double_t d0z0[2],covd0z0[3];
1541  Double_t secR = TMath::Sqrt(secVert->GetX()*secVert->GetX()+secVert->GetY()*secVert->GetY());
1542  if(secR<1.0){
1543  part1->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0,covd0z0);
1544  part2->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0,covd0z0);
1545  trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
1546  }else{
1547  part1->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
1548  part2->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
1549  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
1550  }
1551 
1552  Double_t momxi_new[3]={-9999,-9999,-9999.};
1553  trackCasc->GetPxPyPz(momxi_new);
1554 
1555  Double_t px[3],py[3],pz[3];
1556  px[0] = part1->Px(); py[0] = part1->Py(); pz[0] = part1->Pz();
1557  px[1] = momxi_new[0]; py[1] = momxi_new[1]; pz[1] = momxi_new[2];
1558  px[2] = part2->Px(); py[2] = part2->Py(); pz[2] = part2->Pz();
1559 
1560  //------------------------------------------------
1561  // d0
1562  //------------------------------------------------
1563  Double_t d0[3],d0err[3];
1564  part1->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
1565  d0[0]= d0z0[0];
1566  d0err[0] = TMath::Sqrt(covd0z0[0]);
1567 
1568  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
1569  d0[1]= d0z0[0];
1570  d0err[1] = TMath::Sqrt(covd0z0[0]);//Do not know what to use
1571 
1572  part2->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
1573  d0[2]= d0z0[0];
1574  d0err[2] = TMath::Sqrt(covd0z0[0]);
1575 
1576 
1577  //------------------------------------------------
1578  // Other stuff
1579  //------------------------------------------------
1580  Double_t dist12=0.0;//Vertex pi-casc not calculated
1581  Double_t dist23=0.0;//Vertex pi-casc not calculated
1582  Short_t charge=(Short_t)(part1->Charge()+trackCasc->Charge()+part2->Charge());
1583 
1584  //------------------------------------------------
1585  // Create AliAODRecoCascadeHF3Prong
1586  //------------------------------------------------
1587  AliAODRecoCascadeHF3Prong *theCascade = new AliAODRecoCascadeHF3Prong(secVert,charge,px,py,pz,d0,d0err,dca,dispersion,dist12,dist23);
1588  if(!theCascade)
1589  {
1590  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
1591  if(esdtrack1) delete esdtrack1;
1592  if(esdtrack2) delete esdtrack2;
1593  if(trackCasc) delete trackCasc;
1594  return 0x0;
1595  }
1596  theCascade->SetOwnPrimaryVtx(primVertexAOD);
1597  UShort_t id[3]={(UShort_t)part1->GetID(),(UShort_t)trackCasc->GetID(),(UShort_t)part2->GetID()};
1598  theCascade->SetProngIDs(3,id);
1599 
1600  theCascade->GetSecondaryVtx()->AddDaughter(part1);
1601  theCascade->GetSecondaryVtx()->AddDaughter(casc);
1602  theCascade->GetSecondaryVtx()->AddDaughter(part2);
1603 
1604  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
1605  if(esdtrack1) delete esdtrack1;
1606  if(esdtrack2) delete esdtrack2;
1607  if(trackCasc) delete trackCasc;
1608 
1609  return theCascade;
1610 }
Int_t charge
Double_t InvMassPiXiPi() const
Xic invariant mass.
AliAODTrack * GetBachelor2() const
double Double_t
Definition: External.C:58
Bool_t SingleCascadeCutsRef(AliAODcascade *casc, Double_t *vert)
AliAODVertex * PrimaryVertex(const TObjArray *trkArray, AliVEvent *event)
void SelectTrack(const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks, Bool_t *seleFlags)
Definition: External.C:236
Bool_t GetUseCombined()
Definition: AliAODPidHF.h:165
char Char_t
Definition: External.C:18
AliAODVertex * CallReconstructSecondaryVertex(AliAODTrack *trk1, AliAODTrack *trk2, Double_t &disp)
TList * fOutputAll
! User output slot 3 // Analysis histos
void SelectCascade(const AliVEvent *event, Int_t nCascades, Int_t &nSeleCasc, Bool_t *seleCascFlags)
AliAODcascade * GetCascade() const
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:271
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:261
Bool_t fIsMB
Reconstruct primary vertex excluding candidate tracks.
AliAODVertex * ReconstructSecondaryVertex(TObjArray *trkArray, Double_t &dispersion, Bool_t useTRefArray=kTRUE)
virtual void UserCreateOutputObjects()
Implementation of interface methods.
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
void FillROOTObjects(AliAODRecoCascadeHF3Prong *xicobj, AliAODMCParticle *mcpart, AliAODMCParticle *mcdau1, AliAODMCParticle *mcdau2, AliAODMCParticle *mcdauxi, Int_t mcnused, Bool_t isXiC)
AliAODTrack * GetBachelor1() const
AliAODVertex * GetOwnPrimaryVtx() const
AliAODVertex * CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent *evt)
void SetProngIDs(Int_t nIDs, UShort_t *id)
TH1F * fHistoCascDcaPosToPrimVertex
! DCA of positive track to primary vertex
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
void GetDCAs(Double_t dca[3]) const
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)
short Short_t
Definition: External.C:23
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Double_t DecayLengthXY() const
TH1F * fHistoCascDcaBachToPrimVertex
! DCA of bachelor track to primary vertex
AliAODRecoCascadeHF3Prong * MakeCascadeHF3Prong(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent *aod, AliAODVertex *secvert, Double_t dispersion)
Bool_t SingleCascadeCuts(AliAODcascade *casc, Double_t *vert)
AliRDHFCutsXicPlustoXiPiPifromAODtracks * fAnalCuts
histogram to check centrality
Bool_t IsEventSelected(AliVEvent *event)
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabscasc, Int_t *pdgDg, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
TH1F * fHistoCascCosPAXiPrim
! Cosine pointing angle of Xi to primary vertex
unsigned short UShort_t
Definition: External.C:28
Bool_t SelectWithRoughCuts(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2)
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:284
const char Option_t
Definition: External.C:48
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:333
bool Bool_t
Definition: External.C:53
TH1F * fHistoCascDcaNegToPrimVertex
! DCA of negative track to primary vertex
Double_t DecayLength() const
TTree * fVariablesTree
flag to decide whether to write the candidate variables on a tree variables