3 //**************************************************************************
4 //* This file is property of and copyright by the *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 //* for The ALICE HLT Project. *
11 //* Permission to use, copy, modify and distribute this software and its *
12 //* documentation strictly for non-commercial purposes is hereby granted *
13 //* without fee, provided that the above copyright notice appears in all *
14 //* copies and that both the copyright notice and this permission notice *
15 //* appear in the supporting documentation. The authors make no claims *
16 //* about the suitability of this software for any purpose. It is *
17 //* provided "as is" without express or implied warranty. *
18 //**************************************************************************
20 // @file AliHLTSampleComponent1.cxx
21 // @author Matthias Richter, Timm M. Steinbeck
23 // @brief A sample processing component for the HLT.
24 // Component illustrates the basic functionality and component
27 #include "AliHLTSampleComponent1.h"
29 #include "TObjString.h"
34 /** ROOT macro for the implementation of ROOT specific class methods */
35 ClassImp(AliHLTSampleComponent1)
37 AliHLTSampleComponent1::AliHLTSampleComponent1()
42 // an example component which implements the ALICE HLT processor
43 // interface and illustrates the basic interface methods
46 // NOTE: all helper classes should be instantiated in DoInit()
49 AliHLTSampleComponent1::~AliHLTSampleComponent1()
53 // NOTE: implement proper cleanup in DoDeinit()
56 const char* AliHLTSampleComponent1::GetComponentID()
58 // component property: id
59 return "Sample-component1";
62 void AliHLTSampleComponent1::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
64 // component property: list of input data types
65 list.push_back(kAliHLTAnyDataType);
68 AliHLTComponentDataType AliHLTSampleComponent1::GetOutputDataType()
70 // component property: output data type
71 return kAliHLTVoidDataType;
74 void AliHLTSampleComponent1::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
76 // component property: output size estimator
81 void AliHLTSampleComponent1::GetOCDBObjectDescription( TMap* const targetMap)
83 // Get a list of OCDB object description.
84 // The list of objects is provided in a TMap
85 // - key: complete OCDB path, e.g. GRP/GRP/Data
86 // - value: short description why the object is needed
87 // Key and value objects created inside this class go into ownership of
89 if (!targetMap) return;
90 targetMap->Add(new TObjString("HLT/ConfigSample/SampleComponent1"),
91 new TObjString("configuration object"));
94 AliHLTComponent* AliHLTSampleComponent1::Spawn()
96 // Spawn function, return new class instance
97 return new AliHLTSampleComponent1;
100 int AliHLTSampleComponent1::DoInit( int argc, const char** argv )
102 // see header file for class documentation
105 // init stage 1: default values for all data members
109 // init stage 2: read configuration object
110 // ScanConfigurationArgument() needs to be implemented
111 TString cdbPath="HLT/ConfigSample/SampleComponent1";
112 iResult=ConfigureFromCDBTObjString(cdbPath);
114 // init stage 3: read the component arguments
116 iResult=ConfigureFromArgumentString(argc, argv);
120 // implement the component initialization
122 HLTError("mandatory argument \'-mandatory1\' missing");
126 HLTError("mandatory argument \'-mandatory2\' missing");
138 int AliHLTSampleComponent1::ScanConfigurationArgument( int argc, const char** argv )
140 // see header file for class documentation
142 TString configuration="";
145 if (argument.IsNull()) return 0;
148 if (argument.CompareTo("-mandatory1")==0) {
149 if (++i>=argc) return -EPROTO;
150 HLTInfo("got \'-mandatory1\' argument: %s", argv[i]);
154 } else if (argument.CompareTo("-mandatory2")==0) {
156 HLTInfo("got \'-mandatory2\' argument");
159 } else if (argument.CompareTo("-config1")==0) {
160 if (++i>=argc) return -EPROTO;
161 HLTInfo("got \'%s\' argument: %s", argument.Data(), argv[i]);
164 } else if (argument.CompareTo("-config2")==0) {
165 HLTInfo("got \'%s\' argument", argument.Data());
168 // no recognized argument
175 int AliHLTSampleComponent1::DoDeinit()
177 // see header file for class documentation
178 HLTInfo("processing cleanup");
182 int AliHLTSampleComponent1::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
183 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
184 AliHLTUInt32_t& size, AliHLTComponentBlockDataList& outputBlocks ) {
185 // see header file for class documentation
186 HLTInfo("processing data");
187 if (evtData.fStructSize==0 && blocks==NULL && trigData.fStructSize==0 &&
188 outputPtr==0 && size==0)
190 outputBlocks.clear();
191 // this is just to get rid of the warning "unused parameter"
195 int AliHLTSampleComponent1::Reconfigure(const char* cdbEntry, const char* chainId)
197 // see header file for class documentation
199 const char* path="HLT/ConfigSample/SampleComponent1";
200 const char* defaultNotify="";
203 defaultNotify=" (default)";
206 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
207 iResult=ConfigureFromCDBTObjString(path);
212 int AliHLTSampleComponent1::ReadPreprocessorValues(const char* modules)
214 // see header file for class documentation
216 TString detectors(modules!=NULL?modules:"");
217 HLTInfo("read preprocessor values for detector(s): %s", detectors.IsNull()?"none":detectors.Data());