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