]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliV0FindVertices.C
Removed warnings
[u/mrichter/AliRoot.git] / ITS / AliV0FindVertices.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2   #include "Riostream.h"
3   #include "AliV0vertexer.h"
4   #include "TFile.h"
5   #include "TStopwatch.h"
6
7   #include "AliRun.h"
8   #include "AliRunLoader.h"
9   #include "AliITSLoader.h"
10 #endif
11
12 extern AliRun *gAlice;
13
14 Int_t AliV0FindVertices(Int_t nev=5) {
15    cerr<<"Looking for V0 vertices...\n";
16
17    if (gAlice) {
18       delete gAlice->GetRunLoader();
19       delete gAlice; 
20       gAlice=0;
21    } 
22    AliRunLoader* rl = AliRunLoader::Open("galice.root");
23    if (rl == 0x0) {
24       cerr<<"AliV0FindVertices.C : Can not open session RL=NULL"<< endl;
25       return 1;
26    }
27    AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
28    if (itsl == 0x0) {
29       cerr<<"AliV0FindVertices.C : Can not get ITS loader"<<endl;
30       return 2;
31    }
32    itsl->LoadTracks("read");
33    itsl->LoadV0s("recreate");
34
35    Double_t cuts[]={33,  // max. allowed chi2
36                     0.16,// min. allowed negative daughter's impact parameter 
37                     0.05,// min. allowed positive daughter's impact parameter 
38                     0.080,// max. allowed DCA between the daughter tracks
39                     0.998,// max. allowed cosine of V0's pointing angle
40                     0.9,  // min. radius of the fiducial volume
41                     2.9   // max. radius of the fiducial volume
42                    };
43    TStopwatch timer;
44    AliV0vertexer vtxer(cuts);
45    Int_t rc=0;
46    if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
47    for (Int_t i=0; i<nev; i++) {
48      rl->GetEvent(i);
49      //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm)
50
51      TTree *tTree=itsl->TreeT();
52      if (!tTree) {
53         cerr<<"AliV0FindVertices.C : Can't get the ITS track tree !"<<endl;
54         return 3;
55      }
56      TTree *vTree=itsl->TreeV0();
57      if (!vTree) {
58         itsl->MakeTree("V0");
59         vTree=itsl->TreeV0();
60      }
61
62      rc=vtxer.Tracks2V0vertices(tTree,vTree);
63
64      itsl->WriteV0s("OVERWRITE");
65    }
66    timer.Stop(); timer.Print();
67     
68    delete rl;
69
70    return rc;
71 }