]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliV0FindVertices.C
Revert one change (Sun,Alpha)
[u/mrichter/AliRoot.git] / ITS / AliV0FindVertices.C
... / ...
CommitLineData
1/****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
4
5#if !defined(__CINT__) || defined(__MAKECINT__)
6 #include "Riostream.h"
7 #include "AliV0vertexer.h"
8 #include "TFile.h"
9 #include "TKey.h"
10 #include "TStopwatch.h"
11
12 #include "AliRun.h"
13 #include "AliKalmanTrack.h"
14 #include "AliMagF.h"
15 #include "AliESD.h"
16 #include "AliRunLoader.h"
17#endif
18
19extern AliRun *gAlice;
20
21Int_t AliV0FindVertices(Int_t nev=5) {
22 cerr<<"Looking for V0 vertices...\n";
23
24 if (gAlice) {
25 delete gAlice->GetRunLoader();
26 delete gAlice;
27 gAlice=0;
28 }
29
30 AliRunLoader* rl = AliRunLoader::Open("galice.root");
31 if (rl == 0x0) {
32 cerr<<"AliV0FindVertices.C : Can not open session RL=NULL"<< endl;
33 return 1;
34 }
35
36 if (rl->LoadgAlice()) {
37 cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<<endl;
38 delete rl;
39 return 3;
40 }
41
42 AliKalmanTrack::SetConvConst(
43 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()
44 );
45
46 Double_t cuts[]={33, // max. allowed chi2
47 0.16,// min. allowed negative daughter's impact parameter
48 0.05,// min. allowed positive daughter's impact parameter
49 0.080,// max. allowed DCA between the daughter tracks
50 0.998,// max. allowed cosine of V0's pointing angle
51 0.9, // min. radius of the fiducial volume
52 2.9 // max. radius of the fiducial volume
53 };
54 TStopwatch timer;
55 AliV0vertexer vtxer(cuts);
56 Int_t rc=0;
57 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
58
59 TFile *v0f=TFile::Open("AliESDv0.root","RECREATE");
60 if ((!v0f)||(!v0f->IsOpen())) {
61 cerr<<"Can't AliESDv0.root !\n"; return 1;
62 }
63 TFile *itsf=TFile::Open("AliESDits.root");
64 if ((!itsf)||(!itsf->IsOpen())) {
65 cerr<<"Can't AliESDits.root !\n"; return 1;
66 }
67 TKey *key=0;
68 TIter next(itsf->GetListOfKeys());
69 for (Int_t i=0; i<nev; i++) {
70 itsf->cd();
71 if ((key=(TKey*)next())==0) break;
72 cerr<<"Processing event number: "<<i<<endl;
73 AliESD *event=(AliESD*)key->ReadObj();
74
75 //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm)
76
77 rc=vtxer.Tracks2V0vertices(event);
78
79 if (rc==0) {
80 Char_t ename[100];
81 sprintf(ename,"%d",i);
82 v0f->cd();
83 if (!event->Write(ename)) rc++;
84 }
85 if (rc) {
86 cerr<<"Something bad happened...\n";
87 }
88 delete event;
89 }
90 timer.Stop(); timer.Print();
91
92 itsf->Close();
93 v0f->Close();
94
95 delete rl;
96
97 return rc;
98}