Using galice.root by default
[u/mrichter/AliRoot.git] / TPC / AliTPCFindClusters.C
CommitLineData
c2b0eaa4 1/****************************************************************************
2 * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch *
3 ****************************************************************************/
4
b9de75e1 5#ifndef __CINT__
6 #include <iostream.h>
7 #include "AliRun.h"
8 #include "AliTPCv1.h"
9 #include "AliTPCv2.h"
10 #include "AliTPCParam.h"
11
12 #include "TFile.h"
13 #include "TStopwatch.h"
14#endif
15
0bc5ae87 16Int_t AliTPCFindClusters(Int_t n=1) {
73042f01 17 TFile *out=TFile::Open("AliTPCclusters.root","new");
18 if (!out->IsOpen()) {cerr<<"Delete old AliTPCclusters.root !\n"; return 1;}
106ea0fc 19 TFile *in=TFile::Open("rfio:galice.root");
73042f01 20 if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;}
21
55d4aa04 22 TFile *ind=TFile::Open("galice.root");
1c53abe2 23 if (!ind->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;}
24
73042f01 25 if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
26 cerr<<"gAlice have not been found on galice.root !\n";
27 return 3;
28 }
29
2ab0c725 30 TDirectory *cwd = gDirectory;
31
73042f01 32 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
33 Int_t ver = TPC->IsVersion();
34 cerr<<"TPC version "<<ver<<" has been found !\n";
35
c2b0eaa4 36 AliTPCParam *dig=(AliTPCParam *)in->Get("75x40_100x60_150x60");
73042f01 37 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
38
39 TStopwatch timer;
40
41 switch (ver) {
42 case 1:
43 cerr<<"Making clusters...\n";
44 {
45 AliTPCv1 &tpc=*((AliTPCv1*)TPC);
afc42102 46 tpc.SetParam(dig); timer.Start(); cwd->cd();
47 for(Int_t i=0;i<n;i++){
48 printf("Processing event %d\n",i);
49 gAlice->GetEvent(i);
50 tpc.Hits2Clusters(out,i);
51 }
73042f01 52 }
53 break;
54 case 2:
55 cerr<<"Looking for clusters...\n";
56 {
afc42102 57 // delete gAlice; gAlice=0;
73042f01 58 AliTPCv2 tpc;
1c53abe2 59 tpc.SetParam(dig); timer.Start(); ind->cd();
afc42102 60 for (Int_t i=0;i<n;i++){
61 printf("Processing event %d\n",i);
62 tpc.Digits2Clusters(out,i);
63 // AliTPCclusterer::Digits2Clusters(dig, out, i);
64 }
73042f01 65 }
66 break;
67 default:
68 cerr<<"Invalid TPC version !\n";
69 return 5;
70 }
71
72 timer.Stop(); timer.Print();
73
74 delete gAlice; gAlice=0;
75
76 out->Close();
f38c8ae5 77
73042f01 78 in->Close();
79
80 return 0;
81}