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