Issue warning message if used outside allowed eta range (-8 to 8).
[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
73042f01 12Int_t AliTPCFindClusters() {
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 gAlice->GetEvent(0);
26
27 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
28 Int_t ver = TPC->IsVersion();
29 cerr<<"TPC version "<<ver<<" has been found !\n";
30
31 AliTPCParam *dig=(AliTPCParam *)in->Get("75x40_100x60");
32 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
33
34 TStopwatch timer;
35
36 switch (ver) {
37 case 1:
38 cerr<<"Making clusters...\n";
39 {
40 AliTPCv1 &tpc=*((AliTPCv1*)TPC);
2ab0c725 41 tpc.SetParam(dig); timer.Start(); cwd->cd(); tpc.Hits2Clusters(out);
73042f01 42 }
43 break;
44 case 2:
45 cerr<<"Looking for clusters...\n";
46 {
47 delete gAlice; gAlice=0;
48 AliTPCv2 tpc;
2ab0c725 49 tpc.SetParam(dig); timer.Start(); cwd->cd(); tpc.Digits2Clusters(out);
73042f01 50 }
51 break;
52 default:
53 cerr<<"Invalid TPC version !\n";
54 return 5;
55 }
56
57 timer.Stop(); timer.Print();
58
59 delete gAlice; gAlice=0;
60
61 out->Close();
62 in->Close();
63
64 return 0;
65}