]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSHistogramProducerComponent.cxx
New production macros (Yves)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSHistogramProducerComponent.cxx
CommitLineData
1b41ab20 1// $Id$
2
9bf87c6f 3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
6 * *
7 * Primary Authors: Oystein Djuvsland *
8 * *
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 **************************************************************************/
17
18#include "AliHLTPHOSHistogramProducerComponent.h"
19#include "AliHLTPHOSProcessor.h"
20#include "TH1D.h"
21#include "TNtuple.h"
22#include "AliHLTPHOSHistogramProducer.h"
23#include "AliHLTPHOSCaloClusterContainerStruct.h"
24
25/**
26 * @file AliHLTPHOSHistogramProducerComponent.cxx
27 * @author Oystein Djuvsland
28 * @date
29 * @brief A digit maker component for PHOS HLT
30*/
31
32// see below for class documentation
33// or
34// refer to README to build package
35// or
36// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
37
38
39const AliHLTComponentDataType AliHLTPHOSHistogramProducerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
40
41AliHLTPHOSHistogramProducerComponent gAliHLTPHOSHistogramProducerComponent;
42
43AliHLTPHOSHistogramProducerComponent::AliHLTPHOSHistogramProducerComponent() :
44 AliHLTPHOSProcessor(),
45 fClusterEnergiesHistPtr(0),
46 fMultiplicitiesHistPtr(0),
47 fClusterNtuplePtr(0),
48 fDoFillClusterEnergies(false),
49 fDoFillMultiplicities(false),
50 fDoFillNtuple(false),
51 fHistogramProducerPtr(0)
52{
53 //see header file for documentation
54}
55
56AliHLTPHOSHistogramProducerComponent::~AliHLTPHOSHistogramProducerComponent()
57{
58 //see header file for documentation
59}
60
61int
62AliHLTPHOSHistogramProducerComponent::Deinit()
63{
64 //see header file for documentation
e304ea31 65 return 0;
9bf87c6f 66}
67
68const char*
69AliHLTPHOSHistogramProducerComponent::GetComponentID()
70{
71 //see header file for documentation
72 return "PhosHistoProducer";
73}
74
75
76void
77AliHLTPHOSHistogramProducerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
78{
79 //see header file for documentation
80 list.clear();
81 list.push_back(AliHLTPHOSDefinitions::fgkChannelDataType);
82
83// const AliHLTComponentDataType* pType=fgkInputDataTypes;
84// while (pType->fID!=0) {
85// list.push_back(*pType);
86// pType++;
87// }
88}
89
90AliHLTComponentDataType
91AliHLTPHOSHistogramProducerComponent::GetOutputDataType()
92{
93 //see header file for documentation
94 return AliHLTPHOSDefinitions::fgkPhosHistDataType;
95}
96
97
98void
99AliHLTPHOSHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
100{
101 //see header file for documentation
102 constBase = 30;
103 inputMultiplier = 5;
104}
105
106// int
107// AliHLTPHOSHistogramProducerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
108// AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
109// std::vector<AliHLTComponentBlockData>& outputBlocks)
110
111int
fc7132e2 112AliHLTPHOSHistogramProducerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
e304ea31 113 AliHLTComponentTriggerData& /*trigData*/)
9bf87c6f 114
115
116{
117 //see header file for documentation
118
e304ea31 119 // UInt_t specification = 0;
9bf87c6f 120
fc7132e2 121 // AliHLTPHOSCaloClusterContainerStruct* tmpClusters = 0;
9bf87c6f 122
123 const AliHLTComponentBlockData* block = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkClusterDataType);
124
125 while(block != 0)
126 {
127 fHistogramProducerPtr->Fill(reinterpret_cast<AliHLTPHOSCaloClusterContainerStruct*>(block->fPtr));
128 block = GetNextInputBlock();
129 }
130
131 if(fDoFillClusterEnergies)
132 {
133 PushBack(fClusterEnergiesHistPtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
134 }
135 if(fDoFillMultiplicities)
136 {
137 PushBack(fMultiplicitiesHistPtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
138 }
139 if(fDoFillNtuple)
140 {
141 PushBack(fClusterNtuplePtr, AliHLTPHOSDefinitions::fgkPhosHistDataType);
142 }
143
144 return 0;
145}
146
147
148int
149AliHLTPHOSHistogramProducerComponent::DoInit(int argc, const char** argv )
150{
151 //see header file for documentation
152
153 fHistogramProducerPtr = new AliHLTPHOSHistogramProducer();
154
155 for(int i = 0; i < argc; i++)
156 {
157 if(!strcmp("-dofillclusterenergies", argv[i]))
158 {
159 fHistogramProducerPtr->SetFillClusterEnergies(true);
160 fDoFillClusterEnergies = true;
161 }
162 if(!strcmp("-dofillmultiplicities", argv[i]))
163 {
164 fHistogramProducerPtr->SetFillMultiplicities(true);
165 fDoFillMultiplicities = true;
166 }
167 if(!strcmp("-dofillntuple", argv[i]))
168 {
169 fHistogramProducerPtr->SetFillClusterNtuple(true);
170 fDoFillNtuple = true;
171 }
172 if(!strcmp("-maxntupleentries", argv[i]))
173 {
174 fHistogramProducerPtr->SetMaxNtupleEntries(atoi(argv[i+1]));
175 }
176 }
177
178 fHistogramProducerPtr->InitializeObjects();
179
180 if(fDoFillClusterEnergies)
181 {
182 fClusterEnergiesHistPtr = fHistogramProducerPtr->GetClusterEnergiesHistogram();
183 }
184 if(fDoFillMultiplicities)
185 {
186 fMultiplicitiesHistPtr = fHistogramProducerPtr->GetMultiplicitiesHistogram();
187 }
188 if(fDoFillNtuple)
189 {
190 fClusterNtuplePtr = fHistogramProducerPtr->GetClusterNtuple();
191 }
192
193 //fDigitMakerPtr->SetDigitThreshold(2);
194
195 return 0;
196}
197
198AliHLTComponent*
199AliHLTPHOSHistogramProducerComponent::Spawn()
200{
201 //see header file for documentation
202 return new AliHLTPHOSHistogramProducerComponent();
203}
204