X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCFindClusters.C;h=a5dad6b5389256fd1c1dd43bf33d7ef5fa121c92;hb=0ffacf98634da4e10ec990b177348f20e3ab2114;hp=4e72316896df6b874c24e00cb404dfc2abf7116f;hpb=afc42102c4f0db8453dcb06ca5063a72216b7d88;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCFindClusters.C b/TPC/AliTPCFindClusters.C index 4e72316896d..a5dad6b5389 100644 --- a/TPC/AliTPCFindClusters.C +++ b/TPC/AliTPCFindClusters.C @@ -1,73 +1,119 @@ -#ifndef __CINT__ - #include +/**************************************************************************** + * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * + ****************************************************************************/ + +#if !defined(__CINT__) || defined(__MAKECINT__) + #include + #include "AliRun.h" + #include "AliRunLoader.h" + #include "AliTPCLoader.h" #include "AliTPCv1.h" - #include "AliTPCv2.h" #include "AliTPCParam.h" + #include "AliTPCclusterer.h" - #include "TFile.h" + #include "TTree.h" #include "TStopwatch.h" #endif -Int_t AliTPCFindClusters(Int_t n) { - TFile *out=TFile::Open("AliTPCclusters.root","new"); - if (!out->IsOpen()) {cerr<<"Delete old AliTPCclusters.root !\n"; return 1;} - TFile *in=TFile::Open("rfio:galice.root"); - if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;} +extern AliRun *gAlice; - if (!(gAlice=(AliRun*)in->Get("gAlice"))) { - cerr<<"gAlice have not been found on galice.root !\n"; - return 3; +Int_t AliTPCFindClusters(Int_t nev=5) { + + if (gAlice) { + delete gAlice->GetRunLoader(); + delete gAlice;//if everything was OK here it is already NULL + gAlice = 0x0; + } + + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) { + cerr<<"Can not open session"<LoadgAlice()) { + cerr<<"Error occured while l"<GetLoader("TPCLoader"); + if (tpcl == 0x0) { + cerr<<"Can not get TPC Loader"<GetAliRun(); + if (!gAlice) { + cerr<<"Can't get gAlice !\n"; + return 1; + } AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); Int_t ver = TPC->IsVersion(); cerr<<"TPC version "<Get("75x40_100x60"); - if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;} + rl->CdGAFile(); + AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!dig) { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + + if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); + + tpcl->LoadRecPoints("recreate"); + if (ver==1) tpcl->LoadHits("read"); + else tpcl->LoadDigits("read"); TStopwatch timer; - switch (ver) { - case 1: + if (ver==1) { cerr<<"Making clusters...\n"; - { - AliTPCv1 &tpc=*((AliTPCv1*)TPC); - tpc.SetParam(dig); timer.Start(); cwd->cd(); - for(Int_t i=0;iLoadKinematics(); + timer.Start(); + for(Int_t i=0;iGetEvent(i); - tpc.Hits2Clusters(out,i); - } + rl->GetEvent(i); + tpc.Hits2Clusters(i); } - break; - case 2: + } else if (ver==2) { cerr<<"Looking for clusters...\n"; - { - // delete gAlice; gAlice=0; - AliTPCv2 tpc; - tpc.SetParam(dig); timer.Start(); cwd->cd(); - for (Int_t i=0;iGetEvent(i); + + TTree *out=tpcl->TreeR(); + if (!out) { + tpcl->MakeTree("R"); + out=tpcl->TreeR(); + } + TTree *in=tpcl->TreeD(); + if (!in) { + cerr<<"Can't get digits tree !\n"; + return 4; + } + + clusterer.Digits2Clusters(in,out); + + tpcl->WriteRecPoints("OVERWRITE"); } - break; - default: + delete dummy; + delete dig; + } else { cerr<<"Invalid TPC version !\n"; + delete rl; return 5; } timer.Stop(); timer.Print(); - delete gAlice; gAlice=0; - - out->Close(); - in->Close(); + delete rl; return 0; }