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 **************************************************************************/
18 #include "AliHLTPHOSModuleMergerComponent.h"
19 #include "AliRawReaderMemory.h"
20 #include "AliCaloRawStream.h"
22 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
25 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
26 const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkOutputDataType=kAliHLTVoidDataType;
28 AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent;
30 //_____________________________________________________________________________________________________
31 AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTPHOSProcessor(), fPhosEventCount(0), fEquippmentID(0)
37 //_____________________________________________________________________________________________________
38 AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent()
44 //_____________________________________________________________________________________________________
45 AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTPHOSProcessor(), fPhosEventCount(0), fEquippmentID(0)
51 //_____________________________________________________________________________________________________
53 AliHLTPHOSModuleMergerComponent::Deinit()
59 //_____________________________________________________________________________________________________
61 AliHLTPHOSModuleMergerComponent::DoDeinit()
63 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSModuleMerger DoDeinit");
69 //_____________________________________________________________________________________________________
71 AliHLTPHOSModuleMergerComponent::GetComponentID()
73 return "ModuleMerger";
77 //_____________________________________________________________________________________________________
79 AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
81 const AliHLTComponentDataType* pType=fgkInputDataTypes;
84 list.push_back(*pType);
90 //_____________________________________________________________________________________________________
91 AliHLTComponentDataType
92 AliHLTPHOSModuleMergerComponent::GetOutputDataType()
94 return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
98 //_____________________________________________________________________________________________________
100 AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
108 int AliHLTPHOSModuleMergerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
109 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
110 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
112 //Merging of data from 4 RCUS to one module
115 const AliHLTComponentBlockData* iter = NULL;
116 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr;
120 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
125 int tmpCnt = cellDataPtr->fCnt;
127 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
128 tmpModuleID = cellDataPtr->fModuleID;
129 tmpRcuX = cellDataPtr->fRcuX ;
130 tmpRcuZ = cellDataPtr->fRcuZ;
132 for(int i= 0; i< tmpCnt; tmpCnt ++)
134 if(cellDataPtr->fValidData[i].fGain == HIGH_GAIN)
136 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ZROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX + N_XCOLUMNS_RCU*tmpRcuX][HIGH_GAIN] = cellDataPtr->fValidData[i].fEnergy;
138 else if(cellDataPtr->fValidData[i].fGain == LOW_GAIN)
140 fMaxValues[tmpModuleID][ cellDataPtr->fValidData[i].fZ + N_ROWS_RCU*tmpRcuZ][ cellDataPtr->fValidData[i].fX +N_COLUMNS_RCU*tmpRcuX][LOW_GAIN] = cellDataPtr->fValidData[i].fEnergy;
153 //_____________________________________________________________________________________________________
155 AliHLTPHOSModuleMergerComponent::DoInit( int argc, const char** argv )
157 //See base classs for documenation
160 if (argc==0 && argv==NULL) {
161 // this is currently just to get rid of the warning "unused parameter"
167 //_____________________________________________________________________________________________________
169 AliHLTPHOSModuleMergerComponent::DumpData(int gain)
171 if(gain < 0 || gain > N_GAINS)
173 cout <<"AliHLTPHOSModuleMergerComponent::DumpDat: Error, gain must be between " << 0 << "and" << N_GAINS << endl;
176 for(int mod = 0; mod < N_MODULES; mod ++)
178 if(gain == HIGH_GAIN)
180 cout << endl <<" *********** MODULE" << mod << "****HIGH_GAIN" <<"************" << endl;
182 else if(gain == LOW_GAIN)
184 cout << endl <<" *********** MODULE" << mod << "****LOW_GAIN" <<"************" << endl;
187 for(int row = 0; row < N_ROWS_MOD; row ++)
189 for(int col = 0; col < N_COLUMNS_MOD; col ++)
191 if( fMaxValues[mod][row][col][0] != 0)
193 cout << fMaxValues[mod][row][col][0] << "\t";
202 //_____________________________________________________________________________________________________
204 AliHLTPHOSModuleMergerComponent::Reset()
206 for(int mod = 0; mod < N_MODULES; mod ++)
208 for(int row = 0; row < N_ROWS_MOD; row ++)
210 for(int col = 0; col < N_COLUMNS_MOD; col ++)
212 for(int gain = 0; gain < N_GAINS; gain ++ )
215 fMaxValues[mod][row][col][gain] = 0;
221 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
223 fTmpChannelData[i] = 0;
228 //_____________________________________________________________________________________________________
230 AliHLTPHOSModuleMergerComponent::ResetDataPtr()
232 for(int i = 0 ; i< ALTRO_MAX_SAMPLES; i++)
234 fTmpChannelData[i] = 0;
239 //_____________________________________________________________________________________________________
241 AliHLTPHOSModuleMergerComponent::SetEquippmentId(int id)
247 //_____________________________________________________________________________________________________
249 AliHLTPHOSModuleMergerComponent::GetEquippmentId() const
251 return fEquippmentID;
255 //_____________________________________________________________________________________________________
257 AliHLTPHOSModuleMergerComponent::Spawn()
259 return new AliHLTPHOSModuleMergerComponent;