]>
Commit | Line | Data |
---|---|---|
adbf547d | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: Oystein Djuvsland * | |
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 | ||
16 | ||
17 | #include "AliPHOSRcuDA1.h" | |
18 | #include "AliHLTPHOSSharedMemoryInterface.h" | |
19 | #include "AliHLTPHOSModuleCalibrationProcessorComponent.h" | |
20 | #include "AliHLTPHOSDefinitions.h" | |
21 | #include "AliHLTPHOSConstants.h" | |
22 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" | |
23 | ||
24 | //#include <iostream> | |
25 | ||
26 | /** @file AliHLTPHOSModuleCalibrationProcessorComponent.cxx | |
27 | @author Oystein Djuvsland | |
28 | @date | |
29 | @brief A module calibration component for PHOS HLT, using the PHOS DA's | |
30 | */ | |
31 | ||
32 | // see header file for class documentation | |
33 | // or | |
34 | // refer to README to build package | |
35 | // or | |
36 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
37 | ||
38 | using namespace PhosHLTConst; | |
39 | ||
40 | AliHLTPHOSModuleCalibrationProcessorComponent gAliHLTPHOSModuleCalibrationProcessorComponent; | |
41 | ||
42 | AliHLTPHOSModuleCalibrationProcessorComponent::AliHLTPHOSModuleCalibrationProcessorComponent() : | |
43 | AliHLTCalibrationProcessor(), | |
adbf547d | 44 | fCnt(0), |
6e587e00 | 45 | fPHOSDAPtr(0), |
adbf547d | 46 | fShmPtr(0) |
47 | { | |
48 | //See header file for documentation | |
49 | } | |
50 | ||
51 | ||
52 | AliHLTPHOSModuleCalibrationProcessorComponent::~AliHLTPHOSModuleCalibrationProcessorComponent() | |
53 | { | |
54 | //See header file for documentation | |
55 | if(fShmPtr) | |
56 | { | |
57 | delete fShmPtr; | |
58 | fShmPtr = 0; | |
59 | } | |
60 | if(fPHOSDAPtr) | |
61 | { | |
62 | delete fPHOSDAPtr; | |
63 | fPHOSDAPtr = 0; | |
64 | } | |
65 | } | |
66 | ||
67 | void AliHLTPHOSModuleCalibrationProcessorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list) | |
68 | { | |
69 | //See header file for documentation | |
70 | list.clear(); | |
71 | list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType); | |
72 | } | |
73 | ||
74 | ||
75 | AliHLTComponentDataType AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataType() | |
76 | { | |
77 | //See header file for documentation | |
78 | return AliHLTPHOSDefinitions::fgkEmcCalibDataType; | |
79 | } | |
80 | ||
81 | void AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
82 | { | |
83 | //See header file for documentation | |
84 | constBase = 0; | |
85 | inputMultiplier = 2; | |
86 | } | |
87 | ||
88 | AliHLTComponent* | |
89 | AliHLTPHOSModuleCalibrationProcessorComponent::Spawn() | |
90 | { | |
91 | //See header file for documentation | |
92 | return new AliHLTPHOSModuleCalibrationProcessorComponent(); | |
93 | } | |
94 | ||
95 | const char* | |
96 | AliHLTPHOSModuleCalibrationProcessorComponent::GetComponentID() | |
97 | { | |
98 | //See header file for documentation | |
99 | return "PhosModuleCalibrationProcessor"; | |
100 | } | |
101 | ||
102 | Int_t | |
103 | AliHLTPHOSModuleCalibrationProcessorComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/) | |
104 | { | |
105 | //See header file for documentation | |
106 | return 0; | |
107 | } | |
108 | ||
109 | Int_t AliHLTPHOSModuleCalibrationProcessorComponent::InitCalibration() | |
110 | { | |
111 | //See header file for documentation | |
112 | fShmPtr = new AliHLTPHOSSharedMemoryInterface(); | |
113 | return 0; | |
114 | } | |
115 | ||
116 | ||
117 | Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration() | |
118 | { | |
119 | //See header file for documentation | |
120 | ||
121 | cout << "Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration()" << endl; | |
122 | //AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) { | |
123 | ||
124 | AliHLTComponentEventData dummyEvtData; | |
125 | AliHLTComponentTriggerData dummyTrgData; | |
126 | ||
127 | ShipDataToFXS(dummyEvtData, dummyTrgData); | |
128 | ||
129 | //See header file for documentation | |
130 | if(fShmPtr) | |
131 | { | |
132 | delete fShmPtr; | |
133 | fShmPtr = 0; | |
134 | } | |
135 | if(fPHOSDAPtr) | |
136 | { | |
137 | delete fPHOSDAPtr; | |
138 | fPHOSDAPtr = 0; | |
139 | } | |
140 | return 0; | |
141 | } | |
142 | ||
143 | Int_t AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) | |
144 | { | |
145 | ||
146 | // fCnt ++; | |
147 | ||
adbf547d | 148 | fCnt ++; |
149 | ||
150 | //See header file for documentation | |
151 | const AliHLTComponentEventData eDta = evtData; | |
152 | AliHLTComponentTriggerData tDta = trigData; | |
153 | ||
7ce40e5c | 154 | |
155 | AliHLTPHOSValidCellDataStruct *currentChannel =0; | |
156 | ||
adbf547d | 157 | UInt_t specification = 0; |
158 | const AliHLTComponentBlockData* iter = 0; | |
159 | iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC); | |
160 | AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0; | |
161 | Int_t xOffset = 0; | |
162 | Int_t zOffset = 0; | |
163 | Int_t module = -1; | |
164 | ||
165 | Float_t energyArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]; | |
166 | Float_t timeArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]; | |
167 | ||
168 | while(iter != 0) | |
169 | { | |
170 | ||
171 | specification = specification|iter->fSpecification; | |
172 | ||
173 | cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
174 | ||
175 | // Only necessary until the specification gives the module number | |
176 | module = cellDataPtr->fModuleID; | |
177 | if(!fPHOSDAPtr) | |
178 | { | |
179 | // fPHOSDAPtr = new AliPHOSDA1(module,0); | |
180 | fPHOSDAPtr = new AliPHOSRcuDA1(module,0); | |
181 | } | |
182 | ||
183 | xOffset = cellDataPtr->fRcuX*N_XCOLUMNS_RCU; | |
184 | zOffset = cellDataPtr->fRcuZ*N_ZROWS_RCU; | |
7ce40e5c | 185 | |
186 | fShmPtr->SetMemory(cellDataPtr); | |
187 | currentChannel = fShmPtr->NextChannel(); | |
188 | ||
189 | while(currentChannel != 0) | |
adbf547d | 190 | { |
7ce40e5c | 191 | Int_t tmpZ = currentChannel->fZ; |
192 | Int_t tmpX = currentChannel->fX; | |
193 | Int_t tmpGain = currentChannel->fGain; | |
194 | ||
195 | energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy; | |
196 | timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime; | |
adbf547d | 197 | } |
7ce40e5c | 198 | // for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++) |
199 | // { | |
200 | // for(Int_t z = 0; z < N_ZROWS_RCU; z++) | |
201 | // { | |
202 | // for(Int_t gain = 0; gain < N_GAINS; gain++) | |
203 | // { | |
204 | // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy; | |
205 | // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime; | |
206 | // } | |
207 | // } | |
208 | // } | |
adbf547d | 209 | iter = GetNextInputBlock(); |
210 | } | |
211 | ||
212 | if(fPHOSDAPtr) | |
213 | { | |
214 | // fPHOSDAPtr->FillHistograms(energyArray, timeArray); | |
215 | } | |
216 | ||
217 | ResetArrays(energyArray, timeArray); | |
218 | ||
219 | //PushBack((TObject*) fCalibDataPtr, AliHLTPHOSDefinitions::fgkEmcCalibDataType, specification); | |
220 | ||
221 | return 0; | |
222 | } | |
223 | ||
224 | ||
225 | Int_t | |
226 | AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) { | |
227 | ||
228 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0" << endl; | |
229 | ||
230 | //://:ShipDataToFXS( | |
231 | ||
232 | // see header file for class documentation | |
233 | ||
234 | // ** PushBack data to FXS ... | |
235 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.1" << endl; | |
236 | Char_t filename[200]; | |
237 | ||
238 | for(int i=0; i < 200; i++) | |
239 | { | |
240 | filename[i] = 0; | |
241 | } | |
242 | ||
243 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.2" << endl; | |
244 | ||
245 | fPHOSDAPtr->GetModule(); | |
246 | ||
247 | sprintf(filename, "PHOS_Module%d_Calib_HLT.root", fPHOSDAPtr->GetModule() ); | |
248 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.3" << endl; | |
249 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP1" << endl; | |
250 | ||
251 | for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++) | |
252 | { | |
253 | for(Int_t z = 0; z < N_ZROWS_RCU; z++) | |
254 | { | |
255 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP2" << endl; | |
256 | PushToFXS( (TObject*) fPHOSDAPtr->GetHgLgRatioHistogram(x, z), "PHOS", filename); | |
257 | for(Int_t gain = 0; gain < N_GAINS; gain++) | |
258 | { | |
259 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP3" << endl; | |
260 | PushToFXS( (TObject*) fPHOSDAPtr->GetTimeEnergyHistogram(x, z, gain), "PHOS", filename); | |
261 | cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP4" << endl; | |
262 | } | |
263 | } | |
264 | } | |
265 | return 0; | |
266 | } | |
267 | ||
268 | void | |
269 | AliHLTPHOSModuleCalibrationProcessorComponent::ResetArrays(Float_t e[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS], Float_t t[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]) | |
270 | { | |
271 | for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++) | |
272 | { | |
273 | for(Int_t z = 0; z < N_ZROWS_RCU; z++) | |
274 | { | |
275 | for(Int_t gain = 0; gain < N_GAINS; gain++) | |
276 | { | |
277 | e[x][z][gain] = 0; | |
278 | t[x][z][gain] = 0; | |
279 | } | |
280 | } | |
281 | } | |
282 | } |