+
+ Int_t rc=0;
+ if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
+
+ 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; i<nev; i++) {
+ v0f->cd();
+ if ((key=(TKey*)next())==0) break;
+ cerr<<"Processing event number: "<<i<<endl;
+ AliESD *event=(AliESD*)key->ReadObj();
+
+ rc=vertexer->V0sTracks2CascadeVertices(event);
+
+ 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;
+ }