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 "AliHLTPHOSDigitMakerComponent.h"
17 #include "AliHLTPHOSDigitMaker.h"
19 #include "AliHLTPHOSProcessor.h"
20 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
21 #include "AliHLTPHOSDigitContainerDataStruct.h"
22 #include "TClonesArray.h"
25 #include <sys/types.h>
27 const AliHLTComponentDataType AliHLTPHOSDigitMakerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
29 AliHLTPHOSDigitMakerComponent gAliHLTPHOSDigitMakerComponent;
31 AliHLTPHOSDigitMakerComponent::AliHLTPHOSDigitMakerComponent() :
32 AliHLTPHOSProcessor(),
39 AliHLTPHOSDigitMakerComponent::~AliHLTPHOSDigitMakerComponent()
45 AliHLTPHOSDigitMakerComponent::Deinit()
50 delete fDigitMakerPtr;
57 AliHLTPHOSDigitMakerComponent::GetComponentID()
60 return "PhosDigitMaker";
65 AliHLTPHOSDigitMakerComponent::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 AliHLTPHOSDigitMakerComponent::GetOutputDataType()
79 return AliHLTPHOSDefinitions::fgkAliHLTDigitDataType;
84 AliHLTPHOSDigitMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
92 AliHLTPHOSDigitMakerComponent::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 = (AliHLTPHOSDigitContainerDataStruct*)outBPtr;
114 //fDigitMakerPtr->SetDigitContainerStruct(fDigitContainerPtr);
115 fDigitMakerPtr->SetDigitContainerStruct((AliHLTPHOSDigitContainerDataStruct*)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(AliHLTPHOSDigitContainerDataStruct);
135 ((AliHLTPHOSDigitContainerDataStruct*)outBPtr)->fNDigits = digitCount;
136 AliHLTComponentBlockData bd;
140 bd.fDataType = AliHLTPHOSDefinitions::fgkAliHLTDigitDataType;
141 bd.fSpecification = 0xFFFFFFFF;
142 outputBlocks.push_back( bd );
149 Logging( kHLTLogFatal, "HLT::AliHLTPHOSDigitMakerComponent::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 AliHLTPHOSDigitMakerComponent::DoInit(int argc, const char** argv )
172 fDigitMakerPtr = new AliHLTPHOSDigitMaker();
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 AliHLTPHOSDigitMakerComponent::Spawn()
191 return new AliHLTPHOSDigitMakerComponent();