X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FPHOS%2FAliHLTPHOSDigitMakerComponent.cxx;h=7474f5966a669e4aab35d9814b0d4e0a229a2e08;hb=ffb1ee30bf6c69b70faf231bb3727023a4bc20b6;hp=c35bc8c71b6525bc744737f56124e124129568ec;hpb=9bf87c6f79c32002e4f8b17223c587a3b09f596c;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/PHOS/AliHLTPHOSDigitMakerComponent.cxx b/HLT/PHOS/AliHLTPHOSDigitMakerComponent.cxx index c35bc8c71b6..7474f5966a6 100644 --- a/HLT/PHOS/AliHLTPHOSDigitMakerComponent.cxx +++ b/HLT/PHOS/AliHLTPHOSDigitMakerComponent.cxx @@ -1,3 +1,5 @@ + // $Id$ + /************************************************************************** * This file is property of and copyright by the ALICE HLT Project * * All rights reserved. * @@ -14,13 +16,11 @@ **************************************************************************/ #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 #include @@ -40,19 +40,17 @@ // 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 @@ -84,12 +82,6 @@ AliHLTPHOSDigitMakerComponent::GetInputDataTypes(vector //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 @@ -104,8 +96,8 @@ void 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 @@ -114,10 +106,10 @@ AliHLTPHOSDigitMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, std::vector& 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; @@ -125,9 +117,11 @@ AliHLTPHOSDigitMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, unsigned long ndx; UInt_t specification = 0; - AliHLTPHOSChannelDataHeaderStruct* tmpChannelData = 0; + AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0; - fDigitMakerPtr->SetDigitContainerStruct(reinterpret_cast(outputPtr)); + // fDigitMakerPtr->SetDigitHeaderPtr(reinterpret_cast(outputPtr)); + + fDigitMakerPtr->SetDigitDataPtr(reinterpret_cast(outputPtr)); for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) { @@ -138,34 +132,32 @@ AliHLTPHOSDigitMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, HLTDebug("Data block is not of type fgkChannelDataType"); continue; } - if(iter == 0) continue; - if((reinterpret_cast(iter->fPtr))->fNChannels == 0) continue; - specification = specification|iter->fSpecification; - tmpChannelData = reinterpret_cast(iter->fPtr); + + specification |= iter->fSpecification; + tmpChannelData = reinterpret_cast(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(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(); @@ -181,14 +173,13 @@ AliHLTPHOSDigitMakerComponent::DoInit(int argc, const char** argv ) { //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])); @@ -197,10 +188,6 @@ AliHLTPHOSDigitMakerComponent::DoInit(int argc, const char** argv ) { fDigitMakerPtr->SetGlobalHighGainFactor(atof(argv[i+1])); } - if(!strcmp("-digitthresholds", argv[i])) - { - fDigitMakerPtr->SetDigitThresholds(atof(argv[i+1]), atof(argv[i+2])); - } } //fDigitMakerPtr->SetDigitThreshold(2);