Correct extrapolation to vertex through the absorber (M. Germain)
[u/mrichter/AliRoot.git] / MUON / AliMUONRawData.cxx
CommitLineData
f6762c71 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
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 **************************************************************************/
15
16////////////////////////////////////
17//
18// MUON Raw Data generator in ALICE-MUON
19//
c8b4255f 20// This class version 1 (further details could be found in Alice-note coming soon right in our direction)
21// Generates raw data for MUON tracker and finally for trigger
f6762c71 22// * a simple mapping is used (see below)
69be760c 23// * the bus patch id is calculated with an absolute number 0 - 999
c8b4255f 24// * one DDL per 1/2 chamber is created for both cathode.
25// For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit)
26// don't need for digits2raw but needed in raw2Reco
27// the position are given per local card
f6762c71 28////////////////////////////////////
c8b4255f 29
69be760c 30#include <TClonesArray.h>
f6762c71 31#include "AliMUONRawData.h"
32#include "AliMUONDigit.h"
1195fa7b 33
f6762c71 34#include "AliMUONConstants.h"
35#include "AliMUONData.h"
f6762c71 36#include "AliLoader.h"
37#include "AliBitPacking.h"
1195fa7b 38
39#include "AliMUONSubEventTrigger.h"
69be760c 40#include "AliMUONDDLTracker.h"
41#include "AliMUONDDLTrigger.h"
42
c8b4255f 43#include "AliMUONLocalTrigger.h"
44#include "AliMUONGlobalTrigger.h"
8c343c7c 45#include "AliLog.h"
f6762c71 46
47const Int_t AliMUONRawData::fgkDefaultPrintLevel = 0;
48
49ClassImp(AliMUONRawData) // Class implementation in ROOT context
50
51//__________________________________________________________________________
52AliMUONRawData::AliMUONRawData(AliLoader* loader)
69be760c 53 : TObject(),
54 fDebug(0)
f6762c71 55{
56 // Standard Constructor
57
f6762c71 58 fPrintLevel = fgkDefaultPrintLevel;
59
60 // initialize loader's
61 fLoader = loader;
62
63 // initialize container
64 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
69be760c 65
66 // trigger decision, temp solution, local & global has to move to Digits Tree
67// fTrigDec = new AliMUONTriggerDecision(fLoader);
68// fTrigData = fTrigDec->GetMUONData();
69
70 // initialize array
71 fSubEventArray[0] = new TClonesArray("AliMUONSubEventTracker",1000);
72 fSubEventArray[1] = new TClonesArray("AliMUONSubEventTracker",1000);
73
74 // initialize array
75 fSubEventTrigArray[0] = new TClonesArray("AliMUONSubEventTrigger",1000);
76 fSubEventTrigArray[1] = new TClonesArray("AliMUONSubEventTrigger",1000);
77
78 // ddl pointer
79 fDDLTracker = new AliMUONDDLTracker();
80 fDDLTrigger= new AliMUONDDLTrigger();
f6762c71 81}
82
83//__________________________________________________________________________
84AliMUONRawData::AliMUONRawData()
85 : TObject(),
f6762c71 86 fMUONData(0),
87 fPrintLevel(fgkDefaultPrintLevel),
88 fDebug(0),
89 fLoader(0)
90{
91 // Default Constructor
92}
93
94//_______________________________________________________________________
95AliMUONRawData::AliMUONRawData (const AliMUONRawData& rhs)
96 : TObject(rhs)
97{
98// Protected copy constructor
99
8c343c7c 100 AliFatal("Not implemented.");
f6762c71 101}
102
103//_______________________________________________________________________
104AliMUONRawData &
105AliMUONRawData::operator=(const AliMUONRawData& rhs)
106{
107// Protected assignement operator
108
109 if (this == &rhs) return *this;
110
8c343c7c 111 AliFatal("Not implemented.");
f6762c71 112
113 return *this;
114}
115
116//__________________________________________________________________________
117AliMUONRawData::~AliMUONRawData(void)
118{
119 if (fMUONData)
120 delete fMUONData;
69be760c 121 if (fSubEventArray[0])
122 fSubEventArray[0]->Delete(); //using delete cos allocating memory in copy ctor.
123 if (fSubEventArray[1])
124 fSubEventArray[1]->Delete();
125
126 if (fSubEventTrigArray[0])
127 fSubEventTrigArray[0]->Delete();
128 if (fSubEventTrigArray[1])
129 fSubEventTrigArray[1]->Delete();
130
131 if (fDDLTracker)
132 delete fDDLTracker;
133 if (fDDLTrigger)
134 delete fDDLTrigger;
135
f6762c71 136 return;
137}
138//____________________________________________________________________
139Int_t AliMUONRawData::WriteRawData()
140{
141 // convert digits of the current event to raw data
142
1195fa7b 143 Int_t idDDL;
f6762c71 144 Char_t name[20];
145
146 fLoader->LoadDigits("READ");
69be760c 147
c8b4255f 148 fMUONData->SetTreeAddress("D,GLT");
f6762c71 149
f6762c71 150
c8b4255f 151 // tracking chambers
152
153 for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) {
154
f6762c71 155 // open files
1195fa7b 156 idDDL = ich * 2 + 0x900;
157 sprintf(name, "MUON_%d.ddl",idDDL);
f6762c71 158 fFile1 = fopen(name,"w");
159
1195fa7b 160 idDDL = (ich * 2) + 1 + 0x900;
161 sprintf(name, "MUON_%d.ddl",idDDL);
f6762c71 162 fFile2 = fopen(name,"w");
163
69be760c 164 WriteTrackerDDL(ich);
f6762c71 165
166 // reset and close
167 fclose(fFile1);
168 fclose(fFile2);
169 fMUONData->ResetDigits();
170 }
69be760c 171
172 // trigger chambers
c8b4255f 173
69be760c 174 // open files
1195fa7b 175 idDDL = 0xA00;
176 sprintf(name, "MUTR_%d.ddl",idDDL);
c8b4255f 177 fFile1 = fopen(name,"w");
69be760c 178
1195fa7b 179 idDDL = 0xA00 + 1;
180 sprintf(name, "MUTR_%d.ddl",idDDL);
c8b4255f 181 fFile2 = fopen(name,"w");
69be760c 182
c8b4255f 183 WriteTriggerDDL();
184
185 // reset and close
186 fclose(fFile1);
187 fclose(fFile2);
188 fMUONData->ResetTrigger();
f6762c71 189
c8b4255f 190 fLoader->UnloadDigits();
69be760c 191
f6762c71 192 return kTRUE;
193}
194//____________________________________________________________________
69be760c 195Int_t AliMUONRawData::WriteTrackerDDL(Int_t iCh)
f6762c71 196{
69be760c 197 // resets
f6762c71 198 TClonesArray* muonDigits = 0;
69be760c 199 fSubEventArray[0]->Clear();
200 fSubEventArray[1]->Clear();
201
202 //
203 TArrayI nbInBus[2];
204
205 nbInBus[0].Set(5000);
206 nbInBus[1].Set(5000);
207
208 nbInBus[0].Reset();
209 nbInBus[1].Reset();
210
211 // DDL header
212 AliRawDataHeader header = fDDLTracker->GetHeader();
213 Int_t headerSize = fDDLTracker->GetHeaderSize();
f6762c71 214
215 // DDL event one per half chamber
69be760c 216 AliMUONSubEventTracker* subEvent;
f6762c71 217
218 // data format
219 Char_t parity = 0x4;
69be760c 220 UShort_t manuId = 0;
221 UChar_t channelId = 0;
222 UShort_t charge = 0;
223 Int_t busPatchId = 0;
f6762c71 224
225 UInt_t word;
69be760c 226 Int_t nEntries = 0;
227 Int_t* buffer = 0;
228 Int_t index;
229 Int_t indexDsp;
230 Int_t indexBlk;
f6762c71 231
232 Int_t nDigits;
69be760c 233 const AliMUONDigit* digit;
f6762c71 234
c8b4255f 235 if (fPrintLevel == 1)
69be760c 236 printf("WriteDDL chamber %d\n", iCh+1);
f6762c71 237
238 for (Int_t iCath = 0; iCath < 2; iCath++) {
239
f6762c71 240 fMUONData->ResetDigits();
241 fMUONData->GetCathode(iCath);
242 muonDigits = fMUONData->Digits(iCh);
243
244 nDigits = muonDigits->GetEntriesFast();
69be760c 245 if (fPrintLevel == 2)
f6762c71 246 printf("ndigits = %d\n",nDigits);
247
248 // open DDL file, on per 1/2 chamber
249
250 for (Int_t idig = 0; idig < nDigits; idig++) {
251
252 digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
253
69be760c 254 // mapping
255 GetDummyMapping(iCh, iCath, digit, busPatchId, manuId, channelId, charge);
256
257 //packing word
258 AliBitPacking::PackWord((UInt_t)parity,word,29,31);
259 AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
260 AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
261 AliBitPacking::PackWord((UInt_t)charge,word,0,11);
262
263 // set sub Event
264 subEvent = new AliMUONSubEventTracker();
265 subEvent->AddData(word);
266 subEvent->SetBusPatchId(busPatchId);
267 if (digit->PadX() > 0) {
268 nbInBus[0][busPatchId]++;
269 AddData1(subEvent);
270 } else {
271 nbInBus[1][busPatchId]++;
272 AddData2(subEvent);
273 }
274 delete subEvent;
275 }
276 }
277 fSubEventArray[0]->Sort();
278 fSubEventArray[1]->Sort();
279
280 // gather datas from same bus patch
281 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
282 nEntries = fSubEventArray[iDDL]->GetEntriesFast();
283
284 for (Int_t i = 0; i < nEntries; i++) {
285 AliMUONSubEventTracker* temp = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(i);
286 busPatchId = temp->GetBusPatchId();
287
288 // add bus patch header, length and total length managed by subevent class
289 temp->SetTriggerWord(0xdeadbeef);
290 for (Int_t j = 0; j < nbInBus[iDDL][busPatchId]-1; j++) {
291 AliMUONSubEventTracker* temp1 = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(++i);
292 temp->AddData(temp1->GetData(0));
293 fSubEventArray[iDDL]->RemoveAt(i) ;
294 }
295 }
296 fSubEventArray[iDDL]->Compress();
297
298 if (fPrintLevel == 3) {
299 nEntries = fSubEventArray[iDDL]->GetEntriesFast();
300 for (Int_t i = 0; i < nEntries; i++) {
301 AliMUONSubEventTracker* temp = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(i);
302 printf("busPatchid back %d\n",temp->GetBusPatchId());
303 for (Int_t j = 0; j < temp->GetLength(); j++) {
304 printf("manuId back %d, ",temp->GetManuId(j));
305 printf("channelId back %d, ",temp->GetChannelId(j));
306 printf("charge back %d\n",temp->GetCharge(j));
307 }
308 }
309 printf("\n");
310 }
311
312 }
313
314 Int_t iBusPatch;
315 Int_t iEntries;
316
317 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
318
319
320 // filling buffer
321 nEntries = fSubEventArray[iDDL]->GetEntriesFast();
322 buffer = new Int_t [(2048+24)*50]; // 24 words in average for one buspatch and 2048 manu info at most
323
324 indexBlk = 0;
325 indexDsp = 0;
326 index = 0;
327 iBusPatch = 0;
328 iEntries = 0;
329
330 for (Int_t iBlock = 0; iBlock < 2; iBlock++) {
331
332 // block header
333 fDDLTracker->SetTotalBlkLength(0xFFFFFFFF);
334 memcpy(&buffer[index],fDDLTracker->GetBlkHeader(),32);
335 indexBlk = index;
336 index += 8;
337
338 for (Int_t iDsp = 0; iDsp < 5; iDsp++) {
339
340 // DSP header
341 fDDLTracker->SetTotalDspLength(0xEEEEEEEE);
342 memcpy(&buffer[index],fDDLTracker->GetDspHeader(),32);
343 indexDsp = index;
344 index += 8;
345
346 for (Int_t i = 0; i < 5; i++) {
347
348 iBusPatch = i + iBlock*25 + iDsp*5 + 50*(2*iCh + iDDL);
349
350 AliMUONSubEventTracker* temp = (AliMUONSubEventTracker*)fSubEventArray[iDDL]->At(iEntries);
351 if (nEntries > 0)
352 busPatchId = temp->GetBusPatchId();
353 else
354 busPatchId = -1;
355
356 if (busPatchId == iBusPatch) {
357 // add bus patch structure
358 memcpy(&buffer[index],temp->GetAddress(),16);
359 index+= 4;
360 for (Int_t j = 0; j < temp->GetLength(); j++)
361 buffer[index++] = temp->GetData(j);
362 if (iEntries < nEntries-1)
363 iEntries++;
364 } else {
365 buffer[index++] = 4; // total length
366 buffer[index++] = 0; // raw data length
367 buffer[index++] = iBusPatch; // bus patch
368 buffer[index++] = 0xdeadbeef; // trigger word
369 }
370 } // bus patch
371 buffer[indexDsp] = index - indexDsp;
372 buffer[indexDsp+1] = index - indexDsp -8;
373 if ((index - indexDsp) % 2 == 0)
374 buffer[indexDsp+7] = 0;
375 else
376 buffer[indexDsp+7] = 1;
377 } // dsp
378 buffer[indexBlk] = index - indexBlk;
379 buffer[indexBlk+1] = index - indexBlk -8;
380 }
381 if (iDDL == 0) {
382 // write DDL 1
383 header.fSize = index + headerSize;// total length in word
384 fwrite((char*)(&header),headerSize*4,1,fFile1);
385 fwrite(buffer,sizeof(int),index,fFile1);
386 }
387 if (iDDL == 1) {
388 // write DDL 2
389 header.fSize = index + headerSize;// total length in word
390 fwrite((char*)(&header),headerSize*4,1,fFile2);
391 fwrite(buffer,sizeof(int),index,fFile2);
392 }
393 delete[] buffer;
394 }
395
396 return kTRUE;
397}
398//____________________________________________________________________
399Int_t AliMUONRawData::WriteTriggerDDL()
400{
401
c8b4255f 402 // DDL event one per half chamber
403 AliMUONSubEventTrigger* subEvent = 0x0;
69be760c 404
69be760c 405
c8b4255f 406 // stored local id number
407 TArrayI isFired(256);
408 isFired.Reset();
69be760c 409
69be760c 410
c8b4255f 411 // DDL header
412 AliRawDataHeader header = fDDLTrigger->GetHeader();
413 Int_t headerSize = fDDLTrigger->GetHeaderSize();
414
415 TClonesArray* localTrigger;
416 TClonesArray* globalTrigger;
417 AliMUONGlobalTrigger* gloTrg;
418 AliMUONLocalTrigger* locTrg = 0x0;
419
420 fMUONData->GetTriggerD();
421
422 // global trigger for trigger pattern
423 globalTrigger = fMUONData->GlobalTrigger();
424 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
425 Int_t gloTrigPat = GetGlobalTriggerPattern(gloTrg);
426
427 // local trigger
428 localTrigger = fMUONData->LocalTrigger();
429
430 UInt_t word;
431 Int_t* buffer = 0;
432 Int_t index;
433 Int_t iEntries = 0;
434 Int_t iLocCard, locCard;
e516b01d 435 Char_t locDec, trigY, posY, devX, posX,regOut;
c8b4255f 436 Int_t version = 1; // software version
437 Int_t eventType =1; // trigger type: 1 for physics ?
438 Int_t serialNb = 0xF; // serial nb of card: all bits on for the moment
439
440 Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
441 // stored the local card id that's fired
442 for (Int_t i = 0; i < nEntries; i++) {
443 locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
444 isFired[locTrg->LoCircuit()] = 1;
445 }
446
447 if (!nEntries)
8c343c7c 448 AliError("No Trigger information available");
c8b4255f 449
a0b2ac9a 450 buffer = new Int_t [680]; // [16(local)*5 words + 4 words]*8(reg) + 8 words = 680
c8b4255f 451
452 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
453
454 index = 0;
455
456 // DDL enhanced header
457 word =0;
458 AliBitPacking::PackWord((UInt_t)iDDL+1,word,30,31); //see AliMUONDDLTrigger.h for details
459 AliBitPacking::PackWord((UInt_t)version,word,22,29);
460 AliBitPacking::PackWord((UInt_t)serialNb,word,18,21);
461 AliBitPacking::PackWord((UInt_t)eventType,word,14,17);
462
463 fDDLTrigger->SetDDLWord(word);
464 fDDLTrigger->SetGlobalOutput(gloTrigPat);
465 memcpy(&buffer[index],fDDLTrigger->GetEnhancedHeader(),24);
466 index += 6;
467
468 for (Int_t iReg = 0; iReg < 8; iReg++) {
469
470 subEvent = new AliMUONSubEventTrigger();
471
472 // Regional card header
473 word = 0;
e516b01d 474 regOut = 0;
475 AliBitPacking::PackWord((UInt_t)serialNb,word,24,28); //see AliMUONSubEventTrigger.h for details
476 AliBitPacking::PackWord((UInt_t)version,word,16,23);
477 AliBitPacking::PackWord((UInt_t)iReg,word,12,15);
478 AliBitPacking::PackWord((UInt_t)regOut,word,0,7); // whenever regional output will be implemented
479
c8b4255f 480 subEvent->SetRegWord(word);
481 memcpy(&buffer[index++],subEvent->GetAddress(),4);
482
e516b01d 483 buffer[index++] = 0;// 2 words of regional input
484 buffer[index++] = 0;
485
c8b4255f 486 for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
487
488 iLocCard = iLoc + iReg*16 + iDDL*128;
489
490 if (isFired[iLocCard]) {
491 locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries);
492 locCard = locTrg->LoCircuit();
493 locDec = locTrg->GetLoDecision();
494 trigY = 0;
495 posY = locTrg->LoStripY();
496 posX = locTrg->LoStripX();
497 devX = locTrg->LoDev();
498 if (fPrintLevel == 4)
499 printf("loctrg %d, posX %d, posY %d, devX %d\n",
500 locTrg-> LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev());
501 } else { //no trigger (see PRR chpt 3.4)
502 locCard = -1;
503 locDec = 0;
504 trigY = 1;
505 posY = 15;
506 posX = 0;
507 devX = 0x8000;
508 }
509
510 //packing word
511 word = 0;
512 AliBitPacking::PackWord((UInt_t)(iLocCard % 16),word,19,22); //card id number in crate
513 AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
514 AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
515 AliBitPacking::PackWord((UInt_t)posY,word,10,13);
516 AliBitPacking::PackWord((UInt_t)devX,word,5,9);
517 AliBitPacking::PackWord((UInt_t)posX,word,0,4);
518
519 if (locCard == iLocCard) {
520 // add local cards structure
521 buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
522 buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
523 buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
524 buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
525 buffer[index++] = (Int_t)word; // data word
526 if (iEntries < nEntries-1)
527 iEntries++;
528 } else {
529 buffer[index++] = 0; // 4 words for x1, x2, y1, y2
530 buffer[index++] = 0;
531 buffer[index++] = 0;
532 buffer[index++] = 0;
533 buffer[index++] = (Int_t)word; // data word
534
535 }
536 } // local card
c8b4255f 537
538 delete subEvent;
539
540 } // Regional card
541
542 buffer[index++] = fDDLTrigger->GetEoD(); // End of DDL word
a0b2ac9a 543 buffer[index++] = fDDLTrigger->GetEoD(); // End of DDL word for 64 bits transfer purpose
c8b4255f 544
545
546 if (iDDL == 0) {
547 // write DDL 1
548 header.fSize = index + headerSize;// total length in word
549 fwrite((char*)(&header),headerSize*4,1,fFile1);
550 fwrite(buffer,sizeof(int),index,fFile1);
551 }
552 if (iDDL == 1) {
553 // write DDL 2
554 header.fSize = index + headerSize;// total length in word
555 fwrite((char*)(&header),headerSize*4,1,fFile2);
556 fwrite(buffer,sizeof(int),index,fFile2);
557 }
558 }
559 delete[] buffer;
69be760c 560
561 return kTRUE;
562}
563//____________________________________________________________________
564void AliMUONRawData::GetDummyMapping(Int_t iCh, Int_t iCath, const AliMUONDigit* digit,
565 Int_t &busPatchId, UShort_t &manuId, UChar_t &channelId, UShort_t &charge)
566{
1195fa7b 567// Dummy mapping for tracker
69be760c 568
569 Int_t offsetX = 0; // offet row
570 Int_t offsetY = 0; // offset columns
571 Int_t offsetCath = 0; //offset from one cathod to the other
572 Int_t maxChannel = 0; // maximum nb of channel in 1/2 chamber
573 Int_t id;
f6762c71 574 switch (iCh+1) {
575 case 1:
576 case 2:
577 case 3:
578 case 4:
579 offsetX = 512;
580 offsetY = 256;
581 offsetCath = 65536;
582 maxChannel = (offsetY * offsetX + 2* offsetY + offsetCath);
583 break;
584 case 5:
585 case 6:
586 case 7:
587 case 8:
588 case 9:
589 case 10:
590 offsetX = 1024;
591 offsetY = 0;
592 offsetCath = 65536;
593 maxChannel = (256 * offsetX + offsetX + offsetCath);
594 break;
595 }
596 // dummy mapping
597 // manu Id directly from a matrix 8*8, same segmentation for B and NB
598 // 50 buspatches for 1/2 chamber
f6762c71 599
69be760c 600 id = (TMath::Abs(digit->PadX()) * offsetX + digit->PadY() + offsetY +
601 offsetCath * iCath);
602 Int_t chPerBus = maxChannel/50;
603 busPatchId = id/chPerBus; // start at zero
604 if (digit->PadX() > 0)
605 busPatchId += 50*iCh*2;
606 else
607 busPatchId += 50*(2*iCh+1);
f6762c71 608 // 64 manu cards for one buspatch
69be760c 609 manuId = (id % chPerBus)/64; //start at zero
f6762c71 610 manuId &= 0x7FF; // 11 bits
611
612 // channel id
69be760c 613 channelId = (id % chPerBus) % 64; //start at zero
f6762c71 614 channelId &= 0x3F; // 6 bits
615
69be760c 616// id = (TMath::Abs(digit->PadX()) * offsetX + digit->PadY() + offsetY +
617// offsetCath * iCath);
618// busPatchId = id/50;
619
620// Int_t inBusId = id - (maxChannel/50 * busPatchId);// id channel in buspatch
621// Int_t manuPerBus = (maxChannel/(50*64)); // number of manus per buspatch
622
623// // 64 manu cards for one buspatch
624// manuId = inBusId/manuPerBus;
625// manuId &= 0x7FF; // 11 bits
626
627// // channel id
628// channelId = (inBusId % manuPerBus);
629// channelId &= 0x3F; // 6 bits
630
631 if (fPrintLevel == 2)
632 printf("id: %d, busPatchId %d, manuId: %d, channelId: %d, maxchannel: %d, chPerBus %d\n",
633 id, busPatchId, manuId, channelId, maxChannel, chPerBus);
f6762c71 634 // charge
635 charge = digit->Signal();
636 charge &= 0xFFF;
637
69be760c 638 if (fPrintLevel == 2)
f6762c71 639 printf("id: %d, busPatchId %d, manuId: %d, channelId: %d, padx: %d pady %d, charge %d\n",
640 id, busPatchId, manuId, channelId, digit->PadX(), digit->PadY(), digit->Signal());
f6762c71 641
f6762c71 642}
c8b4255f 643
644//____________________________________________________________________
1195fa7b 645Int_t AliMUONRawData::GetGlobalTriggerPattern(const AliMUONGlobalTrigger* gloTrg)
c8b4255f 646{
1195fa7b 647 // global trigger pattern calculation
648
c8b4255f 649 Int_t gloTrigPat = 0;
650
651 if (gloTrg->SinglePlusLpt()) gloTrigPat|= 0x1;
652 if (gloTrg->SinglePlusHpt()) gloTrigPat|= 0x2;
653 if (gloTrg->SinglePlusApt()) gloTrigPat|= 0x4;
654
655 if (gloTrg->SingleMinusLpt()) gloTrigPat|= 0x8;
656 if (gloTrg->SingleMinusHpt()) gloTrigPat|= 0x10;
657 if (gloTrg->SingleMinusApt()) gloTrigPat|= 0x20;
658
659 if (gloTrg->SingleUndefLpt()) gloTrigPat|= 0x40;
660 if (gloTrg->SingleUndefHpt()) gloTrigPat|= 0x80;
661 if (gloTrg->SingleUndefApt()) gloTrigPat|= 0x100;
662
663 if (gloTrg->PairUnlikeLpt()) gloTrigPat|= 0x200;
664 if (gloTrg->PairUnlikeHpt()) gloTrigPat|= 0x400;
665 if (gloTrg->PairUnlikeApt()) gloTrigPat|= 0x800;
666
667 if (gloTrg->PairLikeLpt()) gloTrigPat|= 0x1000;
668 if (gloTrg->PairLikeHpt()) gloTrigPat|= 0x2000;
669 if (gloTrg->PairLikeApt()) gloTrigPat|= 0x4000;
670
671 return gloTrigPat;
672}