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