]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | // $Id$ |
2 | ||
792f66f1 | 3 | /************************************************************************** |
4 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: Boris Polichtchouk & Per Thomas Hille for the ALICE * | |
7 | * offline/HLT Project. Contributors are mentioned in the code where * | |
8 | * appropriate. * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
0bba8357 | 19 | //#include "AliHLTPHOSRcuCellEnergyDataStruct.h" |
792f66f1 | 20 | #include "AliHLTPHOSRcuHistogramProducer.h" |
21 | #include "AliHLTPHOSRcuHistogramProducerComponent.h" | |
1b486665 | 22 | #include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" |
0bba8357 | 23 | #include "AliHLTPHOSSharedMemoryInterfacev2.h" |
0bba8357 | 24 | #include "AliHLTPHOSChannelDataHeaderStruct.h" |
25 | #include "AliHLTPHOSChannelDataStruct.h" | |
26 | ||
792f66f1 | 27 | |
792f66f1 | 28 | AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent; |
792f66f1 | 29 | /************************************************************************* |
30 | * Class AliHLTPHOSRcuHistogramProducerComponent accumulating histograms * | |
31 | * with amplitudes per PHOS channel * | |
32 | * It is intended to run at the HLT farm * | |
33 | * and it fills the histograms with amplitudes per channel. * | |
34 | * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * | |
35 | **************************************************************************/ | |
b444d727 | 36 | AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent() : AliHLTPHOSRcuProcessor(), |
37 | fHistoWriteFrequency(100), | |
38 | fRcuHistoProducerPtr(0), | |
39 | fOutPtr(0), | |
40 | fShmPtr(0) | |
792f66f1 | 41 | { |
0bba8357 | 42 | fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2(); |
14ff16ed | 43 | //Default constructor |
792f66f1 | 44 | } |
45 | ||
46 | ||
792f66f1 | 47 | AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent() |
48 | { | |
1b486665 | 49 | //Destructor |
792f66f1 | 50 | } |
51 | ||
52 | ||
792f66f1 | 53 | int |
54 | AliHLTPHOSRcuHistogramProducerComponent::Deinit() | |
55 | { | |
1b486665 | 56 | //See html documentation of base class |
792f66f1 | 57 | cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl; |
e304ea31 | 58 | char* arg = new char[9]; |
59 | sprintf(arg, "recreate"); | |
60 | fRcuHistoProducerPtr->WriteAllHistograms(arg); | |
792f66f1 | 61 | return 0; |
62 | } | |
63 | ||
64 | ||
792f66f1 | 65 | const char* |
66 | AliHLTPHOSRcuHistogramProducerComponent::GetComponentID() | |
67 | { | |
1b486665 | 68 | //See html documentation of base class |
792f66f1 | 69 | return "RcuHistogramProducer"; |
70 | } | |
71 | ||
72 | ||
73 | void | |
1b486665 | 74 | AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
792f66f1 | 75 | { |
1b486665 | 76 | //See html documentation of base class |
77 | const AliHLTComponentDataType* pType=fgkInputDataTypes; | |
792f66f1 | 78 | while (pType->fID!=0) |
79 | { | |
80 | list.push_back(*pType); | |
81 | pType++; | |
82 | } | |
83 | } | |
84 | ||
85 | ||
86 | AliHLTComponentDataType | |
87 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataType() | |
88 | { | |
1b486665 | 89 | //See html documentation of base class |
d504c864 | 90 | return AliHLTPHOSDefinitions::fgkCellEnergyDataType; |
792f66f1 | 91 | } |
92 | ||
93 | ||
94 | void | |
95 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
96 | { | |
1b486665 | 97 | //See html documentation of base class |
792f66f1 | 98 | constBase = 30; |
99 | inputMultiplier = 1; | |
100 | } | |
101 | ||
102 | ||
c0b4e7eb | 103 | |
0bba8357 | 104 | int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, const AliHLTComponentBlockData* /*blocks*/, |
b210e538 | 105 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, |
0bba8357 | 106 | AliHLTUInt32_t& /*size*/, vector<AliHLTComponentBlockData>& /*outputBlocks*/ ) |
792f66f1 | 107 | { |
0bba8357 | 108 | /* |
b1a2799f | 109 | |
110 | cout << " AliHLTPHOSRcuHistogramProducerComponent::Doevent, entering event loop" << endl; | |
111 | ||
112 | //See html documentation of base class | |
b444d727 | 113 | |
114 | // trigData++; | |
115 | // trigData--; //shutting up the compiler, we dont use trigData now but will do in near future | |
116 | ||
117 | AliHLTComponentTriggerData &trDta = trigData; | |
118 | trDta.fDataSize++; | |
119 | trDta.fDataSize--; //shutting up the compiler, we dont use trigData now but will do in near future | |
120 | ||
0bba8357 | 121 | // AliHLTPHOSValidCellDataStruct *currentChannel =0; |
122 | ||
123 | AliHLTPHOSChannelDataStruct *currentChannel =0; | |
124 | ||
792f66f1 | 125 | unsigned long ndx = 0; |
126 | UInt_t offset = 0; | |
127 | UInt_t mysize = 0; | |
128 | UInt_t tSize = 0; | |
129 | const AliHLTComponentBlockData* iter = NULL; | |
0bba8357 | 130 | |
792f66f1 | 131 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; |
132 | AliHLTUInt8_t* outBPtr; | |
c0b4e7eb | 133 | |
792f66f1 | 134 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
135 | { | |
b1a2799f | 136 | cout << " AliHLTPHOSRcuHistogramProducerComponent::DoEvent, recieved block" << endl; |
792f66f1 | 137 | iter = blocks+ndx; |
c0b4e7eb | 138 | if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType) |
139 | { | |
b1a2799f | 140 | cout << " AliHLTPHOSRcuHistogramProducerComponent::DoEvent, recieved block of wrong type" << endl; |
141 | cout << "evtData.fSize =" << evtData.fStructSize << "evtData.fBlockCnt =" << evtData.fBlockCnt <<endl ; | |
142 | ||
c0b4e7eb | 143 | continue; |
144 | } | |
14ff16ed | 145 | |
0bba8357 | 146 | cellDataPtr = (AliHLTPHOSChannelDataStruct*)( iter->fPtr); |
14ff16ed | 147 | fShmPtr->SetMemory(cellDataPtr); |
148 | currentChannel = fShmPtr->NextChannel(); | |
7ce40e5c | 149 | |
150 | Int_t* tmpDataPtr = 0; | |
151 | Int_t nSamples = 0; | |
152 | if(cellDataPtr->fHasRawData == true) | |
153 | { | |
154 | while(currentChannel != 0) | |
155 | { | |
156 | tmpDataPtr = fShmPtr->GetRawData(nSamples); | |
157 | fRcuHistoProducerPtr->FillEnergy(currentChannel->fX, currentChannel->fZ, currentChannel->fGain, currentChannel->fEnergy); | |
158 | fRcuHistoProducerPtr->FillLiveChannels(tmpDataPtr, nSamples, currentChannel->fX, currentChannel->fZ,currentChannel->fGain); | |
159 | currentChannel = fShmPtr->NextChannel(); | |
160 | } | |
161 | } | |
162 | else | |
792f66f1 | 163 | { |
7ce40e5c | 164 | |
165 | Logging(kHLTLogFatal, __FILE__ , IntToChar( __LINE__ ) , "AliHLTPHOSRcuHistogramProducerComponent::We are not pushing raw data, aborting"); | |
166 | return -1; | |
792f66f1 | 167 | } |
168 | } | |
14ff16ed | 169 | |
792f66f1 | 170 | outBPtr = outputPtr; |
171 | fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr; | |
172 | const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct &innPtr = fRcuHistoProducerPtr->GetCellAccumulatedEnergies(); | |
792f66f1 | 173 | fOutPtr->fModuleID = fModuleID; |
174 | fOutPtr->fRcuX = fRcuX; | |
175 | fOutPtr->fRcuZ = fRcuZ; | |
176 | ||
27029341 | 177 | for(int x=0; x < NXCOLUMNSRCU; x ++) |
792f66f1 | 178 | { |
27029341 | 179 | for(int z=0; z < NZROWSRCU; z ++) |
792f66f1 | 180 | { |
27029341 | 181 | for(int gain =0; gain < NGAINS; gain ++) |
792f66f1 | 182 | { |
183 | fOutPtr->fAccumulatedEnergies[x][z][gain] = innPtr.fAccumulatedEnergies[x][z][gain]; | |
184 | fOutPtr->fHits[x][z][gain] = innPtr.fHits[x][z][gain]; | |
c0b4e7eb | 185 | fOutPtr->fDeadChannelMap[x][z][gain] = innPtr.fDeadChannelMap[x][z][gain]; |
792f66f1 | 186 | } |
187 | } | |
188 | } | |
189 | ||
792f66f1 | 190 | mysize += sizeof(AliHLTPHOSRcuCellAccumulatedEnergyDataStruct); |
191 | AliHLTComponentBlockData bd; | |
192 | FillBlockData( bd ); | |
193 | bd.fOffset = offset; | |
194 | bd.fSize = mysize; | |
d504c864 | 195 | bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; |
792f66f1 | 196 | bd.fSpecification = 0xFFFFFFFF; |
197 | outputBlocks.push_back( bd ); | |
198 | tSize += mysize; | |
199 | outBPtr += mysize; | |
200 | ||
201 | if( tSize > size ) | |
202 | { | |
203 | Logging( kHLTLogFatal, "HLT::AliHLTRcuHistogramProducerComponent::DoEvent", "Too much data", | |
204 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
205 | , tSize, size ); | |
206 | return EMSGSIZE; | |
207 | } | |
208 | ||
1b486665 | 209 | fPhosEventCount++; |
c0b4e7eb | 210 | |
c0b4e7eb | 211 | if( (fPhosEventCount%fHistoWriteFrequency == 0) && ( fPhosEventCount != 0)) |
c0b4e7eb | 212 | { |
e304ea31 | 213 | char* arg = new char[9]; |
214 | sprintf(arg, "recreate"); | |
215 | fRcuHistoProducerPtr->WriteAllHistograms(arg); | |
c0b4e7eb | 216 | } |
792f66f1 | 217 | return 0; |
0bba8357 | 218 | |
219 | */ | |
b210e538 | 220 | return 0; |
792f66f1 | 221 | }//end DoEvent |
222 | ||
223 | ||
224 | int | |
b210e538 | 225 | AliHLTPHOSRcuHistogramProducerComponent::DoInit( int /*argc*/, const char** /*argv*/ ) |
792f66f1 | 226 | { |
1b486665 | 227 | //See html documentation of base class |
9a2451f1 | 228 | // fPrintInfo = kFALSE; |
792f66f1 | 229 | int iResult=0; |
230 | TString argument=""; | |
9a2451f1 | 231 | |
232 | // iResult = ScanArguments(argc, argv); | |
233 | ||
234 | /* | |
1b486665 | 235 | if(fIsSetEquippmentID == kFALSE) |
792f66f1 | 236 | { |
1b486665 | 237 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", |
238 | "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>"); | |
239 | iResult = -2; | |
792f66f1 | 240 | } |
9a2451f1 | 241 | */ |
242 | ||
243 | ||
244 | //fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ); | |
245 | ||
246 | ||
1b486665 | 247 | return iResult; |
792f66f1 | 248 | |
792f66f1 | 249 | } |
250 | ||
251 | ||
252 | AliHLTComponent* | |
253 | AliHLTPHOSRcuHistogramProducerComponent::Spawn() | |
254 | { | |
1b486665 | 255 | //See html documentation of base class |
792f66f1 | 256 | return new AliHLTPHOSRcuHistogramProducerComponent; |
257 | } | |
258 | ||
259 | ||
14ff16ed | 260 |