]>
Commit | Line | Data |
---|---|---|
de0257eb | 1 | //************************************************************************** |
2 | //* This file is property of and copyright by the ALICE HLT Project * | |
3 | //* ALICE Experiment at CERN, All rights reserved. * | |
4 | //* * | |
5 | //* Primary Authors: Timur.Pocheptsov@cern.ch * | |
6 | //* for The ALICE HLT Project. * | |
7 | //* * | |
8 | //* Permission to use, copy, modify and distribute this software and its * | |
9 | //* documentation strictly for non-commercial purposes is hereby granted * | |
10 | //* without fee, provided that the above copyright notice appears in all * | |
11 | //* copies and that both the copyright notice and this permission notice * | |
12 | //* appear in the supporting documentation. The authors make no claims * | |
13 | //* about the suitability of this software for any purpose. It is * | |
14 | //* provided "as is" without express or implied warranty. * | |
15 | //************************************************************************** | |
16 | ||
17 | /** @file AliHLTGlobalVertexerComponent.h | |
18 | @author Timur Pocheptsov | |
19 | @brief Component for monitor primary vertex | |
20 | */ | |
21 | ||
22 | #include "AliESDVertex.h" | |
23 | #include "AliESDEvent.h" | |
24 | ||
25 | #include "AliHLTGlobalVertexerHistoComponent.h" | |
26 | ||
27 | ClassImp(AliHLTGlobalVertexerHistoComponent) | |
28 | ||
29 | AliHLTGlobalVertexerHistoComponent::AliHLTGlobalVertexerHistoComponent() | |
30 | : | |
31 | fPrimaryXY(), | |
32 | fPrimaryZX(), | |
33 | fPrimaryZY(), | |
34 | fSPDVertexXY(), | |
35 | fSPDVertexX(), | |
36 | fSPDVertexY(), | |
37 | fSPDVertexZ() | |
38 | { | |
39 | //Default ctor. | |
40 | fPrimaryXY.SetName("primVertexXY"); | |
41 | fPrimaryXY.SetTitle("HLT: Primary vertex distribution in XY"); | |
42 | fPrimaryXY.SetMarkerStyle(8); | |
43 | fPrimaryXY.SetMarkerSize(0.4); | |
44 | fPrimaryXY.SetYTitle("Y [cm]"); | |
45 | fPrimaryXY.SetXTitle("X [cm]"); | |
46 | fPrimaryXY.SetStats(0); | |
47 | fPrimaryXY.SetBit(TH1::kCanRebin); | |
48 | ||
49 | fPrimaryZX.SetName("primVertexZX"); | |
50 | fPrimaryZX.SetTitle("HLT: Primary vertex distribution in ZX"); | |
51 | fPrimaryZX.SetMarkerStyle(8); | |
52 | fPrimaryZX.SetMarkerSize(0.4); | |
53 | fPrimaryZX.SetYTitle("X [cm]"); | |
54 | fPrimaryZX.SetXTitle("Z [cm]"); | |
55 | fPrimaryZX.SetStats(0); | |
56 | fPrimaryZX.SetBit(TH1::kCanRebin); | |
57 | ||
58 | fPrimaryZY.SetName("primVertexZY"); | |
59 | fPrimaryZY.SetTitle("HLT: Primary vertex distribution in ZY"); | |
60 | fPrimaryZY.SetMarkerStyle(8); | |
61 | fPrimaryZY.SetMarkerSize(0.4); | |
62 | fPrimaryZY.SetYTitle("Y [cm]"); | |
63 | fPrimaryZY.SetXTitle("Z [cm]"); | |
64 | fPrimaryZY.SetStats(0); | |
65 | fPrimaryZY.SetBit(TH1::kCanRebin); | |
66 | ||
67 | ||
68 | fSPDVertexXY.SetName("spdVertexXY"); | |
69 | fSPDVertexXY.SetTitle("HLT: SPDVertex vertex distribution in XY"); | |
70 | fSPDVertexXY.SetMarkerStyle(8); | |
71 | fSPDVertexXY.SetMarkerSize(0.4); | |
72 | fSPDVertexXY.SetYTitle("Y [cm]"); | |
73 | fSPDVertexXY.SetXTitle("X [cm]"); | |
74 | fSPDVertexXY.SetStats(0); | |
75 | fSPDVertexXY.SetBit(TH1::kCanRebin); | |
76 | ||
77 | fSPDVertexX.SetName("spdVertexX"); | |
78 | fSPDVertexX.SetTitle("HLT: SPDVertex vertex distribution in X"); | |
79 | fSPDVertexX.SetMarkerStyle(8); | |
80 | fSPDVertexX.SetMarkerSize(0.4); | |
81 | fSPDVertexX.SetXTitle("X [cm]"); | |
82 | fSPDVertexX.SetStats(0); | |
83 | fSPDVertexX.SetBit(TH1::kCanRebin); | |
84 | ||
85 | fSPDVertexY.SetName("spdVertexY"); | |
86 | fSPDVertexY.SetTitle("HLT: SPDVertex vertex distribution in Y"); | |
87 | fSPDVertexY.SetMarkerStyle(8); | |
88 | fSPDVertexY.SetMarkerSize(0.4); | |
89 | fSPDVertexY.SetXTitle("Y [cm]"); | |
90 | fSPDVertexY.SetStats(0); | |
91 | fSPDVertexY.SetBit(TH1::kCanRebin); | |
92 | ||
93 | fSPDVertexZ.SetName("spdVertexZ"); | |
94 | fSPDVertexZ.SetTitle("HLT: SPDVertex vertex distribution in Z"); | |
95 | fSPDVertexZ.SetMarkerStyle(8); | |
96 | fSPDVertexZ.SetMarkerSize(0.4); | |
97 | fSPDVertexZ.SetXTitle("Z [cm]"); | |
98 | fSPDVertexZ.SetStats(0); | |
99 | fSPDVertexZ.SetBit(TH1::kCanRebin); | |
100 | } | |
101 | ||
102 | const char* AliHLTGlobalVertexerHistoComponent::GetComponentID() | |
103 | { | |
104 | //Unique component id. | |
105 | return "GlobalVertexerHisto"; | |
106 | } | |
107 | ||
108 | void AliHLTGlobalVertexerHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) | |
109 | { | |
110 | // | |
111 | list.clear(); | |
112 | list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut); | |
113 | list.push_back(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS ); | |
114 | } | |
115 | ||
116 | ||
d2831d6a | 117 | |
de0257eb | 118 | AliHLTComponentDataType AliHLTGlobalVertexerHistoComponent::GetOutputDataType() |
119 | { | |
d2831d6a | 120 | // see header file for class documentation |
121 | return kAliHLTMultipleDataType; | |
de0257eb | 122 | } |
123 | ||
d2831d6a | 124 | int AliHLTGlobalVertexerHistoComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) |
125 | ||
126 | { | |
127 | // see header file for class documentation | |
128 | tgtList.clear(); | |
129 | tgtList.push_back(kAliHLTDataTypeHistogram|kAliHLTDataOriginOut); | |
130 | tgtList.push_back(kAliHLTDataTypeHistogram|kAliHLTDataOriginITSSPD); | |
131 | return tgtList.size(); | |
132 | } | |
133 | ||
134 | ||
de0257eb | 135 | void AliHLTGlobalVertexerHistoComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) |
136 | { | |
137 | //8000 is a temporary number. Find the way to | |
138 | //estimate 3 serialized TH2F. | |
139 | constBase = GetOutputDataSize(); | |
140 | inputMultiplier = 1.; | |
141 | } | |
142 | ||
143 | AliHLTComponent* AliHLTGlobalVertexerHistoComponent::Spawn() | |
144 | { | |
145 | //Should be const, I think, but it's not. | |
146 | return new AliHLTGlobalVertexerHistoComponent; | |
147 | } | |
148 | ||
149 | int AliHLTGlobalVertexerHistoComponent::DoInit(int /*argc*/, const char** /*argv*/) | |
150 | { | |
151 | //Clear all bin contents and statistics. | |
152 | fPrimaryXY.Reset(); | |
153 | fPrimaryZX.Reset(); | |
154 | fPrimaryZY.Reset(); | |
155 | fSPDVertexXY.Reset(); | |
156 | fSPDVertexX.Reset(); | |
157 | fSPDVertexY.Reset(); | |
158 | fSPDVertexZ.Reset(); | |
159 | //Set bin numbers and axis ranges. | |
160 | fPrimaryXY.SetBins(60, -2., 2., 60, -2., 2.); | |
161 | fPrimaryZX.SetBins(60, -15., 15., 60, -2., 2.); | |
162 | fPrimaryZY.SetBins(60, -10., 10., 60, -2., 2.); | |
163 | fSPDVertexXY.SetBins(100, -2., 2., 100, -2., 2.); | |
164 | fSPDVertexX.SetBins(100, -2., 2.); | |
165 | fSPDVertexY.SetBins(100, -2., 2.); | |
166 | fSPDVertexZ.SetBins(100, -15., 15.); | |
167 | ||
168 | return 0; | |
169 | } | |
170 | ||
171 | int AliHLTGlobalVertexerHistoComponent::DoDeinit() | |
172 | { | |
173 | //Nothing to delete or "do de init" yet. | |
174 | return 0; | |
175 | } | |
176 | ||
177 | int AliHLTGlobalVertexerHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, | |
178 | const AliHLTComponentBlockData* /*blocks*/, | |
179 | AliHLTComponentTriggerData& /*trigData*/, | |
180 | AliHLTUInt8_t* /*outputPtr*/, | |
181 | AliHLTUInt32_t& size, | |
182 | AliHLTComponentBlockDataList& /*outputBlocks*/) | |
183 | { | |
184 | //Fill histogramms. | |
185 | if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) | |
186 | return 0; | |
187 | ||
188 | if (GetOutputDataSize() > size) { | |
189 | Logging(kHLTLogFatal, "HLT::AliHLTGlobalVertexerHistoComponent::DoEvent", "Too much data", | |
190 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
191 | GetOutputDataSize(), size); | |
192 | return -ENOSPC; | |
193 | } | |
194 | ||
195 | int iResult = 0; | |
196 | ||
197 | bool wasITS = 0; | |
198 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); iter != NULL; iter = GetNextInputObject() ) { | |
199 | if( AliESDVertex *vertex = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) ) ){ | |
200 | if( vertex && vertex->GetNContributors() >= 3 ){ | |
201 | fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY()); | |
202 | fSPDVertexX.Fill(vertex->GetX() ); | |
203 | fSPDVertexY.Fill(vertex->GetY() ); | |
204 | fSPDVertexZ.Fill(vertex->GetZ() ); | |
205 | wasITS = 1; | |
206 | } | |
207 | } else { | |
208 | HLTError("ITS SPD vertex object is corrupted"); | |
209 | iResult = -EINVAL; | |
210 | } | |
211 | } | |
212 | ||
213 | for (const TObject* iter = GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut); iter; iter = GetNextInputObject() ) { | |
214 | if (AliESDEvent* event = dynamic_cast<AliESDEvent*>((TObject*)iter)) { | |
215 | event->GetStdContent(); | |
216 | const AliESDVertex* vertex = event->GetPrimaryVertexTracks(); | |
217 | if (vertex && vertex->GetNContributors() >= 3) { | |
218 | fPrimaryXY.Fill(vertex->GetX(), vertex->GetY()); | |
219 | fPrimaryZX.Fill(vertex->GetZ(), vertex->GetX()); | |
220 | fPrimaryZY.Fill(vertex->GetZ(), vertex->GetY()); | |
221 | } | |
222 | if( !wasITS ){ | |
223 | vertex = event->GetPrimaryVertexSPD(); | |
224 | if( vertex && vertex->GetNContributors() >= 3 ){ | |
225 | fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY()); | |
226 | fSPDVertexX.Fill(vertex->GetX() ); | |
227 | fSPDVertexY.Fill(vertex->GetY() ); | |
228 | fSPDVertexZ.Fill(vertex->GetZ() ); | |
229 | } | |
230 | } | |
231 | } else { | |
232 | HLTError("ESD event object is corrupted"); | |
233 | iResult = -EINVAL; | |
234 | } | |
235 | } | |
236 | ||
d2831d6a | 237 | PushBack(&fPrimaryXY, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0); |
238 | PushBack(&fPrimaryZX, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0); | |
239 | PushBack(&fPrimaryZY, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0); | |
240 | ||
241 | PushBack(&fSPDVertexXY, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0); | |
242 | PushBack(&fSPDVertexX, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0); | |
243 | PushBack(&fSPDVertexY, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0); | |
244 | PushBack(&fSPDVertexZ, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0); | |
de0257eb | 245 | |
246 | return iResult; | |
247 | } | |
248 | ||
249 | int AliHLTGlobalVertexerHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
250 | { | |
251 | //Do nothing at the moment, but at least log (base class version). | |
252 | return AliHLTComponent::Reconfigure(cdbEntry, chainId); | |
253 | } | |
254 | ||
255 | unsigned long AliHLTGlobalVertexerHistoComponent::GetOutputDataSize()const | |
256 | { | |
257 | //8000 is a temporary number. Find the way to | |
258 | //estimate serialized TH2F. | |
259 | return 20000; | |
260 | } |