]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx
Adding / removing files to the build system
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALRawAnalyzerComponent.cxx
CommitLineData
88b2ce82 1/**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2007 *
5 * *
6 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7 * Contributors are mentioned in the code where appropriate. *
8 * Please report bugs to perthi@fys.uio.no *
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
20#include "AliHLTEMCALRawAnalyzerComponent.h"
21#include "AliHLTEMCALMapper.h"
22#include "AliHLTEMCALDefinitions.h"
c375e15d 23#include "AliHLTCaloChannelDataHeaderStruct.h"
88b2ce82 24
77f350f7 25AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() :
26AliHLTCaloRawAnalyzerComponentv3("EMCAL")
88b2ce82 27{
28
29
30}
31
32
33AliHLTEMCALRawAnalyzerComponent::~AliHLTEMCALRawAnalyzerComponent()
34{
35
36}
37
38
39
40void
41AliHLTEMCALRawAnalyzerComponent::GetInputDataTypes( vector <AliHLTComponentDataType>& list)
42{
43 list.clear();
44 list.push_back( AliHLTEMCALDefinitions::fgkDDLRawDataType | kAliHLTDataOriginEMCAL );
45}
46
47
c375e15d 48
49AliHLTComponentDataType
50AliHLTEMCALRawAnalyzerComponent::GetOutputDataType()
51{
52 //comment
53 return AliHLTEMCALDefinitions::fgkChannelDataType;
54}
55
56
57void
58AliHLTEMCALRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
59{
60 //comment
61 constBase = sizeof(AliHLTCaloChannelDataHeaderStruct);
62 inputMultiplier = 0.5;
63}
64
65
66void
67AliHLTEMCALRawAnalyzerComponent::DoInit()
68{
69
70}
71
88b2ce82 72bool
73AliHLTEMCALRawAnalyzerComponent::CheckInputDataType(const AliHLTComponentDataType &datatype)
74{
75 if ( datatype == AliHLTEMCALDefinitions::fgkDDLRawDataType )
76 {
77 return true;
78 }
79 else
80 {
81 return false;
82 }
83}
84
85
c375e15d 86
87
88b2ce82 88void
4d6be4cd 89AliHLTEMCALRawAnalyzerComponent::InitMapping( const int specification )
88b2ce82 90{
4d6be4cd 91
92 if ( fMapperPtr == 0 )
93 {
94 fMapperPtr = new AliHLTEMCALMapper( specification );
95 }
96
97 if(fMapperPtr->GetIsInitializedMapping() == false )
98 {
99 HLTError("%d:%d, ERROR, mapping not initialized ", __FILE__, __LINE__ );
100 exit(-2);
101 }
88b2ce82 102}
c375e15d 103
104int
105AliHLTEMCALRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/,
106 AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
107{
108
109 /*
110
111 if( fPhosEventCount%300 == 0 )
112 {
113 cout << __FILE__<<__LINE__<< " Processing event " << fPhosEventCount << endl;
114 }
115 */
116
117 // Int_t blockSize = 0;
118
119 Int_t blockSize = -1;
120 UInt_t totSize = 0;
121 const AliHLTComponentBlockData* iter = NULL;
122 unsigned long ndx;
123
124 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
125 {
126 iter = blocks+ndx;
127 if( ! CheckInputDataType(iter->fDataType) )
128 {
129 continue;
130 }
131 else
132 {
133 InitMapping( iter->fSpecification);
134
135 blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block
136
137 // blockSize = 1;
138
139 if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg.
140 {
141 return -ENOBUFS;
142 }
143
144 totSize += blockSize; //Keeping track of the used size
145 AliHLTComponentBlockData bdChannelData;
146 FillBlockData( bdChannelData );
147 bdChannelData.fOffset = 0; //FIXME
148 bdChannelData.fSize = blockSize;
149
150 // bdChannelData.fDataType = AliHLTPHOSDefinitions::fgkChannelDataType;
151 bdChannelData.fDataType = AliHLTEMCALDefinitions::fgkChannelDataType;
152
153 bdChannelData.fSpecification = iter->fSpecification;
154 outputBlocks.push_back(bdChannelData);
155 outputPtr += blockSize; //Updating position of the output buffer
156 }
157
158 fCaloEventCount++;
159 size = totSize; //telling the framework how much buffer space we have used.
160 }
161
162
163return 0;
164
165}//end DoEvent
166