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()
41 fPrimaryXY.SetName("primVertexXY");
42 fPrimaryXY.SetTitle("HLT: Primary vertex distribution in XY");
43 fPrimaryXY.SetMarkerStyle(8);
44 fPrimaryXY.SetMarkerSize(0.4);
45 fPrimaryXY.SetYTitle("Y [cm]");
46 fPrimaryXY.SetXTitle("X [cm]");
47 //fPrimaryXY.SetStats(0);
48 //fPrimaryXY.SetBit(TH1::kCanRebin);
50 fPrimaryX.SetName("primVertexX");
51 fPrimaryX.SetTitle("HLT: Primary vertex distribution in X");
52 fPrimaryX.SetMarkerStyle(8);
53 fPrimaryX.SetMarkerSize(0.4);
54 fPrimaryX.SetXTitle("X [cm]");
55 //fPrimaryX.SetStats(0);
56 //fPrimaryX.SetBit(TH1::kCanRebin);
58 fPrimaryY.SetName("primVertexY");
59 fPrimaryY.SetTitle("HLT: Primary vertex distribution in Y");
60 fPrimaryY.SetMarkerStyle(8);
61 fPrimaryY.SetMarkerSize(0.4);
62 fPrimaryY.SetXTitle("Y [cm]");
63 //fPrimaryY.SetStats(0);
64 //fPrimaryX.SetBit(TH1::kCanRebin);
66 fPrimaryZ.SetName("primVertexZ");
67 fPrimaryZ.SetTitle("HLT: Primary vertex distribution in Z");
68 fPrimaryZ.SetMarkerStyle(8);
69 fPrimaryZ.SetMarkerSize(0.4);
70 fPrimaryZ.SetXTitle("Z [cm]");
71 //fPrimaryZ.SetStats(0);
72 //fPrimaryX.SetBit(TH1::kCanRebin);
75 fSPDVertexXY.SetName("spdVertexXY");
76 fSPDVertexXY.SetTitle("HLT: SPD vertex distribution in XY");
77 fSPDVertexXY.SetMarkerStyle(8);
78 fSPDVertexXY.SetMarkerSize(0.4);
79 fSPDVertexXY.SetYTitle("Y [cm]");
80 fSPDVertexXY.SetXTitle("X [cm]");
81 fSPDVertexXY.SetStats(0);
82 //fSPDVertexXY.SetBit(TH1::kCanRebin);
84 fSPDVertexX.SetName("spdVertexX");
85 fSPDVertexX.SetTitle("HLT: SPD vertex distribution in X");
86 fSPDVertexX.SetMarkerStyle(8);
87 fSPDVertexX.SetMarkerSize(0.4);
88 fSPDVertexX.SetXTitle("X [cm]");
89 //fSPDVertexX.SetStats(0);
90 //fSPDVertexX.SetBit(TH1::kCanRebin);
92 fSPDVertexY.SetName("spdVertexY");
93 fSPDVertexY.SetTitle("HLT: SPD vertex distribution in Y");
94 fSPDVertexY.SetMarkerStyle(8);
95 fSPDVertexY.SetMarkerSize(0.4);
96 fSPDVertexY.SetXTitle("Y [cm]");
97 //fSPDVertexY.SetStats(0);
98 //fSPDVertexY.SetBit(TH1::kCanRebin);
100 fSPDVertexZ.SetName("spdVertexZ");
101 fSPDVertexZ.SetTitle("HLT: SPD vertex distribution in Z");
102 fSPDVertexZ.SetMarkerStyle(8);
103 fSPDVertexZ.SetMarkerSize(0.4);
104 fSPDVertexZ.SetXTitle("Z [cm]");
105 //fSPDVertexZ.SetStats(0);
106 //fSPDVertexZ.SetBit(TH1::kCanRebin);
109 const char* AliHLTGlobalVertexerHistoComponent::GetComponentID()
111 //Unique component id.
112 return "GlobalVertexerHisto";
115 void AliHLTGlobalVertexerHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
119 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
120 list.push_back(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS );
125 AliHLTComponentDataType AliHLTGlobalVertexerHistoComponent::GetOutputDataType()
127 // see header file for class documentation
128 return kAliHLTMultipleDataType;
131 int AliHLTGlobalVertexerHistoComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
134 // see header file for class documentation
136 tgtList.push_back(kAliHLTDataTypeHistogram|kAliHLTDataOriginOut);
137 tgtList.push_back(kAliHLTDataTypeHistogram|kAliHLTDataOriginITSSPD);
138 return tgtList.size();
142 void AliHLTGlobalVertexerHistoComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
144 //8000 is a temporary number. Find the way to
145 //estimate 3 serialized TH2F.
146 constBase = GetOutputDataSize();
147 inputMultiplier = 1.;
150 AliHLTComponent* AliHLTGlobalVertexerHistoComponent::Spawn()
152 //Should be const, I think, but it's not.
153 return new AliHLTGlobalVertexerHistoComponent;
156 int AliHLTGlobalVertexerHistoComponent::DoInit(int /*argc*/, const char** /*argv*/)
158 //Clear all bin contents and statistics.
163 fSPDVertexXY.Reset();
167 //Set bin numbers and axis ranges.
168 fPrimaryXY.SetBins(1000, -1., 1., 1000, -1., 1.);
169 fPrimaryX.SetBins( 1000, -1., 1.);
170 fPrimaryY.SetBins( 1000, -1., 1.);
171 fPrimaryZ.SetBins( 1000, -30., 30.);
172 fSPDVertexXY.SetBins(1000, -1., 1., 1000, -1., 1.);
173 fSPDVertexX.SetBins(1000, -1., 1.);
174 fSPDVertexY.SetBins(1000, -1., 1.);
175 fSPDVertexZ.SetBins(1000, -30., 30.);
180 int AliHLTGlobalVertexerHistoComponent::DoDeinit()
182 //Nothing to delete or "do de init" yet.
186 int AliHLTGlobalVertexerHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
187 const AliHLTComponentBlockData* /*blocks*/,
188 AliHLTComponentTriggerData& /*trigData*/,
189 AliHLTUInt8_t* /*outputPtr*/,
190 AliHLTUInt32_t& size,
191 AliHLTComponentBlockDataList& /*outputBlocks*/)
194 if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR))
197 if (GetOutputDataSize() > size) {
198 Logging(kHLTLogFatal, "HLT::AliHLTGlobalVertexerHistoComponent::DoEvent", "Too much data",
199 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
200 GetOutputDataSize(), size);
207 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); iter != NULL; iter = GetNextInputObject() ) {
208 if( AliESDVertex *vertex = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) ) ){
209 if( vertex && vertex->GetNContributors() >= 5 ){
210 fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY());
211 fSPDVertexX.Fill(vertex->GetX() );
212 fSPDVertexY.Fill(vertex->GetY() );
213 fSPDVertexZ.Fill(vertex->GetZ() );
217 HLTError("ITS SPD vertex object is corrupted");
222 for (const TObject* iter = GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOut); iter; iter = GetNextInputObject() ) {
223 if (AliESDEvent* event = dynamic_cast<AliESDEvent*>((TObject*)iter)) {
224 event->GetStdContent();
225 const AliESDVertex* vertex = event->GetPrimaryVertexTracks();
226 if (vertex && vertex->GetNContributors() >= 5) {
227 fPrimaryXY.Fill(vertex->GetX(), vertex->GetY());
228 fPrimaryX.Fill(vertex->GetX());
229 fPrimaryY.Fill(vertex->GetY());
230 fPrimaryZ.Fill(vertex->GetZ());
233 vertex = event->GetPrimaryVertexSPD();
234 if( vertex && vertex->GetNContributors() >= 3 ){
235 fSPDVertexXY.Fill(vertex->GetX(), vertex->GetY());
236 fSPDVertexX.Fill(vertex->GetX() );
237 fSPDVertexY.Fill(vertex->GetY() );
238 fSPDVertexZ.Fill(vertex->GetZ() );
242 HLTError("ESD event object is corrupted");
247 PushBack(&fPrimaryXY, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0);
248 PushBack(&fPrimaryZ, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0);
249 PushBack(&fPrimaryX, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0);
250 PushBack(&fPrimaryY, kAliHLTDataTypeHistogram | kAliHLTDataOriginOut, 0);
252 PushBack(&fSPDVertexXY, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0);
253 PushBack(&fSPDVertexZ, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0);
254 PushBack(&fSPDVertexX, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0);
255 PushBack(&fSPDVertexY, kAliHLTDataTypeHistogram | kAliHLTDataOriginITSSPD, 0);
260 int AliHLTGlobalVertexerHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
262 //Do nothing at the moment, but at least log (base class version).
263 return AliHLTComponent::Reconfigure(cdbEntry, chainId);
266 unsigned long AliHLTGlobalVertexerHistoComponent::GetOutputDataSize()const
268 //8000 is a temporary number. Find the way to
269 //estimate serialized TH2F.