]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx
- fixing compilation warnings
[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
88938cd8 19// Base class fro anlyzing EMCAL raww data
20// Further documentation found in base class
21// --------------
22// --------------
23// --------------
24// --------------
25
88b2ce82 26
27#include "AliHLTEMCALRawAnalyzerComponent.h"
28#include "AliHLTEMCALMapper.h"
29#include "AliHLTEMCALDefinitions.h"
c375e15d 30#include "AliHLTCaloChannelDataHeaderStruct.h"
1637625c 31//#include "unistd.h"
88938cd8 32
33//#include "TStopwatch.h"
34//TStopwatch fgWatch; //CRAP PTH
88b2ce82 35
1637625c 36
37AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() : AliHLTCaloRawAnalyzerComponentv3("EMCAL")
88b2ce82 38{
39
1637625c 40
88b2ce82 41}
42
43
44AliHLTEMCALRawAnalyzerComponent::~AliHLTEMCALRawAnalyzerComponent()
45{
46
47}
48
49
50
51void
52AliHLTEMCALRawAnalyzerComponent::GetInputDataTypes( vector <AliHLTComponentDataType>& list)
53{
54 list.clear();
55 list.push_back( AliHLTEMCALDefinitions::fgkDDLRawDataType | kAliHLTDataOriginEMCAL );
56}
57
58
c375e15d 59
60AliHLTComponentDataType
61AliHLTEMCALRawAnalyzerComponent::GetOutputDataType()
62{
63 //comment
64 return AliHLTEMCALDefinitions::fgkChannelDataType;
65}
66
67
68void
69AliHLTEMCALRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
70{
71 //comment
72 constBase = sizeof(AliHLTCaloChannelDataHeaderStruct);
73 inputMultiplier = 0.5;
74}
75
76
77void
78AliHLTEMCALRawAnalyzerComponent::DoInit()
79{
88938cd8 80 // fgWatch.Start();
1637625c 81
c375e15d 82}
83
88b2ce82 84bool
85AliHLTEMCALRawAnalyzerComponent::CheckInputDataType(const AliHLTComponentDataType &datatype)
86{
88938cd8 87 // Cheking if datatype is the correct one before processing
88b2ce82 88 if ( datatype == AliHLTEMCALDefinitions::fgkDDLRawDataType )
89 {
90 return true;
91 }
92 else
93 {
94 return false;
95 }
96}
97
98
88b2ce82 99void
4d6be4cd 100AliHLTEMCALRawAnalyzerComponent::InitMapping( const int specification )
88b2ce82 101{
88938cd8 102 //-------------
4d6be4cd 103 if ( fMapperPtr == 0 )
104 {
105 fMapperPtr = new AliHLTEMCALMapper( specification );
106 }
107
108 if(fMapperPtr->GetIsInitializedMapping() == false )
109 {
110 HLTError("%d:%d, ERROR, mapping not initialized ", __FILE__, __LINE__ );
111 exit(-2);
112 }
88b2ce82 113}
c375e15d 114
1637625c 115
c375e15d 116int
117AliHLTEMCALRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/,
118 AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
119{
88938cd8 120 //-----------------------
1637625c 121 static int evntcnt = 0;
cefad3b2 122// static double wlast = -1;
123 // static double wcurrent = 0;
c375e15d 124
1637625c 125 evntcnt ++;
126
88938cd8 127 /*
1637625c 128 if( evntcnt %100 == 0 )
c375e15d 129 {
1637625c 130
1637625c 131 cout << __FILE__ << __LINE__ << " : Processing event " << evntcnt << endl;
1637625c 132 wlast = wcurrent;
1637625c 133 wcurrent = fgWatch.RealTime();
1637625c 134 cout << wlast << ":" << wcurrent << endl;
1637625c 135 cout << __FILE__ << __LINE__ << "The event rate is " << 100/( wcurrent - wlast ) << " Hz" << endl;
1637625c 136 fgWatch.Start(kFALSE);
1637625c 137 // wlast = fgWatch.RealTime();
88938cd8 138 }
139 */
1637625c 140
c375e15d 141
c375e15d 142 Int_t blockSize = -1;
143 UInt_t totSize = 0;
144 const AliHLTComponentBlockData* iter = NULL;
145 unsigned long ndx;
146
147 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
148 {
149 iter = blocks+ndx;
150 if( ! CheckInputDataType(iter->fDataType) )
151 {
152 continue;
153 }
154 else
155 {
156 InitMapping( iter->fSpecification);
c375e15d 157 blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block
158
c375e15d 159 if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg.
160 {
161 return -ENOBUFS;
162 }
163
164 totSize += blockSize; //Keeping track of the used size
165 AliHLTComponentBlockData bdChannelData;
166 FillBlockData( bdChannelData );
167 bdChannelData.fOffset = 0; //FIXME
168 bdChannelData.fSize = blockSize;
169
170 // bdChannelData.fDataType = AliHLTPHOSDefinitions::fgkChannelDataType;
171 bdChannelData.fDataType = AliHLTEMCALDefinitions::fgkChannelDataType;
172
173 bdChannelData.fSpecification = iter->fSpecification;
174 outputBlocks.push_back(bdChannelData);
175 outputPtr += blockSize; //Updating position of the output buffer
176 }
177
178 fCaloEventCount++;
179 size = totSize; //telling the framework how much buffer space we have used.
180 }
181
182
183return 0;
184
185}//end DoEvent
186