]>
Commit | Line | Data |
---|---|---|
f899e060 | 1 | // $Id$ |
2 | //************************************************************************** | |
3 | //* This file is property of and copyright by the ALICE HLT Project * | |
4 | //* ALICE Experiment at CERN, All rights reserved. * | |
5 | //* * | |
6 | //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
7 | //* for The ALICE HLT Project. * | |
8 | //* * | |
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 | //************************************************************************** | |
17 | ||
18 | /// @file AliHLTTPCDataCompressionDecoder.cxx | |
19 | /// @author Matthias Richter | |
20 | /// @date 2011-10-04 | |
21 | /// @brief Generic decoder class for compressed TPC data, works on a container | |
22 | /// class implementation which fills the actual target data struct | |
23 | ||
24 | #include "AliHLTTPCDataCompressionDecoder.h" | |
25 | #include "AliHLTDataInflaterSimple.h" | |
26 | #include "AliHLTDataInflaterHuffman.h" | |
27 | #include "TList.h" | |
28 | #include <memory> | |
29 | ||
30 | ClassImp(AliHLTTPCDataCompressionDecoder) | |
31 | ||
32 | AliHLTTPCDataCompressionDecoder::AliHLTTPCDataCompressionDecoder() | |
5391e9f6 | 33 | : fPadShift(0.) |
34 | , fVerbosity(0) | |
35 | , fpDataInflaterPartition(NULL) | |
36 | , fpDataInflaterTrack(NULL) | |
f899e060 | 37 | { |
38 | /// constructor | |
39 | } | |
40 | ||
41 | AliHLTTPCDataCompressionDecoder::~AliHLTTPCDataCompressionDecoder() | |
42 | { | |
43 | ///destructor | |
5391e9f6 | 44 | if (fpDataInflaterPartition) delete fpDataInflaterPartition; |
45 | fpDataInflaterPartition=NULL; | |
46 | if (fpDataInflaterTrack) delete fpDataInflaterTrack; | |
47 | fpDataInflaterTrack=NULL; | |
f899e060 | 48 | } |
49 | ||
50 | AliHLTDataInflater* AliHLTTPCDataCompressionDecoder::CreateInflater(int deflater, int mode) const | |
51 | { | |
52 | // create the inflater for the specified mode | |
53 | vector<AliHLTTPCDefinitions::AliClusterParameterId_t> parameterids; | |
54 | switch (mode) { | |
55 | case 1: | |
56 | parameterids.push_back(AliHLTTPCDefinitions::kPadRow ); | |
57 | parameterids.push_back(AliHLTTPCDefinitions::kPad ); | |
58 | parameterids.push_back(AliHLTTPCDefinitions::kTime ); | |
59 | parameterids.push_back(AliHLTTPCDefinitions::kSigmaY2); | |
60 | parameterids.push_back(AliHLTTPCDefinitions::kSigmaZ2); | |
61 | parameterids.push_back(AliHLTTPCDefinitions::kCharge ); | |
62 | parameterids.push_back(AliHLTTPCDefinitions::kQMax ); | |
63 | break; | |
64 | case 2: | |
65 | parameterids.push_back(AliHLTTPCDefinitions::kResidualPad ); | |
66 | parameterids.push_back(AliHLTTPCDefinitions::kResidualTime); | |
67 | parameterids.push_back(AliHLTTPCDefinitions::kSigmaY2); | |
68 | parameterids.push_back(AliHLTTPCDefinitions::kSigmaZ2); | |
69 | parameterids.push_back(AliHLTTPCDefinitions::kCharge ); | |
70 | parameterids.push_back(AliHLTTPCDefinitions::kQMax ); | |
71 | break; | |
72 | default: | |
73 | HLTError("invalid mode %d for inflater initialization", mode); | |
74 | } | |
75 | ||
76 | switch (deflater) { | |
77 | case 1: | |
78 | { | |
79 | std::auto_ptr<AliHLTDataInflaterSimple> inflatersimple(new AliHLTDataInflaterSimple); | |
80 | if (!inflatersimple.get()) return NULL; | |
81 | for (vector<AliHLTTPCDefinitions::AliClusterParameterId_t>::const_iterator id=parameterids.begin(); | |
82 | id!=parameterids.end(); id++) { | |
83 | const AliHLTTPCDefinitions::AliClusterParameter& parameter=AliHLTTPCDefinitions::fgkClusterParameterDefinitions[*id]; | |
84 | if (inflatersimple->AddParameterDefinition(parameter.fName, | |
85 | parameter.fBitLength, | |
86 | parameter.fOptional)<0) { | |
87 | HLTError("error adding parameter definition %s to inflater", parameter.fName); | |
88 | return NULL; | |
89 | } | |
90 | } | |
91 | return inflatersimple.release(); | |
92 | } | |
93 | break; | |
94 | case 2: | |
95 | { | |
96 | std::auto_ptr<AliHLTDataInflaterHuffman> inflaterhuffman(new AliHLTDataInflaterHuffman); | |
97 | if (!inflaterhuffman.get()) return NULL; | |
98 | TString cdbPath("HLT/ConfigTPC/TPCDataCompressorHuffmanTables"); | |
99 | TObject* pConf=AliHLTMisc::Instance().ExtractObject(AliHLTMisc::Instance().LoadOCDBEntry(cdbPath)); | |
100 | if (!pConf) { | |
101 | HLTError("can not load configuration object %s", cdbPath.Data()); | |
102 | return NULL; | |
103 | } | |
104 | if (dynamic_cast<TList*>(pConf)==NULL) { | |
105 | HLTError("huffman table configuration object of inconsistent type"); | |
106 | return NULL; | |
107 | } | |
108 | inflaterhuffman->InitDecoders(dynamic_cast<TList*>(pConf)); | |
109 | for (vector<AliHLTTPCDefinitions::AliClusterParameterId_t>::const_iterator id=parameterids.begin(); | |
110 | id!=parameterids.end(); id++) { | |
111 | const AliHLTTPCDefinitions::AliClusterParameter& parameter=AliHLTTPCDefinitions::fgkClusterParameterDefinitions[*id]; | |
112 | if (inflaterhuffman->AddParameterDefinition(parameter.fName, | |
113 | parameter.fBitLength)<0) { | |
114 | HLTError("error adding parameter definition %s to inflater", parameter.fName); | |
115 | return NULL; | |
116 | } | |
117 | } | |
118 | return inflaterhuffman.release(); | |
119 | } | |
120 | break; | |
121 | default: | |
122 | HLTError("unknown inflater requested %d", deflater); | |
123 | } | |
124 | return NULL; | |
125 | } |