]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCFindClusters.C
Minor changes and cosmetics according to Anders.
[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
0bc5ae87 12Int_t AliTPCFindClusters(Int_t n=1) {
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
7a09f434 29 AliTPCParamSR *dig=(AliTPCParamSR *)in->Get("75x40_100x60");
30 if(dig){
31 cerr<<"2 pad-length geom hits with 3 pad-lengths geom digits\n";
32 delete dig;
33 dig = new AliTPCParamSR();
34 }
35 else
36 {
37 dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
38 }
73042f01 39 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
40
41 TStopwatch timer;
42
43 switch (ver) {
44 case 1:
45 cerr<<"Making clusters...\n";
46 {
47 AliTPCv1 &tpc=*((AliTPCv1*)TPC);
afc42102 48 tpc.SetParam(dig); timer.Start(); cwd->cd();
49 for(Int_t i=0;i<n;i++){
50 printf("Processing event %d\n",i);
51 gAlice->GetEvent(i);
52 tpc.Hits2Clusters(out,i);
53 }
73042f01 54 }
55 break;
56 case 2:
57 cerr<<"Looking for clusters...\n";
58 {
afc42102 59 // delete gAlice; gAlice=0;
73042f01 60 AliTPCv2 tpc;
afc42102 61 tpc.SetParam(dig); timer.Start(); cwd->cd();
62 for (Int_t i=0;i<n;i++){
63 printf("Processing event %d\n",i);
64 tpc.Digits2Clusters(out,i);
65 // AliTPCclusterer::Digits2Clusters(dig, out, i);
66 }
73042f01 67 }
68 break;
69 default:
70 cerr<<"Invalid TPC version !\n";
71 return 5;
72 }
73
74 timer.Stop(); timer.Print();
75
76 delete gAlice; gAlice=0;
77
78 out->Close();
f38c8ae5 79
73042f01 80 in->Close();
81
82 return 0;
83}