1 //**************************************************************************
2 //* This file is property of and copyright by the ALICE HLT Project *
3 //* ALICE Experiment at CERN, All rights reserved. *
5 //* Primary Authors: Timur.Pocheptsov@cern.ch *
6 //* for The ALICE HLT Project. *
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 //**************************************************************************
17 /** @file AliHLTGlobalVertexerComponent.h
18 @author Timur Pocheptsov
19 @brief Component for monitor primary vertex
22 #include "AliESDVertex.h"
23 #include "AliESDEvent.h"
25 #include "AliHLTGlobalVertexerHistoComponent.h"
27 ClassImp(AliHLTGlobalVertexerHistoComponent)
29 AliHLTGlobalVertexerHistoComponent::AliHLTGlobalVertexerHistoComponent()
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);
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);
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);
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);
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);
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);
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);
102 const char* AliHLTGlobalVertexerHistoComponent::GetComponentID()
104 //Unique component id.
105 return "GlobalVertexerHisto";
108 void AliHLTGlobalVertexerHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
112 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
113 list.push_back(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS );
117 AliHLTComponentDataType AliHLTGlobalVertexerHistoComponent::GetOutputDataType()
119 //Output are histogramms.
120 return kAliHLTDataTypeHistogram /*| kAliHLTDataOriginOut*/;
123 void AliHLTGlobalVertexerHistoComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
125 //8000 is a temporary number. Find the way to
126 //estimate 3 serialized TH2F.
127 constBase = GetOutputDataSize();
128 inputMultiplier = 1.;
131 AliHLTComponent* AliHLTGlobalVertexerHistoComponent::Spawn()
133 //Should be const, I think, but it's not.
134 return new AliHLTGlobalVertexerHistoComponent;
137 int AliHLTGlobalVertexerHistoComponent::DoInit(int /*argc*/, const char** /*argv*/)
139 //Clear all bin contents and statistics.
143 fSPDVertexXY.Reset();
147 //Set bin numbers and axis ranges.
148 fPrimaryXY.SetBins(60, -2., 2., 60, -2., 2.);
149 fPrimaryZX.SetBins(60, -15., 15., 60, -2., 2.);
150 fPrimaryZY.SetBins(60, -10., 10., 60, -2., 2.);
151 fSPDVertexXY.SetBins(100, -2., 2., 100, -2., 2.);
152 fSPDVertexX.SetBins(100, -2., 2.);
153 fSPDVertexY.SetBins(100, -2., 2.);
154 fSPDVertexZ.SetBins(100, -15., 15.);
159 int AliHLTGlobalVertexerHistoComponent::DoDeinit()
161 //Nothing to delete or "do de init" yet.
165 int AliHLTGlobalVertexerHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
166 const AliHLTComponentBlockData* /*blocks*/,
167 AliHLTComponentTriggerData& /*trigData*/,
168 AliHLTUInt8_t* /*outputPtr*/,
169 AliHLTUInt32_t& size,
170 AliHLTComponentBlockDataList& /*outputBlocks*/)
173 if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR))
176 if (GetOutputDataSize() > size) {
177 Logging(kHLTLogFatal, "HLT::AliHLTGlobalVertexerHistoComponent::DoEvent", "Too much data",
178 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
179 GetOutputDataSize(), size);
186 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); iter != NULL; iter = GetNextInputObject() ) {
187 if( AliESDVertex *vertex = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) ) ){
188 if( vertex && vertex->GetNContributors() >= 3 ){
189 fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY());
190 fSPDVertexX.Fill(vertex->GetX() );
191 fSPDVertexY.Fill(vertex->GetY() );
192 fSPDVertexZ.Fill(vertex->GetZ() );
196 HLTError("ITS SPD vertex object is corrupted");
201 for (const TObject* iter = GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut); iter; iter = GetNextInputObject() ) {
202 if (AliESDEvent* event = dynamic_cast<AliESDEvent*>((TObject*)iter)) {
203 event->GetStdContent();
204 const AliESDVertex* vertex = event->GetPrimaryVertexTracks();
205 if (vertex && vertex->GetNContributors() >= 3) {
206 fPrimaryXY.Fill(vertex->GetX(), vertex->GetY());
207 fPrimaryZX.Fill(vertex->GetZ(), vertex->GetX());
208 fPrimaryZY.Fill(vertex->GetZ(), vertex->GetY());
211 vertex = event->GetPrimaryVertexSPD();
212 if( vertex && vertex->GetNContributors() >= 3 ){
213 fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY());
214 fSPDVertexX.Fill(vertex->GetX() );
215 fSPDVertexY.Fill(vertex->GetY() );
216 fSPDVertexZ.Fill(vertex->GetZ() );
220 HLTError("ESD event object is corrupted");
225 PushBack(&fPrimaryXY, kAliHLTDataTypeHistogram, 0);
226 PushBack(&fPrimaryZX, kAliHLTDataTypeHistogram, 0);
227 PushBack(&fPrimaryZY, kAliHLTDataTypeHistogram, 0);
229 PushBack(&fSPDVertexXY, kAliHLTDataTypeHistogram, 0);
230 PushBack(&fSPDVertexX, kAliHLTDataTypeHistogram, 0);
231 PushBack(&fSPDVertexY, kAliHLTDataTypeHistogram, 0);
232 PushBack(&fSPDVertexZ, kAliHLTDataTypeHistogram, 0);
237 int AliHLTGlobalVertexerHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
239 //Do nothing at the moment, but at least log (base class version).
240 return AliHLTComponent::Reconfigure(cdbEntry, chainId);
243 unsigned long AliHLTGlobalVertexerHistoComponent::GetOutputDataSize()const
245 //8000 is a temporary number. Find the way to
246 //estimate serialized TH2F.