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