]>
Commit | Line | Data |
---|---|---|
566abf75 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
ddae8318 | 2 | #include <Riostream.h> |
ca28c5f5 | 3 | #include "AliCascadeVertexer.h" |
4 | #include "TFile.h" | |
a62f4fcc | 5 | #include "TKey.h" |
ca28c5f5 | 6 | #include "TStopwatch.h" |
566abf75 | 7 | |
8 | #include "AliRun.h" | |
a62f4fcc | 9 | #include "AliESD.h" |
c84a5e9e | 10 | #include "AliTracker.h" |
566abf75 | 11 | #include "AliRunLoader.h" |
ca28c5f5 | 12 | #endif |
13 | ||
566abf75 | 14 | Int_t AliCascadeFindVertices(Int_t nev=5) { |
ca28c5f5 | 15 | cerr<<"Looking for cascade vertices...\n"; |
16 | ||
566abf75 | 17 | if (gAlice) { |
33c3c91a | 18 | delete AliRunLoader::Instance(); |
566abf75 | 19 | delete gAlice; |
20 | gAlice=0; | |
ca28c5f5 | 21 | } |
566abf75 | 22 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); |
23 | if (rl == 0x0) { | |
24 | cerr<<"AliCascadeFindVertices.C : Can not open session RL=NULL"<< endl; | |
25 | return 1; | |
ca28c5f5 | 26 | } |
a62f4fcc | 27 | |
28 | if (rl->LoadgAlice()) { | |
29 | cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<<endl; | |
30 | delete rl; | |
31 | return 3; | |
566abf75 | 32 | } |
566abf75 | 33 | |
c84a5e9e | 34 | // Magnetic field |
35 | AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field | |
04b2a5f1 | 36 | Double_t cuts[]={33., // max. allowed chi2 |
37 | 0.05, // min. allowed V0 impact parameter | |
38 | 0.008, // window around the Lambda mass | |
39 | 0.035, // min. allowed bachelor's impact parameter | |
40 | 0.10, // max. allowed DCA between a V0 and a track | |
a62f4fcc | 41 | 0.9985,// max. allowed cosine of the cascade pointing angle |
04b2a5f1 | 42 | 0.9, // min. radius of the fiducial volume |
43 | 2.9 // max. radius of the fiducial volume | |
ca28c5f5 | 44 | }; |
45 | TStopwatch timer; | |
46 | AliCascadeVertexer *vertexer=new AliCascadeVertexer(cuts); | |
a62f4fcc | 47 | |
566abf75 | 48 | Int_t rc=0; |
49 | if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); | |
566abf75 | 50 | |
a62f4fcc | 51 | TFile *casf=TFile::Open("AliESDcas.root","RECREATE"); |
52 | if ((!casf)||(!casf->IsOpen())) { | |
53 | cerr<<"Can't AliESDcas.root !\n"; return 1; | |
54 | } | |
55 | TFile *v0f=TFile::Open("AliESDv0.root"); | |
56 | if ((!v0f)||(!v0f->IsOpen())) { | |
57 | cerr<<"Can't AliESDv0.root !\n"; return 1; | |
58 | } | |
59 | ||
60 | TKey *key=0; | |
61 | TIter next(v0f->GetListOfKeys()); | |
62 | for (Int_t i=0; i<nev; i++) { | |
63 | v0f->cd(); | |
64 | if ((key=(TKey*)next())==0) break; | |
65 | cerr<<"Processing event number: "<<i<<endl; | |
66 | AliESD *event=(AliESD*)key->ReadObj(); | |
566abf75 | 67 | |
a62f4fcc | 68 | rc=vertexer->V0sTracks2CascadeVertices(event); |
566abf75 | 69 | |
a62f4fcc | 70 | if (rc==0) { |
71 | Char_t ename[100]; | |
72 | sprintf(ename,"%d",i); | |
73 | casf->cd(); | |
74 | if (!event->Write(ename)) rc++; | |
75 | } | |
76 | if (rc) { | |
77 | cerr<<"Something bad happened...\n"; | |
78 | } | |
79 | delete event; | |
566abf75 | 80 | } |
ca28c5f5 | 81 | delete vertexer; |
82 | timer.Stop(); timer.Print(); | |
83 | ||
a62f4fcc | 84 | v0f->Close(); |
85 | casf->Close(); | |
86 | ||
566abf75 | 87 | delete rl; |
ca28c5f5 | 88 | |
89 | return rc; | |
90 | } |