1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////
20 // MUON Raw Data generaton in ALICE-MUON
21 // This class version 3 (further details could be found in Alice-note)
23 // Implemented non-constant buspatch numbers for tracking
24 // with correct DDL id (first guess)
25 // (Ch. Finck, dec 2005)
28 // Generates raw data for MUON tracker and finally for trigger
29 // Using real mapping (inverse) for tracker
30 // For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit)
32 // Use memcpy instead of assignment elt by elt
33 // Introducing variable DSP numbers, real manu numbers per buspatch for st12
34 // Implemented scaler event for Trigger
37 ////////////////////////////////////
39 #include "AliMUONRawWriter.h"
41 #include "AliBitPacking.h"
42 #include "AliRawReader.h"
45 #include "AliMUONConstants.h"
47 #include "AliMUONDarcHeader.h"
48 #include "AliMUONRegHeader.h"
49 #include "AliMUONLocalStruct.h"
50 #include "AliMUONDspHeader.h"
51 #include "AliMUONBlockHeader.h"
53 #include "AliMUONData.h"
54 #include "AliMUONDigit.h"
55 #include "AliMUONGlobalTrigger.h"
56 #include "AliMUONLocalTrigger.h"
58 #include "AliMpBusPatch.h"
59 #include "AliMpDEManager.h"
61 #include "AliMpPlaneType.h"
62 #include "AliMpSegFactory.h"
63 #include "AliMpStationType.h"
64 #include "AliMpVSegmentation.h"
66 #include "TClonesArray.h"
68 ClassImp(AliMUONRawWriter) // Class implementation in ROOT context
70 Int_t AliMUONRawWriter::fgManuPerBusSwp1B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 224, 232};
71 Int_t AliMUONRawWriter::fgManuPerBusSwp1NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 225, 233};
73 Int_t AliMUONRawWriter::fgManuPerBusSwp2B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 226, 246};
74 Int_t AliMUONRawWriter::fgManuPerBusSwp2NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 227, 245};
77 //__________________________________________________________________________
78 AliMUONRawWriter::AliMUONRawWriter(AliMUONData* data)
83 // Standard Constructor
85 AliDebug(1,"Standard ctor");
87 // initialize container
91 fBusArray = new TClonesArray("AliMUONBusStruct",1000);
92 fBusArray->SetOwner(kTRUE);
94 // ddl tracker pointers
95 fBlockHeader = new AliMUONBlockHeader();
96 fDspHeader = new AliMUONDspHeader();
97 fBusStruct = new AliMUONBusStruct();
99 // setting data key to default value (only for writting)
100 fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey());
101 fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey());
102 fBusStruct->SetDataKey(fBusStruct->GetDefaultDataKey());
104 // set default paddind word (only for writting)
105 fDspHeader->SetPaddingWord(fDspHeader->GetDefaultPaddingWord());
107 // ddl trigger pointers
108 fDarcHeader = new AliMUONDarcHeader();
109 fRegHeader = new AliMUONRegHeader();
110 fLocalStruct = new AliMUONLocalStruct();
112 // bus patch & Seg managers
113 fBusPatchManager = new AliMpBusPatch();
114 fBusPatchManager->ReadBusPatchFile();
116 fSegFactory = new AliMpSegFactory();
119 fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop();
120 fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop();
121 fMappingTimer.Start(kTRUE); fMappingTimer.Stop();
125 //__________________________________________________________________________
126 AliMUONRawWriter::AliMUONRawWriter()
136 fScalerEvent(kFALSE),
140 // Default Constructor
142 AliDebug(1,"Default ctor");
143 fFile[0] = fFile[1] = 0x0;
144 fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop();
145 fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop();
146 fMappingTimer.Start(kTRUE); fMappingTimer.Stop();
149 //_______________________________________________________________________
150 AliMUONRawWriter::AliMUONRawWriter (const AliMUONRawWriter& rhs)
154 // Protected copy constructor
156 AliFatal("Not implemented.");
159 //_______________________________________________________________________
161 AliMUONRawWriter::operator=(const AliMUONRawWriter& rhs)
164 // Protected assignement operator
166 if (this == &rhs) return *this;
168 AliFatal("Not implemented.");
173 //__________________________________________________________________________
174 AliMUONRawWriter::~AliMUONRawWriter(void)
190 delete fBusPatchManager;
194 AliInfo(Form("Execution time for MUON tracker : R:%.2fs C:%.2fs",
195 fTrackerTimer.RealTime(),fTrackerTimer.CpuTime()));
196 AliInfo(Form(" Execution time for MUON tracker (mapping calls part) "
198 fMappingTimer.RealTime(),fMappingTimer.CpuTime()));
199 AliInfo(Form("Execution time for MUON trigger : R:%.2fs C:%.2fs",
200 fTriggerTimer.RealTime(),fTriggerTimer.CpuTime()));
203 //____________________________________________________________________
204 Int_t AliMUONRawWriter::Digits2Raw()
207 // convert digits of the current event to raw data
212 fMUONData->GetLoader()->LoadDigits("READ");
214 fMUONData->SetTreeAddress("D,GLT");
216 fMUONData->ResetDigits();
217 fMUONData->ResetTrigger();
219 // This will get both tracker and trigger digits.
220 fMUONData->GetDigits();
224 for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++)
227 idDDL = ich * 2 + 0x900; // official number for MUON
228 sprintf(name, "MUON_%d.ddl",idDDL);
229 fFile[0] = fopen(name,"w");
231 idDDL = (ich * 2) + 1 + 0x900;
232 sprintf(name, "MUON_%d.ddl",idDDL);
233 fFile[1] = fopen(name,"w");
235 WriteTrackerDDL(ich);
245 idDDL = 0xA00;// official number for MUTR
246 sprintf(name, "MUTR_%d.ddl",idDDL);
247 fFile[0] = fopen(name,"w");
250 sprintf(name, "MUTR_%d.ddl",idDDL);
251 fFile[1] = fopen(name,"w");
259 fMUONData->ResetDigits();
260 fMUONData->ResetTrigger();
261 fMUONData->GetLoader()->UnloadDigits();
266 //____________________________________________________________________
267 Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iCh)
269 // writing DDL for tracker
270 // used inverse mapping
272 fTrackerTimer.Start(kFALSE);
275 static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
278 TClonesArray* muonDigits = 0;
291 Int_t headerSize = sizeof(fHeader)/4;
293 // DDL event one per half chamber
298 UChar_t channelId = 0;
300 Int_t busPatchId = 0;
305 Int_t totalDspLength;
309 Int_t totalBlkLength;
313 Int_t totalDDLLength;
329 const AliMUONDigit* digit;
331 AliDebug(3, Form("WriteDDL chamber %d\n", iCh+1));
333 muonDigits = fMUONData->Digits(iCh);
335 nDigits = muonDigits->GetEntriesFast();
336 AliDebug(3,Form("ndigits = %d\n",nDigits));
339 for (Int_t idig = 0; idig < nDigits; idig++) {
341 digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
343 padX = digit->PadX();
344 padY = digit->PadY();
345 charge = digit->ADC();
346 if ( charge > kMAXADC )
348 // This is most probably an error in the digitizer (which should insure
349 // the adc is below kMAXADC), so make it a (non-fatal) error indeed.
350 AliError(Form("adc value %d above %x. Setting to %x",
351 charge,kMAXADC,kMAXADC));
354 cathode = digit->Cathode();
355 detElemId = digit->DetElemId();
358 busPatchId = GetBusPatch(*digit);
359 if (busPatchId<0) continue;
361 if ( digit->ManuId() > 0x7FF || digit->ManuId() < 0 ||
362 digit->ManuChannel() > 0x3F || digit->ManuChannel() < 0 )
364 StdoutToAliError(digit->Print(););
365 AliFatal("ManuId,ManuChannel are invalid for the digit above.");
368 manuId = ( digit->ManuId() & 0x7FF ); // 11 bits
369 channelId = ( digit->ManuChannel() & 0x3F ); // 6 bits
371 AliDebug(3,Form("input IdDE %d busPatchId %d PadX %d PadY %d iCath %d \n",
372 detElemId, busPatchId, padX, padY, cathode));
374 AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n", busPatchId, manuId, channelId ));
377 AliBitPacking::PackWord((UInt_t)parity,word,29,31);
378 AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
379 AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
380 AliBitPacking::PackWord((UInt_t)charge,word,0,11);
383 fBusStruct->SetLength(0);
384 fBusStruct->AddData(word);
385 fBusStruct->SetBusPatchId(busPatchId);
387 // storing the number of identical buspatches
388 nbInBus[busPatchId]++;
389 AddData(*fBusStruct);
393 // sorting by buspatch
396 // gather datas from same bus patch
397 nEntries = fBusArray->GetEntriesFast();
399 for (Int_t i = 0; i < nEntries; i++) {
400 AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i);
401 busPatchId = temp->GetBusPatchId();
403 // add bus patch header, length and total length managed by subevent class
404 for (Int_t j = 0; j < nbInBus[busPatchId]-1; j++) {
405 AliMUONBusStruct* temp1 = (AliMUONBusStruct*)fBusArray->At(++i);
406 temp->AddData(temp1->GetData(0));
407 fBusArray->RemoveAt(i) ;
410 fBusArray->Compress();
412 if (AliLog::GetGlobalDebugLevel() == 3) {
413 nEntries = fBusArray->GetEntriesFast();
414 for (Int_t i = 0; i < nEntries; i++) {
415 AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i);
416 printf("busPatchid back %d\n",temp->GetBusPatchId());
417 for (Int_t j = 0; j < temp->GetLength(); j++) {
418 printf("manuId back %d, ",temp->GetManuId(j));
419 printf("channelId back %d, ",temp->GetChannelId(j));
420 printf("charge back %d\n",temp->GetCharge(j));
426 // getting info for the number of buspatches
429 Int_t iBusPerDSP[5];//number of bus patches per DSP
430 Int_t iDspMax; //number max of DSP per block
432 fBusPatchManager->GetDspInfo(iCh, iDspMax, iBusPerDSP);
434 TArrayI* vec = fBusPatchManager->GetBusfromDE((iCh+1)*100);
436 Int_t iBus0AtCh = vec->At(0); //get first bus patch id for a given ich
438 AliDebug(3,Form("iBus0AtCh %d", iBus0AtCh));
440 iBusPatch = iBus0AtCh - 1; // starting point for each chamber
442 // nEntries = fBusArray->GetEntriesFast();
444 AliMUONBusStruct* busStructPtr = 0x0;
446 // open DDL file, on per 1/2 chamber
447 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
452 buffer = new Int_t [(2048+24)*50]; // 24 words at most for one buspatch and 2048 manu info at most
458 // two blocks A and B per DDL
459 for (Int_t iBlock = 0; iBlock < 2; iBlock++) {
462 length = fBlockHeader->GetHeaderLength();
463 memcpy(&buffer[index],fBlockHeader->GetHeader(),length*4);
467 // 5 DSP's max per block
468 for (Int_t iDsp = 0; iDsp < iDspMax; iDsp++) {
471 length = fDspHeader->GetHeaderLength();
472 memcpy(&buffer[index],fDspHeader->GetHeader(),length*4);
476 //Â 5 buspatches max per DSP
477 for (Int_t i = 0; i < iBusPerDSP[iDsp]; i++) {
480 if ((fBusPatchManager->GetDDLfromBus(iBusPatch) % 2) == 0) // comparing to DDL file
485 AliDebug(3,Form("iCh %d iDDL %d iBlock %d iDsp %d busPatchId %d", iCh, iDDL, iBlock, iDsp, iBusPatch));
487 nEntries = fBusArray->GetEntriesFast();
490 for (Int_t iEntries = 0; iEntries < nEntries; iEntries++) { // method "bourrique"...
491 busStructPtr = (AliMUONBusStruct*)fBusArray->At(iEntries);
492 busPatchId = busStructPtr->GetBusPatchId();
493 if (busPatchId == iBusPatch) break;
495 AliDebug(3,Form("busPatchId %d", busStructPtr->GetBusPatchId()));
498 // check if buspatchid has digit
499 if (busPatchId != -1) {
500 // add bus patch structure header
501 length = busStructPtr->GetHeaderLength();
502 memcpy(&buffer[index],busStructPtr->GetHeader(),length*4);
505 // add bus patch data
506 for (Int_t j = 0; j < busStructPtr->GetLength(); j++) {
507 buffer[index++] = busStructPtr->GetData(j);
508 AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n",
509 busStructPtr->GetBusPatchId(),
510 busStructPtr->GetManuId(j), busStructPtr->GetChannelId(j) ));
512 // fBusArray->RemoveAt(iEntries);
513 // fBusArray->Compress();
515 // writting anyhow buspatch structure (empty ones)
516 buffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size
517 buffer[index++] = busStructPtr->GetHeaderLength(); // header length
518 buffer[index++] = 0; // raw data length
519 buffer[index++] = iBusPatch; // bus patch
523 totalDspLength = index - indexDsp;
524 dspLength = totalDspLength - fDspHeader->GetHeaderLength();
526 buffer[indexDsp+1] = totalDspLength; // dsp total length
527 buffer[indexDsp+2] = dspLength; // data length
529 // remove padding word if necessary cos already in Dsp header length
530 // if total length is even, remove already placed padding word, else let it as it is.
531 if ((totalDspLength % 2) == 1) {
532 buffer[indexDsp+1] -= 1;
533 buffer[indexDsp+2] -= 1;
535 Int_t indexCopy = indexDsp + fDspHeader->GetHeaderLength() - 2;
536 memcpy(&buffer[indexCopy], &buffer[indexCopy+1],
537 (totalDspLength - fDspHeader->GetHeaderLength() + 2)*4);
542 totalBlkLength = index - indexBlk;
543 blkLength = totalBlkLength - fBlockHeader->GetHeaderLength();
544 totalDDLLength += totalBlkLength;
546 buffer[indexBlk+1] = totalBlkLength; // total block length
547 buffer[indexBlk+2] = blkLength;
553 fHeader.fSize = (totalDDLLength + headerSize) * 4;// total length in bytes
554 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iFile]);
555 fwrite(buffer,sizeof(int),index,fFile[iFile]);
560 fTrackerTimer.Stop();
564 //____________________________________________________________________
565 Int_t AliMUONRawWriter::GetBusPatch(const AliMUONDigit& digit)
568 // Determine the BusPatch this digit belongs to.
570 fMappingTimer.Start(kFALSE);
574 // information from digits
575 Int_t detElemId = digit.DetElemId();
577 AliMpVSegmentation* seg =
578 fSegFactory->CreateMpSegmentationByElectronics(detElemId, digit.ManuId());
580 AliMpPlaneType plane = seg->PlaneType();
582 AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId);
584 if ( stationType == kStation1 || stationType == kStation2 )
586 if (plane == kBendingPlane)
588 ptr = &fgManuPerBusSwp1B[0];
592 ptr = &fgManuPerBusSwp1NB[0];
597 if (plane == kBendingPlane)
599 ptr = &fgManuPerBusSwp2B[0];
603 ptr = &fgManuPerBusSwp2NB[0];
607 // Getting buspatch id
608 TArrayI* vec = fBusPatchManager->GetBusfromDE(detElemId);
611 Int_t m = ( digit.ManuId() & 0x3FF ); // remove bit 10
612 //FIXME : how can we remove that condition
613 // on the 10-th bit ? All the rest need not any knowledge about it,
614 // can't we find a way to get manu<->buspatch transparent to this too ?
616 if ( stationType == kStation1 || stationType == kStation2 )
618 for (Int_t i = 0; i < 12; i++)
620 if (m >= *(ptr + pos++)) break;
625 // offset of 100 in manuId for following bus patch
629 if (pos >(Int_t) vec->GetSize())
631 AliError(Form("pos greater %d than size %d manuId %d detElemId %d \n",
632 pos, (Int_t)vec->GetSize(), digit.ManuId(), detElemId));
633 AliError(Form("Chamber %s Plane %s manuId %d m %d",
634 StationTypeName(stationType).Data(),
635 PlaneTypeName(plane).Data(),
641 Int_t busPatchId = vec->At(pos);
643 fMappingTimer.Stop();
648 //____________________________________________________________________
649 Int_t AliMUONRawWriter::WriteTriggerDDL()
654 fTriggerTimer.Start(kFALSE);
656 // DDL event one per half chamber
658 // stored local id number
659 TArrayI isFired(256);
664 Int_t headerSize = sizeof(AliRawDataHeader)/4;
666 TClonesArray* localTrigger;
667 TClonesArray* globalTrigger;
668 AliMUONGlobalTrigger* gloTrg;
669 AliMUONLocalTrigger* locTrg = 0x0;
671 // global trigger for trigger pattern
672 globalTrigger = fMUONData->GlobalTrigger();
673 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
674 Int_t gloTrigPat = gloTrg->GetGlobalPattern();
677 localTrigger = fMUONData->LocalTrigger();
683 Int_t iLocCard, locCard;
684 Char_t locDec, trigY, posY, posX,regOut;
686 Int_t version = 1; // software version
687 Int_t eventType = 1; // trigger type: 1 for physics ?
688 Int_t serialNb = 0xF; // serial nb of card: all bits on for the moment
689 Int_t globalFlag = 1; // set to 2 if global info present in DDL else set to 1
692 eventType = 2; //set to generate scaler events
694 Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
695 // stored the local card id that's fired
696 for (Int_t i = 0; i < nEntries; i++) {
697 locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
698 isFired[locTrg->LoCircuit()] = 1; // storing local boards with informations
702 AliInfo("No Trigger information available");
705 // [16(local)*51 words + 16 words]*8(reg) + 6 + 12 + 6 words scaler event 6672 words
706 buffer = new Int_t [6680];
708 // [16(local)*6 words + 5 words]*8(reg) + 10 words = 818
709 buffer = new Int_t [818];
712 // open DDL file, on per 1/2 chamber
713 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
718 // set darc status word
719 AliBitPacking::PackWord((UInt_t)iDDL+1,word,28,31); //see AliMUONDDLTrigger.h for details
720 AliBitPacking::PackWord((UInt_t)serialNb,word,24,27);
721 AliBitPacking::PackWord((UInt_t)version,word,16,23);
722 AliBitPacking::PackWord((UInt_t)eventType,word,12,15);
724 if (iDDL == 0) // suppose global info in DDL one
729 AliBitPacking::PackWord((UInt_t)globalFlag,word,8,11);
730 fDarcHeader->SetWord(word);
732 memcpy(&buffer[index], fDarcHeader->GetHeader(), (fDarcHeader->GetDarcHeaderLength())*4);
733 index += fDarcHeader->GetDarcHeaderLength();
736 fDarcHeader->SetGlobalOutput(gloTrigPat);// no global input for the moment....
738 fDarcHeader->SetGlobalOutput(0);
741 // 6 DARC scaler words
742 memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),fDarcHeader->GetDarcScalerLength()*4);
743 index += fDarcHeader->GetDarcScalerLength();
746 buffer[index++] = fDarcHeader->GetEndOfDarc();
748 // 4 words of global board input + Global board output
749 memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (fDarcHeader->GetGlobalHeaderLength())*4);
750 index += fDarcHeader->GetGlobalHeaderLength();
753 // 10 Global scaler words
754 memcpy(fDarcHeader->GetGlobalScalers(), &buffer[index], fDarcHeader->GetGlobalScalerLength()*4);
755 index += fDarcHeader->GetGlobalScalerLength();
758 // end of global word
759 buffer[index++] = fDarcHeader->GetEndOfGlobal();
761 // 8 regional cards per DDL
762 for (Int_t iReg = 0; iReg < 8; iReg++) {
764 // Regional card header
767 // set darc status word
768 fRegHeader->SetDarcWord(word);
771 AliBitPacking::PackWord((UInt_t)serialNb,word,24,28); //see AliMUONLocalStruct.h for details
772 AliBitPacking::PackWord((UInt_t)version,word,16,23);
773 AliBitPacking::PackWord((UInt_t)iReg,word,12,15);
774 AliBitPacking::PackWord((UInt_t)regOut,word,0,7); // whenever regional output will be implemented
776 fRegHeader->SetWord(word);
777 memcpy(&buffer[index],fRegHeader->GetHeader(),fRegHeader->GetHeaderLength()*4);
778 index += fRegHeader->GetHeaderLength();
780 // 11 regional scaler word
782 memcpy(&buffer[index], fRegHeader->GetScalers(), fRegHeader->GetScalerLength()*4);
783 index += fRegHeader->GetScalerLength();
786 // end of regional word
787 buffer[index++] = fRegHeader->GetEndOfReg();
789 // 16 local card per regional board
790 for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
792 iLocCard = iLoc + iReg*16 + iDDL*128;
794 if (isFired[iLocCard]) {
795 locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries);
796 locCard = locTrg->LoCircuit();
797 locDec = locTrg->GetLoDecision();
799 posY = locTrg->LoStripY();
800 posX = locTrg->LoStripX();
801 devX = locTrg->LoDev();
802 AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n",
803 locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev()));
804 } else { //no trigger (see PRR chpt 3.4)
805 locCard = -1; // not possible on 4 bits
815 AliBitPacking::PackWord((UInt_t)(iLocCard % 16),word,19,22); //card id number in crate
816 AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
817 AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
818 AliBitPacking::PackWord((UInt_t)posY,word,10,13);
819 AliBitPacking::PackWord((UInt_t)devX,word,5,9);
820 AliBitPacking::PackWord((UInt_t)posX,word,0,4);
822 if (locCard == iLocCard) {
823 // add local cards structure
824 buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
825 buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
826 buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
827 buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
828 buffer[index++] = (Int_t)word; // data word
829 if (iEntries < nEntries-1)
832 buffer[index++] = 0; // 4 words for x1, x2, y1, y2
836 buffer[index++] = (Int_t)word; // data word
839 // 45 regional scaler word
841 memcpy(&buffer[index], fLocalStruct->GetScalers(), fLocalStruct->GetScalerLength()*4);
842 index += fLocalStruct->GetScalerLength();
845 // end of local structure words
846 buffer[index++] = fLocalStruct->GetEndOfLocal();
853 // writting onto disk
855 fHeader.fSize = (index + headerSize) * 4;// total length in bytes
856 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iDDL]);
857 fwrite(buffer,sizeof(int),index,fFile[iDDL]);
862 fTriggerTimer.Stop();
866 //____________________________________________________________________
867 void AliMUONRawWriter::SetScalersNumbers()
869 // set numbers for scaler events for trigger headers
870 // since this is provided by the experiment
871 // put dummy numbers to check the monitoring
873 fDarcHeader->SetScalersNumbers();
874 fRegHeader->SetScalersNumbers();
875 fLocalStruct->SetScalersNumbers();
877 fScalerEvent = kTRUE;