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