2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 //* for The ALICE HLT Project. *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /// @file AliHLTTPCDataCompressionDecoder.cxx
19 /// @author Matthias Richter
21 /// @brief Generic decoder class for compressed TPC data, works on a container
22 /// class implementation which fills the actual target data struct
24 #include "AliHLTTPCDataCompressionDecoder.h"
25 #include "AliHLTDataInflaterSimple.h"
26 #include "AliHLTDataInflaterHuffman.h"
30 ClassImp(AliHLTTPCDataCompressionDecoder)
32 AliHLTTPCDataCompressionDecoder::AliHLTTPCDataCompressionDecoder()
38 AliHLTTPCDataCompressionDecoder::~AliHLTTPCDataCompressionDecoder()
43 AliHLTDataInflater* AliHLTTPCDataCompressionDecoder::CreateInflater(int deflater, int mode) const
45 // create the inflater for the specified mode
46 vector<AliHLTTPCDefinitions::AliClusterParameterId_t> parameterids;
49 parameterids.push_back(AliHLTTPCDefinitions::kPadRow );
50 parameterids.push_back(AliHLTTPCDefinitions::kPad );
51 parameterids.push_back(AliHLTTPCDefinitions::kTime );
52 parameterids.push_back(AliHLTTPCDefinitions::kSigmaY2);
53 parameterids.push_back(AliHLTTPCDefinitions::kSigmaZ2);
54 parameterids.push_back(AliHLTTPCDefinitions::kCharge );
55 parameterids.push_back(AliHLTTPCDefinitions::kQMax );
58 parameterids.push_back(AliHLTTPCDefinitions::kResidualPad );
59 parameterids.push_back(AliHLTTPCDefinitions::kResidualTime);
60 parameterids.push_back(AliHLTTPCDefinitions::kSigmaY2);
61 parameterids.push_back(AliHLTTPCDefinitions::kSigmaZ2);
62 parameterids.push_back(AliHLTTPCDefinitions::kCharge );
63 parameterids.push_back(AliHLTTPCDefinitions::kQMax );
66 HLTError("invalid mode %d for inflater initialization", mode);
72 std::auto_ptr<AliHLTDataInflaterSimple> inflatersimple(new AliHLTDataInflaterSimple);
73 if (!inflatersimple.get()) return NULL;
74 for (vector<AliHLTTPCDefinitions::AliClusterParameterId_t>::const_iterator id=parameterids.begin();
75 id!=parameterids.end(); id++) {
76 const AliHLTTPCDefinitions::AliClusterParameter& parameter=AliHLTTPCDefinitions::fgkClusterParameterDefinitions[*id];
77 if (inflatersimple->AddParameterDefinition(parameter.fName,
79 parameter.fOptional)<0) {
80 HLTError("error adding parameter definition %s to inflater", parameter.fName);
84 return inflatersimple.release();
89 std::auto_ptr<AliHLTDataInflaterHuffman> inflaterhuffman(new AliHLTDataInflaterHuffman);
90 if (!inflaterhuffman.get()) return NULL;
91 TString cdbPath("HLT/ConfigTPC/TPCDataCompressorHuffmanTables");
92 TObject* pConf=AliHLTMisc::Instance().ExtractObject(AliHLTMisc::Instance().LoadOCDBEntry(cdbPath));
94 HLTError("can not load configuration object %s", cdbPath.Data());
97 if (dynamic_cast<TList*>(pConf)==NULL) {
98 HLTError("huffman table configuration object of inconsistent type");
101 inflaterhuffman->InitDecoders(dynamic_cast<TList*>(pConf));
102 for (vector<AliHLTTPCDefinitions::AliClusterParameterId_t>::const_iterator id=parameterids.begin();
103 id!=parameterids.end(); id++) {
104 const AliHLTTPCDefinitions::AliClusterParameter& parameter=AliHLTTPCDefinitions::fgkClusterParameterDefinitions[*id];
105 if (inflaterhuffman->AddParameterDefinition(parameter.fName,
106 parameter.fBitLength)<0) {
107 HLTError("error adding parameter definition %s to inflater", parameter.fName);
111 return inflaterhuffman.release();
115 HLTError("unknown inflater requested %d", deflater);