From 8bdb460bbf3a316ad9c4e16812366a0ce79063f1 Mon Sep 17 00:00:00 2001 From: richterm Date: Wed, 27 Apr 2011 18:39:14 +0000 Subject: [PATCH] extracting DDL id from HLT origin and specification for RawReader initialization, some bugfixes --- HLT/comp/AliHLTCOMPHuffmanAltro.cxx | 13 +++-- HLT/comp/AliHLTCOMPHuffmanAltro.h | 3 +- HLT/comp/AliHLTCOMPHuffmanAltroComponent.cxx | 50 +++++++++++--------- HLT/comp/AliHLTCOMPHuffmanAltroComponent.h | 10 ++-- HLT/comp/macros/run-AliHLTCOMPHuffmanAltro.C | 4 +- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/HLT/comp/AliHLTCOMPHuffmanAltro.cxx b/HLT/comp/AliHLTCOMPHuffmanAltro.cxx index 8812040379e..e47cd402c6a 100644 --- a/HLT/comp/AliHLTCOMPHuffmanAltro.cxx +++ b/HLT/comp/AliHLTCOMPHuffmanAltro.cxx @@ -52,7 +52,7 @@ namespace ClassImp(AliHLTCOMPHuffmanAltro) AliHLTCOMPHuffmanAltro::AliHLTCOMPHuffmanAltro() - : AliHLTLogging() + : TObject(), AliHLTLogging() , fpRawReader(NULL) , fpAltroRawStream(NULL) , fTrainingMode(0) @@ -71,7 +71,7 @@ AliHLTCOMPHuffmanAltro::AliHLTCOMPHuffmanAltro() } AliHLTCOMPHuffmanAltro::AliHLTCOMPHuffmanAltro(Bool_t compressionswitch, Bool_t trainingmode, AliHLTCOMPHuffmanCodeData::AliHLTCOMPHuffmanCodeStruct* translationtable, Int_t nrcutrailerwords) - : AliHLTLogging() + : TObject(), AliHLTLogging() , fpRawReader(NULL) , fpAltroRawStream(NULL) , fTrainingMode(trainingmode) @@ -276,12 +276,10 @@ void AliHLTCOMPHuffmanAltro::ProcessData() } } -/** GetEntropy returns entropy and prints it to screen */ Double_t AliHLTCOMPHuffmanAltro::GetEntropy() { - // see header file for class documentation // Information about calculated entropy - HLTInfo("Calculated entropy = %f",fEntropy); + if (fVerbosity>0) HLTInfo("Calculated entropy = %f",fEntropy); return fEntropy; } @@ -1153,6 +1151,7 @@ Int_t AliHLTCOMPHuffmanAltro::CreateCodeTable() HLTWarning("Warning! Only %i different 10 bit words out of %i are used, i.e. created Huffman Code table might not be optimal to encode other data", TIMEBINS-zeroentries, TIMEBINS); } + // FIXME use auto_ptr, use size of HuffmanArraySorted instead of TIMEBINS // initialise leaves of the tree as list (= queue) ofAliHLTCOMPHuffmanData::AliHLTCOMPHuffmanTreeDataStruct, AliHLTCOMPHuffmanData::AliHLTCOMPHuffmanTreeDataStruct * HuffmanTreeList = new AliHLTCOMPHuffmanData::AliHLTCOMPHuffmanTreeDataStruct[filled]; @@ -1910,4 +1909,8 @@ void AliHLTCOMPHuffmanAltro::Print(Option_t* option) const return; } + if (strcmp(option, "entropy")==0) { + cout << "Calculated entropy = " << fEntropy << endl; + return; + } } diff --git a/HLT/comp/AliHLTCOMPHuffmanAltro.h b/HLT/comp/AliHLTCOMPHuffmanAltro.h index 8191512865b..cf48f4f25c8 100644 --- a/HLT/comp/AliHLTCOMPHuffmanAltro.h +++ b/HLT/comp/AliHLTCOMPHuffmanAltro.h @@ -24,6 +24,7 @@ @brief The Huffman compressor */ +#include "TObject.h" #include "AliHLTLogging.h" #include "AliHLTCOMPHuffmanData.h" @@ -35,7 +36,7 @@ class AliAltroRawStreamV3; @date 20-11-2007 @brief The Huffman Compressor with functions training (for Calibration), compress and decompress, calculate entropy */ -class AliHLTCOMPHuffmanAltro : public AliHLTLogging +class AliHLTCOMPHuffmanAltro : public TObject, public AliHLTLogging { public: diff --git a/HLT/comp/AliHLTCOMPHuffmanAltroComponent.cxx b/HLT/comp/AliHLTCOMPHuffmanAltroComponent.cxx index 18650221d3a..6475f162a06 100644 --- a/HLT/comp/AliHLTCOMPHuffmanAltroComponent.cxx +++ b/HLT/comp/AliHLTCOMPHuffmanAltroComponent.cxx @@ -1,25 +1,25 @@ // $Id$ -/************************************************************************** - * This file is property of and copyright by the ALICE HLT Project * - * All rights reserved. * - * * - * Primary Author: Jenny Wagner (jwagner@cern.ch) * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/** @file AliHLTCOMPHuffmanAltroComponent.cxx - @author Jenny Wagner - @date 29-08-2007 - @brief The Huffman compressor component. -*/ +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* All rights reserved. * +//* * +//* Primary Author: Jenny Wagner * +//* * +//* Permission to use, copy, modify and distribute this software and its * +//* documentation strictly for non-commercial purposes is hereby granted * +//* without fee, provided that the above copyright notice appears in all * +//* copies and that both the copyright notice and this permission notice * +//* appear in the supporting documentation. The authors make no claims * +//* about the suitability of this software for any purpose. It is * +//* provided "as is" without express or implied warranty. * +//************************************************************************** + +/// @file AliHLTCOMPHuffmanAltroComponent.cxx +/// @author Jenny Wagner, maintained by Matthias.Richter@cern.ch +/// @date 29-08-2007 +/// @brief The Huffman compressor component. +/// #if __GNUC__>= 3 using namespace std; @@ -30,6 +30,7 @@ using namespace std; #include "AliHLTCOMPHuffmanData.h" #include "AliHLTCompDefinitions.h" #include "AliHLTStdIncludes.h" +#include "AliHLTDAQ.h" #include "TFile.h" ClassImp(AliHLTCOMPHuffmanAltroComponent) @@ -377,8 +378,13 @@ int AliHLTCOMPHuffmanAltroComponent::DoEvent( const AliHLTComponentEventData& ev // HLTDebug("HLT::HuffmanCompressor::DoEvent", "Event received", "Starting to process data"); - // FIXME: set ddl no - fHuffmanCompressor->AddInputData(reinterpret_cast(iter->fPtr), iter->fSize, 768); + int ddlid=AliHLTDAQ::DdlIDFromHLTBlockData(iter->fDataType.fOrigin, iter->fSpecification); + if (ddlid<0) { + HLTError("unable to extract DDL Id for data block %s 0x%08x", DataType2Text(iter->fDataType).c_str(), iter->fSpecification); + continue; + } + + fHuffmanCompressor->AddInputData(reinterpret_cast(iter->fPtr), iter->fSize, ddlid); // validation test // HLTDebug("input data pointer (HEX) = %x ", iter->fPtr); diff --git a/HLT/comp/AliHLTCOMPHuffmanAltroComponent.h b/HLT/comp/AliHLTCOMPHuffmanAltroComponent.h index 9a0968bcfda..c8f545ad6cd 100644 --- a/HLT/comp/AliHLTCOMPHuffmanAltroComponent.h +++ b/HLT/comp/AliHLTCOMPHuffmanAltroComponent.h @@ -7,11 +7,11 @@ //* ALICE Experiment at CERN, All rights reserved. * //* See cxx source for full Copyright notice * -/** @file AliHLTCOMPHuffmanAltroComponent.h - @author Jenny Wagner - @date 20-11-2007 - @brief The Huffman compressor component. -*/ +/// @file AliHLTCOMPHuffmanAltroComponent.h +/// @author Jenny Wagner, maintained by Matthias.Richter@cern.ch +/// @date 20-11-2007 +/// @brief The Huffman compressor component. +/// #include "AliHLTProcessor.h" diff --git a/HLT/comp/macros/run-AliHLTCOMPHuffmanAltro.C b/HLT/comp/macros/run-AliHLTCOMPHuffmanAltro.C index ae83fb749a9..bbdd817e68e 100644 --- a/HLT/comp/macros/run-AliHLTCOMPHuffmanAltro.C +++ b/HLT/comp/macros/run-AliHLTCOMPHuffmanAltro.C @@ -24,7 +24,7 @@ void run_AliHLTCOMPHuffmanAltro(const char* input, int iMinEquipmentId=768, int return; } pRawReader->RewindEvents(); - pRawReader->SelectEquipment(0, iMinEquipmentId, iMaxEquipmentId); + pRawReader->SelectEquipment(-1, iMinEquipmentId, iMaxEquipmentId); gSystem->Load("libAliHLTComp.so"); AliHLTCOMPHuffmanAltro encoder(kTRUE, kTRUE, NULL, 0); @@ -46,7 +46,7 @@ void run_AliHLTCOMPHuffmanAltro(const char* input, int iMinEquipmentId=768, int cout << " DDL: " << ddlid << " size " << size << endl; encoder.AddInputData((UChar_t*)buffer.GetArray(), size, ddlid); encoder.ProcessData(); - //encoder.CreateCodeTable(); + encoder.CreateCodeTable(); } event++; } -- 2.43.0