]>
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 | **************************************************************************/ | |
c0b4e7eb | 37 | AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent():AliHLTPHOSRcuProcessor(), fRcuHistoProducerPtr(0), fHistoWriteFrequency(100) |
792f66f1 | 38 | { |
1b486665 | 39 | //Default constructor |
792f66f1 | 40 | } |
41 | ||
42 | ||
792f66f1 | 43 | AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent() |
44 | { | |
1b486665 | 45 | //Destructor |
792f66f1 | 46 | } |
47 | ||
48 | ||
792f66f1 | 49 | int |
50 | AliHLTPHOSRcuHistogramProducerComponent::Deinit() | |
51 | { | |
1b486665 | 52 | //See html documentation of base class |
792f66f1 | 53 | cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl; |
c0b4e7eb | 54 | // fRcuHistoProducerPtr->WriteAllHistograms("update"); |
55 | fRcuHistoProducerPtr->WriteAllHistograms("recreate"); | |
792f66f1 | 56 | return 0; |
57 | } | |
58 | ||
59 | ||
792f66f1 | 60 | const char* |
61 | AliHLTPHOSRcuHistogramProducerComponent::GetComponentID() | |
62 | { | |
1b486665 | 63 | //See html documentation of base class |
792f66f1 | 64 | return "RcuHistogramProducer"; |
65 | } | |
66 | ||
67 | ||
68 | void | |
1b486665 | 69 | AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
792f66f1 | 70 | { |
1b486665 | 71 | //See html documentation of base class |
72 | const AliHLTComponentDataType* pType=fgkInputDataTypes; | |
792f66f1 | 73 | while (pType->fID!=0) |
74 | { | |
75 | list.push_back(*pType); | |
76 | pType++; | |
77 | } | |
78 | } | |
79 | ||
80 | ||
81 | AliHLTComponentDataType | |
82 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataType() | |
83 | { | |
1b486665 | 84 | //See html documentation of base class |
d504c864 | 85 | return AliHLTPHOSDefinitions::fgkCellEnergyDataType; |
792f66f1 | 86 | } |
87 | ||
88 | ||
89 | void | |
90 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
91 | { | |
1b486665 | 92 | //See html documentation of base class |
792f66f1 | 93 | constBase = 30; |
94 | inputMultiplier = 1; | |
95 | } | |
96 | ||
97 | ||
c0b4e7eb | 98 | |
792f66f1 | 99 | int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
100 | AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
101 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) | |
102 | { | |
c0b4e7eb | 103 | // cout << "AliHLTPHOSRcuHistogramProducerComponent::DoEven TP0" << endl; |
104 | ||
1b486665 | 105 | //See html documentation of base class |
792f66f1 | 106 | unsigned long ndx = 0; |
107 | UInt_t offset = 0; | |
108 | UInt_t mysize = 0; | |
109 | UInt_t tSize = 0; | |
110 | const AliHLTComponentBlockData* iter = NULL; | |
111 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; | |
112 | AliHLTUInt8_t* outBPtr; | |
792f66f1 | 113 | int tmpCnt; |
c0b4e7eb | 114 | |
792f66f1 | 115 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
116 | { | |
117 | iter = blocks+ndx; | |
c0b4e7eb | 118 | if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType) |
119 | { | |
120 | // cout << "Warning: data type is not fgkCellEnergyDataType " << endl; | |
121 | continue; | |
122 | } | |
123 | ||
124 | ||
125 | cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
792f66f1 | 126 | tmpCnt = cellDataPtr->fCnt; |
c0b4e7eb | 127 | |
128 | for(int i= 0; i < tmpCnt; i ++) | |
792f66f1 | 129 | { |
130 | fRcuHistoProducerPtr->FillEnergy(cellDataPtr->fValidData[i].fX, | |
c0b4e7eb | 131 | cellDataPtr->fValidData[i].fZ, |
792f66f1 | 132 | cellDataPtr->fValidData[i].fGain, |
133 | cellDataPtr->fValidData[i].fEnergy); | |
03b3d247 | 134 | |
c0b4e7eb | 135 | fRcuHistoProducerPtr->FillLiveChannels(cellDataPtr->fValidData[i].fData, |
136 | fNTotalSamples, | |
137 | cellDataPtr->fValidData[i].fX, | |
138 | cellDataPtr->fValidData[i].fZ, | |
139 | cellDataPtr->fValidData[i].fGain); | |
792f66f1 | 140 | } |
141 | } | |
c0b4e7eb | 142 | // cout << "Done filling\n"; |
c37f821f | 143 | |
792f66f1 | 144 | outBPtr = outputPtr; |
145 | fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr; | |
146 | const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct &innPtr = fRcuHistoProducerPtr->GetCellAccumulatedEnergies(); | |
792f66f1 | 147 | fOutPtr->fModuleID = fModuleID; |
148 | fOutPtr->fRcuX = fRcuX; | |
149 | fOutPtr->fRcuZ = fRcuZ; | |
150 | ||
151 | ||
152 | for(int x=0; x < N_XCOLUMNS_RCU; x ++) | |
153 | { | |
c37f821f | 154 | for(int z=0; z < N_ZROWS_RCU; z ++) |
792f66f1 | 155 | { |
156 | for(int gain =0; gain < N_GAINS; gain ++) | |
157 | { | |
158 | fOutPtr->fAccumulatedEnergies[x][z][gain] = innPtr.fAccumulatedEnergies[x][z][gain]; | |
159 | fOutPtr->fHits[x][z][gain] = innPtr.fHits[x][z][gain]; | |
c0b4e7eb | 160 | fOutPtr->fDeadChannelMap[x][z][gain] = innPtr.fDeadChannelMap[x][z][gain]; |
792f66f1 | 161 | } |
162 | } | |
163 | } | |
164 | ||
165 | ||
c0b4e7eb | 166 | // cout << "AliHLTPHOSRcuHistogramProducerComponent::DoEven TP1" << endl; |
792f66f1 | 167 | //pushing data to shared output memory |
c0b4e7eb | 168 | |
792f66f1 | 169 | mysize += sizeof(AliHLTPHOSRcuCellAccumulatedEnergyDataStruct); |
170 | AliHLTComponentBlockData bd; | |
171 | FillBlockData( bd ); | |
172 | bd.fOffset = offset; | |
173 | bd.fSize = mysize; | |
d504c864 | 174 | bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; |
792f66f1 | 175 | bd.fSpecification = 0xFFFFFFFF; |
176 | outputBlocks.push_back( bd ); | |
177 | tSize += mysize; | |
178 | outBPtr += mysize; | |
c0b4e7eb | 179 | |
180 | // cout << "AliHLTPHOSRcuHistogramProducerComponent::DoEven TP2" << endl; | |
181 | ||
792f66f1 | 182 | |
183 | if( tSize > size ) | |
184 | { | |
185 | Logging( kHLTLogFatal, "HLT::AliHLTRcuHistogramProducerComponent::DoEvent", "Too much data", | |
186 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
187 | , tSize, size ); | |
188 | return EMSGSIZE; | |
189 | } | |
190 | ||
1b486665 | 191 | fPhosEventCount++; |
c0b4e7eb | 192 | |
193 | ||
194 | if( (fPhosEventCount%fHistoWriteFrequency == 0) && ( fPhosEventCount != 0)) | |
195 | //if( (fPhosEventCount%fHistoWriteFrequency == 0)) | |
196 | { | |
197 | cout << "AliHLTPHOSRcuHistogramProducerComponent::DoEvent, updating histograms " << endl; | |
198 | fRcuHistoProducerPtr->WriteAllHistograms("recreate"); | |
199 | } | |
200 | ||
792f66f1 | 201 | return 0; |
c0b4e7eb | 202 | |
1b486665 | 203 | |
792f66f1 | 204 | }//end DoEvent |
205 | ||
206 | ||
207 | int | |
208 | AliHLTPHOSRcuHistogramProducerComponent::DoInit( int argc, const char** argv ) | |
209 | { | |
1b486665 | 210 | //See html documentation of base class |
211 | fPrintInfo = kFALSE; | |
792f66f1 | 212 | int iResult=0; |
213 | TString argument=""; | |
1b486665 | 214 | iResult = ScanArguments(argc, argv); |
1b486665 | 215 | if(fIsSetEquippmentID == kFALSE) |
792f66f1 | 216 | { |
1b486665 | 217 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", |
218 | "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>"); | |
219 | iResult = -2; | |
792f66f1 | 220 | } |
1b486665 | 221 | fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ); |
1b486665 | 222 | return iResult; |
792f66f1 | 223 | |
792f66f1 | 224 | } |
225 | ||
226 | ||
227 | AliHLTComponent* | |
228 | AliHLTPHOSRcuHistogramProducerComponent::Spawn() | |
229 | { | |
1b486665 | 230 | //See html documentation of base class |
792f66f1 | 231 | return new AliHLTPHOSRcuHistogramProducerComponent; |
232 | } | |
233 | ||
234 |