1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
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 "AliHLTPHOSRcuDigitMakerComponent.h"
17 #include "AliHLTPHOSRcuDigitMaker.h"
19 #include "AliHLTPHOSRcuProcessor.h"
20 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
21 #include "AliHLTPHOSRcuDigitContainerDataStruct.h"
22 #include "TClonesArray.h"
25 #include <sys/types.h>
27 const AliHLTComponentDataType AliHLTPHOSRcuDigitMakerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
29 AliHLTPHOSRcuDigitMakerComponent gAliHLTPHOSRcuDigitMakerComponent;
31 AliHLTPHOSRcuDigitMakerComponent::AliHLTPHOSRcuDigitMakerComponent() :
32 AliHLTPHOSRcuProcessor(),
39 AliHLTPHOSRcuDigitMakerComponent::~AliHLTPHOSRcuDigitMakerComponent()
45 AliHLTPHOSRcuDigitMakerComponent::Deinit()
50 delete fDigitMakerPtr;
57 AliHLTPHOSRcuDigitMakerComponent::GetComponentID()
60 return "PhosRcuDigitMaker";
65 AliHLTPHOSRcuDigitMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
67 //Get datatypes for input
68 const AliHLTComponentDataType* pType=fgkInputDataTypes;
69 while (pType->fID!=0) {
70 list.push_back(*pType);
75 AliHLTComponentDataType
76 AliHLTPHOSRcuDigitMakerComponent::GetOutputDataType()
79 return AliHLTPHOSDefinitions::fgkAliHLTDigitDataType;
84 AliHLTPHOSRcuDigitMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
92 AliHLTPHOSRcuDigitMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
93 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
94 std::vector<AliHLTComponentBlockData>& outputBlocks)
101 //Int_t nRecPoints = 0;
104 //Int_t fileCount = 0;
105 Int_t digitCount = 0;
106 //char filename [50];
109 AliHLTUInt8_t* outBPtr;
111 const AliHLTComponentBlockData* iter = 0;
113 fDigitContainerPtr = (AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr;
114 //fDigitMakerPtr->SetDigitContainerStruct(fDigitContainerPtr);
115 fDigitMakerPtr->SetDigitContainerStruct((AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr);
117 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
121 if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType)
123 // cout << "Warning: data type is not fgkCellEnergyDataType " << endl;
127 digitCount = fDigitMakerPtr->MakeDigits(reinterpret_cast<AliHLTPHOSRcuCellEnergyDataStruct*>(iter->fPtr));
134 mysize += sizeof(AliHLTPHOSRcuDigitContainerDataStruct);
135 ((AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr)->fNDigits = digitCount;
136 AliHLTComponentBlockData bd;
140 bd.fDataType = AliHLTPHOSDefinitions::fgkAliHLTDigitDataType;
141 bd.fSpecification = 0xFFFFFFFF;
142 outputBlocks.push_back( bd );
149 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuDigitMakerComponent::DoEvent", "Too much data",
150 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
155 fDigitMakerPtr->Reset();
157 if(fEvtCnt % 10 == 0)
159 cout << "Event #: " << fEvtCnt << endl;
160 cout << " - Number of digits found: " << digitCount << endl;
168 AliHLTPHOSRcuDigitMakerComponent::DoInit(int argc, const char** argv )
172 fDigitMakerPtr = new AliHLTPHOSRcuDigitMaker();
174 for(int i = 0; i < argc; i++)
176 if(!strcmp("-threshold", argv[i]))
177 fDigitMakerPtr->SetDigitThreshold(atoi(argv[i+1]));
178 if(!strcmp("-presamples", argv[i]))
179 fDigitMakerPtr->SetNrPresamples(atoi(argv[i+1]));
182 //fDigitMakerPtr->SetDigitThreshold(2);
188 AliHLTPHOSRcuDigitMakerComponent::Spawn()
191 return new AliHLTPHOSRcuDigitMakerComponent();