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"
46 #include "AliMUONConstants.h"
48 #include "AliMUONDarcHeader.h"
49 #include "AliMUONRegHeader.h"
50 #include "AliMUONLocalStruct.h"
51 #include "AliMUONDspHeader.h"
52 #include "AliMUONBlockHeader.h"
54 #include "AliMUONData.h"
55 #include "AliMUONDigit.h"
56 #include "AliMUONGlobalTrigger.h"
57 #include "AliMUONLocalTrigger.h"
59 #include "AliMpBusPatch.h"
60 #include "AliMpDEManager.h"
62 #include "AliMpPlaneType.h"
63 #include "AliMpSegFactory.h"
64 #include "AliMpStationType.h"
65 #include "AliMpVSegmentation.h"
67 #include "TClonesArray.h"
69 ClassImp(AliMUONRawWriter) // Class implementation in ROOT context
71 Int_t AliMUONRawWriter::fgManuPerBusSwp1B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 224, 232};
72 Int_t AliMUONRawWriter::fgManuPerBusSwp1NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 225, 233};
74 Int_t AliMUONRawWriter::fgManuPerBusSwp2B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 226, 246};
75 Int_t AliMUONRawWriter::fgManuPerBusSwp2NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 227, 245};
78 //__________________________________________________________________________
79 AliMUONRawWriter::AliMUONRawWriter(AliMUONData* data)
84 // Standard Constructor
86 AliDebug(1,"Standard ctor");
88 // initialize container
92 fBusArray = new TClonesArray("AliMUONBusStruct",1000);
93 fBusArray->SetOwner(kTRUE);
95 // ddl tracker pointers
96 fBlockHeader = new AliMUONBlockHeader();
97 fDspHeader = new AliMUONDspHeader();
98 fBusStruct = new AliMUONBusStruct();
100 // setting data key to default value (only for writting)
101 fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey());
102 fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey());
103 fBusStruct->SetDataKey(fBusStruct->GetDefaultDataKey());
105 // ddl trigger pointers
106 fDarcHeader = new AliMUONDarcHeader();
107 fRegHeader = new AliMUONRegHeader();
108 fLocalStruct = new AliMUONLocalStruct();
110 // bus patch & Seg managers
111 fBusPatchManager = new AliMpBusPatch();
112 fBusPatchManager->ReadBusPatchFile();
114 fSegFactory = new AliMpSegFactory();
117 fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop();
118 fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop();
119 fMappingTimer.Start(kTRUE); fMappingTimer.Stop();
123 //__________________________________________________________________________
124 AliMUONRawWriter::AliMUONRawWriter()
134 fScalerEvent(kFALSE),
138 // Default Constructor
140 AliDebug(1,"Default ctor");
141 fFile[0] = fFile[1] = 0x0;
142 fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop();
143 fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop();
144 fMappingTimer.Start(kTRUE); fMappingTimer.Stop();
147 //_______________________________________________________________________
148 AliMUONRawWriter::AliMUONRawWriter (const AliMUONRawWriter& rhs)
152 // Protected copy constructor
154 AliFatal("Not implemented.");
157 //_______________________________________________________________________
159 AliMUONRawWriter::operator=(const AliMUONRawWriter& rhs)
162 // Protected assignement operator
164 if (this == &rhs) return *this;
166 AliFatal("Not implemented.");
171 //__________________________________________________________________________
172 AliMUONRawWriter::~AliMUONRawWriter(void)
188 delete fBusPatchManager;
192 AliInfo(Form("Execution time for MUON tracker : R:%.2fs C:%.2fs",
193 fTrackerTimer.RealTime(),fTrackerTimer.CpuTime()));
194 AliInfo(Form(" Execution time for MUON tracker (mapping calls part) "
196 fMappingTimer.RealTime(),fMappingTimer.CpuTime()));
197 AliInfo(Form("Execution time for MUON trigger : R:%.2fs C:%.2fs",
198 fTriggerTimer.RealTime(),fTriggerTimer.CpuTime()));
201 //____________________________________________________________________
202 Int_t AliMUONRawWriter::Digits2Raw()
205 // convert digits of the current event to raw data
210 fMUONData->GetLoader()->LoadDigits("READ");
212 fMUONData->SetTreeAddress("D,GLT");
214 fMUONData->ResetDigits();
215 fMUONData->ResetTrigger();
217 // This will get both tracker and trigger digits.
218 fMUONData->GetDigits();
222 for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++)
225 idDDL = ich * 2 + AliDAQ::DdlIDOffset("MUONTRK");
226 sprintf(name, "MUON_%d.ddl",idDDL);
227 fFile[0] = fopen(name,"w");
229 idDDL = (ich * 2) + 1 + AliDAQ::DdlIDOffset("MUONTRK");
230 sprintf(name, "MUON_%d.ddl",idDDL);
231 fFile[1] = fopen(name,"w");
233 WriteTrackerDDL(ich);
243 idDDL = AliDAQ::DdlIDOffset("MUONTRG");
244 sprintf(name, "MUTR_%d.ddl",idDDL);
245 fFile[0] = fopen(name,"w");
247 idDDL = AliDAQ::DdlIDOffset("MUONTRG") + 1;
248 sprintf(name, "MUTR_%d.ddl",idDDL);
249 fFile[1] = fopen(name,"w");
257 fMUONData->ResetDigits();
258 fMUONData->ResetTrigger();
259 fMUONData->GetLoader()->UnloadDigits();
264 //____________________________________________________________________
265 Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iCh)
267 // writing DDL for tracker
268 // used inverse mapping
270 fTrackerTimer.Start(kFALSE);
273 static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
276 TClonesArray* muonDigits = 0;
289 Int_t headerSize = sizeof(fHeader)/4;
291 // DDL event one per half chamber
296 UChar_t channelId = 0;
298 Int_t busPatchId = 0;
303 Int_t totalDspLength;
307 Int_t totalBlkLength;
311 Int_t totalDDLLength;
327 const AliMUONDigit* digit;
329 AliDebug(3, Form("WriteDDL chamber %d\n", iCh+1));
331 muonDigits = fMUONData->Digits(iCh);
333 nDigits = muonDigits->GetEntriesFast();
334 AliDebug(3,Form("ndigits = %d\n",nDigits));
337 for (Int_t idig = 0; idig < nDigits; idig++) {
339 digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
341 padX = digit->PadX();
342 padY = digit->PadY();
343 charge = digit->ADC();
344 if ( charge > kMAXADC )
346 // This is most probably an error in the digitizer (which should insure
347 // the adc is below kMAXADC), so make it a (non-fatal) error indeed.
348 AliError(Form("adc value %d above %x. Setting to %x",
349 charge,kMAXADC,kMAXADC));
352 cathode = digit->Cathode();
353 detElemId = digit->DetElemId();
356 busPatchId = GetBusPatch(*digit);
357 if (busPatchId<0) continue;
359 if ( digit->ManuId() > 0x7FF || digit->ManuId() < 0 ||
360 digit->ManuChannel() > 0x3F || digit->ManuChannel() < 0 )
362 StdoutToAliError(digit->Print(););
363 AliFatal("ManuId,ManuChannel are invalid for the digit above.");
366 manuId = ( digit->ManuId() & 0x7FF ); // 11 bits
367 channelId = ( digit->ManuChannel() & 0x3F ); // 6 bits
369 AliDebug(3,Form("input IdDE %d busPatchId %d PadX %d PadY %d iCath %d \n",
370 detElemId, busPatchId, padX, padY, cathode));
372 AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n", busPatchId, manuId, channelId ));
375 AliBitPacking::PackWord((UInt_t)parity,word,29,31);
376 AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
377 AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
378 AliBitPacking::PackWord((UInt_t)charge,word,0,11);
381 fBusStruct->SetLength(0);
382 fBusStruct->AddData(word);
383 fBusStruct->SetBusPatchId(busPatchId);
385 // storing the number of identical buspatches
386 nbInBus[busPatchId]++;
387 AddData(*fBusStruct);
391 // sorting by buspatch
394 // gather datas from same bus patch
395 nEntries = fBusArray->GetEntriesFast();
397 for (Int_t i = 0; i < nEntries; i++) {
398 AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i);
399 busPatchId = temp->GetBusPatchId();
401 // add bus patch header, length and total length managed by subevent class
402 for (Int_t j = 0; j < nbInBus[busPatchId]-1; j++) {
403 AliMUONBusStruct* temp1 = (AliMUONBusStruct*)fBusArray->At(++i);
404 temp->AddData(temp1->GetData(0));
405 fBusArray->RemoveAt(i) ;
408 fBusArray->Compress();
410 if (AliLog::GetGlobalDebugLevel() == 3) {
411 nEntries = fBusArray->GetEntriesFast();
412 for (Int_t i = 0; i < nEntries; i++) {
413 AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i);
414 printf("busPatchid back %d\n",temp->GetBusPatchId());
415 for (Int_t j = 0; j < temp->GetLength(); j++) {
416 printf("manuId back %d, ",temp->GetManuId(j));
417 printf("channelId back %d, ",temp->GetChannelId(j));
418 printf("charge back %d\n",temp->GetCharge(j));
424 // getting info for the number of buspatches
427 Int_t iBusPerDSP[5];//number of bus patches per DSP
428 Int_t iDspMax; //number max of DSP per block
430 fBusPatchManager->GetDspInfo(iCh, iDspMax, iBusPerDSP);
432 TArrayI* vec = fBusPatchManager->GetBusfromDE((iCh+1)*100);
434 Int_t iBus0AtCh = vec->At(0); //get first bus patch id for a given ich
436 AliDebug(3,Form("iBus0AtCh %d", iBus0AtCh));
438 iBusPatch = iBus0AtCh - 1; // starting point for each chamber
440 // nEntries = fBusArray->GetEntriesFast();
442 AliMUONBusStruct* busStructPtr = 0x0;
444 // open DDL file, on per 1/2 chamber
445 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
450 buffer = new Int_t [(2048+24)*50]; // 24 words at most for one buspatch and 2048 manu info at most
456 // two blocks A and B per DDL
457 for (Int_t iBlock = 0; iBlock < 2; iBlock++) {
460 length = fBlockHeader->GetHeaderLength();
461 memcpy(&buffer[index],fBlockHeader->GetHeader(),length*4);
465 // 5 DSP's max per block
466 for (Int_t iDsp = 0; iDsp < iDspMax; iDsp++) {
469 length = fDspHeader->GetHeaderLength();
470 memcpy(&buffer[index],fDspHeader->GetHeader(),length*4);
474 //Â 5 buspatches max per DSP
475 for (Int_t i = 0; i < iBusPerDSP[iDsp]; i++) {
478 if ((fBusPatchManager->GetDDLfromBus(iBusPatch) % 2) == 0) // comparing to DDL file
483 AliDebug(3,Form("iCh %d iDDL %d iBlock %d iDsp %d busPatchId %d", iCh, iDDL, iBlock, iDsp, iBusPatch));
485 nEntries = fBusArray->GetEntriesFast();
488 for (Int_t iEntries = 0; iEntries < nEntries; iEntries++) { // method "bourrique"...
489 busStructPtr = (AliMUONBusStruct*)fBusArray->At(iEntries);
490 busPatchId = busStructPtr->GetBusPatchId();
491 if (busPatchId == iBusPatch) break;
493 AliDebug(3,Form("busPatchId %d", busStructPtr->GetBusPatchId()));
496 // check if buspatchid has digit
497 if (busPatchId != -1) {
498 // add bus patch structure header
499 length = busStructPtr->GetHeaderLength();
500 memcpy(&buffer[index],busStructPtr->GetHeader(),length*4);
503 // add bus patch data
504 for (Int_t j = 0; j < busStructPtr->GetLength(); j++) {
505 buffer[index++] = busStructPtr->GetData(j);
506 AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n",
507 busStructPtr->GetBusPatchId(),
508 busStructPtr->GetManuId(j), busStructPtr->GetChannelId(j) ));
510 // fBusArray->RemoveAt(iEntries);
511 // fBusArray->Compress();
513 // writting anyhow buspatch structure (empty ones)
514 buffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size
515 buffer[index++] = busStructPtr->GetHeaderLength(); // header length
516 buffer[index++] = 0; // raw data length
517 buffer[index++] = iBusPatch; // bus patch
521 // check if totalLength even
522 // set padding word in case
523 // Add one word 0xBEEFFACE at the end of DSP structure
524 totalDspLength = index - indexDsp;
525 if ((totalDspLength % 2) == 1) {
526 buffer[indexDsp + fDspHeader->GetHeaderLength() - 2] = 1;
527 buffer[index++] = fDspHeader->GetDefaultPaddingWord();
531 dspLength = totalDspLength - fDspHeader->GetHeaderLength();
533 buffer[indexDsp+1] = totalDspLength; // dsp total length
534 buffer[indexDsp+2] = dspLength; // data length
538 totalBlkLength = index - indexBlk;
539 blkLength = totalBlkLength - fBlockHeader->GetHeaderLength();
540 totalDDLLength += totalBlkLength;
542 buffer[indexBlk+1] = totalBlkLength; // total block length
543 buffer[indexBlk+2] = blkLength;
549 fHeader.fSize = (totalDDLLength + headerSize) * 4;// total length in bytes
550 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iFile]);
551 fwrite(buffer,sizeof(int),index,fFile[iFile]);
556 fTrackerTimer.Stop();
560 //____________________________________________________________________
561 Int_t AliMUONRawWriter::GetBusPatch(const AliMUONDigit& digit)
564 // Determine the BusPatch this digit belongs to.
566 fMappingTimer.Start(kFALSE);
570 // information from digits
571 Int_t detElemId = digit.DetElemId();
573 AliMpVSegmentation* seg =
574 fSegFactory->CreateMpSegmentationByElectronics(detElemId, digit.ManuId());
576 AliMpPlaneType plane = seg->PlaneType();
578 AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId);
580 if ( stationType == kStation1 || stationType == kStation2 )
582 if (plane == kBendingPlane)
584 ptr = &fgManuPerBusSwp1B[0];
588 ptr = &fgManuPerBusSwp1NB[0];
593 if (plane == kBendingPlane)
595 ptr = &fgManuPerBusSwp2B[0];
599 ptr = &fgManuPerBusSwp2NB[0];
603 // Getting buspatch id
604 TArrayI* vec = fBusPatchManager->GetBusfromDE(detElemId);
607 Int_t m = ( digit.ManuId() & 0x3FF ); // remove bit 10
608 //FIXME : how can we remove that condition
609 // on the 10-th bit ? All the rest need not any knowledge about it,
610 // can't we find a way to get manu<->buspatch transparent to this too ?
612 if ( stationType == kStation1 || stationType == kStation2 )
614 for (Int_t i = 0; i < 12; i++)
616 if (m >= *(ptr + pos++)) break;
621 // offset of 100 in manuId for following bus patch
625 if (pos >(Int_t) vec->GetSize())
627 AliError(Form("pos greater %d than size %d manuId %d detElemId %d \n",
628 pos, (Int_t)vec->GetSize(), digit.ManuId(), detElemId));
629 AliError(Form("Chamber %s Plane %s manuId %d m %d",
630 StationTypeName(stationType).Data(),
631 PlaneTypeName(plane).Data(),
637 Int_t busPatchId = vec->At(pos);
639 fMappingTimer.Stop();
644 //____________________________________________________________________
645 Int_t AliMUONRawWriter::WriteTriggerDDL()
650 fTriggerTimer.Start(kFALSE);
652 // DDL event one per half chamber
654 // stored local id number
655 TArrayI isFired(256);
660 Int_t headerSize = sizeof(AliRawDataHeader)/4;
662 TClonesArray* localTrigger;
663 TClonesArray* globalTrigger;
664 AliMUONGlobalTrigger* gloTrg;
665 AliMUONLocalTrigger* locTrg = 0x0;
667 // global trigger for trigger pattern
668 globalTrigger = fMUONData->GlobalTrigger();
669 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
670 Int_t gloTrigPat = gloTrg->GetGlobalPattern();
673 localTrigger = fMUONData->LocalTrigger();
679 Int_t iLocCard, locCard;
680 Char_t locDec, trigY, posY, posX,regOut;
682 Int_t version = 1; // software version
683 Int_t eventType = 1; // trigger type: 1 for physics ?
684 Int_t serialNb = 0xF; // serial nb of card: all bits on for the moment
685 Int_t globalFlag = 1; // set to 2 if global info present in DDL else set to 1
688 eventType = 2; //set to generate scaler events
690 Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
691 // stored the local card id that's fired
692 for (Int_t i = 0; i < nEntries; i++) {
693 locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
694 isFired[locTrg->LoCircuit()] = 1; // storing local boards with informations
698 AliInfo("No Trigger information available");
701 // [16(local)*51 words + 16 words]*8(reg) + 6 + 12 + 6 words scaler event 6672 words
702 buffer = new Int_t [6680];
704 // [16(local)*6 words + 5 words]*8(reg) + 10 words = 818
705 buffer = new Int_t [818];
708 // open DDL file, on per 1/2 chamber
709 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
714 // set darc status word
715 AliBitPacking::PackWord((UInt_t)iDDL+1,word,28,31); //see AliMUONDDLTrigger.h for details
716 AliBitPacking::PackWord((UInt_t)serialNb,word,24,27);
717 AliBitPacking::PackWord((UInt_t)version,word,16,23);
718 AliBitPacking::PackWord((UInt_t)eventType,word,12,15);
720 if (iDDL == 0) // suppose global info in DDL one
725 AliBitPacking::PackWord((UInt_t)globalFlag,word,8,11);
726 fDarcHeader->SetWord(word);
728 memcpy(&buffer[index], fDarcHeader->GetHeader(), (fDarcHeader->GetDarcHeaderLength())*4);
729 index += fDarcHeader->GetDarcHeaderLength();
732 fDarcHeader->SetGlobalOutput(gloTrigPat);// no global input for the moment....
734 fDarcHeader->SetGlobalOutput(0);
737 // 6 DARC scaler words
738 memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),fDarcHeader->GetDarcScalerLength()*4);
739 index += fDarcHeader->GetDarcScalerLength();
742 buffer[index++] = fDarcHeader->GetEndOfDarc();
744 // 4 words of global board input + Global board output
745 memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (fDarcHeader->GetGlobalHeaderLength())*4);
746 index += fDarcHeader->GetGlobalHeaderLength();
749 // 10 Global scaler words
750 memcpy(fDarcHeader->GetGlobalScalers(), &buffer[index], fDarcHeader->GetGlobalScalerLength()*4);
751 index += fDarcHeader->GetGlobalScalerLength();
754 // end of global word
755 buffer[index++] = fDarcHeader->GetEndOfGlobal();
757 // 8 regional cards per DDL
758 for (Int_t iReg = 0; iReg < 8; iReg++) {
760 // Regional card header
763 // set darc status word
764 fRegHeader->SetDarcWord(word);
767 AliBitPacking::PackWord((UInt_t)serialNb,word,24,28); //see AliMUONLocalStruct.h for details
768 AliBitPacking::PackWord((UInt_t)version,word,16,23);
769 AliBitPacking::PackWord((UInt_t)iReg,word,12,15);
770 AliBitPacking::PackWord((UInt_t)regOut,word,0,7); // whenever regional output will be implemented
772 fRegHeader->SetWord(word);
773 memcpy(&buffer[index],fRegHeader->GetHeader(),fRegHeader->GetHeaderLength()*4);
774 index += fRegHeader->GetHeaderLength();
776 // 11 regional scaler word
778 memcpy(&buffer[index], fRegHeader->GetScalers(), fRegHeader->GetScalerLength()*4);
779 index += fRegHeader->GetScalerLength();
782 // end of regional word
783 buffer[index++] = fRegHeader->GetEndOfReg();
785 // 16 local card per regional board
786 for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
788 iLocCard = iLoc + iReg*16 + iDDL*128;
790 if (isFired[iLocCard]) {
791 locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries);
792 locCard = locTrg->LoCircuit();
793 locDec = locTrg->GetLoDecision();
795 posY = locTrg->LoStripY();
796 posX = locTrg->LoStripX();
797 devX = locTrg->LoDev();
798 AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n",
799 locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev()));
800 } else { //no trigger (see PRR chpt 3.4)
801 locCard = -1; // not possible on 4 bits
811 AliBitPacking::PackWord((UInt_t)(iLocCard % 16),word,19,22); //card id number in crate
812 AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
813 AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
814 AliBitPacking::PackWord((UInt_t)posY,word,10,13);
815 AliBitPacking::PackWord((UInt_t)devX,word,5,9);
816 AliBitPacking::PackWord((UInt_t)posX,word,0,4);
818 if (locCard == iLocCard) {
819 // add local cards structure
820 buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
821 buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
822 buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
823 buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
824 buffer[index++] = (Int_t)word; // data word
825 if (iEntries < nEntries-1)
828 buffer[index++] = 0; // 4 words for x1, x2, y1, y2
832 buffer[index++] = (Int_t)word; // data word
835 // 45 regional scaler word
837 memcpy(&buffer[index], fLocalStruct->GetScalers(), fLocalStruct->GetScalerLength()*4);
838 index += fLocalStruct->GetScalerLength();
841 // end of local structure words
842 buffer[index++] = fLocalStruct->GetEndOfLocal();
849 // writting onto disk
851 fHeader.fSize = (index + headerSize) * 4;// total length in bytes
852 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iDDL]);
853 fwrite(buffer,sizeof(int),index,fFile[iDDL]);
858 fTriggerTimer.Stop();
862 //____________________________________________________________________
863 void AliMUONRawWriter::SetScalersNumbers()
865 // set numbers for scaler events for trigger headers
866 // since this is provided by the experiment
867 // put dummy numbers to check the monitoring
869 fDarcHeader->SetScalersNumbers();
870 fRegHeader->SetScalersNumbers();
871 fLocalStruct->SetScalersNumbers();
873 fScalerEvent = kTRUE;