]>
Commit | Line | Data |
---|---|---|
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 | |
25 | const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array | |
26 | const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::outputDataType=kAliHLTVoidDataType; | |
27 | ||
28 | ||
bd3d5aa2 | 29 | AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent; |
bd3d5aa2 | 30 | AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0) |
67b4900f | 31 | { |
32 | ||
33 | } | |
34 | ||
35 | AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent() | |
36 | { | |
37 | ||
38 | } | |
39 | ||
bd3d5aa2 | 40 | AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0) |
67b4900f | 41 | { |
42 | ||
43 | } | |
44 | ||
45 | ||
46 | int | |
47 | AliHLTPHOSModuleMergerComponent::Deinit() | |
48 | { | |
49 | return 0; | |
50 | } | |
51 | ||
52 | int | |
53 | AliHLTPHOSModuleMergerComponent::DoDeinit() | |
54 | { | |
55 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSModuleMerger DoDeinit"); | |
56 | return 0; | |
57 | ||
58 | } | |
59 | ||
60 | const char* | |
bd3d5aa2 | 61 | AliHLTPHOSModuleMergerComponent::GetComponentID() |
67b4900f | 62 | { |
63 | return "ModuleMerger"; | |
64 | } | |
65 | ||
66 | void | |
67 | AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
68 | { | |
69 | const AliHLTComponentDataType* pType=inputDataTypes; | |
70 | while (pType->fID!=0) { | |
71 | list.push_back(*pType); | |
72 | pType++; | |
73 | } | |
74 | } | |
75 | ||
76 | AliHLTComponentDataType | |
bd3d5aa2 | 77 | AliHLTPHOSModuleMergerComponent::GetOutputDataType() |
67b4900f | 78 | { |
bd3d5aa2 | 79 | return AliHLTPHOSDefinitions::gkCellEnergyDataType; |
cf434398 | 80 | } |
67b4900f | 81 | |
82 | void | |
bd3d5aa2 | 83 | AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) |
67b4900f | 84 | |
85 | { | |
86 | constBase = 30; | |
bd3d5aa2 | 87 | inputMultiplier = 1; |
67b4900f | 88 | } |
89 | ||
90 | ||
91 | int AliHLTPHOSModuleMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
92 | AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
93 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) | |
94 | { | |
bd3d5aa2 | 95 | unsigned long ndx; |
96 | const AliHLTComponentBlockData* iter = NULL; | |
bde48b84 | 97 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; |
bd3d5aa2 | 98 | |
cf434398 | 99 | Reset(); |
67b4900f | 100 | |
bd3d5aa2 | 101 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
102 | { | |
cf434398 | 103 | int tmpModuleID = 0; |
104 | int tmpRcuX = 0; | |
105 | int tmpRcuZ = 0; | |
106 | ||
bd3d5aa2 | 107 | iter = blocks+ndx; |
bde48b84 | 108 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); |
cf434398 | 109 | |
110 | tmpModuleID = cellDataPtr->fModuleID; | |
111 | tmpRcuX = cellDataPtr->fRcuX ; | |
112 | tmpRcuZ = cellDataPtr->fRcuZ; | |
113 | ||
114 | for(int row = 0; row<32; row ++) | |
115 | { | |
116 | for(int col = 0; col < 28; col ++) | |
117 | { | |
118 | for(int gain=0; gain <2; gain++) | |
119 | { | |
120 | fMaxValues[tmpModuleID][row + 32*tmpRcuX][col + 28*tmpRcuZ][gain] = cellDataPtr->fCellEnergies[row][col][gain]; | |
121 | } | |
122 | } | |
123 | } | |
124 | ||
bd3d5aa2 | 125 | } |
cf434398 | 126 | |
127 | DumpData(); | |
67b4900f | 128 | fEventCount++; |
129 | return 0; | |
130 | }//end DoEvent | |
131 | ||
132 | ||
133 | ||
134 | int | |
bd3d5aa2 | 135 | AliHLTPHOSModuleMergerComponent::DoInit( int argc, const char** argv ) |
136 | { | |
67b4900f | 137 | Reset(); |
67b4900f | 138 | |
67b4900f | 139 | if (argc==0 && argv==NULL) { |
140 | // this is currently just to get rid of the warning "unused parameter" | |
141 | } | |
142 | return 0; | |
143 | } | |
144 | ||
145 | void | |
bd3d5aa2 | 146 | AliHLTPHOSModuleMergerComponent::DumpData() |
67b4900f | 147 | { |
148 | for(int mod = 0; mod <5; mod ++) | |
149 | { | |
150 | printf("\n *********** MODULE %d ************\n", mod); | |
151 | for(int row = 0; row < 64; row ++) | |
152 | { | |
153 | for(int col = 0; col < 56; col ++) | |
154 | { | |
155 | if( fMaxValues[mod][row][col][0] != 0) | |
156 | { | |
157 | cout << fMaxValues[mod][row][col][0] << "\t"; | |
158 | } | |
159 | } | |
160 | } | |
161 | } | |
162 | } | |
163 | ||
164 | ||
165 | void | |
bd3d5aa2 | 166 | AliHLTPHOSModuleMergerComponent::Reset() |
67b4900f | 167 | { |
168 | for(int mod = 0; mod <5; mod ++) | |
169 | { | |
170 | for(int row = 0; row < 64; row ++) | |
171 | { | |
172 | for(int col = 0; col < 56; col ++) | |
173 | { | |
174 | for(int gain = 0; gain <2; gain ++ ) | |
175 | { | |
176 | fMaxValues[mod][row][col][gain] = 0; | |
177 | } | |
178 | } | |
179 | } | |
180 | } | |
181 | ||
182 | for(int i = 0 ; i< 1008; i++) | |
183 | { | |
184 | fTmpChannelData[i] = 0; | |
185 | } | |
186 | } // end Reset | |
187 | ||
188 | void | |
bd3d5aa2 | 189 | AliHLTPHOSModuleMergerComponent::ResetDataPtr() |
67b4900f | 190 | { |
191 | for(int i = 0 ; i< 1008; i++) | |
192 | { | |
193 | fTmpChannelData[i] = 0; | |
194 | } | |
195 | } | |
196 | ||
197 | ||
198 | void | |
bd3d5aa2 | 199 | AliHLTPHOSModuleMergerComponent::SetEquippmentId(int id) |
67b4900f | 200 | { |
bd3d5aa2 | 201 | fEquippmentID = id; |
67b4900f | 202 | } |
203 | ||
204 | int | |
205 | AliHLTPHOSModuleMergerComponent::GetEquippmentId() | |
206 | { | |
bd3d5aa2 | 207 | return fEquippmentID; |
67b4900f | 208 | } |
bd3d5aa2 | 209 | |
210 | ||
211 | AliHLTComponent* | |
212 | AliHLTPHOSModuleMergerComponent::Spawn() | |
213 | { | |
214 | return new AliHLTPHOSModuleMergerComponent; | |
215 | } | |
216 | ||
217 |