#include "AliMpDDLStore.h"
#include "AliMpDDL.h"
+#include "AliMpRegionalTrigger.h"
#include "AliMpTriggerCrate.h"
#include "AliMpLocalBoard.h"
#include "AliMpDetElement.h"
{
AliCodeTimerAuto("for Tracker")
- AliMpExMap busPatchMap(true);
+ AliMpExMap busPatchMap;
Int_t nDDLs = AliDAQ::NumberOfDdls("MUONTRK");
UChar_t channelId = 0;
UShort_t charge = 0;
Int_t busPatchId = 0;
+ Int_t currentBusPatchId = -1;
UInt_t word;
+ AliMUONBusStruct* busStruct(0x0);
+
TIter next(digitStore.CreateTrackerIterator());
AliMUONVDigit* digit;
parity ^= ((word >> i) & 0x1);
}
AliBitPacking::PackWord((UInt_t)parity,word,31,31);
-
- AliMUONBusStruct* busStruct =
- static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
+
+ if ( currentBusPatchId != busPatchId )
+ {
+ busStruct =
+ static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
+ currentBusPatchId = busPatchId;
+ }
if (!busStruct)
{
for (Int_t iDsp = 0; iDsp < iDspMax; ++iDsp)
{
// DSP header
- Int_t length = fDspHeader->GetHeaderLength();
- memcpy(&fBuffer[index],fDspHeader->GetHeader(),length*4);
+ Int_t dspHeaderLength = fDspHeader->GetHeaderLength();
+ memcpy(&fBuffer[index],fDspHeader->GetHeader(),dspHeaderLength*4);
Int_t indexDsp = index;
- index += length;
+ index += dspHeaderLength;
// 5 buspatches max per DSP
for (Int_t i = 0; i < iBusPerDSP[iDsp]; ++i)
if (busStructPtr)
{
// add bus patch structure header
- Int_t length = busStructPtr->GetHeaderLength();
- memcpy(&fBuffer[index],busStructPtr->GetHeader(),length*4);
- index += length;
+ Int_t busHeaderLength = busStructPtr->GetHeaderLength();
+ memcpy(&fBuffer[index],busStructPtr->GetHeader(),busHeaderLength*4);
+ index += busHeaderLength;
// add bus patch data
- length = busStructPtr->GetLength();
- memcpy(&fBuffer[index],busStructPtr->GetData(),length*4);
- index += length;
+ Int_t busLength = busStructPtr->GetLength();
+ memcpy(&fBuffer[index],busStructPtr->GetData(),busLength*4);
+ index += busLength;
}
else
{
kGlobalHeaderLength + kGlobalScalerLength + 2);
if(fScalerEvent) {
eventPhys = 0; //set to generate scaler events
- fHeader->fWord2 |= 0x1; // set L1SwC bit on
+ fHeader->fWord2 |= (0x1 << 14); // set L1SwC bit on
}
if(fScalerEvent)
buffer = new Int_t [kScalerBufferSize];
// 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);
AliWarning(Form("Missing crate number %d in DDL %d\n", iReg, iDDL));
// regional info tree, make sure that no reg card missing
- AliMUONRegionalTrigger* regTrg = triggerStore.FindRegional(iReg+iDDL*8);
-
+ AliMUONRegionalTrigger* regTrg = triggerStore.FindRegional(crate->GetId());
+ if (!regTrg)
+ AliError(Form("Missing regional board %d in trigger Store\n", crate->GetId()));
+
// Regional card header
word = 0;
// 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,19,24);
- AliBitPacking::PackWord((UInt_t)version,word,7,14);
- AliBitPacking::PackWord((UInt_t)iReg,word,15,18);
+ 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);
// 16 local card per regional board
// UShort_t localMask = 0x0;
- for (Int_t iLoc = 0; iLoc < 16; iLoc++) {
+ Int_t nLocalBoard = AliMpConstants::LocalBoardNofChannels();
+
+ for (Int_t iLoc = 0; iLoc < nLocalBoard; iLoc++) {
// slot zero for Regional card
Int_t localBoardId = crate->GetLocalBoardId(iLoc);