X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALTriggerSTURawStream.cxx;h=b91407b962b28baf640a71ec4a0029090f4a9694;hb=5b1c9a0a21bf3ca50a1dd3896466ae7e094b9610;hp=e08cfcd845a8defe28529c8ec7782713306d85f4;hpb=c58cfdffb67e5feaacd779edcef1731505b02202;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALTriggerSTURawStream.cxx b/EMCAL/AliEMCALTriggerSTURawStream.cxx index e08cfcd845a..b91407b962b 100644 --- a/EMCAL/AliEMCALTriggerSTURawStream.cxx +++ b/EMCAL/AliEMCALTriggerSTURawStream.cxx @@ -32,7 +32,8 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3 namespace { - const Int_t kPayLoadSize = 944; + const Int_t kPayLoadSize = 944; + const Int_t kPayLoadSizeWithRawData = 1772; } ClassImp(AliEMCALTriggerSTURawStream) @@ -42,13 +43,13 @@ AliEMCALTriggerSTURawStream::AliEMCALTriggerSTURawStream() : TObject(), fRawReader(0x0), fL1JetThreshold(0), fL1GammaThreshold(0), -fL0GammaPatchIndex(0x0), -fL1GammaPatchIndex(0x0), -fL1JetPatchIndex(0x0), +fL0GammaPatchIndex(), +fL1GammaPatchIndex(), +fL1JetPatchIndex(), fNL0GammaPatch(0), fNL1JetPatch(0), fNL1GammaPatch(0), -fL0(0) +fGetRawData(0) { // } @@ -58,13 +59,13 @@ AliEMCALTriggerSTURawStream::AliEMCALTriggerSTURawStream(AliRawReader* rawReader fRawReader(rawReader), fL1JetThreshold(0), fL1GammaThreshold(0), -fL0GammaPatchIndex(0x0), -fL1GammaPatchIndex(0x0), -fL1JetPatchIndex(0x0), +fL0GammaPatchIndex(), +fL1GammaPatchIndex(), +fL1JetPatchIndex(), fNL0GammaPatch(0), fNL1JetPatch(0), fNL1GammaPatch(0), -fL0(0) +fGetRawData(0) { // fRawReader->Reset(); @@ -82,6 +83,10 @@ void AliEMCALTriggerSTURawStream::Reset() { // if (fRawReader) fRawReader->Reset(); + + fNL0GammaPatch = 0; + fNL1GammaPatch = 0; + fNL1JetPatch = 0; } //_____________________________________________________________________________ @@ -91,23 +96,39 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() // bourrion@lpsc.in2p3.fr UInt_t word32[1772]; // 32b words - + for (Int_t i=0;i<1772;i++) word32[i] = 0; + Int_t iword = 0; + fNL0GammaPatch = 0; + fNL1GammaPatch = 0; + fNL1JetPatch = 0; + + Int_t eqId = -1, eqSize = 0; + UInt_t w32; - while (fRawReader->ReadNextInt(w32)) word32[iword++] = w32; + while (fRawReader->ReadNextInt(w32)) + { + if (!iword) + { + eqId = fRawReader->GetEquipmentId(); + eqSize = fRawReader->GetEquipmentSize(); + } + + word32[iword++] = w32; + } - if (iword < kPayLoadSize) + if (iword != kPayLoadSize && iword != kPayLoadSizeWithRawData) { - AliError(Form("STU raw data size is too small: %d word32 only!", iword)); + AliError(Form("ERROR: STU payload (eqId: %d, eqSize: %d) doesn't match expected size! %d word32", + eqId, eqSize, iword)); return kFALSE; - } - else if (iword > kPayLoadSize ) + } + else if (AliDebugLevel()) { - AliLog::Message(AliLog::kInfo, "TRU raw data in the STU payload enabled","EMCAL","AliEMCALTriggerSTURawStream","ReadPayLoad()","AliEMCALTriggerSTURawStream.cxx",104); + AliInfo(Form("STU (eqId: %d, eqSize: %d) payload size: %d word32", + eqId, eqSize, iword)); } - - fL0 = 0; fL1JetThreshold = ((word32[0]>>16) & 0xFFF); fL1GammaThreshold = (word32[0] & 0xFFF); @@ -121,8 +142,6 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() if (currentrow & (1 << jet_col)) { fNL1JetPatch++; - fL1JetPatchIndex = (UShort_t*)realloc(fL1JetPatchIndex, fNL1JetPatch * sizeof(UShort_t)); - if (fL1JetPatchIndex == NULL) {AliError("Error (re)allocating L1 jet patch memory");} fL1JetPatchIndex[fNL1JetPatch-1] = ((jet_row << 8) & 0xFF00) | (jet_col & 0xFF); } @@ -154,19 +173,11 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() { if ((TRU_L0_indexes[tru_num][index] & (1 << bit_num))) { - fL0 = 1; - Int_t idx = 12 * index + bit_num; - - Int_t col = idx / 3; - Int_t row = idx % 3; - + fNL0GammaPatch++; - fL0GammaPatchIndex = (UShort_t*)realloc(fL0GammaPatchIndex, fNL0GammaPatch * sizeof(UShort_t)); - if (fL0GammaPatchIndex == NULL) {AliError("Error (re)allocating L0 gamma patch memory");} - - fL0GammaPatchIndex[fNL0GammaPatch-1] = (((row << 10) & 0xC00) | ((col << 5) & 0x3E0) | (tru_num & 0x1F)); + fL0GammaPatchIndex[fNL0GammaPatch-1] = (((idx << 5) & 0x7E0) | (tru_num & 0x1F)); } } } @@ -212,9 +223,6 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() } fNL1GammaPatch++; - fL1GammaPatchIndex = (UShort_t*)realloc(fL1GammaPatchIndex, fNL1GammaPatch * sizeof(UShort_t)); - - if (fL1GammaPatchIndex == NULL) {AliError("Error (re)allocating L1 gamma patch memory");} fL1GammaPatchIndex[fNL1GammaPatch-1] = (((indexcopy << 10) & 0xC00) | ((gammacolnum << 5) & 0x3E0) | (tru_num & 0x1F)); } @@ -226,7 +234,13 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() // raw output // ////////////////////////////////////////////////////////// - if ( iword <= kPayLoadSize ) return kFALSE; + if ( iword <= kPayLoadSize ) + { + fGetRawData = 0; + return kTRUE; + } + + fGetRawData = 1; // extraction from stream for (Int_t index=0;index<96;index++) @@ -240,24 +254,23 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad() for (Int_t tru_num=16;tru_num<32;tru_num++) // A side { - for (Int_t index=0;index<96;index++) - { - fADC[tru_num][index] = fADC[tru_num][95-index]; - } + Int_t v[96]; + for (Int_t index=0;index<96;index++) v[index] = fADC[tru_num][95-index]; + + for (Int_t index=0;index<96;index++) fADC[tru_num][index] = v[index]; } - return kFALSE; + return kTRUE; } //_____________________________________________________________________________ -Bool_t AliEMCALTriggerSTURawStream::GetL0GammaPatch(const Int_t i, Int_t& tru, Int_t& col, Int_t& row) const +Bool_t AliEMCALTriggerSTURawStream::GetL0GammaPatch(const Int_t i, Int_t& tru, Int_t& idx) const { // if (i > fNL0GammaPatch) return kFALSE; tru = fL0GammaPatchIndex[i] & 0x1F; - col = (fL0GammaPatchIndex[i] & 0x3E0) >> 5; - row = (fL0GammaPatchIndex[i] & 0xC00) >> 10; + idx = (fL0GammaPatchIndex[i] & 0x7E0) >> 5; return kTRUE; } @@ -295,24 +308,25 @@ void AliEMCALTriggerSTURawStream::GetADC(Int_t iTRU, UInt_t ADC[]) } //_____________________________________________________________________________ -void AliEMCALTriggerSTURawStream::Dump(const Option_t *option) const +void AliEMCALTriggerSTURawStream::DumpPayLoad(const Option_t *option) const { // 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; Int_t itru, col, row; - - Bool_t isOK; if (op.Contains("L0") || op.Contains("ALL")) { for (Int_t i=0;i Found L0 gamma in TRU #" << setw(2) << itru - << " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl; + + if (GetL0GammaPatch(i,itru,col)) + cout << "> Found L0 gamma in TRU #" << setw(2) << itru << " at idx: " << setw(2) << col << endl; } } @@ -320,19 +334,19 @@ void AliEMCALTriggerSTURawStream::Dump(const Option_t *option) const { for (Int_t i=0;i Found L1 gamma in TRU #" << setw(2) << itru - << " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl; + if (GetL1GammaPatch(i,itru,col,row)) + cout << "> Found L1 gamma in TRU #" << setw(2) << itru << " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl; } for (Int_t i=0;i Found L1 jet at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl; + if (GetL1JetPatch(i,col,row)) cout << "> Found L1 jet at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl; } } - if (op.Contains("ADC") || op.Contains("ALL")) + cout << "> RawData: " << fGetRawData << endl; + + if ( (op.Contains("ADC") || op.Contains("ALL")) && fGetRawData ) { for (Int_t i=0;i<32;i++) {