+
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
namespace
{
- const Int_t kPayLoadSize = 944;
- const Int_t kPayLoadSizeWithRawData = 1772;
+ const Int_t kPayLoadSizeOld = 236;
+ const Int_t kPayLoadSizeNew = 245;
}
ClassImp(AliEMCALTriggerSTURawStream)
fNL0GammaPatch(0),
fNL1JetPatch(0),
fNL1GammaPatch(0),
-fGetRawData(0)
+fGetRawData(0),
+fV0A(0),
+fV0C(0),
+fGA(0),
+fGB(0),
+fGC(0),
+fJA(0),
+fJB(0),
+fJC(0),
+fRegionEnable(0),
+fFrameReceived(0),
+fFwVersion(0)
{
//
}
fNL0GammaPatch(0),
fNL1JetPatch(0),
fNL1GammaPatch(0),
-fGetRawData(0)
+fGetRawData(0),
+fV0A(0),
+fV0C(0),
+fGA(0),
+fGB(0),
+fGC(0),
+fJA(0),
+fJB(0),
+fJC(0),
+fRegionEnable(0),
+fFrameReceived(0),
+fFwVersion(0)
{
//
fRawReader->Reset();
//_____________________________________________________________________________
void AliEMCALTriggerSTURawStream::Reset()
{
- //
+ // Reset
+
if (fRawReader) fRawReader->Reset();
fNL0GammaPatch = 0;
Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
{
// STU data decoder from Olivier Bourrion LPSC CNRS-IN2P3
- // bourrion@lpsc.in2p3.fr
+ // bourrion_at_lpsc_dot_in2p3_dot_fr
- UInt_t word32[1772]; // 32b words
- for (Int_t i=0;i<1772;i++) word32[i] = 0;
+ UInt_t word32[kPayLoadSizeNew + 1536]; // 32b words
+ for (Int_t i = 0;i < kPayLoadSizeNew + 1536; i++) word32[i] = 0;
Int_t iword = 0;
Int_t eqId = -1, eqSize = 0;
UInt_t w32;
+
while (fRawReader->ReadNextInt(w32))
{
if (!iword)
word32[iword++] = w32;
}
-
- if (iword != kPayLoadSize && iword != kPayLoadSizeWithRawData)
+
+ if (iword != kPayLoadSizeOld && iword != kPayLoadSizeNew && iword != (kPayLoadSizeOld + 1536) && iword != (kPayLoadSizeNew + 1536))
{
- AliError(Form("ERROR: STU payload (eqId: %d, eqSize: %d) doesn't match expected size! %d word32",
+ AliError(Form("STU payload (eqId: %d, eqSize: %d) doesn't match expected size! %d word32",
eqId, eqSize, iword));
return kFALSE;
}
- else if (AliDebugLevel())
+
+ if (AliDebugLevel())
{
AliInfo(Form("STU (eqId: %d, eqSize: %d) payload size: %d word32",
eqId, eqSize, iword));
}
- fL1JetThreshold = ((word32[0]>>16) & 0xFFF);
- fL1GammaThreshold = (word32[0] & 0xFFF);
+ int offset = 0, jetSize = 2;
- for (Int_t jet_row=0; jet_row<11; jet_row++)
+ switch (iword)
{
- UInt_t currentrow = word32[1+jet_row];
+ case kPayLoadSizeOld:
+ case kPayLoadSizeOld + 1536:
+ {
+ fL1JetThreshold = ((word32[0]>>16) & 0xFFFF);
+ fL1GammaThreshold = (word32[0] & 0xFFFF);
+
+ break;
+ }
+ case kPayLoadSizeNew:
+ case kPayLoadSizeNew + 1536:
+ {
+ fV0A = ((word32[0]>>16) & 0xFFFF);
+ fV0C = (word32[0] & 0xFFFF);
+
+ fGA = word32[1];
+ fGB = word32[2];
+ fGC = word32[3];
+ fJA = word32[4];
+ fJB = word32[5];
+ fJC = word32[6];
+ fRegionEnable = word32[7];
+ fFrameReceived = word32[8];
+ fFwVersion = word32[9];
+
+ jetSize += (fFwVersion >> 16);
+
+ fL1JetThreshold = GetThreshold(fJA, fJB, fJC, fV0A, fV0C);
+ fL1GammaThreshold = GetThreshold(fGA, fGB, fGC, fV0A, fV0C);
+
+ offset = 9;
+
+ break;
+ }
+ }
+
+ ///////////
+ // START DECODING
+ //////////
+
+ for (Int_t jet_row = 0; jet_row < 12 - (jetSize - 1); jet_row++)
+ {
+ UInt_t currentrow = word32[offset + 1 + jet_row];
- for (Int_t jet_col=0; jet_col<15; jet_col++)
+ for (Int_t jet_col = 0; jet_col < 15; jet_col++)
{
if (currentrow & (1 << jet_col))
{
}
}
}
+
//////////////////////////////////////////////////////////
// index des L0 //
//////////////////////////////////////////////////////////
- // FIXME: still not interpreted to be done with Jiri
+ // FIXME: sounds like not valid data
- unsigned short TRU_L0_indexes[32][6];
+ unsigned short truL0indexes[32][6];
// extraction from stream
for (Int_t index=0;index<6;index++)
{
for (Int_t tru_num=0;tru_num<16;tru_num++)
{
- TRU_L0_indexes[2*tru_num ][index] = ( word32[12+index*16+tru_num] & 0xFFFF);
- TRU_L0_indexes[2*tru_num+1][index] = ((word32[12+index*16+tru_num]>>16) & 0xFFFF);
+ truL0indexes[2*tru_num ][index] = ( word32[offset + 12 + index * 16 + tru_num] & 0xFFFF);
+ truL0indexes[2*tru_num+1][index] = ((word32[offset + 12 + index * 16 + tru_num] >> 16) & 0xFFFF);
}
}
{
for (Int_t bit_num=0;bit_num<12;bit_num++)
{
- if ((TRU_L0_indexes[tru_num][index] & (1 << bit_num)))
+ if ((truL0indexes[tru_num][index] & (1 << bit_num)))
{
Int_t idx = 12 * index + bit_num;
// index des L1 gamma //
//////////////////////////////////////////////////////////
- unsigned short TRU_L1_indexes[32][8];
+ unsigned short truL1indexes[32][8];
// extraction from stream
for (Int_t index=0;index<8;index++)
{
for (Int_t tru_num=0;tru_num<16;tru_num++)
{
- TRU_L1_indexes[2*tru_num ][index] = ( word32[108+index*16+tru_num] & 0xFFFF);
- TRU_L1_indexes[2*tru_num+1][index] = ((word32[108+index*16+tru_num]>>16) & 0xFFFF);
+ truL1indexes[2*tru_num ][index] = ( word32[offset + 108 + index * 16 + tru_num] & 0xFFFF);
+ truL1indexes[2*tru_num+1][index] = ((word32[offset + 108 + index * 16 + tru_num] >> 16) & 0xFFFF);
}
}
{
for (Int_t bit_num=0; bit_num<12; bit_num++)
{
- if ((TRU_L1_indexes[tru_num][index] & (1<<bit_num)) != 0)
+ if ((truL1indexes[tru_num][index] & (1<<bit_num)) != 0)
{
if (index<4) // Even
{
// raw output //
//////////////////////////////////////////////////////////
- if ( iword <= kPayLoadSize )
+ if (iword == kPayLoadSizeOld || iword == kPayLoadSizeNew)
{
fGetRawData = 0;
return kTRUE;
{
for (Int_t tru_num=0;tru_num<16;tru_num++)
{
- fADC[2*tru_num ][index] = ( word32[236+index*16+tru_num] & 0xFFFF);
- fADC[2*tru_num+1][index] = ((word32[236+index*16+tru_num]>>16) & 0xFFFF);
+ fADC[2*tru_num ][index] = ( word32[offset + 236 + index * 16 + tru_num] & 0xFFFF);
+ fADC[2*tru_num+1][index] = ((word32[offset + 236 + index * 16 + tru_num] >> 16) & 0xFFFF);
}
}
//_____________________________________________________________________________
Bool_t AliEMCALTriggerSTURawStream::GetL0GammaPatch(const Int_t i, Int_t& tru, Int_t& idx) const
{
- //
+ // L0 gamma patches sent to STU (original access to L0 patch indexes)
+
if (i > fNL0GammaPatch) return kFALSE;
tru = fL0GammaPatchIndex[i] & 0x1F;
//_____________________________________________________________________________
Bool_t AliEMCALTriggerSTURawStream::GetL1GammaPatch(const Int_t i, Int_t& tru, Int_t& col, Int_t& row) const
{
- //
+ // L1 gamma patch indexes
+
if (i > fNL1GammaPatch) return kFALSE;
tru = fL1GammaPatchIndex[i] & 0x1F;
//_____________________________________________________________________________
Bool_t AliEMCALTriggerSTURawStream::GetL1JetPatch(const Int_t i, Int_t& col, Int_t& row) const
{
- //
+ // L1 jet patch indexes
+
if (i > fNL1JetPatch) return kFALSE;
col = fL1JetPatchIndex[i] & 0xFF;
//_____________________________________________________________________________
void AliEMCALTriggerSTURawStream::GetADC(Int_t iTRU, UInt_t ADC[])
{
- //
+ // Time sums
+
for (Int_t i=0; i<96; i++) ADC[i] = fADC[iTRU][i];
}
//_____________________________________________________________________________
void AliEMCALTriggerSTURawStream::DumpPayLoad(const Option_t *option) const
{
- //
+ // Dump STU payload
+
TString op = option;
- cout << "Jet Threshold: " << fL1JetThreshold << " Gamma threshold: " << fL1GammaThreshold << endl;
- cout << "Number of L0: " << fNL0GammaPatch << endl;
- cout << "Number of L1-g: " << fNL1GammaPatch << endl;
- cout << "Number of L1-j: " << fNL1JetPatch << endl;
+ printf("V0A: %d\n", fV0A);
+ printf("V0C: %d\n", fV0C);
+ printf("G_A: %d\n", fGA);
+ printf("G_B: %d\n", fGB);
+ printf("G_C: %d\n", fGC);
+ printf("Gamma threshold: %d\n", fL1GammaThreshold);
+ printf("J_A: %d\n", fJA);
+ printf("J_B: %d\n", fJB);
+ printf("J_C: %d\n", fJC);
+ printf("Jet Threshold: %d\n", fL1JetThreshold);
+ printf("RawData: %d\n", fGetRawData);
+ printf("RegionEnable: %8x\n", fRegionEnable);
+ printf("FrameReceived: %8x\n", fFrameReceived);
+ printf("FwVersion: %x\n", fFwVersion);
+ printf("Number of L0: %d\n", fNL0GammaPatch);
+ printf("Number of L1-g: %d\n", fNL1GammaPatch);
+ printf("Number of L1-j: %d\n", fNL1JetPatch);
Int_t itru, col, row;
}
}
- cout << "> RawData: " << fGetRawData << endl;
+
if ( (op.Contains("ADC") || op.Contains("ALL")) && fGetRawData )
{
}
}
}
+
+//_____________________________________________________________________________
+UShort_t AliEMCALTriggerSTURawStream::GetThreshold(Short_t A, Short_t B, Short_t C, UShort_t V0A, UShort_t V0C) const
+{
+ // Get threshold
+ ULong64_t v0sum = V0A + V0C;
+
+ ULong64_t sqrV0 = v0sum * v0sum;
+
+ sqrV0 *= A;
+
+ sqrV0 >>= 32;
+
+ v0sum *= B;
+
+ v0sum >>= 16;
+
+ return (UShort_t)(sqrV0 + v0sum + C);
+}