From 434772a9396e80b01832df4e87583439d0328841 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 19 Aug 2003 15:10:30 +0000 Subject: [PATCH] Working version (P.Skowronski) --- TPC/AliTPCFindClustersMI.C | 100 ++++++++++++++++++---------- TPC/AliTPCFindTracksMI.C | 133 ++++++++++++++++++++++++++++--------- 2 files changed, 166 insertions(+), 67 deletions(-) diff --git a/TPC/AliTPCFindClustersMI.C b/TPC/AliTPCFindClustersMI.C index aaeb046c2fb..281bc0572dd 100644 --- a/TPC/AliTPCFindClustersMI.C +++ b/TPC/AliTPCFindClustersMI.C @@ -31,18 +31,38 @@ #endif Int_t AliTPCFindClustersMI(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;} - - TFile *ind=TFile::Open("rfio:digits.root"); - if (!ind->IsOpen()) {cerr<<"Can't open digits file !\n"; return 2;} + + AliRunLoader* rl = AliRunLoader::Open("rfio:./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; @@ -50,8 +70,10 @@ Int_t AliTPCFindClustersMI(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; @@ -76,23 +98,37 @@ Int_t AliTPCFindClustersMI(Int_t n=1) { AliTPCv2 tpc; tpc.SetParam(dig); timer.Start(); cwd->cd(); - - for (Int_t i=0;iGet(dname); - out->cd(); - TTree * output = new TTree(cname,cname); - - printf("Processing event %d\n",i); - clusterer.SetInput(input); - clusterer.SetOutput(output); - clusterer.Digits2Clusters(dig, i); - //tpc.Digits2Clusters(out,i); - // AliTPCclusterer::Digits2Clusters(dig, out, i); + n = rl->GetNumberOfEvents(); + for (Int_t i=0;iGetEvent(i); + AliTPCclustererMI 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; @@ -103,11 +139,7 @@ Int_t AliTPCFindClustersMI(Int_t n=1) { timer.Stop(); timer.Print(); - delete gAlice; gAlice=0; - - out->Close(); - - in->Close(); + delete rl;//cleans everything return 0; } diff --git a/TPC/AliTPCFindTracksMI.C b/TPC/AliTPCFindTracksMI.C index 7e3acc0d6cd..e0b19a1676e 100644 --- a/TPC/AliTPCFindTracksMI.C +++ b/TPC/AliTPCFindTracksMI.C @@ -3,47 +3,114 @@ ****************************************************************************/ #ifndef __CINT__ -#include -#include "AliTPCParam.h" -#include "AliTPCtrackerMI.h" -#include "TFile.h" -#include "TStopwatch.h" -#include "AliRun.h" -#include "AliMagF.h" + #include + #include "AliTPCParam.h" + #include "AliTPCtracker.h" + + #include "TFile.h" + #include "TStopwatch.h" #endif -Int_t AliTPCFindTracks(Int_t eventn=1) { +Int_t AliTPCFindTracksMI(Int_t N=-1) { + cerr<<"Looking for tracks...\n"; - TFile f("galice.root"); - gAlice = (AliRun*)f.Get("gAlice"); - AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField()); - TFile *out=TFile::Open("AliTPCtracks.root","new"); - if (!out->IsOpen()) {cerr<<"Delete old AliTPCtracks.root !\n"; return 1;} - TFile *in=TFile::Open("AliTPCclusters.root"); - if (!in->IsOpen()) {cerr<<"Can't open AliTPCclusters.root !\n"; return 2;} + if (gAlice) + { + delete gAlice->GetRunLoader(); + delete gAlice; + gAlice = 0x0; + } + + rl = AliRunLoader::Open("galice.root"); + if (rl == 0x0) + { + cerr<<"Can not open session"<GetLoader("TPCLoader"); + if (tpcl == 0x0) + { + cerr<<"Can not get TPC Loader"<LoadgAlice()) + { + cerr<<"Error occured while l"<GetAliRun()->Field()->SolenoidField()); + rl->UnloadgAlice(); + + rl->CdGAFile(); + + AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); + if (!dig) + { + dig=(AliTPCParam *)gDirectory->Get("75x40_100x60"); + if (!param) + { + cerr<<"TPC parameters have not been found !\n"; + return 1; + } + else + { + cout<<"TPC 75x40_100x60 geometry found"<Get("75x40_100x60_150x60"); - if (!par) {cerr<<"Can't get TPC parameters !\n"; return 3;} - + + tpcl->LoadTracks("recreate"); + + Int_t eventn; + if (N<=0) + { + eventn = rl->GetNumberOfEvents(); + rl->UnloadHeader(); + } + else + eventn = N; + TStopwatch timer; - Int_t rc=0; - for (Int_t i=0;iSetVertex(xyz); //primary vertex - rc=tracker->Clusters2Tracks(0,out); - delete tracker; - } + for (Int_t i=0;iTreeR(); + if (input == 0x0) + { + tpcl->LoadRecPoints("read"); + input = tpcl->TreeR(); + if (input == 0x0) + { + cerr << "Problems with input tree (TreeR) for event " << i <TreeT(); + if (output == 0x0) + { + tpcl->MakeTree("T"); + output = tpcl->TreeT(); + if (output == 0x0) + { + cerr << "Problems with output tree (TreeT) for event " << i <Clusters2Tracks(); + delete tracker; + } timer.Stop(); timer.Print(); - delete par; //Thanks to Mariana Bondila - - in->Close(); - out->Close(); - + delete dig; //Thanks to Mariana Bondila + delete rl; return rc; } -- 2.31.1