]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/AliKFParticleTest.C
Added protection agains null primary vertex pointer
[u/mrichter/AliRoot.git] / PWG1 / AliKFParticleTest.C
CommitLineData
6602e329 1
2//---------------------------------------------------------------------------------
3// The example of usage of AliKFParticle & AliKFVertex classes for V0 analysis
4// .
5// @author S.Gorbunov, I.Kisel
6// @version 1.0
7// @since 13.05.07
8//
9// The AliKFParticleTest macro contains a toy V0 finder for ESD tracks.
10// At the first step, event primary vertex is reconstructed.
11// At the second step, ideal PID hypothesis are assigned to all the particles.
12// At the third step, V0 candidates are constructed for each pair
13// of positive and negative particles.
14// V0 candidate considered as good when it passes Chi^2 cut and
15// it is placed >= 3 Sigma away from the primary vertex.
16// Invariant mass distribution for all good V0 candidates is plotted.
17//
18// -= Copyright &copy ALICE HLT Group =-
19//_________________________________________________________________________________
20
21
22void AliKFParticleTest(const char *dirname="/d/alice09/sma/v4-05-Rev-03/charmwmi/", Int_t limit = 100)
23{
24 UInt_t startsample = 1000;
25 cout <<"Using events : "<<dirname<<endl;
26
27 gSystem->AddIncludePath("-I\"$ALICE_ROOT/include\"");
28 gSystem->Load("libANALYSIS.so");
29 gSystem->Load("libANALYSISRL.so");
30 gROOT->LoadMacro("$ALICE_ROOT/STEER/AliKFParticleTest.h+");
31
32 //
33 // Setup chain
34 //
35 UInt_t nFile = 0;
36 UInt_t iFile = startsample-1;
37 TChain *chain = new TChain("esdTree");
38
39 while (nFile < limit)
40 {
41 iFile++;
42 TString pathFile (Form("%s%3.3d/AliESDs.root", dirname, iFile));
43 TFile * file = TFile::Open (pathFile.Data());
44 if (file == 0x0)continue;
45
46 cout<<"File "<<pathFile.Data()<<endl;
47
48 if (file->IsZombie ()){
49 cout<<"File "<<pathFile.Data()<<" is zombie"<<endl;
50 file->Close();
51 continue;
52 }
53
54 file->Close();
55 chain->Add (pathFile.Data());
56 nFile++;
57 }
58 cout << "Number of files : "<<nFile<<endl;
59
60
61 AliAnalysisManager *mgr = new AliAnalysisManager("testEvent");
62
63 AliAnalysisTask *task = new AliKFParticleTest("AliKFParticleTest");
64
65 // Create containers for input/output
66 AliAnalysisDataContainer *cinput = mgr->CreateContainer("input0", TChain::Class(), AliAnalysisManager::kInputContainer);
67
68 // Connect containers to the task input/outputs
69
70 cout << "Adding task " << task->GetName() << endl;
71
72 mgr->ConnectInput(task, 0, cinput);
73
74 AliAnalysisDataContainer *coutput =
75 mgr->CreateContainer("output0", TObjArray::Class(), AliAnalysisManager::kOutputContainer,Form("%s.root",task->GetName()));
76 mgr->ConnectOutput(task,0,coutput);
77
78 // Init analysis and start event loop
79 if (mgr->InitAnalysis()) {
80 mgr->PrintStatus();
81 mgr->StartAnalysis("local",chain);
82 }
83 delete mgr;
84}