Removing PWG3TrackExtrapInterface from PWG3base library (Gines)
[u/mrichter/AliRoot.git] / PWG3 / AliAnalysisVertexingHFTest.C
1 //--------------------------------------------------------------------------
2 // Test macro for reconstruction of heavy-flavour vertexing candidates
3 //
4 //     Andrea Dainese, andrea.dainese@lnl.infn.it
5 //--------------------------------------------------------------------------
6
7 void AliAnalysisVertexingHFTest(Int_t evFirst=0,
8                                 Int_t evLast=99,
9                                 TString infile="AliESDs.root",
10                                 TString outfile="VertexingHF.root") {
11   
12   gSystem->Load("libAOD.so");
13   gSystem->Load("libPWG3base.so");
14
15   AliAnalysisVertexingHF *vHF = new AliAnalysisVertexingHF();
16   //--- switch-off candidates finding (default: all on)
17   //vHF->SetD0toKpiOff();
18   //vHF->SetJPSItoEleOff();
19   //vHF->Set3ProngOff();
20   //vHF->Set4ProngOff();
21   //--- set cuts for single-track selection
22   vHF->SetITSrefitRequired();
23   vHF->SetBothSPDNotRequired();
24   vHF->SetMinITSCls(5);
25   vHF->SetMinPtCut(0.);
26   vHF->SetMind0Cut(0.);
27   //--- set cuts for candidates selection
28   //vHF->SetD0toKpiCuts(); 
29   //vHF->SetBtoJPSICuts(); 
30   //vHF->SetDplusCuts(); 
31   //--- set this if you want to reconstruct primary vertex candidate by
32   //    candidate using other tracks in the event (for pp, broad 
33   //    interaction region)
34   //vHF->SetRecoPrimVtxSkippingTrks();
35   //--- OR set this if you want to remove the candidate daughters from 
36   //    the primary vertex, without recostructing it from scratch
37   //vHF->SetRmTrksFromPrimVtx();
38
39   //--- check the settings
40   vHF->PrintStatus();
41   //--- verbose
42   vHF->SetDebug(1);
43
44   TTree *trees = new TTree[4];
45   AliAODRecoDecayHF2Prong *rd2=0;
46   AliAODRecoDecayHF3Prong *rd3=0;
47   AliAODRecoDecayHF4Prong *rd4=0;
48   trees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
49   trees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
50   trees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
51   trees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
52
53   TFile *inesd = new TFile(infile.Data());
54   AliESDEvent *esd = new AliESDEvent();
55   TTree *esdTree = (TTree*)inesd->Get("esdTree");
56   esd->ReadFromTree(esdTree);
57
58   if(esdTree->GetEntries()<evLast) evLast=esdTree->GetEntries()-1;
59   for(Int_t i=evFirst; i<=evLast; i++) {
60     esdTree->GetEvent(i);
61     vHF->FindCandidates(esd,trees);
62     //if(i==evLast) i=evFirst;
63   }
64
65   delete esdTree;
66   inesd->Close();
67   delete inesd;
68
69   // Write trees with candidates
70   TFile *fout = new TFile("AliAnalysisVertexingHF.root","recreate");
71   trees[0].Write("TreeD0toKpi");
72   trees[1].Write("TreeJPSItoEle");
73   trees[2].Write("TreeCharm3Prong");
74   trees[3].Write("TreeD0to4Prong");
75   fout->Close();
76   delete fout;
77
78   return;
79 }