]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataSource.cxx
HLTcalo module
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataSource.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the                          * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8 //*                  for The ALICE HLT Project.                            *
9 //*                                                                        *
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 //**************************************************************************
18
19 /// @file   AliHLTDataSource.cxx
20 /// @author Matthias Richter
21 /// @date   
22 /// @brief  Base class implementation for HLT data source components.
23 ///
24
25 #include "AliHLTDataSource.h"
26
27 /** ROOT macro for the implementation of ROOT specific class methods */
28 ClassImp(AliHLTDataSource)
29
30 AliHLTDataSource::AliHLTDataSource()
31 {
32   // Base class of HLT data source components.
33   // The class provides a common interface for the implementation of HLT data
34   // source components.
35   // Source components do not consume any input consequently the processing
36   // function is called 'GetEvent'.
37 }
38
39 AliHLTDataSource::~AliHLTDataSource()
40
41   // destructor
42 }
43
44 void AliHLTDataSource::GetInputDataTypes( AliHLTComponentDataTypeList& list)
45 {
46   // default method as source components do not consume input
47   list.clear(); // there are no input data types
48 }
49
50
51 int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
52                                     const AliHLTComponentBlockData* blocks, 
53                                     AliHLTComponentTriggerData& trigData,
54                                     AliHLTUInt8_t* outputPtr, 
55                                     AliHLTUInt32_t& size,
56                                     AliHLTComponentBlockDataList& outputBlocks,
57                                     AliHLTComponentEventDoneData*& edd )
58 {
59   // Processing method, calls child's GetEvent
60   int iResult=0;
61   if (evtData.fBlockCnt > 0) {
62     int unknown=-1;
63     for (unsigned int block=0; block<evtData.fBlockCnt; block++) {
64       if (blocks[block].fDataType==kAliHLTDataTypeSOR ||
65           blocks[block].fDataType==kAliHLTDataTypeEOR ||
66           blocks[block].fDataType==kAliHLTDataTypeEvent ||
67           blocks[block].fDataType==kAliHLTDataTypeRunType ||
68           blocks[block].fDataType==kAliHLTDataTypeComponentStatistics ||
69           blocks[block].fDataType==kAliHLTDataTypeComponentTable ||
70           blocks[block].fDataType==kAliHLTDataTypeECSParam) {
71         continue;
72       }
73       unknown=block;
74       break;
75     }
76     static int warningCount=0;
77     if (unknown>=0 && warningCount++<5) {
78       HLTWarning("Data source component skips input data blocks: first unknown block %s",
79                  DataType2Text(blocks[unknown].fDataType).c_str());
80     }
81   }
82   iResult=GetEvent(evtData, trigData, outputPtr, size, outputBlocks);
83   HLTDebug("component %s (%p) GetEvent finished (%d)", GetComponentID(), this, iResult);
84   edd = NULL;
85   return iResult;
86 }
87
88 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData,
89                                 AliHLTComponentTriggerData& trigData,
90                                 AliHLTUInt8_t* /*outputPtr*/, 
91                                 AliHLTUInt32_t& size,
92                                 AliHLTComponentBlockDataList& /*outputBlocks*/ )
93 {
94   // we just forward to the high level method, all other parameters already
95   // have been stored internally
96   size=0;
97   return GetEvent(evtData, trigData);
98 }
99
100 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
101 {
102   // default method: one of GetEvent methods must be implemented
103   HLTFatal("no processing method implemented");
104   return -ENOSYS;
105 }