]>
Commit | Line | Data |
---|---|---|
1c53abe2 | 1 | /**************************************************************************** |
2 | * Origin: M.Ivanov marian.ivanov@cern.ch * | |
3 | ****************************************************************************/ | |
4 | ||
5 | /* | |
6 | ||
7 | macro to create array of clusters from TPC digits | |
8 | input files - galice.root | |
9 | digits.root - file with digits - usualy use link to galice.root | |
10 | - in splitted mode - neccesary to create link to proper file | |
11 | ||
12 | output file - AliTPCclusters.root | |
13 | - to be used by AliTPCTrackFinderMI.C | |
14 | ||
15 | Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything | |
16 | ||
17 | ||
18 | */ | |
19 | ||
20 | ||
21 | #ifndef __CINT__ | |
22 | #include <iostream.h> | |
23 | #include "AliRun.h" | |
24 | #include "AliTPCv1.h" | |
25 | #include "AliTPCv2.h" | |
26 | #include "AliTPCParam.h" | |
27 | #include "AliTPCclustererMI.h" | |
28 | #include "TFile.h" | |
29 | #include "TStopwatch.h" | |
30 | #include "TTree.h" | |
31 | #endif | |
32 | ||
33 | Int_t AliTPCFindClustersMI(Int_t n=1) { | |
434772a9 | 34 | |
927d593f | 35 | AliRunLoader* rl = AliRunLoader::Open("galice.root"); |
434772a9 | 36 | if (rl == 0x0) { |
37 | cerr<<"Can not open session"<<endl; | |
38 | return 1; | |
39 | } | |
40 | ||
41 | AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); | |
42 | if (tpcl == 0x0) { | |
43 | cerr<<"Can not get TPC Loader"<<endl; | |
44 | return 1; | |
45 | } | |
1c53abe2 | 46 | |
434772a9 | 47 | if (tpcl->LoadDigits()) { |
48 | cerr<<"Error occured while loading digits"<<endl; | |
49 | return 1; | |
50 | } | |
1c53abe2 | 51 | |
434772a9 | 52 | if (tpcl->LoadRecPoints("recreate")) { |
53 | cerr<<"Error occured while loading digits"<<endl; | |
54 | return 1; | |
55 | } | |
56 | ||
57 | if (rl->LoadgAlice()) { | |
58 | cerr<<"Error occured while l"<<endl; | |
59 | return 1; | |
60 | } | |
61 | ||
62 | gAlice=rl->GetAliRun(); | |
63 | if (!gAlice) { | |
64 | cerr<<"Can't get gAlice !\n"; | |
65 | return 1; | |
1c53abe2 | 66 | } |
67 | ||
68 | TDirectory *cwd = gDirectory; | |
69 | ||
70 | AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); | |
71 | Int_t ver = TPC->IsVersion(); | |
72 | cerr<<"TPC version "<<ver<<" has been found !\n"; | |
434772a9 | 73 | |
74 | rl->CdGAFile(); | |
75 | ||
76 | AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60"); | |
1c53abe2 | 77 | if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;} |
78 | ||
79 | TStopwatch timer; | |
80 | ||
81 | switch (ver) { | |
82 | case 1: | |
83 | cerr<<"Making clusters...\n"; | |
84 | { | |
85 | AliTPCv1 &tpc=*((AliTPCv1*)TPC); | |
86 | tpc.SetParam(dig); timer.Start(); cwd->cd(); | |
87 | for(Int_t i=0;i<n;i++){ | |
88 | printf("Processing event %d\n",i); | |
89 | gAlice->GetEvent(i); | |
90 | tpc.Hits2Clusters(out,i); | |
91 | } | |
92 | } | |
93 | break; | |
94 | case 2: | |
95 | cerr<<"Looking for clusters...\n"; | |
96 | { | |
97 | // delete gAlice; gAlice=0; | |
98 | AliTPCv2 tpc; | |
99 | tpc.SetParam(dig); timer.Start(); cwd->cd(); | |
100 | ||
434772a9 | 101 | n = rl->GetNumberOfEvents(); |
102 | for (Int_t i=0;i<n;i++) | |
103 | { | |
104 | rl->GetEvent(i); | |
105 | AliTPCclustererMI clusterer(dig); | |
106 | ||
107 | TTree * input = tpcl->TreeD(); | |
108 | if (input == 0x0) | |
109 | { | |
110 | cerr << "Can not get TreeD for event " << i <<endl; | |
111 | continue; | |
112 | } | |
113 | ||
114 | TTree * output = tpcl->TreeR(); | |
115 | if (output == 0x0) | |
116 | { | |
117 | tpcl->MakeTree("R"); | |
118 | output = tpcl->TreeR(); | |
119 | if (output == 0x0) | |
120 | { | |
121 | cerr << "Problems with output tree (TreeR) for event " << i <<endl; | |
122 | continue; | |
123 | } | |
124 | } | |
125 | ||
126 | printf("Processing event %d\n",i); | |
127 | clusterer.SetInput(input); | |
128 | clusterer.SetOutput(output); | |
129 | clusterer.Digits2Clusters(); | |
130 | ||
131 | tpcl->WriteRecPoints("OVERWRITE"); | |
1c53abe2 | 132 | } |
133 | } | |
134 | break; | |
135 | default: | |
136 | cerr<<"Invalid TPC version !\n"; | |
137 | return 5; | |
138 | } | |
139 | ||
140 | timer.Stop(); timer.Print(); | |
141 | ||
434772a9 | 142 | delete rl;//cleans everything |
1c53abe2 | 143 | |
144 | return 0; | |
145 | } |