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: 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 AliHLTProcessor.cxx
21 @author Matthias Richter, Timm Steinbeck
23 @brief Base class implementation for HLT analysis components. */
29 #include "AliHLTProcessor.h"
34 /** ROOT macro for the implementation of ROOT specific class methods */
35 ClassImp(AliHLTProcessor)
37 AliHLTProcessor::AliHLTProcessor()
39 , fpDebugCounters(NULL)
41 // see header file for class documentation
43 // refer to README to build package
45 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
48 AliHLTProcessor::~AliHLTProcessor()
50 // see header file for class documentation
51 if (fpDebugCounters) delete fpDebugCounters;
55 int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
56 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
58 vector<AliHLTComponentBlockData>& outputBlocks,
59 AliHLTComponentEventDoneData*& edd )
61 // see header file for class documentation
63 ReleaseEventDoneData();
65 iResult=DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
68 AliHLTComponentEventDoneData* eddTmp = GetCurrentEventDoneData();
70 int ret = GetEventDoneData(eddTmp->fDataSize, &edd);
72 HLTError( "Cannot get event done data of %u bytes for event %lu: error (%d)",
73 eddTmp->fDataSize, evtData.fEventID, ret );
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 );
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;
88 if (fpDebugCounters) {
89 int wordCnt=edd->fDataSize/4;
90 AliHLTUInt32_t* buffer=reinterpret_cast<AliHLTUInt32_t*>(edd->fData);
92 while (word<wordCnt) {
93 switch (buffer[word]) {
95 fpDebugCounters->fReadoutFilter++;
96 word+=1+buffer[word+1]*4;
99 fpDebugCounters->fMonitoringFilter++;
100 word+=1+buffer[word+1]*4;
103 fpDebugCounters->fMonitoringEvent++;
106 fpDebugCounters->fMismatch++;
112 static UInt_t lastTime=0;
114 if (time.Get()-lastTime>1) {
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; ) {
120 for (int j=0; j<4 && i<wordCnt; j++) {
121 TString number; number.Form("0x%08x ", buffer[i++]);
124 HLTImportant(" %s", message.Data());
133 int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& evtData,
134 const AliHLTComponentBlockData* /*blocks*/,
135 AliHLTComponentTriggerData& trigData,
136 AliHLTUInt8_t* /*outputPtr*/,
137 AliHLTUInt32_t& size,
138 vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
140 // we just forward to the high level method, all other parameters already
141 // have been stored internally
143 return DoEvent(evtData, trigData);
146 int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
148 HLTFatal("no processing method implemented");