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