* provided "as is" without express or implied warranty. *
**************************************************************************/
-//#include "AliHLTPHOSModuleMergerComponent.h"
-
#include "AliHLTPHOSModuleMergerComponent.h"
#include <iostream>
#include "stdio.h"
-
#include "AliRawReaderMemory.h"
#include "AliCaloRawStream.h"
#include <cstdlib>
-//#include "TH2.h"
+#include "AliHLTPHOSRcuCellEnergyData.h"
-//#include "AliHLTTPCDefinitions.h"
const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::outputDataType=kAliHLTVoidDataType;
AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent;
-//ClassImp( AliHLTPHOSModuleMergerComponent)
AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0)
{
AliHLTComponentDataType
AliHLTPHOSModuleMergerComponent::GetOutputDataType()
{
- // return AliHLTPHOSDefinitions::gkUnpackedRawDataType;
return AliHLTPHOSDefinitions::gkCellEnergyDataType;
- // return outputDataType;
-
- }
+}
void
AliHLTPHOSModuleMergerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
{
unsigned long ndx;
const AliHLTComponentBlockData* iter = NULL;
-
- // cout << "Inside AliHLTPHOSModuleMergerComponent::DoEvent" << endl;
- // AliHLTUInt32_t *tmp =
- // cout << " AliHLTPHOSModuleMergerComponen: the size of ouputblocks is " << outputBlocks.size() <<endl;
- // cout << " AliHLTPHOSModuleMergerComponen: the size of inputblock is " << blocks->fSize <<endl;
- // cout << " AliHLTPHOSModuleMergerComponen: the size " << size <<endl;
-
- // cout << "AliHLTPHOSModuleMergerComponen: evtData fStructSize = "<< evtData.fStructSize<<endl;
- // cout << "AliHLTPHOSModuleMergerComponen: evtData EventID = "<< evtData.fEventID<<endl;
- // cout << "AliHLTPHOSModuleMergerComponen: evtData block count = "<< evtData.fBlockCnt<<endl;
- for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
- {
- iter = blocks+ndx;
- // iter = ndx;
-
- AliHLTUInt32_t *tmpPtr = reinterpret_cast<AliHLTUInt32_t*>( iter->fPtr);
-
- //
- // if( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType )
- // {
- // cout << "Warning: data type = is nOT gkDDLPackedRawDataType " << endl;
- // continue;
- // }
-
-
- if (iter->fDataType == kAliHLTVoidDataType){ cout << "ModuleMerger: datatype is kAliHLTVoidDataType :" << endl;}
- if (iter->fDataType == kAliHLTAnyDataType){ cout << "ModuleMerger: datatype is kAliHLTAnyDataType :" << endl;}
- if (iter->fDataType == AliHLTPHOSDefinitions::gkDDLPackedRawDataType){ cout << "ModuleMerger: datatType is : AliHLTPHOSDefinitions::gkDDLPackedRawDataType :" << endl;}
- if (iter->fDataType == AliHLTPHOSDefinitions::gkCellEnergyDataType){ cout << "ModuleMerger: datatype isAliHLTPHOSDefinitions::gkCellEnergyDataType" << endl;}
-
- // if (iter->fDataType == AliHLTPHOSDefinitions::gkPackedRawDataType){ cout << "ModuleMerger: datatype is: AliHLTPHOSDefinitions::gkPackedRawDataType" << endl;}
- // if (iter->fDataType == AliHLTPHOSDefinitions::gkUnpackedRawDataType){ cout << "ModuleMerger: datatype is: AliHLTPHOSDefinitions::gkUnpackedRawDataType" << endl;}
- // if (iter->fDataType == AliHLTPHOSDefinitions::gkClustersDataType){ cout << "ModuleMerger: datatype is: AliHLTPHOSDefinitions::gkClustersDataType" << endl;}
- // if (iter->fDataType == AliHLTPHOSDefinitions::gkVertexDataType){ cout << "ModuleMerger: datatype is: AliHLTPHOSDefinitions::gkVertexDataTypeg" << endl;}
- // if (iter->fDataType == AliHLTPHOSDefinitions::gkTrackSegmentsDataType){ cout << "ModuleMerger: datatype is: AliHLTPHOSDefinitions::gkTrackSegmentsDataTypeg" << endl;}
+ AliHLTPHOSRcuCellEnergyData *cellDataPtr;
- }
-
-
-
- cout << "blocks.fSize = " << blocks->fSize << endl ;
-
- // AliHLTUInt32_t* tmpPtr = reinterpret_cast<AliHLTUInt32_t*>(blocks->fPtr);
+ Reset();
- AliHLTUInt32_t* tmpPtr = (AliHLTUInt32_t*)(blocks->fPtr);
- // *tmpPtr = 100;
+ for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+ {
+ int tmpModuleID = 0;
+ int tmpRcuX = 0;
+ int tmpRcuZ = 0;
+ iter = blocks+ndx;
+ AliHLTPHOSRcuCellEnergyData *cellDataPtr = (AliHLTPHOSRcuCellEnergyData*)( iter->fPtr);
+ tmpModuleID = cellDataPtr->fModuleID;
+ tmpRcuX = cellDataPtr->fRcuX ;
+ tmpRcuZ = cellDataPtr->fRcuZ;
- cout << "ModuleMerge*tmpPtr =" << *tmpPtr << endl;
- cout << "ModuleMerge tmpPtr =" << tmpPtr << endl;
+ for(int row = 0; row<32; row ++)
+ {
+ for(int col = 0; col < 28; col ++)
+ {
+ for(int gain=0; gain <2; gain++)
+ {
+ fMaxValues[tmpModuleID][row + 32*tmpRcuX][col + 28*tmpRcuZ][gain] = cellDataPtr->fCellEnergies[row][col][gain];
+ }
+ }
+ }
- for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
- {
- // AliHLTUInt16_t* tmpPtr = reinterpret_cast<AliHLTUInt16_t*>(blocks->fPtr);
- iter = blocks+ndx;
- // AliHLTUInt16_t *tmp = (AliHLTUInt16_t *)(iter->fPtr);
- // cout <<"AliHLTPHOSModuleMergerComponent::Equippment ID *tmp= " << *tmp << endl;
- // cout <<"AliHLTPHOSModuleMergerComponent::Equippment ID blocks->fPtr[0] = " << tmpPtr[0] << endl;
}
-
-
+
+ DumpData();
fEventCount++;
return 0;
}//end DoEvent
-
/**************************************************************************
* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
* *
#include "AliRawReaderMemory.h"
#include "AliCaloRawStream.h"
#include <cstdlib>
-//#include "TH2.h"
+#include "AliHLTPHOSRcuCellEnergyData.h"
-//#include "AliHLTTPCDefinitions.h"
const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
-//const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::outputDataType=kAliHLTVoidDataType;
-//AliHLTPHOSRawAnalyzerComponent gAliHLTPHOSRawAnalyzerComponent;
-//ClassImp(AliHLTPHOSRawAnalyzerComponent)
AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0), fPHOSRawStream(), fRawMemoryReader(0)
{
- // fRawMemoryReader = NULL;
+
}
AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent()
AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0), fPHOSRawStream(),fRawMemoryReader(0)
{
- // fRawMemoryReader = NULL;
}
AliHLTComponentDataType
AliHLTPHOSRawAnalyzerComponent::GetOutputDataType()
{
- // return AliHLTTPCDefinitions::gkUnpackedRawDataType;
return AliHLTPHOSDefinitions::gkCellEnergyDataType;
- // return outputDataType;
}
void
UInt_t offset = 0;
UInt_t mysize = 0;
UInt_t tSize = 0;
-
+ AliHLTPHOSRcuCellEnergyData* outPtr;
AliHLTUInt8_t* outBPtr;
- AliHLTUInt32_t* outPtr;
outBPtr = outputPtr;
-
const AliHLTComponentBlockData* iter = NULL;
-
unsigned long ndx;
+
Reset();
for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
}
fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
-
- // fRawMemoryReader->DumpData();
- // fRawMemoryReader->RewindEvents();
-
analyzerPtr->SetData(fTmpChannelData);
-
+
+ outPtr = (AliHLTPHOSRcuCellEnergyData*)outBPtr;
+ mysize += sizeof(AliHLTPHOSRcuCellEnergyData);
+
+ outPtr->fRcuX = fRcuX;
+ outPtr->fRcuZ = fRcuZ;
+ outPtr->fModuleID = fModuleID;
+
while(fPHOSRawStream->Next())
{
if (fPHOSRawStream->IsNewHWAddress())
analyzerPtr->SetData(fTmpChannelData);
analyzerPtr->Evaluate(0, 1008);
fMaxValues[tmpMod][tmpRow][tmpCol][tmpGain] = analyzerPtr->GetEnergy();
+ outPtr->fCellEnergies[tmpRow - fRcuRowOffeset][tmpCol - fRcuColOffeset][tmpGain] = fMaxValues[tmpMod][tmpRow][tmpCol][tmpGain];
ResetDataPtr();
}
AliHLTComponentBlockData bd;
FillBlockData( bd );
- mysize += sizeof(fEquippmentID);
-
- outPtr = ( AliHLTUInt32_t*)outBPtr;
- *outPtr = fEquippmentID;
-
- // bd.fPtr = &fEquippmentId;
bd.fOffset = offset;
bd.fSize = mysize;
-
bd.fDataType = AliHLTPHOSDefinitions::gkCellEnergyDataType;
outputBlocks.push_back( bd );
-
-
tSize += mysize;
outBPtr += mysize;
- if ( tSize > size )
+ if( tSize > size )
{
Logging( kHLTLogFatal, "HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent", "Too much data",
"Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
, tSize, size );
return EMSGSIZE;
}
-
+
}
fEventCount++;
int
AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
{
- cout << "DOINIT argc =" << argc << endl;
- cout << "DOINIT argv[0] =" << argv[0] << endl;
- cout << "DOINIT argv[1] =" << argv[1] << endl;
- cout << "DOINIT argv[2] =" << argv[2] << endl;
- cout << "DOINIT argv[3] =" << argv[3] << endl;
- cout << "DOINIT argv[4] =" << argv[4] << endl;
- cout << "DOINIT argv[5] =" << argv[5] << endl;
- cout << "DOINIT argv[6] =" << argv[6] << endl;
-
int equippmentID = atoi(argv[6]);
- cout << "The equipment ID was set to " <<equippmentID << endl;
-
- //fRawMemoryReader->SetEquipmentID(1806);
-
Reset();
- cout << "AliHLTPHOSRawAnalyzerComponent::DoInit Creating new AliRawReaderMemory()" << endl;
- //legoPlotPtr = new TH2S("Lego plot 1","Phi0 20Gev, High gain", 56*5, 0, 56*5, 64, 0, 64);
fRawMemoryReader = new AliRawReaderMemory();
fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS");
fRawMemoryReader->SetEquipmentID(equippmentID);
-
SetEquippmentID(equippmentID);
SetCoordinates(equippmentID);
-
- // cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni DONE!" << endl;
if (argc==0 && argv==NULL) {
// this is currently just to get rid of the warning "unused parameter"
}
return fEquippmentID;
}
-
void
AliHLTPHOSRawAnalyzerComponent::SetCoordinates(AliHLTUInt32_t equippmentID)
{
int rcuIndex = (fEquippmentID - 1792)%4;
- // int moduleIndex = (fEquippmentID -1792 -rcuIndex)/5;
- fModuleID = (fEquippmentID -1792 -rcuIndex)/5;
+ fModuleID = (fEquippmentID -1792 -rcuIndex)/5;
if(rcuIndex == 0)
{
fRcuX = 0;
- fRcuY = 0;
+ fRcuZ = 0;
}
if(rcuIndex == 1)
{
- fRcuX = 1;
- fRcuY = 0;
+ fRcuX = 0;
+ fRcuZ = 1;
}
if(rcuIndex == 2)
{
- fRcuX = 0;
- fRcuY = 1;
+ fRcuX = 1;
+ fRcuZ = 0;
}
- if(rcuIndex == 2)
+ if(rcuIndex == 3)
{
fRcuX = 1;
- fRcuY = 1;
+ fRcuZ = 1;
}
-// cout << "AliHLTPHOSModuleMergerComponent::SetRcuCoordinates. (fEquippmentId - 1792)%4 = " << rcuIndex << endl;
-// cout << "AliHLTPHOSModuleMergerComponent::SetRcuCoordinates. Module undex = " << moduleIndex << endl;
+ fRcuRowOffeset = 32*fRcuX;
+ fRcuColOffeset = 28*fRcuZ;
+
}