+ // $Id$
+
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* All rights reserved. *
**************************************************************************/
#include "AliHLTPHOSDigitMakerComponent.h"
-#include "AliHLTPHOSDigitMaker.h"
-#include "TTree.h"
-#include "AliHLTPHOSProcessor.h"
-#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
-#include "AliHLTPHOSDigitContainerDataStruct.h"
+#include "AliHLTCaloDigitMaker.h"
+#include "AliHLTCaloDigitDataStruct.h"
+#include "AliHLTPHOSMapper.h"
#include "AliHLTPHOSChannelDataHeaderStruct.h"
-#include "TClonesArray.h"
+#include "AliHLTPHOSChannelDataStruct.h"
#include "TFile.h"
#include <sys/stat.h>
#include <sys/types.h>
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-const AliHLTComponentDataType AliHLTPHOSDigitMakerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
-
AliHLTPHOSDigitMakerComponent gAliHLTPHOSDigitMakerComponent;
AliHLTPHOSDigitMakerComponent::AliHLTPHOSDigitMakerComponent() :
AliHLTPHOSProcessor(),
fDigitMakerPtr(0),
fDigitContainerPtr(0)
- // fEvtCnt(0)
{
//see header file for documentation
}
+
AliHLTPHOSDigitMakerComponent::~AliHLTPHOSDigitMakerComponent()
{
//see header file for documentation
//see header file for documentation
list.clear();
list.push_back(AliHLTPHOSDefinitions::fgkChannelDataType);
-
-// const AliHLTComponentDataType* pType=fgkInputDataTypes;
-// while (pType->fID!=0) {
-// list.push_back(*pType);
-// pType++;
-// }
}
AliHLTComponentDataType
AliHLTPHOSDigitMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
{
//see header file for documentation
- constBase = sizeof(AliHLTPHOSDigitContainerDataStruct);
- inputMultiplier = 1;
+ constBase = 0;
+ inputMultiplier = (float)sizeof(AliHLTCaloDigitDataStruct)/sizeof(AliHLTPHOSChannelDataStruct) + 1;
}
int
std::vector<AliHLTComponentBlockData>& outputBlocks)
{
//see header file for documentation
- UInt_t tSize = 0;
UInt_t offset = 0;
UInt_t mysize = 0;
- Int_t digitCount = 0;
+ Int_t digitCount = 0;
+ Int_t ret = 0;
AliHLTUInt8_t* outBPtr;
outBPtr = outputPtr;
unsigned long ndx;
UInt_t specification = 0;
- AliHLTPHOSChannelDataHeaderStruct* tmpChannelData = 0;
+ AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
- fDigitMakerPtr->SetDigitContainerStruct(reinterpret_cast<AliHLTPHOSDigitContainerDataStruct*>(outputPtr));
+ // fDigitMakerPtr->SetDigitHeaderPtr(reinterpret_cast<AliHLTCaloDigitHeaderStruct*>(outputPtr));
+
+ fDigitMakerPtr->SetDigitDataPtr(reinterpret_cast<AliHLTCaloDigitDataStruct*>(outputPtr));
for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
{
HLTDebug("Data block is not of type fgkChannelDataType");
continue;
}
- if(iter == 0) continue;
- if((reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*>(iter->fPtr))->fNChannels == 0) continue;
- specification = specification|iter->fSpecification;
- tmpChannelData = reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*>(iter->fPtr);
+
+ specification |= iter->fSpecification;
+ tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
- digitCount += fDigitMakerPtr->MakeDigits(tmpChannelData);
+ ret = fDigitMakerPtr->MakeDigits(tmpChannelData, size-(digitCount*sizeof(AliHLTCaloDigitDataStruct)));
+ if(ret == -1)
+ {
+ HLTError("Trying to write over buffer size");
+ return -ENOBUFS;
+ }
+ digitCount += ret;
}
- // mysize = 0;
- //offset = tSize;
-
- mysize += sizeof(AliHLTPHOSDigitContainerDataStruct);
- (reinterpret_cast<AliHLTPHOSDigitContainerDataStruct*>(outputPtr))->fNDigits = digitCount;
- AliHLTComponentBlockData bd;
- FillBlockData( bd );
- bd.fOffset = offset;
- bd.fSize = mysize;
- bd.fDataType = AliHLTPHOSDefinitions::fgkDigitDataType;
- bd.fSpecification = specification;
- outputBlocks.push_back(bd);
-
-// tSize += mysize;
-// outputPtr += mysize;
-
- if( tSize > size )
+ mysize += digitCount*sizeof(AliHLTCaloDigitDataStruct);
+
+ HLTDebug("# of digits: %d, used memory size: %d, available size: %d", digitCount, mysize, size);
+
+ if(mysize > 0)
{
- Logging( kHLTLogFatal, "HLT::AliHLTPHOSDigitMakerComponent::DoEvent", "Too much data", "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", tSize, size );
- return EMSGSIZE;
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ bd.fOffset = offset;
+ bd.fSize = mysize;
+ bd.fDataType = AliHLTPHOSDefinitions::fgkDigitDataType;
+ bd.fSpecification = specification;
+ outputBlocks.push_back(bd);
}
fDigitMakerPtr->Reset();
{
//see header file for documentation
- fDigitMakerPtr = new AliHLTPHOSDigitMaker();
+ fDigitMakerPtr = new AliHLTCaloDigitMaker("PHOS");
+
+ AliHLTCaloMapper *mapper = new AliHLTPHOSMapper();
+ fDigitMakerPtr->SetMapper(mapper);
for(int i = 0; i < argc; i++)
{
- if(!strcmp("-rmsfilepath", argv[i]))
- {
- fDigitMakerPtr->SetDigitThresholds(argv[i+1], 3);
- }
if(!strcmp("-lowgainfactor", argv[i]))
{
fDigitMakerPtr->SetGlobalLowGainFactor(atof(argv[i+1]));
{
fDigitMakerPtr->SetGlobalHighGainFactor(atof(argv[i+1]));
}
- if(!strcmp("-digitthresholds", argv[i]))
- {
- fDigitMakerPtr->SetDigitThresholds(atof(argv[i+1]), atof(argv[i+2]));
- }
}
//fDigitMakerPtr->SetDigitThreshold(2);