]>
Commit | Line | Data |
---|---|---|
998c0c43 | 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 | ||
0a04ebd2 | 18 | // This is AliMUONTriggerDecision adaped for the mapping with a patch |
19 | // for triggerCircuit. | |
20 | // Will be replaced soon by new trigger architecture. | |
21 | ||
998c0c43 | 22 | #include "AliMUONTriggerDecisionV1.h" |
23 | ||
24 | #include <TError.h> | |
25 | #include "AliMUONTriggerCircuit.h" | |
0a04ebd2 | 26 | #include "AliMUONTriggerConstants.h" |
998c0c43 | 27 | #include "AliMUONTriggerLut.h" |
28 | #include "AliMUON.h" | |
29 | #include "AliMUONDigit.h" | |
30 | #include "AliMUONConstants.h" | |
31 | #include "AliMUONGlobalTrigger.h" | |
32 | #include "AliMUONLocalTrigger.h" | |
33 | #include "AliRun.h" | |
34 | #include "AliRunLoader.h" | |
35 | #include "AliLoader.h" | |
36 | #include "AliLog.h" | |
37 | ||
0a04ebd2 | 38 | //#include "AliMUONGeometrySegmentation.h" |
39 | #include "AliMpTriggerSegmentation.h" | |
40 | #include "AliMUONSegmentation.h" | |
41 | #include "AliMpVSegmentation.h" | |
42 | ||
43 | ||
998c0c43 | 44 | // A note on debug level. Using AliLog facility, you can set the verbosity |
45 | // of this class. | |
46 | // | |
47 | // DebugLevel = | |
48 | // 0 : don't print anything | |
49 | // 1 : print Global Trigger Output | |
50 | // 2 : print Local and Global Trigger Outputs | |
51 | // 3 : iprint = 2 + detailed info on X strips | |
52 | // 4 : iprint = 2 + detailed info on Y strip | |
53 | // 5 : iprint = 2 + detailed info on X and Y strips | |
54 | // Note : with DebugLevel>2, the strips detailed info is given for all circuits | |
55 | ||
56 | //---------------------------------------------------------------------- | |
57 | ClassImp(AliMUONTriggerDecisionV1) | |
58 | ||
59 | //---------------------------------------------------------------------- | |
60 | AliMUONTriggerDecisionV1::AliMUONTriggerDecisionV1(AliMUONData* data) | |
61 | : TTask("AliMUONTriggerDecisionV1", | |
62 | "From trigger digits to Local and Global Trigger objects (old style)"), | |
63 | fMUONData(data), | |
64 | fMUON(0x0) | |
65 | { | |
66 | // Constructor | |
67 | ||
68 | // initialize container | |
69 | if (fMUONData == 0) | |
70 | { | |
71 | AliFatal("No MUONdata for trigger"); | |
72 | } | |
73 | ||
74 | // Global Trigger information | |
75 | Int_t i; | |
76 | Int_t icirc; | |
77 | Int_t istrip; | |
78 | ||
79 | for (i=0; i<3; i++) | |
80 | { // [0] : Low pt, [1] : High pt, [2] : All pt | |
81 | fGlobalSinglePlus[i]=0; // tot num of single plus | |
82 | fGlobalSingleMinus[i]=0; // tot num of single minus | |
83 | fGlobalSingleUndef[i]=0; // tot num of single undefined | |
84 | fGlobalPairUnlike[i]=0; // tot num of unlike-sign pairs | |
85 | fGlobalPairLike[i]=0; // tot num of like-sign pairs | |
86 | } | |
87 | ||
88 | // Local Trigger information | |
89 | for (icirc=0; icirc<234; icirc++) | |
90 | { | |
91 | fTrigger[icirc]=0; // trigger or not | |
92 | fStripX11[icirc]=0; // X strip in MC11 which triggers | |
93 | fDev[icirc]=0; // deviation which triggers | |
94 | fStripY11[icirc]=0; // Y strip in MC11 which triggers | |
95 | for (i=0; i<2; i++) | |
96 | { // pt information via LuT | |
97 | fLutLpt[icirc][i]=fLutHpt[icirc][i]=fLutApt[icirc][i]=0; | |
98 | } | |
99 | } | |
100 | ||
101 | // bit pattern | |
102 | for (icirc=0; icirc<234; icirc++) | |
103 | { | |
104 | for (istrip=0; istrip<16; istrip++) | |
105 | { | |
106 | fXbit11[icirc][istrip]=fXbit12[icirc][istrip]=0; | |
107 | fYbit11[icirc][istrip]=fYbit12[icirc][istrip]=0; | |
108 | fYbit21[icirc][istrip]=fYbit22[icirc][istrip]=0; | |
109 | fYbit21U[icirc][istrip]=fYbit22U[icirc][istrip]=0; | |
110 | fYbit21D[icirc][istrip]=fYbit22D[icirc][istrip]=0; | |
111 | } | |
112 | for (istrip=0; istrip<32; istrip++) | |
113 | { | |
114 | fXbit21[icirc][istrip]=fXbit22[icirc][istrip]=0; | |
115 | } | |
116 | } | |
117 | ||
118 | fTriggerCircuit = new TObjArray(AliMUONConstants::NTriggerCircuit()); | |
119 | ||
120 | // getting MUON | |
121 | fMUON = (AliMUON*) gAlice->GetDetector("MUON"); | |
122 | ||
123 | // setting circuit | |
124 | for (icirc = 0; icirc < AliMUONConstants::NTriggerCircuit(); icirc++) | |
125 | { | |
126 | AliMUONTriggerCircuit* pCir = 0; | |
127 | pCir = &(fMUON->TriggerCircuit(icirc)); | |
128 | fTriggerCircuit->AddAt(pCir, icirc); | |
129 | } | |
130 | } | |
131 | ||
132 | //---------------------------------------------------------------------- | |
133 | AliMUONTriggerDecisionV1::AliMUONTriggerDecisionV1() | |
134 | : TTask("AliMUONTriggerDecisionV1", | |
135 | "From trigger digits to Local and Global Trigger objects (old style)"), | |
136 | ||
137 | fTriggerCircuit(0), | |
138 | fMUONData(0), | |
139 | fMUON(0) | |
140 | { | |
141 | // Default constructor | |
142 | } | |
143 | ||
144 | //---------------------------------------------------------------------- | |
145 | AliMUONTriggerDecisionV1::AliMUONTriggerDecisionV1(const AliMUONTriggerDecisionV1& rhs) | |
146 | : TTask(rhs) | |
147 | { | |
148 | // Protected copy constructor | |
149 | ||
150 | AliFatal("Not implemented."); | |
151 | } | |
152 | ||
153 | //---------------------------------------------------------------------- | |
154 | AliMUONTriggerDecisionV1::~AliMUONTriggerDecisionV1() | |
155 | { | |
156 | // Destructor | |
157 | if (fTriggerCircuit) | |
158 | { | |
159 | fTriggerCircuit->Clear();// Sets pointers to 0 since it is not the owner | |
160 | delete fTriggerCircuit; | |
161 | } | |
162 | } | |
163 | ||
164 | //---------------------------------------------------------------------- | |
165 | AliMUONTriggerDecisionV1& | |
166 | AliMUONTriggerDecisionV1::operator=(const AliMUONTriggerDecisionV1& rhs) | |
167 | { | |
168 | // Protected assignement operator | |
169 | ||
170 | if (this == &rhs) return *this; | |
171 | ||
172 | AliFatal("Not implemented."); | |
173 | ||
174 | return *this; | |
175 | } | |
176 | ||
177 | ||
178 | //---------------------------------------------------------------------- | |
179 | void AliMUONTriggerDecisionV1::Trigger() | |
180 | { | |
181 | // main method of the class which calls the overall Trigger procedure | |
182 | ||
183 | ResetBit(); | |
184 | SetBit(); | |
0a04ebd2 | 185 | SetBitUpDownX(); |
998c0c43 | 186 | SetBitUpDownY(); |
187 | ||
188 | Int_t coinc44=0, resetMid=0; // initialize coincidence | |
189 | ||
190 | AliMUONTriggerCircuit* triggerCircuit; | |
191 | ||
192 | for (Int_t icirc=0; icirc<234; icirc++) | |
193 | { | |
194 | // loop on circuits | |
195 | triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); | |
196 | ||
197 | Int_t minDevStrip[5], minDev[5], coordY[5]; | |
198 | for (Int_t i=0; i<5; i++) | |
199 | { | |
200 | minDevStrip[i]=minDev[i]=coordY[i]=0; | |
201 | } | |
202 | Int_t x2m=triggerCircuit->GetX2m(); | |
203 | Int_t x2ud=triggerCircuit->GetX2ud(); | |
204 | Int_t orMud[2]={0,0}; | |
205 | triggerCircuit->GetOrMud(orMud); | |
206 | ||
207 | // call triggerX | |
208 | TrigX(fXbit11[icirc],fXbit12[icirc],fXbit21[icirc],fXbit22[icirc], | |
209 | coinc44, minDevStrip, minDev); | |
210 | ||
211 | // call triggerY | |
212 | TrigY(fYbit11[icirc],fYbit12[icirc],fYbit21[icirc],fYbit22[icirc], | |
213 | fYbit21U[icirc],fYbit21D[icirc],fYbit22U[icirc],fYbit22D[icirc], | |
214 | x2m,x2ud,orMud,resetMid,coinc44,coordY); | |
215 | ||
216 | // call LocalTrigger | |
217 | Int_t iTrigger=0; | |
218 | LocalTrigger(icirc, minDevStrip, minDev, coordY, iTrigger); | |
219 | ||
220 | if (iTrigger==1) | |
221 | { | |
222 | StdoutToAliDebug(1, | |
223 | PrintBitPatXInput(icirc); | |
224 | PrintBitPatYInput(icirc); | |
225 | PrintLocalOutput(minDevStrip, minDev, coordY);); | |
0a04ebd2 | 226 | } |
998c0c43 | 227 | } // end loop on circuits |
228 | ||
229 | // call Global Trigger | |
230 | GlobalTrigger(); | |
231 | } | |
232 | ||
233 | //---------------------------------------------------------------------- | |
234 | void AliMUONTriggerDecisionV1::ResetBit() | |
235 | { | |
236 | // reset bit pattern, global and local trigger output tables to 0 | |
237 | ||
238 | Int_t i; | |
239 | Int_t icirc; | |
240 | Int_t istrip; | |
241 | ||
242 | for (icirc=0; icirc<234; icirc++) | |
243 | { | |
244 | for (istrip=0; istrip<16; istrip++) | |
245 | { | |
246 | fXbit11[icirc][istrip]=fXbit12[icirc][istrip]=0; | |
247 | fYbit11[icirc][istrip]=fYbit12[icirc][istrip]=0; | |
248 | fYbit21[icirc][istrip]=fYbit22[icirc][istrip]=0; | |
249 | fYbit21U[icirc][istrip]=fYbit22U[icirc][istrip]=0; | |
250 | fYbit21D[icirc][istrip]=fYbit22D[icirc][istrip]=0; | |
251 | } | |
252 | for (istrip=0; istrip<32; istrip++) | |
253 | { | |
254 | fXbit21[icirc][istrip]=fXbit22[icirc][istrip]=0; | |
255 | } | |
256 | } | |
257 | ||
258 | for (i=0; i<3; i++) | |
259 | { | |
260 | fGlobalSinglePlus[i]=0; | |
261 | fGlobalSingleMinus[i]=0; | |
262 | fGlobalSingleUndef[i]=0; | |
263 | fGlobalPairLike[i]=0; | |
264 | fGlobalPairLike[i]=0; | |
265 | } | |
266 | ||
267 | for (icirc=0; icirc<234; icirc++) | |
268 | { | |
269 | fTrigger[icirc]=0; | |
270 | fStripX11[icirc]=0; | |
271 | fDev[icirc]=0; | |
272 | fStripY11[icirc]=0; | |
273 | for (i=0; i<2; i++) | |
274 | { | |
275 | fLutLpt[icirc][i]=fLutHpt[icirc][i]=fLutApt[icirc][i]=0; | |
276 | } | |
277 | } | |
278 | } | |
279 | ||
280 | //---------------------------------------------------------------------- | |
281 | void AliMUONTriggerDecisionV1::SetBit() | |
282 | { | |
0a04ebd2 | 283 | // 1) loop over chambers and cathodes |
284 | // 2) load digits | |
285 | // 3) remove soft background | |
286 | // 4) set the bit patterns | |
998c0c43 | 287 | |
0a04ebd2 | 288 | Int_t cathode; |
289 | AliMUONTriggerCircuit* triggerCircuit; | |
998c0c43 | 290 | |
0a04ebd2 | 291 | for (Int_t chamber = 11; chamber < 15; ++chamber) |
998c0c43 | 292 | { |
0a04ebd2 | 293 | |
294 | TClonesArray* muonDigits = fMUONData->Digits(chamber-1); | |
295 | Int_t ndigits = muonDigits->GetEntriesFast(); | |
296 | AliDebug(3,Form("Found %d digits in %p %d", ndigits, muonDigits,chamber-1)); | |
297 | ||
298 | for (Int_t digit = 0; digit < ndigits; ++digit) | |
299 | { | |
300 | AliMUONDigit* mdig = static_cast<AliMUONDigit*> | |
301 | (muonDigits->UncheckedAt(digit)); | |
302 | ||
303 | // get the center of the pad Id | |
304 | Int_t ix=mdig->PadX(); | |
305 | Int_t iy=mdig->PadY(); | |
306 | Int_t detElemId=mdig->DetElemId(); | |
307 | // cathode = mdig->Cathode() + 1; | |
308 | cathode = mdig->Cathode(); | |
309 | ||
310 | const AliMpVSegmentation* seg = | |
311 | fMUON->GetSegmentation()->GetMpSegmentation(detElemId,cathode); | |
312 | AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); | |
313 | ||
314 | AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); | |
315 | ||
316 | // pad.Print(); | |
317 | ||
318 | // get the sum of the coded charge | |
319 | // see coding convention in AliMUONChamberTrigger::DisIntegration | |
320 | Int_t sumCharge = mdig->Signal(); | |
321 | ||
322 | // apply condition on soft background | |
323 | Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10; | |
324 | ||
325 | if(sumCharge<=10||testCharge>0) | |
326 | { | |
327 | Int_t icirc; | |
328 | ||
329 | // FIXME: if it works like this, rename digitindex to digit simply... | |
330 | Int_t digitindex = digit; | |
331 | ||
332 | if (cathode==0) { | |
333 | for (Int_t i=0; i<pad.GetNofLocations(); i++) { | |
334 | AliMpIntPair location = pad.GetLocation(i); | |
335 | icirc=Board2Circuit(location.GetFirst()-1); | |
336 | triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); | |
337 | DigitFiredCircuit(icirc, cathode, chamber-1, digitindex); | |
338 | switch (chamber) { | |
339 | case 11: | |
340 | fXbit11[icirc][location.GetSecond()]=1; | |
341 | break; | |
342 | case 12: | |
343 | fXbit12[icirc][location.GetSecond()]=1; | |
344 | break; | |
345 | case 13: | |
346 | fXbit21[icirc][location.GetSecond()+8]=1; | |
347 | break; | |
348 | case 14: | |
349 | fXbit22[icirc][location.GetSecond()+8]=1; | |
350 | break; | |
351 | } | |
352 | } // end of loop on locations | |
353 | ||
354 | } else { // Y plane | |
355 | for (Int_t i=0; i<pad.GetNofLocations(); i++) { | |
356 | AliMpIntPair location = pad.GetLocation(i); | |
357 | icirc=Board2Circuit(location.GetFirst()-1); | |
358 | triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); | |
359 | ||
360 | switch (chamber) { | |
361 | case 11: | |
362 | fYbit11[icirc][location.GetSecond()]=1; | |
363 | break; | |
364 | case 12: | |
365 | fYbit12[icirc][location.GetSecond()]=1; | |
366 | break; | |
367 | case 13: | |
368 | fYbit21[icirc][location.GetSecond()]=1; | |
369 | break; | |
370 | case 14: | |
371 | fYbit22[icirc][location.GetSecond()]=1; | |
372 | break; | |
373 | } | |
374 | } // end of loop on locations | |
375 | } // end of condition on cathode | |
376 | } // remove soft background | |
377 | } // end loop on digit | |
378 | } // end loop on chamber | |
998c0c43 | 379 | } |
380 | ||
381 | //---------------------------------------------------------------------- | |
0a04ebd2 | 382 | void AliMUONTriggerDecisionV1::SetBitUpDownX() |
383 | { | |
384 | // Set X bit for up and down part of circuits | |
385 | Int_t idModule, nStripX, nStripY, iPosCircuit; | |
386 | Int_t idCirc,iCircD,idCircD,iCircU,idCircU; | |
387 | ||
388 | ||
389 | for (Int_t iCirc=0; iCirc<234; iCirc++) | |
998c0c43 | 390 | { |
391 | ||
392 | AliMUONTriggerCircuit* circuit; // current circuit | |
393 | AliMUONTriggerCircuit* circuitD; // circuit Down | |
394 | AliMUONTriggerCircuit* circuitU; // circuit Up | |
395 | ||
0a04ebd2 | 396 | circuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(iCirc); |
998c0c43 | 397 | idModule=circuit->GetIdModule(); // corresponding module Id. |
398 | nStripX=circuit->GetNstripX(); // number of X strips | |
399 | nStripY=circuit->GetNstripY(); // number of Y strips | |
400 | iPosCircuit=circuit->GetPosCircuit(); // position of circuit in module | |
0a04ebd2 | 401 | idCirc=circuit->GetIdCircuit(); |
402 | ||
998c0c43 | 403 | // fill lower part |
404 | if (iPosCircuit==1) | |
405 | { // need to scan lower module | |
0a04ebd2 | 406 | if(idModule<91&&TMath::Abs(idModule)!=41&&idModule>-91) |
407 | { | |
408 | // cp temporary trick | |
409 | iCircD=circuit->GetICircuitD(); // first circuit in module down | |
410 | Int_t sign=TMath::Abs(idModule)/idModule; | |
411 | Int_t idModuleD=sign*(TMath::Abs(idModule)+10); // lower module Id | |
412 | Int_t nstripx=AliMUONTriggerConstants::NstripX(ModuleNumber(idModuleD)); // and its number of strips | |
413 | Int_t ioffset=0; | |
414 | if (nstripx==32) { | |
415 | ioffset = 1; | |
416 | } else if (nstripx==48) { | |
417 | ioffset = 2; | |
418 | } else if (nstripx==64) { | |
419 | ioffset = 3; | |
420 | } | |
421 | iCircD = iCircD + ioffset; | |
422 | ||
423 | circuitD = (AliMUONTriggerCircuit*)fTriggerCircuit->At(iCircD); | |
424 | idCircD=circuitD->GetIdCircuit(); | |
425 | // cp temporary trick | |
426 | for (Int_t istrip=0; istrip<8; istrip++) | |
427 | { | |
428 | if (fXbit21[iCircD][istrip+16]==1) fXbit21[iCirc][istrip]=1; | |
429 | if (fXbit22[iCircD][istrip+16]==1) fXbit22[iCirc][istrip]=1; | |
430 | } | |
431 | } | |
432 | ||
998c0c43 | 433 | } else |
0a04ebd2 | 434 | { // lower strips within same module |
435 | if (idCirc>0) { | |
436 | idCircD=idCirc-1; | |
437 | } else { | |
438 | idCircD=idCirc+1; | |
439 | } | |
440 | iCircD=CircuitNumber(idCircD); | |
441 | ||
442 | for (Int_t istrip=0; istrip<8; istrip++) | |
443 | { | |
444 | if (fXbit21[iCircD][istrip+16]==1) fXbit21[iCirc][istrip]=1; | |
445 | if (fXbit22[iCircD][istrip+16]==1) fXbit22[iCirc][istrip]=1; | |
446 | } | |
447 | } | |
998c0c43 | 448 | |
449 | // fill upper part | |
450 | if ( (iPosCircuit==1&&nStripX==16)||(iPosCircuit==2&&nStripX==32)|| | |
451 | (iPosCircuit==3&&nStripX==48)||(iPosCircuit==4&&nStripX==64)) | |
452 | { | |
0a04ebd2 | 453 | if ((idModule>17||idModule<-17)&&TMath::Abs(idModule)!=61) |
454 | { // need to scan upper module | |
455 | Int_t iCircU=circuit->GetICircuitU(); | |
456 | circuitU = (AliMUONTriggerCircuit*)fTriggerCircuit->At(iCircU); | |
457 | ||
458 | for (Int_t istrip=24; istrip<32; istrip++) | |
459 | { | |
460 | if (fXbit21[iCircU][istrip-16]==1) fXbit21[iCirc][istrip]=1; | |
461 | if (fXbit22[iCircU][istrip-16]==1) fXbit22[iCirc][istrip]=1; | |
462 | } | |
463 | } | |
464 | ||
998c0c43 | 465 | } else |
466 | { // upper strips within same module | |
0a04ebd2 | 467 | // idCirc=circuit->GetIdCircuit(); |
468 | if (idCirc>0) { | |
469 | idCircU=idCirc+1; | |
470 | } else { | |
471 | idCircU=idCirc-1; | |
472 | } | |
473 | iCircU=CircuitNumber(idCircU); | |
474 | for (Int_t istrip=24; istrip<32; istrip++) | |
475 | { | |
476 | if (fXbit21[iCircU][istrip-16]==1) fXbit21[iCirc][istrip]=1; | |
477 | if (fXbit22[iCircU][istrip-16]==1) fXbit22[iCirc][istrip]=1; | |
478 | } | |
479 | } | |
480 | } // loop on circuit | |
481 | ||
482 | } | |
483 | ||
484 | //---------------------------------------------------------------------- | |
485 | void AliMUONTriggerDecisionV1::SetBitUpDownY(){ | |
486 | // Set Y bit for up and down parts of circuits | |
487 | Int_t idModule, nStripX, nStripY, iPosCircuit; | |
488 | ||
489 | ||
490 | for (Int_t icirc=0; icirc<234; icirc++) { | |
491 | ||
492 | AliMUONTriggerCircuit* circuit; // current circuit | |
493 | AliMUONTriggerCircuit* circuitD; // circuit Down | |
494 | AliMUONTriggerCircuit* circuitU; // circuit Up | |
495 | ||
496 | circuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); | |
497 | idModule=circuit->GetIdModule(); // corresponding module Id. | |
498 | nStripX=circuit->GetNstripX(); // number of X strips | |
499 | nStripY=circuit->GetNstripY(); // number of Y strips | |
500 | iPosCircuit=circuit->GetPosCircuit(); // position of circuit in module | |
501 | ||
502 | // fill lower part | |
503 | if (iPosCircuit==1) { // need to scan lower module | |
504 | if(idModule<91&&TMath::Abs(idModule)!=41&&idModule>-91) { | |
505 | Int_t icircD=circuit->GetICircuitD(); | |
506 | circuitD = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icircD); | |
507 | Int_t nStripD=circuitD->GetNstripY(); | |
508 | ||
509 | if (TMath::Abs(idModule)==42) { // shift of +8 bits | |
510 | for (Int_t istrip=0; istrip<nStripD; istrip++) { | |
511 | fYbit21D[icirc][istrip+8]=fYbit21[icircD][istrip]; | |
512 | fYbit22D[icirc][istrip+8]=fYbit22[icircD][istrip]; | |
513 | } | |
514 | } else if (TMath::Abs(idModule)==52) { // shift of -8 bits | |
515 | for (Int_t istrip=0; istrip<nStripD; istrip++) { | |
516 | fYbit21D[icirc][istrip]=fYbit21[icircD][istrip+8]; | |
517 | fYbit22D[icirc][istrip]=fYbit22[icircD][istrip+8]; | |
518 | } | |
519 | } else { | |
520 | for (Int_t istrip=0; istrip<nStripD; istrip++) { | |
521 | fYbit21D[icirc][istrip]=fYbit21[icircD][istrip]; | |
522 | fYbit22D[icirc][istrip]=fYbit22[icircD][istrip]; | |
523 | } | |
524 | } | |
525 | } | |
526 | } else { // lower strips within same module | |
527 | for (Int_t istrip=0; istrip<nStripY; istrip++) { | |
528 | fYbit21D[icirc][istrip]=fYbit21[icirc][istrip]; | |
529 | fYbit22D[icirc][istrip]=fYbit22[icirc][istrip]; | |
530 | } | |
531 | } | |
532 | ||
533 | // fill upper part | |
534 | if ((iPosCircuit==1&&nStripX==16)||(iPosCircuit==2&&nStripX==32)|| | |
535 | (iPosCircuit==3&&nStripX==48)||(iPosCircuit==4&&nStripX==64)) { | |
536 | if ((idModule>17||idModule<-17)&&TMath::Abs(idModule)!=61) { | |
537 | Int_t icircU=circuit->GetICircuitU(); | |
538 | circuitU = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icircU); | |
539 | Int_t nStripU=circuitU->GetNstripY(); | |
540 | ||
541 | if (TMath::Abs(idModule)==62) { // shift of +8 bits | |
542 | for (Int_t istrip=0; istrip<nStripU; istrip++) { | |
543 | fYbit21U[icirc][istrip+8]=fYbit21[icircU][istrip]; | |
544 | fYbit22U[icirc][istrip+8]=fYbit22[icircU][istrip]; | |
545 | } | |
546 | } else if (TMath::Abs(idModule)==52) { // shift of -8 bits | |
547 | for (Int_t istrip=0; istrip<nStripU; istrip++) { | |
548 | fYbit21U[icirc][istrip]=fYbit21[icircU][istrip+8]; | |
549 | fYbit22U[icirc][istrip]=fYbit22[icircU][istrip+8]; | |
550 | } | |
551 | } else { | |
552 | for (Int_t istrip=0; istrip<nStripU; istrip++) { | |
553 | fYbit21U[icirc][istrip]=fYbit21[icircU][istrip]; | |
554 | fYbit22U[icirc][istrip]=fYbit22[icircU][istrip]; | |
555 | } | |
556 | } | |
557 | } | |
558 | } else { // upper strips within same module | |
559 | for (Int_t istrip=0; istrip<nStripY; istrip++) { | |
560 | fYbit21U[icirc][istrip]=fYbit21[icirc][istrip]; | |
561 | fYbit22U[icirc][istrip]=fYbit22[icirc][istrip]; | |
998c0c43 | 562 | } |
563 | } | |
564 | } // loop on circuit | |
565 | } | |
566 | ||
0a04ebd2 | 567 | |
998c0c43 | 568 | //---------------------------------------------------------------------- |
569 | // x part of trigger Algo | |
570 | //---------------------------------------------------------------------- | |
571 | //---------------------------------------------------------------------- | |
572 | void AliMUONTriggerDecisionV1::TrigX(Int_t ch1q[16], Int_t ch2q[16], | |
573 | Int_t ch3q[32], Int_t ch4q[32], | |
574 | Int_t coinc44, Int_t minDevStrip[5], | |
575 | Int_t minDev[5]){ | |
576 | // note : coinc44 = flag 0 or 1 (0 coincidence -> 3/4, 1 coincidence -> 4/4) | |
577 | //--------------------------------------------------------- | |
578 | // step # 1 : declustering, reduction DS, calculate sgle & dble | |
579 | //--------------------------------------------------------- | |
580 | Int_t ch1e[19], ch2e[20], ch3e[35], ch4e[36]; | |
581 | Int_t sgleHit1[31], sgleHit2[63]; | |
582 | Int_t dbleHit1[31], dbleHit2[63]; | |
583 | ||
584 | Int_t i; | |
585 | Int_t j; | |
586 | ||
587 | for (i=0; i<31; i++) | |
588 | { | |
589 | sgleHit1[i]=0; | |
590 | dbleHit1[i]=0; | |
591 | } | |
592 | for (i=0; i<63; i++) | |
593 | { | |
594 | sgleHit2[i]=0; | |
595 | dbleHit2[i]=0; | |
596 | } | |
597 | ||
598 | //--- inititialize che using chq | |
599 | for (i=0; i<19; i++) | |
600 | { | |
601 | if (i<1||i>16) ch1e[i]=0; | |
602 | else ch1e[i]=ch1q[i-1]; | |
603 | } | |
604 | for (i=0; i<20; i++) | |
605 | { | |
606 | if (i<2||i>17) ch2e[i]=0; | |
607 | else ch2e[i]=ch2q[i-2]; | |
608 | } | |
609 | for (i=0; i<35; i++) | |
610 | { | |
611 | if (i<1||i>32) ch3e[i]=0; | |
612 | else ch3e[i]=ch3q[i-1]; | |
613 | } | |
614 | for (i=0; i<36; i++) | |
615 | { | |
616 | if (i<2||i>33) ch4e[i]=0; | |
617 | else ch4e[i]=ch4q[i-2]; | |
618 | } | |
619 | ||
620 | ||
621 | //--- calculate dble & sgle first station | |
622 | for (i=0; i<=15; i++) | |
623 | { | |
624 | sgleHit1[2*i] = (!ch1e[i+1]|(ch1e[i]^ch1e[i+2])) & | |
625 | (!ch2e[i+2] | (ch2e[i+1]^ch2e[i+3])); | |
626 | ||
627 | dbleHit1[2*i] = ch1e[i+1]&!(ch1e[i+2]^ch1e[i]) & | |
628 | (ch2e[i+2] | (!ch2e[i]&ch2e[i+1]) | (ch2e[i+3]&!ch2e[i+4])); | |
629 | } | |
630 | ||
631 | for (i=0; i<=14; i++) | |
632 | { | |
633 | sgleHit1[2*i+1] = (!ch1e[i+1]|!ch1e[i+2]|(ch1e[i]^ch1e[i+3])) & | |
634 | (!ch2e[i+2] | !ch2e[i+3] | (ch2e[i+1]^ch2e[i+4])); | |
635 | dbleHit1[2*i+1] = ch1e[i+1]&ch1e[i+2]&!(ch1e[i]^ch1e[i+3]) & | |
636 | (ch2e[i+2]&(!ch2e[i+1]|!ch2e[i]) | | |
637 | ch2e[i+3]&(ch2e[i+2]|!ch2e[i+4]|!ch2e[i+5])); | |
638 | } | |
639 | ||
640 | //--- calculate dble & sgle second station | |
641 | for (i=0; i<=31; i++) | |
642 | { | |
643 | sgleHit2[2*i] = (!ch3e[i+1]|(ch3e[i]^ch3e[i+2])) & | |
644 | (!ch4e[i+2] | (ch4e[i+1]^ch4e[i+3])); | |
645 | dbleHit2[2*i] = ch3e[i+1]&!(ch3e[i+2]^ch3e[i]) & | |
646 | (ch4e[i+2] | (!ch4e[i]&ch4e[i+1]) | (ch4e[i+3]&!ch4e[i+4])); | |
647 | } | |
648 | ||
649 | for (i=0; i<=30; i++) | |
650 | { | |
651 | sgleHit2[2*i+1] = (!ch3e[i+1]|!ch3e[i+2]|(ch3e[i]^ch3e[i+3])) & | |
652 | (!ch4e[i+2] | !ch4e[i+3] | (ch4e[i+1]^ch4e[i+4])); | |
653 | dbleHit2[2*i+1] = ch3e[i+1]&ch3e[i+2]&!(ch3e[i]^ch3e[i+3]) & | |
654 | (ch4e[i+2]&(!ch4e[i+1]|!ch4e[i]) | | |
655 | ch4e[i+3]&(ch4e[i+2]|!ch4e[i+4]|!ch4e[i+5])); | |
656 | } | |
657 | ||
658 | //--- | |
659 | /* FIXME : use AliLog here... | |
660 | ||
661 | if(fDebug==3||fDebug==5) | |
662 | { | |
663 | printf("===============================================================\n"); | |
664 | printf(" X plane after sgle and dble \n"); | |
665 | printf(" 0987654321098765432109876543210"); | |
666 | printf("\n SGLE1 "); | |
667 | for (istrip=30; istrip>=0; istrip--) printf("%i",(!sgleHit1[istrip])); | |
668 | printf("\n DBLE1 "); | |
669 | for (istrip=30; istrip>=0; istrip--) printf("%i",dbleHit1[istrip]); | |
670 | printf("\n SGLE2 "); | |
671 | for (istrip=62; istrip>=0; istrip--) printf("%i",(!sgleHit2[istrip])); | |
672 | printf("\n DBLE2 "); | |
673 | for (istrip=62; istrip>=0; istrip--) printf("%i",dbleHit2[istrip]); | |
674 | printf("\n 210987654321098765432109876543210987654321098765432109876543210\n"); | |
675 | } | |
676 | */ | |
677 | ||
678 | //--------------------------------------------------------- | |
679 | // step # 2 : coincidence 3/4 | |
680 | //--------------------------------------------------------- | |
681 | Int_t rearImage[31][31]; | |
682 | for (i=0; i<31; i++) | |
683 | { | |
684 | for (j=0; j<31; j++) | |
685 | { | |
686 | rearImage[i][j]=0; | |
687 | } | |
688 | } | |
689 | ||
690 | Int_t notOr1=!dbleHit1[30] & !dbleHit1[29] & !dbleHit1[28] & !dbleHit1[27] & | |
691 | !dbleHit1[26] & !dbleHit1[25] & !dbleHit1[24] & !dbleHit1[23] & | |
692 | !dbleHit1[22] & !dbleHit1[21] & !dbleHit1[20] & !dbleHit1[19] & | |
693 | !dbleHit1[18] & !dbleHit1[17] & !dbleHit1[16] & !dbleHit1[15] & | |
694 | !dbleHit1[14] & !dbleHit1[13] & !dbleHit1[12] & !dbleHit1[11] & | |
695 | !dbleHit1[10] & !dbleHit1[9] & !dbleHit1[8] & !dbleHit1[7] & | |
696 | !dbleHit1[6] & !dbleHit1[5] & !dbleHit1[4] & !dbleHit1[3] & | |
697 | !dbleHit1[2] & !dbleHit1[1] & !dbleHit1[0] & !coinc44; | |
698 | ||
699 | Int_t notOr2= !dbleHit2[62] & !dbleHit2[61] & !dbleHit2[60] & !dbleHit2[59] & | |
700 | !dbleHit2[58] & !dbleHit2[57] & !dbleHit2[56] & !dbleHit2[55] & | |
701 | !dbleHit2[54] & !dbleHit2[53] & !dbleHit2[52] & !dbleHit2[51] & | |
702 | !dbleHit2[50] & !dbleHit2[49] & !dbleHit2[48] & !dbleHit2[47] & | |
703 | !dbleHit2[46] & !dbleHit2[45] & !dbleHit2[44] & !dbleHit2[43] & | |
704 | !dbleHit2[42] & !dbleHit2[41] & !dbleHit2[40] & !dbleHit2[39] & | |
705 | !dbleHit2[38] & !dbleHit2[37] & !dbleHit2[36] & !dbleHit2[35] & | |
706 | !dbleHit2[34] & !dbleHit2[33] & !dbleHit2[32] & !dbleHit2[31] & | |
707 | !dbleHit2[30] & !dbleHit2[29] & !dbleHit2[28] & !dbleHit2[27] & | |
708 | !dbleHit2[26] & !dbleHit2[25] & !dbleHit2[24] & !dbleHit2[23] & | |
709 | !dbleHit2[22] & !dbleHit2[21] & !dbleHit2[20] & !dbleHit2[19] & | |
710 | !dbleHit2[18] & !dbleHit2[17] & !dbleHit2[16] & !dbleHit2[15] & | |
711 | !dbleHit2[14] & !dbleHit2[13] & !dbleHit2[12] & !dbleHit2[11] & | |
712 | !dbleHit2[10] & !dbleHit2[9] & !dbleHit2[8] & !dbleHit2[7] & | |
713 | !dbleHit2[6] & !dbleHit2[5] & !dbleHit2[4] & !dbleHit2[3] & | |
714 | !dbleHit2[2] & !dbleHit2[1] & !dbleHit2[0] & !coinc44; | |
715 | ||
716 | // DS reduction | |
717 | for (i=0; i<31; i++) | |
718 | { | |
719 | sgleHit1[i] = !sgleHit1[i]¬Or1; | |
720 | } | |
721 | for (i=0; i<63; i++) | |
722 | { | |
723 | sgleHit2[i] = !sgleHit2[i]¬Or2; | |
724 | } | |
725 | ||
726 | // extract rearImage | |
727 | for (i=0; i<31; i++) | |
728 | { | |
729 | Int_t tmpSgleHit2[31]; | |
730 | Int_t tmpDbleHit2[31]; | |
731 | for (j=0; j<31; j++) | |
732 | { | |
733 | tmpSgleHit2[j] = sgleHit2[i+j+1]; | |
734 | tmpDbleHit2[j] = dbleHit2[i+j+1]; | |
735 | } | |
736 | ||
737 | for (Int_t k=0; k<31; k++) | |
738 | { | |
739 | rearImage[i][k]=(sgleHit1[i]&tmpDbleHit2[k])| | |
740 | (dbleHit1[i]&(tmpSgleHit2[k]|tmpDbleHit2[k])); | |
741 | } | |
742 | } | |
743 | ||
744 | //----------- | |
745 | /* FIXME: use AliLog here | |
746 | if(fDebug==3||fDebug==5) { | |
747 | printf("===============================================================\n"); | |
748 | for (i=30; i>=0; i--) | |
749 | { | |
750 | printf("%i \t",i); | |
751 | for (istrip=31; istrip>=0; istrip--) printf("%i",rearImage[i][istrip]); | |
752 | printf("\n"); | |
753 | } | |
754 | } | |
755 | */ | |
756 | ||
757 | //--------------------------------------------------------- | |
758 | // step # 3 : calculate deviation | |
759 | //--------------------------------------------------------- | |
760 | Int_t dev[31][6]; | |
761 | for (i=0; i<31; i++) | |
762 | { | |
763 | for (j=0; j<6; j++) | |
764 | { | |
765 | dev[i][j]=0; | |
766 | } | |
767 | } | |
768 | ||
769 | for (i=0; i<31; i++) | |
770 | { | |
771 | Int_t leftDev[5], rightDev[5]; | |
772 | Int_t orL1, andL1, andL2, orR1, orR2, andR1, andR2, andR3; | |
773 | ||
774 | // calculate Left deviation | |
775 | orL1=rearImage[i][16]|rearImage[i][18]|rearImage[i][20]|rearImage[i][22]; | |
776 | andL1=!rearImage[i][17]&!rearImage[i][19]&!rearImage[i][21] & !orL1; | |
777 | andL2=!rearImage[i][23]&!rearImage[i][24]&!rearImage[i][25]&!rearImage[i][26]; | |
778 | ||
779 | leftDev[0] = (rearImage[i][16]|!rearImage[i][17]) & | |
780 | (rearImage[i][16]|rearImage[i][18]|!rearImage[i][19]& | |
781 | (rearImage[i][20]|!rearImage[i][21])) & | |
782 | (orL1|!rearImage[i][23]&(rearImage[i][24]|!rearImage[i][25])) & | |
783 | (orL1|rearImage[i][24]|rearImage[i][26]|!rearImage[i][27]& | |
784 | (rearImage[i][28]|!rearImage[i][29])); | |
785 | ||
786 | leftDev[1] = !rearImage[i][16] & | |
787 | !(!rearImage[i][17]&!rearImage[i][18]&!rearImage[i][21]&!rearImage[i][22] & | |
788 | (!rearImage[i][25]&!rearImage[i][26]&(rearImage[i][27]|rearImage[i][28]))) & | |
789 | (rearImage[i][17]|rearImage[i][18] | !rearImage[i][19]&!rearImage[i][20]) & | |
790 | (rearImage[i][17]|rearImage[i][18]|rearImage[i][21]|rearImage[i][22] | | |
791 | !rearImage[i][23]&!rearImage[i][24]); | |
792 | ||
793 | leftDev[2] = (!rearImage[i][16]&!rearImage[i][17]&!rearImage[i][18]) & | |
794 | (rearImage[i][19]|rearImage[i][20]|rearImage[i][21]|rearImage[i][22] | andL2); | |
795 | ||
796 | leftDev[3] = andL1; | |
797 | ||
798 | leftDev[4] = | |
799 | !rearImage[i][27]&!rearImage[i][28]&!rearImage[i][29]&!rearImage[i][30] & | |
800 | andL1 & andL2; | |
801 | ||
802 | // calculate Right deviation | |
803 | orR1=rearImage[i][8]|rearImage[i][10]|rearImage[i][12]|rearImage[i][14]; | |
804 | orR2=rearImage[i][8]|rearImage[i][9]|rearImage[i][10]|rearImage[i][11]; | |
805 | andR1=!rearImage[i][12]&!rearImage[i][13]&!rearImage[i][14]&!rearImage[i][15]; | |
806 | andR2= | |
807 | !rearImage[i][8]&!rearImage[i][9]&!rearImage[i][10]&!rearImage[i][11] & andR1; | |
808 | andR3=!rearImage[i][4]&!rearImage[i][5]&!rearImage[i][6]&!rearImage[i][7]; | |
809 | ||
810 | rightDev[0] = !rearImage[i][15]&(rearImage[i][14]|!rearImage[i][13]) & | |
811 | ((rearImage[i][12]|rearImage[i][14]|!rearImage[i][11]& | |
812 | (rearImage[i][10]|!rearImage[i][9])) & | |
813 | ((orR1|!rearImage[i][7]&(rearImage[i][6]|!rearImage[i][5])) & | |
814 | (orR1|rearImage[i][4]|rearImage[i][6]|!rearImage[i][3]&(rearImage[i][2]| | |
815 | !rearImage[i][1])))); | |
816 | ||
817 | rightDev[1] = !rearImage[i][15]&!rearImage[i][14] & | |
818 | !(!rearImage[i][4]&!rearImage[i][5]&!rearImage[i][8]&!rearImage[i][9] & | |
819 | (!rearImage[i][12]&!rearImage[i][13]&(rearImage[i][2]|rearImage[i][3]))) & | |
820 | (rearImage[i][12]|rearImage[i][13] | !rearImage[i][10]&!rearImage[i][11]) & | |
821 | (rearImage[i][8]|rearImage[i][9]|rearImage[i][12]|rearImage[i][13] | | |
822 | !rearImage[i][6]&!rearImage[i][7]); | |
823 | ||
824 | rightDev[2] = andR1 & (orR2 | andR3); | |
825 | rightDev[3] = andR2; | |
826 | rightDev[4] = | |
827 | !rearImage[i][0]&!rearImage[i][1]&!rearImage[i][2]&!rearImage[i][3] & | |
828 | andR2 & andR3 ; | |
829 | ||
830 | // compare Left & Right deviations | |
831 | Int_t tmpLeftDev=0, tmpRightDev=0; | |
832 | for (j=0; j<5; j++) | |
833 | { | |
834 | tmpLeftDev = tmpLeftDev + Int_t(leftDev[j]<<j); | |
835 | tmpRightDev = tmpRightDev + Int_t(rightDev[j]<<j); | |
836 | } | |
837 | ||
838 | // assign mimimum deviation do dev[][] | |
839 | if (tmpLeftDev < tmpRightDev ) | |
840 | { | |
841 | for (j=0; j<5; j++){ dev[i][j]=leftDev[j];} | |
842 | dev[i][5]=1; | |
843 | } else | |
844 | { | |
845 | for (j=0; j<5; j++){ dev[i][j]=rightDev[j];} | |
846 | dev[i][5]=0; | |
847 | } | |
848 | } | |
849 | ||
850 | //--- | |
851 | /* FIXME: use AliLog here... | |
852 | if(fDebug==3||fDebug==5) { | |
853 | printf("===============================================================\n"); | |
854 | for (i=30; i>=0; i--) { | |
855 | printf("%i \t",i); | |
856 | for (istrip=5; istrip>=0; istrip--) printf("%i",dev[i][istrip]); | |
857 | printf(" \n"); | |
858 | } | |
859 | } | |
860 | */ | |
861 | ||
862 | //--------------------------------------------------------- | |
863 | // step # 4 : sort deviation | |
864 | //--------------------------------------------------------- | |
865 | Int_t bga1[16], bga2[8], bga3[4], bga4[2], bga5; | |
866 | Int_t tmpbga1[16][6], tmpbga2[8][6], tmpbga3[4][6], tmpbga4[2][6], tmpbga5[6]; | |
867 | Int_t tmpMax[6]={1,1,1,1,1,0}; | |
868 | ||
869 | for (i=0; i<15; i++) | |
870 | { | |
871 | Sort2x5(dev[2*i],dev[2*i+1],tmpbga1[i],bga1[i]); | |
872 | } | |
873 | Sort2x5(dev[30],tmpMax,tmpbga1[15],bga1[15]); | |
874 | ||
875 | //-- | |
876 | /* FIXME: use AliLog here... | |
877 | ||
878 | if(fDebug==3||fDebug==5) { | |
879 | printf("===============================================================\n"); | |
880 | printf(" sorting : 1st level \n"); | |
881 | for (i=15; i>=0; i--) { | |
882 | printf("\t %i \t",bga1[i]); | |
883 | for (j=5; j>=0; j--) printf("%i",tmpbga1[i][j]); | |
884 | printf(" \n"); | |
885 | } | |
886 | } | |
887 | */ | |
888 | ||
889 | for (i=0; i<8; i++) | |
890 | { | |
891 | Sort2x5(tmpbga1[2*i],tmpbga1[2*i+1],tmpbga2[i],bga2[i]); | |
892 | } | |
893 | ||
894 | //-- | |
895 | /* FIXME: use AliLog here... | |
896 | if(fDebug==3||fDebug==5) { | |
897 | printf("===============================================================\n"); | |
898 | printf(" sorting : 2nd level \n"); | |
899 | for (i=7; i>=0; i--) { | |
900 | printf("\t %i \t",bga2[i]); | |
901 | for (j=5; j>=0; j--) printf("%i",tmpbga1[i][j]); | |
902 | printf(" \n"); | |
903 | } | |
904 | } | |
905 | */ | |
906 | ||
907 | for (i=0; i<4; i++) | |
908 | { | |
909 | Sort2x5(tmpbga2[2*i],tmpbga2[2*i+1],tmpbga3[i],bga3[i]); | |
910 | } | |
911 | ||
912 | //-- | |
913 | /* FIXME: use AliLog here... | |
914 | if(fDebug==3||fDebug==5) { | |
915 | printf("===============================================================\n"); | |
916 | printf(" sorting : 3rd level \n"); | |
917 | for (i=3; i>=0; i--) { | |
918 | printf("\t %i \t",bga3[i]); | |
919 | for (j=5; j>=0; j--) printf("%i",tmpbga3[i][j]); | |
920 | printf(" \n"); | |
921 | } | |
922 | } | |
923 | */ | |
924 | ||
925 | for (i=0; i<2; i++) | |
926 | { | |
927 | Sort2x5(tmpbga3[2*i],tmpbga3[2*i+1],tmpbga4[i],bga4[i]); | |
928 | } | |
929 | ||
930 | //-- | |
931 | /* FIXME: use AliLog Here... | |
932 | if(fDebug==3||fDebug==5) { | |
933 | printf("===============================================================\n"); | |
934 | printf(" sorting : 4th level \n"); | |
935 | for (i=1; i>=0; i--) { | |
936 | printf("\t %i \t",bga4[i]); | |
937 | for (j=5; j>=0; j--) printf("%i",tmpbga4[i][j]); | |
938 | printf(" \n"); | |
939 | } | |
940 | } | |
941 | */ | |
942 | ||
943 | Sort2x5(tmpbga4[0],tmpbga4[1],tmpbga5,bga5); | |
944 | ||
945 | // coding from 6 to 5 bits | |
946 | minDev[4] = tmpbga5[5] | tmpbga5[4]; | |
947 | for (i=0; i<4; i++) | |
948 | { | |
949 | minDev[i]=tmpbga5[i] & !tmpbga5[4]; | |
950 | } | |
951 | ||
952 | // find address of strip with minimum deviation | |
953 | minDevStrip[4]=bga5; | |
954 | if (bga5<=1) minDevStrip[3]=bga4[bga5]; | |
955 | ||
956 | Int_t tmpAd=minDevStrip[3]+minDevStrip[4]*2; | |
957 | if (tmpAd<=3) minDevStrip[2]=bga3[tmpAd]; | |
958 | ||
959 | tmpAd=minDevStrip[2]+minDevStrip[3]*2+minDevStrip[4]*4; | |
960 | if (tmpAd<=7) minDevStrip[1]=bga2[tmpAd]; | |
961 | ||
962 | tmpAd=minDevStrip[1]+minDevStrip[2]*2+minDevStrip[3]*4+minDevStrip[4]*8; | |
963 | if (tmpAd<=15) minDevStrip[0]=bga1[tmpAd]; | |
964 | ||
965 | /* FIXME : use AliLog here... | |
966 | if(fDebug==3||fDebug==5) { | |
967 | printf("===============================================================\n"); | |
968 | printf("minDevStrip = "); | |
969 | for (i=4; i>=0; i--) printf("%i",minDevStrip[i]); | |
970 | printf(" minDev = "); | |
971 | for (i=4; i>=0; i--) printf("%i",minDev[i]); | |
972 | printf(" \n"); | |
973 | printf("===============================================================\n"); | |
974 | } | |
975 | */ | |
976 | } | |
977 | ||
978 | //--------------------------------------------- | |
979 | void AliMUONTriggerDecisionV1::Sort2x5(Int_t dev1[6], Int_t dev2[6], | |
980 | Int_t minDev[6], Int_t &dev1GTdev2) | |
981 | { | |
982 | // returns minimun between dev1 and dev2 | |
983 | Int_t tmpDev1=0, tmpDev2=0; | |
984 | for (Int_t j=0; j<5; j++) | |
985 | { | |
986 | tmpDev1 = tmpDev1 + Int_t(dev1[j]<<j); | |
987 | tmpDev2 = tmpDev2 + Int_t(dev2[j]<<j); | |
988 | } | |
989 | if (tmpDev1 <= tmpDev2 ) | |
990 | { | |
991 | for (Int_t j=0; j<=5; j++) { minDev[j]=dev1[j];} | |
992 | dev1GTdev2=0; | |
993 | } else | |
994 | { | |
995 | for (Int_t j=0; j<=5; j++) { minDev[j]=dev2[j];} | |
996 | dev1GTdev2=1; | |
997 | } | |
998 | } | |
999 | ||
1000 | //---------------------------------------------------------------------- | |
1001 | // y part of trigger Algo | |
1002 | //---------------------------------------------------------------------- | |
1003 | ||
1004 | //---------------------------------------------------------------------- | |
1005 | void AliMUONTriggerDecisionV1::TrigY(Int_t y1[16], Int_t y2[16], | |
1006 | Int_t y3[16], Int_t y4[16], | |
1007 | Int_t y3u[16], Int_t y3d[16], | |
1008 | Int_t y4u[16], Int_t y4d[16], | |
1009 | Int_t x2m, Int_t x2ud, Int_t orMud[2], | |
1010 | Int_t resetMid, Int_t coinc44, | |
1011 | Int_t coordY[5]){ | |
1012 | // note : resMid = 1 -> cancel | |
1013 | //--------------------------------------------------------- | |
1014 | // step # 1 : prehandling Y | |
1015 | //--------------------------------------------------------- | |
1016 | Int_t i; | |
1017 | ||
1018 | for (i=0; i<16; i++) | |
1019 | { | |
1020 | y3[i]=y3[i]&!resetMid; | |
1021 | y4[i]=y4[i]&!resetMid; | |
1022 | } | |
1023 | ||
1024 | Int_t ch1[16], ch2[16], ch3[16], ch4[16]; | |
1025 | ||
1026 | Int_t tmpy3to16[16], tmpy4to16[16]; | |
1027 | Int_t tmpy3uto16[16], tmpy3dto16[16], tmpy4uto16[16], tmpy4dto16[16]; | |
1028 | for (i=0; i<8; i++) | |
1029 | { | |
1030 | ch1[2*i] = y1[i]&x2m | y1[2*i]&!x2m; | |
1031 | ch1[2*i+1] = y1[i]&x2m | y1[2*i+1]&!x2m; | |
1032 | ||
1033 | ch2[2*i] = y2[i]&x2m | y2[2*i]&!x2m; | |
1034 | ch2[2*i+1] = y2[i]&x2m | y2[2*i+1]&!x2m; | |
1035 | ||
1036 | tmpy3to16[2*i] = y3[i]&x2m | y3[2*i]&!x2m; | |
1037 | tmpy3to16[2*i+1] = y3[i]&x2m | y3[2*i+1]&!x2m; | |
1038 | ||
1039 | tmpy4to16[2*i] = y4[i]&x2m | y4[2*i]&!x2m; | |
1040 | tmpy4to16[2*i+1] = y4[i]&x2m | y4[2*i+1]&!x2m; | |
1041 | ||
1042 | tmpy3uto16[2*i] = y3u[i]&x2ud | y3u[2*i]&!x2ud; | |
1043 | tmpy3uto16[2*i+1] = y3u[i]&x2ud | y3u[2*i+1]&!x2ud; | |
1044 | ||
1045 | tmpy4uto16[2*i] = y4u[i]&x2ud | y4u[2*i]&!x2ud; | |
1046 | tmpy4uto16[2*i+1] = y4u[i]&x2ud | y4u[2*i+1]&!x2ud; | |
1047 | ||
1048 | tmpy3dto16[2*i] = y3d[i]&x2ud | y3d[2*i]&!x2ud; | |
1049 | tmpy3dto16[2*i+1] = y3d[i]&x2ud | y3d[2*i+1]&!x2ud; | |
1050 | ||
1051 | tmpy4dto16[2*i] = y4d[i]&x2ud | y4d[2*i]&!x2ud; | |
1052 | tmpy4dto16[2*i+1] = y4d[i]&x2ud | y4d[2*i+1]&!x2ud; | |
1053 | } | |
1054 | ||
1055 | if (orMud[0]==0&&orMud[1]==0) | |
1056 | { | |
1057 | for (i=0; i<16; i++) | |
1058 | { | |
1059 | ch3[i] = tmpy3to16[i]; | |
1060 | ch4[i] = tmpy4to16[i]; | |
1061 | } | |
1062 | } | |
1063 | if (orMud[0]==0&&orMud[1]==1) | |
1064 | { | |
1065 | for (i=0; i<16; i++) | |
1066 | { | |
1067 | ch3[i] = tmpy3uto16[i]|tmpy3to16[i]; | |
1068 | ch4[i] = tmpy4uto16[i]|tmpy4to16[i]; | |
1069 | } | |
1070 | } | |
1071 | if (orMud[0]==1&&orMud[1]==0) | |
1072 | { | |
1073 | for (i=0; i<16; i++) | |
1074 | { | |
1075 | ch3[i] = tmpy3dto16[i]|tmpy3to16[i]; | |
1076 | ch4[i] = tmpy4dto16[i]|tmpy4to16[i]; | |
1077 | } | |
1078 | } | |
1079 | if (orMud[0]==1&&orMud[1]==1) | |
1080 | { | |
1081 | for (i=0; i<16; i++) | |
1082 | { | |
1083 | ch3[i] = tmpy3dto16[i]|tmpy3to16[i]|tmpy3uto16[i]; | |
1084 | ch4[i] = tmpy4dto16[i]|tmpy4to16[i]|tmpy4uto16[i]; | |
1085 | } | |
1086 | } | |
1087 | ||
1088 | // debug | |
1089 | /* FIXME: use AliLog here... | |
1090 | if(fDebug==4||fDebug==5) { | |
1091 | printf("===============================================================\n"); | |
1092 | printf(" Y plane after PreHandling x2m x2ud orMud %i %i %i %i \n", | |
1093 | x2m,x2ud,orMud[0],orMud[1]); | |
1094 | printf(" "); | |
1095 | for (istrip=15; istrip>=0; istrip--) { | |
1096 | if (istrip>9) printf("%i",istrip-10*Int_t(istrip/10)); | |
1097 | if (istrip<10) printf("%i",istrip); | |
1098 | } | |
1099 | printf("\n YMC11 "); | |
1100 | for (istrip=15; istrip>=0; istrip--) printf("%i",ch1[istrip]); | |
1101 | printf("\n YMC12 "); | |
1102 | for (istrip=15; istrip>=0; istrip--) printf("%i",ch2[istrip]); | |
1103 | printf("\n YMC21 "); | |
1104 | for (istrip=15; istrip>=0; istrip--) printf("%i",ch3[istrip]); | |
1105 | printf("\n YMC22 "); | |
1106 | for (istrip=15; istrip>=0; istrip--) printf("%i",ch4[istrip]); | |
1107 | printf(" \n"); | |
1108 | } | |
1109 | */ | |
1110 | //debug | |
1111 | ||
1112 | //--------------------------------------------------------- | |
1113 | // step # 2 : calculate sgle and dble, apply DS reduction | |
1114 | //--------------------------------------------------------- | |
1115 | Int_t sgle1[16], dble1[16]; | |
1116 | Int_t sgle2[16], dble2[16]; | |
1117 | ||
1118 | // Calculate simple and double hits | |
1119 | for (i=0; i<16; i++) | |
1120 | { | |
1121 | dble1[i] = ch1[i] & ch2[i]; | |
1122 | dble2[i] = ch3[i] & ch4[i]; | |
1123 | ||
1124 | sgle1[i] = (ch1[i]|ch2[i]); | |
1125 | sgle2[i] = (ch3[i]|ch4[i]); | |
1126 | } | |
1127 | ||
1128 | //debug | |
1129 | /* FIXME: use AliLog here... | |
1130 | if(fDebug==4||fDebug==5) { | |
1131 | printf("===============================================================\n"); | |
1132 | printf(" Y plane after sgle dble \n"); | |
1133 | printf(" "); | |
1134 | for (istrip=15; istrip>=0; istrip--) { | |
1135 | if (istrip>9) printf("%i",istrip-10*Int_t(istrip/10)); | |
1136 | if (istrip<10) printf("%i",istrip); | |
1137 | } | |
1138 | printf("\n SGLE1 "); | |
1139 | for (istrip=15; istrip>=0; istrip--) printf("%i",sgle1[istrip]); | |
1140 | printf("\n DBLE1 "); | |
1141 | for (istrip=15; istrip>=0; istrip--) printf("%i",dble1[istrip]); | |
1142 | printf("\n SGLE2 "); | |
1143 | for (istrip=15; istrip>=0; istrip--) printf("%i",sgle2[istrip]); | |
1144 | printf("\n DBLE2 "); | |
1145 | for (istrip=15; istrip>=0; istrip--) printf("%i",dble2[istrip]); | |
1146 | printf(" \n"); | |
1147 | } | |
1148 | //debug | |
1149 | */ | |
1150 | ||
1151 | // DS Reduction | |
1152 | Int_t notOr1, notOr2; | |
1153 | ||
1154 | notOr1=!dble1[15] & !dble1[14] & !dble1[13] & !dble1[12] & | |
1155 | !dble1[11] & !dble1[10] & !dble1[9] & !dble1[8] & | |
1156 | !dble1[7] & !dble1[6] & !dble1[5] & !dble1[4] & | |
1157 | !dble1[3] & !dble1[2] & !dble1[1] & !dble1[0]; | |
1158 | ||
1159 | notOr2=!dble2[15] & !dble2[14] & !dble2[13] & !dble2[12] & | |
1160 | !dble2[11] & !dble2[10] & !dble2[9] & !dble2[8] & | |
1161 | !dble2[7] & !dble2[6] & !dble2[5] & !dble2[4] & | |
1162 | !dble2[3] & !dble2[2] & !dble2[1] & !dble2[0]; | |
1163 | ||
1164 | for (i=0; i<16; i++) | |
1165 | { | |
1166 | sgle1[i] = sgle1[i] & notOr1 & !coinc44; | |
1167 | sgle2[i] = sgle2[i] & notOr2 & !coinc44; | |
1168 | } | |
1169 | ||
1170 | //--------------------------------------------------------- | |
1171 | // step # 3 : 3/4 coincidence | |
1172 | //--------------------------------------------------------- | |
1173 | Int_t frontImage[16]; | |
1174 | ||
1175 | for (i=1; i<15; i++) | |
1176 | { | |
1177 | frontImage[i] = (dble1[i] | sgle1[i]) & | |
1178 | (dble2[i+1] | dble2[i] | dble2[i-1]) | | |
1179 | dble1[i] & (sgle2[i+1] | sgle2[i] | sgle2[i-1]); | |
1180 | } | |
1181 | frontImage[0] = (dble1[0] | sgle1[0]) & | |
1182 | (dble2[1] | dble2[0]) | dble1[0] & (sgle2[1] | sgle2[0]); | |
1183 | ||
1184 | frontImage[15] = (dble1[15] | sgle1[15]) & | |
1185 | (dble2[15] | dble2[14]) | dble1[15] & (sgle2[15] | sgle2[14]); | |
1186 | ||
1187 | ||
1188 | //debug | |
1189 | /* FIXME: use AliLog here... | |
1190 | if(fDebug==4||fDebug==5) { | |
1191 | printf("===============================================================\n"); | |
1192 | printf(" Y plane frontImage\n"); | |
1193 | printf(" "); | |
1194 | for (istrip=15; istrip>=0; istrip--) { | |
1195 | if (istrip>9) printf("%i",istrip-10*Int_t(istrip/10)); | |
1196 | if (istrip<10) printf("%i",istrip); | |
1197 | } | |
1198 | printf("\n "); | |
1199 | for (istrip=15; istrip>=0; istrip--) printf("%i",frontImage[istrip]); | |
1200 | printf("\n"); | |
1201 | } | |
1202 | //debug | |
1203 | */ | |
1204 | ||
1205 | //--------------------------------------------------------- | |
1206 | // step # 4 : Y position | |
1207 | //--------------------------------------------------------- | |
1208 | Int_t or1, or2, and1, and2, and3; | |
1209 | ||
1210 | or1 = frontImage[7]|frontImage[5]|frontImage[3]|frontImage[1]; | |
1211 | or2 = frontImage[7]|frontImage[6]|frontImage[5]|frontImage[4]; | |
1212 | and1 = !frontImage[3]&!frontImage[2]&!frontImage[1]&!frontImage[0]; | |
1213 | and2 = !frontImage[7]&!frontImage[6]&!frontImage[5]&!frontImage[4] & and1; | |
1214 | and3 = !frontImage[11]&!frontImage[10]&!frontImage[9]&!frontImage[8]; | |
1215 | ||
1216 | coordY[0] = !frontImage[0]&(frontImage[1]|!frontImage[2]) & | |
1217 | (frontImage[3]|frontImage[1]|!frontImage[4]&(frontImage[5]|!frontImage[6])) & | |
1218 | (or1|!frontImage[8]&(frontImage[9]|!frontImage[10])) & | |
1219 | (or1|frontImage[11]|frontImage[9]|!frontImage[12]&(frontImage[13]|!frontImage[14])); | |
1220 | ||
1221 | coordY[1] = !frontImage[0]&!frontImage[1] & | |
1222 | !(!frontImage[11]&!frontImage[10]&!frontImage[7]&!frontImage[6] & | |
1223 | !frontImage[3]&!frontImage[2]&(frontImage[13]|frontImage[12])) & | |
1224 | (frontImage[3]|frontImage[2] | !frontImage[5]&!frontImage[4]) & | |
1225 | (frontImage[7]|frontImage[6]|frontImage[3]|frontImage[2] | | |
1226 | !frontImage[9]&!frontImage[8]); | |
1227 | ||
1228 | coordY[2] = and1 & (or2 | and3); | |
1229 | ||
1230 | coordY[3] = and2; | |
1231 | ||
1232 | coordY[4] = !frontImage[15]&!frontImage[14]&!frontImage[13]&!frontImage[12] & | |
1233 | and2 & and3 ; | |
1234 | ||
1235 | } | |
1236 | //---------------------------------------------------------------------- | |
1237 | // end of trigger Algo | |
1238 | //---------------------------------------------------------------------- | |
1239 | ||
1240 | //______________________________________________________________________________ | |
1241 | void AliMUONTriggerDecisionV1::LocalTrigger(Int_t icirc, | |
1242 | Int_t minDevStrip[5], | |
1243 | Int_t minDev[5], Int_t coordY[5], | |
1244 | Int_t &iTrigger){ | |
1245 | // returns local trigger answer for circuit icirc | |
1246 | Int_t i; | |
1247 | ||
1248 | AliMUONTriggerCircuit* triggerCircuit; | |
1249 | triggerCircuit = (AliMUONTriggerCircuit*) fTriggerCircuit->At(icirc); | |
0a04ebd2 | 1250 | // Int_t idCircuit=triggerCircuit->GetIdCircuit(); |
998c0c43 | 1251 | |
1252 | Int_t signDev=minDev[4]; | |
1253 | Int_t deviation=0; | |
1254 | for (i=0; i<4; i++) | |
1255 | { // extract deviation | |
1256 | deviation = deviation+Int_t(minDev[i]<<i); | |
1257 | } | |
1258 | ||
1259 | Int_t istripX1Circ=0; | |
1260 | for (i=0; i<5; i++) | |
1261 | { // extract X1 strip fired | |
1262 | istripX1Circ = istripX1Circ+Int_t(minDevStrip[i]<<i); | |
1263 | } | |
1264 | ||
1265 | Int_t iStripY=0; | |
1266 | for (i=0; i<4; i++) | |
1267 | { // extract Y strip fired | |
1268 | iStripY = iStripY+Int_t(coordY[i]<<i); | |
1269 | } | |
1270 | ||
1271 | // trigger or not | |
1272 | if (signDev==1&&deviation==0) | |
1273 | { // something in X ? | |
1274 | iTrigger=0; | |
1275 | } else | |
1276 | { | |
1277 | if (coordY[4]==1&&iStripY==15) | |
1278 | { // something in Y ? | |
1279 | iTrigger=0; | |
1280 | } else | |
1281 | { | |
1282 | iTrigger=1; | |
1283 | } | |
1284 | } | |
1285 | ||
1286 | if (iTrigger==1) | |
1287 | { | |
1288 | // fill fTrigger fStripX11 fStripY11 | |
1289 | fTrigger[icirc] = 1; | |
1290 | fStripX11[icirc] = istripX1Circ; | |
1291 | fStripY11[icirc] = iStripY; | |
1292 | ||
1293 | // calculate deviation in [0+30] | |
1294 | Int_t sign=0; | |
1295 | if (signDev==0&&deviation!=0) sign=-1; | |
1296 | if (signDev==0&&deviation==0) sign=0; | |
1297 | if (signDev==1) sign=1; | |
1298 | fDev[icirc] = sign * deviation + 15; // fill fDev | |
1299 | ||
1300 | // get Lut output for circuit/istripX/idev/istripY | |
1301 | AliMUONTriggerLut lut; | |
1302 | // lut->StartEvent(); | |
1303 | lut.GetLutOutput(icirc,fStripX11[icirc],fDev[icirc],fStripY11[icirc], | |
1304 | fLutLpt[icirc],fLutHpt[icirc],fLutApt[icirc]); | |
1305 | // lut->FinishEvent(); | |
1306 | ||
1307 | /* FIXME : use AliLog here... | |
0a04ebd2 | 1308 | if (fDebug>1) { |
998c0c43 | 1309 | Float_t pt= // get ptCal corresponding to istripX1Circ/idev/iStripY |
1310 | triggerCircuit->PtCal(fStripX11[icirc],fDev[icirc],fStripY11[icirc]); | |
1311 | printf("-------------------------------------------\n"); | |
1312 | printf(" Local Trigger info for circuit Id %i (number %i ) \n", | |
1313 | idCircuit,icirc); | |
1314 | printf(" istripX1 signDev deviation istripY = %i %i %i %i \n", | |
1315 | istripX1Circ,signDev,deviation,iStripY); | |
0a04ebd2 | 1316 | printf(" fStripX11 %d fDev %d fStripY11 %d \n",fStripX11[icirc],fDev[icirc],fStripY11[icirc]); |
998c0c43 | 1317 | printf(" pt = %f (GeV/c) \n",pt); |
1318 | printf("-------------------------------------------\n"); | |
1319 | printf(" Local Trigger Lut Output = Lpt : "); | |
1320 | for (i=1; i>=0; i--) printf("%i",fLutLpt[icirc][i]); | |
1321 | printf(" Hpt : "); | |
1322 | for (i=1; i>=0; i--) printf("%i",fLutHpt[icirc][i]); | |
1323 | printf(" Apt : "); | |
1324 | for (i=1; i>=0; i--) printf("%i",fLutApt[icirc][i]); | |
1325 | printf("\n"); | |
1326 | printf("-------------------------------------------\n"); | |
1327 | } // fDebug > 1 | |
0a04ebd2 | 1328 | |
1329 | */ | |
998c0c43 | 1330 | } // local trigger = 1 |
1331 | } | |
1332 | ||
1333 | //---------------------------------------------------------------------- | |
1334 | void AliMUONTriggerDecisionV1::GlobalTrigger() | |
1335 | { | |
1336 | // loop on Lut[icirc] and give Global Trigger output | |
1337 | Int_t i; | |
1338 | ||
1339 | for (Int_t icirc=0; icirc<234; icirc++) | |
1340 | { | |
1341 | if (fLutLpt[icirc][0]==1&&fLutLpt[icirc][1]==1) | |
1342 | fGlobalSingleUndef[0] = fGlobalSingleUndef[0] + 1; | |
1343 | if (fLutHpt[icirc][0]==1&&fLutHpt[icirc][1]==1) | |
1344 | fGlobalSingleUndef[1] = fGlobalSingleUndef[1] + 1; | |
1345 | if (fLutApt[icirc][0]==1&&fLutApt[icirc][1]==1) | |
1346 | fGlobalSingleUndef[2] = fGlobalSingleUndef[2] + 1; | |
1347 | ||
1348 | if (fLutLpt[icirc][0]==0&&fLutLpt[icirc][1]==1) | |
1349 | fGlobalSinglePlus[0] = fGlobalSinglePlus[0] + 1; | |
1350 | if (fLutHpt[icirc][0]==0&&fLutHpt[icirc][1]==1) | |
1351 | fGlobalSinglePlus[1] = fGlobalSinglePlus[1] + 1; | |
1352 | if (fLutApt[icirc][0]==0&&fLutApt[icirc][1]==1) | |
1353 | fGlobalSinglePlus[2] = fGlobalSinglePlus[2] + 1; | |
1354 | ||
1355 | if (fLutLpt[icirc][0]==1&&fLutLpt[icirc][1]==0) | |
1356 | fGlobalSingleMinus[0] = fGlobalSingleMinus[0] + 1; | |
1357 | if (fLutHpt[icirc][0]==1&&fLutHpt[icirc][1]==0) | |
1358 | fGlobalSingleMinus[1] = fGlobalSingleMinus[1] + 1; | |
1359 | if (fLutApt[icirc][0]==1&&fLutApt[icirc][1]==0) | |
1360 | fGlobalSingleMinus[2] = fGlobalSingleMinus[2] + 1; | |
1361 | } | |
1362 | ||
1363 | // like sign low, high and all pt | |
1364 | for (i=0; i<3; i++) | |
1365 | { | |
1366 | fGlobalPairLike[i]=fGlobalSingleMinus[i]*(fGlobalSingleMinus[i]-1)/2 + | |
1367 | fGlobalSinglePlus[i]*(fGlobalSinglePlus[i]-1)/2 + | |
1368 | fGlobalSingleUndef[i]*(fGlobalSingleUndef[i]-1)/2 + | |
1369 | fGlobalSingleUndef[i]*fGlobalSinglePlus[i] + | |
1370 | fGlobalSingleUndef[i]*fGlobalSingleMinus[i]; | |
1371 | } | |
1372 | ||
1373 | // unlike sign low, high and all pt | |
1374 | for (i=0; i<3; i++) | |
1375 | { | |
1376 | fGlobalPairUnlike[i]=fGlobalSingleMinus[i]*fGlobalSinglePlus[i] + | |
1377 | fGlobalSingleUndef[i]*(fGlobalSingleUndef[i]-1)/2 + | |
1378 | fGlobalSingleUndef[i]*fGlobalSinglePlus[i] + | |
1379 | fGlobalSingleUndef[i]*fGlobalSingleMinus[i]; | |
1380 | } | |
1381 | ||
1382 | StdoutToAliDebug(1, | |
1383 | printf("===================================================\n"); | |
1384 | printf(" Global Trigger output Low pt High pt All\n"); | |
1385 | printf(" number of Single Plus :\t"); | |
1386 | for (i=0; i<3; i++) printf("%i\t",fGlobalSinglePlus[i]); | |
1387 | printf("\n"); | |
1388 | printf(" number of Single Minus :\t"); | |
1389 | for (i=0; i<3; i++) printf("%i\t",fGlobalSingleMinus[i]); | |
1390 | printf("\n"); | |
1391 | printf(" number of Single Undefined :\t"); | |
1392 | for (i=0; i<3; i++) printf("%i\t",fGlobalSingleUndef[i]); | |
1393 | printf("\n"); | |
1394 | printf(" number of UnlikeSign pair :\t"); | |
1395 | for (i=0; i<3; i++) printf("%i\t",fGlobalPairUnlike[i]); | |
1396 | printf("\n"); | |
1397 | printf(" number of LikeSign pair :\t"); | |
1398 | for (i=0; i<3; i++) printf("%i\t",fGlobalPairLike[i]); | |
1399 | printf("\n"); | |
1400 | printf("===================================================\n"); | |
1401 | printf("\n"); | |
1402 | ); | |
1403 | } | |
1404 | ||
1405 | //---------------------------------------------------------------------- | |
1406 | void AliMUONTriggerDecisionV1::PrintBitPatXInput(Int_t icirc) | |
1407 | { | |
1408 | // print bit pattern for X strips | |
1409 | ||
1410 | Int_t istrip; | |
1411 | ||
1412 | printf("-------- TRIGGER INPUT ---------\n"); | |
1413 | printf("===============================================================\n"); | |
1414 | printf(" 5432109876543210"); | |
1415 | printf("\n XMC11 "); | |
1416 | for (istrip=15; istrip>=0; istrip--) printf("%i",fXbit11[icirc][istrip]); | |
1417 | printf("\n XMC12 "); | |
1418 | for (istrip=15; istrip>=0; istrip--) printf("%i",fXbit12[icirc][istrip]); | |
1419 | printf("\n XMC21 "); | |
1420 | for (istrip=31; istrip>=0; istrip--) printf("%i",fXbit21[icirc][istrip]); | |
1421 | printf("\n XMC22 "); | |
1422 | for (istrip=31; istrip>=0; istrip--) printf("%i",fXbit22[icirc][istrip]); | |
1423 | printf("\n "); | |
1424 | printf("10987654321098765432109876543210\n"); | |
1425 | } | |
1426 | ||
1427 | //---------------------------------------------------------------------- | |
1428 | void AliMUONTriggerDecisionV1::PrintBitPatYInput(Int_t icirc) | |
1429 | { | |
1430 | // print bit pattern for Y strips | |
1431 | ||
1432 | Int_t istrip; | |
1433 | ||
1434 | AliMUONTriggerCircuit* triggerCircuit; | |
1435 | triggerCircuit = (AliMUONTriggerCircuit*) fTriggerCircuit->At(icirc); | |
1436 | Int_t idCircuit=triggerCircuit->GetIdCircuit(); | |
1437 | Int_t nStrip=triggerCircuit->GetNstripY(); | |
1438 | ||
1439 | printf("---------------------------------------------------------------\n"); | |
1440 | printf(" "); | |
1441 | for (istrip=nStrip-1; istrip>=0; istrip--) { | |
1442 | if (istrip>9) printf("%i",istrip-10*Int_t(istrip/10)); | |
1443 | if (istrip<10) printf("%i",istrip); | |
1444 | } | |
1445 | printf("\n YMC11 "); | |
1446 | for (istrip=nStrip-1; istrip>=0; istrip--) | |
1447 | printf("%i",fYbit11[icirc][istrip]); | |
1448 | printf("\n YMC12 "); | |
1449 | for (istrip=nStrip-1; istrip>=0; istrip--) | |
1450 | printf("%i",fYbit12[icirc][istrip]); | |
1451 | printf("\n YMC21 "); | |
1452 | for (istrip=nStrip-1; istrip>=0; istrip--) | |
1453 | printf("%i",fYbit21[icirc][istrip]); | |
1454 | printf("\n YMC22 "); | |
1455 | for (istrip=nStrip-1; istrip>=0; istrip--) | |
1456 | printf("%i",fYbit22[icirc][istrip]); | |
1457 | printf("\n"); | |
1458 | // tmp | |
1459 | printf("---------------------------------------------------------------"); | |
1460 | printf("\n upper part of circuit %i",idCircuit); | |
1461 | printf("\n UMC21 "); | |
1462 | for (istrip=15; istrip>=0; istrip--) printf("%i",fYbit21U[icirc][istrip]); | |
1463 | printf("\n UMC22 "); | |
1464 | for (istrip=15; istrip>=0; istrip--) printf("%i", fYbit22U[icirc][istrip]); | |
1465 | ||
1466 | printf("\n lower part of circuit %i",idCircuit); | |
1467 | printf("\n LMC21 "); | |
1468 | for (istrip=15; istrip>=0; istrip--) printf("%i",fYbit21D[icirc][istrip]); | |
1469 | printf("\n LMC22 "); | |
1470 | for (istrip=15; istrip>=0; istrip--) printf("%i",fYbit22D[icirc][istrip]); | |
1471 | printf("\n"); | |
1472 | printf("===============================================================\n"); | |
1473 | } | |
1474 | ||
1475 | //---------------------------------------------------------------------- | |
1476 | void AliMUONTriggerDecisionV1::PrintLocalOutput(Int_t minDevStrip[5], | |
1477 | Int_t minDev[5], | |
1478 | Int_t coordY[5]){ | |
1479 | // print Local trigger output before the LuT step | |
1480 | ||
1481 | Int_t i; | |
1482 | ||
1483 | printf("===============================================================\n"); | |
1484 | printf("-------- TRIGGER OUTPUT --------\n"); | |
1485 | printf("minDevStrip = "); | |
1486 | for (i=4; i>=0; i--) printf("%i",minDevStrip[i]); | |
1487 | printf(" minDev = "); | |
1488 | for (i=4; i>=0; i--) printf("%i",minDev[i]); | |
1489 | printf(" coordY = "); | |
1490 | for (i=4; i>=0; i--) printf("%i",coordY[i]); | |
1491 | printf(" \n"); | |
1492 | } | |
1493 | ||
1494 | //---------------------------------------------------------------------- | |
1495 | //--- methods which return member data related info | |
1496 | //---------------------------------------------------------------------- | |
1497 | Int_t AliMUONTriggerDecisionV1::GetITrigger(Int_t icirc) const | |
1498 | { | |
1499 | // returns Local Trigger Status | |
1500 | return fTrigger[icirc]; | |
1501 | } | |
1502 | //---------------------------------------------------------------------- | |
1503 | Int_t AliMUONTriggerDecisionV1::GetStripX11(Int_t icirc) const | |
1504 | { | |
1505 | // returns fStripX11 | |
1506 | return fStripX11[icirc]; | |
1507 | } | |
1508 | //---------------------------------------------------------------------- | |
1509 | Int_t AliMUONTriggerDecisionV1::GetDev(Int_t icirc) const | |
1510 | { | |
1511 | // returns idev | |
1512 | return fDev[icirc]; | |
1513 | } | |
1514 | //---------------------------------------------------------------------- | |
1515 | Int_t AliMUONTriggerDecisionV1::GetStripY11(Int_t icirc) const | |
1516 | { | |
1517 | // returns fStripY11; | |
1518 | return fStripY11[icirc]; | |
1519 | } | |
1520 | //---------------------------------------------------------------------- | |
1521 | void AliMUONTriggerDecisionV1::GetLutOutput(Int_t icirc, Int_t lpt[2], | |
1522 | Int_t hpt[2], Int_t apt[2]) const | |
1523 | { | |
1524 | // returns Look up Table output | |
1525 | for (Int_t i=0; i<2; i++) { | |
1526 | lpt[i]=fLutLpt[icirc][i]; | |
1527 | hpt[i]=fLutHpt[icirc][i]; | |
1528 | apt[i]=fLutApt[icirc][i]; | |
1529 | } | |
1530 | } | |
1531 | //---------------------------------------------------------------------- | |
1532 | void AliMUONTriggerDecisionV1::GetGlobalTrigger(Int_t singlePlus[3], | |
1533 | Int_t singleMinus[3], | |
1534 | Int_t singleUndef[3], | |
1535 | Int_t pairUnlike[3], | |
1536 | Int_t pairLike[3]) const | |
1537 | { | |
1538 | // returns Global Trigger information (0,1,2 : Lpt,Hpt,Apt) | |
1539 | // should not be used anymore. | |
1540 | for (Int_t i=0; i<3; i++) | |
1541 | { | |
1542 | singlePlus[i] = fGlobalSinglePlus[i]; | |
1543 | singleMinus[i] = fGlobalSingleMinus[i]; | |
1544 | singleUndef[i] = fGlobalSingleUndef[i]; | |
1545 | pairUnlike[i] = fGlobalPairUnlike[i]; | |
1546 | pairLike[i] = fGlobalPairLike[i]; | |
1547 | } | |
1548 | } | |
1549 | ||
1550 | //_______________________________________________________________________ | |
1551 | void AliMUONTriggerDecisionV1::Exec(Option_t*) | |
1552 | { | |
1553 | // call the Trigger Algorithm and fill TreeD | |
1554 | ||
1555 | ClearDigitNumbers(); | |
1556 | ||
1557 | fMUONData->ResetTrigger(); | |
1558 | ||
1559 | Trigger(); | |
1560 | ||
1561 | AliMUONGlobalTrigger* pGloTrig = | |
1562 | new AliMUONGlobalTrigger(fGlobalSinglePlus, fGlobalSingleMinus, | |
1563 | fGlobalSingleUndef, fGlobalPairUnlike, | |
1564 | fGlobalPairLike); | |
1565 | ||
1566 | // add a local trigger in the list | |
1567 | fMUONData->AddGlobalTrigger(*pGloTrig); | |
1568 | ||
1569 | for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) | |
1570 | { | |
1571 | if(GetITrigger(icirc)==1) | |
1572 | { | |
1573 | Int_t localtr[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; | |
1574 | Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0}; | |
1575 | GetLutOutput(icirc, loLpt, loHpt, loApt); | |
1576 | localtr[0] = icirc; | |
1577 | localtr[1] = GetStripX11(icirc); | |
1578 | localtr[2] = GetDev(icirc); | |
1579 | localtr[3] = GetStripY11(icirc); | |
1580 | for (Int_t i = 0; i < 2; i++) | |
1581 | { // convert the Lut output in 1 digit | |
1582 | localtr[4] += Int_t(loLpt[i]<<i); | |
1583 | localtr[5] += Int_t(loHpt[i]<<i); | |
1584 | localtr[6] += Int_t(loApt[i]<<i); | |
1585 | } | |
1586 | ||
1587 | for (Int_t i = 0; i < 16; i++) | |
1588 | { // convert X/Y bit in bit pattern | |
1589 | localtr[7] |= (fXbit11[icirc][i] << i); | |
1590 | localtr[8] |= (fXbit12[icirc][i] << i); | |
1591 | ||
1592 | // 8 first and last elts correspond to neighbouring cards | |
1593 | localtr[9] |= (fXbit21[icirc][i+8] << i); | |
1594 | localtr[10] |= (fXbit22[icirc][i+8] << i); | |
1595 | ||
1596 | localtr[11] |= (fYbit11[icirc][i] << i); | |
1597 | localtr[12] |= (fYbit12[icirc][i] << i); | |
1598 | localtr[13] |= (fYbit21[icirc][i] << i); | |
1599 | localtr[14] |= (fYbit22[icirc][i] << i); | |
1600 | } | |
1601 | ||
1602 | AliMUONLocalTrigger* pLocTrig = new AliMUONLocalTrigger(localtr, fDigitNumbers[icirc]); | |
1603 | fMUONData->AddLocalTrigger(*pLocTrig); // add a local trigger in the list | |
1604 | } | |
1605 | } | |
1606 | } | |
1607 | ||
1608 | //_______________________________________________________________________ | |
1609 | void AliMUONTriggerDecisionV1::ClearDigitNumbers() | |
1610 | { | |
1611 | // Clears the fDigitNumbers arrays so that they are all empty. | |
1612 | ||
1613 | for (Int_t i = 0; i < AliMUONConstants::NTriggerCircuit(); i++) | |
1614 | { | |
1615 | fDigitNumbers[i].Set(0); | |
1616 | } | |
1617 | } | |
1618 | ||
1619 | //_______________________________________________________________________ | |
1620 | void AliMUONTriggerDecisionV1::DigitFiredCircuit(Int_t circuit, Int_t cathode, | |
1621 | Int_t chamber, Int_t digit) | |
1622 | { | |
1623 | // Registers that the specified digit fired the specified circuit. | |
1624 | // This digit gets added to an array which will be copied to | |
1625 | // AliMUONLocalTrigger when such an object is created for each circuit. | |
1626 | ||
1627 | Int_t digitnumber = AliMUONLocalTrigger::EncodeDigitNumber(chamber, cathode, digit); | |
1628 | Int_t last = fDigitNumbers[circuit].GetSize(); | |
1629 | fDigitNumbers[circuit].Set(last + 1); | |
1630 | fDigitNumbers[circuit][last] = digitnumber; | |
1631 | } | |
1632 | ||
0a04ebd2 | 1633 | //_______________________________________________________________________ |
1634 | const Int_t AliMUONTriggerDecisionV1::CircuitSortedAsBoard[234]={ | |
1635 | 911, 811, 812, 711, 712, 611, 612, 613, 411, 412, 413, 311, 312, 211, 212, 111, | |
1636 | 921, 821, 822, 721, 722, 621, 622, 623, 624, 521, 522, 523, 524, 421, 422, 423, 424, 321, 322, 221, 222, 121, | |
1637 | 931, 831, 832, 731, 732, 631, 632, 633, 634, 531, 532, 533, 534, 431, 432, 433, 434, 331, 332, 231, 232, 131, | |
1638 | 941, 841, 842, 741, 742, 641, 642, 541, 542, 441, 442, 341, 342, 241, 242, 141, | |
1639 | 951, 851, 852, 751, 752, 651, 652, 551, 552, 451, 452, 351, 352, 251, 252, 151, | |
1640 | 961, 861, 862, 761, 762, 661, 662, 561, 562, 461, 462, 361, 362, 261, 262, 161, | |
1641 | 971, 871, 771, 671, 571, 471, 371, 271, 171, | |
1642 | -911, -811, -812, -711, -712, -611, -612, -613, -411, -412, -413, -311, -312, -211, -212, -111, | |
1643 | -921, -821, -822, -721, -722, -621, -622, -623, -624, -521, -522, -523, -524, -421, -422, -423, -424, -321, -322, -221, -222, -121, | |
1644 | -931, -831, -832, -731, -732, -631, -632, -633, -634, -531, -532, -533, -534, -431, -432, -433, -434, -331, -332, -231, -232, -131, | |
1645 | -941, -841, -842, -741, -742, -641, -642, -541, -542, -441, -442, -341, -342, -241, -242, -141, | |
1646 | -951, -851, -852, -751, -752, -651, -652, -551, -552, -451, -452, -351, -352, -251, -252, -151, | |
1647 | -961, -861, -862, -761, -762, -661, -662, -561, -562, -461, -462, -361, -362, -261, -262, -161, | |
1648 | -971, -871, -771, -671, -571, -471, -371, -271, -171}; | |
1649 | ||
1650 | //---------------------------------------------------------------------- | |
1651 | Int_t AliMUONTriggerDecisionV1::ModuleNumber(Int_t idModule) const { | |
1652 | // returns module number imod (from 0 to 63) corresponding to module idmodule | |
1653 | Int_t absidModule=TMath::Abs(idModule); | |
1654 | Int_t iModule=0; | |
1655 | for (Int_t i=0; i<63; i++) { | |
1656 | if (AliMUONTriggerConstants::ModuleId(i)==absidModule) { | |
1657 | iModule=i; | |
1658 | break; | |
1659 | } | |
1660 | } | |
1661 | return iModule; | |
1662 | } | |
1663 | //---------------------------------------------------------------------- | |
1664 | Int_t AliMUONTriggerDecisionV1::CircuitNumber(Int_t idCircuit) const { | |
1665 | // returns circuit number iCircuit (0-234) corresponding to circuit idCircuit | |
1666 | Int_t iCircuit=0; | |
1667 | for (Int_t i=0; i<234; i++) { | |
1668 | if (AliMUONTriggerConstants::CircuitId(i)==idCircuit) { | |
1669 | iCircuit=i; | |
1670 | break; | |
1671 | } | |
1672 | } | |
1673 | return iCircuit; | |
1674 | } | |
1675 | //_______________________________________________________________________ | |
1676 | Int_t AliMUONTriggerDecisionV1::Board2Circuit(Int_t iboard) const { | |
1677 | // returns Circuit number corresponding to iboard | |
1678 | Int_t idCircuit = CircuitSortedAsBoard[iboard]; | |
1679 | return CircuitNumber(idCircuit); | |
1680 | } | |
1681 |