]>
Commit | Line | Data |
---|---|---|
52c9bc11 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //////////////////////////////////// | |
19 | // | |
cf464691 | 20 | // MUON cluster reconstructor for MUON |
52c9bc11 | 21 | // |
cf464691 | 22 | // Should implement a virtual class ClusterFinder to chose between VS and AZ method |
52c9bc11 | 23 | //////////////////////////////////// |
24 | ||
52c9bc11 | 25 | #include "AliMUONClusterReconstructor.h" |
cf464691 | 26 | #include "AliRun.h" // for gAlice |
27 | #include "AliRunLoader.h" | |
28 | #include "AliLoader.h" | |
29 | ||
a713db22 | 30 | #include "AliMUON.h" |
52c9bc11 | 31 | #include "AliMUONDigit.h" |
32 | #include "AliMUONConstants.h" | |
33 | #include "AliMUONData.h" | |
34 | #include "AliMUONClusterFinderVS.h" | |
52c9bc11 | 35 | #include "AliMUONClusterInput.h" |
36 | #include "AliMUONRawCluster.h" | |
cf464691 | 37 | #include "AliRawReader.h" // for raw data |
8c343c7c | 38 | #include "AliLog.h" |
cf464691 | 39 | |
52c9bc11 | 40 | |
343146bf | 41 | const Int_t AliMUONClusterReconstructor::fgkDefaultPrintLevel = 0; |
52c9bc11 | 42 | |
43 | ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context | |
44 | ||
45 | //__________________________________________________________________________ | |
46 | AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliLoader* loader) | |
7e4a628d | 47 | : TObject(), |
48 | fMUONData(0), | |
49 | fPrintLevel(fgkDefaultPrintLevel), | |
50 | fDebug(0) | |
52c9bc11 | 51 | { |
30178c30 | 52 | // Standard Constructor |
52c9bc11 | 53 | |
54 | // initialize loader's | |
55 | fLoader = loader; | |
56 | ||
57 | // initialize container | |
58 | fMUONData = new AliMUONData(fLoader,"MUON","MUON"); | |
59 | ||
7e4a628d | 60 | // reconstruction model |
61 | fRecModel = new AliMUONClusterFinderVS(); | |
62 | //fRecModel = new AliMUONClusterFinderAZ(); | |
52c9bc11 | 63 | |
30178c30 | 64 | } |
52c9bc11 | 65 | |
30178c30 | 66 | //__________________________________________________________________________ |
67 | AliMUONClusterReconstructor::AliMUONClusterReconstructor() | |
68 | : TObject(), | |
30178c30 | 69 | fMUONData(0), |
30178c30 | 70 | fPrintLevel(fgkDefaultPrintLevel), |
71 | fDebug(0), | |
72 | fLoader(0) | |
73 | { | |
74 | // Default Constructor | |
52c9bc11 | 75 | } |
30178c30 | 76 | |
52c9bc11 | 77 | //_______________________________________________________________________ |
30178c30 | 78 | AliMUONClusterReconstructor::AliMUONClusterReconstructor (const AliMUONClusterReconstructor& rhs) |
79 | : TObject(rhs) | |
52c9bc11 | 80 | { |
30178c30 | 81 | // Protected copy constructor |
82 | ||
8c343c7c | 83 | AliFatal("Not implemented."); |
52c9bc11 | 84 | } |
85 | ||
30178c30 | 86 | //_______________________________________________________________________ |
87 | AliMUONClusterReconstructor & | |
88 | AliMUONClusterReconstructor::operator=(const AliMUONClusterReconstructor& rhs) | |
52c9bc11 | 89 | { |
30178c30 | 90 | // Protected assignement operator |
91 | ||
92 | if (this == &rhs) return *this; | |
93 | ||
8c343c7c | 94 | AliFatal("Not implemented."); |
30178c30 | 95 | |
96 | return *this; | |
52c9bc11 | 97 | } |
98 | ||
99 | //__________________________________________________________________________ | |
100 | AliMUONClusterReconstructor::~AliMUONClusterReconstructor(void) | |
101 | { | |
7e4a628d | 102 | |
52c9bc11 | 103 | if (fMUONData) |
104 | delete fMUONData; | |
105 | ||
106 | return; | |
107 | } | |
108 | //____________________________________________________________________ | |
109 | void AliMUONClusterReconstructor::Digits2Clusters() | |
110 | { | |
a713db22 | 111 | // |
112 | // Perform cluster finding | |
113 | // | |
114 | ||
115 | AliMUON* pMUON = (AliMUON*) gAlice->GetModule("MUON"); | |
116 | if (pMUON->WhichSegmentation() == 1) | |
117 | Digits2ClustersOld(); | |
118 | else | |
119 | Digits2ClustersNew(); | |
120 | ||
121 | } | |
122 | //____________________________________________________________________ | |
123 | void AliMUONClusterReconstructor::Digits2ClustersOld() | |
124 | { | |
125 | ||
52c9bc11 | 126 | // |
127 | // Perform cluster finding | |
128 | // | |
129 | TClonesArray *dig1, *dig2; | |
130 | Int_t ndig, k; | |
131 | dig1 = new TClonesArray("AliMUONDigit",1000); | |
132 | dig2 = new TClonesArray("AliMUONDigit",1000); | |
133 | AliMUONDigit *digit; | |
7e4a628d | 134 | |
135 | // Loop on chambers and on cathode planes | |
52c9bc11 | 136 | TClonesArray * muonDigits; |
137 | ||
138 | for (Int_t ich = 0; ich < 10; ich++) { | |
52c9bc11 | 139 | |
a713db22 | 140 | fMUONData->ResetDigits(); |
141 | fMUONData->GetCathode(0); | |
142 | //TClonesArray * | |
143 | muonDigits = fMUONData->Digits(ich); | |
144 | ndig=muonDigits->GetEntriesFast(); | |
145 | AliDebug(1,Form("1 Found %d digits in %p chamber %d", ndig, (void*)muonDigits,ich)); | |
146 | TClonesArray &lhits1 = *dig1; | |
147 | Int_t n = 0; | |
148 | for (k = 0; k < ndig; k++) { | |
149 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
150 | new(lhits1[n++]) AliMUONDigit(*digit); | |
151 | } | |
152 | fMUONData->ResetDigits(); | |
153 | fMUONData->GetCathode(1); | |
154 | muonDigits = fMUONData->Digits(ich); | |
155 | ndig=muonDigits->GetEntriesFast(); | |
156 | AliDebug(1,Form("2 Found %d digits in %p %d", ndig, (void*)muonDigits, ich)); | |
157 | TClonesArray &lhits2 = *dig2; | |
158 | n=0; | |
159 | ||
160 | for (k=0; k<ndig; k++) { | |
161 | digit= (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
162 | new(lhits2[n++]) AliMUONDigit(*digit); | |
163 | } | |
164 | ||
165 | if (fRecModel) { | |
166 | AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2); | |
167 | fRecModel->FindRawClusters(); | |
168 | } | |
169 | // copy into the container | |
170 | TClonesArray* tmp = fRecModel->GetRawClusters(); | |
171 | for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) { | |
172 | AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); | |
173 | fMUONData->AddRawCluster(ich, *pClus); | |
174 | } | |
175 | dig1->Delete(); | |
176 | dig2->Delete(); | |
177 | } // for ich | |
178 | delete dig1; | |
179 | delete dig2; | |
180 | } | |
181 | //____________________________________________________________________ | |
182 | void AliMUONClusterReconstructor::Digits2ClustersNew() | |
183 | { | |
184 | ||
185 | TClonesArray *dig1, *dig2, *digAll; | |
186 | Int_t ndig, k, idDE, idDE_prev; | |
187 | dig1 = new TClonesArray("AliMUONDigit",1000); | |
188 | dig2 = new TClonesArray("AliMUONDigit",1000); | |
189 | digAll = new TClonesArray("AliMUONDigit",2000); | |
190 | ||
191 | AliMUONDigit* digit; | |
192 | ||
f7db2071 | 193 | TArrayI id(200); // contains the different IdDE |
194 | ||
a713db22 | 195 | |
196 | // Loop on chambers and on cathode planes | |
197 | TClonesArray* muonDigits; | |
198 | Int_t n2; | |
199 | Int_t n1; | |
200 | Int_t flag = 0; | |
201 | ||
202 | for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) { | |
f7db2071 | 203 | |
204 | id.Reset(); | |
a713db22 | 205 | n1 = 0; |
206 | n2 = 0; | |
207 | //cathode 0 | |
208 | fMUONData->ResetDigits(); | |
209 | fMUONData->GetCathode(0); | |
210 | muonDigits = fMUONData->Digits(ich); | |
211 | ndig = muonDigits->GetEntriesFast(); | |
212 | TClonesArray &lDigit = *digAll; | |
213 | ||
214 | idDE_prev = 0; | |
215 | ||
216 | for (k = 0; k < ndig; k++) { | |
217 | ||
218 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
219 | new(lDigit[n1++]) AliMUONDigit(*digit); | |
220 | idDE = digit->DetElemId(); | |
f7db2071 | 221 | if (idDE != idDE_prev) { |
a713db22 | 222 | id.AddAt(idDE,n2++); |
f7db2071 | 223 | } |
a713db22 | 224 | idDE_prev = idDE; |
225 | } | |
226 | ||
227 | //cathode 1 | |
228 | fMUONData->ResetDigits(); | |
229 | fMUONData->GetCathode(1); | |
230 | muonDigits = fMUONData->Digits(ich); | |
231 | ndig = muonDigits->GetEntriesFast(); | |
232 | ||
f7db2071 | 233 | Int_t idSize = n2; |
234 | ||
a713db22 | 235 | for (k = 0; k < ndig; k++) { |
236 | ||
237 | digit = (AliMUONDigit*) muonDigits->UncheckedAt(k); | |
238 | new(lDigit[n1++]) AliMUONDigit(*digit); | |
239 | idDE = digit->DetElemId(); | |
240 | flag = 0; | |
241 | ||
f7db2071 | 242 | // looking for new idDE in cathode 1 (method to be checked CF) |
243 | for (Int_t n = 0; n < idSize; n++) { | |
244 | if (idDE == id[n]) { | |
a713db22 | 245 | flag = 1; |
246 | break; | |
247 | } | |
52c9bc11 | 248 | } |
f7db2071 | 249 | if (flag) continue; |
250 | id.AddAt(idDE,n2++); | |
a713db22 | 251 | } |
252 | ||
f7db2071 | 253 | idSize = n2; |
a713db22 | 254 | |
f7db2071 | 255 | // loop over id DE |
256 | for (idDE = 0; idDE < idSize; idDE++) { | |
a713db22 | 257 | TClonesArray &lhits1 = *dig1; |
52c9bc11 | 258 | TClonesArray &lhits2 = *dig2; |
677975f0 | 259 | dig1->Clear(); |
260 | dig2->Clear(); | |
a713db22 | 261 | n1 = n2 = 0; |
262 | ||
263 | for (k = 0; k < digAll->GetEntriesFast(); k++) { | |
264 | digit = (AliMUONDigit*) digAll->UncheckedAt(k); | |
f7db2071 | 265 | // printf("digit idDE %d\n", digit->DetElemId()); |
266 | if (id[idDE] == digit->DetElemId()) { | |
677975f0 | 267 | if (digit->Cathode() == 0) |
a713db22 | 268 | new(lhits1[n1++]) AliMUONDigit(*digit); |
269 | else | |
270 | new(lhits2[n2++]) AliMUONDigit(*digit); | |
f7db2071 | 271 | } |
52c9bc11 | 272 | } |
273 | ||
677975f0 | 274 | if (id[idDE] < 500 && id[idDE] > 299) continue; // temporary patch til St2 geometry is not yet ok (CF) |
275 | ||
a713db22 | 276 | // cluster finder |
277 | if (fRecModel) { | |
278 | AliMUONClusterInput::Instance()->SetDigits(ich, id[idDE], dig1, dig2); | |
279 | fRecModel->FindRawClusters(); | |
52c9bc11 | 280 | } |
281 | // copy into the container | |
7e4a628d | 282 | TClonesArray* tmp = fRecModel->GetRawClusters(); |
52c9bc11 | 283 | for (Int_t id = 0; id < tmp->GetEntriesFast(); id++) { |
284 | AliMUONRawCluster* pClus = (AliMUONRawCluster*) tmp->At(id); | |
285 | fMUONData->AddRawCluster(ich, *pClus); | |
286 | } | |
287 | dig1->Delete(); | |
288 | dig2->Delete(); | |
f7db2071 | 289 | } // idDE |
290 | digAll->Delete(); | |
52c9bc11 | 291 | } // for ich |
292 | delete dig1; | |
293 | delete dig2; | |
a713db22 | 294 | delete digAll; |
52c9bc11 | 295 | } |
cf464691 | 296 | |
297 | //____________________________________________________________________ | |
298 | void AliMUONClusterReconstructor::Digits2Clusters(AliRawReader* /*rawReader*/) | |
299 | { | |
300 | ||
301 | // Perform cluster finding form raw data | |
302 | ||
8c343c7c | 303 | AliFatal("clusterization not implemented for raw data input"); |
cf464691 | 304 | } |
7e4a628d | 305 | //_______________________________________________________________________ |
306 | void AliMUONClusterReconstructor::Trigger2Trigger() | |
307 | { | |
308 | // copy trigger from TreeD to TreeR | |
309 | ||
310 | fMUONData->SetTreeAddress("GLT"); | |
311 | fMUONData->GetTriggerD(); | |
312 | } | |
313 | //_______________________________________________________________________ | |
314 | void AliMUONClusterReconstructor::Trigger2Trigger(AliRawReader* /*rawReader*/) | |
315 | { | |
316 | // call the Trigger Algorithm from raw data and fill TreeR | |
317 | ||
318 | AliFatal("Trigger not implemented for raw data input"); | |
319 | ||
320 | } |