]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliCascadeFindVertices.C
set reco param on an event by event basis
[u/mrichter/AliRoot.git] / ITS / AliCascadeFindVertices.C
... / ...
CommitLineData
1#if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <Riostream.h>
3 #include "AliCascadeVertexer.h"
4 #include "TFile.h"
5 #include "TKey.h"
6 #include "TStopwatch.h"
7
8 #include "AliRun.h"
9 #include "AliESD.h"
10 #include "AliTracker.h"
11 #include "AliRunLoader.h"
12#endif
13
14Int_t AliCascadeFindVertices(Int_t nev=5) {
15 cerr<<"Looking for cascade vertices...\n";
16
17 if (gAlice) {
18 delete AliRunLoader::Instance();
19 delete gAlice;
20 gAlice=0;
21 }
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;
26 }
27
28 if (rl->LoadgAlice()) {
29 cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<<endl;
30 delete rl;
31 return 3;
32 }
33
34 // Magnetic field
35 AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field
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
41 0.9985,// max. allowed cosine of the cascade pointing angle
42 0.9, // min. radius of the fiducial volume
43 2.9 // max. radius of the fiducial volume
44 };
45 TStopwatch timer;
46 AliCascadeVertexer *vertexer=new AliCascadeVertexer(cuts);
47
48 Int_t rc=0;
49 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
50
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();
67
68 rc=vertexer->V0sTracks2CascadeVertices(event);
69
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;
80 }
81 delete vertexer;
82 timer.Stop(); timer.Print();
83
84 v0f->Close();
85 casf->Close();
86
87 delete rl;
88
89 return rc;
90}