4 #ifndef ALIHLTBLOCKFILTERCOMPONENT_H
5 #define ALIHLTBLOCKFILTERCOMPONENT_H
6 //* This file is property of and copyright by the *
7 //* ALICE Experiment at CERN, All rights reserved. *
8 //* See cxx source for full Copyright notice *
10 /// @file AliHLTBlockFilterComponent.h
11 /// @author Matthias Richter
13 /// @brief A simple data block filter and merger, merges block descriptors
16 #include "AliHLTProcessor.h"
19 * @class AliHLTBlockFilterComponent
20 * A data block merger and filter.
21 * It merges data block descriptors fulfilling the filtering rules and
22 * forwards the descriptors to the output. The actual data is not touched.
24 * <h2>General properties:</h2>
26 * Component ID: \b BlockFilter <br>
27 * Library: \b libAliHLTUtil.so <br>
28 * Input Data Types: kAliHLTAnyDataType <br>
29 * Output Data Types: according to parameter and input blocks <br>
31 * <h2>Mandatory arguments:</h2>
32 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
34 * <h2>Optional arguments:</h2>
35 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
36 * \li -datatype <i> id origin </i> <br>
37 * e.g. <tt> -datatype 'ESD_TREE' 'TPC ' </tt> <br>
38 * \b Note: due to the 4-character data origin it might be necessary to
39 * append a blank to the detectorname, e.g. <tt>TPC -> 'TPC '</tt>
41 * \li -origin <i> origin </i> <br>
42 * e.g. -origin 'TPC ', \b Note: the filter rule has type id 'ANY'
44 * \li -typeid <i> id </i> <br>
45 * e.g. -typeid ESD_TREE, \b Note: the filter rule has origin 'ANY'
47 * \li -dataspec <i> specification </i> <br>
48 * data specification treated as decimal number or hex number if
51 * \li -prescalar <i> scalar </i> <br>
52 * a prescalar value, forwarding only if eventcount%scalar is zero
54 * \li -skip-events <i> count </i> <br>
55 * skip count events in the beginning
58 * print out some more info messages, mainly for the sake of tutorials
60 * <h2>Configuration:</h2>
61 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
62 * Configuration by component arguments.
64 * <h2>Default CDB entries:</h2>
65 * The component loads no CDB entries.
67 * <h2>Performance:</h2>
68 * The component does not process any event data.
70 * <h2>Memory consumption:</h2>
71 * The component does not process any event data.
73 * <h2>Output size:</h2>
74 * No additional data is produced. Data blocks are just forwarded.
76 * By default, all blocks will be published. By means of the \em -datatype,
77 * \em -origin, and \em -typeid arguments, the blocks can be selected. A list
78 * of filter rules can be built up by multiple usage of the arguments. Each
79 * time a new filter rule is added.
81 * No filtering by the data specification is applied unless then \em
82 * -specification argument is used. The specification applies to to the
83 * current filter rule, regardless of the sequence of -datatype/-specification
86 * @ingroup alihlt_util_components
88 class AliHLTBlockFilterComponent : public AliHLTProcessor
91 /** standard constructor */
92 AliHLTBlockFilterComponent();
94 virtual ~AliHLTBlockFilterComponent();
97 * The id of the component.
98 * @return component id (string)
100 virtual const char* GetComponentID() {return "BlockFilter";};
103 * Get the input data types of the component.
104 * @return list of data types in the vector reference
106 void GetInputDataTypes( AliHLTComponentDataTypeList& );
109 * Get the output data type of the component.
110 * If @ref kAliHLTMultipleDataType is returned, the framework invokes
111 * @ref GetOutputDataTypes.
112 * @return output data type
114 AliHLTComponentDataType GetOutputDataType();
117 * Get the output data types of the component.
118 * The function can be implemented to indicate multiple output data types
119 * in the target array.
120 * @ref GetOutputDataType must return @ref kAliHLTMultipleDataType in order
121 * to invoke this method.
122 * @param tgtList list to receive the data types
123 * @return no of output data types, data types in the target list
125 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
128 * Get a ratio by how much the data volume is shrinked or enhanced.
129 * @param constBase <i>return</i>: additive part, independent of the
131 * @param inputMultiplier <i>return</i>: multiplication ratio
132 * @return values in the reference variables
134 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
138 * @return new class instance
140 virtual AliHLTComponent* Spawn() {return new AliHLTBlockFilterComponent;}
145 * Data processing method for the component.
146 * Filters the incoming data descriptors according to the rules and forwards
147 * them into the output.
148 * @return neg. error code if failed
150 int DoEvent( const AliHLTComponentEventData& evtData,
151 const AliHLTComponentBlockData* blocks,
152 AliHLTComponentTriggerData& trigData,
153 AliHLTUInt8_t* outputPtr,
154 AliHLTUInt32_t& size,
155 AliHLTComponentBlockDataList& outputBlocks );
157 using AliHLTProcessor::DoEvent;
160 * Component initialisation and argument scan.
162 int DoInit( int argc, const char** argv );
170 /** copy constructor prohibited */
171 AliHLTBlockFilterComponent(const AliHLTBlockFilterComponent&);
172 /** assignment operator prohibited */
173 AliHLTBlockFilterComponent& operator=(const AliHLTBlockFilterComponent&);
176 * Check if the data block is selected by the filter rules.
177 * @return 1 if selected
179 int IsSelected(const AliHLTComponentBlockData& block);
181 /** filtering rules, only the data type and specification members are use */
182 AliHLTComponentBlockDataList fFilterRules; //! transient
183 AliHLTUInt32_t fPrescalar; //! transient
184 AliHLTUInt32_t fFirstEvent; //! transient
186 ClassDef(AliHLTBlockFilterComponent, 0)