]>
Commit | Line | Data |
---|---|---|
cbd576a6 | 1 | // --- ROOT system --- |
2 | #include "TBenchmark.h" | |
3 | #include "TROOT.h" | |
4 | ||
5 | // --- Standard library --- | |
6 | #include <iostream.h> | |
7 | #include <iomanip.h> | |
8 | ||
9 | // --- AliRoot header files --- | |
10 | #include "AliPHOSClusterizerv2.h" | |
11 | #include "AliPHOSGetter.h" | |
12 | #include "TFolder.h" | |
13 | #include "AliPHOSEvalRecPoint.h" | |
14 | #include "AliPHOSRecCpvManager.h" | |
15 | #include "AliPHOSRecEmcManager.h" | |
16 | ||
17 | ClassImp(AliPHOSClusterizerv2) | |
18 | ||
19 | AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1() | |
20 | {} | |
21 | ||
fbf811ec | 22 | AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name, const Bool_t toSplit): |
23 | AliPHOSClusterizerv1(headerFile,name,toSplit) | |
cbd576a6 | 24 | {} |
25 | ||
26 | void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const | |
27 | { | |
28 | ||
29 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; | |
30 | numb[0] = gime->EmcRecPoints()->GetEntries(); | |
31 | numb[1] = gime->CpvRecPoints()->GetEntries(); | |
32 | } | |
33 | ||
34 | void AliPHOSClusterizerv2::Exec(Option_t* option) | |
35 | { | |
36 | ||
37 | if(strstr(option,"tim")) | |
38 | gBenchmark->Start("PHOSClusterizer"); | |
39 | ||
40 | if(strstr(option,"print")) | |
41 | Print("") ; | |
42 | ||
43 | AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; | |
44 | ||
fbf811ec | 45 | TFolder* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS")); |
46 | TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS"); | |
47 | ||
cbd576a6 | 48 | TObjArray* wPool = new TObjArray(400); |
49 | wPool->SetName("SmartPoints"); | |
50 | wPoolF->Add(wPool); | |
51 | wPoolF->Add(this); | |
52 | ||
53 | Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; | |
54 | Int_t ievent ; | |
55 | ||
56 | for(ievent = 0; ievent<nevents; ievent++) { | |
57 | ||
58 | gAlice->GetEvent(ievent) ; | |
59 | gAlice->SetEvent(ievent) ; | |
60 | ||
61 | gime->Event(ievent,"D") ; | |
62 | // if(!ReadDigits(ievent)) //reads digits for event fEvent | |
63 | // continue; | |
64 | ||
65 | cout<<" MakeClusters invoked.."; | |
66 | MakeClusters() ; | |
67 | cout<<" done."<<endl; | |
68 | ||
69 | ||
70 | //SmartRecPoints will communicate with wPool. | |
71 | ||
72 | AliPHOSEvalRecPoint* rp=0; | |
73 | ||
74 | // CPV reconstruction | |
75 | ||
76 | AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager(); | |
77 | wPoolF->Add(recCpv); | |
78 | ||
c9eeb00e | 79 | Int_t iPoint; //loop variable |
80 | ||
81 | for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) { | |
cbd576a6 | 82 | rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv); |
83 | rp->MakeJob(); | |
84 | } | |
85 | ||
86 | AliPHOSEvalRecPoint pt; | |
87 | pt.UpdateWorkingPool(); | |
88 | ||
89 | TObjArray * cpvRecPoints = gime->CpvRecPoints() ; | |
90 | Int_t nOldCpv = cpvRecPoints->GetEntries(); | |
91 | cpvRecPoints->Delete(); | |
92 | cpvRecPoints->Compress(); | |
93 | ||
c9eeb00e | 94 | Int_t i; //loop variable |
95 | ||
96 | for(i=0; i<wPool->GetEntries(); i++) | |
cbd576a6 | 97 | cpvRecPoints->Add(wPool->At(i)); |
98 | ||
99 | wPool->Clear(); | |
100 | wPool->Compress(); | |
101 | ||
102 | wPoolF->Remove(recCpv); | |
103 | delete recCpv; | |
104 | ||
105 | cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl; | |
106 | cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl; | |
107 | ||
108 | ||
109 | // Now Emc reconstruction | |
110 | ||
111 | AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager(); | |
112 | wPoolF->Add(recEmc); | |
113 | ||
c9eeb00e | 114 | for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) { |
40b23f22 | 115 | rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc); |
cbd576a6 | 116 | rp->MakeJob(); |
117 | } | |
118 | ||
119 | pt.UpdateWorkingPool(); | |
120 | ||
121 | TObjArray * emcRecPoints = gime->EmcRecPoints() ; | |
122 | Int_t nOldEmc = emcRecPoints->GetEntries(); | |
123 | emcRecPoints->Delete(); | |
124 | emcRecPoints->Compress(); | |
125 | ||
c9eeb00e | 126 | for(i=0; i<wPool->GetEntries(); i++) |
cbd576a6 | 127 | emcRecPoints->Add(wPool->At(i)); |
128 | ||
129 | wPool->Clear(); | |
130 | wPool->Compress(); | |
131 | ||
132 | wPoolF->Remove(recEmc); | |
133 | delete recEmc; | |
134 | ||
135 | cout<<" "<<nOldCpv<<" OLD cpvRecPoints."<<endl; | |
136 | cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl; | |
137 | cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl; | |
138 | ||
139 | cout<<" "<<nOldEmc<<" OLD emcRecPoints."<<endl; | |
140 | cout<<" "<<gime->EmcRecPoints()->GetEntries()<<endl; | |
141 | cout<<" "<<emcRecPoints->GetEntries()<<" emcRecPoints."<<endl<<endl; | |
142 | ||
143 | WriteRecPoints(ievent); | |
144 | ||
145 | ||
146 | } // loop over events | |
147 | ||
148 | if(strstr(option,"tim")) { | |
149 | gBenchmark->Stop("PHOSClusterizer"); | |
150 | cout << "AliPHOSClusterizer:" << endl ; | |
151 | cout << " took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing " << endl; | |
152 | cout << endl ; | |
153 | ||
154 | } | |
155 | ||
156 | } | |
fbf811ec | 157 | //--------------------------------------------------------------------------------- |
cbd576a6 | 158 | Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const |
159 | { | |
160 | // Points are neighbours if they have common edge. | |
161 | // Points with common vertex are NOT neighbours. | |
162 | // This treatment of neighbourship is the part of | |
163 | // IHEP algorithm of clusterization. | |
164 | ||
165 | // Gives the neighbourness of two digits = 0 are not neighbour but continue searching | |
166 | // = 1 are neighbour | |
167 | // = 2 are not neighbour but do not continue searching | |
168 | // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster | |
169 | // which is compared to a digit (d2) not yet in a cluster | |
170 | ||
171 | const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry(); | |
172 | ||
173 | Int_t rv = 0 ; | |
174 | ||
175 | Int_t relid1[4] ; | |
176 | geom->AbsToRelNumbering(d1->GetId(), relid1) ; | |
177 | ||
178 | Int_t relid2[4] ; | |
179 | geom->AbsToRelNumbering(d2->GetId(), relid2) ; | |
180 | ||
181 | if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module | |
182 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; | |
183 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
184 | ||
185 | if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){ | |
186 | rv = 1 ; | |
187 | } | |
188 | else { | |
189 | if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) | |
190 | rv = 2; // Difference in row numbers is too large to look further | |
191 | } | |
192 | ||
193 | } | |
194 | else { | |
195 | ||
196 | if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) ) | |
197 | rv=2 ; | |
198 | ||
199 | } | |
200 | ||
cbd576a6 | 201 | return rv ; |
202 | ||
203 | } |