Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / TPC / AliTPCFindClusters.C
CommitLineData
73042f01 1Int_t AliTPCFindClusters() {
2 TFile *out=TFile::Open("AliTPCclusters.root","new");
3 if (!out->IsOpen()) {cerr<<"Delete old AliTPCclusters.root !\n"; return 1;}
4 TFile *in=TFile::Open("galice.root");
5 if (!in->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 2;}
6
7 if (!(gAlice=(AliRun*)in->Get("gAlice"))) {
8 cerr<<"gAlice have not been found on galice.root !\n";
9 return 3;
10 }
11
12 gAlice->GetEvent(0);
13
14 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
15 Int_t ver = TPC->IsVersion();
16 cerr<<"TPC version "<<ver<<" has been found !\n";
17
18 AliTPCParam *dig=(AliTPCParam *)in->Get("75x40_100x60");
19 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
20
21 TStopwatch timer;
22
23 switch (ver) {
24 case 1:
25 cerr<<"Making clusters...\n";
26 {
27 AliTPCv1 &tpc=*((AliTPCv1*)TPC);
28 tpc.SetParam(dig); timer.Start(); tpc.Hits2Clusters(out);
29 }
30 break;
31 case 2:
32 cerr<<"Looking for clusters...\n";
33 {
34 delete gAlice; gAlice=0;
35 AliTPCv2 tpc;
36 tpc.SetParam(dig); timer.Start(); tpc.Digits2Clusters(out);
37 }
38 break;
39 default:
40 cerr<<"Invalid TPC version !\n";
41 return 5;
42 }
43
44 timer.Stop(); timer.Print();
45
46 delete gAlice; gAlice=0;
47
48 out->Close();
49 in->Close();
50
51 return 0;
52}