From a62f4fcce2f7ff82d5b2096f9ac6e43ccf551653 Mon Sep 17 00:00:00 2001 From: hristov Date: Fri, 21 Nov 2003 08:00:26 +0000 Subject: [PATCH] Tests and example macros working with ESD (Yu.Belikov) --- ITS/AliCascadeFindVertices.C | 73 +++++++++++++++++++++------------- ITS/AliITSFindTracksV2.C | 77 ++++++++++++++++++++---------------- ITS/AliITStestV2.C | 2 +- ITS/AliV0FindVertices.C | 69 ++++++++++++++++++++++---------- TPC/AliTPCFindTracks.C | 36 +++++++++++------ 5 files changed, 161 insertions(+), 96 deletions(-) diff --git a/ITS/AliCascadeFindVertices.C b/ITS/AliCascadeFindVertices.C index 1b8e88b914f..b85e761a9e5 100644 --- a/ITS/AliCascadeFindVertices.C +++ b/ITS/AliCascadeFindVertices.C @@ -2,11 +2,14 @@ #include #include "AliCascadeVertexer.h" #include "TFile.h" + #include "TKey.h" #include "TStopwatch.h" #include "AliRun.h" + #include "AliMagF.h" + #include "AliESD.h" + #include "AliKalmanTrack.h" #include "AliRunLoader.h" - #include "AliITSLoader.h" #endif Int_t AliCascadeFindVertices(Int_t nev=5) { @@ -22,54 +25,68 @@ 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"); + AliKalmanTrack::SetConvConst( + 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField() + ); + 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; diff --git a/ITS/AliITSFindTracksV2.C b/ITS/AliITSFindTracksV2.C index 6fc08504ef5..43d3d7dca3a 100644 --- a/ITS/AliITSFindTracksV2.C +++ b/ITS/AliITSFindTracksV2.C @@ -4,16 +4,18 @@ #if !defined(__CINT__) || defined(__MAKECINT__) #include "Riostream.h" - + #include "TKey.h" #include "TStopwatch.h" #include "AliRun.h" + #include "AliMagF.h" #include "AliRunLoader.h" #include "AliTPCLoader.h" #include "AliITSLoader.h" #include "AliITS.h" #include "AliITSgeom.h" #include "AliITStrackerV2.h" + #include "AliESD.h" #endif extern AliRun *gAlice; @@ -33,33 +35,23 @@ Int_t AliITSFindTracksV2(Int_t nev=5) { //number of events to process return 3; } - Int_t retval = rl->LoadgAlice(); - if (retval) { - cerr<<"AliITSFindTracksV2.C : LoadgAlice returned error"<LoadHeader(); - if (retval) { - cerr<<"AliITSFindTracksV2.C : LoadHeader returned error"<GetAliRun(); - AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); if (itsl == 0x0) { cerr<<"AliITSFindTracksV2.C : Can not get ITS loader"<GetLoader("TPCLoader"); - if (tpcl == 0x0) { - cerr<<"AliITSFindTracksV2.C : can not get TPC loader"<LoadgAlice()) { + cerr<<"AliITSFindTracksV2.C : LoadgAlice returned error"<GetDetector("ITS"); + AliKalmanTrack::SetConvConst( + 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField() + ); + + AliITS *dITS = (AliITS*)rl->GetAliRun()->GetDetector("ITS"); if (!dITS) { cerr<<"AliITSFindClusters.C : Can not find the ITS detector !"<LoadTracks("read"); - itsl->LoadTracks("recreate"); itsl->LoadRecPoints("read"); - TStopwatch timer; if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); Int_t rc=0; + + TFile *itsf=TFile::Open("AliESDits.root","RECREATE"); + if ((!itsf)||(!itsf->IsOpen())) { + cerr<<"Can't AliESDits.root !\n"; return 1; + } + TFile *tpcf=TFile::Open("AliESDtpc.root"); + if ((!tpcf)||(!tpcf->IsOpen())) { + cerr<<"Can't AliESDtpc.root !\n"; return 1; + } + TKey *key=0; + TIter next(tpcf->GetListOfKeys()); + TStopwatch timer; for (Int_t i=0; icd(); + if ((key=(TKey*)next())==0) break; cerr<<"Processing event number: "<ReadObj(); + rl->GetEvent(i); TTree *cTree=itsl->TreeR(); @@ -84,25 +89,27 @@ Int_t AliITSFindTracksV2(Int_t nev=5) { //number of events to process cerr<<"AliITSFindTracksV2.C : Can't get the clusters tree !"<TreeT(); - if (!tpcTree) { - cerr<<"AliITSFindTracksV2.C : Can't get the TPC track tree !"<TreeT(); - if (!itsTree) { - itsl->MakeTree("T"); - itsTree=itsl->TreeT(); - } tracker.LoadClusters(cTree); - rc=tracker.Clusters2Tracks(tpcTree,itsTree); + rc=tracker.Clusters2Tracks(event); tracker.UnloadClusters(); - itsl->WriteTracks("OVERWRITE"); + if (rc==0) { + Char_t ename[100]; + sprintf(ename,"%d",i); + itsf->cd(); + if (!event->Write(ename)) rc++; + } + if (rc) { + cerr<<"Something bad happened...\n"; + } + delete event; } timer.Stop(); timer.Print(); + tpcf->Close(); + itsf->Close(); + delete rl; return rc; diff --git a/ITS/AliITStestV2.C b/ITS/AliITStestV2.C index ade8c991e7e..b8e35014808 100644 --- a/ITS/AliITStestV2.C +++ b/ITS/AliITStestV2.C @@ -36,7 +36,7 @@ Int_t AliITStestV2(Int_t nev=5, Char_t SlowOrFast='s') { AliITSSDigits2Digits(); } gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C"); - if (rc=AliITSFindClustersV2(SlowOrFast)) return rc; + if (rc=AliITSFindClustersV2(nev,SlowOrFast)) return rc; gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindTracksV2.C"); if (rc=AliITSFindTracksV2()) return rc; diff --git a/ITS/AliV0FindVertices.C b/ITS/AliV0FindVertices.C index 4c286df4497..338ae94c2f3 100644 --- a/ITS/AliV0FindVertices.C +++ b/ITS/AliV0FindVertices.C @@ -1,12 +1,19 @@ +/**************************************************************************** + * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * + ****************************************************************************/ + #if !defined(__CINT__) || defined(__MAKECINT__) #include "Riostream.h" #include "AliV0vertexer.h" #include "TFile.h" + #include "TKey.h" #include "TStopwatch.h" #include "AliRun.h" + #include "AliKalmanTrack.h" + #include "AliMagF.h" + #include "AliESD.h" #include "AliRunLoader.h" - #include "AliITSLoader.h" #endif extern AliRun *gAlice; @@ -19,19 +26,23 @@ Int_t AliV0FindVertices(Int_t nev=5) { delete gAlice; gAlice=0; } + AliRunLoader* rl = AliRunLoader::Open("galice.root"); if (rl == 0x0) { cerr<<"AliV0FindVertices.C : Can not open session RL=NULL"<< endl; return 1; } - AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); - if (itsl == 0x0) { - cerr<<"AliV0FindVertices.C : Can not get ITS loader"<LoadgAlice()) { + cerr<<"AliV0FindVertices.C : LoadgAlice returned error"<LoadTracks("read"); - itsl->LoadV0s("recreate"); + AliKalmanTrack::SetConvConst( + 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField() + ); + Double_t cuts[]={33, // max. allowed chi2 0.16,// min. allowed negative daughter's impact parameter 0.05,// min. allowed positive daughter's impact parameter @@ -44,27 +55,43 @@ Int_t AliV0FindVertices(Int_t nev=5) { AliV0vertexer vtxer(cuts); Int_t rc=0; if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); + + TFile *v0f=TFile::Open("AliESDv0.root","RECREATE"); + if ((!v0f)||(!v0f->IsOpen())) { + cerr<<"Can't AliESDv0.root !\n"; return 1; + } + TFile *itsf=TFile::Open("AliESDits.root"); + if ((!itsf)||(!itsf->IsOpen())) { + cerr<<"Can't AliESDits.root !\n"; return 1; + } + TKey *key=0; + TIter next(itsf->GetListOfKeys()); for (Int_t i=0; iGetEvent(i); - //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm) + itsf->cd(); + if ((key=(TKey*)next())==0) break; + cerr<<"Processing event number: "<ReadObj(); - TTree *tTree=itsl->TreeT(); - if (!tTree) { - cerr<<"AliV0FindVertices.C : Can't get the ITS track tree !"<TreeV0(); - if (!vTree) { - itsl->MakeTree("V0"); - vTree=itsl->TreeV0(); - } + //Double_t vtx[3]={0.,0.,0.}; vtxer.SetVertex(vtx); // primary vertex (cm) - rc=vtxer.Tracks2V0vertices(tTree,vTree); + rc=vtxer.Tracks2V0vertices(event); - itsl->WriteV0s("OVERWRITE"); + if (rc==0) { + Char_t ename[100]; + sprintf(ename,"%d",i); + v0f->cd(); + if (!event->Write(ename)) rc++; + } + if (rc) { + cerr<<"Something bad happened...\n"; + } + delete event; } timer.Stop(); timer.Print(); + itsf->Close(); + v0f->Close(); + delete rl; return rc; diff --git a/TPC/AliTPCFindTracks.C b/TPC/AliTPCFindTracks.C index aa4449b3cc2..7bc53ee6d3b 100644 --- a/TPC/AliTPCFindTracks.C +++ b/TPC/AliTPCFindTracks.C @@ -10,6 +10,7 @@ #include "AliMagF.h" #include "AliRunLoader.h" #include "AliTPCLoader.h" + #include "AliESD.h" #include "TFile.h" #include "TStopwatch.h" @@ -43,9 +44,11 @@ Int_t AliTPCFindTracks(Int_t nev=5) { cerr<<"Error occured while loading gAlice"<GetAliRun()->Field()->SolenoidField() + 1000/0.299792458/rl->GetAliRun()->Field()->SolenoidField() ); + rl->CdGAFile(); AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); if (!dig) { @@ -53,18 +56,22 @@ Int_t AliTPCFindTracks(Int_t nev=5) { return 1; } - rl->UnloadgAlice(); + //rl->UnloadgAlice(); tpcl->LoadRecPoints("read"); - tpcl->LoadTracks("recreate"); if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); + TFile *ef=TFile::Open("AliESDtpc.root","RECREATE"); + if ((!ef)||(!ef->IsOpen())) { + cerr<<"Can't AliESDtpc.root !\n"; return 1; + } TStopwatch timer; Int_t rc=0; AliTPCtracker tracker(dig); for (Int_t i=0;iGetEvent(i); TTree *in=tpcl->TreeR(); @@ -73,19 +80,26 @@ Int_t AliTPCFindTracks(Int_t nev=5) { return 4; } - TTree *out=tpcl->TreeT(); - if (!out) { - tpcl->MakeTree("T"); - out=tpcl->TreeT(); + tracker.LoadClusters(in); + rc=tracker.Clusters2Tracks(event); + tracker.UnloadClusters(); + + if (rc==0) { + Char_t ename[100]; + sprintf(ename,"%d",i); + ef->cd(); + if (!event->Write(ename)) rc++; + } + if (rc) { + cerr<<"Something bad happened...\n"; } - - rc=tracker.Clusters2Tracks(in,out); - - tpcl->WriteTracks("OVERWRITE"); + delete event; } timer.Stop(); timer.Print(); + ef->Close(); + delete dig; //Thanks to Mariana Bondila delete rl; -- 2.43.0