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