3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
7 * Primary Authors: Oystein Djuvsland *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
18 #include "AliHLTPHOSHistogramProducerComponent.h"
19 #include "AliHLTPHOSProcessor.h"
22 #include "AliHLTPHOSHistogramProducer.h"
23 #include "AliHLTPHOSCaloClusterContainerStruct.h"
26 * @file AliHLTPHOSHistogramProducerComponent.cxx
27 * @author Oystein Djuvsland
29 * @brief A digit maker component for PHOS HLT
32 // see below for class documentation
34 // refer to README to build package
36 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
39 const AliHLTComponentDataType AliHLTPHOSHistogramProducerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
41 AliHLTPHOSHistogramProducerComponent gAliHLTPHOSHistogramProducerComponent;
43 AliHLTPHOSHistogramProducerComponent::AliHLTPHOSHistogramProducerComponent() :
44 AliHLTPHOSProcessor(),
45 fClusterEnergiesHistPtr(0),
46 fMultiplicitiesHistPtr(0),
48 fDoFillClusterEnergies(false),
49 fDoFillMultiplicities(false),
51 fHistogramProducerPtr(0)
53 //see header file for documentation
56 AliHLTPHOSHistogramProducerComponent::~AliHLTPHOSHistogramProducerComponent()
58 //see header file for documentation
62 AliHLTPHOSHistogramProducerComponent::Deinit()
64 //see header file for documentation
69 AliHLTPHOSHistogramProducerComponent::GetComponentID()
71 //see header file for documentation
72 return "PhosHistoProducer";
77 AliHLTPHOSHistogramProducerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
79 //see header file for documentation
81 list.push_back(AliHLTPHOSDefinitions::fgkChannelDataType);
83 // const AliHLTComponentDataType* pType=fgkInputDataTypes;
84 // while (pType->fID!=0) {
85 // list.push_back(*pType);
90 AliHLTComponentDataType
91 AliHLTPHOSHistogramProducerComponent::GetOutputDataType()
93 //see header file for documentation
94 return AliHLTPHOSDefinitions::fgkPhosHistDataType;
99 AliHLTPHOSHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
101 //see header file for documentation
107 // AliHLTPHOSHistogramProducerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
108 // AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
109 // std::vector<AliHLTComponentBlockData>& outputBlocks)
112 AliHLTPHOSHistogramProducerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
113 AliHLTComponentTriggerData& /*trigData*/)
117 //see header file for documentation
119 // UInt_t specification = 0;
121 // AliHLTPHOSCaloClusterContainerStruct* tmpClusters = 0;
123 const AliHLTComponentBlockData* block = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkClusterDataType);
127 fHistogramProducerPtr->Fill(reinterpret_cast<AliHLTPHOSCaloClusterContainerStruct*>(block->fPtr));
128 block = GetNextInputBlock();
131 if(fDoFillClusterEnergies)
133 PushBack(fClusterEnergiesHistPtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
135 if(fDoFillMultiplicities)
137 PushBack(fMultiplicitiesHistPtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
141 PushBack(fClusterNtuplePtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
149 AliHLTPHOSHistogramProducerComponent::DoInit(int argc, const char** argv )
151 //see header file for documentation
153 fHistogramProducerPtr = new AliHLTPHOSHistogramProducer();
155 for(int i = 0; i < argc; i++)
157 if(!strcmp("-dofillclusterenergies", argv[i]))
159 fHistogramProducerPtr->SetFillClusterEnergies(true);
160 fDoFillClusterEnergies = true;
162 if(!strcmp("-dofillmultiplicities", argv[i]))
164 fHistogramProducerPtr->SetFillMultiplicities(true);
165 fDoFillMultiplicities = true;
167 if(!strcmp("-dofillntuple", argv[i]))
169 fHistogramProducerPtr->SetFillClusterNtuple(true);
170 fDoFillNtuple = true;
172 if(!strcmp("-maxntupleentries", argv[i]))
174 fHistogramProducerPtr->SetMaxNtupleEntries(atoi(argv[i+1]));
178 fHistogramProducerPtr->InitializeObjects();
180 if(fDoFillClusterEnergies)
182 fClusterEnergiesHistPtr = fHistogramProducerPtr->GetClusterEnergiesHistogram();
184 if(fDoFillMultiplicities)
186 fMultiplicitiesHistPtr = fHistogramProducerPtr->GetMultiplicitiesHistogram();
190 fClusterNtuplePtr = fHistogramProducerPtr->GetClusterNtuple();
193 //fDigitMakerPtr->SetDigitThreshold(2);
199 AliHLTPHOSHistogramProducerComponent::Spawn()
201 //see header file for documentation
202 return new AliHLTPHOSHistogramProducerComponent();