]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliV0FindVertices.C
Compiler Warning removed
[u/mrichter/AliRoot.git] / ITS / AliV0FindVertices.C
CommitLineData
a62f4fcc 1/****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
4
566abf75 5#if !defined(__CINT__) || defined(__MAKECINT__)
548b1270 6 #include "Riostream.h"
ca28c5f5 7 #include "AliV0vertexer.h"
8 #include "TFile.h"
a62f4fcc 9 #include "TKey.h"
ca28c5f5 10 #include "TStopwatch.h"
566abf75 11
12 #include "AliRun.h"
a62f4fcc 13 #include "AliKalmanTrack.h"
14 #include "AliMagF.h"
15 #include "AliESD.h"
566abf75 16 #include "AliRunLoader.h"
ca28c5f5 17#endif
18
566abf75 19extern AliRun *gAlice;
ca28c5f5 20
566abf75 21Int_t AliV0FindVertices(Int_t nev=5) {
22 cerr<<"Looking for V0 vertices...\n";
ca28c5f5 23
566abf75 24 if (gAlice) {
25 delete gAlice->GetRunLoader();
26 delete gAlice;
27 gAlice=0;
28 }
a62f4fcc 29
566abf75 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 }
a62f4fcc 35
36 if (rl->LoadgAlice()) {
37 cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<<endl;
38 delete rl;
39 return 3;
566abf75 40 }
ca28c5f5 41
a62f4fcc 42 AliKalmanTrack::SetConvConst(
43 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField()
44 );
45
ca28c5f5 46 Double_t cuts[]={33, // max. allowed chi2
04b2a5f1 47 0.16,// min. allowed negative daughter's impact parameter
48 0.05,// min. allowed positive daughter's impact parameter
ca28c5f5 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;
5d390eda 55 AliV0vertexer vtxer(cuts);
56 Int_t rc=0;
566abf75 57 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
a62f4fcc 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());
5d390eda 69 for (Int_t i=0; i<nev; i++) {
a62f4fcc 70 itsf->cd();
71 if ((key=(TKey*)next())==0) break;
72 cerr<<"Processing event number: "<<i<<endl;
73 AliESD *event=(AliESD*)key->ReadObj();
566abf75 74
a62f4fcc 75 //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm)
566abf75 76
a62f4fcc 77 rc=vtxer.Tracks2V0vertices(event);
566abf75 78
a62f4fcc 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;
5d390eda 89 }
ca28c5f5 90 timer.Stop(); timer.Print();
91
a62f4fcc 92 itsf->Close();
93 v0f->Close();
94
566abf75 95 delete rl;
ca28c5f5 96
97 return rc;
98}