1 /**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 #include "AliHLTPHOSModuleMergerComponent.h"
19 #include "AliRawReaderMemory.h"
20 #include "AliCaloRawStream.h"
23 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
26 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
27 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkOutputDataType=kAliHLTVoidDataType;
30 AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent;
31 AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
37 AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent()
43 AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
50 AliHLTPHOSModuleMergerComponent::Deinit()
57 AliHLTPHOSModuleMergerComponent::DoDeinit()
59 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSModuleMerger DoDeinit");
66 AliHLTPHOSModuleMergerComponent::GetComponentID()
68 return "ModuleMerger";
73 AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
76 const AliHLTComponentDataType* pType=fgkInputDataTypes;
79 list.push_back(*pType);
85 AliHLTComponentDataType
86 AliHLTPHOSModuleMergerComponent::GetOutputDataType()
89 return AliHLTPHOSDefinitions::gkCellEnergyDataType;
94 AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
102 int AliHLTPHOSModuleMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
103 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
104 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
106 //Merging of data from 4 RCUS to one module
109 const AliHLTComponentBlockData* iter = NULL;
110 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr;
114 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
119 int tmpCnt = cellDataPtr->fCnt;
121 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
122 tmpModuleID = cellDataPtr->fModuleID;
123 tmpRcuX = cellDataPtr->fRcuX ;
124 tmpRcuZ = cellDataPtr->fRcuZ;
126 for(int i= 0; i< tmpCnt; tmpCnt ++)
128 if(cellDataPtr->fValidData[i].fGain == HIGH_GAIN)
130 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ZROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX + N_XCOLUMNS_RCU*tmpRcuX][HIGH_GAIN] = cellDataPtr->fValidData[i].fEnergy;
132 else if(cellDataPtr->fValidData[i].fGain == LOW_GAIN)
134 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX +N_COLUMNS_RCU*tmpRcuX][LOW_GAIN] = cellDataPtr->fValidData[i].fEnergy;
148 AliHLTPHOSModuleMergerComponent::DoInit( int argc, const char** argv )
150 //See base classs for documenation
153 if (argc==0 && argv==NULL) {
154 // this is currently just to get rid of the warning "unused parameter"
161 AliHLTPHOSModuleMergerComponent::DumpData(int gain)
163 if(gain < 0 || gain > N_GAINS)
165 cout <<"AliHLTPHOSModuleMergerComponent::DumpDat: Error, gain must be between " << 0 << "and" << N_GAINS << endl;
168 for(int mod = 0; mod < N_MODULES; mod ++)
170 if(gain == HIGH_GAIN)
172 cout << endl <<" *********** MODULE" << mod << "****HIGH_GAIN" <<"************" << endl;
174 else if(gain == LOW_GAIN)
176 cout << endl <<" *********** MODULE" << mod << "****LOW_GAIN" <<"************" << endl;
179 for(int row = 0; row < N_ROWS_MOD; row ++)
181 for(int col = 0; col < N_COLUMNS_MOD; col ++)
183 if( fMaxValues[mod][row][col][0] != 0)
185 cout << fMaxValues[mod][row][col][0] << "\t";
195 AliHLTPHOSModuleMergerComponent::Reset()
197 for(int mod = 0; mod < N_MODULES; mod ++)
199 for(int row = 0; row < N_ROWS_MOD; row ++)
201 for(int col = 0; col < N_COLUMNS_MOD; col ++)
203 for(int gain = 0; gain < N_GAINS; gain ++ )
206 fMaxValues[mod][row][col][gain] = 0;
212 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
214 fTmpChannelData[i] = 0;
219 AliHLTPHOSModuleMergerComponent::ResetDataPtr()
221 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
223 fTmpChannelData[i] = 0;
229 AliHLTPHOSModuleMergerComponent::SetEquippmentId(int id)
235 AliHLTPHOSModuleMergerComponent::GetEquippmentId()
237 return fEquippmentID;
242 AliHLTPHOSModuleMergerComponent::Spawn()
244 return new AliHLTPHOSModuleMergerComponent;