]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRcuDAComponent.cxx
- Adding macros for testing the geom trigger
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRcuDAComponent.cxx
CommitLineData
1b41ab20 1// $Id$
2
64357c47 3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
6 * *
7 * Primary Authors: Oystein Djuvsland *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18
64357c47 19#include "AliPHOSRcuDA1.h"
0bba8357 20#include "AliHLTPHOSSharedMemoryInterfacev2.h"
64357c47 21#include "AliHLTPHOSRcuDAComponent.h"
22#include "AliHLTPHOSDefinitions.h"
23#include "AliHLTPHOSConstants.h"
0bba8357 24//#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
64357c47 25#include "TObjArray.h"
9a2451f1 26#include "AliHLTPHOSUtilities.h"
64357c47 27
28//#include <iostream>
29
30/** @file AliHLTPHOSRcuDAComponent.cxx
31 @author Oystein Djuvsland
32 @date
33 @brief A module calibration component for PHOS HLT, using the PHOS DA's
34*/
35
36// see header file for class documentation
37// or
38// refer to README to build package
39// or
40// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
41
42using namespace PhosHLTConst;
43
44AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
45
9a2451f1 46AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() : //AliHLTPHOSRcuProperties(),
64357c47 47 AliHLTCalibrationProcessor(),
6e587e00 48 fPhosEventCount(0),
64357c47 49 fPHOSDAPtr(0),
50 fShmPtr(0)
51 // fTest(-2)
52{
0bba8357 53 fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2();
64357c47 54}
55
56
6e587e00 57
64357c47 58AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
59{
60 if(fShmPtr)
61 {
62 delete fShmPtr;
63 fShmPtr = 0;
64 }
65 if(fPHOSDAPtr)
66 {
67 delete fPHOSDAPtr;
68 fPHOSDAPtr = 0;
69 }
70}
71
72
73void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
74{
75 list.clear();
76 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
77}
78
79
80AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
81{
82 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
83}
84
85
86void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
87{
88 constBase = 0;
89 inputMultiplier = 2;
90}
91
92
93AliHLTComponent*
94AliHLTPHOSRcuDAComponent::Spawn()
95{
96 return new AliHLTPHOSRcuDAComponent();
97}
98
99const char*
100AliHLTPHOSRcuDAComponent::GetComponentID()
101{
102 return "PhosRcuDAProcessor";
103}
104
105
106Int_t
107AliHLTPHOSRcuDAComponent::ScanArgument( Int_t argc, const char** argv)
108{
9a2451f1 109 //CRAP PTH
110 // AliHLTPHOSUtilities::ScanArguments(argc, argv);
111
112
113 return 0;
64357c47 114}
115
116
117Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
118{
64357c47 119 return 0;
120}
121
122
123Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
124{
125 AliHLTComponentEventData dummyEvtData;
126 AliHLTComponentTriggerData dummyTrgData;
127 ShipDataToFXS(dummyEvtData, dummyTrgData);
128
129
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
144
0bba8357 145Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
64357c47 146{
0bba8357 147 /*
64357c47 148 fPhosEventCount ++;
149 const AliHLTComponentEventData eDta = evtData;
150 AliHLTComponentTriggerData tDta = trigData;
151
152 UInt_t specification = 0;
153 const AliHLTComponentBlockData* iter = 0;
154 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
155
156 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
7ce40e5c 157 AliHLTPHOSValidCellDataStruct *currentChannel =0;
64357c47 158 Int_t xOffset = 0;
159 Int_t zOffset = 0;
160 Int_t module = -1;
161
27029341 162 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
163 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
64357c47 164 ResetArrays(energyArray, timeArray);
165
166 while(iter != 0)
167 {
168 specification = specification|iter->fSpecification;
169 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
170 module = cellDataPtr->fModuleID;
27029341 171 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
172 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
64357c47 173
7ce40e5c 174 while(currentChannel != 0)
64357c47 175 {
7ce40e5c 176 Int_t tmpZ = currentChannel->fZ;
177 Int_t tmpX = currentChannel->fX;
178 Int_t tmpGain = currentChannel->fGain;
179
180 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
181 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
64357c47 182 }
7ce40e5c 183
27029341 184// for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
7ce40e5c 185// {
27029341 186// for(Int_t z = 0; z < NZROWSRCU; z++)
7ce40e5c 187// {
27029341 188// for(Int_t gain = 0; gain < NGAINS; gain++)
7ce40e5c 189// {
190// energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
191// timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
192// }
193// }
194// }
64357c47 195 iter = GetNextInputBlock();
196 }
197
198 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
199
200 ResetArrays(energyArray, timeArray);
0bba8357 201 */
64357c47 202 return 0;
203}
204
205
206Int_t
207AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
208{
209 Char_t filename[200];
210
211 for(int i=0; i < 200; i++)
212 {
213 filename[i] = 0;
214 }
215 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
216 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
217 TFile *outFile = new TFile(filename, "recreate");
218 calibPtr->Write();
219 outFile->Close();
220 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename);
221 cout << "Finnished pushing data to HLT FXS" << endl;
222 return 0;
223}
224
225
226void
27029341 227AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
64357c47 228{
27029341 229 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
64357c47 230 {
27029341 231 for(Int_t z = 0; z < NZROWSRCU; z++)
64357c47 232 {
27029341 233 for(Int_t gain = 0; gain < NGAINS; gain++)
64357c47 234 {
235 e[x][z][gain] = 0;
236 t[x][z][gain] = 0;
237 }
238 }
239 }
240}