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