X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliCascadeFindVertices.C;h=6639df8739a8d2d84ccc8214045634b53bd113fd;hb=bf27d64a0f4d49bc005c0fc4ad812e1f92578c67;hp=1b8e88b914f34c3ed11e30888aee2167b2e76c29;hpb=566abf7587803a3484678fc81c53b3c68e32106d;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliCascadeFindVertices.C b/ITS/AliCascadeFindVertices.C index 1b8e88b914f..6639df8739a 100644 --- a/ITS/AliCascadeFindVertices.C +++ b/ITS/AliCascadeFindVertices.C @@ -2,18 +2,20 @@ #include #include "AliCascadeVertexer.h" #include "TFile.h" + #include "TKey.h" #include "TStopwatch.h" #include "AliRun.h" + #include "AliESD.h" + #include "AliTracker.h" #include "AliRunLoader.h" - #include "AliITSLoader.h" #endif Int_t AliCascadeFindVertices(Int_t nev=5) { cerr<<"Looking for cascade vertices...\n"; if (gAlice) { - delete gAlice->GetRunLoader(); + delete AliRunLoader::Instance(); delete gAlice; gAlice=0; } @@ -22,54 +24,66 @@ Int_t AliCascadeFindVertices(Int_t nev=5) { cerr<<"AliCascadeFindVertices.C : Can not open session RL=NULL"<< endl; return 1; } - AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); - if (itsl == 0x0) { - cerr<<"AliCascadeFindVertices.C : Can not get ITS loader"<LoadgAlice()) { + cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<LoadTracks("read"); - itsl->LoadV0s("read"); - itsl->LoadCascades("recreate"); + // Magnetic field + AliTracker::SetFieldMap(gAlice->Field(),1); // 1 means uniform magnetic field Double_t cuts[]={33., // max. allowed chi2 0.05, // min. allowed V0 impact parameter 0.008, // window around the Lambda mass 0.035, // min. allowed bachelor's impact parameter 0.10, // max. allowed DCA between a V0 and a track - 0.9985, // max. allowed cosine of the cascade pointing angle + 0.9985,// max. allowed cosine of the cascade pointing angle 0.9, // min. radius of the fiducial volume 2.9 // max. radius of the fiducial volume }; TStopwatch timer; AliCascadeVertexer *vertexer=new AliCascadeVertexer(cuts); + Int_t rc=0; if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); - for (Int_t i=0; iGetEvent(i); - TTree *tTree=itsl->TreeT(); - if (!tTree) { - cerr<<"AliCascadeFindVertices.C : Can't get the ITS track tree !"<TreeV0(); - if (!vTree) { - cerr<<"AliCascadeFindVertices.C : Can't get the V0 tree !"<TreeX(); - if (!xTree) { - itsl->MakeTree("X"); - xTree=itsl->TreeX(); - } + TFile *casf=TFile::Open("AliESDcas.root","RECREATE"); + if ((!casf)||(!casf->IsOpen())) { + cerr<<"Can't AliESDcas.root !\n"; return 1; + } + TFile *v0f=TFile::Open("AliESDv0.root"); + if ((!v0f)||(!v0f->IsOpen())) { + cerr<<"Can't AliESDv0.root !\n"; return 1; + } + + TKey *key=0; + TIter next(v0f->GetListOfKeys()); + for (Int_t i=0; icd(); + if ((key=(TKey*)next())==0) break; + cerr<<"Processing event number: "<ReadObj(); - rc=vertexer->V0sTracks2CascadeVertices(vTree,tTree,xTree); + rc=vertexer->V0sTracks2CascadeVertices(event); - itsl->WriteCascades("OVERWRITE"); + if (rc==0) { + Char_t ename[100]; + sprintf(ename,"%d",i); + casf->cd(); + if (!event->Write(ename)) rc++; + } + if (rc) { + cerr<<"Something bad happened...\n"; + } + delete event; } delete vertexer; timer.Stop(); timer.Print(); + v0f->Close(); + casf->Close(); + delete rl; return rc;