/* $Id$ */
+//-----------------------------------------------------------------------------
/// \class AliMUONRawWriter
/// MUON Raw Data generaton in ALICE-MUON
/// Raw data structure could be found in Alice-note.
/// Using AliMpDDLStore::GetBusPatchId.
///
/// \author Ch. Finck, Feb. 07.
+//-----------------------------------------------------------------------------
#include "AliMUONRawWriter.h"
#include "AliMUONRegHeader.h"
#include "AliMUONVTriggerStore.h"
-#include "AliMUONStopwatchGroup.h"
-#include "AliMUONStopwatchGroupElement.h"
+#include "AliCodeTimer.h"
#include "AliMpDDLStore.h"
#include "AliMpDDL.h"
#include "AliMpVSegmentation.h"
#include "AliRawReader.h"
+#include "AliRawDataHeaderSim.h"
#include "AliBitPacking.h"
#include "AliDAQ.h"
#include "AliLog.h"
fLocalStruct(new AliMUONLocalStruct()),
fDDLStore(AliMpDDLStore::Instance()),
fScalerEvent(kFALSE),
- fHeader(),
- fTimers(new AliMUONStopwatchGroup),
+ fHeader(0x0),
fBufferSize((((43*AliMpConstants::ManuNofChannels() + 4)*5 + 10)*5 + 8)*2),
fBuffer(new Int_t [fBufferSize])
{
delete fDarcHeader;
delete fRegHeader;
delete fLocalStruct;
- AliInfo("Timers:");
- fTimers->Print();
- delete fTimers;
delete[] fBuffer;
}
{
/// convert digits of the current event to raw data
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::Digits2Raw");
+ AliCodeTimerAuto("")
Int_t idDDL;
Char_t name[255];
if ( digitStore )
{
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::Digits2Raw for Tracker");
+ AliCodeTimerAuto("for Tracker")
AliMpExMap busPatchMap(true);
if ( triggerStore )
{
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::Digits2Raw for Trigger");
+ AliCodeTimerAuto("for Trigger")
// trigger chambers
{
/// Create bus patch structures corresponding to digits in the store
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::Digits2BusPatchMap");
+ AliCodeTimerAuto("")
static const Int_t kMAXADC = (1<<12)-1; // We code the charge on a 12 bits ADC.
{
// 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 for DE %d . Setting to %x. Digit is:",
- digit->DetElemId(),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;
}
// (((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
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::WriteTrackerDDL");
+ AliCodeTimerAuto("")
+ if (fHeader == 0x0) {
+ AliError("Raw data header must be set");
+ return;
+ }
memset(fBuffer,0,fBufferSize*sizeof(Int_t));
AliMpDDL* ddl = fDDLStore->GetDDL(iDDL);
// writting onto disk
// total length in bytes
// DDL header
- Int_t headerSize = sizeof(fHeader)/4;
+
+ Int_t headerSize = sizeof(AliRawDataHeader)/4;
- fHeader.fSize = (totalDDLLength + headerSize) * 4;
+ fHeader->fSize = (totalDDLLength + headerSize) * 4;
AliFstream* file = new AliFstream(AliDAQ::DdlFileName("MUONTRK",iDDL));
- file->WriteBuffer((char*)(&fHeader),headerSize*4);
+ file->WriteBuffer((char*)fHeader,headerSize*4);
file->WriteBuffer((char*)fBuffer,sizeof(int)*index);
delete file;
}
{
/// Write trigger DDL
- AliMUONStopwatchGroupElement timer(fTimers,"MUON","AliMUONRawWriter::WriteTriggerDDL");
+ AliCodeTimerAuto("")
+
+ if (fHeader == 0x0) {
+ AliError("Raw data header must be set");
+ return 0;
+ }
// DDL event one per half chamber
// writting onto disk
// write DDL's
- fHeader.fSize = (index + headerSize) * 4;// total length in bytes
- file[iDDL]->WriteBuffer((char*)(&fHeader),headerSize*4);
+ fHeader->fSize = (index + headerSize) * 4;// total length in bytes
+ file[iDDL]->WriteBuffer((char*)fHeader,headerSize*4);
file[iDDL]->WriteBuffer((char*)buffer,sizeof(int)*index);
}