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