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