]>
Commit | Line | Data |
---|---|---|
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" | |
4f4b7ba4 | 23 | #include "AliHLTPHOSConstant.h" |
0bba8357 | 24 | //#include "AliHLTPHOSRcuCellEnergyDataStruct.h" |
64357c47 | 25 | #include "TObjArray.h" |
9a2451f1 | 26 | #include "AliHLTPHOSUtilities.h" |
8d53dca2 | 27 | #include "AliHLTReadoutList.h" |
64357c47 | 28 | |
29 | //#include <iostream> | |
30 | ||
31 | /** @file AliHLTPHOSRcuDAComponent.cxx | |
32 | @author Oystein Djuvsland | |
33 | @date | |
34 | @brief A module calibration component for PHOS HLT, using the PHOS DA's | |
35 | */ | |
36 | ||
37 | // see header file for class documentation | |
38 | // or | |
39 | // refer to README to build package | |
40 | // or | |
41 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
42 | ||
43 | using namespace PhosHLTConst; | |
44 | ||
45 | AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent; | |
46 | ||
4f4b7ba4 | 47 | AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() : |
48 | //AliHLTPHOSRcuProperties(), | |
49 | AliHLTCalibrationProcessor(), | |
50 | fPhosEventCount(0), | |
51 | fPHOSDAPtr(0), | |
52 | fShmPtr(0) | |
53 | // fTest(-2) | |
64357c47 | 54 | { |
0bba8357 | 55 | fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2(); |
64357c47 | 56 | } |
57 | ||
58 | ||
6e587e00 | 59 | |
64357c47 | 60 | AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent() |
61 | { | |
62 | if(fShmPtr) | |
63 | { | |
64 | delete fShmPtr; | |
65 | fShmPtr = 0; | |
66 | } | |
67 | if(fPHOSDAPtr) | |
68 | { | |
69 | delete fPHOSDAPtr; | |
70 | fPHOSDAPtr = 0; | |
71 | } | |
72 | } | |
73 | ||
74 | ||
75 | void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list) | |
76 | { | |
77 | list.clear(); | |
78 | list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType); | |
79 | } | |
80 | ||
81 | ||
82 | AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType() | |
83 | { | |
84 | return AliHLTPHOSDefinitions::fgkEmcCalibDataType; | |
85 | } | |
86 | ||
87 | ||
88 | void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
89 | { | |
90 | constBase = 0; | |
91 | inputMultiplier = 2; | |
92 | } | |
93 | ||
94 | ||
95 | AliHLTComponent* | |
96 | AliHLTPHOSRcuDAComponent::Spawn() | |
97 | { | |
98 | return new AliHLTPHOSRcuDAComponent(); | |
99 | } | |
100 | ||
101 | const char* | |
102 | AliHLTPHOSRcuDAComponent::GetComponentID() | |
103 | { | |
104 | return "PhosRcuDAProcessor"; | |
105 | } | |
106 | ||
107 | ||
108 | Int_t | |
b210e538 | 109 | AliHLTPHOSRcuDAComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/) |
64357c47 | 110 | { |
9a2451f1 | 111 | //CRAP PTH |
112 | // AliHLTPHOSUtilities::ScanArguments(argc, argv); | |
113 | ||
114 | ||
115 | return 0; | |
64357c47 | 116 | } |
117 | ||
118 | ||
119 | Int_t AliHLTPHOSRcuDAComponent::InitCalibration() | |
120 | { | |
64357c47 | 121 | return 0; |
122 | } | |
123 | ||
124 | ||
125 | Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration() | |
126 | { | |
127 | AliHLTComponentEventData dummyEvtData; | |
128 | AliHLTComponentTriggerData dummyTrgData; | |
129 | ShipDataToFXS(dummyEvtData, dummyTrgData); | |
130 | ||
131 | ||
132 | if(fShmPtr) | |
133 | { | |
134 | delete fShmPtr; | |
135 | fShmPtr = 0; | |
136 | } | |
137 | if(fPHOSDAPtr) | |
138 | { | |
139 | delete fPHOSDAPtr; | |
140 | fPHOSDAPtr = 0; | |
141 | } | |
142 | return 0; | |
143 | } | |
144 | ||
145 | ||
146 | ||
0bba8357 | 147 | Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/) |
64357c47 | 148 | { |
0bba8357 | 149 | /* |
64357c47 | 150 | fPhosEventCount ++; |
151 | const AliHLTComponentEventData eDta = evtData; | |
152 | AliHLTComponentTriggerData tDta = trigData; | |
153 | ||
154 | UInt_t specification = 0; | |
155 | const AliHLTComponentBlockData* iter = 0; | |
156 | iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS); | |
157 | ||
158 | AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0; | |
7ce40e5c | 159 | AliHLTPHOSValidCellDataStruct *currentChannel =0; |
64357c47 | 160 | Int_t xOffset = 0; |
161 | Int_t zOffset = 0; | |
162 | Int_t module = -1; | |
163 | ||
27029341 | 164 | Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS]; |
165 | Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS]; | |
64357c47 | 166 | ResetArrays(energyArray, timeArray); |
167 | ||
168 | while(iter != 0) | |
169 | { | |
170 | specification = specification|iter->fSpecification; | |
171 | cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
172 | module = cellDataPtr->fModuleID; | |
27029341 | 173 | xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU; |
174 | zOffset = cellDataPtr->fRcuZ*NZROWSRCU; | |
64357c47 | 175 | |
7ce40e5c | 176 | while(currentChannel != 0) |
64357c47 | 177 | { |
7ce40e5c | 178 | Int_t tmpZ = currentChannel->fZ; |
179 | Int_t tmpX = currentChannel->fX; | |
180 | Int_t tmpGain = currentChannel->fGain; | |
181 | ||
182 | energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy; | |
183 | timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime; | |
64357c47 | 184 | } |
7ce40e5c | 185 | |
27029341 | 186 | // for(Int_t x = 0; x < NXCOLUMNSRCU; x++) |
7ce40e5c | 187 | // { |
27029341 | 188 | // for(Int_t z = 0; z < NZROWSRCU; z++) |
7ce40e5c | 189 | // { |
27029341 | 190 | // for(Int_t gain = 0; gain < NGAINS; gain++) |
7ce40e5c | 191 | // { |
192 | // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy; | |
193 | // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime; | |
194 | // } | |
195 | // } | |
196 | // } | |
64357c47 | 197 | iter = GetNextInputBlock(); |
198 | } | |
199 | ||
200 | fPHOSDAPtr->FillHistograms(energyArray, timeArray); | |
201 | ||
202 | ResetArrays(energyArray, timeArray); | |
0bba8357 | 203 | */ |
64357c47 | 204 | return 0; |
205 | } | |
206 | ||
207 | ||
208 | Int_t | |
209 | AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) | |
210 | { | |
211 | Char_t filename[200]; | |
212 | ||
213 | for(int i=0; i < 200; i++) | |
214 | { | |
215 | filename[i] = 0; | |
216 | } | |
217 | const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer(); | |
218 | sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() ); | |
219 | TFile *outFile = new TFile(filename, "recreate"); | |
220 | calibPtr->Write(); | |
221 | outFile->Close(); | |
8d53dca2 | 222 | static AliHLTReadoutList rdList(AliHLTReadoutList::kPHOS); |
223 | PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename, rdList.Buffer()); | |
64357c47 | 224 | cout << "Finnished pushing data to HLT FXS" << endl; |
225 | return 0; | |
226 | } | |
227 | ||
228 | ||
229 | void | |
27029341 | 230 | AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS]) |
64357c47 | 231 | { |
27029341 | 232 | for(Int_t x = 0; x < NXCOLUMNSRCU; x++) |
64357c47 | 233 | { |
27029341 | 234 | for(Int_t z = 0; z < NZROWSRCU; z++) |
64357c47 | 235 | { |
27029341 | 236 | for(Int_t gain = 0; gain < NGAINS; gain++) |
64357c47 | 237 | { |
238 | e[x][z][gain] = 0; | |
239 | t[x][z][gain] = 0; | |
240 | } | |
241 | } | |
242 | } | |
243 | } |