]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCFindClusters.C
Correction for superposition of ZDC volumes with MUON arm one
[u/mrichter/AliRoot.git] / TPC / AliTPCFindClusters.C
1 Int_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    TDirectory *cwd = gDirectory;
13
14    gAlice->GetEvent(0);
15
16    AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); 
17    Int_t ver = TPC->IsVersion(); 
18    cerr<<"TPC version "<<ver<<" has been found !\n";
19
20    AliTPCParam *dig=(AliTPCParam *)in->Get("75x40_100x60");
21    if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
22
23    TStopwatch timer;
24
25    switch (ver) {
26    case 1:
27       cerr<<"Making clusters...\n";
28       {
29        AliTPCv1 &tpc=*((AliTPCv1*)TPC);
30        tpc.SetParam(dig); timer.Start(); cwd->cd(); tpc.Hits2Clusters(out); 
31       }
32       break;
33    case 2:
34       cerr<<"Looking for clusters...\n";
35       {
36        delete gAlice; gAlice=0;
37        AliTPCv2 tpc; 
38        tpc.SetParam(dig); timer.Start(); cwd->cd(); tpc.Digits2Clusters(out); 
39       }
40       break;
41    default:
42       cerr<<"Invalid TPC version !\n";
43       return 5;
44    }
45
46    timer.Stop(); timer.Print();
47
48    delete gAlice; gAlice=0;
49
50    out->Close();
51    in->Close();
52
53    return 0;
54 }