X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TPC%2FAliTPCFindClusters.C;h=9535e0447d28aaa10fc2c288e0a68c9627da7ec9;hp=4cada652026fec9edf956207f378e1fc78c943a8;hb=457c07133e3ee1b60bb2f1aa7f26e3eb084729f3;hpb=ddae83186a2eca406cf3addf01e4d1cdc7e9ed0b diff --git a/TPC/AliTPCFindClusters.C b/TPC/AliTPCFindClusters.C index 4cada652026..9535e0447d2 100644 --- a/TPC/AliTPCFindClusters.C +++ b/TPC/AliTPCFindClusters.C @@ -1,27 +1,62 @@ -/**************************************************************************** - * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * - ****************************************************************************/ +/// \file AliTPCFindClusters.C +/// +/// \author M.Ivanov marian.ivanov@cern.ch +/// +/// macro to create array of clusters from TPC digits +/// input files - galice.root +/// digits.root - file with digits - usualy use link to galice.root +/// - in splitted mode - neccesary to create link to proper file +/// +/// output file - AliTPCclusters.root +/// - to be used by AliTPCTrackFinderMI.C +/// +/// Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything #ifndef __CINT__ - #include - #include "AliRun.h" - #include "AliTPCv1.h" - #include "AliTPCv2.h" - #include "AliTPCParam.h" - - #include "TFile.h" - #include "TStopwatch.h" +#include +#include "AliRun.h" +#include "AliTPCv1.h" +#include "AliTPCv2.h" +#include "AliTPCParam.h" +#include "AliTPCclusterer.h" +#include "TFile.h" +#include "TStopwatch.h" +#include "TTree.h" #endif -Int_t AliTPCFindClusters(Int_t n=1) { - 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;} +Int_t AliTPCFindClustersMI(Int_t n=1) { + + AliRunLoader* rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) { + cerr<<"Can not open session"<GetLoader("TPCLoader"); + if (tpcl == 0x0) { + cerr<<"Can not get TPC Loader"<LoadDigits()) { + cerr<<"Error occured while loading digits"<Get("gAlice"))) { - cerr<<"gAlice have not been found on galice.root !\n"; - return 3; + if (tpcl->LoadRecPoints("recreate")) { + cerr<<"Error occured while loading digits"<LoadgAlice()) { + cerr<<"Error occured while l"<GetAliRun(); + if (!gAlice) { + cerr<<"Can't get gAlice !\n"; + return 1; } TDirectory *cwd = gDirectory; @@ -29,8 +64,10 @@ Int_t AliTPCFindClusters(Int_t n=1) { AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); Int_t ver = TPC->IsVersion(); cerr<<"TPC version "<Get("75x40_100x60_150x60"); + + rl->CdGAFile(); + + AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;} TStopwatch timer; @@ -49,30 +86,54 @@ Int_t AliTPCFindClusters(Int_t n=1) { } break; case 2: - cerr<<"Looking for clusters...\n"; - { - // delete gAlice; gAlice=0; + cerr<<"Looking for clusters...\n"; + { + // delete gAlice; gAlice=0; AliTPCv2 tpc; tpc.SetParam(dig); timer.Start(); cwd->cd(); - for (Int_t i=0;iGetNumberOfEvents(); + for (Int_t i=0;iGetEvent(i); + AliTPCclusterer clusterer(dig); + + TTree * input = tpcl->TreeD(); + if (input == 0x0) + { + cerr << "Can not get TreeD for event " << i <TreeR(); + if (output == 0x0) + { + tpcl->MakeTree("R"); + output = tpcl->TreeR(); + if (output == 0x0) + { + cerr << "Problems with output tree (TreeR) for event " << i <WriteRecPoints("OVERWRITE"); } - } - break; + } + break; default: - cerr<<"Invalid TPC version !\n"; - return 5; + cerr<<"Invalid TPC version !\n"; + return 5; } - + timer.Stop(); timer.Print(); - - delete gAlice; gAlice=0; - - out->Close(); - - in->Close(); + + delete rl;//cleans everything return 0; }