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.
41 /// Ch. Finck, Feb. 07.
44 #include "AliMUONRawWriter.h"
46 #include "AliMUONBlockHeader.h"
47 #include "AliMUONBusStruct.h"
48 #include "AliMUONConstants.h"
49 #include "AliMUONDarcHeader.h"
50 #include "AliMUONData.h"
51 #include "AliMUONDigit.h"
52 #include "AliMUONDspHeader.h"
53 #include "AliMUONGlobalTrigger.h"
54 #include "AliMUONLocalStruct.h"
55 #include "AliMUONLocalTrigger.h"
56 #include "AliMUONLocalTriggerBoard.h"
57 #include "AliMUONRegionalTrigger.h"
58 #include "AliMUONRegHeader.h"
59 #include "AliMUONTriggerCrate.h"
60 #include "AliMUONTriggerCrateStore.h"
62 #include "AliMpDDLStore.h"
64 #include "AliMpDetElement.h"
65 #include "AliMpDEManager.h"
66 #include "AliMpExMap.h"
67 #include "AliMpConstants.h"
68 #include "AliMpPlaneType.h"
69 #include "AliMpSegmentation.h"
70 #include "AliMpStationType.h"
71 #include "AliMpVSegmentation.h"
73 #include "AliRawReader.h"
74 #include "AliBitPacking.h"
79 #include "TObjArray.h"
80 #include "TStopwatch.h"
83 ClassImp(AliMUONRawWriter) // Class implementation in ROOT context
88 enum ETimer { kWriteTracker, kWriteTrigger, kDigitLoop, kGetBusPatch, kTest, kLast };
91 //__________________________________________________________________________
92 AliMUONRawWriter::AliMUONRawWriter(AliMUONData* data)
95 fBlockHeader(new AliMUONBlockHeader()),
96 fDspHeader(new AliMUONDspHeader()),
97 fDarcHeader(new AliMUONDarcHeader()),
98 fRegHeader(new AliMUONRegHeader()),
99 fLocalStruct(new AliMUONLocalStruct()),
100 fDDLStore(AliMpDDLStore::Instance()),
101 fCrateManager(new AliMUONTriggerCrateStore()),
102 fScalerEvent(kFALSE),
104 fTimers(new TStopwatch[kLast])
107 /// Standard Constructor
109 AliDebug(1,"Standard ctor");
110 fFile[0] = fFile[1] = 0x0;
111 fFile[2] = fFile[3] = 0x0;
113 // setting data key to default value (only for writting)
114 fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey());
115 fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey());
118 fCrateManager->ReadFromFile();
121 for ( Int_t i = 0; i < kLast; ++i )
123 fTimers[i].Start(kTRUE);
129 //__________________________________________________________________________
130 AliMUONRawWriter::AliMUONRawWriter()
140 fScalerEvent(kFALSE),
144 /// Default Constructor
146 AliDebug(1,"Default ctor");
147 fFile[0] = fFile[1] = 0x0;
148 fFile[2] = fFile[3] = 0x0;
152 //__________________________________________________________________________
153 AliMUONRawWriter::~AliMUONRawWriter(void)
165 delete fCrateManager;
167 for ( Int_t i = 0; i < kLast; ++i )
169 AliDebug(1, Form("Execution time (timer %d) : R:%7.2fs C:%7.2fs",i,
170 fTimers[i].RealTime(),fTimers[i].CpuTime()));
176 //______________________________________________________________________________
178 //AliMUONRawWriter::CheckDigits()
180 // std::map<int,std::map<int,int> > m;
182 // for (Int_t iSt = 0; iSt < AliMUONConstants::NTrackingCh()/2; ++iSt)
184 // for (Int_t iCh = iSt*2; iCh <= iSt*2 + 1; ++iCh)
186 // TClonesArray* muonDigits = fMUONData->Digits(iCh);
187 // for (Int_t idig = 0; idig < muonDigits->GetEntriesFast(); idig++)
189 // AliMUONDigit* digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig);
190 // Int_t busPatchId = GetBusPatch(*digit);
191 // m[busPatchId][digit->ManuId()]++;
196 // std::map<int,std::map<int,int> >::const_iterator it;
198 // Int_t nManuMax(0);
200 // for ( it = m.begin(); it != m.end(); ++it )
202 // AliDebug(1,Form("BusPatch %3d has %3d manus",it->first,it->second.size()));
203 // nManuMax = std::max((Int_t)it->second.size(),nManuMax);
204 // std::map<int,int>::const_iterator it2;
205 // for ( it2 = it->second.begin(); it2 != it->second.end(); ++it2 )
207 // AliDebug(1,Form(" BusPatch %3d Manu %4d Nch %3d",it->first,it2->first,it2->second));
210 // AliDebug(1,Form("Max manus per busPatch : %3d",nManuMax));
213 //____________________________________________________________________
214 Int_t AliMUONRawWriter::Digits2Raw()
216 /// convert digits of the current event to raw data
221 fMUONData->GetLoader()->LoadDigits("READ");
223 fMUONData->SetTreeAddress("D,GLT");
225 fMUONData->ResetDigits();
226 fMUONData->ResetTrigger();
228 // This will get both tracker and trigger digits.
229 fMUONData->GetDigits();
235 for (Int_t iSt = 0; iSt < AliMUONConstants::NTrackingCh()/2; ++iSt) {
237 // open files for one station
238 // cos station 3, 1/4 of DE's from 2 chambers has same DDL number
240 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
241 fFile[0] = fopen(name,"w");
243 idDDL = (iSt * 4) + 1;
244 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
245 fFile[1] = fopen(name,"w");
247 idDDL = (iSt * 4) + 2;;
248 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
249 fFile[2] = fopen(name,"w");
251 idDDL = (iSt * 4) + 3;
252 strcpy(name,AliDAQ::DdlFileName("MUONTRK",idDDL));
253 fFile[3] = fopen(name,"w");
255 WriteTrackerDDL(iSt);
257 // reset and close when station has been processed
265 AliDebug(1,"Tracker written");
271 strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
272 fFile[0] = fopen(name,"w");
275 strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
276 fFile[1] = fopen(name,"w");
284 AliDebug(1,"Trigger written");
286 fMUONData->ResetDigits();
287 fMUONData->ResetTrigger();
288 fMUONData->GetLoader()->UnloadDigits();
290 AliDebug(1,"muondata reset");
295 //____________________________________________________________________
296 Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iSt)
298 /// writing DDL for tracker
299 /// used inverse mapping
301 fTimers[kWriteTracker].Start(kFALSE);
303 static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
306 TClonesArray* muonDigits = 0;
309 Int_t headerSize = sizeof(fHeader)/4;
311 // DDL event one per half chamber
316 UChar_t channelId = 0;
318 Int_t busPatchId = 0;
323 Int_t totalDspLength;
327 Int_t totalBlkLength;
331 Int_t totalDDLLength;
338 // buffer size (max'ed out)
339 // (((43 manus max per bus patch *64 channels + 4 bus patch words) * 5 bus patch
340 // + 10 dsp words)*5 dsps + 8 block words)*2 blocks
341 static const Int_t kBufferSize = (((43*64 + 4)*5 + 10)*5 + 8)*2;
345 AliMpExMap busPatchMap(kTRUE);
347 fTimers[kDigitLoop].Start(kFALSE);
349 for (Int_t iCh = iSt*2; iCh <= iSt*2 + 1; ++iCh) {
351 muonDigits = fMUONData->Digits(iCh);
353 nDigits = muonDigits->GetEntriesFast();
356 for (Int_t idig = 0; idig < nDigits; ++idig) {
358 AliMUONDigit* digit = static_cast<AliMUONDigit*>(muonDigits->UncheckedAt(idig));
360 charge = digit->ADC();
361 if ( charge > kMAXADC )
363 // This is most probably an error in the digitizer (which should insure
364 // the adc is below kMAXADC), so make it a (non-fatal) error indeed.
365 AliError(Form("adc value %d above %x for ch %d . Setting to %x. Digit is:",iCh,
366 charge,kMAXADC,kMAXADC));
367 StdoutToAliError(digit->Print());
372 fTimers[kGetBusPatch].Start(kFALSE);
373 busPatchId = GetBusPatch(*digit);
374 fTimers[kGetBusPatch].Stop();
375 if (busPatchId<0) continue;
377 if ( digit->ManuId() > 0x7FF || digit->ManuId() < 0 ||
378 digit->ManuChannel() > 0x3F || digit->ManuChannel() < 0 )
380 StdoutToAliError(digit->Print(););
381 AliFatal("ManuId,ManuChannel are invalid for the digit above.");
384 manuId = ( digit->ManuId() & 0x7FF ); // 11 bits
385 channelId = ( digit->ManuChannel() & 0x3F ); // 6 bits
389 AliBitPacking::PackWord((UInt_t)manuId,word,18,28);
390 AliBitPacking::PackWord((UInt_t)channelId,word,12,17);
391 AliBitPacking::PackWord((UInt_t)charge,word,0,11);
395 for (Int_t i = 1; i <= 30; ++i)
396 parity ^= ((word >> i) & 0x1);
397 AliBitPacking::PackWord((UInt_t)parity,word,31,31);
399 AliMUONBusStruct* busStruct =
400 static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
404 busStruct = new AliMUONBusStruct;
405 busStruct->SetDataKey(busStruct->GetDefaultDataKey());
406 busStruct->SetBusPatchId(busPatchId);
407 busStruct->SetLength(0);
408 busPatchMap.Add(busPatchId,busStruct);
412 busStruct->AddData(word);
415 } // loop over chamber in station
417 fTimers[kDigitLoop].Stop();
419 // getting info for the number of buspatches
422 Int_t iBusPerDSP[5];//number of bus patches per DSP
423 Int_t iDspMax; //number max of DSP per block
426 AliMUONBusStruct* busStructPtr(0x0);
428 // open DDL files, 4 per station
429 for (Int_t iDDL = iSt*4; iDDL < 4 + iSt*4; ++iDDL) {
431 AliMpDDL* ddl = fDDLStore->GetDDL(iDDL);
432 iDspMax = ddl->GetMaxDsp();
433 ddl->GetBusPerDsp(iBusPerDSP);
436 Int_t buffer[kBufferSize];
444 // two blocks A and B per DDL
445 for (Int_t iBlock = 0; iBlock < 2; ++iBlock) {
448 length = fBlockHeader->GetHeaderLength();
449 memcpy(&buffer[index],fBlockHeader->GetHeader(),length*4);
453 // 5 DSP's max per block
454 for (Int_t iDsp = 0; iDsp < iDspMax; ++iDsp) {
457 length = fDspHeader->GetHeaderLength();
458 memcpy(&buffer[index],fDspHeader->GetHeader(),length*4);
462 //Â 5 buspatches max per DSP
463 for (Int_t i = 0; i < iBusPerDSP[iDsp]; i++) {
465 iBusPatch = ddl->GetBusPatchId(busIter++);
467 // iteration over bus patch in DDL
468 if (iBusPatch == -1) {
469 AliWarning(Form("Error in bus itr in DDL %d\n", iDDL));
473 // 4 DDL's per station, condition needed for station 3
474 iFile = iDDL - iSt*4; // works only if DDL begins at zero (as it should be) !!!
476 busStructPtr = static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(iBusPatch));
478 // check if buspatchid has digit
480 // add bus patch structure header
481 length = busStructPtr->GetHeaderLength();
482 memcpy(&buffer[index],busStructPtr->GetHeader(),length*4);
485 // add bus patch data
486 length = busStructPtr->GetLength();
487 memcpy(&buffer[index],busStructPtr->GetData(),length*4);
490 if (AliLog::GetGlobalDebugLevel() == 3) {
491 for (Int_t j = 0; j < busStructPtr->GetLength(); j++) {
492 printf("busPatchId %d, manuId %d channelId %d\n", busStructPtr->GetBusPatchId(),
493 busStructPtr->GetManuId(j), busStructPtr->GetChannelId(j));
497 // writting anyhow buspatch structure (empty ones)
498 buffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size
499 buffer[index++] = busStructPtr->GetHeaderLength(); // header length
500 buffer[index++] = 0; // raw data length
501 buffer[index++] = iBusPatch; // bus patch
505 // check if totalLength even
506 // set padding word in case
507 // Add one word 0xBEEFFACE at the end of DSP structure
508 totalDspLength = index - indexDsp;
509 if ((totalDspLength % 2) == 1) {
510 buffer[indexDsp + fDspHeader->GetHeaderLength() - 2] = 1;
511 buffer[index++] = fDspHeader->GetDefaultPaddingWord();
515 dspLength = totalDspLength - fDspHeader->GetHeaderLength();
517 buffer[indexDsp+1] = totalDspLength; // dsp total length
518 buffer[indexDsp+2] = dspLength; // data length
522 totalBlkLength = index - indexBlk;
523 blkLength = totalBlkLength - fBlockHeader->GetHeaderLength();
524 totalDDLLength += totalBlkLength;
526 buffer[indexBlk+1] = totalBlkLength; // total block length
527 buffer[indexBlk+2] = blkLength;
533 // total length in bytes
534 fHeader.fSize = (totalDDLLength + headerSize) * 4;
536 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iFile]);
537 fwrite(buffer,sizeof(int),index,fFile[iFile]);
540 fTimers[kWriteTracker].Stop();
544 //____________________________________________________________________
545 Int_t AliMUONRawWriter::GetBusPatch(const AliMUONDigit& digit) const
547 /// Determine the BusPatch this digit belongs to.
549 return fDDLStore->GetBusPatchId(digit.DetElemId(),digit.ManuId());
552 //____________________________________________________________________
553 Int_t AliMUONRawWriter::WriteTriggerDDL()
555 /// Write trigger DDL
557 fTimers[kWriteTrigger].Start(kFALSE);
559 // DDL event one per half chamber
561 // stored local id number
562 TArrayI isFired(256);
567 Int_t headerSize = sizeof(AliRawDataHeader)/4;
569 TClonesArray* localTrigger;
570 TClonesArray* globalTrigger;
571 TClonesArray* regionalTrigger;
573 AliMUONGlobalTrigger* gloTrg;
574 AliMUONLocalTrigger* locTrg = 0x0;
575 AliMUONRegionalTrigger* regTrg = 0x0;
577 // global trigger for trigger pattern
578 globalTrigger = fMUONData->GlobalTrigger();
579 gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
582 fTimers[kWriteTrigger].Stop();
586 Int_t gloTrigResp = gloTrg->GetGlobalResponse();
589 localTrigger = fMUONData->LocalTrigger();
593 regionalTrigger = fMUONData->RegionalTrigger();
600 Int_t iLocCard, locCard;
601 UChar_t locDec, trigY, posY, posX, regOut;
606 UInt_t version = 1; // software version
607 UInt_t eventPhys = 1; // trigger type: 1 for physics, 0 for software
608 UInt_t serialNb = 0xF; // serial nb of card: all bits on for the moment
609 Int_t globalFlag = 0; // set to 1 if global info present in DDL else set to 0
612 static const Int_t kDarcHeaderLength = fDarcHeader->GetDarcHeaderLength();
613 static const Int_t kGlobalHeaderLength = fDarcHeader->GetGlobalHeaderLength();
614 static const Int_t kDarcScalerLength = fDarcHeader->GetDarcScalerLength();
615 static const Int_t kGlobalScalerLength = fDarcHeader->GetGlobalScalerLength();
616 static const Int_t kRegHeaderLength = fRegHeader->GetHeaderLength();
617 static const Int_t kRegScalerLength = fRegHeader->GetScalerLength();
618 static const Int_t kLocHeaderLength = fLocalStruct->GetLength();
619 static const Int_t kLocScalerLength = fLocalStruct->GetScalerLength();
621 // [16(local)*6 words + 6 words]*8(reg) + 8 words = 824
622 static const Int_t kBufferSize = (16 * (kLocHeaderLength+1) + (kRegHeaderLength+1))* 8
623 + kDarcHeaderLength + kGlobalHeaderLength + 2;
625 // [16(local)*51 words + 16 words]*8(reg) + 8 + 10 + 8 words scaler event 6682 words
626 static const Int_t kScalerBufferSize = (16 * (kLocHeaderLength + kLocScalerLength +1) +
627 (kRegHeaderLength + kRegScalerLength +1))* 8 +
628 (kDarcHeaderLength + kDarcScalerLength +
629 kGlobalHeaderLength + kGlobalScalerLength + 2);
631 eventPhys = 0; //set to generate scaler events
633 Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards
634 // stored the local card id that's fired
635 for (Int_t i = 0; i < nEntries; i++) {
636 locTrg = (AliMUONLocalTrigger*)localTrigger->At(i);
637 isFired[locTrg->LoCircuit()] = 1; // storing local boards with informations
641 AliDebug(1, "No Trigger information available");
644 buffer = new Int_t [kScalerBufferSize];
646 buffer = new Int_t [kBufferSize];
650 // open DDL file, on per 1/2 chamber
651 for (Int_t iDDL = 0; iDDL < 2; iDDL++) {
655 if (iDDL == 0) // suppose global info in DDL one
661 // set darc status word
662 // see AliMUONDarcHeader.h for details
663 AliBitPacking::PackWord((UInt_t)eventPhys,word,30,30);
664 AliBitPacking::PackWord((UInt_t)serialNb,word,20,23);
665 AliBitPacking::PackWord((UInt_t)globalFlag,word,10,10);
666 AliBitPacking::PackWord((UInt_t)version,word,12,19);
667 fDarcHeader->SetWord(word);
669 memcpy(&buffer[index], fDarcHeader->GetHeader(), (kDarcHeaderLength)*4);
670 index += kDarcHeaderLength;
672 // no global input for the moment....
674 fDarcHeader->SetGlobalOutput(gloTrigResp);
676 fDarcHeader->SetGlobalOutput(0);
679 // 6 DARC scaler words
680 memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),kDarcScalerLength*4);
681 index += kDarcScalerLength;
684 buffer[index++] = fDarcHeader->GetEndOfDarc();
686 // 4 words of global board input + Global board output
687 memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (kGlobalHeaderLength)*4);
688 index += kGlobalHeaderLength;
691 // 10 Global scaler words
692 memcpy(fDarcHeader->GetGlobalScalers(), &buffer[index], kGlobalScalerLength*4);
693 index += kGlobalScalerLength;
696 // end of global word
697 buffer[index++] = fDarcHeader->GetEndOfGlobal();
699 // 8 regional cards per DDL
700 for (Int_t iReg = 0; iReg < 8; iReg++) {
703 AliMUONTriggerCrate* crate = fCrateManager->Crate(iDDL, iReg);
706 AliWarning(Form("Missing crate number %d in DDL %d\n", iReg, iDDL));
708 // regional info tree, make sure that no reg card missing
709 for (Int_t i = 0; i < 16; ++i) {
710 regTrg = (AliMUONRegionalTrigger*)regionalTrigger->At(i);
712 if (regTrg->GetId() == (iReg + iDDL*8)) break;
715 // Regional card header
718 // set darc status word
719 fRegHeader->SetDarcWord(word);
721 regOut = regTrg->GetOutput();
722 regInpHpt = regTrg->GetLocalOutput(0);
723 regInpLpt = regTrg->GetLocalOutput(1);
725 // fill darc word, not darc status for the moment (empty)
726 //see AliMUONRegHeader.h for details
727 AliBitPacking::PackWord((UInt_t)eventPhys,word,31,31);
728 AliBitPacking::PackWord((UInt_t)serialNb,word,19,24);
729 AliBitPacking::PackWord((UInt_t)version,word,16,23);
730 AliBitPacking::PackWord((UInt_t)iReg,word,15,18);
731 AliBitPacking::PackWord((UInt_t)regOut,word,0,7);
732 fRegHeader->SetWord(word);
735 // fill header later, need local response
736 Int_t indexReg = index;
737 index += kRegHeaderLength;
739 // 11 regional scaler word
741 memcpy(&buffer[index], fRegHeader->GetScalers(), kRegScalerLength*4);
742 index += kRegScalerLength;
745 // end of regional word
746 buffer[index++] = fRegHeader->GetEndOfReg();
748 TObjArray *boards = crate->Boards();
751 // 16 local card per regional board
752 // UShort_t localMask = 0x0;
754 for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
756 // slot zero for Regional card
757 AliMUONLocalTriggerBoard* localBoard = (AliMUONLocalTriggerBoard*)boards->At(iLoc+1);
759 if (localBoard) { // if not empty slot
761 if ((iLocCard = localBoard->GetNumber()) != 0) {// if notified board
763 if (isFired[iLocCard]) { // if card has triggered
764 locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries++);
765 locCard = locTrg->LoCircuit();
766 locDec = locTrg->GetLoDecision();
768 posY = locTrg->LoStripY();
769 posX = locTrg->LoStripX();
770 devX = locTrg->LoDev();
772 AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n",
773 locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev()));
774 } else { //no trigger (see PRR chpt 3.4)
780 // set local card id to -1
786 AliBitPacking::PackWord((UInt_t)iLoc,word,19,22); //card id number in crate
787 AliBitPacking::PackWord((UInt_t)locDec,word,15,18);
788 AliBitPacking::PackWord((UInt_t)trigY,word,14,14);
789 AliBitPacking::PackWord((UInt_t)posY,word,10,13);
790 AliBitPacking::PackWord((UInt_t)devX,word,5,9);
791 AliBitPacking::PackWord((UInt_t)posX,word,0,4);
793 if (locCard == iLocCard) {
794 // add local cards structure
795 buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16));
796 buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16));
797 buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16));
798 buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16));
799 buffer[index++] = (Int_t)word; // data word
802 buffer[index++] = 0; // 4 words for x1, x2, y1, y2
806 buffer[index++] = (Int_t)word; // data word
810 // fill with 10CDEAD word for 'non-notified' slots
811 for (Int_t i = 0; i < fLocalStruct->GetLength(); i++)
812 buffer[index++] = fLocalStruct->GetDisableWord();
815 // fill with 10CDEAD word for empty slots
816 for (Int_t i = 0; i < fLocalStruct->GetLength(); i++)
817 buffer[index++] = fLocalStruct->GetDisableWord();
818 }// condition localBoard
820 // 45 regional scaler word
822 memcpy(&buffer[index], fLocalStruct->GetScalers(), kLocScalerLength*4);
823 index += kLocScalerLength;
826 // end of local structure words
827 buffer[index++] = fLocalStruct->GetEndOfLocal();
830 // fill regional header with local output
831 fRegHeader->SetInput(regInpHpt, 0);
832 fRegHeader->SetInput(regInpHpt, 1);
833 memcpy(&buffer[indexReg],fRegHeader->GetHeader(),kRegHeaderLength*4);
838 // writting onto disk
840 fHeader.fSize = (index + headerSize) * 4;// total length in bytes
841 fwrite((char*)(&fHeader),headerSize*4,1,fFile[iDDL]);
842 fwrite(buffer,sizeof(int),index,fFile[iDDL]);
847 fTimers[kWriteTrigger].Stop();
851 //____________________________________________________________________
852 void AliMUONRawWriter::SetScalersNumbers()
854 /// set numbers for scaler events for trigger headers
855 /// since this is provided by the experiment
856 /// put dummy numbers to check the monitoring
858 fDarcHeader->SetScalersNumbers();
859 fRegHeader->SetScalersNumbers();
860 fLocalStruct->SetScalersNumbers();
862 fScalerEvent = kTRUE;