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