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)
96 cout << "AliHLTPHOSRcuDigitMakerComponent::DoEven TP1" << endl;
103 //Int_t nRecPoints = 0;
106 //Int_t fileCount = 0;
107 Int_t digitCount = 0;
108 //char filename [50];
111 AliHLTUInt8_t* outBPtr;
113 const AliHLTComponentBlockData* iter = 0;
116 cout << "AliHLTPHOSRcuDigitMakerComponent::DoEven TP2" << endl;
117 fDigitContainerPtr = (AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr;
118 //fDigitMakerPtr->SetDigitContainerStruct(fDigitContainerPtr);
119 fDigitMakerPtr->SetDigitContainerStruct((AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr);
120 cout << "AliHLTPHOSRcuDigitMakerComponent::DoEven TP3" << endl;
121 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
125 if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType)
127 // cout << "Warning: data type is not fgkCellEnergyDataType " << endl;
134 digitCount = fDigitMakerPtr->MakeDigits(reinterpret_cast<AliHLTPHOSRcuCellEnergyDataStruct*>(iter->fPtr));
141 mysize += sizeof(AliHLTPHOSRcuDigitContainerDataStruct);
142 ((AliHLTPHOSRcuDigitContainerDataStruct*)outBPtr)->fNDigits = digitCount;
143 AliHLTComponentBlockData bd;
147 bd.fDataType = AliHLTPHOSDefinitions::fgkAliHLTDigitDataType;
148 bd.fSpecification = 0xFFFFFFFF;
149 outputBlocks.push_back( bd );
156 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuDigitMakerComponent::DoEvent", "Too much data",
157 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
162 fDigitMakerPtr->Reset();
164 if(fEvtCnt % 10 == 0)
166 cout << "Event #: " << fEvtCnt << endl;
167 cout << " - Number of digits found: " << digitCount << endl;
175 AliHLTPHOSRcuDigitMakerComponent::DoInit(int argc, const char** argv )
179 fDigitMakerPtr = new AliHLTPHOSRcuDigitMaker();
181 for(int i = 0; i < argc; i++)
183 if(!strcmp("-threshold", argv[i]))
184 fDigitMakerPtr->SetDigitThreshold(atoi(argv[i+1]));
185 if(!strcmp("-presamples", argv[i]))
186 fDigitMakerPtr->SetNrPresamples(atoi(argv[i+1]));
189 //fDigitMakerPtr->SetDigitThreshold(2);
195 AliHLTPHOSRcuDigitMakerComponent::Spawn()
198 return new AliHLTPHOSRcuDigitMakerComponent();