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"
22 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
25 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
26 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::outputDataType=kAliHLTVoidDataType;
29 AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent;
30 AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
36 AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent()
42 AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
49 AliHLTPHOSModuleMergerComponent::Deinit()
56 AliHLTPHOSModuleMergerComponent::DoDeinit()
58 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSModuleMerger DoDeinit");
65 AliHLTPHOSModuleMergerComponent::GetComponentID()
67 return "ModuleMerger";
72 AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
74 const AliHLTComponentDataType* pType=inputDataTypes;
77 list.push_back(*pType);
83 AliHLTComponentDataType
84 AliHLTPHOSModuleMergerComponent::GetOutputDataType()
86 return AliHLTPHOSDefinitions::gkCellEnergyDataType;
91 AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
98 int AliHLTPHOSModuleMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
99 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
100 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
104 const AliHLTComponentBlockData* iter = NULL;
105 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr;
109 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
114 int tmpCnt = cellDataPtr->fCnt;
116 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
117 tmpModuleID = cellDataPtr->fModuleID;
118 tmpRcuX = cellDataPtr->fRcuX ;
119 tmpRcuZ = cellDataPtr->fRcuZ;
121 for(int i= 0; i< tmpCnt; tmpCnt ++)
123 if(cellDataPtr->fValidData[i].fGain == HIGH_GAIN)
125 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fRow + N_ROWS_RCU*tmpRcuX][ cellDataPtr->fValidData[i].fCol + N_COLUMNS_RCU*tmpRcuZ][HIGH_GAIN] = cellDataPtr->fValidData[i].fEnergy;
126 // fMaxValues[0][0][0][0] = 0;
128 else if(cellDataPtr->fValidData[i].fGain == LOW_GAIN)
130 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fRow + N_ROWS_RCU*tmpRcuX][ cellDataPtr->fValidData[i].fCol +N_COLUMNS_RCU*tmpRcuZ][LOW_GAIN] = cellDataPtr->fValidData[i].fEnergy;
131 // fMaxValues[0][0][0][0]=0;
145 AliHLTPHOSModuleMergerComponent::DoInit( int argc, const char** argv )
149 if (argc==0 && argv==NULL) {
150 // this is currently just to get rid of the warning "unused parameter"
157 AliHLTPHOSModuleMergerComponent::DumpData(int gain)
160 if(gain < 0 || gain > N_GAINS)
162 cout <<"AliHLTPHOSModuleMergerComponent::DumpDat: Error, gain must be between " << 0 << "and" << N_GAINS << endl;
165 for(int mod = 0; mod < N_MODULES; mod ++)
167 if(gain == HIGH_GAIN)
169 cout << endl <<" *********** MODULE" << mod << "****HIGH_GAIN" <<"************" << endl;
171 else if(gain == LOW_GAIN)
173 cout << endl <<" *********** MODULE" << mod << "****LOW_GAIN" <<"************" << endl;
176 for(int row = 0; row < N_ROWS_MOD; row ++)
178 for(int col = 0; col < N_COLUMNS_MOD; col ++)
180 if( fMaxValues[mod][row][col][0] != 0)
182 cout << fMaxValues[mod][row][col][0] << "\t";
192 AliHLTPHOSModuleMergerComponent::Reset()
194 for(int mod = 0; mod < N_MODULES; mod ++)
196 for(int row = 0; row < N_ROWS_MOD; row ++)
198 for(int col = 0; col < N_COLUMNS_MOD; col ++)
200 for(int gain = 0; gain < N_GAINS; gain ++ )
203 fMaxValues[mod][row][col][gain] = 0;
209 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
211 fTmpChannelData[i] = 0;
216 AliHLTPHOSModuleMergerComponent::ResetDataPtr()
218 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
220 fTmpChannelData[i] = 0;
226 AliHLTPHOSModuleMergerComponent::SetEquippmentId(int id)
232 AliHLTPHOSModuleMergerComponent::GetEquippmentId()
234 return fEquippmentID;
239 AliHLTPHOSModuleMergerComponent::Spawn()
241 return new AliHLTPHOSModuleMergerComponent;