3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTTPCCompModelInflaterComponent.cxx
20 @author Timm Steinbeck
22 @brief A copy processing component for the HLT. */
28 #include "AliHLTTPCCompModelInflaterComponent.h"
29 #include "AliHLTTPCDefinitions.h"
33 /** ROOT macro for the implementation of ROOT specific class methods */
34 ClassImp(AliHLTTPCCompModelInflaterComponent);
36 AliHLTTPCCompModelInflaterComponent::AliHLTTPCCompModelInflaterComponent()
40 // see header file for class documentation
43 AliHLTTPCCompModelInflaterComponent::~AliHLTTPCCompModelInflaterComponent()
45 // see header file for class documentation
48 const char* AliHLTTPCCompModelInflaterComponent::GetComponentID()
50 // see header file for class documentation
51 return "TPCCompModelInflater"; // The ID of this component
54 void AliHLTTPCCompModelInflaterComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
56 // see header file for class documentation
57 list.clear(); // We do not have any requirements for our input data type(s).
58 list.push_back( AliHLTTPCDefinitions::fgkClusterTracksCompressedDataType );
59 list.push_back( AliHLTTPCDefinitions::fgkRemainingClustersCompressedDataType );
62 AliHLTComponent_DataType AliHLTTPCCompModelInflaterComponent::GetOutputDataType()
64 // see header file for class documentation
65 return AliHLTTPCDefinitions::fgkClusterTracksModelDataType;
68 void AliHLTTPCCompModelInflaterComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
70 // see header file for class documentation
71 constBase = 4+4; // Format versions
72 inputMultiplier = 20.;
73 //#warning Adapt input Multiplier to something more realistic
76 // Spawn function, return new instance of this class
77 AliHLTComponent* AliHLTTPCCompModelInflaterComponent::Spawn()
79 // see header file for class documentation
80 return new AliHLTTPCCompModelInflaterComponent;
83 int AliHLTTPCCompModelInflaterComponent::DoInit( int argc, const char** argv )
85 // see header file for class documentation
89 Logging( kHLTLogDebug, "HLT::TPCCompModelInflater::DoInit", "Arguments", "argv[0] == %s", argv[0] );
90 Logging(kHLTLogError, "HLT::TPCCompModelInflater::DoInit", "Unknown Option", "Unknown option '%s'", argv[0] );
96 int AliHLTTPCCompModelInflaterComponent::DoDeinit()
98 // see header file for class documentation
102 int AliHLTTPCCompModelInflaterComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
103 AliHLTComponent_TriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
104 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
106 // see header file for class documentation
108 // Loop over all input blocks in the event
109 AliHLTUInt8_t* writePtr = outputPtr;
110 AliHLTUInt32_t outputSize = 0, blockSize;
112 AliHLTComponent_BlockData ob;
114 for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
116 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClusterTracksCompressedDataType )
118 blockSize = size-outputSize;
119 ret = fModelInflater.DecompressTracks( (AliHLTUInt8_t*)blocks[n].fPtr, blocks[n].fSize, writePtr, blockSize );
120 HLTDebug( "fModelInflater.DecompressTracks: ret: %d - blockSize: %u", ret, (unsigned)blockSize );
123 // Let the structure be filled with the default values.
124 // This takes care of setting the shared memory and data type values to default values,
125 // so that they can be filled in by the calling code.
127 // This block's start (offset) is after all other blocks written so far
128 ob.fOffset = outputSize;
129 // the size of this block's data.
130 ob.fSize = blockSize;
131 // The specification of the data is copied from the input block.
132 ob.fSpecification = blocks[n].fSpecification;
133 // The type of the data is copied from the input block.
134 ob.fDataType = AliHLTTPCDefinitions::fgkClusterTracksModelDataType;
135 // Place this block into the list of output blocks
136 outputBlocks.push_back( ob );
137 writePtr += blockSize;
138 outputSize += blockSize;
142 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkRemainingClustersCompressedDataType )
144 blockSize = size-outputSize;
145 ret = fModelInflater.DecompressRemainingClusters( (AliHLTUInt8_t*)blocks[n].fPtr, blocks[n].fSize, writePtr, blockSize );
146 HLTDebug( "ret: %d - blockSize: %u - blocks[%u].fSize: %u", ret, (unsigned)blockSize, (unsigned)n, (unsigned)blocks[n].fSize );
149 // Let the structure be filled with the default values.
150 // This takes care of setting the shared memory and data type values to default values,
151 // so that they can be filled in by the calling code.
153 // This block's start (offset) is after all other blocks written so far
154 ob.fOffset = outputSize;
155 // the size of this block's data.
156 ob.fSize = blockSize;
157 // The specification of the data is copied from the input block.
158 ob.fSpecification = blocks[n].fSpecification;
159 // The type of the data is copied from the input block.
160 ob.fDataType = AliHLTTPCDefinitions::fgkRemainingClustersModelDataType;
161 // Place this block into the list of output blocks
162 outputBlocks.push_back( ob );
163 writePtr += blockSize;
164 outputSize += blockSize;
170 // Finally we set the total size of output memory we consumed.