]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSModuleMergerComponent.cxx
Bug fix. Incorrect usage of types was corrected.
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSModuleMergerComponent.cxx
CommitLineData
67b4900f 1/**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
67b4900f 16#include "AliHLTPHOSModuleMergerComponent.h"
17#include <iostream>
18#include "stdio.h"
67b4900f 19#include "AliRawReaderMemory.h"
20#include "AliCaloRawStream.h"
21#include <cstdlib>
bde48b84 22#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
67b4900f 23
67b4900f 24
25const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
26const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::outputDataType=kAliHLTVoidDataType;
27
28
bd3d5aa2 29AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent;
bd3d5aa2 30AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
67b4900f 31{
32
33}
34
415cfd05 35
67b4900f 36AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent()
37{
38
39}
40
415cfd05 41
42AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
67b4900f 43{
44
45}
46
47
48int
49AliHLTPHOSModuleMergerComponent::Deinit()
50{
51 return 0;
52}
53
415cfd05 54
67b4900f 55int
56AliHLTPHOSModuleMergerComponent::DoDeinit()
57{
58 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSModuleMerger DoDeinit");
59 return 0;
60
61}
62
415cfd05 63
67b4900f 64const char*
bd3d5aa2 65AliHLTPHOSModuleMergerComponent::GetComponentID()
67b4900f 66{
67 return "ModuleMerger";
68}
69
415cfd05 70
67b4900f 71void
72 AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
73{
74 const AliHLTComponentDataType* pType=inputDataTypes;
415cfd05 75 while (pType->fID!=0)
76 {
77 list.push_back(*pType);
78 pType++;
79 }
67b4900f 80}
81
415cfd05 82
67b4900f 83AliHLTComponentDataType
bd3d5aa2 84AliHLTPHOSModuleMergerComponent::GetOutputDataType()
67b4900f 85{
bd3d5aa2 86 return AliHLTPHOSDefinitions::gkCellEnergyDataType;
cf434398 87}
67b4900f 88
415cfd05 89
67b4900f 90void
bd3d5aa2 91AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
67b4900f 92{
93 constBase = 30;
bd3d5aa2 94 inputMultiplier = 1;
67b4900f 95}
96
97
98int AliHLTPHOSModuleMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
99 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
100 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
101{
415cfd05 102
bd3d5aa2 103 unsigned long ndx;
104 const AliHLTComponentBlockData* iter = NULL;
bde48b84 105 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr;
bd3d5aa2 106
cf434398 107 Reset();
67b4900f 108
bd3d5aa2 109 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
110 {
cf434398 111 int tmpModuleID = 0;
112 int tmpRcuX = 0;
113 int tmpRcuZ = 0;
415cfd05 114 int tmpCnt = cellDataPtr->fCnt;
bd3d5aa2 115 iter = blocks+ndx;
bde48b84 116 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
cf434398 117 tmpModuleID = cellDataPtr->fModuleID;
118 tmpRcuX = cellDataPtr->fRcuX ;
119 tmpRcuZ = cellDataPtr->fRcuZ;
120
415cfd05 121 for(int i= 0; i< tmpCnt; tmpCnt ++)
cf434398 122 {
415cfd05 123 if(cellDataPtr->fValidData[i].fGain == HIGH_GAIN)
124 {
1c1b3412 125 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ZROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX + N_XCOLUMNS_RCU*tmpRcuX][HIGH_GAIN] = cellDataPtr->fValidData[i].fEnergy;
415cfd05 126 // fMaxValues[0][0][0][0] = 0;
127 }
128 else if(cellDataPtr->fValidData[i].fGain == LOW_GAIN)
cf434398 129 {
1c1b3412 130 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX +N_COLUMNS_RCU*tmpRcuX][LOW_GAIN] = cellDataPtr->fValidData[i].fEnergy;
415cfd05 131 // fMaxValues[0][0][0][0]=0;
cf434398 132 }
133 }
415cfd05 134
bd3d5aa2 135 }
cf434398 136
415cfd05 137 DumpData(1);
67b4900f 138 fEventCount++;
139 return 0;
415cfd05 140
67b4900f 141}//end DoEvent
142
143
67b4900f 144int
bd3d5aa2 145AliHLTPHOSModuleMergerComponent::DoInit( int argc, const char** argv )
146{
67b4900f 147 Reset();
67b4900f 148
67b4900f 149 if (argc==0 && argv==NULL) {
150 // this is currently just to get rid of the warning "unused parameter"
151 }
152 return 0;
153}
154
415cfd05 155
67b4900f 156void
415cfd05 157AliHLTPHOSModuleMergerComponent::DumpData(int gain)
67b4900f 158{
415cfd05 159
160 if(gain < 0 || gain > N_GAINS)
161 {
162 cout <<"AliHLTPHOSModuleMergerComponent::DumpDat: Error, gain must be between " << 0 << "and" << N_GAINS << endl;
163 }
164
165 for(int mod = 0; mod < N_MODULES; mod ++)
67b4900f 166 {
415cfd05 167 if(gain == HIGH_GAIN)
67b4900f 168 {
415cfd05 169 cout << endl <<" *********** MODULE" << mod << "****HIGH_GAIN" <<"************" << endl;
170 }
171 else if(gain == LOW_GAIN)
172 {
173 cout << endl <<" *********** MODULE" << mod << "****LOW_GAIN" <<"************" << endl;
174 }
175
176 for(int row = 0; row < N_ROWS_MOD; row ++)
177 {
178 for(int col = 0; col < N_COLUMNS_MOD; col ++)
67b4900f 179 {
415cfd05 180 if( fMaxValues[mod][row][col][0] != 0)
67b4900f 181 {
415cfd05 182 cout << fMaxValues[mod][row][col][0] << "\t";
67b4900f 183 }
184 }
185 }
186 }
187}
188
189
415cfd05 190
67b4900f 191void
bd3d5aa2 192AliHLTPHOSModuleMergerComponent::Reset()
67b4900f 193{
415cfd05 194 for(int mod = 0; mod < N_MODULES; mod ++)
67b4900f 195 {
415cfd05 196 for(int row = 0; row < N_ROWS_MOD; row ++)
67b4900f 197 {
415cfd05 198 for(int col = 0; col < N_COLUMNS_MOD; col ++)
67b4900f 199 {
415cfd05 200 for(int gain = 0; gain < N_GAINS; gain ++ )
201 {
202
67b4900f 203 fMaxValues[mod][row][col][gain] = 0;
204 }
205 }
206 }
207 }
208
415cfd05 209 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
67b4900f 210 {
211 fTmpChannelData[i] = 0;
212 }
213} // end Reset
214
215void
bd3d5aa2 216AliHLTPHOSModuleMergerComponent::ResetDataPtr()
67b4900f 217{
415cfd05 218 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
67b4900f 219 {
220 fTmpChannelData[i] = 0;
221 }
222}
223
224
225void
bd3d5aa2 226AliHLTPHOSModuleMergerComponent::SetEquippmentId(int id)
67b4900f 227{
bd3d5aa2 228 fEquippmentID = id;
67b4900f 229}
230
231int
232AliHLTPHOSModuleMergerComponent::GetEquippmentId()
233{
bd3d5aa2 234 return fEquippmentID;
67b4900f 235}
bd3d5aa2 236
237
238AliHLTComponent*
239AliHLTPHOSModuleMergerComponent::Spawn()
240{
241 return new AliHLTPHOSModuleMergerComponent;
242}
243
244