]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTProcessor.cxx
Cosmetics. Fixed bug preventing creation of async block list
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTProcessor.cxx
CommitLineData
f23a6e1a 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
f23a6e1a 6 * *
9be2600f 7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 * for The ALICE HLT Project. *
f23a6e1a 10 * *
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 **************************************************************************/
19
bfccbf68 20/** @file AliHLTProcessor.cxx
21 @author Matthias Richter, Timm Steinbeck
22 @date
23 @brief Base class implementation for HLT analysis components. */
f23a6e1a 24
0c0c9d99 25#if __GNUC__>= 3
f23a6e1a 26using namespace std;
27#endif
28
29#include "AliHLTProcessor.h"
30#include <string.h>
df3d6cff 31#include "TDatime.h"
32#include "TString.h"
f23a6e1a 33
b22e91eb 34/** ROOT macro for the implementation of ROOT specific class methods */
f23a6e1a 35ClassImp(AliHLTProcessor)
36
37AliHLTProcessor::AliHLTProcessor()
df3d6cff 38 : AliHLTComponent()
39 , fpDebugCounters(NULL)
f23a6e1a 40{
70ed7d01 41 // see header file for class documentation
42 // or
43 // refer to README to build package
44 // or
45 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
f23a6e1a 46}
47
48AliHLTProcessor::~AliHLTProcessor()
49{
70ed7d01 50 // see header file for class documentation
df3d6cff 51 if (fpDebugCounters) delete fpDebugCounters;
52 fpDebugCounters=NULL;
f23a6e1a 53}
54
3cde846d 55int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
8ede8717 56 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
a655eae3 57 AliHLTUInt32_t& size,
58 vector<AliHLTComponentBlockData>& outputBlocks,
8ede8717 59 AliHLTComponentEventDoneData*& edd )
f23a6e1a 60{
70ed7d01 61 // see header file for class documentation
f23a6e1a 62 int iResult=0;
eafbc306 63 ReleaseEventDoneData();
64
a655eae3 65 iResult=DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
eafbc306 66
71d7c760 67 edd = NULL;
eafbc306 68 AliHLTComponentEventDoneData* eddTmp = GetCurrentEventDoneData();
69 if (eddTmp) {
70 int ret = GetEventDoneData(eddTmp->fDataSize, &edd);
71 if (ret) {
72 HLTError( "Cannot get event done data of %u bytes for event %lu: %s (%d)",
73 eddTmp->fDataSize, evtData.fEventID, strerror(ret), ret );
74 return -ENOMEM;
75 }
76 edd->fStructSize = sizeof(AliHLTComponentEventDoneData);
77 edd->fDataSize = eddTmp->fDataSize;
78 edd->fData = reinterpret_cast<AliHLTUInt8_t*>(edd)+edd->fStructSize;
79 memcpy( edd->fData, eddTmp->fData, eddTmp->fDataSize );
df3d6cff 80
81 // 2009-12-07 want to make this switchable, but this first needs some
82 // extension in the online framework to change the log level settings
83 // in the component while running
84 if (false/*CheckFilter(kHLTLogDebug)*/) {
85 if (!fpDebugCounters) {
86 fpDebugCounters=new AliHLTProcessorCounters;
87 }
88 if (fpDebugCounters) {
89 int wordCnt=edd->fDataSize/4;
90 AliHLTUInt32_t* buffer=reinterpret_cast<AliHLTUInt32_t*>(edd->fData);
91 int word=0;
92 while (word<wordCnt) {
93 switch (buffer[word]) {
94 case 3:
95 fpDebugCounters->fReadoutFilter++;
96 word+=1+buffer[word+1]*4;
97 break;
98 case 4:
99 fpDebugCounters->fMonitoringFilter++;
100 word+=1+buffer[word+1]*4;
101 break;
102 case 5:
103 fpDebugCounters->fMonitoringEvent++;
104 break;
105 default:
106 fpDebugCounters->fMismatch++;
107 break;
108 }
109 word++;
110 }
111
112 static UInt_t lastTime=0;
113 TDatime time;
114 if (time.Get()-lastTime>1) {
115 lastTime=time.Get();
116 HLTImportant("EventDoneData size %d: readout %d, monitoring filter %d, monitoring event %d, format error %d",
117 edd->fDataSize, fpDebugCounters->fReadoutFilter, fpDebugCounters->fMonitoringFilter, fpDebugCounters->fMonitoringEvent, fpDebugCounters->fMismatch);
118 for (int i=0; i< wordCnt; ) {
119 TString message;
120 for (int j=0; j<4 && i<wordCnt; j++) {
121 TString number; number.Form("0x%08x ", buffer[i++]);
122 message+=number;
123 }
124 HLTImportant(" %s", message.Data());
125 }
126 }
127 }
128 }
eafbc306 129 }
f23a6e1a 130 return iResult;
131}
a655eae3 132
133int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& evtData,
298ef463 134 const AliHLTComponentBlockData* /*blocks*/,
135 AliHLTComponentTriggerData& trigData,
136 AliHLTUInt8_t* /*outputPtr*/,
53f79557 137 AliHLTUInt32_t& size,
298ef463 138 vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
a655eae3 139{
140 // we just forward to the high level method, all other parameters already
141 // have been stored internally
53f79557 142 size=0;
a655eae3 143 return DoEvent(evtData, trigData);
144}
145
298ef463 146int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
a655eae3 147{
148 HLTFatal("no processing method implemented");
149 return -ENOSYS;
150}