X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONRawWriter.cxx;h=d783d441343da0765c2f3ef031dfe37f96ec0cbe;hb=e29fb8cd040f9667a34b5687575b34aabd590fe9;hp=858b1c7a8a5987c686fb0421c76f6d68da202043;hpb=86400e6103c71ca837b660bbb06915a0adaaff3e;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONRawWriter.cxx b/MUON/AliMUONRawWriter.cxx index 858b1c7a8a5..d783d441343 100644 --- a/MUON/AliMUONRawWriter.cxx +++ b/MUON/AliMUONRawWriter.cxx @@ -15,348 +15,259 @@ /* $Id$ */ -//////////////////////////////////// -// -// MUON Raw Data generaton in ALICE-MUON -// This class version 3 (further details could be found in Alice-note) -// -// Implemented non-constant buspatch numbers for tracking -// with correct DDL id (first guess) -// (Ch. Finck, dec 2005) -// -// Digits2Raw: -// Generates raw data for MUON tracker and finally for trigger -// Using real mapping (inverse) for tracker -// For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit) -// Ch. Finck, July 04 -// Use memcpy instead of assignment elt by elt -// Introducing variable DSP numbers, real manu numbers per buspatch for st12 -// Implemented scaler event for Trigger -// Ch. Finck, Jan. 06 -// -//////////////////////////////////// +//----------------------------------------------------------------------------- +/// \class AliMUONRawWriter +/// MUON Raw Data generaton in ALICE-MUON +/// Raw data structure could be found in Alice-note. +/// +/// Implemented non-constant buspatch numbers for tracking +/// with correct DDL id (first guess) +/// (Ch. Finck, dec 2005) +/// +/// Digits2Raw: +/// Generates raw data for MUON tracker and finally for trigger +/// Using real mapping (inverse) for tracker +/// For trigger there is no mapping (mapping could be found in AliMUONTriggerCircuit) +/// Ch. Finck, July 04 +/// Use memcpy instead of assignment elt by elt +/// Introducing variable DSP numbers, real manu numbers per buspatch for st12 +/// Implemented scaler event for Trigger +/// Ch. Finck, Jan. 06 +/// Using bus itr in DDL instead of simple incrementation +/// treat correctly the DDL & buspatch for station 3. +/// Using informations from AliMUONTriggerCrateStore for +/// empty slots and non-notified cards in trigger crates. +/// Ch. Finck, August 06. +/// Using AliMpDDLStore::GetBusPatchId. +/// +/// \author Ch. Finck, Feb. 07. +//----------------------------------------------------------------------------- + #include "AliMUONRawWriter.h" -#include "AliBitPacking.h" -#include "AliRawReader.h" -#include "AliLog.h" -#include "AliMUON.h" +#include "AliMUONBlockHeader.h" +#include "AliMUONBusStruct.h" #include "AliMUONConstants.h" - #include "AliMUONDarcHeader.h" -#include "AliMUONRegHeader.h" -#include "AliMUONLocalStruct.h" +#include "AliMUONVDigit.h" +#include "AliMUONVDigitStore.h" #include "AliMUONDspHeader.h" -#include "AliMUONBlockHeader.h" - -#include "AliMUONData.h" -#include "AliMUONDigit.h" #include "AliMUONGlobalTrigger.h" +#include "AliMUONLocalStruct.h" #include "AliMUONLocalTrigger.h" +#include "AliMUONLocalTriggerBoard.h" +#include "AliMUONRegionalTrigger.h" +#include "AliMUONRegHeader.h" + +#include "AliMUONVTriggerStore.h" +#include "AliCodeTimer.h" -#include "AliMpBusPatch.h" +#include "AliMpCDB.h" +#include "AliMpDDLStore.h" +#include "AliMpDDL.h" +#include "AliMpRegionalTrigger.h" +#include "AliMpTriggerCrate.h" +#include "AliMpLocalBoard.h" +#include "AliMpDetElement.h" #include "AliMpDEManager.h" -#include "AliMpPad.h" +#include "AliMpExMap.h" +#include "AliMpConstants.h" #include "AliMpPlaneType.h" -#include "AliMpSegFactory.h" +#include "AliMpSegmentation.h" #include "AliMpStationType.h" #include "AliMpVSegmentation.h" -#include "TClonesArray.h" - -ClassImp(AliMUONRawWriter) // Class implementation in ROOT context - -Int_t AliMUONRawWriter::fgManuPerBusSwp1B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 224, 232}; -Int_t AliMUONRawWriter::fgManuPerBusSwp1NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 225, 233}; - -Int_t AliMUONRawWriter::fgManuPerBusSwp2B[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 226, 246}; -Int_t AliMUONRawWriter::fgManuPerBusSwp2NB[12] = {1, 27, 53, 79, 105, 131, 157, 183, 201, 214, 227, 245}; - - -//__________________________________________________________________________ -AliMUONRawWriter::AliMUONRawWriter(AliMUONData* data) -: TObject(), - fScalerEvent(kFALSE) -{ - // - // Standard Constructor - // - AliDebug(1,"Standard ctor"); - - // initialize container - fMUONData = data; - - // initialize array - fBusArray = new TClonesArray("AliMUONBusStruct",1000); - fBusArray->SetOwner(kTRUE); - - // ddl tracker pointers - fBlockHeader = new AliMUONBlockHeader(); - fDspHeader = new AliMUONDspHeader(); - fBusStruct = new AliMUONBusStruct(); - - // setting data key to default value (only for writting) - fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey()); - fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey()); - fBusStruct->SetDataKey(fBusStruct->GetDefaultDataKey()); - - // ddl trigger pointers - fDarcHeader = new AliMUONDarcHeader(); - fRegHeader = new AliMUONRegHeader(); - fLocalStruct = new AliMUONLocalStruct(); - - // bus patch & Seg managers - fBusPatchManager = new AliMpBusPatch(); - fBusPatchManager->ReadBusPatchFile(); +#include "AliRawReader.h" +#include "AliRawDataHeaderSim.h" +#include "AliBitPacking.h" +#include "AliDAQ.h" +#include "AliLog.h" - fSegFactory = new AliMpSegFactory(); +#include "TObjArray.h" +#include "TStopwatch.h" +#include - // timers - fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop(); - fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop(); - fMappingTimer.Start(kTRUE); fMappingTimer.Stop(); - -} +/// \cond CLASSIMP +ClassImp(AliMUONRawWriter) // Class implementation in ROOT context +/// \endcond //__________________________________________________________________________ AliMUONRawWriter::AliMUONRawWriter() : TObject(), - fMUONData(0), - fBlockHeader(0), - fDspHeader(0), - fBusStruct(0), - fDarcHeader(0), - fRegHeader(0), - fLocalStruct(0), - fBusPatchManager(0), + fBlockHeader(new AliMUONBlockHeader()), + fDspHeader(new AliMUONDspHeader()), + fDarcHeader(new AliMUONDarcHeader()), + fRegHeader(new AliMUONRegHeader()), + fLocalStruct(new AliMUONLocalStruct()), + fDDLStore(AliMpDDLStore::Instance()), fScalerEvent(kFALSE), - fSegFactory(0x0) + fHeader(0x0), + fBufferSize((((43*AliMpConstants::ManuNofChannels() + 4)*5 + 10)*5 + 8)*2), + fBuffer(new Int_t [fBufferSize]) { - // - // Default Constructor - // - AliDebug(1,"Default ctor"); - fFile[0] = fFile[1] = 0x0; - fTrackerTimer.Start(kTRUE); fTrackerTimer.Stop(); - fTriggerTimer.Start(kTRUE); fTriggerTimer.Stop(); - fMappingTimer.Start(kTRUE); fMappingTimer.Stop(); -} + /// Standard Constructor -//_______________________________________________________________________ -AliMUONRawWriter::AliMUONRawWriter (const AliMUONRawWriter& rhs) - : TObject(rhs) -{ - // - // Protected copy constructor - // - AliFatal("Not implemented."); -} + AliDebug(1,"Standard ctor"); -//_______________________________________________________________________ -AliMUONRawWriter & -AliMUONRawWriter::operator=(const AliMUONRawWriter& rhs) -{ - // - // Protected assignement operator - // - if (this == &rhs) return *this; + // setting data key to default value (only for writting) + fBlockHeader->SetDataKey(fBlockHeader->GetDefaultDataKey()); + fDspHeader->SetDataKey(fDspHeader->GetDefaultDataKey()); - AliFatal("Not implemented."); - - return *this; + // Load mapping + if ( ! fDDLStore ) { + if ( ! AliMpCDB::LoadDDLStore() ) { + AliFatal("Could not access mapping from OCDB !"); + } + fDDLStore = AliMpDDLStore::Instance(); + } } //__________________________________________________________________________ AliMUONRawWriter::~AliMUONRawWriter(void) { - // - // Destructor - // + /// Destructor + AliDebug(1,"dtor"); - delete fBusArray; - delete fBlockHeader; delete fDspHeader; - delete fBusStruct; delete fDarcHeader; delete fRegHeader; delete fLocalStruct; - - delete fBusPatchManager; - - delete fSegFactory; - - AliInfo(Form("Execution time for MUON tracker : R:%.2fs C:%.2fs", - fTrackerTimer.RealTime(),fTrackerTimer.CpuTime())); - AliInfo(Form(" Execution time for MUON tracker (mapping calls part) " - ": R:%.2fs C:%.2fs", - fMappingTimer.RealTime(),fMappingTimer.CpuTime())); - AliInfo(Form("Execution time for MUON trigger : R:%.2fs C:%.2fs", - fTriggerTimer.RealTime(),fTriggerTimer.CpuTime())); + delete[] fBuffer; } //____________________________________________________________________ -Int_t AliMUONRawWriter::Digits2Raw() +void AliMUONRawWriter::LocalWordPacking(UInt_t& word, UInt_t locId, UInt_t locDec, + UInt_t trigY, UInt_t posY, UInt_t posX, + UInt_t sdevX, UInt_t devX) { - // - // convert digits of the current event to raw data - // - Int_t idDDL; - Char_t name[20]; +/// pack local trigger word + + AliBitPacking::PackWord(locId,word,19,22); //card id number in crate + AliBitPacking::PackWord(locDec,word,15,18); + AliBitPacking::PackWord(trigY,word,14,14); + AliBitPacking::PackWord(posY,word,10,13); + AliBitPacking::PackWord(sdevX,word,9,9); + AliBitPacking::PackWord(devX,word,5,8); + AliBitPacking::PackWord(posX,word,0,4); - fMUONData->GetLoader()->LoadDigits("READ"); +} - fMUONData->SetTreeAddress("D,GLT"); +//____________________________________________________________________ +Int_t AliMUONRawWriter::Digits2Raw(const AliMUONVDigitStore* digitStore, + const AliMUONVTriggerStore* triggerStore) +{ + /// convert digits of the current event to raw data - fMUONData->ResetDigits(); - fMUONData->ResetTrigger(); - - // This will get both tracker and trigger digits. - fMUONData->GetDigits(); + AliCodeTimerAuto("",0) - // tracking chambers + Int_t idDDL; - for (Int_t ich = 0; ich < AliMUONConstants::NTrackingCh(); ich++) + // tracking chambers + + if ( digitStore ) { - // open files - idDDL = ich * 2 + 0x900; // official number for MUON - sprintf(name, "MUON_%d.ddl",idDDL); - fFile[0] = fopen(name,"w"); + AliCodeTimerAuto("for Tracker",1) + + AliMpExMap busPatchMap; - idDDL = (ich * 2) + 1 + 0x900; - sprintf(name, "MUON_%d.ddl",idDDL); - fFile[1] = fopen(name,"w"); + Int_t nDDLs = AliDAQ::NumberOfDdls("MUONTRK"); - WriteTrackerDDL(ich); - - // reset and close - fclose(fFile[0]); - fclose(fFile[1]); + Int_t nofBusPatches(0); + + for (Int_t iDDL = 0; iDDL < nDDLs; ++iDDL ) + { + AliMpDDL* ddl = fDDLStore->GetDDL(iDDL); + nofBusPatches += ddl->GetNofBusPatches(); + } + + busPatchMap.SetSize(nofBusPatches); + + Digits2BusPatchMap(*digitStore,busPatchMap); + + for (Int_t iDDL = 0; iDDL < nDDLs; ++iDDL ) + { + WriteTrackerDDL(busPatchMap,iDDL); + } + AliDebug(1,"Tracker written"); } - // trigger chambers - - // open files - idDDL = 0xA00;// official number for MUTR - sprintf(name, "MUTR_%d.ddl",idDDL); - fFile[0] = fopen(name,"w"); - - idDDL = 0xA00 + 1; - sprintf(name, "MUTR_%d.ddl",idDDL); - fFile[1] = fopen(name,"w"); + if ( triggerStore ) + { + AliCodeTimerAuto("for Trigger",1) - WriteTriggerDDL(); + // trigger chambers + + AliFstream* file[2]; + + // open files + idDDL = 0;// MUTR + file[0] = new AliFstream(AliDAQ::DdlFileName("MUONTRG",idDDL)); + + idDDL = 1;// MUTR + file[1] = new AliFstream(AliDAQ::DdlFileName("MUONTRG",idDDL)); + + WriteTriggerDDL(*triggerStore,file); + + // reset and close + delete file[0]; + delete file[1]; + + AliDebug(1,"Trigger written"); + } - // reset and close - fclose(fFile[0]); - fclose(fFile[1]); - - fMUONData->ResetDigits(); - fMUONData->ResetTrigger(); - fMUONData->GetLoader()->UnloadDigits(); - return kTRUE; } -//____________________________________________________________________ -Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iCh) +//______________________________________________________________________________ +void +AliMUONRawWriter::Digits2BusPatchMap(const AliMUONVDigitStore& digitStore, + AliMpExMap& busPatchMap) { - // writing DDL for tracker - // used inverse mapping - // - fTrackerTimer.Start(kFALSE); + /// Create bus patch structures corresponding to digits in the store + + AliCodeTimerAuto("",0) - static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC. - - // resets - TClonesArray* muonDigits = 0; - - fBusArray->Delete(); - - - // - TArrayI nbInBus; - - nbInBus.Set(5000); - - nbInBus.Reset(); - - // DDL header - Int_t headerSize = sizeof(fHeader)/4; - + // DDL event one per half chamber - + // raw data Char_t parity = 0x4; UShort_t manuId = 0; UChar_t channelId = 0; UShort_t charge = 0; Int_t busPatchId = 0; + Int_t currentBusPatchId = -1; UInt_t word; - - - // Dsp length - Int_t totalDspLength; - Int_t dspLength; - - // block length - Int_t totalBlkLength; - Int_t blkLength; - // total DDL length - Int_t totalDDLLength; - - // indexes - Int_t index; - Int_t indexDsp; - Int_t indexBlk; - - // digits - Int_t nEntries = 0; - Int_t* buffer = 0; - Int_t padX; - Int_t padY; - Int_t cathode = 0; - Int_t detElemId; - Int_t nDigits; - - const AliMUONDigit* digit; - - AliDebug(3, Form("WriteDDL chamber %d\n", iCh+1)); - - muonDigits = fMUONData->Digits(iCh); - - nDigits = muonDigits->GetEntriesFast(); - AliDebug(3,Form("ndigits = %d\n",nDigits)); - - // loop over digit - for (Int_t idig = 0; idig < nDigits; idig++) { - - digit = (AliMUONDigit*) muonDigits->UncheckedAt(idig); - - padX = digit->PadX(); - padY = digit->PadY(); + AliMUONBusStruct* busStruct(0x0); + + TIter next(digitStore.CreateTrackerIterator()); + AliMUONVDigit* digit; + + while ( ( digit = static_cast(next()) ) ) + { charge = digit->ADC(); if ( charge > kMAXADC ) { // This is most probably an error in the digitizer (which should insure // the adc is below kMAXADC), so make it a (non-fatal) error indeed. - AliError(Form("adc value %d above %x. Setting to %x", - charge,kMAXADC,kMAXADC)); + AliError(Form("adc value %d above 0x%x for DE %d . Setting to 0x%x. Digit is:", + charge,kMAXADC,digit->DetElemId(),kMAXADC)); + StdoutToAliError(digit->Print()); charge = kMAXADC; } - cathode = digit->Cathode(); - detElemId = digit->DetElemId(); - + // inverse mapping busPatchId = GetBusPatch(*digit); - if (busPatchId<0) continue; - if ( digit->ManuId() > 0x7FF || digit->ManuId() < 0 || - digit->ManuChannel() > 0x3F || digit->ManuChannel() < 0 ) + if (busPatchId<0) continue; + + if ( digit->ManuId() > 0x7FF || + digit->ManuChannel() > 0x3F ) { StdoutToAliError(digit->Print();); AliFatal("ManuId,ManuChannel are invalid for the digit above."); @@ -364,506 +275,463 @@ Int_t AliMUONRawWriter::WriteTrackerDDL(Int_t iCh) manuId = ( digit->ManuId() & 0x7FF ); // 11 bits channelId = ( digit->ManuChannel() & 0x3F ); // 6 bits - - AliDebug(3,Form("input IdDE %d busPatchId %d PadX %d PadY %d iCath %d \n", - detElemId, busPatchId, padX, padY, cathode)); - - AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n", busPatchId, manuId, channelId )); - + //packing word - AliBitPacking::PackWord((UInt_t)parity,word,29,31); + word = 0; AliBitPacking::PackWord((UInt_t)manuId,word,18,28); AliBitPacking::PackWord((UInt_t)channelId,word,12,17); AliBitPacking::PackWord((UInt_t)charge,word,0,11); - - // set sub Event - fBusStruct->SetLength(0); - fBusStruct->AddData(word); - fBusStruct->SetBusPatchId(busPatchId); - - // storing the number of identical buspatches - nbInBus[busPatchId]++; - AddData(*fBusStruct); - - } - - // sorting by buspatch - fBusArray->Sort(); - - // gather datas from same bus patch - nEntries = fBusArray->GetEntriesFast(); - - for (Int_t i = 0; i < nEntries; i++) { - AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i); - busPatchId = temp->GetBusPatchId(); - - // add bus patch header, length and total length managed by subevent class - for (Int_t j = 0; j < nbInBus[busPatchId]-1; j++) { - AliMUONBusStruct* temp1 = (AliMUONBusStruct*)fBusArray->At(++i); - temp->AddData(temp1->GetData(0)); - fBusArray->RemoveAt(i) ; - } - } - fBusArray->Compress(); - - if (AliLog::GetGlobalDebugLevel() == 3) { - nEntries = fBusArray->GetEntriesFast(); - for (Int_t i = 0; i < nEntries; i++) { - AliMUONBusStruct* temp = (AliMUONBusStruct*)fBusArray->At(i); - printf("busPatchid back %d\n",temp->GetBusPatchId()); - for (Int_t j = 0; j < temp->GetLength(); j++) { - printf("manuId back %d, ",temp->GetManuId(j)); - printf("channelId back %d, ",temp->GetChannelId(j)); - printf("charge back %d\n",temp->GetCharge(j)); - } + + // parity word + parity = word & 0x1; + for (Int_t i = 1; i <= 30; ++i) + { + parity ^= ((word >> i) & 0x1); } - printf("\n"); - } - - // getting info for the number of buspatches - Int_t iBusPatch; - Int_t length; - Int_t iBusPerDSP[5];//number of bus patches per DSP - Int_t iDspMax; //number max of DSP per block - Int_t iFile = 0; - fBusPatchManager->GetDspInfo(iCh, iDspMax, iBusPerDSP); - - TArrayI* vec = fBusPatchManager->GetBusfromDE((iCh+1)*100); - - Int_t iBus0AtCh = vec->At(0); //get first bus patch id for a given ich - - AliDebug(3,Form("iBus0AtCh %d", iBus0AtCh)); - - iBusPatch = iBus0AtCh - 1; // starting point for each chamber - - // nEntries = fBusArray->GetEntriesFast(); + AliBitPacking::PackWord((UInt_t)parity,word,31,31); - AliMUONBusStruct* busStructPtr = 0x0; - - // open DDL file, on per 1/2 chamber - for (Int_t iDDL = 0; iDDL < 2; iDDL++) { + if ( currentBusPatchId != busPatchId ) + { + busStruct = + static_cast(busPatchMap.GetValue(busPatchId)); + currentBusPatchId = busPatchId; + } - totalDDLLength = 0; - - // filling buffer - buffer = new Int_t [(2048+24)*50]; // 24 words at most for one buspatch and 2048 manu info at most - - indexBlk = 0; - indexDsp = 0; - index = 0; - - // two blocks A and B per DDL - for (Int_t iBlock = 0; iBlock < 2; iBlock++) { - - // block header - length = fBlockHeader->GetHeaderLength(); - memcpy(&buffer[index],fBlockHeader->GetHeader(),length*4); - indexBlk = index; - index += length; - - // 5 DSP's max per block - for (Int_t iDsp = 0; iDsp < iDspMax; iDsp++) { - - // DSP header - length = fDspHeader->GetHeaderLength(); - memcpy(&buffer[index],fDspHeader->GetHeader(),length*4); - indexDsp = index; - index += length; - - // 5 buspatches max per DSP - for (Int_t i = 0; i < iBusPerDSP[iDsp]; i++) { - - iBusPatch++; - if ((fBusPatchManager->GetDDLfromBus(iBusPatch) % 2) == 0) // comparing to DDL file - iFile = 1; - else - iFile = 0; - - AliDebug(3,Form("iCh %d iDDL %d iBlock %d iDsp %d busPatchId %d", iCh, iDDL, iBlock, iDsp, iBusPatch)); - - nEntries = fBusArray->GetEntriesFast(); - busPatchId = -1; - - for (Int_t iEntries = 0; iEntries < nEntries; iEntries++) { // method "bourrique"... - busStructPtr = (AliMUONBusStruct*)fBusArray->At(iEntries); - busPatchId = busStructPtr->GetBusPatchId(); - if (busPatchId == iBusPatch) break; - busPatchId = -1; - AliDebug(3,Form("busPatchId %d", busStructPtr->GetBusPatchId())); - } - - // check if buspatchid has digit - if (busPatchId != -1) { - // add bus patch structure header - length = busStructPtr->GetHeaderLength(); - memcpy(&buffer[index],busStructPtr->GetHeader(),length*4); - index += length; - - // add bus patch data - for (Int_t j = 0; j < busStructPtr->GetLength(); j++) { - buffer[index++] = busStructPtr->GetData(j); - AliDebug(3,Form("busPatchId %d, manuId %d channelId %d\n", - busStructPtr->GetBusPatchId(), - busStructPtr->GetManuId(j), busStructPtr->GetChannelId(j) )); - } - // fBusArray->RemoveAt(iEntries); - // fBusArray->Compress(); - } else { - // writting anyhow buspatch structure (empty ones) - buffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size - buffer[index++] = busStructPtr->GetHeaderLength(); // header length - buffer[index++] = 0; // raw data length - buffer[index++] = iBusPatch; // bus patch - } - } // bus patch - - // check if totalLength even - // set padding word in case - // Add one word 0xBEEFFACE at the end of DSP structure - totalDspLength = index - indexDsp; - if ((totalDspLength % 2) == 1) { - buffer[indexDsp + fDspHeader->GetHeaderLength() - 2] = 1; - buffer[index++] = fDspHeader->GetDefaultPaddingWord(); - totalDspLength++; - } - - dspLength = totalDspLength - fDspHeader->GetHeaderLength(); - - buffer[indexDsp+1] = totalDspLength; // dsp total length - buffer[indexDsp+2] = dspLength; // data length - - } // dsp - - totalBlkLength = index - indexBlk; - blkLength = totalBlkLength - fBlockHeader->GetHeaderLength(); - totalDDLLength += totalBlkLength; - - buffer[indexBlk+1] = totalBlkLength; // total block length - buffer[indexBlk+2] = blkLength; - - } // block + if (!busStruct) + { + busStruct = new AliMUONBusStruct; + busStruct->SetDataKey(busStruct->GetDefaultDataKey()); + busStruct->SetBusPatchId(busPatchId); + busStruct->SetLength(0); + busPatchMap.Add(busPatchId,busStruct); + } - //writting onto disk - // write DDL 1 & 2 - fHeader.fSize = (totalDDLLength + headerSize) * 4;// total length in bytes - fwrite((char*)(&fHeader),headerSize*4,1,fFile[iFile]); - fwrite(buffer,sizeof(int),index,fFile[iFile]); - - delete[] buffer; + // set sub Event + busStruct->AddData(word); } - - fTrackerTimer.Stop(); - return kTRUE; } -//____________________________________________________________________ -Int_t AliMUONRawWriter::GetBusPatch(const AliMUONDigit& digit) +//______________________________________________________________________________ +void +AliMUONRawWriter::WriteTrackerDDL(AliMpExMap& busPatchMap, Int_t iDDL) { - // - // Determine the BusPatch this digit belongs to. - // - fMappingTimer.Start(kFALSE); - - Int_t* ptr = 0; - - // information from digits - Int_t detElemId = digit.DetElemId(); - - AliMpVSegmentation* seg = - fSegFactory->CreateMpSegmentationByElectronics(detElemId, digit.ManuId()); + /// Write DDL file for one tracker DDL - AliMpPlaneType plane = seg->PlaneType(); - - AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId); + // buffer size (max'ed out) + // (((43 manus max per bus patch *64 channels + 4 bus patch words) * 5 bus patch + // + 10 dsp words)*5 dsps + 8 block words)*2 blocks + + AliCodeTimerAuto("",0) - if ( stationType == kStation1 || stationType == kStation2 ) - { - if (plane == kBendingPlane) - { - ptr = &fgManuPerBusSwp1B[0]; - } - else - { - ptr = &fgManuPerBusSwp1NB[0]; - } - } - else - { - if (plane == kBendingPlane) - { - ptr = &fgManuPerBusSwp2B[0]; - } - else - { - ptr = &fgManuPerBusSwp2NB[0]; - } + if (fHeader == 0x0) { + AliError("Raw data header must be set"); + return; } - - // Getting buspatch id - TArrayI* vec = fBusPatchManager->GetBusfromDE(detElemId); - Int_t pos = 0; - - Int_t m = ( digit.ManuId() & 0x3FF ); // remove bit 10 - //FIXME : how can we remove that condition - // on the 10-th bit ? All the rest need not any knowledge about it, - // can't we find a way to get manu<->buspatch transparent to this too ? + memset(fBuffer,0,fBufferSize*sizeof(Int_t)); + + AliMpDDL* ddl = fDDLStore->GetDDL(iDDL); + Int_t iDspMax = ddl->GetMaxDsp(); + Int_t iBusPerDSP[5]; //number of bus patches per DSP + ddl->GetBusPerDsp(iBusPerDSP); + Int_t busIter = 0; + + Int_t totalDDLLength = 0; + + Int_t index = 0; - if ( stationType == kStation1 || stationType == kStation2 ) + // two blocks A and B per DDL + for (Int_t iBlock = 0; iBlock < 2; ++iBlock) { - for (Int_t i = 0; i < 12; i++) + // block header + Int_t length = fBlockHeader->GetHeaderLength(); + memcpy(&fBuffer[index],fBlockHeader->GetHeader(),length*4); + Int_t indexBlk = index; + index += length; + + // 5 DSP's max per block + for (Int_t iDsp = 0; iDsp < iDspMax; ++iDsp) { - if (m >= *(ptr + pos++)) break; - } - } - else - { - // offset of 100 in manuId for following bus patch - pos = m/100; - } - - if (pos >(Int_t) vec->GetSize()) - { - AliError(Form("pos greater %d than size %d manuId %d detElemId %d \n", - pos, (Int_t)vec->GetSize(), digit.ManuId(), detElemId)); - AliError(Form("Chamber %s Plane %s manuId %d m %d", - StationTypeName(stationType).Data(), - PlaneTypeName(plane).Data(), - digit.ManuId(), - m)); - return -1; - } + // DSP header + Int_t dspHeaderLength = fDspHeader->GetHeaderLength(); + memcpy(&fBuffer[index],fDspHeader->GetHeader(),dspHeaderLength*4); + Int_t indexDsp = index; + index += dspHeaderLength; + + // 5 buspatches max per DSP + for (Int_t i = 0; i < iBusPerDSP[iDsp]; ++i) + { + Int_t iBusPatch = ddl->GetBusPatchId(busIter++); + + // iteration over bus patch in DDL + if (iBusPatch == -1) + { + AliWarning(Form("Error in bus itr in DDL %d\n", iDDL)); + continue; + } + + AliMUONBusStruct* busStructPtr = static_cast(busPatchMap.GetValue(iBusPatch)); + + // check if buspatchid has digit + if (busStructPtr) + { + // add bus patch structure header + Int_t busHeaderLength = busStructPtr->GetHeaderLength(); + memcpy(&fBuffer[index],busStructPtr->GetHeader(),busHeaderLength*4); + index += busHeaderLength; + + // add bus patch data + Int_t busLength = busStructPtr->GetLength(); + memcpy(&fBuffer[index],busStructPtr->GetData(),busLength*4); + index += busLength; + } + else + { + // writting anyhow buspatch structure (empty ones) + fBuffer[index++] = busStructPtr->GetDefaultDataKey(); // fill it also for empty data size + fBuffer[index++] = busStructPtr->GetHeaderLength(); // header length + fBuffer[index++] = 0; // raw data length + fBuffer[index++] = iBusPatch; // bus patch + } + } // bus patch + + // check if totalLength even + // set padding word in case + // Add one word 0xBEEFFACE at the end of DSP structure + Int_t totalDspLength = index - indexDsp; + if ((totalDspLength % 2) == 1) + { + fBuffer[indexDsp + fDspHeader->GetHeaderLength() - 2] = 1; + fBuffer[index++] = fDspHeader->GetDefaultPaddingWord(); + totalDspLength++; + } + + Int_t dspLength = totalDspLength - fDspHeader->GetHeaderLength(); + + fBuffer[indexDsp+1] = totalDspLength; // dsp total length + fBuffer[indexDsp+2] = dspLength; // data length + + } // dsp + + Int_t totalBlkLength = index - indexBlk; + Int_t blkLength = totalBlkLength - fBlockHeader->GetHeaderLength(); + totalDDLLength += totalBlkLength; + + fBuffer[indexBlk+1] = totalBlkLength; // total block length + fBuffer[indexBlk+2] = blkLength; + + } // block + + // add twice the end of CRT structure data key + // hope it's good placed (ChF) + fBuffer[index++] = fBlockHeader->GetDdlDataKey(); + fBuffer[index++] = fBlockHeader->GetDdlDataKey(); + totalDDLLength += 2; - Int_t busPatchId = vec->At(pos); + // writting onto disk + // total length in bytes + // DDL header - fMappingTimer.Stop(); + Int_t headerSize = sizeof(AliRawDataHeader)/4; + + fHeader->fSize = (totalDDLLength + headerSize) * 4; + + AliFstream* file = new AliFstream(AliDAQ::DdlFileName("MUONTRK",iDDL)); - return busPatchId; + file->WriteBuffer((char*)fHeader,headerSize*4); + file->WriteBuffer((char*)fBuffer,sizeof(int)*index); + delete file; } -//____________________________________________________________________ -Int_t AliMUONRawWriter::WriteTriggerDDL() +//______________________________________________________________________________ +Int_t AliMUONRawWriter::GetBusPatch(const AliMUONVDigit& digit) const { - // - // Write trigger DDL - // - fTriggerTimer.Start(kFALSE); + /// Determine the BusPatch this digit belongs to. + + return fDDLStore->GetBusPatchId(digit.DetElemId(),digit.ManuId()); +} + +//______________________________________________________________________________ +Int_t AliMUONRawWriter::WriteTriggerDDL(const AliMUONVTriggerStore& triggerStore, AliFstream* file[2]) +{ + /// Write trigger DDL - // DDL event one per half chamber + AliCodeTimerAuto("",0) - // stored local id number - TArrayI isFired(256); - isFired.Reset(); + if (fHeader == 0x0) { + AliError("Raw data header must be set"); + return 0; + } + // DDL event one per half chamber // DDL header size Int_t headerSize = sizeof(AliRawDataHeader)/4; - TClonesArray* localTrigger; - TClonesArray* globalTrigger; - AliMUONGlobalTrigger* gloTrg; - AliMUONLocalTrigger* locTrg = 0x0; - // global trigger for trigger pattern - globalTrigger = fMUONData->GlobalTrigger(); - gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0); - Int_t gloTrigPat = gloTrg->GetGlobalPattern(); - - // local trigger - localTrigger = fMUONData->LocalTrigger(); + AliMUONGlobalTrigger* gloTrg = triggerStore.Global(); + if (!gloTrg) + { + return 0; + } + + Int_t gloTrigResp = gloTrg->GetGlobalResponse(); + UInt_t *gloTrigInput = gloTrg->GetGlobalInput(); UInt_t word; Int_t* buffer = 0; Int_t index; - Int_t iEntries = 0; - Int_t iLocCard, locCard; - Char_t locDec, trigY, posY, posX,regOut; - Int_t devX; - Int_t version = 1; // software version - Int_t eventType = 1; // trigger type: 1 for physics ? - Int_t serialNb = 0xF; // serial nb of card: all bits on for the moment - Int_t globalFlag = 1; // set to 2 if global info present in DDL else set to 1 - - if(fScalerEvent) - eventType = 2; //set to generate scaler events - - Int_t nEntries = (Int_t) (localTrigger->GetEntries());// 234 local cards - // stored the local card id that's fired - for (Int_t i = 0; i < nEntries; i++) { - locTrg = (AliMUONLocalTrigger*)localTrigger->At(i); - isFired[locTrg->LoCircuit()] = 1; // storing local boards with informations + Int_t locCard; + UChar_t locDec, trigY, posY, posX, regOut; + UInt_t regInpLpt; + UInt_t regInpHpt; + + UInt_t devX; + UChar_t sdevX; + UInt_t version = 1; // software version + UInt_t eventPhys = 1; // trigger type: 1 for physics, 0 for software + UInt_t serialNb = 0xF; // serial nb of card: all bits on for the moment + Int_t globalFlag = 0; // set to 1 if global info present in DDL else set to 0 + + // size of headers + static const Int_t kDarcHeaderLength = fDarcHeader->GetDarcHeaderLength(); + static const Int_t kGlobalHeaderLength = fDarcHeader->GetGlobalHeaderLength(); + static const Int_t kDarcScalerLength = fDarcHeader->GetDarcScalerLength(); + static const Int_t kGlobalScalerLength = fDarcHeader->GetGlobalScalerLength(); + static const Int_t kRegHeaderLength = fRegHeader->GetHeaderLength(); + static const Int_t kRegScalerLength = fRegHeader->GetScalerLength(); + static const Int_t kLocHeaderLength = fLocalStruct->GetLength(); + static const Int_t kLocScalerLength = fLocalStruct->GetScalerLength(); + + // [16(local)*6 words + 6 words]*8(reg) + 8 words = 824 + static const Int_t kBufferSize = (16 * (kLocHeaderLength+1) + (kRegHeaderLength+1))* 8 + + kDarcHeaderLength + kGlobalHeaderLength + 2; + + // [16(local)*51 words + 16 words]*8(reg) + 8 + 10 + 8 words scaler event 6682 words + static const Int_t kScalerBufferSize = (16 * (kLocHeaderLength + kLocScalerLength +1) + + (kRegHeaderLength + kRegScalerLength +1))* 8 + + (kDarcHeaderLength + kDarcScalerLength + + kGlobalHeaderLength + kGlobalScalerLength + 2); + if(fScalerEvent) { + eventPhys = 0; //set to generate scaler events + fHeader->fWord2 |= (0x1 << 14); // set L1SwC bit on } - - if (!nEntries) - AliInfo("No Trigger information available"); - if(fScalerEvent) - // [16(local)*51 words + 16 words]*8(reg) + 6 + 12 + 6 words scaler event 6672 words - buffer = new Int_t [6680]; + buffer = new Int_t [kScalerBufferSize]; else - // [16(local)*6 words + 5 words]*8(reg) + 10 words = 818 - buffer = new Int_t [818]; + buffer = new Int_t [kBufferSize]; + // reset crate // open DDL file, on per 1/2 chamber - for (Int_t iDDL = 0; iDDL < 2; iDDL++) { - + for ( Int_t iDDL = 0; iDDL < 2; ++iDDL ) + { index = 0; - word = 0; - // set darc status word - AliBitPacking::PackWord((UInt_t)iDDL+1,word,28,31); //see AliMUONDDLTrigger.h for details - AliBitPacking::PackWord((UInt_t)serialNb,word,24,27); - AliBitPacking::PackWord((UInt_t)version,word,16,23); - AliBitPacking::PackWord((UInt_t)eventType,word,12,15); - if (iDDL == 0) // suppose global info in DDL one - globalFlag = 2; - else globalFlag = 1; + else + globalFlag = 0; - AliBitPacking::PackWord((UInt_t)globalFlag,word,8,11); + word = 0; + // set darc status word + // see AliMUONDarcHeader.h for details + AliBitPacking::PackWord((UInt_t)eventPhys,word,30,30); + AliBitPacking::PackWord((UInt_t)serialNb,word,20,23); + AliBitPacking::PackWord((UInt_t)globalFlag,word,10,10); + AliBitPacking::PackWord((UInt_t)version,word,12,19); fDarcHeader->SetWord(word); - memcpy(&buffer[index], fDarcHeader->GetHeader(), (fDarcHeader->GetDarcHeaderLength())*4); - index += fDarcHeader->GetDarcHeaderLength(); + memcpy(&buffer[index], fDarcHeader->GetHeader(), (kDarcHeaderLength)*4); + index += kDarcHeaderLength; - if (iDDL == 0) - fDarcHeader->SetGlobalOutput(gloTrigPat);// no global input for the moment.... - else - fDarcHeader->SetGlobalOutput(0); + // no global input for the moment.... + if (iDDL == 0) { + fDarcHeader->SetGlobalOutput(gloTrigResp); + for (Int_t ii = 0; ii < 4; ii++) { + fDarcHeader->SetGlobalInput(gloTrigInput[ii],ii); + } + } else { + fDarcHeader->SetGlobalOutput(0); + } if (fScalerEvent) { // 6 DARC scaler words - memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),fDarcHeader->GetDarcScalerLength()*4); - index += fDarcHeader->GetDarcScalerLength(); + memcpy(&buffer[index], fDarcHeader->GetDarcScalers(),kDarcScalerLength*4); + index += kDarcScalerLength; } // end of darc word buffer[index++] = fDarcHeader->GetEndOfDarc(); // 4 words of global board input + Global board output - memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (fDarcHeader->GetGlobalHeaderLength())*4); - index += fDarcHeader->GetGlobalHeaderLength(); + memcpy(&buffer[index], fDarcHeader->GetGlobalInput(), (kGlobalHeaderLength)*4); + index += kGlobalHeaderLength; if (fScalerEvent) { // 10 Global scaler words - memcpy(fDarcHeader->GetGlobalScalers(), &buffer[index], fDarcHeader->GetGlobalScalerLength()*4); - index += fDarcHeader->GetGlobalScalerLength(); + memcpy(&buffer[index], fDarcHeader->GetGlobalScalers(), kGlobalScalerLength*4); + index += kGlobalScalerLength; } // end of global word buffer[index++] = fDarcHeader->GetEndOfGlobal(); + const AliMpRegionalTrigger* reg = AliMpDDLStore::Instance()->GetRegionalTrigger(); + Int_t nCrate = reg->GetNofTriggerCrates()/2; // 8 regional cards per DDL - for (Int_t iReg = 0; iReg < 8; iReg++) { - + for (Int_t iReg = 0; iReg < nCrate; ++iReg) { + + // crate info + AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(iDDL, iReg); + + if (!crate) { + AliError(Form("Missing crate number %d in DDL %d\n", iReg, iDDL)); + continue; + } + + // regional info tree, make sure that no reg card missing + AliMUONRegionalTrigger* regTrg = triggerStore.FindRegional(crate->GetId()); + if (!regTrg) { + AliError(Form("Missing regional board %d in trigger Store\n", crate->GetId())); + continue; + } + // Regional card header word = 0; // set darc status word fRegHeader->SetDarcWord(word); - regOut = 0; - AliBitPacking::PackWord((UInt_t)serialNb,word,24,28); //see AliMUONLocalStruct.h for details - AliBitPacking::PackWord((UInt_t)version,word,16,23); - AliBitPacking::PackWord((UInt_t)iReg,word,12,15); - AliBitPacking::PackWord((UInt_t)regOut,word,0,7); // whenever regional output will be implemented - + regOut = regTrg->GetOutput(); + regInpLpt = regTrg->GetLocalOutput(0); + regInpHpt = regTrg->GetLocalOutput(1); + + // fill darc word, not darc status for the moment (empty) + //see AliMUONRegHeader.h for details + AliBitPacking::PackWord((UInt_t)eventPhys,word,31,31); + AliBitPacking::PackWord((UInt_t)serialNb,word,20,25); + AliBitPacking::PackWord((UInt_t)version,word,8,15); + AliBitPacking::PackWord((UInt_t)crate->GetId(),word,16,19); + AliBitPacking::PackWord((UInt_t)regOut,word,0,7); fRegHeader->SetWord(word); - memcpy(&buffer[index],fRegHeader->GetHeader(),fRegHeader->GetHeaderLength()*4); - index += fRegHeader->GetHeaderLength(); + + + // fill header later, need local response + Int_t indexReg = index; + index += kRegHeaderLength; // 11 regional scaler word if (fScalerEvent) { - memcpy(&buffer[index], fRegHeader->GetScalers(), fRegHeader->GetScalerLength()*4); - index += fRegHeader->GetScalerLength(); + memcpy(&buffer[index], fRegHeader->GetScalers(), kRegScalerLength*4); + index += kRegScalerLength; } // end of regional word buffer[index++] = fRegHeader->GetEndOfReg(); - + // 16 local card per regional board - for (Int_t iLoc = 0; iLoc < 16; iLoc++) { - - iLocCard = iLoc + iReg*16 + iDDL*128; - - if (isFired[iLocCard]) { - locTrg = (AliMUONLocalTrigger*)localTrigger->At(iEntries); - locCard = locTrg->LoCircuit(); - locDec = locTrg->GetLoDecision(); - trigY = 0; - posY = locTrg->LoStripY(); - posX = locTrg->LoStripX(); - devX = locTrg->LoDev(); - AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n", - locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev())); - } else { //no trigger (see PRR chpt 3.4) - locCard = -1; // not possible on 4 bits - locDec = 0; - trigY = 1; - posY = 15; - posX = 0; - devX = 0x8; - } - - //packing word - word = 0; - AliBitPacking::PackWord((UInt_t)(iLocCard % 16),word,19,22); //card id number in crate - AliBitPacking::PackWord((UInt_t)locDec,word,15,18); - AliBitPacking::PackWord((UInt_t)trigY,word,14,14); - AliBitPacking::PackWord((UInt_t)posY,word,10,13); - AliBitPacking::PackWord((UInt_t)devX,word,5,9); - AliBitPacking::PackWord((UInt_t)posX,word,0,4); - - if (locCard == iLocCard) { - // add local cards structure - buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16)); - buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16)); - buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16)); - buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16)); - buffer[index++] = (Int_t)word; // data word - if (iEntries < nEntries-1) - iEntries++; - } else { - buffer[index++] = 0; // 4 words for x1, x2, y1, y2 - buffer[index++] = 0; - buffer[index++] = 0; - buffer[index++] = 0; - buffer[index++] = (Int_t)word; // data word + // UShort_t localMask = 0x0; + + Int_t nLocalBoard = AliMpConstants::LocalBoardNofChannels(); + + for (Int_t iLoc = 0; iLoc < nLocalBoard; iLoc++) { + + // slot zero for Regional card + Int_t localBoardId = crate->GetLocalBoardId(iLoc); + + if (localBoardId) { // if not empty slot + AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(localBoardId); + + if (localBoard->IsNotified()) {// if notified board + AliMUONLocalTrigger* locTrg = triggerStore.FindLocal(localBoardId); + + if (locTrg) + { + locCard = locTrg->LoCircuit(); + locDec = locTrg->GetLoDecision(); + trigY = locTrg->LoTrigY(); + posY = locTrg->LoStripY(); + posX = locTrg->LoStripX(); + devX = locTrg->LoDev(); + sdevX = locTrg->LoSdev(); + + AliDebug(4,Form("loctrg %d, posX %d, posY %d, devX %d\n", + locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoStripY(),locTrg->LoDev())); + //packing word + word = 0; + LocalWordPacking(word, (UInt_t)iLoc, (UInt_t)locDec, (UInt_t)trigY, (UInt_t)posY, + (UInt_t)posX, (UInt_t)sdevX, (UInt_t)devX); + + buffer[index++] = (locTrg->GetX1Pattern() | (locTrg->GetX2Pattern() << 16)); + buffer[index++] = (locTrg->GetX3Pattern() | (locTrg->GetX4Pattern() << 16)); + buffer[index++] = (locTrg->GetY1Pattern() | (locTrg->GetY2Pattern() << 16)); + buffer[index++] = (locTrg->GetY3Pattern() | (locTrg->GetY4Pattern() << 16)); + buffer[index++] = (Int_t)word; // data word + } + } + // fill copy card X-Y inputs from the notified cards + if (localBoard->GetInputXfrom() && localBoard->GetInputYfrom()) + { + // not triggered + locDec = 0; trigY = 1; posY = 15; + posX = 0; devX = 0; sdevX = 1; + LocalWordPacking(word, (UInt_t)iLoc, (UInt_t)locDec, (UInt_t)trigY, (UInt_t)posY, + (UInt_t)posX, (UInt_t)sdevX, (UInt_t)devX); + + Int_t localFromId = localBoard->GetInputXfrom(); + AliMUONLocalTrigger* locTrgfrom = triggerStore.FindLocal(localFromId); + + if ( locTrgfrom ) + { + buffer[index++] = 0; // copy only X3-4 & Y1-4 + buffer[index++] = (locTrgfrom->GetX3Pattern() | (locTrgfrom->GetX4Pattern() << 16)); + buffer[index++] = (locTrgfrom->GetY1Pattern() | (locTrgfrom->GetY2Pattern() << 16)); + buffer[index++] = (locTrgfrom->GetY3Pattern() | (locTrgfrom->GetY4Pattern() << 16)); + buffer[index++] = word; + } + } - } + } else { + // fill with 10CDEAD word for empty slots + for (Int_t i = 0; i < fLocalStruct->GetLength(); i++) + buffer[index++] = fLocalStruct->GetDisableWord(); + }// condition localBoard + // 45 regional scaler word if (fScalerEvent) { - memcpy(&buffer[index], fLocalStruct->GetScalers(), fLocalStruct->GetScalerLength()*4); - index += fLocalStruct->GetScalerLength(); + memcpy(&buffer[index], fLocalStruct->GetScalers(), kLocScalerLength*4); + index += kLocScalerLength; } - + // end of local structure words - buffer[index++] = fLocalStruct->GetEndOfLocal(); - + buffer[index++] = fLocalStruct->GetEndOfLocal(); + } // local card - + // fill regional header with local output + fRegHeader->SetInput(regInpLpt, 0); + fRegHeader->SetInput(regInpHpt, 1); + memcpy(&buffer[indexReg],fRegHeader->GetHeader(),kRegHeaderLength*4); + } // Regional card // writting onto disk - // write DDL 1 - fHeader.fSize = (index + headerSize) * 4;// total length in bytes - fwrite((char*)(&fHeader),headerSize*4,1,fFile[iDDL]); - fwrite(buffer,sizeof(int),index,fFile[iDDL]); + // write DDL's + fHeader->fSize = (index + headerSize) * 4;// total length in bytes + file[iDDL]->WriteBuffer((char*)fHeader,headerSize*4); + file[iDDL]->WriteBuffer((char*)buffer,sizeof(int)*index); } delete[] buffer; - fTriggerTimer.Stop(); - return kTRUE; } + //____________________________________________________________________ void AliMUONRawWriter::SetScalersNumbers() { - // set numbers for scaler events for trigger headers - // since this is provided by the experiment - // put dummy numbers to check the monitoring + /// set numbers for scaler events for trigger headers + /// since this is provided by the experiment + /// put dummy numbers to check the monitoring fDarcHeader->SetScalersNumbers(); fRegHeader->SetScalersNumbers(); @@ -871,3 +739,4 @@ void AliMUONRawWriter::SetScalersNumbers() fScalerEvent = kTRUE; } +