Make SetChi2 method public
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMergerComponent.cxx
CommitLineData
ec6160d5 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Jacek Otwinowski <Jacek.Otwinowski@gsi.de> *
8//* for The ALICE HLT Project. *
9//* *
10//* Permission to use, copy, modify and distribute this software and its *
11//* documentation strictly for non-commercial purposes is hereby granted *
12//* without fee, provided that the above copyright notice appears in all *
13//* copies and that both the copyright notice and this permission notice *
14//* appear in the supporting documentation. The authors make no claims *
15//* about the suitability of this software for any purpose. It is *
16//* provided "as is" without express or implied warranty. *
17//**************************************************************************
18
19/** @file AliHLTGlobalTrackMergerComponent.cxx
20 @author Jacek Otwinowski
21 @date
22 @brief HLT global track merger component.
23*/
24
ec6160d5 25#include <climits>
26#include <cassert>
ec6160d5 27#include <cstdlib>
28#include <cerrno>
29
30#include "AliESDEvent.h"
31#include "AliTracker.h"
ec6160d5 32#include "AliHLTGlobalTrackMerger.h"
ec6160d5 33#include "AliHLTGlobalTrackMergerComponent.h"
34
a7f38894 35using namespace std;
36
ec6160d5 37/** ROOT macro for the implementation of ROOT specific class methods */
18ada816 38ClassImp(AliHLTGlobalTrackMergerComponent)
ec6160d5 39
40//_____________________________________________________________________________
18ada816 41AliHLTGlobalTrackMergerComponent::AliHLTGlobalTrackMergerComponent() : AliHLTGlobalEsdConverterComponent(),
42 fGlobalTrackMerger(0)
ec6160d5 43{
44}
45
46//_____________________________________________________________________________
47AliHLTGlobalTrackMergerComponent::~AliHLTGlobalTrackMergerComponent()
48{
49 // see header file for class documentation
50}
51
52//_____________________________________________________________________________
53const char* AliHLTGlobalTrackMergerComponent::GetComponentID()
54{
55 // see header file for class documentation
56 return "GlobalTrackMerger";
57}
58
59//_____________________________________________________________________________
60void AliHLTGlobalTrackMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
61{
62 // see header file for class documentation
18ada816 63 list.push_back( kAliHLTDataTypeTrack );
ec6160d5 64}
65
66//_____________________________________________________________________________
18ada816 67// AliHLTComponentDataType AliHLTGlobalTrackMergerComponent::GetOutputDataType()
68// {
69// // see header file for class documentation
70// return kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC;
71// }
ec6160d5 72
73//_____________________________________________________________________________
18ada816 74// void AliHLTGlobalTrackMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
75// {
76// // see header file for class documentation
77// // XXX TODO: Find more realistic values.
78// constBase = 20000;
79// inputMultiplier = 1.0;
80// }
ec6160d5 81
82//_____________________________________________________________________________
83AliHLTComponent* AliHLTGlobalTrackMergerComponent::Spawn()
84{
85 // see header file for class documentation
86 return new AliHLTGlobalTrackMergerComponent;
87}
88
89//_____________________________________________________________________________
90void AliHLTGlobalTrackMergerComponent::SetMergerParameters(Double_t maxy,Double_t maxz,Double_t maxkappa,Double_t maxpsi,Double_t maxtgl)
91{
92 // see header file for class documentation
93 fGlobalTrackMerger->SetParameter( maxy, maxz, maxkappa, maxpsi, maxtgl );
94}
95
96//_____________________________________________________________________________
97int AliHLTGlobalTrackMergerComponent::DoInit( int /*argc*/, const char** /*argv*/ )
98{
99 // see header file for class documentation
18ada816 100 const char* argv = "-notree";
101 AliHLTGlobalEsdConverterComponent::DoInit(1,&argv);
102
ec6160d5 103 int iResult = 0;
104
105 // Init merger
106 fGlobalTrackMerger = new AliHLTGlobalTrackMerger();
ec6160d5 107
18ada816 108 if (!fGlobalTrackMerger ) {
ec6160d5 109 HLTError("failed creating internal objects");
110 iResult=-ENOMEM;
111 return iResult;
112 }
113
114 SetMergerParameters();
115
116 return iResult;
117}
118
119//_____________________________________________________________________________
120int AliHLTGlobalTrackMergerComponent::DoDeinit()
121{
122 // see header file for class documentation
123 if(fGlobalTrackMerger) delete fGlobalTrackMerger; fGlobalTrackMerger =0;
18ada816 124 AliHLTGlobalEsdConverterComponent::DoDeinit();
ec6160d5 125 return 0;
126}
127
128//_____________________________________________________________________________
18ada816 129int AliHLTGlobalTrackMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
130 AliHLTComponentTriggerData& /*trigData*/)
ec6160d5 131{
132 //
133 // global track merger function
134 // takes TRD and TPC tracks and merges them
135 //
136 HLTInfo("DoEvent processing data");
137
138 // see header file for class documentation
139 int iResult=0;
140
141 if(!fGlobalTrackMerger || !fESD) {
142 HLTError("component not initialized");
143 iResult=-ENOMEM;
144 return iResult;
145 }
146
18ada816 147 fESD->Reset();
148 fESD->SetMagneticField(fSolenoidBz);
149 //fESD->SetMagneticField(AliTracker::GetBz());
ec6160d5 150
accd913d 151 if ((iResult=ProcessBlocks(NULL, fESD, NULL))<0) return iResult;
18ada816 152 if(!fESD->GetNumberOfTracks()>0) return iResult;
ec6160d5 153
154 // merge tracks
155 Bool_t isMerged = fGlobalTrackMerger->Merge(fESD);
156 if(!isMerged) {
a9f060e5 157 HLTInfo("No merged tracks");
ec6160d5 158 }
159
160 // try to propagate all tracks to DCA to primary vertex
161 fGlobalTrackMerger->PropagateTracksToDCA(fESD);
162
163 // calculate specification
164 // AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( minSlice, maxSlice, 0, 5 );
165 // HLTInfo("minSlice %d, maxSlice %d", minSlice, maxSlice);
166
167 // send output data
168 //PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, iSpecification);
18ada816 169 PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
ec6160d5 170
a9f060e5 171 // clean ESD event content
ec6160d5 172 fESD->Reset();
173
174return iResult;
175}
176
177