]>
Commit | Line | Data |
---|---|---|
f0c62051 | 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 * | |
354e70ca | 12 | * about the suitability of this software for any purpose. It is * |
f0c62051 | 13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | // $MpId: AliMpDDLStore.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $ | |
18 | // Category: management | |
3d1463c8 | 19 | |
20 | //----------------------------------------------------------------------------- | |
f0c62051 | 21 | // Class AliMpDDLStore |
22 | // -------------------- | |
23 | // The top container class for DDLs, det elements and bus patched | |
24 | // It provides acces to DDL, det element and bus patches objects | |
25 | // via various characteristics. | |
26 | // Authors: Ivana Hrivnacova, IPN Orsay | |
27 | // Christian Finck, SUBATECH Nantes | |
3d1463c8 | 28 | //----------------------------------------------------------------------------- |
61c370dd | 29 | |
f0c62051 | 30 | #include "AliMpDDLStore.h" |
61c370dd | 31 | #include "AliMpConstants.h" |
f0c62051 | 32 | #include "AliMpDEStore.h" |
33 | #include "AliMpDDL.h" | |
34 | #include "AliMpFiles.h" | |
35 | #include "AliMpHelper.h" | |
36 | #include "AliMpDEManager.h" | |
37 | #include "AliMpDetElement.h" | |
38 | #include "AliMpBusPatch.h" | |
61c370dd | 39 | #include "AliMpTriggerCrate.h" |
40 | #include "AliMpLocalBoard.h" | |
42d368d0 | 41 | #include "AliMpSegmentation.h" |
42 | #include "AliMpVSegmentation.h" | |
354e70ca | 43 | #include "AliMpStringObjMap.h" |
f0c62051 | 44 | #include "AliLog.h" |
45 | ||
46 | #include <Riostream.h> | |
42d368d0 | 47 | #include <TList.h> |
61c370dd | 48 | #include <TObjArray.h> |
49 | #include <TString.h> | |
50 | #include <TObjString.h> | |
5f377a9a | 51 | #include <TClass.h> |
f0c62051 | 52 | |
53 | /// \cond CLASSIMP | |
54 | ClassImp(AliMpDDLStore) | |
55 | /// \endcond | |
56 | ||
57 | AliMpDDLStore* AliMpDDLStore::fgInstance = 0; | |
58 | const Int_t AliMpDDLStore::fgkNofDDLs = 20; | |
61c370dd | 59 | const Int_t AliMpDDLStore::fgkNofTriggerDDLs = 2; |
f0c62051 | 60 | |
61 | // | |
62 | // static methods | |
63 | // | |
64 | ||
65 | //______________________________________________________________________________ | |
40c8e44b | 66 | AliMpDDLStore* AliMpDDLStore::Instance(Bool_t warn) |
f0c62051 | 67 | { |
40c8e44b | 68 | /// Create the DDL store if it does not yet exist |
69 | /// and return its instance | |
f0c62051 | 70 | |
40c8e44b | 71 | if ( ! fgInstance && warn ) { |
72 | AliWarningClass("DDL Store has not been loaded"); | |
73 | } | |
74 | ||
75 | return fgInstance; | |
76 | } | |
5f377a9a | 77 | |
78 | //______________________________________________________________________________ | |
40c8e44b | 79 | AliMpDDLStore* AliMpDDLStore::ReadData(Bool_t warn) |
5f377a9a | 80 | { |
40c8e44b | 81 | /// Load the DDL store from ASCII data files |
82 | /// and return its instance | |
5f377a9a | 83 | |
40c8e44b | 84 | if ( fgInstance ) { |
85 | if ( warn ) | |
86 | AliWarningClass("DDL Store has been already loaded"); | |
87 | return fgInstance; | |
88 | } | |
5f377a9a | 89 | |
40c8e44b | 90 | AliInfoClass("Reading DDL Store from ASCII files."); |
91 | ||
92 | fgInstance = new AliMpDDLStore(); | |
93 | return fgInstance; | |
94 | } | |
f0c62051 | 95 | |
96 | // | |
97 | // ctors, dtor | |
98 | // | |
99 | ||
100 | //______________________________________________________________________________ | |
101 | AliMpDDLStore::AliMpDDLStore() | |
40c8e44b | 102 | : TObject(), |
103 | fDDLs(fgkNofDDLs+fgkNofTriggerDDLs), // FIXEME | |
104 | fBusPatches(true), | |
105 | fTriggerCrates(true), | |
106 | fLocalBoards(true), | |
107 | fManuList12(), | |
108 | fManuBridge2(), | |
109 | fGlobalCrate(new AliMpGlobalCrate()) | |
110 | { | |
111 | /// Standard constructor | |
112 | ||
113 | AliDebug(1,""); | |
114 | fDDLs.SetOwner(true); | |
115 | fBusPatches.SetOwner(true); | |
116 | fBusPatches.SetSize(900); | |
117 | ||
118 | fTriggerCrates.SetOwner(true); | |
119 | fTriggerCrates.SetSize(16); | |
120 | ||
121 | fLocalBoards.SetOwner(true); | |
122 | fLocalBoards.SetSize(242); // included non-identied board | |
123 | ||
124 | ||
125 | // Load segmentation & DE store data | |
126 | if ( ! AliMpSegmentation::Instance(false) ) | |
127 | AliMpSegmentation::ReadData(true); | |
128 | ||
129 | // Create all detection elements | |
130 | ReadDDLs(); | |
131 | ReadTriggerDDLs(); | |
132 | SetManus(); | |
133 | SetPatchModules(); | |
134 | SetBusPatchLength(); | |
f0c62051 | 135 | } |
136 | ||
137 | //______________________________________________________________________________ | |
138 | AliMpDDLStore::AliMpDDLStore(TRootIOCtor* /*ioCtor*/) | |
40c8e44b | 139 | : TObject(), |
140 | fDDLs(), | |
141 | fBusPatches(), | |
142 | fTriggerCrates(true), | |
143 | fLocalBoards(true), | |
144 | fGlobalCrate() | |
145 | { | |
146 | /// Constructor for IO | |
f0c62051 | 147 | |
40c8e44b | 148 | AliDebug(1,""); |
f0c62051 | 149 | |
40c8e44b | 150 | fgInstance = this; |
f0c62051 | 151 | } |
152 | ||
153 | ||
154 | //______________________________________________________________________________ | |
40c8e44b | 155 | AliMpDDLStore::~AliMpDDLStore() |
f0c62051 | 156 | { |
40c8e44b | 157 | /// Destructor |
f0c62051 | 158 | |
40c8e44b | 159 | AliDebug(1,""); |
f0c62051 | 160 | |
40c8e44b | 161 | // DDL objects are deleted with fDDLs |
162 | // Bus patches objects are deleted with fBusPatches | |
163 | ||
164 | fgInstance = 0; | |
165 | delete fGlobalCrate; | |
f0c62051 | 166 | } |
167 | ||
168 | // | |
169 | // private methods | |
170 | // | |
171 | ||
42d368d0 | 172 | //______________________________________________________________________________ |
40c8e44b | 173 | Int_t AliMpDDLStore::GetManuListIndex(Int_t detElemId) const |
42d368d0 | 174 | { |
40c8e44b | 175 | /// Return the index of the manu list for given detElemId |
176 | ||
177 | return AliMpDEManager::GetChamberId(detElemId)*4 + (detElemId % 100); | |
178 | } | |
42d368d0 | 179 | |
42d368d0 | 180 | |
181 | //______________________________________________________________________________ | |
40c8e44b | 182 | Int_t AliMpDDLStore::GetBusPatchIndex(Int_t detElemId, Int_t manuId) const |
42d368d0 | 183 | { |
40c8e44b | 184 | /// Calculate the index of the buspatch from manuId |
42d368d0 | 185 | |
186 | Int_t pos = 0; | |
187 | AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); | |
188 | static Int_t manuMask = AliMpConstants::ManuMask(AliMp::kNonBendingPlane) - 1; | |
189 | ||
190 | if( stationType == AliMp::kStation345) { | |
40c8e44b | 191 | pos = (manuId & manuMask)/100; |
42d368d0 | 192 | } else { |
40c8e44b | 193 | Int_t idx = GetManuListIndex(detElemId); |
42d368d0 | 194 | |
40c8e44b | 195 | // using array defined from DetElemIdToBusPatch.dat file |
196 | for (pos = fManuList12[idx].GetSize()-1; pos >= 0; --pos) | |
197 | if ( manuId >= fManuList12[idx].At(pos)) | |
198 | break; | |
42d368d0 | 199 | } |
200 | ||
201 | return pos; | |
202 | } | |
203 | ||
f0c62051 | 204 | //______________________________________________________________________________ |
40c8e44b | 205 | Bool_t AliMpDDLStore::ReadGlobalTrigger(AliMpGlobalCrate& crate, const Char_t* globalName) |
f0c62051 | 206 | { |
40c8e44b | 207 | /// Fill trigger global crate object from ascii file |
208 | /// put the method static to be used by other class w/o initializing object | |
209 | ||
210 | TString infile; | |
211 | ||
212 | if (globalName == 0) | |
213 | infile = AliMpFiles::GlobalTriggerBoardMapping(); | |
214 | else | |
215 | infile = globalName; | |
42d368d0 | 216 | |
40c8e44b | 217 | ifstream in(infile, ios::in); |
f0c62051 | 218 | |
40c8e44b | 219 | if (!in) { |
220 | printf("Local Trigger Board Mapping File %s not found", infile.Data()); | |
221 | return kFALSE; | |
222 | } | |
f0c62051 | 223 | |
40c8e44b | 224 | TArrayI list; |
f0c62051 | 225 | |
40c8e44b | 226 | char line[255]; |
227 | in.getline(line, 255); | |
228 | TString tmp(AliMpHelper::Normalize(line)); | |
229 | ||
230 | if (!tmp.Contains(crate.GetName())) | |
231 | printf("Wrong Global Crate File"); | |
232 | ||
233 | in.getline(line, 255); | |
234 | tmp = AliMpHelper::Normalize(line); | |
235 | ||
236 | if (tmp.Contains(crate.GetJtagName())) { | |
237 | // vme addr | |
238 | in.getline(line, 255); | |
239 | TString tmp(AliMpHelper::Normalize(line)); | |
240 | ULong_t addr; | |
241 | sscanf(tmp.Data(), "%lx", &addr); | |
242 | crate.SetJtagVmeAddr(addr); | |
243 | //AliDebug(1, Form("Jtag Vme Address: 0x%x", addr)); | |
244 | ||
245 | // clk div, rx phase, read delay | |
246 | in.getline(line, 255); | |
247 | tmp = AliMpHelper::Normalize(line); | |
248 | TArrayI list; | |
249 | AliMpHelper::DecodeName(line, ' ', list); | |
250 | crate.SetJtagClockDiv(list[0]); | |
251 | crate.SetJtagRxPhase(list[1]); | |
252 | crate.SetJtagRdDelay(list[2]); | |
253 | //AliDebug(1, Form("Jtag Clock Div: %d, Rx Phase: %d, Read Delay %d", list[0], list[1], list[2])); | |
254 | ||
255 | // enable | |
256 | in.getline(line, 255); | |
257 | tmp = AliMpHelper::Normalize(line); | |
258 | AliMpHelper::DecodeName(line, ' ', list); | |
259 | UChar_t enable = 0; | |
260 | for (Int_t i = 0; i < crate.GetJtagNofLines(); ++i) | |
261 | enable |= (list[i] << i); | |
262 | crate.SetEnableJtag(enable); | |
263 | //AliDebug(1, Form("Jtag Enable: 0x%x", enable)); | |
264 | ||
265 | for (Int_t i = 0; i < crate.GetJtagNofLines(); ++i) { | |
266 | in.getline(line, 255); | |
267 | for (Int_t j = 0; j < crate.GetJtagNofLines(); ++j) { | |
268 | in.getline(line, 255); | |
269 | tmp = AliMpHelper::Normalize(line); | |
270 | crate.SetJtagCrateName(i*crate.GetJtagNofLines() + j, tmp); | |
271 | //AliDebug(1, Form("Jtag Crate Name: %s", tmp.Data())); | |
272 | } | |
273 | } | |
274 | } | |
f0c62051 | 275 | |
40c8e44b | 276 | in.getline(line, 255); |
277 | tmp = AliMpHelper::Normalize(line); | |
278 | if (tmp.Contains(crate.GetFirstDarcName())) { | |
279 | // vme addr | |
280 | in.getline(line, 255); | |
281 | TString tmp(AliMpHelper::Normalize(line)); | |
282 | ULong_t addr; | |
283 | sscanf(tmp.Data(), "%lx", &addr); | |
284 | crate.SetFirstDarcVmeAddr(addr); | |
285 | //AliDebug(1, Form("First Darc Vme Address: 0x%x", addr)); | |
286 | ||
287 | // type | |
288 | in.getline(line, 255); | |
289 | tmp = AliMpHelper::Normalize(line); | |
290 | crate.SetFirstDarcType(tmp.Atoi()); | |
291 | //AliDebug(1, Form("First Darc Type: %d", tmp.Atoi())); | |
292 | ||
293 | // enable | |
294 | in.getline(line, 255); | |
295 | UInt_t item; | |
296 | tmp = AliMpHelper::Normalize(line); | |
297 | sscanf(tmp.Data(), "%x", &item); | |
298 | crate.SetFirstDarcDisable(item); | |
299 | //AliDebug(1, Form("First Darc Enable: 0x%x", item)); | |
300 | ||
301 | // L0 | |
302 | in.getline(line, 255); | |
303 | tmp = AliMpHelper::Normalize(line); | |
304 | sscanf(tmp.Data(), "%x", &item); | |
305 | crate.SetFirstDarcL0Delay(item); | |
306 | //AliDebug(1, Form("First Darc L0 Delay: 0x%x", item)); | |
307 | ||
308 | // L1 | |
309 | in.getline(line, 255); | |
310 | tmp = AliMpHelper::Normalize(line); | |
311 | sscanf(tmp.Data(), "%x", &item); | |
312 | crate.SetFirstDarcL1TimeOut(item); | |
313 | //AliDebug(1, Form("First Darc L1 Time Out: 0x%x", item)); | |
314 | } | |
f0c62051 | 315 | |
40c8e44b | 316 | in.getline(line, 255); |
317 | tmp = AliMpHelper::Normalize(line); | |
318 | if (tmp.Contains(crate.GetSecondDarcName())) { | |
319 | // vme addr | |
320 | in.getline(line, 255); | |
321 | TString tmp(AliMpHelper::Normalize(line)); | |
322 | ULong_t addr; | |
323 | sscanf(tmp.Data(), "%lx", &addr); | |
324 | crate.SetSecondDarcVmeAddr(addr); | |
325 | //AliDebug(1, Form("Second Darc Vme Address: 0x%x", addr)); | |
326 | ||
327 | // type | |
328 | in.getline(line, 255); | |
329 | tmp = AliMpHelper::Normalize(line); | |
330 | crate.SetSecondDarcType(tmp.Atoi()); | |
331 | //AliDebug(1, Form("Second Darc Type: %d", tmp.Atoi())); | |
332 | ||
333 | // enable | |
334 | in.getline(line, 255); | |
335 | UInt_t item; | |
336 | tmp = AliMpHelper::Normalize(line); | |
337 | sscanf(tmp.Data(), "%x", &item); | |
338 | crate.SetSecondDarcDisable(item); | |
339 | //AliDebug(1, Form("Second Darc Enable: 0x%x", item)); | |
340 | ||
341 | // L0 | |
342 | in.getline(line, 255); | |
343 | tmp = AliMpHelper::Normalize(line); | |
344 | sscanf(tmp.Data(), "%x", &item); | |
345 | crate.SetSecondDarcL0Delay(item); | |
346 | //AliDebug(1, Form("Second Darc L0 Delay: 0x%x", item)); | |
347 | ||
348 | // L1 | |
349 | in.getline(line, 255); | |
350 | tmp = AliMpHelper::Normalize(line); | |
351 | sscanf(tmp.Data(), "%x", &item); | |
352 | crate.SetSecondDarcL1TimeOut(item); | |
353 | //AliDebug(1, Form("Second Darc L1 Time Out: 0x%x", item)); | |
354 | } | |
f0c62051 | 355 | |
40c8e44b | 356 | in.getline(line, 255); |
357 | tmp = AliMpHelper::Normalize(line); | |
358 | if (tmp.Contains(crate.GetGlobalName())) { | |
359 | in.getline(line, 255); | |
360 | TString tmp(AliMpHelper::Normalize(line)); | |
361 | ULong_t addr; | |
362 | sscanf(tmp.Data(), "%lx", &addr); | |
363 | crate.SetGlobalVmeAddr(addr); | |
364 | //AliDebug(1, Form("Global Vme Address: 0x%x", addr)); | |
365 | ||
366 | for (Int_t i = 0; i < crate.GetGlobalNofRegisters(); ++i) { | |
367 | in.getline(line, 255); | |
368 | TString tmp(AliMpHelper::Normalize(line)); | |
369 | UInt_t reg; | |
370 | sscanf(tmp.Data(), "%x", ®); | |
371 | crate.SetGlobalRegister(i, reg); | |
372 | //AliDebug(1, Form("Global Register %d: 0x%x", i, reg)); | |
373 | } | |
374 | } | |
f0c62051 | 375 | |
40c8e44b | 376 | in.getline(line, 255); |
377 | tmp = AliMpHelper::Normalize(line); | |
378 | if (tmp.Contains(crate.GetFetName())) { | |
379 | in.getline(line, 255); | |
380 | TString tmp(AliMpHelper::Normalize(line)); | |
381 | ULong_t addr; | |
382 | sscanf(tmp.Data(), "%lx", &addr); | |
383 | crate.SetFetVmeAddr(addr); | |
384 | //AliDebug(1, Form("Fet Vme Address: 0x%x", addr)); | |
385 | ||
386 | for (Int_t i = 0; i < crate.GetFetNofRegisters(); ++i) { | |
387 | in.getline(line, 255); | |
388 | TString tmp(AliMpHelper::Normalize(line)); | |
389 | UInt_t reg; | |
390 | sscanf(tmp.Data(), "%x", ®); | |
391 | crate.SetFetRegister(i, reg); | |
392 | //AliDebug(1, Form("Fet Register %d: 0x%x", i, reg)); | |
393 | } | |
394 | } | |
f0c62051 | 395 | |
40c8e44b | 396 | return kTRUE; |
f0c62051 | 397 | } |
61c370dd | 398 | //______________________________________________________________________________ |
40c8e44b | 399 | Bool_t AliMpDDLStore::ReadDDLs() |
61c370dd | 400 | { |
40c8e44b | 401 | /// Read ddl <-> bus patch file |
354e70ca | 402 | |
40c8e44b | 403 | TString infile = AliMpFiles::BusPatchFilePath(); |
61c370dd | 404 | |
61c370dd | 405 | ifstream in(infile, ios::in); |
61c370dd | 406 | if (!in) { |
40c8e44b | 407 | AliErrorStream() << "Data file " << infile << " not found."; |
408 | return false; | |
61c370dd | 409 | } |
61c370dd | 410 | |
411 | char line[255]; | |
61c370dd | 412 | |
40c8e44b | 413 | while ( in.getline(line,255) ) { |
61c370dd | 414 | |
40c8e44b | 415 | if ( line[0] == '#' ) |
416 | continue; | |
61c370dd | 417 | |
40c8e44b | 418 | TString tmp(AliMpHelper::Normalize(line)); |
61c370dd | 419 | |
40c8e44b | 420 | TObjArray* stringList = tmp.Tokenize(TString(" ")); |
354e70ca | 421 | |
40c8e44b | 422 | TString sDE = ((TObjString*)stringList->At(0))->GetString(); |
423 | Int_t idDE = atoi(sDE.Data()); | |
354e70ca | 424 | |
40c8e44b | 425 | if ( ! AliMpDEManager::IsValidDetElemId(idDE, false) ) { |
426 | AliErrorStream() << "DetElemId "<< idDE << " not valid." << endl; | |
427 | return false; | |
428 | } | |
354e70ca | 429 | |
40c8e44b | 430 | TString busPatch = ((TObjString*)stringList->At(1))->GetString(); |
354e70ca | 431 | |
432 | ||
40c8e44b | 433 | TString sDDL = ((TObjString*)stringList->At(2))->GetString(); |
434 | Int_t iDDL = atoi(sDDL.Data()); | |
61c370dd | 435 | |
40c8e44b | 436 | if ( iDDL < 0 || iDDL >= fgkNofDDLs ) { |
437 | AliErrorStream() << "DDL id "<< iDDL << " outside limits." << endl; | |
438 | return false; | |
439 | } | |
61c370dd | 440 | |
40c8e44b | 441 | AliDebugStream(3) |
442 | << "idDE " << idDE << " buspatch " << busPatch.Data() << " iDDL " << iDDL | |
443 | << endl; | |
61c370dd | 444 | |
40c8e44b | 445 | // reading 1st manu Id for each bus patch (station 1 & 2) |
446 | if(AliMpDEManager::GetStationType(idDE) != AliMp::kStation345) { | |
61c370dd | 447 | |
40c8e44b | 448 | TString sManu = ((TObjString*)stringList->At(3))->GetString(); |
449 | AliMpHelper::DecodeName(sManu,',',fManuList12[GetManuListIndex(idDE)]); | |
61c370dd | 450 | |
40c8e44b | 451 | if(AliMpDEManager::GetStationType(idDE) == AliMp::kStation2) { |
452 | TString sManuBridge = ((TObjString*)stringList->At(4))->GetString(); | |
453 | AliMpHelper::DecodeName(sManuBridge,',',fManuBridge2[GetManuListIndex(idDE)]); | |
454 | } | |
61c370dd | 455 | |
40c8e44b | 456 | } |
61c370dd | 457 | |
40c8e44b | 458 | delete stringList; |
61c370dd | 459 | |
40c8e44b | 460 | AliMpDDL* ddl = GetDDL(iDDL, false); |
461 | if ( !ddl) { | |
462 | ddl = new AliMpDDL(iDDL); | |
463 | fDDLs.AddAt(ddl, iDDL); | |
464 | } | |
465 | ddl->AddDE(idDE); | |
466 | ||
467 | TArrayI busPatchList; | |
468 | // decoding range of buspatch | |
469 | AliMpHelper::DecodeName(busPatch,';',busPatchList); | |
470 | ||
471 | // Update DE | |
472 | AliMpDetElement* de = AliMpDEManager::GetDetElement(idDE); | |
473 | de->SetDdlId(iDDL); | |
474 | // filling buspatch -> idDE | |
475 | for (Int_t i = 0; i < busPatchList.GetSize(); i++) { | |
476 | fBusPatches.Add(busPatchList[i], | |
477 | new AliMpBusPatch(busPatchList[i], idDE, iDDL)); | |
478 | de->AddBusPatch(busPatchList[i]); | |
479 | } | |
480 | } | |
481 | ||
482 | // Fill bus patch Ids array in DDLs now | |
483 | for ( Int_t i=0; i<fDDLs.GetEntriesFast(); i++ ) { | |
484 | AliMpDDL* ddl = (AliMpDDL*) fDDLs.At(i); | |
485 | ddl->FillBusPatchIds(); | |
61c370dd | 486 | } |
40c8e44b | 487 | |
488 | in.close(); | |
489 | return true; | |
490 | } | |
491 | //______________________________________________________________________________ | |
492 | Bool_t AliMpDDLStore::ReadTriggerDDLs() | |
493 | { | |
494 | /// create trigger DDL object and Global crate object | |
495 | ||
496 | if (!ReadGlobalTrigger(*fGlobalCrate)) return false; | |
497 | if (!ReadLocalTrigger()) return false; | |
498 | ||
499 | return true; | |
500 | } | |
501 | ||
502 | //______________________________________________________________________________ | |
503 | Bool_t AliMpDDLStore::ReadLocalTrigger() | |
504 | { | |
505 | /// create trigger DDL object ddl<->Crate<->local board | |
506 | ||
507 | ReadGlobalTrigger(*fGlobalCrate); | |
354e70ca | 508 | |
40c8e44b | 509 | Int_t iDDL = -1; |
354e70ca | 510 | |
40c8e44b | 511 | TString infile = AliMpFiles::LocalTriggerBoardMapping(); |
354e70ca | 512 | |
40c8e44b | 513 | ifstream in(infile, ios::in); |
514 | ||
515 | if (!in) { | |
516 | AliError(Form("Local Trigger Board Mapping File %s not found", infile.Data())); | |
517 | return kFALSE; | |
354e70ca | 518 | } |
519 | ||
40c8e44b | 520 | AliMpLocalBoard* board = 0x0; |
521 | AliMpTriggerCrate* crate = 0x0; | |
354e70ca | 522 | |
61c370dd | 523 | |
40c8e44b | 524 | Int_t localBoardId = 0; |
525 | TArrayI list; | |
526 | UShort_t crateId, mask; | |
527 | Int_t mode, coincidence; | |
528 | ||
529 | char line[80]; | |
530 | ||
531 | while (!in.eof()) | |
532 | { | |
533 | in.getline(line,80); | |
534 | if (!strlen(line)) break; | |
535 | TString crateName(AliMpHelper::Normalize(line)); | |
536 | ||
537 | in.getline(line,80); | |
538 | sscanf(line,"%hx",&crateId); | |
539 | ||
540 | in.getline(line,80); | |
541 | sscanf(line,"%d",&mode); | |
542 | ||
543 | in.getline(line,80); | |
544 | sscanf(line,"%d",&coincidence); | |
545 | ||
546 | in.getline(line,80); | |
547 | sscanf(line,"%hx",&mask); | |
548 | ||
549 | // determine ddl number vs crate side | |
550 | if (crateName.Contains("R")) | |
551 | iDDL = fgkNofDDLs; // starts where tracker ends | |
552 | else | |
553 | iDDL = fgkNofDDLs + 1; | |
554 | ||
555 | AliMpDDL* ddl = GetDDL(iDDL, false); | |
556 | if ( !ddl) { | |
557 | ddl = new AliMpDDL(iDDL); | |
558 | fDDLs.AddAt(ddl, iDDL); | |
559 | } | |
560 | if (!GetTriggerCrate(crateName.Data(), false)) { | |
561 | crate = new AliMpTriggerCrate(crateName.Data(), crateId, mask, mode, coincidence); | |
562 | crate->SetDdlId(iDDL); | |
563 | fTriggerCrates.Add(crateName.Data(), crate); | |
564 | } | |
565 | ||
566 | // add trigger crate number for given ddl if not present | |
567 | if ( !ddl->HasTriggerCrateId(crateId) ) | |
568 | ddl->AddTriggerCrate(crateId); | |
569 | ||
570 | ||
571 | Char_t localBoardName[20]; | |
572 | Int_t slot; | |
573 | UInt_t switches; | |
574 | ||
575 | for ( Int_t i = 0; i < AliMpConstants::LocalBoardNofChannels(); ++i ) | |
576 | { | |
577 | if ( (mask >> i ) & 0x1 ) | |
578 | { | |
579 | in.getline(line,80); | |
580 | sscanf(line,"%02d %s %03d %03x",&slot,localBoardName,&localBoardId,&switches); | |
581 | board = new AliMpLocalBoard(localBoardId, localBoardName, slot); | |
582 | board->SetSwitch(switches); | |
583 | board->SetCrate(crateName); | |
584 | ||
585 | if (localBoardId > AliMpConstants::NofLocalBoards()) | |
586 | board->SetNotified(false); // copy cards | |
587 | ||
588 | crate->AddLocalBoard(localBoardId); | |
589 | ||
590 | list.Reset(); | |
591 | AliMpDDL* ddl = GetDDL(iDDL, true); | |
592 | ||
593 | // add DE for local board and DDL | |
594 | in.getline(line,80); | |
595 | TString tmp(AliMpHelper::Normalize(line)); | |
596 | AliMpHelper::DecodeName(tmp,' ',list); | |
597 | ||
598 | for (Int_t i = 0; i < list.GetSize(); ++i) { | |
599 | ||
600 | if (list[i]) { // skip copy card | |
601 | AliMpDetElement* de = AliMpDEManager::GetDetElement(list[i]); | |
602 | if (de->GetDdlId() == -1) | |
603 | de->SetDdlId(iDDL); | |
604 | } | |
605 | board->AddDE(list[i]); | |
606 | if(!ddl->HasDEId(list[i])) | |
607 | ddl->AddDE(list[i]); | |
608 | } | |
609 | ||
610 | // set copy number and transverse connector | |
611 | in.getline(line,80); | |
612 | tmp = AliMpHelper::Normalize(line); | |
613 | AliMpHelper::DecodeName(tmp,' ',list); | |
614 | ||
615 | board->SetInputXfrom(list[0]); | |
616 | board->SetInputXto(list[1]); | |
617 | ||
618 | board->SetInputYfrom(list[2]); | |
619 | board->SetInputYto(list[3]); | |
620 | ||
621 | board->SetTC(list[4]); | |
622 | ||
623 | // add local board into map | |
624 | fLocalBoards.Add(board->GetId(), board); | |
625 | } | |
626 | } | |
627 | ||
628 | } | |
61c370dd | 629 | return kTRUE; |
630 | } | |
631 | ||
42d368d0 | 632 | //______________________________________________________________________________ |
40c8e44b | 633 | Bool_t AliMpDDLStore::SetManus() { |
634 | /// Set manus for each bus patch | |
42d368d0 | 635 | |
636 | Int_t manuMask = AliMpConstants::ManuMask(AliMp::kNonBendingPlane) - 1; | |
637 | ||
40c8e44b | 638 | // loop over DDL |
42d368d0 | 639 | for (Int_t iDDL = 0; iDDL < fgkNofDDLs; ++iDDL) { |
640 | ||
40c8e44b | 641 | AliDebug(3, Form("DDL # %d\n", iDDL)); |
42d368d0 | 642 | |
40c8e44b | 643 | AliMpDDL* ddl = GetDDL(iDDL); |
42d368d0 | 644 | |
40c8e44b | 645 | // loop over DE in the given DDL |
646 | for (Int_t detElemIdx = 0; detElemIdx < ddl->GetNofDEs(); ++detElemIdx) { | |
42d368d0 | 647 | |
40c8e44b | 648 | Int_t detElemId = ddl->GetDEId(detElemIdx); |
42d368d0 | 649 | |
40c8e44b | 650 | AliMpDetElement* detElement = GetDetElement(detElemId); |
42d368d0 | 651 | |
40c8e44b | 652 | AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); |
42d368d0 | 653 | |
654 | ||
40c8e44b | 655 | // list of manu per DE on both cathode |
656 | TList manuList; | |
657 | for ( Int_t cath = 0; cath < 2 ; ++cath ) { | |
658 | const AliMpVSegmentation* seg | |
659 | = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); | |
42d368d0 | 660 | |
40c8e44b | 661 | AliMp::PlaneType planeType = detElement->GetPlaneType(AliMp::GetCathodType(cath)); |
42d368d0 | 662 | |
40c8e44b | 663 | TArrayI manus; |
664 | seg->GetAllElectronicCardIDs(manus); | |
42d368d0 | 665 | |
40c8e44b | 666 | // filling TList manu |
667 | for ( Int_t im = 0; im < manus.GetSize(); ++im ) { | |
42d368d0 | 668 | |
40c8e44b | 669 | AliMpIntPair* manu = 0x0; |
670 | if( stationType == AliMp::kStation345) | |
671 | manu = new AliMpIntPair((manus[im] & manuMask), planeType, kTRUE); //remove offset for NB | |
672 | else | |
673 | manu = new AliMpIntPair(manus[im], planeType, kTRUE); //keep offset for NB | |
42d368d0 | 674 | |
40c8e44b | 675 | manuList.Add(manu); |
42d368d0 | 676 | |
40c8e44b | 677 | detElement->AddManu(manus[im]); |
678 | } | |
679 | }// cathode | |
680 | ||
681 | manuList.Sort(); // sort regardless B or NB plane | |
42d368d0 | 682 | |
40c8e44b | 683 | // filling manu to the corresponding buspatch |
684 | for (Int_t iEntry = 0; iEntry < manuList.GetEntries(); ++iEntry) { | |
42d368d0 | 685 | |
40c8e44b | 686 | AliMpIntPair* manuPtr = (AliMpIntPair*)manuList.At(iEntry); |
42d368d0 | 687 | |
40c8e44b | 688 | Int_t manuId = manuPtr->GetFirst(); |
689 | Int_t pos = GetBusPatchIndex(detElemId, manuId); | |
42d368d0 | 690 | |
40c8e44b | 691 | if (pos > detElement->GetNofBusPatches()) { |
692 | AliError(Form("pos greater %d than size %d manuId %d detElemId %d \n", | |
693 | pos, detElement->GetNofBusPatches(), manuId, detElemId)); | |
694 | return false; | |
695 | } | |
696 | ||
697 | // get buspatch and fill manus | |
698 | Int_t busPatchId = detElement->GetBusPatchId(pos); | |
699 | AliMpBusPatch* busPatch = GetBusPatch(busPatchId); | |
700 | ||
701 | if( stationType == AliMp::kStation345) { | |
702 | ||
703 | if (manuPtr->GetSecond()) | |
704 | busPatch->AddManu(manuId+manuMask+1); // add offset again after sorted | |
705 | else | |
706 | busPatch->AddManu(manuId); | |
707 | ||
708 | } else { | |
709 | ||
710 | busPatch->AddManu(manuId); | |
711 | ||
712 | } | |
713 | } | |
714 | ||
715 | manuList.Delete(); | |
716 | ||
717 | if (AliDebugLevel() == 3) { | |
718 | ||
719 | // print out for checking | |
720 | for(Int_t pos = 0; pos < detElement->GetNofBusPatches(); ++pos) { | |
721 | Int_t busPatchId = detElement->GetBusPatchId(pos); | |
722 | AliMpBusPatch* busPatch = GetBusPatch(busPatchId); | |
723 | printf("BusPatch: %d\n", busPatch->GetId()); | |
724 | for (Int_t iEntry = 0; iEntry < busPatch->GetNofManus(); ++iEntry) | |
725 | printf("manu Id: %d\n", busPatch->GetManuId(iEntry)); | |
726 | } | |
727 | } | |
728 | ||
729 | } // detection element loop | |
42d368d0 | 730 | }// DDL loop |
731 | ||
732 | return true; | |
733 | } | |
f0c62051 | 734 | |
dbc1e34c | 735 | //______________________________________________________________________________ |
40c8e44b | 736 | Bool_t AliMpDDLStore::SetPatchModules() { |
737 | /// Compute the number of manu per PCB for each buspatch | |
dbc1e34c | 738 | |
0f30c458 | 739 | AliMpDEIterator it; |
740 | Bool_t result = true; | |
dbc1e34c | 741 | |
0f30c458 | 742 | for ( it.First(); !it.IsDone(); it.Next() ) { |
dbc1e34c | 743 | |
40c8e44b | 744 | AliMpDetElement* detElement = it.CurrentDE(); |
745 | ||
746 | for (Int_t i = 0; i < detElement->GetNofBusPatches(); ++i) { | |
747 | AliMpBusPatch* busPatch = GetBusPatch(detElement->GetBusPatchId(i)); | |
748 | Bool_t newResult = false; | |
749 | Int_t idDE = busPatch->GetDEId(); | |
750 | ||
751 | if (AliMpDEManager::GetStationType(idDE) == AliMp::kStation2 ) | |
752 | newResult = busPatch->SetNofManusPerModule(fManuBridge2[GetManuListIndex(idDE)].At(i)); | |
753 | else | |
754 | newResult = busPatch->SetNofManusPerModule(); | |
755 | } | |
0f30c458 | 756 | } |
757 | ||
758 | return result; | |
759 | } | |
760 | ||
761 | //______________________________________________________________________________ | |
40c8e44b | 762 | Bool_t AliMpDDLStore::SetBusPatchLength() { |
763 | /// read the buspatch length file and set buspatch length | |
0f30c458 | 764 | |
765 | TString infile = AliMpFiles::BusPatchLengthFilePath(); | |
766 | ifstream in(infile, ios::in); | |
767 | if (!in) { | |
40c8e44b | 768 | AliErrorStream() << "Data file " << infile << " not found."; |
769 | return false; | |
770 | } | |
0f30c458 | 771 | char line[255]; |
772 | ||
773 | for (Int_t iDDL = 0; iDDL < fgkNofDDLs; ++iDDL ) { | |
40c8e44b | 774 | AliMpDDL* ddl = GetDDL(iDDL); |
0f30c458 | 775 | |
40c8e44b | 776 | for (Int_t iBusPatch = 0; iBusPatch < ddl->GetNofBusPatches(); ++iBusPatch) { |
0f30c458 | 777 | |
40c8e44b | 778 | do { |
779 | if (!in.getline(line,255)) { | |
780 | AliWarning(Form("Wrong size in bus patch length file; index %d DDL %d", | |
781 | iBusPatch, iDDL)); | |
782 | return false; | |
783 | } | |
784 | } while(line[0] == '#'); | |
d9fc467c | 785 | |
40c8e44b | 786 | TString tmp(AliMpHelper::Normalize(line)); |
d9fc467c | 787 | |
40c8e44b | 788 | TObjArray* stringList = tmp.Tokenize(TString(" ")); |
d9fc467c | 789 | |
40c8e44b | 790 | TString sLocalBusId = ((TObjString*)stringList->At(0))->GetString(); |
791 | Int_t localBusId = sLocalBusId.Atoi(); | |
d9fc467c | 792 | |
40c8e44b | 793 | TString sLength = ((TObjString*)stringList->At(1))->GetString(); |
794 | Float_t length = sLength.Atof(); | |
0f30c458 | 795 | |
40c8e44b | 796 | delete stringList; |
797 | ||
798 | if (localBusId != iBusPatch + 1) | |
799 | AliWarning(Form("Wrong local buspatch id %d instead of %d", iBusPatch+1, localBusId)); | |
800 | ||
801 | Int_t busPatchId = ddl->GetBusPatchId(iBusPatch); | |
802 | AliMpBusPatch* busPatch = GetBusPatch(busPatchId); | |
803 | busPatch->SetCableLength(length); | |
804 | } | |
0f30c458 | 805 | } |
806 | ||
807 | return true; | |
dbc1e34c | 808 | } |
809 | ||
0f30c458 | 810 | |
61c370dd | 811 | //________________________________________________________________ |
40c8e44b | 812 | Int_t AliMpDDLStore::GetLocalBoardId(TString name) const { |
813 | /// return the first board with a given side and line | |
61c370dd | 814 | |
40c8e44b | 815 | TExMapIter i = fLocalBoards.GetIterator(); |
61c370dd | 816 | Long_t key, value; |
817 | while ( i.Next(key, value) ) { | |
40c8e44b | 818 | AliMpLocalBoard* local = (AliMpLocalBoard*)value; |
61c370dd | 819 | |
40c8e44b | 820 | TString tmp(&local->GetName()[4], 2); |
821 | if (name.Contains(tmp)) | |
822 | if (name[0] == local->GetName()[0]) | |
823 | return local->GetId(); | |
61c370dd | 824 | } |
825 | ||
826 | return 0; | |
827 | ||
828 | } | |
dbc1e34c | 829 | |
f0c62051 | 830 | // |
831 | // public methods | |
832 | // | |
833 | ||
834 | ||
835 | //______________________________________________________________________________ | |
40c8e44b | 836 | AliMpDDL* AliMpDDLStore::GetDDL(Int_t ddlId, Bool_t warn) const { |
837 | /// Return DDL for given ddlId | |
f0c62051 | 838 | |
40c8e44b | 839 | AliMpDDL* ddl |
f0c62051 | 840 | = (AliMpDDL*)fDDLs.At(ddlId); |
40c8e44b | 841 | |
842 | if ( ! ddl && warn ) { | |
843 | AliErrorStream() | |
f0c62051 | 844 | << "DDL with Id = " << ddlId << " not defined." << endl; |
40c8e44b | 845 | } |
f0c62051 | 846 | |
40c8e44b | 847 | return ddl; |
848 | } | |
f0c62051 | 849 | |
850 | //______________________________________________________________________________ | |
40c8e44b | 851 | AliMpDetElement* AliMpDDLStore::GetDetElement(Int_t detElemId, Bool_t warn) const { |
852 | /// Return detection element with given detElemId | |
f0c62051 | 853 | |
40c8e44b | 854 | if ( ! AliMpDEStore::Instance() ) { |
855 | AliFatal("DE Store has not been loaded."); | |
856 | return 0; | |
857 | } | |
24f9bd97 | 858 | |
40c8e44b | 859 | return AliMpDEStore::Instance()->GetDetElement(detElemId, warn); |
860 | } | |
f0c62051 | 861 | |
862 | //______________________________________________________________________________ | |
40c8e44b | 863 | AliMpBusPatch* AliMpDDLStore::GetBusPatch(Int_t busPatchId, Bool_t warn) const { |
864 | /// Return bus patch with given Id | |
f0c62051 | 865 | |
40c8e44b | 866 | AliMpBusPatch* busPatch |
f0c62051 | 867 | = (AliMpBusPatch*) fBusPatches.GetValue(busPatchId); |
40c8e44b | 868 | |
869 | if ( ! busPatch && warn ) { | |
870 | AliErrorStream() | |
f0c62051 | 871 | << "Bus patch with Id = " << busPatchId << " not defined." << endl; |
40c8e44b | 872 | } |
f0c62051 | 873 | |
40c8e44b | 874 | return busPatch; |
875 | } | |
f0c62051 | 876 | |
61c370dd | 877 | //______________________________________________________________________________ |
40c8e44b | 878 | AliMpLocalBoard* AliMpDDLStore::GetLocalBoard(Int_t localBoardId, Bool_t warn) const { |
879 | /// Return bus patch with given Id | |
61c370dd | 880 | |
40c8e44b | 881 | AliMpLocalBoard* localBoard |
61c370dd | 882 | = (AliMpLocalBoard*) fLocalBoards.GetValue(localBoardId); |
40c8e44b | 883 | |
884 | if ( ! localBoard && warn ) { | |
885 | AliErrorStream() | |
61c370dd | 886 | << "Local board with Id = " << localBoardId << " not defined." << endl; |
40c8e44b | 887 | } |
61c370dd | 888 | |
40c8e44b | 889 | return localBoard; |
890 | } | |
61c370dd | 891 | |
892 | //______________________________________________________________________________ | |
40c8e44b | 893 | AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(TString name, Bool_t warn) const { |
894 | /// Return trigger crate with given name | |
61c370dd | 895 | |
40c8e44b | 896 | AliMpTriggerCrate* crate |
897 | = (AliMpTriggerCrate*) fTriggerCrates.GetValue(name.Data()); | |
898 | ||
899 | if ( ! crate && warn ) { | |
900 | AliErrorStream() | |
61c370dd | 901 | << "Trigger crate with name = " << name.Data() << " not defined." << endl; |
40c8e44b | 902 | } |
61c370dd | 903 | |
40c8e44b | 904 | return crate; |
905 | } | |
61c370dd | 906 | |
907 | //______________________________________________________________________________ | |
40c8e44b | 908 | AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(Int_t ddlId, Int_t index, Bool_t warn) const { |
909 | /// Return trigger crate with given ddl and index crate | |
61c370dd | 910 | |
40c8e44b | 911 | if (ddlId == 0 || ddlId == 1) |
912 | ddlId += fgkNofDDLs; | |
fbd38b34 | 913 | |
40c8e44b | 914 | AliMpDDL* ddl = GetDDL(ddlId, warn); |
915 | if ( ! ddl ) | |
916 | return 0; | |
917 | ||
918 | if ( index >= ddl->GetNofTriggerCrates() ) { | |
919 | AliError(Form("crate id %d greater than array[%d]", index, ddl->GetNofTriggerCrates())); | |
920 | return 0; | |
921 | } | |
922 | ||
923 | TString name = AliMpTriggerCrate::GenerateName(index, ddlId, fgkNofDDLs); | |
924 | ||
925 | return GetTriggerCrate(name, warn); | |
926 | } | |
61c370dd | 927 | |
f0c62051 | 928 | //______________________________________________________________________________ |
40c8e44b | 929 | Int_t AliMpDDLStore::GetDEfromBus(Int_t busPatchId) const { |
930 | /// Return detection element Id for given busPatchId | |
f0c62051 | 931 | |
40c8e44b | 932 | AliMpBusPatch* busPatch = GetBusPatch(busPatchId); |
933 | ||
934 | if ( ! busPatch ) { | |
935 | AliErrorStream() | |
f0c62051 | 936 | << "Bus patch with Id = " << busPatchId << " not defined." << endl; |
40c8e44b | 937 | return 0; |
938 | } | |
f0c62051 | 939 | |
40c8e44b | 940 | return busPatch->GetDEId(); |
941 | } | |
f0c62051 | 942 | |
61c370dd | 943 | //______________________________________________________________________________ |
40c8e44b | 944 | Int_t AliMpDDLStore::GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const { |
945 | /// Return detElemId for local board Id and chamber id. | |
61c370dd | 946 | |
40c8e44b | 947 | AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId); |
948 | ||
949 | if ( ! localBoard ) { | |
950 | AliErrorStream() | |
61c370dd | 951 | << "Loacl board with Id = " << localBoardId << " not defined." << endl; |
40c8e44b | 952 | return 0; |
953 | } | |
61c370dd | 954 | |
40c8e44b | 955 | return localBoard->GetDEIdByChamber(chamberId); |
61c370dd | 956 | } |
957 | ||
f0c62051 | 958 | //______________________________________________________________________________ |
40c8e44b | 959 | Int_t AliMpDDLStore::GetDDLfromBus(Int_t busPatchId) const { |
960 | /// Return DDL Id for given busPatchId | |
f0c62051 | 961 | |
40c8e44b | 962 | AliMpBusPatch* busPatch = GetBusPatch(busPatchId); |
963 | ||
964 | if ( ! busPatch ) { | |
965 | AliErrorStream() | |
f0c62051 | 966 | << "Bus patch with Id = " << busPatchId << " not defined." << endl; |
40c8e44b | 967 | return 0; |
968 | } | |
f0c62051 | 969 | |
40c8e44b | 970 | return busPatch->GetDdlId(); |
971 | } | |
f0c62051 | 972 | |
42d368d0 | 973 | //______________________________________________________________________________ |
40c8e44b | 974 | Int_t AliMpDDLStore::GetBusPatchId(Int_t detElemId, Int_t manuId) const { |
975 | /// Return bus patch for a given manuId | |
976 | ||
977 | AliMpDetElement* detElement = GetDetElement(detElemId); | |
978 | Int_t pos = GetBusPatchIndex(detElemId, manuId); | |
979 | ||
980 | if ( pos > detElement->GetNofBusPatches() ) { | |
981 | AliErrorStream() | |
982 | << "Pos = " << pos | |
983 | << " greater than the size = " << detElement->GetNofBusPatches() | |
984 | << " for detElemId = " << detElemId | |
985 | << " manuId = " << manuId << endl; | |
986 | return -1; | |
987 | } | |
42d368d0 | 988 | |
40c8e44b | 989 | return detElement->GetBusPatchId(pos); |
990 | } | |
42d368d0 | 991 | |
f0c62051 | 992 | //______________________________________________________________________________ |
40c8e44b | 993 | AliMpIntPair AliMpDDLStore::GetDetElemIdManu(Int_t manuSerial) const { |
994 | /// Return the detElemId and manuId for given serial manu number | |
f0c62051 | 995 | |
40c8e44b | 996 | if ( ! AliMpDEStore::Instance() ) { |
997 | AliFatal("DE Store has not been loaded."); | |
998 | return AliMpIntPair::Invalid(); | |
999 | } | |
24f9bd97 | 1000 | |
40c8e44b | 1001 | return AliMpDEStore::Instance()->GetDetElemIdManu(manuSerial); |
1002 | } | |
92faf71f | 1003 | |
1004 | //______________________________________________________________________________ | |
40c8e44b | 1005 | void AliMpDDLStore::PrintAllManu() const { |
1006 | /// Print all manu Ids and their serial numbers sorted by detection element | |
1007 | /// and bus patch. \n | |
1008 | /// As serial manu numbers are filled in a different way than manu Ids this | |
1009 | /// printing allows to check that both ways are consistent | |
1010 | ||
1011 | // Loop over DE | |
1012 | AliMpDEIterator it; | |
1013 | for ( it.First(); ! it.IsDone(); it.Next() ) { | |
1014 | AliMpDetElement* de = it.CurrentDE(); | |
1015 | cout << "DE: " << de->GetId() << endl; | |
1016 | ||
1017 | // Loop over bus patches in this DE | |
1018 | for ( Int_t i=0; i< de->GetNofBusPatches(); ++i ) { | |
1019 | ||
1020 | AliMpBusPatch* busPatch = GetBusPatch(de->GetBusPatchId(i)); | |
1021 | cout << " busPatch: " << busPatch->GetId() << endl; | |
1022 | ||
1023 | cout << " Manu : "; | |
1024 | for ( Int_t j=0; j<busPatch->GetNofManus(); ++j ) { | |
1025 | cout << std::setw(6) << busPatch->GetManuId(j) << " "; | |
1026 | } | |
1027 | cout << endl; | |
1028 | ||
1029 | cout << " Manu serial: "; | |
1030 | for ( Int_t k=0; k<busPatch->GetNofManus(); ++k ) { | |
1031 | cout << std::setw(6) << de->GetManuSerialFromId(busPatch->GetManuId(k)) << " "; | |
1032 | } | |
1033 | cout << endl; | |
1034 | } | |
1035 | } | |
1036 | } | |
92faf71f | 1037 | |
61c370dd | 1038 | //________________________________________________________________ |
40c8e44b | 1039 | Int_t AliMpDDLStore::GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberId ) const { |
1040 | /// return the next detection element in line | |
61c370dd | 1041 | |
1042 | AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId); | |
1043 | ||
1044 | TString name(localBoard->GetName()); | |
1045 | ||
1046 | Int_t line = localBoard->GetPosition().GetFirst(); | |
1047 | ++line; | |
40c8e44b | 1048 | |
61c370dd | 1049 | name.Replace(4,1,Form("%d", line)); |
1050 | ||
40c8e44b | 1051 | Int_t nextLocalId; |
61c370dd | 1052 | if ((nextLocalId = GetLocalBoardId(name))) |
40c8e44b | 1053 | return GetDEfromLocalBoard(nextLocalId, chamberId); |
61c370dd | 1054 | else |
40c8e44b | 1055 | return 0; |
61c370dd | 1056 | |
1057 | return 0; | |
1058 | } | |
1059 | ||
1060 | //________________________________________________________________ | |
40c8e44b | 1061 | Int_t AliMpDDLStore::GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const { |
1062 | /// return the previous detection element in line | |
61c370dd | 1063 | |
1064 | AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId); | |
1065 | ||
1066 | TString name(localBoard->GetName()); | |
1067 | ||
1068 | Int_t line = localBoard->GetPosition().GetFirst(); | |
1069 | --line; | |
40c8e44b | 1070 | |
61c370dd | 1071 | name.Replace(4,1,Form("%d", line)); |
1072 | ||
1073 | Int_t prevLocalId; | |
1074 | if ((prevLocalId = GetLocalBoardId(name))) | |
40c8e44b | 1075 | return GetDEfromLocalBoard(prevLocalId, chamberId); |
61c370dd | 1076 | else |
40c8e44b | 1077 | return 0; |
61c370dd | 1078 | |
1079 | } | |
92faf71f | 1080 |