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