]>
Commit | Line | Data |
---|---|---|
516d3280 | 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 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
19 | // Class AliMUONTriggerElectronics | |
20 | //-------------------------------- | |
21 | // Manager class for muon trigger electronics | |
22 | // Client of trigger board classes | |
23 | // Debugged by Ph. Crochet & Ch. Finck | |
24 | // Interfaced with new mapping Ch. Finck | |
25 | // | |
26 | // Author: Rachid Guernane (LPCCFd) | |
27 | //----------------------------------------------------------------------------- | |
516d3280 | 28 | |
257091b1 | 29 | #include "AliLoader.h" |
30 | #include "AliLog.h" | |
31 | #include "AliMUON.h" | |
32 | #include "AliMUONCalibrationData.h" | |
33 | #include "AliMUONVDigit.h" | |
34 | #include "AliMUONVDigitStore.h" | |
35 | #include "AliMUONGlobalTrigger.h" | |
516d3280 | 36 | #include "AliMUONGlobalTriggerBoard.h" |
37 | #include "AliMUONLocalTrigger.h" | |
257091b1 | 38 | #include "AliMUONLocalTriggerBoard.h" |
47dc4ee7 | 39 | #include "AliMUONRegionalTrigger.h" |
257091b1 | 40 | #include "AliMUONRegionalTriggerBoard.h" |
41 | #include "AliMUONTriggerCrate.h" | |
42 | #include "AliMUONTriggerCrateStore.h" | |
43 | #include "AliMUONTriggerElectronics.h" | |
44 | #include "AliMUONVTriggerStore.h" | |
4c0f0f5d | 45 | #include "AliMUONVCalibParam.h" |
257091b1 | 46 | #include "AliMpCathodType.h" |
47 | #include "AliMpDEManager.h" | |
666ada1e | 48 | #include "AliMpSegmentation.h" |
f4678817 | 49 | #include "AliMpVSegmentation.h" |
866c3232 | 50 | #include "AliMpCathodType.h" |
fd19a819 | 51 | #include "AliMpTriggerCrate.h" |
52 | #include "AliMpLocalBoard.h" | |
53 | #include "AliMpDDLStore.h" | |
54 | #include "AliMpExMap.h" | |
55 | #include "AliMpIntPair.h" | |
f4678817 | 56 | |
57 | #include "AliLog.h" | |
58 | #include "AliLoader.h" | |
59 | #include "AliRun.h" | |
257091b1 | 60 | #include <TBits.h> |
61 | #include <TSystem.h> | |
f4678817 | 62 | |
516d3280 | 63 | |
6014107b | 64 | /// \cond CLASSIMP |
63ed9c6b | 65 | ClassImp(AliMUONTriggerElectronics) |
6014107b | 66 | /// \endcond |
63ed9c6b | 67 | |
516d3280 | 68 | //___________________________________________ |
257091b1 | 69 | AliMUONTriggerElectronics::AliMUONTriggerElectronics(AliMUONCalibrationData* calibData) |
70 | : TObject(), | |
f1e8d46c | 71 | fCrates(new AliMUONTriggerCrateStore), |
257091b1 | 72 | fGlobalTriggerBoard(new AliMUONGlobalTriggerBoard) |
516d3280 | 73 | { |
257091b1 | 74 | /// CONSTRUCTOR |
6014107b | 75 | /// |
fd19a819 | 76 | |
77 | for (Int_t i = 0; i < 2; ++i) { | |
78 | fCopyXInput[i] = new TList(); | |
79 | fCopyXInput[i]->SetOwner(); | |
80 | fCopyYInput[i] = new TList(); | |
81 | fCopyYInput[i]->SetOwner(); | |
82 | } | |
83 | ||
84 | SetCopyInput(); | |
f1e8d46c | 85 | Factory(calibData); |
86 | LoadMasks(calibData); | |
516d3280 | 87 | } |
88 | ||
89 | //___________________________________________ | |
90 | AliMUONTriggerElectronics::~AliMUONTriggerElectronics() | |
91 | { | |
6014107b | 92 | /// DESTRUCTOR |
93 | /// | |
516d3280 | 94 | delete fGlobalTriggerBoard; |
95 | delete fCrates; | |
fd19a819 | 96 | for (Int_t i = 0; i < 2; ++i) { |
97 | delete fCopyXInput[i]; | |
98 | delete fCopyYInput[i]; | |
99 | } | |
100 | ||
101 | } | |
102 | //___________________________________________ | |
103 | void AliMUONTriggerElectronics::SetCopyInput() | |
104 | { | |
105 | /// set list of copy input | |
106 | ||
107 | for (Int_t iDDL = 0; iDDL < 2; ++iDDL) { | |
108 | ||
109 | for(Int_t iReg = 0; iReg < 8; ++iReg){ //reg loop | |
110 | ||
111 | AliMpTriggerCrate* crateMapping = AliMpDDLStore::Instance()->GetTriggerCrate(iDDL, iReg); | |
112 | ||
113 | for(Int_t iLocal = 0; iLocal < crateMapping->GetNofLocalBoards(); ++iLocal) { | |
114 | ||
115 | Int_t localBoardFromId = crateMapping->GetLocalBoardId(iLocal); | |
116 | if (!localBoardFromId) continue; //empty slot, should not happen | |
117 | ||
118 | AliMpLocalBoard* localBoardFrom = AliMpDDLStore::Instance()->GetLocalBoard(localBoardFromId); | |
119 | Int_t localBoardToId; | |
120 | if ((localBoardToId = localBoardFrom->GetInputXto())) { | |
121 | AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId); | |
122 | TString crateFrom = localBoardFrom->GetCrate(); | |
123 | Int_t slotFrom = localBoardFrom->GetSlot(); | |
124 | TString crateTo = localBoardTo->GetCrate(); | |
125 | Int_t slotTo = localBoardTo->GetSlot(); | |
126 | ||
127 | fCopyXInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom)); | |
128 | fCopyXInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo)); | |
129 | AliDebug(3, Form("copy xInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, | |
130 | crateTo.Data(), slotTo)); | |
131 | } | |
132 | ||
133 | if ((localBoardToId = localBoardFrom->GetInputYto())) { | |
134 | AliMpLocalBoard* localBoardTo = AliMpDDLStore::Instance()->GetLocalBoard(localBoardToId); | |
135 | TString crateFrom = localBoardFrom->GetCrate(); | |
136 | Int_t slotFrom = localBoardFrom->GetSlot(); | |
137 | TString crateTo = localBoardTo->GetCrate(); | |
138 | Int_t slotTo = localBoardTo->GetSlot(); | |
139 | ||
140 | fCopyYInput[0]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateFrom), slotFrom)); | |
141 | fCopyYInput[1]->Add(new AliMpIntPair(AliMpExMap::GetIndex(crateTo), slotTo)); | |
142 | AliDebug(3, Form("copy yInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, | |
143 | crateTo.Data(), slotTo)); | |
144 | ||
145 | } | |
146 | ||
147 | } | |
148 | } | |
149 | } | |
516d3280 | 150 | } |
151 | ||
152 | //___________________________________________ | |
4c0f0f5d | 153 | void AliMUONTriggerElectronics::Factory(AliMUONCalibrationData* calibData) |
516d3280 | 154 | { |
6014107b | 155 | /// BUILD ALL ELECTRONICS |
156 | /// | |
e93b11d0 | 157 | |
158 | // get coinc44 from AliMUON (added 12/09/06) | |
159 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
160 | Int_t coinc44 = pMUON->GetTriggerCoinc44(); | |
161 | if (coinc44 != 0 && coinc44 != 1) { | |
162 | AliFatal("Coinc 44 should be equal to 0 or 1"); | |
163 | return; | |
164 | } | |
165 | ||
fd19a819 | 166 | fCrates->ReadFromFile(); |
f1e8d46c | 167 | |
168 | if ( !calibData ) return; | |
169 | ||
170 | AliMUONTriggerLut* lut = calibData->TriggerLut(); | |
171 | ||
172 | if (!lut) return; | |
173 | ||
174 | AliMUONLocalTriggerBoard* localBoard; | |
175 | ||
176 | fCrates->FirstLocalBoard(); | |
177 | ||
178 | while ( (localBoard=fCrates->NextLocalBoard()) ) | |
179 | { | |
180 | localBoard->SetLUT(lut); | |
e93b11d0 | 181 | localBoard->SetCoinc44(coinc44); |
f1e8d46c | 182 | } |
8af755f4 | 183 | } |
516d3280 | 184 | |
8af755f4 | 185 | //___________________________________________ |
257091b1 | 186 | void AliMUONTriggerElectronics::Feed(const AliMUONVDigitStore& digitStore) |
8af755f4 | 187 | { |
257091b1 | 188 | /// FILL INPUTS |
189 | /// | |
190 | ||
191 | TIter next(digitStore.CreateTriggerIterator()); | |
192 | AliMUONVDigit* mdig; | |
193 | ||
194 | while ( ( mdig = static_cast<AliMUONVDigit*>(next()) ) ) | |
195 | { | |
196 | // CHECKME ! The TrackCharge is not ok with new digitizerV3 ! | |
197 | // for (Int_t ichg=0; ichg<10; ichg++) schg += mdig->TrackCharge(ichg); | |
198 | Int_t ichamber = AliMpDEManager::GetChamberId(mdig->DetElemId()); | |
199 | Int_t schg = (Int_t)(mdig->Charge() + 0.5); | |
200 | ||
201 | // APPLY CONDITION ON SOFT BACKGROUND | |
202 | Int_t tchg = schg - (Int_t(schg/10))*10; | |
203 | ||
204 | if (schg<=10 || tchg>0) | |
43368512 | 205 | { |
257091b1 | 206 | Int_t detElemId = mdig->DetElemId(); |
207 | Int_t cathode = mdig->Cathode(); | |
fd19a819 | 208 | |
209 | const AliMpVSegmentation* seg = | |
210 | AliMpSegmentation::Instance() | |
211 | ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode)); | |
212 | ||
257091b1 | 213 | Int_t ix = mdig->PadX(), iy = mdig->PadY(); |
214 | ||
215 | AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); | |
fd19a819 | 216 | |
257091b1 | 217 | AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); |
218 | ||
219 | for (Int_t i=0; i<pad.GetNofLocations(); i++) | |
43368512 | 220 | { |
257091b1 | 221 | AliMpIntPair location = pad.GetLocation(i); |
222 | ||
223 | Int_t nboard = location.GetFirst(); | |
224 | ||
225 | Int_t ibitxy = location.GetSecond(); | |
226 | ||
227 | AliMUONLocalTriggerBoard *b = fCrates->LocalBoard(nboard); | |
228 | ||
229 | if (b) | |
230 | { | |
231 | if (cathode && b->GetSwitch(6)) ibitxy += 8; | |
232 | ||
233 | b->SetbitM(ibitxy,cathode,ichamber-10); | |
234 | } | |
235 | else | |
236 | { | |
237 | AliError(Form("Could not get local board number %d",b->GetNumber())); | |
238 | } | |
43368512 | 239 | } |
257091b1 | 240 | } |
241 | } | |
fd19a819 | 242 | |
43368512 | 243 | // Particular case of the columns with 22 local boards (2R(L) 3R(L)) |
fd19a819 | 244 | // fill copy input from mapping instead of hardcoded valued (Ch.F) |
43368512 | 245 | AliMUONTriggerCrate *crate = 0x0; TObjArray *bs = 0x0; |
fd19a819 | 246 | |
247 | for (Int_t i = 0; i < fCopyXInput[0]->GetEntries(); ++i) | |
43368512 | 248 | { |
fd19a819 | 249 | AliMpIntPair* pair = (AliMpIntPair*)fCopyXInput[0]->At(i); |
250 | TString crateFrom = AliMpExMap::GetString(pair->GetFirst()); | |
251 | Int_t slotFrom = pair->GetSecond(); | |
252 | ||
253 | pair = (AliMpIntPair*)fCopyXInput[1]->At(i); | |
254 | TString crateTo = AliMpExMap::GetString(pair->GetFirst()); | |
255 | Int_t slotTo = pair->GetSecond(); | |
256 | ||
257 | AliDebug(3, Form("copy xInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, | |
258 | crateTo.Data(), slotTo)); | |
259 | ||
260 | UShort_t cX[2]; | |
261 | crate = fCrates->Crate(crateFrom); | |
257091b1 | 262 | bs = crate->Boards(); |
fd19a819 | 263 | AliMUONLocalTriggerBoard *fromxb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom); |
264 | crate = fCrates->Crate(crateTo); | |
257091b1 | 265 | bs = crate->Boards(); |
fd19a819 | 266 | AliMUONLocalTriggerBoard *desxb = (AliMUONLocalTriggerBoard*)bs->At(slotTo); |
267 | fromxb->GetX34(cX); desxb->SetX34(cX); | |
268 | ||
269 | ||
270 | } | |
271 | ||
272 | for (Int_t i = 0; i < fCopyYInput[0]->GetEntries(); ++i) | |
273 | { | |
274 | AliMpIntPair* pair = (AliMpIntPair*)fCopyYInput[0]->At(i); | |
275 | TString crateFrom = AliMpExMap::GetString(pair->GetFirst()); | |
276 | Int_t slotFrom = pair->GetSecond(); | |
277 | ||
278 | pair = (AliMpIntPair*)fCopyYInput[1]->At(i); | |
279 | TString crateTo = AliMpExMap::GetString(pair->GetFirst()); | |
280 | Int_t slotTo = pair->GetSecond(); | |
281 | ||
282 | AliDebug(3, Form("copy yInputs from local %s_%d to %s_%d\n", crateFrom.Data(), slotFrom, | |
283 | crateTo.Data(), slotTo)); | |
284 | ||
257091b1 | 285 | UShort_t cY[4]; |
fd19a819 | 286 | crate = fCrates->Crate(crateFrom); |
287 | bs = crate->Boards(); | |
288 | AliMUONLocalTriggerBoard *fromyb = (AliMUONLocalTriggerBoard*)bs->At(slotFrom); | |
289 | crate = fCrates->Crate(crateTo); | |
290 | bs = crate->Boards(); | |
291 | AliMUONLocalTriggerBoard *desyb = (AliMUONLocalTriggerBoard*)bs->At(slotTo); | |
292 | fromyb->GetY(cY); desyb->SetY(cY); | |
43368512 | 293 | } |
257091b1 | 294 | |
43368512 | 295 | // FILL UP/DOWN OF CURRENT BOARD (DONE VIA J3 BUS IN REAL LIFE) |
296 | AliMUONTriggerCrate* cr; | |
257091b1 | 297 | |
43368512 | 298 | fCrates->FirstCrate(); |
257091b1 | 299 | |
43368512 | 300 | while ( ( cr = fCrates->NextCrate() ) ) |
301 | { | |
257091b1 | 302 | TObjArray *boards = cr->Boards(); |
303 | ||
304 | for (Int_t j = 1; j < boards->GetEntries()-1; j++) | |
305 | { | |
306 | TObject *o = boards->At(j); | |
8af755f4 | 307 | |
257091b1 | 308 | if (!o) break; |
8af755f4 | 309 | |
257091b1 | 310 | AliMUONLocalTriggerBoard *currboard = (AliMUONLocalTriggerBoard*)o; |
8af755f4 | 311 | |
257091b1 | 312 | AliMUONLocalTriggerBoard *neighbour = (AliMUONLocalTriggerBoard*)boards->At(j+1); |
1fe8c19b | 313 | |
257091b1 | 314 | UShort_t cXY[2][4]; |
8af755f4 | 315 | |
257091b1 | 316 | if (j==1) {neighbour->GetXY(cXY); currboard->SetXYU(cXY);} |
8af755f4 | 317 | |
257091b1 | 318 | // LAST BOARD IN THE CRATE HAS NO UP EXCEPT FOR CRATES 2 & 3 |
319 | if (j < boards->GetEntries()-2) | |
320 | { | |
43368512 | 321 | AliMUONLocalTriggerBoard *nextboard = (AliMUONLocalTriggerBoard*)boards->At(j+2); |
8af755f4 | 322 | |
43368512 | 323 | currboard->GetXY(cXY); neighbour->SetXYD(cXY); |
324 | nextboard->GetXY(cXY); neighbour->SetXYU(cXY); | |
8af755f4 | 325 | |
1fe8c19b | 326 | if (j==boards->GetEntries()-3) {neighbour->GetXY(cXY); nextboard->SetXYD(cXY);} |
43368512 | 327 | } |
257091b1 | 328 | } |
43368512 | 329 | } |
fd19a819 | 330 | |
257091b1 | 331 | } |
1fe8c19b | 332 | |
516d3280 | 333 | |
334 | //___________________________________________ | |
335 | void AliMUONTriggerElectronics::Feed(UShort_t pattern[2][4]) | |
336 | { | |
6014107b | 337 | /// FILL INPUTS |
338 | /// | |
f1e8d46c | 339 | AliMUONTriggerCrate* cr; |
340 | ||
341 | fCrates->FirstCrate(); | |
342 | ||
343 | while ( ( cr = fCrates->NextCrate() ) ) | |
344 | { | |
345 | TObjArray *boards = cr->Boards(); | |
346 | ||
43368512 | 347 | for (Int_t j = 1; j < boards->GetEntries(); j++) |
f1e8d46c | 348 | { |
349 | TObject *o = boards->At(j); | |
350 | ||
351 | if (!o) break; | |
352 | ||
353 | AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; | |
354 | ||
355 | board->SetXY(pattern); | |
356 | } | |
516d3280 | 357 | } |
358 | } | |
359 | ||
360 | //___________________________________________ | |
361 | void AliMUONTriggerElectronics::DumpOS() | |
362 | { | |
6014107b | 363 | /// DUMP IN THE OLD WAY |
364 | /// | |
43368512 | 365 | for (Int_t i= 0; i < 234;i++) |
516d3280 | 366 | { |
f1e8d46c | 367 | AliMUONLocalTriggerBoard *board = fCrates->LocalBoard(i); |
516d3280 | 368 | |
43368512 | 369 | if (board) board->Scan("ALL"); |
516d3280 | 370 | } |
371 | } | |
372 | ||
373 | //___________________________________________ | |
374 | void AliMUONTriggerElectronics::Scan(Option_t *option) | |
375 | { | |
6014107b | 376 | /// SCAN |
377 | /// | |
516d3280 | 378 | |
f1e8d46c | 379 | AliMUONTriggerCrate* cr; |
380 | ||
381 | fCrates->FirstCrate(); | |
382 | ||
383 | while ( ( cr = fCrates->NextCrate() ) ) | |
43368512 | 384 | { |
f1e8d46c | 385 | TObjArray *boards = cr->Boards(); |
386 | ||
43368512 | 387 | for (Int_t j = 0; j < boards->GetEntries(); j++) |
f1e8d46c | 388 | { |
389 | TObject *o = boards->At(j); | |
390 | ||
391 | TString op = option; | |
392 | ||
393 | Bool_t cdtion = kFALSE; | |
394 | ||
395 | if (op.Contains("LOCAL")) cdtion = o->IsA() == AliMUONLocalTriggerBoard::Class(); | |
396 | if (op.Contains("REGIONAL")) cdtion = o->IsA() == AliMUONRegionalTriggerBoard::Class(); | |
397 | if (op.Contains("GLOBAL")) cdtion = o->IsA() == AliMUONGlobalTriggerBoard::Class(); | |
398 | ||
399 | if (!o || !cdtion) continue; | |
400 | ||
401 | AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; | |
402 | ||
403 | board->Scan(); | |
404 | } | |
405 | } | |
516d3280 | 406 | } |
407 | ||
408 | //___________________________________________ | |
409 | void AliMUONTriggerElectronics::Reset() | |
410 | { | |
6014107b | 411 | /// RESET |
412 | /// | |
f1e8d46c | 413 | |
414 | AliMUONTriggerCrate* cr; | |
415 | ||
416 | fCrates->FirstCrate(); | |
417 | ||
418 | while ( ( cr = fCrates->NextCrate() ) ) | |
516d3280 | 419 | { |
516d3280 | 420 | TObjArray *boards = cr->Boards(); |
421 | ||
422 | for (Int_t j=0; j<boards->GetEntries(); j++) | |
423 | { | |
424 | AliMUONTriggerBoard *b = (AliMUONTriggerBoard*)boards->At(j); | |
425 | ||
426 | if (b) b->Reset(); | |
427 | } | |
428 | } | |
429 | } | |
430 | ||
4c0f0f5d | 431 | //_______________________________________________________________________ |
432 | void AliMUONTriggerElectronics::LoadMasks(AliMUONCalibrationData* calibData) | |
433 | { | |
71a2d3aa | 434 | /// LOAD MASKS FROM CDB |
4c0f0f5d | 435 | |
436 | ||
437 | // SET MASKS | |
f1e8d46c | 438 | |
439 | AliMUONTriggerCrate* cr; | |
440 | ||
441 | fCrates->FirstCrate(); | |
442 | ||
443 | Int_t irb(0); | |
444 | ||
445 | while ( ( cr = fCrates->NextCrate() ) ) | |
43368512 | 446 | { |
4c0f0f5d | 447 | TObjArray *boards = cr->Boards(); |
448 | ||
449 | AliMUONRegionalTriggerBoard *regb = | |
450 | (AliMUONRegionalTriggerBoard*)boards->At(0); | |
451 | ||
f1e8d46c | 452 | AliMUONVCalibParam* regionalBoardMasks = calibData->RegionalTriggerBoardMasks(irb); |
4c0f0f5d | 453 | |
c05673c9 | 454 | UShort_t rmask = static_cast<UShort_t>(regionalBoardMasks->ValueAsInt(0) & 0xFFFF); |
455 | ||
456 | regb->Mask(rmask); | |
4c0f0f5d | 457 | |
43368512 | 458 | for (Int_t j = 1; j < boards->GetEntries(); j++) |
4c0f0f5d | 459 | { |
460 | AliMUONLocalTriggerBoard *b = (AliMUONLocalTriggerBoard*)boards->At(j); | |
461 | ||
462 | Int_t cardNumber = b->GetNumber(); | |
463 | ||
464 | if (cardNumber) // interface board are not interested | |
465 | { | |
466 | AliMUONVCalibParam* localBoardMasks = calibData->LocalTriggerBoardMasks(cardNumber); | |
467 | for ( Int_t i = 0; i < localBoardMasks->Size(); ++i ) | |
468 | { | |
469 | UShort_t lmask = static_cast<UShort_t>(localBoardMasks->ValueAsInt(i) & 0xFFFF); | |
470 | b->Mask(i,lmask); | |
471 | } | |
472 | } | |
473 | } | |
f1e8d46c | 474 | ++irb; |
4c0f0f5d | 475 | } |
476 | ||
477 | AliMUONVCalibParam* globalBoardMasks = calibData->GlobalTriggerBoardMasks(); | |
478 | for ( Int_t i = 0; i < globalBoardMasks->Size(); ++i ) | |
479 | { | |
c05673c9 | 480 | UShort_t gmask = static_cast<UShort_t>(globalBoardMasks->ValueAsInt(i) & 0xFF); |
4c0f0f5d | 481 | fGlobalTriggerBoard->Mask(i,gmask); |
482 | } | |
483 | } | |
484 | ||
485 | ||
516d3280 | 486 | //___________________________________________ |
487 | void AliMUONTriggerElectronics::LocalResponse() | |
488 | { | |
6014107b | 489 | /// \todo add comment |
516d3280 | 490 | |
f1e8d46c | 491 | AliMUONTriggerCrate* cr; |
492 | ||
493 | fCrates->FirstCrate(); | |
494 | ||
495 | while ( ( cr = fCrates->NextCrate() ) ) | |
43368512 | 496 | { |
f1e8d46c | 497 | |
498 | TObjArray *boards = cr->Boards(); | |
499 | ||
500 | AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); | |
501 | ||
502 | UShort_t thisl[16]; for (Int_t j=0; j<16; j++) thisl[j] = 0; | |
29e3f51e | 503 | |
504 | for (Int_t j = 1; j < boards->GetEntries(); j++) | |
f1e8d46c | 505 | { |
43368512 | 506 | TObject *o = boards->At(j); |
f1e8d46c | 507 | |
43368512 | 508 | if (!o) break; |
f1e8d46c | 509 | |
43368512 | 510 | AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; |
f1e8d46c | 511 | |
29e3f51e | 512 | if (board) // check if empty slot |
43368512 | 513 | { |
514 | board->Response(); | |
516d3280 | 515 | |
29e3f51e | 516 | UShort_t response = board->GetResponse(); |
f1e8d46c | 517 | |
29e3f51e | 518 | // CRATE CONTAINING INTERFACE BOARD |
519 | if (board->GetNumber() == 0) // copy boards | |
520 | { | |
521 | if ( response != 0 ) | |
522 | AliWarning(Form("Interface board %s in slot %d of crate %s has a non zero response", | |
43368512 | 523 | board->GetName(),j,cr->GetName())); |
29e3f51e | 524 | AliDebug(1, Form("local slot %d, number %d in crate %s\n", j, board->GetNumber(), cr->GetName())); |
525 | ||
526 | } | |
f1e8d46c | 527 | |
29e3f51e | 528 | thisl[j-1] = response; |
43368512 | 529 | } |
516d3280 | 530 | } |
f1e8d46c | 531 | |
532 | regb->SetLocalResponse(thisl); | |
533 | } | |
516d3280 | 534 | } |
535 | ||
536 | //___________________________________________ | |
537 | void AliMUONTriggerElectronics::RegionalResponse() | |
538 | { | |
f1e8d46c | 539 | /// Compute the response for all regional cards. |
540 | AliMUONTriggerCrate* cr; | |
541 | ||
542 | fCrates->FirstCrate(); | |
543 | ||
544 | while ( ( cr = fCrates->NextCrate() ) ) | |
43368512 | 545 | { |
516d3280 | 546 | TObjArray *boards = cr->Boards(); |
547 | ||
548 | AliMUONRegionalTriggerBoard *regb = (AliMUONRegionalTriggerBoard*)boards->At(0); | |
549 | ||
550 | if (regb) | |
551 | { | |
552 | regb->Response(); | |
516d3280 | 553 | } |
554 | } | |
555 | } | |
556 | ||
557 | //___________________________________________ | |
558 | void AliMUONTriggerElectronics::GlobalResponse() | |
559 | { | |
f1e8d46c | 560 | /// Compute the global response |
516d3280 | 561 | |
f1e8d46c | 562 | UShort_t regional[16]; |
563 | ||
564 | AliMUONTriggerCrate* cr; | |
565 | ||
566 | fCrates->FirstCrate(); | |
567 | Int_t irb(0); | |
568 | ||
569 | if ( !fCrates->NumberOfCrates() >= 16 ) | |
570 | { | |
571 | AliFatal(Form("Something is wrong : too many crates %d", | |
572 | fCrates->NumberOfCrates())); | |
573 | } | |
574 | ||
575 | while ( ( cr = fCrates->NextCrate() ) ) | |
43368512 | 576 | { |
f1e8d46c | 577 | AliMUONTriggerBoard* rb = |
578 | static_cast<AliMUONTriggerBoard*>(cr->Boards()->At(0)); | |
579 | regional[irb] = rb->GetResponse(); | |
580 | ++irb; | |
581 | } | |
582 | ||
583 | fGlobalTriggerBoard->SetRegionalResponse(regional); | |
584 | fGlobalTriggerBoard->Response(); | |
516d3280 | 585 | } |
586 | ||
516d3280 | 587 | //_______________________________________________________________________ |
257091b1 | 588 | void AliMUONTriggerElectronics::Digits2Trigger(const AliMUONVDigitStore& digitStore, |
589 | AliMUONVTriggerStore& triggerStore) | |
516d3280 | 590 | { |
f1e8d46c | 591 | /// Main method to go from digits to trigger decision |
257091b1 | 592 | AliMUONRegionalTrigger pRegTrig; |
593 | ||
594 | triggerStore.Clear(); | |
595 | ||
f1e8d46c | 596 | // RUN THE FULL BEE CHAIN |
257091b1 | 597 | Feed(digitStore); |
598 | LocalResponse(); | |
599 | RegionalResponse(); | |
600 | GlobalResponse(); | |
601 | // DumpOS(); | |
8af755f4 | 602 | |
f1e8d46c | 603 | AliMUONTriggerCrate* cr; |
257091b1 | 604 | AliMUONLocalTrigger localTrigger; |
605 | ||
6a6a56b4 | 606 | // stored in right order |
607 | // do not used iterator order | |
257091b1 | 608 | |
6a6a56b4 | 609 | for (Int_t iSide = 0; iSide < 2; iSide++) // right & left side |
f1e8d46c | 610 | { |
6a6a56b4 | 611 | for (Int_t iReg = 0; iReg < 8; iReg++) // 8 crates/regional boards for each side. |
612 | { | |
613 | cr = fCrates->Crate(iSide, iReg); | |
614 | TObjArray *boards = cr->Boards(); | |
257091b1 | 615 | |
6a6a56b4 | 616 | UInt_t regInpLpt = 0; |
617 | UInt_t regInpHpt = 0; | |
257091b1 | 618 | |
6a6a56b4 | 619 | AliMUONRegionalTriggerBoard *regBoard = (AliMUONRegionalTriggerBoard*)boards->At(0); |
257091b1 | 620 | |
6a6a56b4 | 621 | for (Int_t j = 1; j < boards->GetEntries(); j++) |
622 | { | |
257091b1 | 623 | TObject *o = boards->At(j); |
624 | ||
625 | if (!o) break; | |
626 | ||
627 | AliMUONLocalTriggerBoard *board = (AliMUONLocalTriggerBoard*)o; | |
628 | ||
629 | if (board) | |
630 | { | |
631 | // L0 TRIGGER | |
632 | // pcrochet 181206: MOOD needs ALL boards | |
633 | // if (board->Triggered()) | |
634 | // { | |
f1e8d46c | 635 | |
257091b1 | 636 | Int_t icirc = board->GetNumber(); |
637 | if (icirc != 0) { // pcrochet 181206: MOOD needs ALL boards | |
638 | ||
639 | localTrigger.SetLoCircuit(icirc); | |
640 | localTrigger.SetLoStripX(board->GetStripX11()); | |
641 | localTrigger.SetLoDev(board->GetDev()); | |
642 | localTrigger.SetLoSdev(board->GetSdev()); | |
643 | localTrigger.SetLoTrigY(board->GetTrigY()); | |
644 | localTrigger.SetLoStripY(board->GetStripY11()); | |
645 | ||
646 | // SAVE LUT OUTPUT | |
647 | UShort_t response = board->GetResponse(); | |
648 | localTrigger.SetLoHpt((response & 12) >> 2); | |
649 | localTrigger.SetLoLpt(response & 3); | |
650 | ||
651 | // calculates regional inputs from local for the moment | |
652 | UInt_t hPt = (response >> 2) & 0x3; | |
653 | UInt_t lPt = response & 0x3; | |
654 | ||
655 | regInpHpt |= hPt << (30 - (j-1)*2); | |
656 | regInpLpt |= lPt << (30 - (j-1)*2); | |
657 | ||
658 | TBits rrr; | |
659 | rrr.Set(6,&response); | |
660 | ||
661 | // SAVE BIT PATTERN | |
662 | localTrigger.SetX1Pattern(board->GetXY(0,0)); | |
663 | localTrigger.SetX2Pattern(board->GetXY(0,1)); | |
664 | localTrigger.SetX3Pattern(board->GetXY(0,2)); | |
665 | localTrigger.SetX4Pattern(board->GetXY(0,3)); | |
666 | ||
667 | localTrigger.SetY1Pattern(board->GetXY(1,0)); | |
668 | localTrigger.SetY2Pattern(board->GetXY(1,1)); | |
669 | localTrigger.SetY3Pattern(board->GetXY(1,2)); | |
670 | localTrigger.SetY4Pattern(board->GetXY(1,3)); | |
671 | ||
672 | // ADD A NEW LOCAL TRIGGER | |
673 | triggerStore.Add(localTrigger); | |
674 | ||
675 | } | |
676 | } | |
677 | } | |
678 | pRegTrig.SetId(iReg + 8*iSide); | |
679 | pRegTrig.SetLocalOutput(regInpLpt, 0); | |
680 | pRegTrig.SetLocalOutput(regInpHpt, 1); | |
681 | pRegTrig.SetOutput(regBoard->GetResponse()); | |
682 | ||
683 | triggerStore.Add(pRegTrig); | |
516d3280 | 684 | } |
6a6a56b4 | 685 | } |
f1e8d46c | 686 | |
1908473e | 687 | // GLOBAL TRIGGER INFORMATION |
f1e8d46c | 688 | UShort_t global = fGlobalTriggerBoard->GetResponse(); |
f1e8d46c | 689 | |
257091b1 | 690 | AliMUONGlobalTrigger globalTrigger; |
691 | ||
692 | globalTrigger.SetFromGlobalResponse(global); | |
f1e8d46c | 693 | // ADD A LOCAL TRIGGER IN THE LIST |
257091b1 | 694 | triggerStore.SetGlobal(globalTrigger); |
695 | ||
f1e8d46c | 696 | // NOW RESET ELECTRONICS |
697 | Reset(); | |
516d3280 | 698 | } |