]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliCascadeFindVertices.C
Removed some dead code.
[u/mrichter/AliRoot.git] / ITS / AliCascadeFindVertices.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2   #include <Riostream.h>
3   #include "AliCascadeVertexer.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 Int_t AliCascadeFindVertices(Int_t nev=5) {
13    cerr<<"Looking for cascade vertices...\n";
14
15    if (gAlice) {
16       delete gAlice->GetRunLoader();
17       delete gAlice;
18       gAlice=0;
19    }
20    AliRunLoader* rl = AliRunLoader::Open("galice.root");
21    if (rl == 0x0) {
22       cerr<<"AliCascadeFindVertices.C : Can not open session RL=NULL"<< endl;
23       return 1;
24    }
25    AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
26    if (itsl == 0x0) {
27       cerr<<"AliCascadeFindVertices.C : Can not get ITS loader"<<endl;
28       return 2;
29    }
30    itsl->LoadTracks("read");
31    itsl->LoadV0s("read");
32    itsl->LoadCascades("recreate");
33
34    Double_t cuts[]={33.,    // max. allowed chi2
35                     0.05,   // min. allowed V0 impact parameter 
36                     0.008,  // window around the Lambda mass 
37                     0.035,  // min. allowed bachelor's impact parameter 
38                     0.10,   // max. allowed DCA between a V0 and a track
39                     0.9985, // max. allowed cosine of the cascade 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    AliCascadeVertexer *vertexer=new AliCascadeVertexer(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
50      TTree *tTree=itsl->TreeT();
51      if (!tTree) {
52        cerr<<"AliCascadeFindVertices.C : Can't get the ITS track tree !"<<endl;
53        return 3;
54      }
55      TTree *vTree=itsl->TreeV0();
56      if (!vTree) {
57        cerr<<"AliCascadeFindVertices.C : Can't get the V0 tree !"<<endl;
58        return 4;
59      }
60      TTree *xTree=itsl->TreeX();
61      if (!xTree) {
62         itsl->MakeTree("X");
63         xTree=itsl->TreeX();
64      }
65
66      rc=vertexer->V0sTracks2CascadeVertices(vTree,tTree,xTree);
67
68      itsl->WriteCascades("OVERWRITE");
69    }
70    delete vertexer;
71    timer.Stop(); timer.Print();
72     
73    delete rl;
74
75    return rc;
76 }