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