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 /// \class AliMUONRawWriter
19 /// MUON Raw Data generaton in ALICE-MUON
20 /// Raw data structure could be found in Alice-note.
22 /// Implemented non-constant buspatch numbers for tracking
23 /// with correct DDL id (first guess)
24 /// (Ch. Finck, dec 2005)
27 /// Generates raw data for MUON tracker and finally for trigger
28 /// Using real mapping (inverse) for tracker
29 /// For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit)
30 /// Ch. Finck, July 04
31 /// Use memcpy instead of assignment elt by elt
32 /// Introducing variable DSP numbers, real manu numbers per buspatch for st12
33 /// Implemented scaler event for Trigger
34 /// Ch. Finck, Jan. 06
35 /// Using bus itr in DDL instead of simple incrementation
36 /// treat correctly the DDL & buspatch for station 3.
37 /// Using informations from AliMUONTriggerCrateStore for
38 /// empty slots and non-notified cards in trigger crates.
39 /// Ch. Finck, August 06.
40 /// Using AliMpDDLStore::GetBusPatchId.
42 /// \author Ch. Finck, Feb. 07.
45 #include "AliMUONRawWriter.h"
47 #include "AliMUONBlockHeader.h"
48 #include "AliMUONBusStruct.h"
49 #include "AliMUONConstants.h"
50 #include "AliMUONDarcHeader.h"
51 #include "AliMUONData.h"
52 #include "AliMUONDigit.h"
53 #include "AliMUONDspHeader.h"
54 #include "AliMUONGlobalTrigger.h"
55 #include "AliMUONLocalStruct.h"
56 #include "AliMUONLocalTrigger.h"
57 #include "AliMUONLocalTriggerBoard.h"
58 #include "AliMUONRegionalTrigger.h"
59 #include "AliMUONRegHeader.h"
60 #include "AliMUONTriggerCrate.h"
61 #include "AliMUONTriggerCrateStore.h"
63 #include "AliMpDDLStore.h"
65 #include "AliMpDetElement.h"
66 #include "AliMpDEManager.h"
67 #include "AliMpExMap.h"
68 #include "AliMpConstants.h"
69 #include "AliMpPlaneType.h"
70 #include "AliMpSegmentation.h"
71 #include "AliMpStationType.h"
72 #include "AliMpVSegmentation.h"
74 #include "AliRawReader.h"
75 #include "AliBitPacking.h"
80 #include "TObjArray.h"
81 #include "TStopwatch.h"
84 ClassImp(AliMUONRawWriter) // Class implementation in ROOT context
89 enum ETimer { kWriteTracker, kWriteTrigger, kDigitLoop, kGetBusPatch, kTest, kLast };
92 //__________________________________________________________________________
93 AliMUONRawWriter::AliMUONRawWriter(AliMUONData* data)
96 fBlockHeader(new AliMUONBlockHeader()),
97 fDspHeader(new AliMUONDspHeader()),
98 fDarcHeader(new AliMUONDarcHeader()),
99 fRegHeader(new AliMUONRegHeader()),
100 fLocalStruct(new AliMUONLocalStruct()),
101 fDDLStore(AliMpDDLStore::Instance()),
102 fCrateManager(new AliMUONTriggerCrateStore()),
103 fScalerEvent(kFALSE),
105 fTimers(new TStopwatch[kLast])
108 /// Standard Constructor
110 AliDebug(1,"Standard ctor");
111 fFile[0] = fFile[1] = 0x0;
112 fFile[2] = fFile[3] = 0x0;
114 // setting data key to default value (only for writting)
115 fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey());
116 fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey());
119 fCrateManager->ReadFromFile();
122 for ( Int_t i = 0; i < kLast; ++i )
124 fTimers[i].Start(kTRUE);
130 //__________________________________________________________________________
131 AliMUONRawWriter::AliMUONRawWriter()
141 fScalerEvent(kFALSE),
145 /// Default Constructor
147 AliDebug(1,"Default ctor");
148 fFile[0] = fFile[1] = 0x0;
149 fFile[2] = fFile[3] = 0x0;
153 //__________________________________________________________________________
154 AliMUONRawWriter::~AliMUONRawWriter(void)
166 delete fCrateManager;
168 for ( Int_t i = 0; i < kLast; ++i )
170 AliDebug(1, Form("Execution time (timer %d) : R:%7.2fs C:%7.2fs",i,
171 fTimers[i].RealTime(),fTimers[i].CpuTime()));
177 //______________________________________________________________________________
179 //AliMUONRawWriter::CheckDigits()
181 // std::map<int,std::map<int,int> > m;
183 // for (Int_t iSt = 0; iSt < AliMUONConstants::NTrackingCh()/2; ++iSt)
185 // for (Int_t iCh = iSt*2; iCh <= iSt*2 + 1; ++iCh)
187 // TClonesArray* muonDigits = fMUONData->Digits(iCh);
188 // for (Int_t idig = 0; idig < muonDigits->GetEntriesFast(); idig++)
190 // AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
191 // Int_t busPatchId = GetBusPatch(*digit);
192 // m[busPatchId][digit->ManuId()]++;
197 // std::map<int,std::map<int,int> >::const_iterator it;
199 // Int_t nManuMax(0);
201 // for ( it = m.begin(); it != m.end(); ++it )
203 // AliDebug(1,Form("BusPatch %3d has %3d manus",it->first,it->second.size()));
204 // nManuMax = std::max((Int_t)it->second.size(),nManuMax);
205 // std::map<int,int>::const_iterator it2;
206 // for ( it2 = it->second.begin(); it2 != it->second.end(); ++it2 )
208 // AliDebug(1,Form(" BusPatch %3d Manu %4d Nch %3d",it->first,it2->first,it2->second));
211 // AliDebug(1,Form("Max manus per busPatch : %3d",nManuMax));
214 //____________________________________________________________________
215 Int_t AliMUONRawWriter::Digits2Raw()
217 /// convert digits of the current event to raw data
222 fMUONData->GetLoader()->LoadDigits("READ");
224 fMUONData->SetTreeAddress("D,GLT");
226 fMUONData->ResetDigits();
227 fMUONData->ResetTrigger();
229 // This will get both tracker and trigger digits.
230 fMUONData->GetDigits();
236 for (Int_t iSt = 0; iSt < AliMUONConstants::NTrackingCh()/2; ++iSt) {
238 // open files for one station
239 // cos station 3, 1/4 of DE's from 2 chambers has same DDL number
241 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
242 fFile[0] = fopen(name,"w");
244 idDDL = (iSt * 4) + 1;
245 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
246 fFile[1] = fopen(name,"w");
248 idDDL = (iSt * 4) + 2;;
249 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
250 fFile[2] = fopen(name,"w");
252 idDDL = (iSt * 4) + 3;
253 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
254 fFile[3] = fopen(name,"w");
256 WriteTrackerDDL(iSt);
258 // reset and close when station has been processed
266 AliDebug(1,"Tracker written");
272 strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
273 fFile[0] = fopen(name,"w");
276 strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
277 fFile[1] = fopen(name,"w");
285 AliDebug(1,"Trigger written");
287 fMUONData->ResetDigits();
288 fMUONData->ResetTrigger();
289 fMUONData->GetLoader()->UnloadDigits();
291 AliDebug(1,"muondata reset");
296 //____________________________________________________________________
297 Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iSt)
299 /// writing DDL for tracker
300 /// used inverse mapping
302 fTimers[kWriteTracker].Start(kFALSE);
304 static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
307 TClonesArray* muonDigits = 0;
310 Int_t headerSize = sizeof(fHeader)/4;
312 // DDL event one per half chamber
317 UChar_t channelId = 0;
319 Int_t busPatchId = 0;
324 Int_t totalDspLength;
328 Int_t totalBlkLength;
332 Int_t totalDDLLength;
339 // buffer size (max'ed out)
340 // (((43 manus max per bus patch *64 channels + 4 bus patch words) * 5 bus patch
341 // + 10 dsp words)*5 dsps + 8 block words)*2 blocks
342 static const Int_t kBufferSize = (((43*64 + 4)*5 + 10)*5 + 8)*2;
346 AliMpExMap busPatchMap(kTRUE);
348 fTimers[kDigitLoop].Start(kFALSE);
350 for (Int_t iCh = iSt*2; iCh <= iSt*2 + 1; ++iCh) {
352 muonDigits = fMUONData->Digits(iCh);
354 nDigits = muonDigits->GetEntriesFast();
357 for (Int_t idig = 0; idig < nDigits; ++idig) {
359 AliMUONDigit* digit = static_cast<AliMUONDigit*>(muonDigits->UncheckedAt(idig));
361 charge = digit->ADC();
362 if ( charge > kMAXADC )
364 // This is most probably an error in the digitizer (which should insure
365 // the adc is below kMAXADC), so make it a (non-fatal) error indeed.
366 AliError(Form("adc value %d above %x for ch %d . Setting to %x. Digit is:",iCh,
367 charge,kMAXADC,kMAXADC));
368 StdoutToAliError(digit->Print());
373 fTimers[kGetBusPatch].Start(kFALSE);
374 busPatchId = GetBusPatch(*digit);
375 fTimers[kGetBusPatch].Stop();
376 if (busPatchId<0) continue;
378 if ( digit->ManuId() > 0x7FF || digit->ManuId() < 0 ||
379 digit->ManuChannel() > 0x3F || digit->ManuChannel() < 0 )
381 StdoutToAliError(digit->Print(););
382 AliFatal("ManuId,ManuChannel are invalid for the digit above.");
385 manuId = ( digit->ManuId() & 0x7FF ); // 11 bits
386 channelId = ( digit->ManuChannel() & 0x3F ); // 6 bits
390 AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
391 AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
392 AliBitPacking::PackWord((UInt_t)charge,word,0,11);
396 for (Int_t i = 1; i <= 30; ++i)
397 parity ^= ((word >> i) & 0x1);
398 AliBitPacking::PackWord((UInt_t)parity,word,31,31);
400 AliMUONBusStruct* busStruct =
401 static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
405 busStruct = new AliMUONBusStruct;
406 busStruct->SetDataKey(busStruct->GetDefaultDataKey());
407 busStruct->SetBusPatchId(busPatchId);
408 busStruct->SetLength(0);
409 busPatchMap.Add(busPatchId,busStruct);
413 busStruct->AddData(word);
416 } // loop over chamber in station
418 fTimers[kDigitLoop].Stop();
420 // getting info for the number of buspatches
423 Int_t iBusPerDSP[5];//number of bus patches per DSP
424 Int_t iDspMax; //number max of DSP per block
427 AliMUONBusStruct* busStructPtr(0x0);
429 // open DDL files, 4 per station
430 for (Int_t iDDL = iSt*4; iDDL < 4 + iSt*4; ++iDDL) {
432 AliMpDDL* ddl = fDDLStore->GetDDL(iDDL);
433 iDspMax = ddl->GetMaxDsp();
434 ddl->GetBusPerDsp(iBusPerDSP);
437 Int_t buffer[kBufferSize];
445 // two blocks A and B per DDL
446 for (Int_t iBlock = 0; iBlock < 2; ++iBlock) {
449 length = fBlockHeader->GetHeaderLength();
450 memcpy(&buffer[index],fBlockHeader->GetHeader(),length*4);
454 // 5 DSP's max per block
455 for (Int_t iDsp = 0; iDsp < iDspMax; ++iDsp) {
458 length = fDspHeader->GetHeaderLength();
459 memcpy(&buffer[index],fDspHeader->GetHeader(),length*4);
463 //Â 5 buspatches max per DSP
464 for (Int_t i = 0; i < iBusPerDSP[iDsp]; i++) {
466 iBusPatch = ddl->GetBusPatchId(busIter++);
468 // iteration over bus patch in DDL
469 if (iBusPatch == -1) {
470 AliWarning(Form("Error in bus itr in DDL %d\n", iDDL));
474 // 4 DDL's per station, condition needed for station 3
475 iFile = iDDL - iSt*4; // works only if DDL begins at zero (as it should be) !!!
477 busStructPtr = static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(iBusPatch));
479 // check if buspatchid has digit
481 // add bus patch structure header
482 length = busStructPtr->GetHeaderLength();
483 memcpy(&buffer[index],busStructPtr->GetHeader(),length*4);
486 // add bus patch data
487 length = busStructPtr->GetLength();
488 memcpy(&buffer[index],busStructPtr->GetData(),length*4);
491 if (AliLog::GetGlobalDebugLevel() == 3) {
492 for (Int_t j = 0; j < busStructPtr->GetLength(); j++) {
493 printf("busPatchId %d, manuId %d channelId %d\n", busStructPtr->GetBusPatchId(),
494 busStructPtr->GetManuId(j), busStructPtr->GetChannelId(j));
498 // writting anyhow buspatch structure (empty ones)
499 buffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size
500 buffer[index++] = busStructPtr->GetHeaderLength(); // header length
501 buffer[index++] = 0; // raw data length
502 buffer[index++] = iBusPatch; // bus patch
506 // check if totalLength even
507 // set padding word in case
508 // Add one word 0xBEEFFACE at the end of DSP structure
509 totalDspLength = index - indexDsp;
510 if ((totalDspLength % 2) == 1) {
511 buffer[indexDsp + fDspHeader->GetHeaderLength() - 2] = 1;
512 buffer[index++] = fDspHeader->GetDefaultPaddingWord();
516 dspLength = totalDspLength - fDspHeader->GetHeaderLength();
518 buffer[indexDsp+1] = totalDspLength; // dsp total length
519 buffer[indexDsp+2] = dspLength; // data length
523 totalBlkLength = index - indexBlk;
524 blkLength = totalBlkLength - fBlockHeader->GetHeaderLength();
525 totalDDLLength += totalBlkLength;
527 buffer[indexBlk+1] = totalBlkLength; // total block length
528 buffer[indexBlk+2] = blkLength;
534 // total length in bytes
535 fHeader.fSize = (totalDDLLength + headerSize) * 4;
537 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iFile]);
538 fwrite(buffer,sizeof(int),index,fFile[iFile]);
541 fTimers[kWriteTracker].Stop();
545 //____________________________________________________________________
546 Int_t AliMUONRawWriter::GetBusPatch(const AliMUONDigit& digit) const
548 /// Determine the BusPatch this digit belongs to.
550 return fDDLStore->GetBusPatchId(digit.DetElemId(),digit.ManuId());
553 //____________________________________________________________________
554 Int_t AliMUONRawWriter::WriteTriggerDDL()
556 /// Write trigger DDL
558 fTimers[kWriteTrigger].Start(kFALSE);
560 // DDL event one per half chamber
562 // stored local id number
563 TArrayI isFired(256);
568 Int_t headerSize = sizeof(AliRawDataHeader)/4;
570 TClonesArray* localTrigger;
571 TClonesArray* globalTrigger;
572 TClonesArray* regionalTrigger;
574 AliMUONGlobalTrigger* gloTrg;
575 AliMUONLocalTrigger* locTrg = 0x0;
576 AliMUONRegionalTrigger* regTrg = 0x0;
578 // global trigger for trigger pattern
579 globalTrigger = fMUONData->GlobalTrigger();
580 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
583 fTimers[kWriteTrigger].Stop();
587 Int_t gloTrigResp = gloTrg->GetGlobalResponse();
590 localTrigger = fMUONData->LocalTrigger();
594 regionalTrigger = fMUONData->RegionalTrigger();
601 Int_t iLocCard, locCard;
602 UChar_t locDec, trigY, posY, posX, regOut;
607 UInt_t version = 1; // software version
608 UInt_t eventPhys = 1; // trigger type: 1 for physics, 0 for software
609 UInt_t serialNb = 0xF; // serial nb of card: all bits on for the moment
610 Int_t globalFlag = 0; // set to 1 if global info present in DDL else set to 0
613 static const Int_t kDarcHeaderLength = fDarcHeader->GetDarcHeaderLength();
614 static const Int_t kGlobalHeaderLength = fDarcHeader->GetGlobalHeaderLength();
615 static const Int_t kDarcScalerLength = fDarcHeader->GetDarcScalerLength();
616 static const Int_t kGlobalScalerLength = fDarcHeader->GetGlobalScalerLength();
617 static const Int_t kRegHeaderLength = fRegHeader->GetHeaderLength();
618 static const Int_t kRegScalerLength = fRegHeader->GetScalerLength();
619 static const Int_t kLocHeaderLength = fLocalStruct->GetLength();
620 static const Int_t kLocScalerLength = fLocalStruct->GetScalerLength();
622 // [16(local)*6 words + 6 words]*8(reg) + 8 words = 824
623 static const Int_t kBufferSize = (16 * (kLocHeaderLength+1) + (kRegHeaderLength+1))* 8
624 + kDarcHeaderLength + kGlobalHeaderLength + 2;
626 // [16(local)*51 words + 16 words]*8(reg) + 8 + 10 + 8 words scaler event 6682 words
627 static const Int_t kScalerBufferSize = (16 * (kLocHeaderLength + kLocScalerLength +1) +
628 (kRegHeaderLength + kRegScalerLength +1))* 8 +
629 (kDarcHeaderLength + kDarcScalerLength +
630 kGlobalHeaderLength + kGlobalScalerLength + 2);
632 eventPhys = 0; //set to generate scaler events
634 Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
635 // stored the local card id that's fired
636 for (Int_t i = 0; i < nEntries; i++) {
637 locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
638 isFired[locTrg->LoCircuit()] = 1; // storing local boards with informations
642 AliDebug(1, "No Trigger information available");
645 buffer = new Int_t [kScalerBufferSize];
647 buffer = new Int_t [kBufferSize];
651 // open DDL file, on per 1/2 chamber
652 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
656 if (iDDL == 0) // suppose global info in DDL one
662 // set darc status word
663 // see AliMUONDarcHeader.h for details
664 AliBitPacking::PackWord((UInt_t)eventPhys,word,30,30);
665 AliBitPacking::PackWord((UInt_t)serialNb,word,20,23);
666 AliBitPacking::PackWord((UInt_t)globalFlag,word,10,10);
667 AliBitPacking::PackWord((UInt_t)version,word,12,19);
668 fDarcHeader->SetWord(word);
670 memcpy(&buffer[index], fDarcHeader->GetHeader(), (kDarcHeaderLength)*4);
671 index += kDarcHeaderLength;
673 // no global input for the moment....
675 fDarcHeader->SetGlobalOutput(gloTrigResp);
677 fDarcHeader->SetGlobalOutput(0);
680 // 6 DARC scaler words
681 memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),kDarcScalerLength*4);
682 index += kDarcScalerLength;
685 buffer[index++] = fDarcHeader->GetEndOfDarc();
687 // 4 words of global board input + Global board output
688 memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (kGlobalHeaderLength)*4);
689 index += kGlobalHeaderLength;
692 // 10 Global scaler words
693 memcpy(fDarcHeader->GetGlobalScalers(), &buffer[index], kGlobalScalerLength*4);
694 index += kGlobalScalerLength;
697 // end of global word
698 buffer[index++] = fDarcHeader->GetEndOfGlobal();
700 // 8 regional cards per DDL
701 for (Int_t iReg = 0; iReg < 8; iReg++) {
704 AliMUONTriggerCrate* crate = fCrateManager->Crate(iDDL, iReg);
707 AliWarning(Form("Missing crate number %d in DDL %d\n", iReg, iDDL));
709 // regional info tree, make sure that no reg card missing
710 for (Int_t i = 0; i < 16; ++i) {
711 regTrg = (AliMUONRegionalTrigger*)regionalTrigger->At(i);
713 if (regTrg->GetId() == (iReg + iDDL*8)) break;
716 // Regional card header
719 // set darc status word
720 fRegHeader->SetDarcWord(word);
722 regOut = regTrg->GetOutput();
723 regInpHpt = regTrg->GetLocalOutput(0);
724 regInpLpt = regTrg->GetLocalOutput(1);
726 // fill darc word, not darc status for the moment (empty)
727 //see AliMUONRegHeader.h for details
728 AliBitPacking::PackWord((UInt_t)eventPhys,word,31,31);
729 AliBitPacking::PackWord((UInt_t)serialNb,word,19,24);
730 AliBitPacking::PackWord((UInt_t)version,word,16,23);
731 AliBitPacking::PackWord((UInt_t)iReg,word,15,18);
732 AliBitPacking::PackWord((UInt_t)regOut,word,0,7);
733 fRegHeader->SetWord(word);
736 // fill header later, need local response
737 Int_t indexReg = index;
738 index += kRegHeaderLength;
740 // 11 regional scaler word
742 memcpy(&buffer[index], fRegHeader->GetScalers(), kRegScalerLength*4);
743 index += kRegScalerLength;
746 // end of regional word
747 buffer[index++] = fRegHeader->GetEndOfReg();
749 TObjArray *boards = crate->Boards();
752 // 16 local card per regional board
753 // UShort_t localMask = 0x0;
755 for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
757 // slot zero for Regional card
758 AliMUONLocalTriggerBoard* localBoard = (AliMUONLocalTriggerBoard*)boards->At(iLoc+1);
760 if (localBoard) { // if not empty slot
762 if ((iLocCard = localBoard->GetNumber()) != 0) {// if notified board
764 if (isFired[iLocCard]) { // if card has triggered
765 locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries++);
766 locCard = locTrg->LoCircuit();
767 locDec = locTrg->GetLoDecision();
769 posY = locTrg->LoStripY();
770 posX = locTrg->LoStripX();
771 devX = locTrg->LoDev();
773 AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n",
774 locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev()));
775 } else { //no trigger (see PRR chpt 3.4)
781 // set local card id to -1
787 AliBitPacking::PackWord((UInt_t)iLoc,word,19,22); //card id number in crate
788 AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
789 AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
790 AliBitPacking::PackWord((UInt_t)posY,word,10,13);
791 AliBitPacking::PackWord((UInt_t)devX,word,5,9);
792 AliBitPacking::PackWord((UInt_t)posX,word,0,4);
794 if (locCard == iLocCard) {
795 // add local cards structure
796 buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
797 buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
798 buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
799 buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
800 buffer[index++] = (Int_t)word; // data word
803 buffer[index++] = 0; // 4 words for x1, x2, y1, y2
807 buffer[index++] = (Int_t)word; // data word
811 // fill with 10CDEAD word for 'non-notified' slots
812 for (Int_t i = 0; i < fLocalStruct->GetLength(); i++)
813 buffer[index++] = fLocalStruct->GetDisableWord();
816 // fill with 10CDEAD word for empty slots
817 for (Int_t i = 0; i < fLocalStruct->GetLength(); i++)
818 buffer[index++] = fLocalStruct->GetDisableWord();
819 }// condition localBoard
821 // 45 regional scaler word
823 memcpy(&buffer[index], fLocalStruct->GetScalers(), kLocScalerLength*4);
824 index += kLocScalerLength;
827 // end of local structure words
828 buffer[index++] = fLocalStruct->GetEndOfLocal();
831 // fill regional header with local output
832 fRegHeader->SetInput(regInpHpt, 0);
833 fRegHeader->SetInput(regInpHpt, 1);
834 memcpy(&buffer[indexReg],fRegHeader->GetHeader(),kRegHeaderLength*4);
839 // writting onto disk
841 fHeader.fSize = (index + headerSize) * 4;// total length in bytes
842 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iDDL]);
843 fwrite(buffer,sizeof(int),index,fFile[iDDL]);
848 fTimers[kWriteTrigger].Stop();
852 //____________________________________________________________________
853 void AliMUONRawWriter::SetScalersNumbers()
855 /// set numbers for scaler events for trigger headers
856 /// since this is provided by the experiment
857 /// put dummy numbers to check the monitoring
859 fDarcHeader->SetScalersNumbers();
860 fRegHeader->SetScalersNumbers();
861 fLocalStruct->SetScalersNumbers();
863 fScalerEvent = kTRUE;