]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSModuleCalibrationProcessorComponent.cxx
DA component that makes calibration data on per module
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSModuleCalibrationProcessorComponent.cxx
CommitLineData
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
38using namespace PhosHLTConst;
39
40AliHLTPHOSModuleCalibrationProcessorComponent gAliHLTPHOSModuleCalibrationProcessorComponent;
41
42AliHLTPHOSModuleCalibrationProcessorComponent::AliHLTPHOSModuleCalibrationProcessorComponent() :
43 AliHLTCalibrationProcessor(),
44 fPHOSDAPtr(0),
45 fCnt(0),
46 fShmPtr(0)
47{
48 //See header file for documentation
49}
50
51
52AliHLTPHOSModuleCalibrationProcessorComponent::~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
67void AliHLTPHOSModuleCalibrationProcessorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
68{
69 //See header file for documentation
70 list.clear();
71 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
72}
73
74
75AliHLTComponentDataType AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataType()
76{
77 //See header file for documentation
78 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
79}
80
81void AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
82{
83 //See header file for documentation
84 constBase = 0;
85 inputMultiplier = 2;
86}
87
88AliHLTComponent*
89AliHLTPHOSModuleCalibrationProcessorComponent::Spawn()
90{
91 //See header file for documentation
92 return new AliHLTPHOSModuleCalibrationProcessorComponent();
93}
94
95const char*
96AliHLTPHOSModuleCalibrationProcessorComponent::GetComponentID()
97{
98 //See header file for documentation
99 return "PhosModuleCalibrationProcessor";
100}
101
102Int_t
103AliHLTPHOSModuleCalibrationProcessorComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
104{
105 //See header file for documentation
106 return 0;
107}
108
109Int_t AliHLTPHOSModuleCalibrationProcessorComponent::InitCalibration()
110{
111 //See header file for documentation
112 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
113 return 0;
114}
115
116
117Int_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
143Int_t AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
144{
145
146 // fCnt ++;
147
148 cout << " AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibratio processing event" << fCnt << endl;
149
150 fCnt ++;
151
152 //See header file for documentation
153 const AliHLTComponentEventData eDta = evtData;
154 AliHLTComponentTriggerData tDta = trigData;
155
156 UInt_t specification = 0;
157 const AliHLTComponentBlockData* iter = 0;
158 iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC);
159 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
160 Int_t xOffset = 0;
161 Int_t zOffset = 0;
162 Int_t module = -1;
163
164 Float_t energyArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
165 Float_t timeArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
166
167 while(iter != 0)
168 {
169
170 specification = specification|iter->fSpecification;
171
172 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
173
174 // Only necessary until the specification gives the module number
175 module = cellDataPtr->fModuleID;
176 if(!fPHOSDAPtr)
177 {
178 // fPHOSDAPtr = new AliPHOSDA1(module,0);
179 fPHOSDAPtr = new AliPHOSRcuDA1(module,0);
180 }
181
182 xOffset = cellDataPtr->fRcuX*N_XCOLUMNS_RCU;
183 zOffset = cellDataPtr->fRcuZ*N_ZROWS_RCU;
184
185 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
186 {
187 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
188 {
189 for(Int_t gain = 0; gain < N_GAINS; gain++)
190 {
191 energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
192 timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
193 }
194 }
195 }
196 iter = GetNextInputBlock();
197 }
198
199 if(fPHOSDAPtr)
200 {
201 // fPHOSDAPtr->FillHistograms(energyArray, timeArray);
202 }
203
204 ResetArrays(energyArray, timeArray);
205
206 //PushBack((TObject*) fCalibDataPtr, AliHLTPHOSDefinitions::fgkEmcCalibDataType, specification);
207
208 return 0;
209}
210
211
212Int_t
213AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
214
215 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0" << endl;
216
217 //://:ShipDataToFXS(
218
219 // see header file for class documentation
220
221 // ** PushBack data to FXS ...
222 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.1" << endl;
223 Char_t filename[200];
224
225 for(int i=0; i < 200; i++)
226 {
227 filename[i] = 0;
228 }
229
230 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.2" << endl;
231
232 fPHOSDAPtr->GetModule();
233
234 sprintf(filename, "PHOS_Module%d_Calib_HLT.root", fPHOSDAPtr->GetModule() );
235 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.3" << endl;
236 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP1" << endl;
237
238 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
239 {
240 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
241 {
242 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP2" << endl;
243 PushToFXS( (TObject*) fPHOSDAPtr->GetHgLgRatioHistogram(x, z), "PHOS", filename);
244 for(Int_t gain = 0; gain < N_GAINS; gain++)
245 {
246 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP3" << endl;
247 PushToFXS( (TObject*) fPHOSDAPtr->GetTimeEnergyHistogram(x, z, gain), "PHOS", filename);
248 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP4" << endl;
249 }
250 }
251 }
252 return 0;
253}
254
255void
256AliHLTPHOSModuleCalibrationProcessorComponent::ResetArrays(Float_t e[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS], Float_t t[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS])
257{
258 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
259 {
260 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
261 {
262 for(Int_t gain = 0; gain < N_GAINS; gain++)
263 {
264 e[x][z][gain] = 0;
265 t[x][z][gain] = 0;
266 }
267 }
268 }
269}