1 /****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
5 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include "AliV0vertexer.h"
10 #include "TStopwatch.h"
13 #include "AliTracker.h"
16 #include "AliRunLoader.h"
19 extern AliRun *gAlice;
21 Int_t AliV0FindVertices(Int_t nev=5) {
22 cerr<<"Looking for V0 vertices...\n";
25 delete gAlice->GetRunLoader();
30 AliRunLoader* rl = AliRunLoader::Open("galice.root");
32 cerr<<"AliV0FindVertices.C : Can not open session RL=NULL"<< endl;
36 if (rl->LoadgAlice()) {
37 cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<<endl;
43 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
45 Double_t cuts[]={33, // max. allowed chi2
46 0.16,// min. allowed negative daughter's impact parameter
47 0.05,// min. allowed positive daughter's impact parameter
48 0.080,// max. allowed DCA between the daughter tracks
49 0.998,// max. allowed cosine of V0's pointing angle
50 0.9, // min. radius of the fiducial volume
51 2.9 // max. radius of the fiducial volume
54 AliV0vertexer vtxer(cuts);
56 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
58 TFile *v0f=TFile::Open("AliESDv0.root","RECREATE");
59 if ((!v0f)||(!v0f->IsOpen())) {
60 cerr<<"Can't AliESDv0.root !\n"; return 1;
62 TFile *itsf=TFile::Open("AliESDits.root");
63 if ((!itsf)||(!itsf->IsOpen())) {
64 cerr<<"Can't AliESDits.root !\n"; return 1;
67 TIter next(itsf->GetListOfKeys());
68 for (Int_t i=0; i<nev; i++) {
70 if ((key=(TKey*)next())==0) break;
71 cerr<<"Processing event number: "<<i<<endl;
72 AliESD *event=(AliESD*)key->ReadObj();
74 //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm)
76 rc=vtxer.Tracks2V0vertices(event);
80 sprintf(ename,"%d",i);
82 if (!event->Write(ename)) rc++;
85 cerr<<"Something bad happened...\n";
89 timer.Stop(); timer.Print();