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