]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | // $Id$ |
2 | ||
9d05c97d | 3 | /************************************************************************** |
4 | * This file is property of and copyright by the Experimental Nuclear * | |
5 | * Physics Group, Dep. of Physics * | |
6 | * University of Oslo, Norway, 2007 * | |
7 | * * | |
8 | * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.* | |
9 | * Contributors are mentioned in the code where appropriate. * | |
10 | * Please report bugs to perthi@fys.uio.no * | |
11 | * * | |
12 | * Permission to use, copy, modify and distribute this software and its * | |
13 | * documentation strictly for non-commercial purposes is hereby granted * | |
14 | * without fee, provided that the above copyright notice appears in all * | |
15 | * copies and that both the copyright notice and this permission notice * | |
16 | * appear in the supporting documentation. The authors make no claims * | |
17 | * about the suitability of this software for any purpose. It is * | |
18 | * provided "as is" without express or implied warranty. * | |
19 | **************************************************************************/ | |
20 | #include "AliHLTPHOSFourierComponent.h" | |
21 | #include "AliHLTPHOSFourier.h" | |
22 | #include "AliHLTPHOSValidCellDataStruct.h" | |
23 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" | |
24 | #include "AliHLTPHOSSharedMemoryInterface.h" | |
25 | ||
26 | #include "AliHLTPHOSRcuFFTDataStruct.h" | |
27 | ||
28 | AliHLTPHOSFourierComponent gAliHLTPHOSFourierComponent; | |
29 | ||
30 | AliHLTPHOSFourierComponent::AliHLTPHOSFourierComponent(): AliHLTPHOSRcuProcessor(),fFourierPtr(0), fShmPtr(0),fOutPtr(0) | |
31 | { | |
32 | fFourierPtr = new AliHLTPHOSFourier(); | |
33 | fShmPtr = new AliHLTPHOSSharedMemoryInterface(); | |
34 | } | |
35 | ||
36 | ||
37 | AliHLTPHOSFourierComponent::~AliHLTPHOSFourierComponent() | |
38 | { | |
39 | ||
40 | } | |
41 | ||
42 | ||
43 | int | |
44 | AliHLTPHOSFourierComponent::Deinit() | |
45 | { | |
46 | Logging(kHLTLogInfo, "HLT", "PHOS", ",Deinitializing AliHLTPHOSFourierComponent"); | |
47 | return 0; | |
48 | } | |
49 | ||
50 | ||
51 | const char* | |
52 | AliHLTPHOSFourierComponent::GetComponentID() | |
53 | { | |
54 | return "PhosFourier"; | |
55 | // "PhosFourier" | |
56 | } | |
57 | ||
58 | ||
59 | AliHLTComponent* | |
60 | AliHLTPHOSFourierComponent::Spawn() | |
61 | ||
62 | { | |
63 | return new AliHLTPHOSFourierComponent; | |
64 | } | |
65 | ||
66 | ||
67 | void | |
68 | AliHLTPHOSFourierComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
69 | { | |
b1a2799f | 70 | list.clear(); |
71 | list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType); | |
72 | ||
73 | /* | |
9d05c97d | 74 | const AliHLTComponentDataType* pType=fgkInputDataTypes; |
75 | ||
76 | while (pType->fID!=0) | |
77 | { | |
78 | list.push_back(*pType); | |
79 | pType++; | |
80 | } | |
b1a2799f | 81 | */ |
9d05c97d | 82 | } |
83 | ||
84 | ||
85 | AliHLTComponentDataType | |
86 | AliHLTPHOSFourierComponent::GetOutputDataType() | |
87 | { | |
88 | return AliHLTPHOSDefinitions::fgkFourierTransform; | |
89 | // return AliHLTPHOSDefinitions::fgkCellEnergyDataType; | |
90 | // return kAliHLTMultipleDataType; | |
91 | } | |
92 | ||
93 | ||
94 | /* | |
95 | int | |
96 | AliHLTPHOSFourierComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
97 | { | |
98 | tgtList.clear(); | |
99 | tgtList.push_back(AliHLTPHOSDefinitions::fgkFourierTransform); | |
100 | // tgtList.push_back(kAliHLTDataTypeHwAddr16); | |
101 | return tgtList.size(); | |
102 | } | |
103 | */ | |
104 | ||
105 | ||
106 | ||
107 | void | |
8394d59f | 108 | AliHLTPHOSFourierComponent::GetOutputDataSize(unsigned long& /*constBase*/, double& inputMultiplier) |
9d05c97d | 109 | { |
110 | // constBase =1; | |
111 | // inputMultiplier = 1; | |
112 | // constBase = 30; | |
113 | // inputMultiplier = 1.2; | |
114 | inputMultiplier = 0.1; | |
115 | } | |
116 | ||
117 | int | |
118 | AliHLTPHOSFourierComponent::DoInit(int /*argc*/, const char** /*argv*/) | |
119 | { | |
120 | cout << "AliHLTPHOSFourierComponent::DoInit !!!!!!!!!! " << endl; | |
121 | return 0; | |
122 | } | |
123 | ||
124 | /* | |
125 | int | |
126 | AliHLTPHOSFourierComponent::DoDeinit() | |
127 | { | |
128 | ||
129 | } | |
130 | */ | |
131 | ||
132 | int | |
133 | AliHLTPHOSFourierComponent::DoEvent(const AliHLTComponentEventData& evtData, | |
134 | const AliHLTComponentBlockData* blocks, | |
135 | AliHLTComponentTriggerData& /*trigData*/, | |
136 | AliHLTUInt8_t* outputPtr, | |
137 | AliHLTUInt32_t& size, | |
138 | AliHLTComponentBlockDataList& outputBlocks ) | |
139 | { | |
140 | fPhosEventCount ++; | |
141 | AliHLTPHOSValidCellDataStruct *currentChannel =0; | |
142 | UInt_t offset = 0; | |
143 | UInt_t mysize = 0; | |
144 | UInt_t tSize = 0; | |
145 | const AliHLTComponentBlockData* iter = NULL; | |
146 | unsigned long ndx; | |
147 | UInt_t specification = 0; | |
148 | ||
149 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
150 | { | |
151 | iter = blocks+ndx; | |
b1a2799f | 152 | |
9d05c97d | 153 | if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType) |
154 | { | |
155 | ||
156 | continue; | |
157 | } | |
158 | ||
159 | specification = specification|iter->fSpecification; | |
160 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
161 | AliHLTPHOSRcuFFTDataStruct *fourierOutPtr = (AliHLTPHOSRcuFFTDataStruct*)outputPtr; | |
162 | fShmPtr->SetMemory(cellDataPtr); | |
163 | currentChannel = fShmPtr->NextChannel(); | |
164 | ||
165 | while(currentChannel != 0) | |
166 | { | |
167 | Int_t *data; | |
168 | Int_t nsamples = 0; | |
169 | data= fShmPtr->GetRawData(nsamples); | |
1283c2be | 170 | fFourierPtr->ProcessFourier(data, nsamples, currentChannel->fZ, currentChannel->fX, currentChannel->fGain ); |
9d05c97d | 171 | currentChannel = fShmPtr->NextChannel(); |
172 | } | |
173 | ||
174 | *fourierOutPtr = fFourierPtr->GetPSD(); | |
175 | ||
176 | for(int i=0; i < 500; i++) | |
177 | { | |
178 | if(i%16 == 0) | |
179 | { | |
180 | printf("\n"); | |
181 | } | |
182 | ||
183 | cout << fourierOutPtr->fGlobalAccumulatedPSD[1][i] << "\t"; | |
184 | } | |
185 | ||
186 | mysize += sizeof(AliHLTPHOSRcuFFTDataStruct); | |
187 | AliHLTComponentBlockData bd; | |
188 | bd.fOffset = offset; | |
189 | bd.fSize = mysize; | |
190 | bd.fDataType = AliHLTPHOSDefinitions::fgkFourierTransform; | |
191 | // bd.fSpecification = 0xFFFFFFFF; | |
b1a2799f | 192 | // bd.fSpecification = specification; |
193 | bd.fSpecification = 1; | |
9d05c97d | 194 | outputBlocks.push_back( bd ); |
195 | ||
9d05c97d | 196 | |
c512615c | 197 | |
694c364e | 198 | |
c512615c | 199 | cout <<"size left is "<< size <<" FourierComponenet: offset ="<< offset << "mysize =" << mysize << "specification =" << specification <<endl; |
9d05c97d | 200 | tSize += mysize; |
201 | ||
202 | outputPtr += mysize; | |
203 | ||
204 | if( tSize > size ) | |
205 | { | |
206 | cout <<"HLT::AliHLTFourierComponent::DoEvent Too much data Data written over allowed buffer. Amount written:"<< tSize<<"allowed amount"<< size << endl; | |
207 | Logging( kHLTLogFatal, "HLT::AliHLTFourierComponent::DoEvent", "Too much data", | |
208 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." , tSize, size ); | |
209 | ||
210 | return EMSGSIZE; | |
211 | } | |
212 | ||
213 | } | |
214 | ||
215 | return 0; | |
216 | ||
217 | } |